0007-mac80211-backport-from-trunk-r48681.patch 1.1 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Tue, 23 Dec 2014 18:57:16 +0100
  3. Subject: mac80211: backport from trunk r48681
  4. Backport mac80211 and dependent drivers/firmwares from OpenWrt trunk.
  5. diff --git a/package/firmware/ath10k-firmware/Makefile b/package/firmware/ath10k-firmware/Makefile
  6. new file mode 100644
  7. index 0000000..882294c
  8. --- /dev/null
  9. +++ b/package/firmware/ath10k-firmware/Makefile
  10. @@ -0,0 +1,104 @@
  11. +#
  12. +# Copyright (C) 2015 OpenWrt.org
  13. +#
  14. +# This is free software, licensed under the GNU General Public License v2.
  15. +# See /LICENSE for more information.
  16. +#
  17. +
  18. +include $(TOPDIR)/rules.mk
  19. +
  20. +PKG_NAME:=ath10k-firmware
  21. +PKG_SOURCE_VERSION:=77f72b5f7dd940386d9e619a17904987759b7186
  22. +PKG_VERSION:=2014-11-13-$(PKG_SOURCE_VERSION)
  23. +PKG_RELEASE:=1
  24. +
  25. +PKG_SOURCE_PROTO:=git
  26. +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  27. +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  28. +PKG_SOURCE_URL:=https://github.com/kvalo/ath10k-firmware.git
  29. +
  30. +PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  31. +
  32. +include $(INCLUDE_DIR)/package.mk
  33. +
  34. +WMENU:=Wireless Drivers
  35. +
  36. +define Package/ath10k-firmware-default
  37. + SECTION:=kernel
  38. + CATEGORY:=Kernel modules
  39. + SUBMENU:=$(WMENU)
  40. + URL:=$(PKG_SOURCE_URL)
  41. + DEPENDS:=kmod-ath10k
  42. +endef
  43. +
  44. +define Package/ath10k-firmware-qca988x
  45. +$(Package/ath10k-firmware-default)
  46. + DEFAULT:=PACKAGE_kmod-ath10k
  47. + TITLE:=ath10k firmware for QCA988x devices
  48. +endef
  49. +
  50. +QCA988X_FIRMWARE_FILE:=firmware-5.bin_10.2.4.97-1
  51. +
  52. +define Download/ath10k-firmware-qca988x
  53. + URL:=https://www.codeaurora.org/cgit/quic/qsdk/oss/firmware/ath10k-firmware/plain/10.2.4/
  54. + FILE:=$(QCA988X_FIRMWARE_FILE)
  55. + MD5SUM:=fcb2fbd42d73a63fbf603505c718cbde
  56. +endef
  57. +$(eval $(call Download,ath10k-firmware-qca988x))
  58. +
  59. +define Package/ath10k-firmware-qca99x0
  60. +$(Package/ath10k-firmware-default)
  61. + TITLE:=ath10k firmware for QCA99x0 devices
  62. +endef
  63. +
  64. +define Package/ath10k-firmware-qca6174
  65. +$(Package/ath10k-firmware-default)
  66. + TITLE:=ath10k firmware for QCA6174 devices
  67. +endef
  68. +
  69. +QCA99X0_BOARD_REV:=ddcec9efd245da9365c474f513a855a55f3ac7fe
  70. +QCA99X0_BOARD_FILE:=board-2.bin.$(QCA99X0_BOARD_REV)
  71. +
  72. +define Download/qca99x0-board
  73. + URL:=https://www.codeaurora.org/cgit/quic/qsdk/oss/firmware/ath10k-firmware/plain/ath10k/QCA99X0/hw2.0
  74. + URL_FILE:=board-2.bin?id=ddcec9efd245da9365c474f513a855a55f3ac7fe
  75. + FILE:=$(QCA99X0_BOARD_FILE)
  76. + MD5SUM:=a2b3c653c2363a5641200051d6333d0a
  77. +endef
  78. +$(eval $(call Download,qca99x0-board))
  79. +
  80. +define Build/Compile
  81. +
  82. +endef
  83. +
  84. +define Package/ath10k-firmware-qca988x/install
  85. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
  86. + $(INSTALL_DATA) \
  87. + $(PKG_BUILD_DIR)/QCA988X/board.bin \
  88. + $(1)/lib/firmware/ath10k/QCA988X/hw2.0/
  89. + $(INSTALL_DATA) \
  90. + $(DL_DIR)/$(QCA988X_FIRMWARE_FILE) \
  91. + $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin
  92. +endef
  93. +
  94. +define Package/ath10k-firmware-qca6174/install
  95. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k
  96. + $(CP) $(PKG_BUILD_DIR)/QCA6174 $(1)/lib/firmware/ath10k/
  97. +endef
  98. +
  99. +define Package/ath10k-firmware-qca99x0/install
  100. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA99X0/hw2.0
  101. + $(INSTALL_DATA) \
  102. + $(DL_DIR)/$(QCA99X0_BOARD_FILE) \
  103. + $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board-2.bin
  104. + $(INSTALL_DATA) \
  105. + $(PKG_BUILD_DIR)/QCA99X0/hw2.0/boardData_AR900B_CUS239_5G_v2_001.bin \
  106. + $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board.bin
  107. + $(INSTALL_DATA) \
  108. + $(PKG_BUILD_DIR)/QCA99X0/hw2.0/firmware-5.bin_10.4.1.00030-1 \
  109. + $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/firmware-5.bin
  110. +endef
  111. +
  112. +$(eval $(call BuildPackage,ath10k-firmware-qca988x))
  113. +$(eval $(call BuildPackage,ath10k-firmware-qca99x0))
  114. +$(eval $(call BuildPackage,ath10k-firmware-qca6174))
  115. diff --git a/package/firmware/b43legacy-firmware/Makefile b/package/firmware/b43legacy-firmware/Makefile
  116. new file mode 100644
  117. index 0000000..ec13c7d
  118. --- /dev/null
  119. +++ b/package/firmware/b43legacy-firmware/Makefile
  120. @@ -0,0 +1,72 @@
  121. +#
  122. +# Copyright (C) 2016 OpenWrt.org
  123. +#
  124. +# This is free software, licensed under the GNU General Public License v2.
  125. +# See /LICENSE for more information.
  126. +#
  127. +
  128. +include $(TOPDIR)/rules.mk
  129. +
  130. +PKG_NAME:=b43legacy-firmware
  131. +PKG_VERSION:=3.130.20.0
  132. +PKG_RELEASE:=1
  133. +
  134. +PKG_SOURCE:=wl_apsta-$(PKG_VERSION).o
  135. +PKG_SOURCE_URL:=http://downloads.openwrt.org/sources
  136. +PKG_MD5SUM:=e08665c5c5b66beb9c3b2dd54aa80cb3
  137. +
  138. +include $(INCLUDE_DIR)/package.mk
  139. +
  140. +define Package/b43legacy-firmware
  141. + SECTION:=firmware
  142. + CATEGORY:=Firmware
  143. + URL:=$(PKG_SOURCE_URL)
  144. + TITLE:=Broadcom bcm43xx b43legacy firmware
  145. +endef
  146. +
  147. +define Package/b43legacy-firmware/config
  148. + if PACKAGE_b43legacy-firmware
  149. +
  150. + config B43LEGACY_FW_SQUASH
  151. + bool "Remove unnecessary firmware files"
  152. + default y
  153. + help
  154. + This options allows you to remove unnecessary b43legacy firmware files
  155. + from the final rootfs image. This can reduce the rootfs size by
  156. + up to 50k.
  157. +
  158. + If unsure, say Y.
  159. +
  160. + config B43LEGACY_FW_SQUASH_COREREVS
  161. + string "Core revisions to include"
  162. + depends on B43LEGACY_FW_SQUASH
  163. + default "1,2,3,4"
  164. + help
  165. + This is a comma seperated list of core revision numbers.
  166. +
  167. + Example (keep files for rev4 only):
  168. + 4
  169. +
  170. + Example (keep files for rev2 and rev4):
  171. + 2,4
  172. +
  173. + endif
  174. +endef
  175. +
  176. +define Build/Prepare
  177. + mkdir -p $(PKG_BUILD_DIR)
  178. +endef
  179. +
  180. +define Build/Compile
  181. +
  182. +endef
  183. +
  184. +define Package/b43legacy-firmware/install
  185. + $(INSTALL_DIR) $(1)/lib/firmware
  186. + b43-fwcutter --unsupported -w $(1)/lib/firmware/ $(DL_DIR)/$(PKG_SOURCE)
  187. + ifneq ($(CONFIG_B43LEGACY_FW_SQUASH),)
  188. + b43-fwsquash.py "G" "$(CONFIG_B43LEGACY_FW_SQUASH_COREREVS)" "$(1)/lib/firmware/b43legacy"
  189. + endif
  190. +endef
  191. +
  192. +$(eval $(call BuildPackage,b43legacy-firmware))
  193. diff --git a/package/firmware/ixp4xx-microcode/Makefile b/package/firmware/ixp4xx-microcode/Makefile
  194. index 52b44f3..1af1248 100644
  195. --- a/package/firmware/ixp4xx-microcode/Makefile
  196. +++ b/package/firmware/ixp4xx-microcode/Makefile
  197. @@ -1,4 +1,4 @@
  198. -#
  199. +#
  200. # Copyright (C) 2007 OpenWrt.org
  201. #
  202. # This is free software, licensed under the GNU General Public License v2.
  203. diff --git a/package/firmware/lantiq/dsl-vrx200-firmware-xdsl-a/Makefile b/package/firmware/lantiq/dsl-vrx200-firmware-xdsl-a/Makefile
  204. new file mode 100644
  205. index 0000000..e8dd659
  206. --- /dev/null
  207. +++ b/package/firmware/lantiq/dsl-vrx200-firmware-xdsl-a/Makefile
  208. @@ -0,0 +1,47 @@
  209. +# Copyright (C) 2015 OpenWrt.org
  210. +# Copyright (C) 2015 Lantiq Beteiligungs GmbH & Co KG.
  211. +#
  212. +# This is free software, licensed under the GNU General Public License v2.
  213. +# See /LICENSE for more information.
  214. +
  215. +include $(TOPDIR)/rules.mk
  216. +
  217. +PKG_NAME:=dsl_vr9_firmware_xdsl
  218. +PKG_VERSION:=05.07.04.03.00.06_05.07.01.08.00.01_osc
  219. +PKG_RELEASE:=1
  220. +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  221. +PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
  222. +PKG_MD5SUM:=4c8d9ca68dda88d3cfc0ca0fb946a63e
  223. +
  224. +include $(INCLUDE_DIR)/package.mk
  225. +
  226. +define Package/dsl-vrx200-firmware-xdsl-a
  227. + SECTION:=firmware
  228. + CATEGORY:=Firmware
  229. + TITLE:=VRX200 / VR9 CPE xDSL Annex A firmware
  230. + URL:=http://www.lantiq.com/
  231. + DEPENDS:=@TARGET_lantiq_xrx200
  232. +endef
  233. +
  234. +define Package/dsl-vrx200-firmware-xdsl-a/description
  235. + VRX200 / VR9 CPE VDSL and ADSL Annex A firmware
  236. +endef
  237. +
  238. +define Build/Prepare
  239. + rm -rf $(PKG_BUILD_DIR)
  240. + mkdir -p $(PKG_BUILD_DIR)
  241. + $(TAR) -C $(PKG_BUILD_DIR) -xzf $(DL_DIR)/$(PKG_SOURCE)
  242. +endef
  243. +
  244. +define Build/Compile
  245. +endef
  246. +
  247. +define Package/dsl-vrx200-firmware-xdsl-a/install
  248. + $(INSTALL_DIR) $(1)/lib/firmware/
  249. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/LICENSE $(1)/lib/firmware/xcpe_574306_571801.LICENSE
  250. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/xcpe_574306_571801.bin $(1)/lib/firmware/
  251. + ln -s xcpe_574306_571801.bin $(1)/lib/firmware/vdsl.bin
  252. + ln -s xcpe_574306_571801.bin $(1)/lib/firmware/adsl-a.bin
  253. +endef
  254. +
  255. +$(eval $(call BuildPackage,dsl-vrx200-firmware-xdsl-a))
  256. diff --git a/package/firmware/lantiq/dsl-vrx200-firmware-xdsl-b/Makefile b/package/firmware/lantiq/dsl-vrx200-firmware-xdsl-b/Makefile
  257. new file mode 100644
  258. index 0000000..c283da2
  259. --- /dev/null
  260. +++ b/package/firmware/lantiq/dsl-vrx200-firmware-xdsl-b/Makefile
  261. @@ -0,0 +1,47 @@
  262. +# Copyright (C) 2015 OpenWrt.org
  263. +# Copyright (C) 2015 Lantiq Beteiligungs GmbH & Co KG.
  264. +#
  265. +# This is free software, licensed under the GNU General Public License v2.
  266. +# See /LICENSE for more information.
  267. +
  268. +include $(TOPDIR)/rules.mk
  269. +
  270. +PKG_NAME:=dsl_vr9_firmware_xdsl
  271. +PKG_VERSION:=05.07.03.03.00.06_05.07.01.0C.00.02_osc
  272. +PKG_RELEASE:=1
  273. +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  274. +PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
  275. +PKG_MD5SUM:=af5581836cbe574574590c046fe45bab
  276. +
  277. +include $(INCLUDE_DIR)/package.mk
  278. +
  279. +define Package/dsl-vrx200-firmware-xdsl-b
  280. + SECTION:=firmware
  281. + CATEGORY:=Firmware
  282. + TITLE:=VRX200 / VR9 CPE xDSL Annex B firmware
  283. + URL:=http://www.lantiq.com/
  284. + DEPENDS:=@TARGET_lantiq_xrx200
  285. +endef
  286. +
  287. +define Package/dsl-vrx200-firmware-xdsl-b/description
  288. + VRX200 / VR9 CPE VDSL and ADSL Annex B firmware
  289. +endef
  290. +
  291. +define Build/Prepare
  292. + rm -rf $(PKG_BUILD_DIR)
  293. + mkdir -p $(PKG_BUILD_DIR)
  294. + $(TAR) -C $(PKG_BUILD_DIR) -xzf $(DL_DIR)/$(PKG_SOURCE)
  295. +endef
  296. +
  297. +define Build/Compile
  298. +endef
  299. +
  300. +define Package/dsl-vrx200-firmware-xdsl-b/install
  301. + $(INSTALL_DIR) $(1)/lib/firmware/
  302. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/LICENSE $(1)/lib/firmware/xcpe_573306_571C02.LICENSE
  303. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/xcpe_573306_571C02.bin $(1)/lib/firmware/
  304. + ln -s xcpe_573306_571C02.bin $(1)/lib/firmware/vdsl.bin
  305. + ln -s xcpe_573306_571C02.bin $(1)/lib/firmware/adsl-b.bin
  306. +endef
  307. +
  308. +$(eval $(call BuildPackage,dsl-vrx200-firmware-xdsl-b))
  309. diff --git a/package/firmware/linux-firmware/Makefile b/package/firmware/linux-firmware/Makefile
  310. index 015aff7..2fcd93b 100644
  311. --- a/package/firmware/linux-firmware/Makefile
  312. +++ b/package/firmware/linux-firmware/Makefile
  313. @@ -8,56 +8,33 @@
  314. include $(TOPDIR)/rules.mk
  315. PKG_NAME:=linux-firmware
  316. -PKG_SOURCE_VERSION:=f8c22c692bdee57a20b092e647464ff6176df3ed
  317. -PKG_VERSION:=2014-03-16-$(PKG_SOURCE_VERSION)
  318. +PKG_SOURCE_VERSION:=52442afee9907bc32a058f22bb3295d040677c26
  319. +PKG_VERSION:=2016-01-25-$(PKG_SOURCE_VERSION)
  320. PKG_RELEASE:=1
  321. PKG_SOURCE_PROTO:=git
  322. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  323. -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  324. +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
  325. +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
  326. PKG_SOURCE_URL:=git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
  327. PKG_MIRROR_MD5SUM:=ca4d289ad9380471cae376fc7dd3660a
  328. PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  329. -include $(INCLUDE_DIR)/package.mk
  330. -
  331. -define Package/r8169-firmware
  332. - SECTION:=firmware
  333. - CATEGORY:=Firmware
  334. - URL:=http://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git
  335. - TITLE:=RealTek r8169 firmware
  336. -endef
  337. -
  338. -define Build/Compile
  339. +SCAN_DEPS = *.mk
  340. -endef
  341. -
  342. -define Package/r8169-firmware/install
  343. - $(INSTALL_DIR) $(1)/lib/firmware/rtl_nic
  344. - $(CP) \
  345. - $(PKG_BUILD_DIR)/rtl_nic/* \
  346. - $(1)/lib/firmware/rtl_nic
  347. -endef
  348. -
  349. -$(eval $(call BuildPackage,r8169-firmware))
  350. +include $(INCLUDE_DIR)/package.mk
  351. -define Package/r8188eu-firmware
  352. +define Package/firmware-default
  353. SECTION:=firmware
  354. CATEGORY:=Firmware
  355. URL:=http://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git
  356. - TITLE:=RealTek r8188eu firmware
  357. + TITLE:=$(1)
  358. endef
  359. define Build/Compile
  360. endef
  361. -define Package/r8188eu-firmware/install
  362. - $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  363. - $(CP) \
  364. - $(PKG_BUILD_DIR)/rtlwifi/rtl8188eufw.bin \
  365. - $(1)/lib/firmware/rtlwifi
  366. -endef
  367. -
  368. -$(eval $(call BuildPackage,r8188eu-firmware))
  369. +include $(wildcard ./*.mk)
  370. +#$(eval $(call BuildPackage,linux-firmware))
  371. diff --git a/package/firmware/linux-firmware/broadcom.mk b/package/firmware/linux-firmware/broadcom.mk
  372. new file mode 100644
  373. index 0000000..659dc82
  374. --- /dev/null
  375. +++ b/package/firmware/linux-firmware/broadcom.mk
  376. @@ -0,0 +1,45 @@
  377. +Package/brcmfmac-firmware-pcie = $(call Package/firmware-default,Broadcom BCM43xx fullmac PCIe firmware)
  378. +define Package/brcmfmac-firmware-pcie/install
  379. + $(INSTALL_DIR) $(1)/lib/firmware/brcm
  380. + $(INSTALL_DATA) \
  381. + $(PKG_BUILD_DIR)/brcm/brcmfmac43602-pcie.ap.bin \
  382. + $(1)/lib/firmware/brcm/brcmfmac43602-pcie.bin
  383. + $(INSTALL_DATA) \
  384. + $(PKG_BUILD_DIR)/brcm/brcmfmac4366b-pcie.bin \
  385. + $(1)/lib/firmware/brcm/
  386. +endef
  387. +$(eval $(call BuildPackage,brcmfmac-firmware-pcie))
  388. +
  389. +Package/brcmfmac-firmware-sdio = $(call Package/firmware-default,Broadcom BCM43xx fullmac SDIO firmware)
  390. +define Package/brcmfmac-firmware-sdio/install
  391. + $(INSTALL_DIR) $(1)/lib/firmware/brcm
  392. + $(INSTALL_DATA) \
  393. + $(PKG_BUILD_DIR)/brcm/brcmfmac4329-sdio.bin \
  394. + $(1)/lib/firmware/brcm/brcmfmac4329-sdio.bin
  395. + $(INSTALL_DATA) \
  396. + $(PKG_BUILD_DIR)/brcm/brcmfmac43362-sdio.bin \
  397. + $(1)/lib/firmware/brcm/brcmfmac43362-sdio.bin
  398. +endef
  399. +$(eval $(call BuildPackage,brcmfmac-firmware-sdio))
  400. +
  401. +Package/brcmfmac-firmware-usb = $(call Package/firmware-default,Broadcom BCM43xx fullmac USB firmware)
  402. +define Package/brcmfmac-firmware-usb/install
  403. + $(INSTALL_DIR) $(1)/lib/firmware/brcm
  404. + $(INSTALL_DATA) \
  405. + $(PKG_BUILD_DIR)/brcm/brcmfmac43236b.bin \
  406. + $(1)/lib/firmware/brcm/
  407. + $(INSTALL_DATA) \
  408. + $(PKG_BUILD_DIR)/brcm/brcmfmac43143.bin \
  409. + $(1)/lib/firmware/brcm/
  410. +endef
  411. +$(eval $(call BuildPackage,brcmfmac-firmware-usb))
  412. +
  413. +Package/brcmsmac-firmware = $(call Package/firmware-default,Broadcom BCM43xx softmac PCIe firmware)
  414. +define Package/brcmsmac-firmware/install
  415. + $(INSTALL_DIR) $(1)/lib/firmware/brcm
  416. + $(INSTALL_DATA) \
  417. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/brcm/bcm43xx-0.fw \
  418. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/brcm/bcm43xx_hdr-0.fw \
  419. + $(1)/lib/firmware/brcm/
  420. +endef
  421. +$(eval $(call BuildPackage,brcmsmac-firmware))
  422. diff --git a/package/firmware/linux-firmware/intel.mk b/package/firmware/linux-firmware/intel.mk
  423. new file mode 100644
  424. index 0000000..f5adfaf
  425. --- /dev/null
  426. +++ b/package/firmware/linux-firmware/intel.mk
  427. @@ -0,0 +1,192 @@
  428. +Package/ibt-firmware = $(call Package/firmware-default,Intel bluetooth firmware)
  429. +define Package/ibt-firmware/install
  430. + $(INSTALL_DIR) $(1)/lib/firmware/intel
  431. + $(CP) \
  432. + $(PKG_BUILD_DIR)/intel/*.bseq \
  433. + $(1)/lib/firmware/intel
  434. +endef
  435. +$(eval $(call BuildPackage,ibt-firmware))
  436. +
  437. +Package/iwl3945-firmware = $(call Package/firmware-default,Intel IWL3945 firmware)
  438. +define Package/iwl3945-firmware/install
  439. + $(INSTALL_DIR) $(1)/lib/firmware
  440. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-3945-2.ucode $(1)/lib/firmware
  441. +endef
  442. +$(eval $(call BuildPackage,iwl3945-firmware))
  443. +
  444. +Package/iwl4965-firmware = $(call Package/firmware-default,Intel IWL4965 firmware)
  445. +define Package/iwl4965-firmware/install
  446. + $(INSTALL_DIR) $(1)/lib/firmware
  447. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-4965-2.ucode $(1)/lib/firmware
  448. +endef
  449. +$(eval $(call BuildPackage,iwl4965-firmware))
  450. +
  451. +Package/iwlwifi-firmware = $(call Package/firmware-default,Intel wireless firmware)
  452. +define Package/iwlwifi-firmware/config
  453. + if PACKAGE_iwlwifi-firmware
  454. + config IWL100_FW
  455. + bool "Intel 100 Firmware"
  456. + default y
  457. + help
  458. + Download and install firmware for:
  459. + Intel Centrino Wireless-N 100
  460. +
  461. + config IWL1000_FW
  462. + bool "Intel 1000 Firmware"
  463. + default y
  464. + help
  465. + Download and install firmware for:
  466. + Intel Centrino Wireless-N 1000
  467. +
  468. + config IWL105_FW
  469. + bool "Intel 105 Firmware"
  470. + default y
  471. + help
  472. + Download and install firmware for:
  473. + Intel Centrino Wireless-N 105
  474. +
  475. + config IWL135_FW
  476. + bool "Intel 135 Firmware"
  477. + default y
  478. + help
  479. + Download and install firmware for:
  480. + Intel Centrino Wireless-N 135
  481. +
  482. + config IWL2000_FW
  483. + bool "Intel 2000 Firmware"
  484. + default y
  485. + help
  486. + Download and install firmware for:
  487. + Intel Centrino Wireless-N 2200
  488. +
  489. + config IWL2030_FW
  490. + bool "Intel 2030 Firmware"
  491. + default y
  492. + help
  493. + Download and install firmware for:
  494. + Intel Centrino Wireless-N 2230
  495. +
  496. + config IWL3160_FW
  497. + bool "Intel 3160 Firmware"
  498. + default y
  499. + help
  500. + Download and install firmware for:
  501. + Intel Wireless WiFi 3160
  502. +
  503. + config IWL5000_FW
  504. + bool "Intel 5000 Firmware"
  505. + default y
  506. + help
  507. + Download and install firmware for:
  508. + Intel Wireless WiFi 5100AGN, 5300AGN, and 5350AGN
  509. +
  510. + config IWL5150_FW
  511. + bool "Intel 5150 Firmware"
  512. + default y
  513. + help
  514. + Download and install firmware for:
  515. + Intel Wireless WiFi 5150AGN
  516. +
  517. + config IWL6000_FW
  518. + bool "Intel 6000 Firmware"
  519. + default y
  520. + help
  521. + Download and install firmware for:
  522. + Intel Centrino Ultimate-N 6300 and Advanced-N 6200
  523. +
  524. + config IWL6005_FW
  525. + bool "Intel 6005 Firmware"
  526. + default y
  527. + help
  528. + Download and install firmware for:
  529. + Intel Centrino Advanced-N 6205
  530. +
  531. + config IWL6030_FW
  532. + bool "Intel 6030 Firmware"
  533. + default y
  534. + help
  535. + Download and install firmware for:
  536. + Intel Centrino Advanced-N 6230, Wireless-N 1030, Wireless-N 130 and Advanced-N 6235
  537. +
  538. + config IWL6050_FW
  539. + bool "Intel 6050 Firmware"
  540. + default y
  541. + help
  542. + Download and install firmware for:
  543. + Intel Centrino Advanced-N + WiMAX 6250 and Wireless-N + WiMAX 6150
  544. +
  545. + config IWL7260_FW
  546. + bool "Intel 7260 Firmware"
  547. + default y
  548. + help
  549. + Download and install firmware for:
  550. + Intel Dual Band Wireless-N 7260 and Intel Dual Band Wireless-AC 7260
  551. +
  552. + config IWL7265_FW
  553. + bool "Intel 7265 Firmware"
  554. + default y
  555. + help
  556. + Download and install firmware for:
  557. + Intel Wireless 7265, 7265D, 3165
  558. +
  559. + config IWL8000_FW
  560. + bool "Intel 8000 Series Firmware"
  561. + default y
  562. + help
  563. + Download and install firmware for:
  564. + Intel Wireless Series 8260, 4165
  565. + endif
  566. +endef
  567. +define Package/iwlwifi-firmware/install
  568. + $(INSTALL_DIR) $(1)/lib/firmware
  569. +ifneq ($(CONFIG_IWL100_FW),)
  570. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-100-5.ucode $(1)/lib/firmware
  571. +endif
  572. +ifneq ($(CONFIG_IWL1000_FW),)
  573. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-1000-5.ucode $(1)/lib/firmware
  574. +endif
  575. +ifneq ($(CONFIG_IWL105_FW),)
  576. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-105-6.ucode $(1)/lib/firmware
  577. +endif
  578. +ifneq ($(CONFIG_IWL135_FW),)
  579. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-135-6.ucode $(1)/lib/firmware
  580. +endif
  581. +ifneq ($(CONFIG_IWL2000_FW),)
  582. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-2000-6.ucode $(1)/lib/firmware
  583. +endif
  584. +ifneq ($(CONFIG_IWL2030_FW),)
  585. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-2030-6.ucode $(1)/lib/firmware
  586. +endif
  587. +ifneq ($(CONFIG_IWL3160_FW),)
  588. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-3160-16.ucode $(1)/lib/firmware
  589. +endif
  590. +ifneq ($(CONFIG_IWL5000_FW),)
  591. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-5000-5.ucode $(1)/lib/firmware
  592. +endif
  593. +ifneq ($(CONFIG_IWL5150_FW),)
  594. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-5150-2.ucode $(1)/lib/firmware
  595. +endif
  596. +ifneq ($(CONFIG_IWL6000_FW),)
  597. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-6000-4.ucode $(1)/lib/firmware
  598. +endif
  599. +ifneq ($(CONFIG_IWL6005_FW),)
  600. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-6000g2a-6.ucode $(1)/lib/firmware
  601. +endif
  602. +ifneq ($(CONFIG_IWL6030_FW),)
  603. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-6000g2b-6.ucode $(1)/lib/firmware
  604. +endif
  605. +ifneq ($(CONFIG_IWL6050_FW),)
  606. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-6050-5.ucode $(1)/lib/firmware
  607. +endif
  608. +ifneq ($(CONFIG_IWL7260_FW),)
  609. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-7260-16.ucode $(1)/lib/firmware
  610. +endif
  611. +ifneq ($(CONFIG_IWL7265_FW),)
  612. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-7265-16.ucode $(1)/lib/firmware
  613. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-7265D-16.ucode $(1)/lib/firmware
  614. +endif
  615. +ifneq ($(CONFIG_IWL8000_FW),)
  616. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-8000C-16.ucode $(1)/lib/firmware
  617. +endif
  618. +endef
  619. +$(eval $(call BuildPackage,iwlwifi-firmware))
  620. diff --git a/package/firmware/linux-firmware/marvell.mk b/package/firmware/linux-firmware/marvell.mk
  621. new file mode 100644
  622. index 0000000..86c0e6f
  623. --- /dev/null
  624. +++ b/package/firmware/linux-firmware/marvell.mk
  625. @@ -0,0 +1,46 @@
  626. +Package/mwl8k-firmware = $(call Package/firmware-default,Marvell 8366/8687 firmware)
  627. +define Package/mwl8k-firmware/install
  628. + $(INSTALL_DIR) $(1)/lib/firmware/mwl8k
  629. + $(INSTALL_DATA) \
  630. + $(PKG_BUILD_DIR)/mwl8k/fmimage_8366_ap-3.fw \
  631. + $(PKG_BUILD_DIR)/mwl8k/fmimage_8366.fw \
  632. + $(PKG_BUILD_DIR)/mwl8k/helper_8366.fw \
  633. + $(PKG_BUILD_DIR)/mwl8k/fmimage_8687.fw \
  634. + $(PKG_BUILD_DIR)/mwl8k/helper_8687.fw \
  635. + $(1)/lib/firmware/mwl8k/
  636. +endef
  637. +$(eval $(call BuildPackage,mwl8k-firmware))
  638. +
  639. +Package/mwifiex-pcie-firmware = $(call Package/firmware-default,Marvell 8897 firmware)
  640. +define Package/mwifiex-pcie-firmware/install
  641. + $(INSTALL_DIR) $(1)/lib/firmware/mrvl
  642. + $(INSTALL_DATA) \
  643. + $(PKG_BUILD_DIR)/mrvl/pcie8897_uapsta.bin \
  644. + $(1)/lib/firmware/mrvl/
  645. +endef
  646. +$(eval $(call BuildPackage,mwifiex-pcie-firmware))
  647. +
  648. +Package/libertas-usb-firmware = $(call Package/firmware-default,Marvell 8388/8682 USB firmware)
  649. +define Package/libertas-usb-firmware/install
  650. + $(INSTALL_DIR) $(1)/lib/firmware/libertas
  651. + $(INSTALL_DATA) \
  652. + $(PKG_BUILD_DIR)/libertas/usb8388_v9.bin \
  653. + $(PKG_BUILD_DIR)/libertas/usb8682.bin \
  654. + $(1)/lib/firmware/libertas/
  655. +endef
  656. +$(eval $(call BuildPackage,libertas-usb-firmware))
  657. +
  658. +Package/libertas-sdio-firmware = $(call Package/firmware-default,Marvell 8385/8686/8688 SDIO firmware)
  659. +define Package/libertas-sdio-firmware/install
  660. + $(INSTALL_DIR) $(1)/lib/firmware/libertas
  661. + $(INSTALL_DATA) \
  662. + $(PKG_BUILD_DIR)/libertas/sd8385_helper.bin \
  663. + $(PKG_BUILD_DIR)/libertas/sd8385.bin \
  664. + $(PKG_BUILD_DIR)/libertas/sd8686_v9_helper.bin \
  665. + $(PKG_BUILD_DIR)/libertas/sd8686_v9.bin \
  666. + $(PKG_BUILD_DIR)/libertas/sd8688_helper.bin \
  667. + $(PKG_BUILD_DIR)/libertas/sd8688.bin \
  668. + $(1)/lib/firmware/libertas
  669. +endef
  670. +$(eval $(call BuildPackage,libertas-sdio-firmware))
  671. +
  672. diff --git a/package/firmware/linux-firmware/mediatek.mk b/package/firmware/linux-firmware/mediatek.mk
  673. new file mode 100644
  674. index 0000000..591ffee
  675. --- /dev/null
  676. +++ b/package/firmware/linux-firmware/mediatek.mk
  677. @@ -0,0 +1,43 @@
  678. +Package/mt7601u-firmware = $(call Package/firmware-default,MediaTek MT7601U firmware)
  679. +define Package/mt7601u-firmware/install
  680. + $(INSTALL_DIR) $(1)/lib/firmware
  681. + $(INSTALL_DATA) \
  682. + $(PKG_BUILD_DIR)/mt7601u.bin \
  683. + $(1)/lib/firmware
  684. +endef
  685. +$(eval $(call BuildPackage,mt7601u-firmware))
  686. +
  687. +Package/rt2800-pci-firmware = $(call Package/firmware-default,Ralink RT28xx/3xxx PCI/SoC firmware)
  688. +define Package/rt2800-pci-firmware/install
  689. + $(INSTALL_DIR) $(1)/lib/firmware
  690. + $(INSTALL_DATA) \
  691. + $(PKG_BUILD_DIR)/rt2860.bin \
  692. + $(PKG_BUILD_DIR)/rt3290.bin \
  693. + $(1)/lib/firmware
  694. +endef
  695. +$(eval $(call BuildPackage,rt2800-pci-firmware))
  696. +
  697. +Package/rt2800-usb-firmware = $(call Package/firmware-default,Ralink RT28xx/3xxx USB firmware)
  698. +define Package/rt2800-usb-firmware/install
  699. + $(INSTALL_DIR) $(1)/lib/firmware
  700. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rt2870.bin $(1)/lib/firmware/
  701. +endef
  702. +$(eval $(call BuildPackage,rt2800-usb-firmware))
  703. +
  704. +Package/rt61-pci-firmware = $(call Package/firmware-default,Ralink RT2561 firmware)
  705. +define Package/rt61-pci-firmware/install
  706. + $(INSTALL_DIR) $(1)/lib/firmware
  707. + $(INSTALL_DATA) \
  708. + $(PKG_BUILD_DIR)/rt2561.bin \
  709. + $(PKG_BUILD_DIR)/rt2561s.bin \
  710. + $(PKG_BUILD_DIR)/rt2661.bin \
  711. + $(1)/lib/firmware/
  712. +endef
  713. +$(eval $(call BuildPackage,rt61-pci-firmware))
  714. +
  715. +Package/rt73-pci-firmware = $(call Package/firmware-default,Ralink RT2573 firmware)
  716. +define Package/rt73-usb-firmware/install
  717. + $(INSTALL_DIR) $(1)/lib/firmware
  718. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rt73.bin $(1)/lib/firmware/
  719. +endef
  720. +$(eval $(call BuildPackage,rt73-pci-firmware))
  721. diff --git a/package/firmware/linux-firmware/qca.mk b/package/firmware/linux-firmware/qca.mk
  722. new file mode 100644
  723. index 0000000..7ad27ef
  724. --- /dev/null
  725. +++ b/package/firmware/linux-firmware/qca.mk
  726. @@ -0,0 +1,25 @@
  727. +Package/ar3k-firmware = $(call Package/firmware-default,ath3k firmware)
  728. +define Package/ar3k-firmware/install
  729. + $(INSTALL_DIR) $(1)/lib/firmware/ar3k
  730. + $(CP) \
  731. + $(PKG_BUILD_DIR)/ar3k/*.dfu \
  732. + $(1)/lib/firmware/ar3k
  733. +endef
  734. +$(eval $(call BuildPackage,ar3k-firmware))
  735. +
  736. +Package/ath9k-htc-firmware = $(call Package/firmware-default,AR9271/AR7010 firmware)
  737. +define Package/ath9k-htc-firmware/install
  738. + $(INSTALL_DIR) $(1)/lib/firmware/ath9k_htc
  739. + $(INSTALL_DATA) \
  740. + $(PKG_BUILD_DIR)/ath9k_htc/htc_9271-1.4.0.fw \
  741. + $(PKG_BUILD_DIR)/ath9k_htc/htc_7010-1.4.0.fw \
  742. + $(1)/lib/firmware/ath9k_htc
  743. +endef
  744. +$(eval $(call BuildPackage,ath9k-htc-firmware))
  745. +
  746. +Package/carl9170-firmware = $(call Package/firmware-default,AR9170 firmware)
  747. +define Package/carl9170-firmware/install
  748. + $(INSTALL_DIR) $(1)/lib/firmware
  749. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/carl9170-1.fw $(1)/lib/firmware
  750. +endef
  751. +$(eval $(call BuildPackage,carl9170-firmware))
  752. diff --git a/package/firmware/linux-firmware/realtek.mk b/package/firmware/linux-firmware/realtek.mk
  753. new file mode 100644
  754. index 0000000..0f8b1ce
  755. --- /dev/null
  756. +++ b/package/firmware/linux-firmware/realtek.mk
  757. @@ -0,0 +1,50 @@
  758. +Package/r8169-firmware = $(call Package/firmware-default,RealTek RTL8169 firmware)
  759. +define Package/r8169-firmware/install
  760. + $(INSTALL_DIR) $(1)/lib/firmware/rtl_nic
  761. + $(CP) \
  762. + $(PKG_BUILD_DIR)/rtl_nic/* \
  763. + $(1)/lib/firmware/rtl_nic
  764. +endef
  765. +$(eval $(call BuildPackage,r8169-firmware))
  766. +
  767. +Package/r8188eu-firmware = $(call Package/firmware-default,RealTek RTL8188EU firmware)
  768. +define Package/r8188eu-firmware/install
  769. + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  770. + $(CP) \
  771. + $(PKG_BUILD_DIR)/rtlwifi/rtl8188eufw.bin \
  772. + $(1)/lib/firmware/rtlwifi
  773. +endef
  774. +$(eval $(call BuildPackage,r8188eu-firmware))
  775. +
  776. +Package/rtl8192ce-firmware = $(call Package/firmware-default,RealTek RTL8192CE firmware)
  777. +define Package/rtl8192ce-firmware/install
  778. + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  779. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8192cfw.bin $(1)/lib/firmware/rtlwifi
  780. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8192cfwU.bin $(1)/lib/firmware/rtlwifi
  781. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8192cfwU_B.bin $(1)/lib/firmware/rtlwifi
  782. +endef
  783. +$(eval $(call BuildPackage,rtl8192ce-firmware))
  784. +
  785. +Package/rtl8192cu-firmware = $(call Package/firmware-default,RealTek RTL8192CU firmware)
  786. +define Package/rtl8192cu-firmware/install
  787. + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  788. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8192cufw.bin $(1)/lib/firmware/rtlwifi
  789. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8192cufw_A.bin $(1)/lib/firmware/rtlwifi
  790. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8192cufw_B.bin $(1)/lib/firmware/rtlwifi
  791. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8192cufw_TMSC.bin $(1)/lib/firmware/rtlwifi
  792. +endef
  793. +$(eval $(call BuildPackage,rtl8192cu-firmware))
  794. +
  795. +Package/rtl8192de-firmware = $(call Package/firmware-default,RealTek RTL8192DE firmware)
  796. +define Package/rtl8192de-firmware/install
  797. + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  798. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8192defw.bin $(1)/lib/firmware/rtlwifi
  799. +endef
  800. +$(eval $(call BuildPackage,rtl8192de-firmware))
  801. +
  802. +Package/rtl8192se-firmware = $(call Package/firmware-default,RealTek RTL8192SE firmware)
  803. +define KernelPackage/rtl8192se/install
  804. + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  805. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8192sefw.bin $(1)/lib/firmware/rtlwifi
  806. +endef
  807. +$(eval $(call BuildPackage,rtl8192se-firmware))
  808. diff --git a/package/firmware/linux-firmware/ti.mk b/package/firmware/linux-firmware/ti.mk
  809. new file mode 100644
  810. index 0000000..a1e12fc
  811. --- /dev/null
  812. +++ b/package/firmware/linux-firmware/ti.mk
  813. @@ -0,0 +1,25 @@
  814. +Package/wl12xx-firmware = $(call Package/firmware-default,TI WL12xx firmware)
  815. +define Package/wl12xx-firmware/install
  816. + $(INSTALL_DIR) $(1)/lib/firmware/ti-connectivity
  817. + $(INSTALL_DATA) \
  818. + $(PKG_BUILD_DIR)/ti-connectivity/wl127x-fw-5-mr.bin \
  819. + $(PKG_BUILD_DIR)/ti-connectivity/wl127x-fw-5-plt.bin \
  820. + $(PKG_BUILD_DIR)/ti-connectivity/wl127x-fw-5-sr.bin \
  821. + $(PKG_BUILD_DIR)/ti-connectivity/wl1271-nvs.bin \
  822. + $(PKG_BUILD_DIR)/ti-connectivity/wl128x-fw-5-mr.bin \
  823. + $(PKG_BUILD_DIR)/ti-connectivity/wl128x-fw-5-plt.bin \
  824. + $(PKG_BUILD_DIR)/ti-connectivity/wl128x-fw-5-sr.bin \
  825. + $(PKG_BUILD_DIR)/ti-connectivity/wl128x-nvs.bin \
  826. + $(1)/lib/firmware/ti-connectivity
  827. +endef
  828. +$(eval $(call BuildPackage,wl12xx-firmware))
  829. +
  830. +Package/wl18xx-firmware = $(call Package/firmware-default,TI WL18xx firmware)
  831. +define Package/wl18xx-firmware/install
  832. + $(INSTALL_DIR) $(1)/lib/firmware/ti-connectivity
  833. + $(INSTALL_DATA) \
  834. + $(PKG_BUILD_DIR)/ti-connectivity/wl18xx-fw-4.bin \
  835. + $(1)/lib/firmware/ti-connectivity
  836. +endef
  837. +$(eval $(call BuildPackage,wl18xx-firmware))
  838. +
  839. diff --git a/package/kernel/acx-mac80211/Makefile b/package/kernel/acx-mac80211/Makefile
  840. index 1820e7a..c5c020d 100644
  841. --- a/package/kernel/acx-mac80211/Makefile
  842. +++ b/package/kernel/acx-mac80211/Makefile
  843. @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk
  844. include $(INCLUDE_DIR)/kernel.mk
  845. PKG_NAME:=acx-mac80211
  846. -PKG_REV:=v20130127
  847. -PKG_VERSION:=20130909
  848. +PKG_REV:=b6fc31491020cb01d2cd1acc170cfa03ced7e726
  849. +PKG_VERSION:=20140216
  850. PKG_RELEASE:=1
  851. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  852. -PKG_SOURCE_URL:=git://acx100.git.sourceforge.net/gitroot/acx100/acx-mac80211
  853. +PKG_SOURCE_URL:=git://git.code.sf.net/p/acx100/acx-mac80211
  854. PKG_SOURCE_PROTO:=git
  855. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  856. PKG_SOURCE_VERSION:=$(PKG_REV)
  857. @@ -190,7 +190,7 @@ define Build/Compile
  858. CROSS_COMPILE="$(TARGET_CROSS)" \
  859. SUBDIRS="$(PKG_BUILD_DIR)" \
  860. $(PKG_EXTRA_KCONFIG) \
  861. - EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS) -DCONFIG_ACX_MAC80211_VERSION=\"KERNEL_VERSION(3,14,0)\"" \
  862. + EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS) -DCONFIG_ACX_MAC80211_VERSION=\"KERNEL_VERSION(4,2,0)\"" \
  863. LINUXINCLUDE="-I$(STAGING_DIR)/usr/include/mac80211-backport/uapi -I$(STAGING_DIR)/usr/include/mac80211-backport \
  864. -I$(STAGING_DIR)/usr/include/mac80211/uapi -I$(STAGING_DIR)/usr/include/mac80211 \
  865. -I$(LINUX_DIR)/include -I$(LINUX_DIR)/include/$(LINUX_UAPI_DIR) \
  866. diff --git a/package/kernel/acx-mac80211/patches/001-pci-mem-Fix-3.8-build.patch b/package/kernel/acx-mac80211/patches/001-pci-mem-Fix-3.8-build.patch
  867. deleted file mode 100644
  868. index fa4a6be..0000000
  869. --- a/package/kernel/acx-mac80211/patches/001-pci-mem-Fix-3.8-build.patch
  870. +++ /dev/null
  871. @@ -1,129 +0,0 @@
  872. -From 8a0f5890019bf43f4bc95ef0754b062ddfcfa9cd Mon Sep 17 00:00:00 2001
  873. -From: Oliver Winker <oliver@oli1170.net>
  874. -Date: Sun, 10 Mar 2013 21:04:23 +0100
  875. -Subject: [PATCH 1/3] pci, mem: Fix 3.8 build
  876. -
  877. -__devexit and __devinit not used anymore in 3.8
  878. -
  879. -Signed-off-by: Reinhard Karcher <reinhard.karcher@gmx.net>
  880. -Signed-off-by: Oliver Winker <oliver@oli1170.net>
  881. ----
  882. - mem.c | 13 ++++++++++++-
  883. - pci.c | 26 +++++++++++++++++++++++++-
  884. - 2 files changed, 37 insertions(+), 2 deletions(-)
  885. -
  886. ---- a/mem.c
  887. -+++ b/mem.c
  888. -@@ -2216,7 +2216,11 @@ int acx100mem_ioctl_set_phy_amp_bias(str
  889. - * ==================================================
  890. - */
  891. -
  892. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  893. - static int __devinit acxmem_probe(struct platform_device *pdev)
  894. -+#else
  895. -+static int acxmem_probe(struct platform_device *pdev)
  896. -+#endif
  897. - {
  898. - acx_device_t *adev = NULL;
  899. - const char *chip_name;
  900. -@@ -2392,7 +2396,11 @@ static int __devinit acxmem_probe(struct
  901. - * pdev - ptr to PCI device structure containing info about pci
  902. - * configuration
  903. - */
  904. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  905. - static int __devexit acxmem_remove(struct platform_device *pdev)
  906. -+#else
  907. -+static int acxmem_remove(struct platform_device *pdev)
  908. -+#endif
  909. - {
  910. - struct ieee80211_hw *hw = (struct ieee80211_hw *)
  911. - platform_get_drvdata(pdev);
  912. -@@ -2594,8 +2602,11 @@ static struct platform_driver acxmem_dri
  913. - .name = "acx-mem",
  914. - },
  915. - .probe = acxmem_probe,
  916. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  917. - .remove = __devexit_p(acxmem_remove),
  918. --
  919. -+#else
  920. -+ .remove = acxmem_remove,
  921. -+#endif
  922. - #ifdef CONFIG_PM
  923. - .suspend = acxmem_e_suspend,
  924. - .resume = acxmem_e_resume
  925. ---- a/pci.c
  926. -+++ b/pci.c
  927. -@@ -1039,7 +1039,11 @@ int acx100pci_ioctl_set_phy_amp_bias(str
  928. - * id - ptr to the device id entry that matched this device
  929. - */
  930. - #ifdef CONFIG_PCI
  931. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  932. - static int __devinit acxpci_probe(struct pci_dev *pdev,
  933. -+#else
  934. -+static int acxpci_probe(struct pci_dev *pdev,
  935. -+#endif
  936. - const struct pci_device_id *id)
  937. - {
  938. - unsigned long mem_region1 = 0;
  939. -@@ -1292,7 +1296,11 @@ static int __devinit acxpci_probe(struct
  940. - *
  941. - * pdev - ptr to PCI device structure containing info about pci configuration
  942. - */
  943. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  944. - static void __devexit acxpci_remove(struct pci_dev *pdev)
  945. -+#else
  946. -+static void acxpci_remove(struct pci_dev *pdev)
  947. -+#endif
  948. - {
  949. - struct ieee80211_hw *hw
  950. - = (struct ieee80211_hw *) pci_get_drvdata(pdev);
  951. -@@ -1505,7 +1513,11 @@ static struct pci_driver acxpci_driver =
  952. - .name = "acx_pci",
  953. - .id_table = acxpci_id_tbl,
  954. - .probe = acxpci_probe,
  955. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  956. - .remove = __devexit_p(acxpci_remove),
  957. -+#else
  958. -+ .remove = acxpci_remove,
  959. -+#endif
  960. - #ifdef CONFIG_PM
  961. - .suspend = acxpci_e_suspend,
  962. - .resume = acxpci_e_resume
  963. -@@ -1603,8 +1615,12 @@ static struct vlynq_device_id acx_vlynq_
  964. - };
  965. -
  966. -
  967. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  968. - static __devinit int vlynq_probe(struct vlynq_device *vdev,
  969. -- struct vlynq_device_id *id)
  970. -+#else
  971. -+static int vlynq_probe(struct vlynq_device *vdev,
  972. -+#endif
  973. -+ struct vlynq_device_id *id)
  974. - {
  975. - int result = -EIO, i;
  976. - u32 addr;
  977. -@@ -1785,7 +1801,11 @@ static __devinit int vlynq_probe(struct
  978. - return result;
  979. - }
  980. -
  981. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  982. - static __devexit void vlynq_remove(struct vlynq_device *vdev)
  983. -+#else
  984. -+static void vlynq_remove(struct vlynq_device *vdev)
  985. -+#endif
  986. - {
  987. - struct ieee80211_hw *hw = vlynq_get_drvdata(vdev);
  988. - acx_device_t *adev = hw2adev(hw);
  989. -@@ -1851,7 +1871,11 @@ static struct vlynq_driver acxvlynq_driv
  990. - .name = "acx_vlynq",
  991. - .id_table = acx_vlynq_id,
  992. - .probe = vlynq_probe,
  993. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  994. - .remove = __devexit_p(vlynq_remove),
  995. -+#else
  996. -+ .remove = vlynq_remove,
  997. -+#endif
  998. - };
  999. - #endif /* CONFIG_VLYNQ */
  1000. -
  1001. diff --git a/package/kernel/acx-mac80211/patches/003-Fix-3.10-build.patch b/package/kernel/acx-mac80211/patches/003-Fix-3.10-build.patch
  1002. deleted file mode 100644
  1003. index c737844..0000000
  1004. --- a/package/kernel/acx-mac80211/patches/003-Fix-3.10-build.patch
  1005. +++ /dev/null
  1006. @@ -1,31 +0,0 @@
  1007. -From 1daf4bfdb072b08f3b4e412bbfa9645f88dc0a01 Mon Sep 17 00:00:00 2001
  1008. -From: Oliver Winker <oliver@oli1170.net>
  1009. -Date: Tue, 3 Sep 2013 20:36:36 +0200
  1010. -Subject: [PATCH 3/3] Fix 3.10 build
  1011. -
  1012. -Signed-off-by: Reinhard Karcher <reinhard.karcher@gmx.net>
  1013. -Signed-off-by: Oliver Winker <oliver@oli1170.net>
  1014. ----
  1015. - main.c | 7 +++++++
  1016. - 1 file changed, 7 insertions(+)
  1017. -
  1018. ---- a/main.c
  1019. -+++ b/main.c
  1020. -@@ -682,10 +682,17 @@ int acx_op_config(struct ieee80211_hw *h
  1021. -
  1022. - if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
  1023. - logf1(L_DEBUG, "IEEE80211_CONF_CHANGE_CHANNEL,"
  1024. -+#if CONFIG_ACX_MAC80211_VERSION >= KERNEL_VERSION(3, 10, 0)
  1025. -+ "channel->hw_value=%i\n", conf->chandef.chan->hw_value);
  1026. -+
  1027. -+ acx_set_channel(adev, conf->chandef.chan->hw_value,
  1028. -+ conf->chandef.chan->center_freq);
  1029. -+#else
  1030. - "channel->hw_value=%i\n", conf->channel->hw_value);
  1031. -
  1032. - acx_set_channel(adev, conf->channel->hw_value,
  1033. - conf->channel->center_freq);
  1034. -+#endif
  1035. -
  1036. - changed_not_done &= ~IEEE80211_CONF_CHANGE_CHANNEL;
  1037. - }
  1038. diff --git a/package/kernel/acx-mac80211/patches/004-Fix-3.14-build.patch b/package/kernel/acx-mac80211/patches/004-Fix-3.14-build.patch
  1039. deleted file mode 100644
  1040. index 847b573..0000000
  1041. --- a/package/kernel/acx-mac80211/patches/004-Fix-3.14-build.patch
  1042. +++ /dev/null
  1043. @@ -1,22 +0,0 @@
  1044. -From d17fcac710e629463591f6bd09d76b66ec591583 Mon Sep 17 00:00:00 2001
  1045. -From: Hauke Mehrtens <hauke@hauke-m.de>
  1046. -Date: Wed, 5 Feb 2014 20:57:07 +0100
  1047. -Subject: [PATCH] Fix 3.14 build
  1048. -
  1049. -Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  1050. ----
  1051. - main.c | 2 ++
  1052. - 1 file changed, 2 insertions(+)
  1053. -
  1054. ---- a/main.c
  1055. -+++ b/main.c
  1056. -@@ -500,7 +500,9 @@ int acx_init_ieee80211(acx_device_t *ade
  1057. - hw->flags &= ~IEEE80211_HW_RX_INCLUDES_FCS;
  1058. - hw->queues = 1;
  1059. - hw->wiphy->max_scan_ssids = 1;
  1060. -+#if CONFIG_ACX_MAC80211_VERSION < KERNEL_VERSION(3, 14, 0)
  1061. - hw->channel_change_time = 10000;
  1062. -+#endif
  1063. -
  1064. - /* OW TODO Check if RTS/CTS threshold can be included here */
  1065. -
  1066. diff --git a/package/kernel/acx-mac80211/patches/300-kernel_4_2.patch b/package/kernel/acx-mac80211/patches/300-kernel_4_2.patch
  1067. new file mode 100644
  1068. index 0000000..ee92b94
  1069. --- /dev/null
  1070. +++ b/package/kernel/acx-mac80211/patches/300-kernel_4_2.patch
  1071. @@ -0,0 +1,67 @@
  1072. +diff --git a/main.c b/main.c
  1073. +index bfec856..3c482d9 100644
  1074. +--- a/main.c
  1075. ++++ b/main.c
  1076. +@@ -497,7 +497,7 @@ int acx_free_mechanics(acx_device_t *adev)
  1077. +
  1078. + int acx_init_ieee80211(acx_device_t *adev, struct ieee80211_hw *hw)
  1079. + {
  1080. +- hw->flags &= ~IEEE80211_HW_RX_INCLUDES_FCS;
  1081. ++ __clear_bit(IEEE80211_HW_RX_INCLUDES_FCS, hw->flags);
  1082. + hw->queues = 1;
  1083. + hw->wiphy->max_scan_ssids = 1;
  1084. +
  1085. +@@ -525,7 +525,7 @@ int acx_init_ieee80211(acx_device_t *adev, struct ieee80211_hw *hw)
  1086. + /* We base signal quality on winlevel approach of previous driver
  1087. + * TODO OW 20100615 This should into a common init code
  1088. + */
  1089. +- hw->flags |= IEEE80211_HW_SIGNAL_UNSPEC;
  1090. ++ __set_bit(IEEE80211_HW_SIGNAL_UNSPEC, hw->flags);
  1091. + hw->max_signal = 100;
  1092. +
  1093. + if (IS_ACX100(adev)) {
  1094. +@@ -945,8 +945,8 @@ void acx_op_configure_filter(struct ieee80211_hw *hw,
  1095. + changed_flags, *total_flags);
  1096. +
  1097. + /* OWI TODO: Set also FIF_PROBE_REQ ? */
  1098. +- *total_flags &= (FIF_PROMISC_IN_BSS | FIF_ALLMULTI | FIF_FCSFAIL
  1099. +- | FIF_CONTROL | FIF_OTHER_BSS);
  1100. ++ *total_flags &= (FIF_ALLMULTI | FIF_FCSFAIL | FIF_CONTROL
  1101. ++ | FIF_OTHER_BSS);
  1102. +
  1103. + logf1(L_DEBUG, "2: *total_flags=0x%08x\n", *total_flags);
  1104. +
  1105. +@@ -1045,9 +1045,10 @@ void acx_op_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
  1106. + }
  1107. +
  1108. + int acx_op_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  1109. +- struct cfg80211_scan_request *req)
  1110. ++ struct ieee80211_scan_request *hw_req)
  1111. + {
  1112. + acx_device_t *adev = hw2adev(hw);
  1113. ++ struct cfg80211_scan_request *req = &hw_req->req;
  1114. + struct sk_buff *skb;
  1115. + size_t ssid_len = 0;
  1116. + u8 *ssid = NULL;
  1117. +@@ -1082,7 +1083,7 @@ int acx_op_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  1118. + goto out;
  1119. + }
  1120. + #else
  1121. +- skb = ieee80211_probereq_get(adev->hw, adev->vif, ssid, ssid_len,
  1122. ++ skb = ieee80211_probereq_get(adev->hw, vif->addr, ssid, ssid_len,
  1123. + req->ie_len);
  1124. + if (!skb) {
  1125. + ret = -ENOMEM;
  1126. +diff --git a/main.h b/main.h
  1127. +index 293f5c8..84ecb9a 100644
  1128. +--- a/main.h
  1129. ++++ b/main.h
  1130. +@@ -62,7 +62,7 @@ void acx_op_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
  1131. + #endif
  1132. +
  1133. + int acx_op_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  1134. +- struct cfg80211_scan_request *req);
  1135. ++ struct ieee80211_scan_request *req);
  1136. +
  1137. + int acx_recover_hw(acx_device_t *adev);
  1138. +
  1139. diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
  1140. index a1eedce..156ea01 100644
  1141. --- a/package/kernel/mac80211/Makefile
  1142. +++ b/package/kernel/mac80211/Makefile
  1143. @@ -10,11 +10,11 @@ include $(INCLUDE_DIR)/kernel.mk
  1144. PKG_NAME:=mac80211
  1145. -PKG_VERSION:=2015-03-09
  1146. -PKG_RELEASE:=3
  1147. +PKG_VERSION:=2016-01-10
  1148. +PKG_RELEASE:=1
  1149. PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
  1150. PKG_BACKPORT_VERSION:=
  1151. -PKG_MD5SUM:=6d4b04e4ce8a1f54dabfb04f4709453c
  1152. +PKG_MD5SUM:=be5fae2e8d6f7490f9b073374fb895ba
  1153. PKG_SOURCE:=compat-wireless-$(PKG_VERSION)$(PKG_BACKPORT_VERSION).tar.bz2
  1154. PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION)
  1155. @@ -23,15 +23,29 @@ PKG_BUILD_PARALLEL:=1
  1156. PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  1157. PKG_DRIVERS = \
  1158. - adm8211 ath5k libertas-usb libertas-sdio p54-common p54-pci p54-usb p54-spi \
  1159. - rt2x00-lib rt2x00-pci rt2x00-usb rt2800-lib rt2400-pci rt2500-pci \
  1160. - rt2500-usb rt61-pci rt73-usb rt2800-mmio rt2800-pci rt2800-usb rt2800-soc \
  1161. - rtl8180 rtl8187 zd1211rw mac80211-hwsim carl9170 b43 b43legacy \
  1162. - ath9k-common ath9k ath9k-htc ath10k ath net-libipw net-ipw2100 net-ipw2200 \
  1163. - mwl8k mwifiex-pcie net-hermes net-hermes-pci net-hermes-plx net-hermes-pcmcia \
  1164. - iwl-legacy iwl3945 iwl4965 iwlagn wlcore wl12xx wl18xx lib80211 \
  1165. + adm8211 \
  1166. + ath ath5k ath9k ath9k-common ath9k-htc ath10k \
  1167. + b43 b43legacy \
  1168. + carl9170 \
  1169. + hermes hermes-pci hermes-pcmcia hermes-plx\
  1170. + iwl-legacy iwl3945 iwl4965 iwlwifi \
  1171. + lib80211 \
  1172. + libipw ipw2100 ipw2200 \
  1173. + libertas-sdio libertas-usb \
  1174. + mac80211-hwsim \
  1175. + mt7601u \
  1176. + mwl8k mwifiex-pcie \
  1177. + p54-common p54-pci p54-spi p54-usb \
  1178. + rt2x00-lib rt2x00-pci rt2x00-usb \
  1179. + rt2400-pci rt2500-pci rt2500-usb \
  1180. + rt2800-lib rt2800-mmio rt2800-pci rt2800-soc rt2800-usb \
  1181. + rt61-pci rt73-usb \
  1182. + rtl8180 rtl8187 \
  1183. rtlwifi rtlwifi-pci rtlwifi-usb rtl8192c-common rtl8192ce rtl8192se \
  1184. - rtl8192de rtl8192cu
  1185. + rtl8192de rtl8192cu \
  1186. + rtl8xxxu \
  1187. + wlcore wl12xx wl18xx \
  1188. + zd1211rw
  1189. PKG_CONFIG_DEPENDS:= \
  1190. CONFIG_PACKAGE_kmod-mac80211 \
  1191. @@ -60,7 +74,6 @@ define KernelPackage/mac80211/Default
  1192. SUBMENU:=$(WMENU)
  1193. URL:=https://wireless.wiki.kernel.org/
  1194. MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  1195. - DEPENDS:=@!TARGET_uml
  1196. endef
  1197. define KernelPackage/cfg80211
  1198. @@ -97,6 +110,15 @@ define KernelPackage/mac80211/config
  1199. Select this to see extensive information about
  1200. the internal state of mac80211 in debugfs.
  1201. + config PACKAGE_MAC80211_TRACING
  1202. + bool "Enable tracing (mac80211 and supported drivers)"
  1203. + select KERNEL_FTRACE
  1204. + select KERNEL_ENABLE_DEFAULT_TRACERS
  1205. + default n
  1206. + help
  1207. + Select this to enable tracing of mac80211 and
  1208. + related wifi drivers (using trace-cmd).
  1209. +
  1210. config PACKAGE_MAC80211_MESH
  1211. bool "Enable 802.11s mesh support"
  1212. default y
  1213. @@ -108,833 +130,703 @@ define KernelPackage/mac80211/description
  1214. Generic IEEE 802.11 Networking Stack (mac80211)
  1215. endef
  1216. -PKG_LINUX_FIRMWARE_NAME:=linux-firmware
  1217. -PKG_LINUX_FIRMWARE_VERSION:=f404336ba808cbd57547196e13367079a23b822c
  1218. -PKG_LINUX_FIRMWARE_SOURCE:=$(PKG_LINUX_FIRMWARE_NAME)-2015-03-20-$(PKG_LINUX_FIRMWARE_VERSION).tar.bz2
  1219. -PKG_LINUX_FIRMWARE_PROTO:=git
  1220. -PKG_LINUX_FIRMWARE_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
  1221. -PKG_LINUX_FIRMWARE_SUBDIR:=$(PKG_LINUX_FIRMWARE_NAME)-$(PKG_LINUX_FIRMWARE_VERSION)
  1222. -#PKG_LINUX_FIRMWARE_MIRROR_MD5SUM:=e219333f01835c6e556875a9e0deb3f9
  1223. -
  1224. -define Download/linux-firmware
  1225. - FILE:=$(PKG_LINUX_FIRMWARE_SOURCE)
  1226. - URL:=$(PKG_LINUX_FIRMWARE_SOURCE_URL)
  1227. - MD5SUM:=$(PKG_LINUX_FIRMWARE_MD5SUM)
  1228. - PROTO:=$(PKG_LINUX_FIRMWARE_PROTO)
  1229. - VERSION:=$(PKG_LINUX_FIRMWARE_VERSION)
  1230. - SUBDIR:=$(PKG_LINUX_FIRMWARE_SUBDIR)
  1231. - MIRROR_MD5SUM:=$(PKG_LINUX_FIRMWARE_MIRROR_MD5SUM)
  1232. -endef
  1233. -$(eval $(call Download,linux-firmware))
  1234. -
  1235. -PKG_ATH10K_LINUX_FIRMWARE_NAME:=ath10k-firmware
  1236. -PKG_ATH10K_LINUX_FIRMWARE_VERSION:=da0f85d924226ee30c46e037120621c9e192b39e
  1237. -PKG_ATH10K_LINUX_FIRMWARE_SOURCE:=$(PKG_ATH10K_LINUX_FIRMWARE_NAME)-$(PKG_ATH10K_LINUX_FIRMWARE_VERSION).tar.bz2
  1238. -PKG_ATH10K_LINUX_FIRMWARE_PROTO:=git
  1239. -PKG_ATH10K_LINUX_FIRMWARE_SOURCE_URL:=https://github.com/kvalo/ath10k-firmware.git
  1240. -PKG_ATH10K_LINUX_FIRMWARE_SUBDIR:=$(PKG_ATH10K_LINUX_FIRMWARE_NAME)-$(PKG_ATH10K_LINUX_FIRMWARE_VERSION)
  1241. -#PKG_ATH10K_LINUX_FIRMWARE_MIRROR_MD5SUM:=?
  1242. -
  1243. -define Download/ath10k-firmware
  1244. - FILE:=$(PKG_ATH10K_LINUX_FIRMWARE_SOURCE)
  1245. - URL:=$(PKG_ATH10K_LINUX_FIRMWARE_SOURCE_URL)
  1246. - PROTO:=$(PKG_ATH10K_LINUX_FIRMWARE_PROTO)
  1247. - VERSION:=$(PKG_ATH10K_LINUX_FIRMWARE_VERSION)
  1248. - SUBDIR:=$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)
  1249. - #MIRROR_MD5SUM:=$(PKG_ATH10K_LINUX_FIRMWARE_MIRROR_MD5SUM)
  1250. -endef
  1251. -$(eval $(call Download,ath10k-firmware))
  1252. -
  1253. -# Prism54 drivers
  1254. -P54PCIFW:=2.13.12.0.arm
  1255. -P54USBFW:=2.13.24.0.lm87.arm
  1256. -P54SPIFW:=2.13.0.0.a.13.14.arm
  1257. -
  1258. -define Download/p54usb
  1259. - FILE:=$(P54USBFW)
  1260. - URL:=http://daemonizer.de/prism54/prism54-fw/fw-usb
  1261. - MD5SUM:=8e8ab005a4f8f0123bcdc51bc25b47f6
  1262. -endef
  1263. -$(eval $(call Download,p54usb))
  1264. -
  1265. -define Download/p54pci
  1266. - FILE:=$(P54PCIFW)
  1267. - URL:=http://daemonizer.de/prism54/prism54-fw/fw-softmac
  1268. - MD5SUM:=ff7536af2092b1c4b21315bd103ef4c4
  1269. -endef
  1270. -$(eval $(call Download,p54pci))
  1271. -
  1272. -define Download/p54spi
  1273. - FILE:=$(P54SPIFW)
  1274. - URL:=http://daemonizer.de/prism54/prism54-fw/stlc4560
  1275. - MD5SUM:=42661f8ecbadd88012807493f596081d
  1276. -endef
  1277. -$(eval $(call Download,p54spi))
  1278. -
  1279. -define KernelPackage/p54/Default
  1280. - $(call KernelPackage/mac80211/Default)
  1281. - TITLE:=Prism54 Drivers
  1282. -endef
  1283. -
  1284. -define KernelPackage/p54/description
  1285. - Kernel module for Prism54 chipsets (mac80211)
  1286. -endef
  1287. -
  1288. -define KernelPackage/p54-common
  1289. - $(call KernelPackage/p54/Default)
  1290. - DEPENDS+= @PCI_SUPPORT||@USB_SUPPORT||@TARGET_omap24xx +kmod-mac80211 +kmod-lib-crc-ccitt
  1291. - TITLE+= (COMMON)
  1292. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54common.ko
  1293. -endef
  1294. -
  1295. -define KernelPackage/p54-pci
  1296. - $(call KernelPackage/p54/Default)
  1297. - TITLE+= (PCI)
  1298. - DEPENDS+= @PCI_SUPPORT +kmod-p54-common
  1299. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54pci.ko
  1300. - AUTOLOAD:=$(call AutoProbe,p54pci)
  1301. -endef
  1302. -
  1303. -define KernelPackage/p54-usb
  1304. - $(call KernelPackage/p54/Default)
  1305. - TITLE+= (USB)
  1306. - DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-p54-common
  1307. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54usb.ko
  1308. - AUTOLOAD:=$(call AutoProbe,p54usb)
  1309. -endef
  1310. -
  1311. -define KernelPackage/p54-spi
  1312. - $(call KernelPackage/p54/Default)
  1313. - TITLE+= (SPI)
  1314. - DEPENDS+= @TARGET_omap24xx +kmod-p54-common
  1315. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54spi.ko
  1316. - AUTOLOAD:=$(call AutoProbe,p54spi)
  1317. -endef
  1318. -
  1319. -define KernelPackage/rt2x00/Default
  1320. +define KernelPackage/adm8211
  1321. $(call KernelPackage/mac80211/Default)
  1322. - TITLE:=Ralink Drivers for RT2x00 cards
  1323. + TITLE:=ADMTek 8211 support
  1324. + DEPENDS+=@PCI_SUPPORT +kmod-mac80211 +kmod-eeprom-93cx6
  1325. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/admtek/adm8211.ko
  1326. + AUTOLOAD:=$(call AutoProbe,adm8211)
  1327. endef
  1328. -define KernelPackage/rt2x00-lib
  1329. -$(call KernelPackage/rt2x00/Default)
  1330. - DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-mac80211 +kmod-lib-crc-itu-t
  1331. - TITLE+= (LIB)
  1332. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00lib.ko
  1333. - MENU:=1
  1334. -endef
  1335. +define KernelPackage/ath/config
  1336. + if PACKAGE_kmod-ath
  1337. + config ATH_USER_REGD
  1338. + bool "Force Atheros drivers to respect the user's regdomain settings"
  1339. + help
  1340. + Atheros' idea of regulatory handling is that the EEPROM of the card defines
  1341. + the regulatory limits and the user is only allowed to restrict the settings
  1342. + even further, even if the country allows frequencies or power levels that
  1343. + are forbidden by the EEPROM settings.
  1344. -define KernelPackage/rt2x00-lib/config
  1345. - if PACKAGE_kmod-rt2x00-lib
  1346. + Select this option if you want the driver to respect the user's decision about
  1347. + regulatory settings.
  1348. - config PACKAGE_RT2X00_LIB_DEBUGFS
  1349. - bool "Enable rt2x00 debugfs support"
  1350. - depends on PACKAGE_MAC80211_DEBUGFS
  1351. + config PACKAGE_ATH_DEBUG
  1352. + bool "Atheros wireless debugging"
  1353. help
  1354. - Enable creation of debugfs files for the rt2x00 drivers.
  1355. - These debugfs files support both reading and writing of the
  1356. - most important register types of the rt2x00 hardware.
  1357. + Say Y, if you want to debug atheros wireless drivers.
  1358. + Only ath9k & ath10k make use of this.
  1359. - config PACKAGE_RT2X00_DEBUG
  1360. - bool "Enable rt2x00 debug output"
  1361. + config PACKAGE_ATH_DFS
  1362. + bool "Enable DFS support"
  1363. + default y
  1364. help
  1365. - Enable debugging output for all rt2x00 modules
  1366. + Dynamic frequency selection (DFS) is required for most of the 5 GHz band
  1367. + channels in Europe, US, and Japan.
  1368. - endif
  1369. -endef
  1370. + Select this option if you want to use such channels.
  1371. -define KernelPackage/rt2x00-mmio
  1372. -$(call KernelPackage/rt2x00/Default)
  1373. - DEPENDS+= @(PCI_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib +kmod-eeprom-93cx6
  1374. - HIDDEN:=1
  1375. - TITLE+= (MMIO)
  1376. - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00mmio.ko
  1377. + endif
  1378. endef
  1379. -define KernelPackage/rt2x00-pci
  1380. -$(call KernelPackage/rt2x00/Default)
  1381. - DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-mmio +kmod-rt2x00-lib
  1382. - HIDDEN:=1
  1383. - TITLE+= (PCI)
  1384. - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00pci.ko
  1385. - AUTOLOAD:=$(call AutoProbe,rt2x00pci)
  1386. +define KernelPackage/ath
  1387. + $(call KernelPackage/mac80211/Default)
  1388. + TITLE:=Atheros common driver part
  1389. + DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx||TARGET_ath25 +kmod-mac80211
  1390. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath.ko
  1391. + MENU:=1
  1392. endef
  1393. -define KernelPackage/rt2x00-usb
  1394. -$(call KernelPackage/rt2x00/Default)
  1395. - DEPENDS+= @USB_SUPPORT +kmod-rt2x00-lib +kmod-usb-core
  1396. - HIDDEN:=1
  1397. - TITLE+= (USB)
  1398. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00usb.ko
  1399. - AUTOLOAD:=$(call AutoProbe,rt2x00usb)
  1400. +define KernelPackage/ath/description
  1401. + This module contains some common parts needed by Atheros Wireless drivers.
  1402. endef
  1403. -define KernelPackage/rt2800-lib
  1404. -$(call KernelPackage/rt2x00/Default)
  1405. - DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib +kmod-lib-crc-ccitt +@DRIVER_11N_SUPPORT
  1406. - HIDDEN:=1
  1407. - TITLE+= (rt2800 LIB)
  1408. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800lib.ko
  1409. +define KernelPackage/ath5k
  1410. + $(call KernelPackage/mac80211/Default)
  1411. + TITLE:=Atheros 5xxx wireless cards support
  1412. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath5k
  1413. + DEPENDS+= @PCI_SUPPORT||@TARGET_ath25 +kmod-ath
  1414. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath5k/ath5k.ko
  1415. + AUTOLOAD:=$(call AutoProbe,ath5k)
  1416. endef
  1417. -define KernelPackage/rt2400-pci
  1418. -$(call KernelPackage/rt2x00/Default)
  1419. - DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
  1420. - TITLE+= (RT2400 PCI)
  1421. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2400pci.ko
  1422. - AUTOLOAD:=$(call AutoProbe,rt2400pci)
  1423. +define KernelPackage/ath5k/description
  1424. + This module adds support for wireless adapters based on
  1425. + Atheros 5xxx chipset.
  1426. endef
  1427. -define KernelPackage/rt2500-pci
  1428. -$(call KernelPackage/rt2x00/Default)
  1429. - DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
  1430. - TITLE+= (RT2500 PCI)
  1431. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2500pci.ko
  1432. - AUTOLOAD:=$(call AutoProbe,rt2500pci)
  1433. +define KernelPackage/ath9k-common
  1434. + $(call KernelPackage/mac80211/Default)
  1435. + TITLE:=Atheros 802.11n wireless devices (common code for ath9k and ath9k_htc)
  1436. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  1437. + DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY
  1438. + FILES:= \
  1439. + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_common.ko \
  1440. + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_hw.ko
  1441. endef
  1442. -define KernelPackage/rt2500-usb
  1443. -$(call KernelPackage/rt2x00/Default)
  1444. - DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb
  1445. - TITLE+= (RT2500 USB)
  1446. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2500usb.ko
  1447. - AUTOLOAD:=$(call AutoProbe,rt2500usb)
  1448. +define KernelPackage/ath9k
  1449. + $(call KernelPackage/mac80211/Default)
  1450. + TITLE:=Atheros 802.11n PCI wireless cards support
  1451. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  1452. + DEPENDS+= @PCI_SUPPORT||TARGET_ar71xx +kmod-ath9k-common
  1453. + FILES:= \
  1454. + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k.ko
  1455. + AUTOLOAD:=$(call AutoProbe,ath9k)
  1456. endef
  1457. -define KernelPackage/rt61-pci
  1458. -$(call KernelPackage/rt2x00/Default)
  1459. - DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
  1460. - TITLE+= (RT2x61 PCI)
  1461. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt61pci.ko
  1462. - AUTOLOAD:=$(call AutoProbe,rt61pci)
  1463. +define KernelPackage/ath9k/description
  1464. +This module adds support for wireless adapters based on
  1465. +Atheros IEEE 802.11n AR5008 and AR9001 family of chipsets.
  1466. endef
  1467. -define KernelPackage/rt73-usb
  1468. - $(call KernelPackage/rt2x00/Default)
  1469. - DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb
  1470. - TITLE+= (RT73 USB)
  1471. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt73usb.ko
  1472. - AUTOLOAD:=$(call AutoProbe,rt73usb)
  1473. -endef
  1474. +define KernelPackage/ath9k/config
  1475. -define KernelPackage/rt2800-mmio
  1476. -$(call KernelPackage/rt2x00/Default)
  1477. - TITLE += (RT28xx/RT3xxx MMIO)
  1478. - DEPENDS += +kmod-rt2800-lib +kmod-rt2x00-mmio
  1479. - HIDDEN:=1
  1480. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800mmio.ko
  1481. -endef
  1482. + config ATH9K_SUPPORT_PCOEM
  1483. + bool "Support chips used in PC OEM cards"
  1484. + depends on PACKAGE_kmod-ath9k
  1485. -define KernelPackage/rt2800-soc
  1486. -$(call KernelPackage/rt2x00/Default)
  1487. - DEPENDS += @(TARGET_ramips_rt288x||TARGET_ramips_rt305x||TARGET_ramips_rt3883||TARGET_ramips_mt7620) +kmod-rt2800-mmio +kmod-rt2800-lib
  1488. - TITLE += (RT28xx/RT3xxx SoC)
  1489. - FILES := \
  1490. - $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00soc.ko \
  1491. - $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800soc.ko
  1492. - AUTOLOAD:=$(call AutoProbe,rt2800soc)
  1493. endef
  1494. -define KernelPackage/rt2800-pci
  1495. -$(call KernelPackage/rt2x00/Default)
  1496. - DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci +kmod-rt2800-lib +kmod-rt2800-mmio
  1497. - TITLE+= (RT2860 PCI)
  1498. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800pci.ko
  1499. - AUTOLOAD:=$(call AutoProbe,rt2800pci)
  1500. +define KernelPackage/ath9k-htc
  1501. + $(call KernelPackage/mac80211/Default)
  1502. + TITLE:=Atheros 802.11n USB device support
  1503. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  1504. + DEPENDS+= @USB_SUPPORT +kmod-ath9k-common +kmod-usb-core +ath9k-htc-firmware
  1505. + FILES:= \
  1506. + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_htc.ko
  1507. + AUTOLOAD:=$(call AutoProbe,ath9k_htc)
  1508. endef
  1509. -define KernelPackage/rt2800-usb
  1510. -$(call KernelPackage/rt2x00/Default)
  1511. - DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb +kmod-rt2800-lib +kmod-lib-crc-ccitt
  1512. - TITLE+= (RT2870 USB)
  1513. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800usb.ko
  1514. - AUTOLOAD:=$(call AutoProbe,rt2800usb)
  1515. +define KernelPackage/ath9k-htc/description
  1516. +This module adds support for wireless adapters based on
  1517. +Atheros USB AR9271 and AR7010 family of chipsets.
  1518. endef
  1519. -define KernelPackage/rtl818x/Default
  1520. +define KernelPackage/ath10k
  1521. $(call KernelPackage/mac80211/Default)
  1522. - TITLE:=Realtek Drivers for RTL818x devices
  1523. - URL:=http://wireless.kernel.org/en/users/Drivers/rtl8187
  1524. - DEPENDS+= +kmod-eeprom-93cx6 +kmod-mac80211
  1525. + TITLE:=Atheros 802.11ac wireless cards support
  1526. + URL:=https://wireless.wiki.kernel.org/en/users/Drivers/ath10k
  1527. + DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY
  1528. + FILES:= \
  1529. + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_core.ko \
  1530. + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_pci.ko
  1531. + AUTOLOAD:=$(call AutoLoad,55,ath10k_core ath10k_pci)
  1532. endef
  1533. -define KernelPackage/rtl8180
  1534. - $(call KernelPackage/rtl818x/Default)
  1535. - DEPENDS+= @PCI_SUPPORT
  1536. - TITLE+= (RTL8180 PCI)
  1537. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtl818x/rtl8180/rtl818x_pci.ko
  1538. - AUTOLOAD:=$(call AutoProbe,rtl818x_pci)
  1539. +define KernelPackage/ath10k/description
  1540. +This module adds support for wireless adapters based on
  1541. +Atheros IEEE 802.11ac family of chipsets. For now only
  1542. +PCI is supported.
  1543. endef
  1544. -define KernelPackage/rtl8187
  1545. -$(call KernelPackage/rtl818x/Default)
  1546. - DEPENDS+= @USB_SUPPORT +kmod-usb-core
  1547. - TITLE+= (RTL8187 USB)
  1548. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtl818x/rtl8187/rtl8187.ko
  1549. - AUTOLOAD:=$(call AutoProbe,rtl8187)
  1550. -endef
  1551. +#Broadcom firmware
  1552. +ifneq ($(CONFIG_B43_FW_6_30),)
  1553. + PKG_B43_FWV4_NAME:=broadcom-wl
  1554. + PKG_B43_FWV4_VERSION:=6.30.163.46
  1555. + PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).wl_apsta.o
  1556. + PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  1557. + PKG_B43_FWV4_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/
  1558. + PKG_B43_FWV4_MD5SUM:=6fe97e9368d25342a1ab943d3cf3496d
  1559. +else
  1560. +ifneq ($(CONFIG_B43_FW_5_10),)
  1561. + PKG_B43_FWV4_NAME:=broadcom-wl
  1562. + PKG_B43_FWV4_VERSION:=5.10.56.27.3
  1563. + PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/driver/wl_apsta/wl_prebuilt.o
  1564. + PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)_mipsel.tar.bz2
  1565. + PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
  1566. + PKG_B43_FWV4_MD5SUM:=3363e3a6b3d9d73c49dea870c7834eac
  1567. +else
  1568. +ifneq ($(CONFIG_B43_FW_4_178),)
  1569. + PKG_B43_FWV4_NAME:=broadcom-wl
  1570. + PKG_B43_FWV4_VERSION:=4.178.10.4
  1571. + PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/linux/wl_apsta.o
  1572. + PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  1573. + PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
  1574. + PKG_B43_FWV4_MD5SUM:=14477e8cbbb91b11896affac9b219fdb
  1575. +else
  1576. +ifneq ($(CONFIG_B43_FW_5_100_138),)
  1577. + PKG_B43_FWV4_NAME:=broadcom-wl
  1578. + PKG_B43_FWV4_VERSION:=5.100.138
  1579. + PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/linux/wl_apsta.o
  1580. + PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  1581. + PKG_B43_FWV4_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/
  1582. + PKG_B43_FWV4_MD5SUM:=f4e357b09eaf5d8b1f1920cf3493a555
  1583. +else
  1584. + PKG_B43_FWV4_NAME:=broadcom-wl
  1585. + PKG_B43_FWV4_VERSION:=4.150.10.5
  1586. + PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/driver/wl_apsta_mimo.o
  1587. + PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  1588. + PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
  1589. + PKG_B43_FWV4_MD5SUM:=0c6ba9687114c6b598e8019e262d9a60
  1590. +endif
  1591. +endif
  1592. +endif
  1593. +endif
  1594. +ifneq ($(CONFIG_B43_OPENFIRMWARE),)
  1595. + PKG_B43_FWV4_NAME:=broadcom-wl
  1596. + PKG_B43_FWV4_VERSION:=5.2
  1597. + PKG_B43_FWV4_OBJECT:=openfwwf-$(PKG_B43_FWV4_VERSION)
  1598. + PKG_B43_FWV4_SOURCE:=openfwwf-$(PKG_B43_FWV4_VERSION).tar.gz
  1599. + PKG_B43_FWV4_SOURCE_URL:=http://www.ing.unibs.it/openfwwf/firmware/
  1600. + PKG_B43_FWV4_MD5SUM:=e045a135453274e439ae183f8498b0fa
  1601. +endif
  1602. -define KernelPackage/rtlwifi/config
  1603. - config PACKAGE_RTLWIFI_DEBUG
  1604. - bool "Realtek wireless debugging"
  1605. - depends on PACKAGE_kmod-rtlwifi
  1606. - help
  1607. - Say Y, if you want to debug realtek wireless drivers.
  1608. +define Download/b43
  1609. + FILE:=$(PKG_B43_FWV4_SOURCE)
  1610. + URL:=$(PKG_B43_FWV4_SOURCE_URL)
  1611. + MD5SUM:=$(PKG_B43_FWV4_MD5SUM)
  1612. endef
  1613. +$(eval $(call Download,b43))
  1614. -define KernelPackage/rtlwifi
  1615. +define KernelPackage/b43
  1616. $(call KernelPackage/mac80211/Default)
  1617. - TITLE:=Realtek common driver part
  1618. - DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT) +kmod-mac80211 +@DRIVER_11N_SUPPORT
  1619. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtlwifi.ko
  1620. - HIDDEN:=1
  1621. + TITLE:=Broadcom 43xx wireless support
  1622. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/b43
  1623. + KCONFIG:= \
  1624. + CONFIG_HW_RANDOM=y
  1625. + # Depend on PCI_SUPPORT to make sure we can select kmod-bcma or kmod-ssb
  1626. + DEPENDS += \
  1627. + @PCI_SUPPORT +kmod-mac80211 \
  1628. + $(if $(CONFIG_PACKAGE_B43_USE_SSB),+kmod-ssb) \
  1629. + $(if $(CONFIG_PACKAGE_B43_USE_BCMA),+kmod-bcma)
  1630. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/broadcom/b43/b43.ko
  1631. + AUTOLOAD:=$(call AutoProbe,b43)
  1632. + MENU:=1
  1633. endef
  1634. -define KernelPackage/rtlwifi-pci
  1635. - $(call KernelPackage/mac80211/Default)
  1636. - TITLE:=Realtek common driver part (PCI support)
  1637. - DEPENDS+= @PCI_SUPPORT +kmod-rtlwifi
  1638. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl_pci.ko
  1639. - AUTOLOAD:=$(call AutoProbe,rtl_pci)
  1640. - HIDDEN:=1
  1641. -endef
  1642. +define KernelPackage/b43/config
  1643. -define KernelPackage/rtlwifi-usb
  1644. - $(call KernelPackage/mac80211/Default)
  1645. - TITLE:=Realtek common driver part (USB support)
  1646. - DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-rtlwifi
  1647. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl_usb.ko
  1648. - AUTOLOAD:=$(call AutoProbe,rtl_usb)
  1649. - HIDDEN:=1
  1650. -endef
  1651. +config PACKAGE_B43_USE_SSB
  1652. + select PACKAGE_kmod-ssb
  1653. + tristate
  1654. + depends on !TARGET_brcm47xx && !TARGET_brcm63xx
  1655. + default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA_AND_SSB
  1656. + default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_SSB
  1657. -define KernelPackage/rtl8192c-common
  1658. - $(call KernelPackage/mac80211/Default)
  1659. - TITLE:=Realtek RTL8192CE/RTL8192CU common support module
  1660. - DEPENDS+= +kmod-rtlwifi
  1661. - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192c/rtl8192c-common.ko
  1662. - HIDDEN:=1
  1663. -endef
  1664. +config PACKAGE_B43_USE_BCMA
  1665. + select PACKAGE_kmod-bcma
  1666. + tristate
  1667. + depends on !TARGET_brcm47xx && !TARGET_bcm53xx
  1668. + default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA_AND_SSB
  1669. + default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA
  1670. -define KernelPackage/rtl8192ce
  1671. - $(call KernelPackage/mac80211/Default)
  1672. - TITLE:=Realtek RTL8192CE/RTL8188CE support
  1673. - DEPENDS+= +kmod-rtlwifi-pci +kmod-rtl8192c-common
  1674. - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192ce/rtl8192ce.ko
  1675. - AUTOLOAD:=$(call AutoProbe,rtl8192ce)
  1676. -endef
  1677. + if PACKAGE_kmod-b43
  1678. -define KernelPackage/rtl8192ce/install
  1679. - $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  1680. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cfw.bin $(1)/lib/firmware/rtlwifi
  1681. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cfwU.bin $(1)/lib/firmware/rtlwifi
  1682. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cfwU_B.bin $(1)/lib/firmware/rtlwifi
  1683. -endef
  1684. + choice
  1685. + prompt "b43 firmware version"
  1686. + default B43_FW_5_100_138
  1687. + help
  1688. + This option allows you to select the version of the b43 firmware.
  1689. -define KernelPackage/rtl8192se
  1690. - $(call KernelPackage/mac80211/Default)
  1691. - TITLE:=Realtek RTL8192SE/RTL8191SE support
  1692. - DEPENDS+= +kmod-rtlwifi-pci
  1693. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192se/rtl8192se.ko
  1694. - AUTOLOAD:=$(call AutoProbe,rtl8192se)
  1695. -endef
  1696. + config B43_FW_4_150
  1697. + bool "Firmware 410.2160 from driver 4.150.10.5 (old stable)"
  1698. + help
  1699. + Old stable firmware for BCM43xx devices.
  1700. -define KernelPackage/rtl8192se/install
  1701. - $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  1702. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192sefw.bin $(1)/lib/firmware/rtlwifi
  1703. -endef
  1704. + If unsure, select this.
  1705. -define KernelPackage/rtl8192de
  1706. - $(call KernelPackage/mac80211/Default)
  1707. - TITLE:=Realtek RTL8192DE/RTL8188DE support
  1708. - DEPENDS+= +kmod-rtlwifi-pci
  1709. - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192de/rtl8192de.ko
  1710. - AUTOLOAD:=$(call AutoProbe,rtl8192de)
  1711. -endef
  1712. + config B43_FW_4_178
  1713. + bool "Firmware 478.104 from driver 4.178.10.4"
  1714. + help
  1715. + Older firmware for BCM43xx devices.
  1716. -define KernelPackage/rtl8192de/install
  1717. - $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  1718. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192defw.bin $(1)/lib/firmware/rtlwifi
  1719. -endef
  1720. + If unsure, select the "stable" firmware.
  1721. -define KernelPackage/rtl8192cu
  1722. - $(call KernelPackage/mac80211/Default)
  1723. - TITLE:=Realtek RTL8192CU/RTL8188CU support
  1724. - DEPENDS+= +kmod-rtlwifi-usb +kmod-rtl8192c-common
  1725. - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192cu/rtl8192cu.ko
  1726. - AUTOLOAD:=$(call AutoProbe,rtl8192cu)
  1727. -endef
  1728. + config B43_FW_5_10
  1729. + bool "Firmware 508.1084 from driver 5.10.56.27"
  1730. + help
  1731. + Older firmware for BCM43xx devices.
  1732. -define KernelPackage/rtl8192cu/install
  1733. - $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  1734. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw.bin $(1)/lib/firmware/rtlwifi
  1735. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw_A.bin $(1)/lib/firmware/rtlwifi
  1736. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw_B.bin $(1)/lib/firmware/rtlwifi
  1737. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw_TMSC.bin $(1)/lib/firmware/rtlwifi
  1738. -endef
  1739. + If unsure, select the "stable" firmware.
  1740. -ZD1211FW_NAME:=zd1211-firmware
  1741. -ZD1211FW_VERSION:=1.4
  1742. -define Download/zd1211rw
  1743. - FILE:=$(ZD1211FW_NAME)-$(ZD1211FW_VERSION).tar.bz2
  1744. - URL:=@SF/zd1211/
  1745. - MD5SUM:=19f28781d76569af8551c9d11294c870
  1746. -endef
  1747. -$(eval $(call Download,zd1211rw))
  1748. + config B43_FW_5_100_138
  1749. + bool "Firmware 666.2 from driver 5.100.138 (stable)"
  1750. + help
  1751. + The currently default firmware for BCM43xx devices.
  1752. -define KernelPackage/zd1211rw
  1753. - $(call KernelPackage/mac80211/Default)
  1754. - TITLE:=Zydas ZD1211 support
  1755. - DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-mac80211
  1756. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/zd1211rw/zd1211rw.ko
  1757. - AUTOLOAD:=$(call AutoProbe,zd1211rw)
  1758. -endef
  1759. + This firmware currently gets most of the testing and is needed for some N-PHY devices.
  1760. -define KernelPackage/adm8211
  1761. - $(call KernelPackage/mac80211/Default)
  1762. - TITLE:=ADMTek 8211 support
  1763. - DEPENDS+=@PCI_SUPPORT +kmod-mac80211 +kmod-eeprom-93cx6
  1764. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/adm8211.ko
  1765. - AUTOLOAD:=$(call AutoProbe,adm8211)
  1766. -endef
  1767. + If unsure, select the this firmware.
  1768. -define KernelPackage/ath/config
  1769. - if PACKAGE_kmod-ath
  1770. - config ATH_USER_REGD
  1771. - bool "Force Atheros drivers to respect the user's regdomain settings"
  1772. + config B43_FW_6_30
  1773. + bool "Firmware 784.2 from driver 6.30.163.46 (experimental)"
  1774. help
  1775. - Atheros' idea of regulatory handling is that the EEPROM of the card defines
  1776. - the regulatory limits and the user is only allowed to restrict the settings
  1777. - even further, even if the country allows frequencies or power levels that
  1778. - are forbidden by the EEPROM settings.
  1779. + Newer experimental firmware for BCM43xx devices.
  1780. +
  1781. + This firmware is mostly untested.
  1782. +
  1783. + If unsure, select the "stable" firmware.
  1784. +
  1785. + config B43_OPENFIRMWARE
  1786. + bool "Open FirmWare for WiFi networks"
  1787. + help
  1788. + Opensource firmware for BCM43xx devices.
  1789. +
  1790. + Do _not_ select this, unless you know what you are doing.
  1791. + The Opensource firmware is not suitable for embedded devices, yet.
  1792. + It does not support QoS, which is bad for AccessPoints.
  1793. + It does not support hardware crypto acceleration, which is a showstopper
  1794. + for embedded devices with low CPU resources.
  1795. +
  1796. + If unsure, select the "stable" firmware.
  1797. +
  1798. + endchoice
  1799. +
  1800. + config B43_FW_SQUASH
  1801. + bool "Remove unnecessary firmware files"
  1802. + depends on !B43_OPENFIRMWARE
  1803. + default y
  1804. + help
  1805. + This options allows you to remove unnecessary b43 firmware files
  1806. + from the final rootfs image. This can reduce the rootfs size by
  1807. + up to 200k.
  1808. +
  1809. + If unsure, say Y.
  1810. +
  1811. + config B43_FW_SQUASH_COREREVS
  1812. + string "Core revisions to include"
  1813. + depends on B43_FW_SQUASH
  1814. + default "5,6,7,8,9,10,11,13,15" if TARGET_brcm47xx_legacy
  1815. + default "16,28,29,30" if TARGET_brcm47xx_mips74k
  1816. + default "5,6,7,8,9,10,11,13,15,16,28,29,30"
  1817. + help
  1818. + This is a comma seperated list of core revision numbers.
  1819. +
  1820. + Example (keep files for rev5 only):
  1821. + 5
  1822. +
  1823. + Example (keep files for rev5 and rev11):
  1824. + 5,11
  1825. +
  1826. + config B43_FW_SQUASH_PHYTYPES
  1827. + string "PHY types to include"
  1828. + depends on B43_FW_SQUASH
  1829. + default "G,N,LP" if TARGET_brcm47xx_legacy
  1830. + default "N,HT" if TARGET_brcm47xx_mips74k
  1831. + default "G,N,LP,HT"
  1832. + help
  1833. + This is a comma seperated list of PHY types:
  1834. + A => A-PHY
  1835. + AG => Dual A-PHY G-PHY
  1836. + G => G-PHY
  1837. + LP => LP-PHY
  1838. + N => N-PHY
  1839. + HT => HT-PHY
  1840. + LCN => LCN-PHY
  1841. + LCN40 => LCN40-PHY
  1842. + AC => AC-PHY
  1843. +
  1844. + Example (keep files for G-PHY only):
  1845. + G
  1846. +
  1847. + Example (keep files for G-PHY and N-PHY):
  1848. + G,N
  1849. +
  1850. + choice
  1851. + prompt "Supported buses"
  1852. + default PACKAGE_B43_BUSES_BCMA_AND_SSB
  1853. + help
  1854. + This allows choosing buses that b43 should support.
  1855. +
  1856. + config PACKAGE_B43_BUSES_BCMA_AND_SSB
  1857. + depends on !TARGET_brcm47xx_legacy && !TARGET_brcm47xx_mips74k && !TARGET_bcm53xx
  1858. + bool "BCMA and SSB"
  1859. +
  1860. + config PACKAGE_B43_BUSES_BCMA
  1861. + depends on !TARGET_brcm47xx_legacy
  1862. + bool "BCMA only"
  1863. +
  1864. + config PACKAGE_B43_BUSES_SSB
  1865. + depends on !TARGET_brcm47xx_mips74k && !TARGET_bcm53xx
  1866. + bool "SSB only"
  1867. +
  1868. + endchoice
  1869. +
  1870. + config PACKAGE_B43_DEBUG
  1871. + bool "Enable debug output and debugfs for b43"
  1872. + default n
  1873. + help
  1874. + Enable additional debug output and runtime sanity checks for b43
  1875. + and enables the debugfs interface.
  1876. +
  1877. + If unsure, say N.
  1878. +
  1879. + config PACKAGE_B43_PIO
  1880. + bool "Enable support for PIO transfer mode"
  1881. + default n
  1882. + help
  1883. + Enable support for using PIO instead of DMA. Unless you have DMA
  1884. + transfer problems you don't need this.
  1885. - Select this option if you want the driver to respect the user's decision about
  1886. - regulatory settings.
  1887. + If unsure, say N.
  1888. - config PACKAGE_ATH_DEBUG
  1889. - bool "Atheros wireless debugging"
  1890. + config PACKAGE_B43_PHY_G
  1891. + bool "Enable support for G-PHYs"
  1892. + default n if TARGET_brcm47xx_mips74k
  1893. + default y
  1894. help
  1895. - Say Y, if you want to debug atheros wireless drivers.
  1896. - Right now only ath9k makes use of this.
  1897. + Enable support for G-PHY. This includes support for the following devices:
  1898. + PCI: BCM4306, BCM4311, BCM4318
  1899. + SoC: BCM5352E, BCM4712
  1900. - config PACKAGE_ATH_DFS
  1901. - bool "Enable DFS support"
  1902. + If unsure, say Y.
  1903. +
  1904. + config PACKAGE_B43_PHY_N
  1905. + bool "Enable support for N-PHYs"
  1906. default y
  1907. help
  1908. - Dynamic frequency selection (DFS) is required for most of the 5 GHz band
  1909. - channels in Europe, US, and Japan.
  1910. + Enable support for N-PHY. This includes support for the following devices:
  1911. + PCI: BCM4321, BCM4322, BCM43222, BCM43224, BCM43225
  1912. + SoC: BCM4716, BCM4717, BCM4718
  1913. - Select this option if you want to use such channels.
  1914. + Currently only 11g speed is available.
  1915. - endif
  1916. -endef
  1917. + If unsure, say Y.
  1918. -define KernelPackage/ath
  1919. - $(call KernelPackage/mac80211/Default)
  1920. - TITLE:=Atheros common driver part
  1921. - DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx||TARGET_ath25 +kmod-mac80211
  1922. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath.ko
  1923. - MENU:=1
  1924. -endef
  1925. + config PACKAGE_B43_PHY_LP
  1926. + bool "Enable support for LP-PHYs"
  1927. + default n if TARGET_brcm47xx_mips74k
  1928. + default y
  1929. + help
  1930. + Enable support for LP-PHY. This includes support for the following devices:
  1931. + PCI: BCM4312
  1932. + SoC: BCM5354
  1933. -define KernelPackage/ath/description
  1934. - This module contains some common parts needed by Atheros Wireless drivers.
  1935. -endef
  1936. + If unsure, say Y.
  1937. -define KernelPackage/ath5k
  1938. - $(call KernelPackage/mac80211/Default)
  1939. - TITLE:=Atheros 5xxx wireless cards support
  1940. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath5k
  1941. - DEPENDS+= @PCI_SUPPORT||@TARGET_ath25 +kmod-ath
  1942. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath5k/ath5k.ko
  1943. - AUTOLOAD:=$(call AutoProbe,ath5k)
  1944. -endef
  1945. + config PACKAGE_B43_PHY_HT
  1946. + bool "Enable support for HT-PHYs"
  1947. + default n if TARGET_brcm47xx_legacy
  1948. + default y
  1949. + help
  1950. + Enable support for HT-PHY. This includes support for the following devices:
  1951. + PCI: BCM4331
  1952. -define KernelPackage/ath5k/description
  1953. - This module adds support for wireless adapters based on
  1954. - Atheros 5xxx chipset.
  1955. -endef
  1956. + Currently only 11g speed is available.
  1957. -define KernelPackage/ath9k-common
  1958. - $(call KernelPackage/mac80211/Default)
  1959. - TITLE:=Atheros 802.11n wireless devices (common code for ath9k and ath9k_htc)
  1960. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  1961. - DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx +kmod-ath +@DRIVER_11N_SUPPORT +@KERNEL_RELAY
  1962. - FILES:= \
  1963. - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_common.ko \
  1964. - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_hw.ko
  1965. -endef
  1966. + If unsure, say Y.
  1967. -define KernelPackage/ath9k
  1968. - $(call KernelPackage/mac80211/Default)
  1969. - TITLE:=Atheros 802.11n PCI wireless cards support
  1970. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  1971. - DEPENDS+= @PCI_SUPPORT||TARGET_ar71xx +kmod-ath9k-common
  1972. - FILES:= \
  1973. - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k.ko
  1974. - AUTOLOAD:=$(call AutoProbe,ath9k)
  1975. -endef
  1976. + config PACKAGE_B43_PHY_LCN
  1977. + bool "Enable support for LCN-PHYs"
  1978. + depends on BROKEN
  1979. + default n
  1980. + help
  1981. + Currently broken.
  1982. -define KernelPackage/ath9k/description
  1983. -This module adds support for wireless adapters based on
  1984. -Atheros IEEE 802.11n AR5008 and AR9001 family of chipsets.
  1985. -endef
  1986. + If unsure, say N.
  1987. -define KernelPackage/ath9k/config
  1988. + endif
  1989. +endef
  1990. - config ATH9K_SUPPORT_PCOEM
  1991. - bool "Support chips used in PC OEM cards"
  1992. - depends on PACKAGE_kmod-ath9k
  1993. -
  1994. +define KernelPackage/b43/description
  1995. +Kernel module for Broadcom 43xx wireless support (mac80211 stack) new
  1996. endef
  1997. -define KernelPackage/ath9k-htc
  1998. +define KernelPackage/b43legacy
  1999. $(call KernelPackage/mac80211/Default)
  2000. - TITLE:=Atheros 802.11n USB device support
  2001. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  2002. - DEPENDS+= @USB_SUPPORT +kmod-ath9k-common +kmod-usb-core
  2003. - FILES:= \
  2004. - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_htc.ko
  2005. - AUTOLOAD:=$(call AutoProbe,ath9k_htc)
  2006. + TITLE:=Broadcom 43xx-legacy wireless support
  2007. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/b43
  2008. + KCONFIG:= \
  2009. + CONFIG_HW_RANDOM=y
  2010. + DEPENDS+= +kmod-mac80211 +!(TARGET_brcm47xx||TARGET_brcm63xx):kmod-ssb +b43legacy-firmware
  2011. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/broadcom/b43legacy/b43legacy.ko
  2012. + AUTOLOAD:=$(call AutoProbe,b43legacy)
  2013. + MENU:=1
  2014. endef
  2015. -define KernelPackage/ath9k-htc/description
  2016. -This module adds support for wireless adapters based on
  2017. -Atheros USB AR9271 and AR7010 family of chipsets.
  2018. +define KernelPackage/b43legacy/description
  2019. +Kernel module for Broadcom 43xx-legacy wireless support (mac80211 stack) new
  2020. endef
  2021. -define KernelPackage/ath10k
  2022. +
  2023. +define KernelPackage/brcmutil
  2024. $(call KernelPackage/mac80211/Default)
  2025. - TITLE:=Atheros 802.11ac wireless cards support
  2026. - URL:=https://wireless.wiki.kernel.org/en/users/Drivers/ath10k
  2027. - DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT
  2028. - FILES:= \
  2029. - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_core.ko \
  2030. - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_pci.ko
  2031. - AUTOLOAD:=$(call AutoLoad,55,ath10k_core ath10k_pci)
  2032. + TITLE:=Broadcom IEEE802.11n common driver parts
  2033. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
  2034. + DEPENDS+=@PCI_SUPPORT||USB_SUPPORT
  2035. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/broadcom/brcm80211/brcmutil/brcmutil.ko
  2036. + AUTOLOAD:=$(call AutoProbe,brcmutil)
  2037. + MENU:=1
  2038. endef
  2039. -define KernelPackage/ath10k/description
  2040. -This module adds support for wireless adapters based on
  2041. -Atheros IEEE 802.11ac family of chipsets. For now only
  2042. -PCI is supported.
  2043. +define KernelPackage/brcmutil/description
  2044. + This module contains some common parts needed by Broadcom Wireless drivers brcmsmac and brcmfmac.
  2045. endef
  2046. -define KernelPackage/ath10k/config
  2047. - if PACKAGE_kmod-ath10k
  2048. -
  2049. - config ATH10K_STA_FW
  2050. - bool "Firmware optimized for STA operation"
  2051. - default n
  2052. - help
  2053. - Use the ath10k firmware optimized for wireless client instead
  2054. - of access point operation.
  2055. +define KernelPackage/brcmutil/config
  2056. + if PACKAGE_kmod-brcmutil
  2057. - config ATH10K_API2_FW
  2058. - bool "Firmware optimized for AP operation (v10.1 / API v2)"
  2059. - default n
  2060. - depends on !ATH10K_STA_FW
  2061. + config PACKAGE_BRCM80211_DEBUG
  2062. + bool "Broadcom wireless driver debugging"
  2063. help
  2064. - Use the ath10k firmware from the 10.1 SDK using API v2 optimized
  2065. - for access point operation if the default firmware keeps crashing.
  2066. + Say Y, if you want to debug brcmsmac and brcmfmac wireless driver.
  2067. endif
  2068. endef
  2069. -define KernelPackage/carl9170
  2070. - $(call KernelPackage/mac80211/Default)
  2071. - TITLE:=Driver for Atheros AR9170 USB sticks
  2072. - DEPENDS:=@USB_SUPPORT +kmod-mac80211 +kmod-ath +kmod-usb-core +kmod-input-core +@DRIVER_11N_SUPPORT
  2073. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/carl9170/carl9170.ko
  2074. - AUTOLOAD:=$(call AutoProbe,carl9170)
  2075. +PKG_BRCMSMAC_FW_NAME:=broadcom-wl
  2076. +PKG_BRCMSMAC_FW_VERSION:=5.100.138
  2077. +PKG_BRCMSMAC_FW_OBJECT:=$(PKG_BRCMSMAC_FW_NAME)-$(PKG_BRCMSMAC_FW_VERSION)/linux/wl_apsta.o
  2078. +PKG_BRCMSMAC_FW_SOURCE:=$(PKG_BRCMSMAC_FW_NAME)-$(PKG_BRCMSMAC_FW_VERSION).tar.bz2
  2079. +PKG_BRCMSMAC_FW_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/
  2080. +PKG_BRCMSMAC_FW_MD5SUM:=f4e357b09eaf5d8b1f1920cf3493a555
  2081. +
  2082. +define Download/brcmsmac
  2083. + FILE:=$(PKG_BRCMSMAC_FW_SOURCE)
  2084. + URL:=$(PKG_BRCMSMAC_FW_SOURCE_URL)
  2085. + MD5SUM:=$(PKG_BRCMSMAC_FW_MD5SUM)
  2086. endef
  2087. +$(eval $(call Download,brcmsmac))
  2088. -define KernelPackage/lib80211
  2089. +define KernelPackage/brcmsmac
  2090. $(call KernelPackage/mac80211/Default)
  2091. - TITLE:=802.11 Networking stack
  2092. - DEPENDS:=+kmod-cfg80211
  2093. - FILES:= \
  2094. - $(PKG_BUILD_DIR)/net/wireless/lib80211.ko \
  2095. - $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_wep.ko \
  2096. - $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_ccmp.ko \
  2097. - $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_tkip.ko
  2098. - AUTOLOAD:=$(call AutoProbe, \
  2099. - lib80211 \
  2100. - lib80211_crypt_wep \
  2101. - lib80211_crypt_ccmp \
  2102. - lib80211_crypt_tkip \
  2103. - )
  2104. + TITLE:=Broadcom IEEE802.11n PCIe SoftMAC WLAN driver
  2105. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
  2106. + DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT +!TARGET_brcm47xx:kmod-bcma +kmod-lib-cordic +kmod-lib-crc8 +kmod-brcmutil +!BRCMSMAC_USE_FW_FROM_WL:brcmsmac-firmware
  2107. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/broadcom/brcm80211/brcmsmac/brcmsmac.ko
  2108. + AUTOLOAD:=$(call AutoProbe,brcmsmac)
  2109. + MENU:=1
  2110. endef
  2111. -define KernelPackage/lib80211/description
  2112. - Kernel modules for 802.11 Networking stack
  2113. - Includes:
  2114. - - lib80211
  2115. - - lib80211_crypt_wep
  2116. - - lib80211_crypt_tkip
  2117. - - lib80211_crytp_ccmp
  2118. +define KernelPackage/brcmsmac/description
  2119. + Kernel module for Broadcom IEEE802.11n PCIe Wireless cards
  2120. endef
  2121. -define KernelPackage/libertas-usb
  2122. - $(call KernelPackage/mac80211/Default)
  2123. - DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +kmod-usb-core +kmod-lib80211 +@DRIVER_WEXT_SUPPORT
  2124. - TITLE:=Marvell 88W8015 Wireless Driver
  2125. - FILES:= \
  2126. - $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/libertas.ko \
  2127. - $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/usb8xxx.ko
  2128. - AUTOLOAD:=$(call AutoProbe,libertas usb8xxx)
  2129. -endef
  2130. +define KernelPackage/brcmsmac/config
  2131. + if PACKAGE_kmod-brcmsmac
  2132. -define KernelPackage/libertas-sdio
  2133. - $(call KernelPackage/mac80211/Default)
  2134. - DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +kmod-mmc +@DRIVER_WEXT_SUPPORT @!TARGET_uml
  2135. - TITLE:=Marvell 88W8686 Wireless Driver
  2136. - FILES:= \
  2137. - $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/libertas.ko \
  2138. - $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/libertas_sdio.ko
  2139. - AUTOLOAD:=$(call AutoProbe,libertas libertas_sdio)
  2140. -endef
  2141. + config BRCMSMAC_USE_FW_FROM_WL
  2142. + bool "Use firmware extracted from broadcom proprietary driver"
  2143. + default y
  2144. + help
  2145. + Instead of using the official brcmsmac firmware a firmware
  2146. + version 666.2 extracted from the proprietary Broadcom driver
  2147. + is used. This is needed to get core rev 17 used in bcm4716
  2148. + to work.
  2149. -define KernelPackage/mac80211-hwsim
  2150. - $(call KernelPackage/mac80211/Default)
  2151. - TITLE:=mac80211 HW simulation device
  2152. - DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT
  2153. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mac80211_hwsim.ko
  2154. - AUTOLOAD:=$(call AutoProbe,mac80211_hwsim)
  2155. + If unsure, say Y.
  2156. +
  2157. + endif
  2158. endef
  2159. -define KernelPackage/net-libipw
  2160. +
  2161. +define KernelPackage/brcmfmac
  2162. $(call KernelPackage/mac80211/Default)
  2163. - TITLE:=libipw for ipw2100 and ipw2200
  2164. - 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
  2165. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ipw2x00/libipw.ko
  2166. - AUTOLOAD:=$(call AutoProbe,libipw)
  2167. + TITLE:=Broadcom IEEE802.11n USB FullMAC WLAN driver
  2168. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
  2169. + DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +@DRIVER_11N_SUPPORT +kmod-brcmutil \
  2170. + +BRCMFMAC_PCIE:brcmfmac-firmware-pcie \
  2171. + +BRCMFMAC_SDIO:kmod-mmc +BRCMFMAC_SDIO:brcmfmac-firmware-sdio \
  2172. + +BRCMFMAC_USB:kmod-usb-core +BRCMFMAC_USB:brcmfmac-firmware-usb
  2173. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko
  2174. + AUTOLOAD:=$(call AutoProbe,brcmfmac)
  2175. endef
  2176. -define KernelPackage/net-libipw/description
  2177. - Hardware independent IEEE 802.11 networking stack for ipw2100 and ipw2200.
  2178. +define KernelPackage/brcmfmac/description
  2179. + Kernel module for Broadcom IEEE802.11n USB Wireless cards
  2180. endef
  2181. -IPW2100_NAME:=ipw2100-fw
  2182. -IPW2100_VERSION:=1.3
  2183. -
  2184. -define Download/net-ipw2100
  2185. - URL:=http://bughost.org/firmware/
  2186. - FILE:=$(IPW2100_NAME)-$(IPW2100_VERSION).tgz
  2187. - MD5SUM=46aa75bcda1a00efa841f9707bbbd113
  2188. -endef
  2189. -$(eval $(call Download,net-ipw2100))
  2190. +define KernelPackage/brcmfmac/config
  2191. + if PACKAGE_kmod-brcmfmac
  2192. -define KernelPackage/net-ipw2100
  2193. - $(call KernelPackage/mac80211/Default)
  2194. - TITLE:=Intel IPW2100 driver
  2195. - DEPENDS:=@PCI_SUPPORT +kmod-net-libipw
  2196. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ipw2x00/ipw2100.ko
  2197. - AUTOLOAD:=$(call AutoProbe,ipw2100)
  2198. -endef
  2199. + config BRCMFMAC_SDIO
  2200. + bool "Enable SDIO bus interface support"
  2201. + default n
  2202. + help
  2203. + Enable support for cards attached to an SDIO bus.
  2204. + Select this option only if you are sure that your
  2205. + board has a Broadcom wireless chip atacched to
  2206. + that bus.
  2207. -define KernelPackage/net-ipw2100/description
  2208. - Kernel support for Intel IPW2100
  2209. - Includes:
  2210. - - ipw2100
  2211. -endef
  2212. + config BRCMFMAC_USB
  2213. + bool "Enable USB bus interface support"
  2214. + depends on USB_SUPPORT
  2215. + default y
  2216. + help
  2217. + Supported USB connected chipsets:
  2218. + BCM43235, BCM43236, BCM43238 (all in revision 3 only)
  2219. + BCM43143, BCM43242, BCM43566, BCM43569
  2220. -IPW2200_NAME:=ipw2200-fw
  2221. -IPW2200_VERSION:=3.1
  2222. + config BRCMFMAC_PCIE
  2223. + bool "Enable PCIE bus interface support"
  2224. + depends on PCI_SUPPORT
  2225. + default y
  2226. + help
  2227. + Supported PCIe connected chipsets:
  2228. + BCM4354, BCM4356, BCM43567, BCM43570, BCM43602
  2229. -define Download/net-ipw2200
  2230. - URL:=http://bughost.org/firmware/
  2231. - FILE:=$(IPW2200_NAME)-$(IPW2200_VERSION).tgz
  2232. - MD5SUM=eaba788643c7cc7483dd67ace70f6e99
  2233. + endif
  2234. endef
  2235. -$(eval $(call Download,net-ipw2200))
  2236. -define KernelPackage/net-ipw2200
  2237. - $(call KernelPackage/mac80211/Default)
  2238. - TITLE:=Intel IPW2200 driver
  2239. - DEPENDS:=@PCI_SUPPORT +kmod-net-libipw
  2240. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ipw2x00/ipw2200.ko
  2241. - AUTOLOAD:=$(call AutoProbe,ipw2200)
  2242. -endef
  2243. -define KernelPackage/net-ipw2200/description
  2244. - Kernel support for Intel IPW2200
  2245. - Includes:
  2246. - - ipw2200
  2247. +define KernelPackage/carl9170
  2248. + $(call KernelPackage/mac80211/Default)
  2249. + TITLE:=Driver for Atheros AR9170 USB sticks
  2250. + DEPENDS:=@USB_SUPPORT +kmod-mac80211 +kmod-ath +kmod-usb-core +kmod-input-core +@DRIVER_11N_SUPPORT +carl9170-firmware
  2251. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/carl9170/carl9170.ko
  2252. + AUTOLOAD:=$(call AutoProbe,carl9170)
  2253. endef
  2254. -define KernelPackage/net-hermes
  2255. +define KernelPackage/hermes
  2256. $(call KernelPackage/mac80211/Default)
  2257. TITLE:=Hermes 802.11b chipset support
  2258. - DEPENDS:=@PCI_SUPPORT||PCMCIA_SUPPORT +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT
  2259. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/orinoco/orinoco.ko
  2260. + DEPENDS:=@PCI_SUPPORT||PCMCIA_SUPPORT +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT +kmod-crypto-michael-mic
  2261. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/orinoco/orinoco.ko
  2262. AUTOLOAD:=$(call AutoProbe,orinoco)
  2263. endef
  2264. -define KernelPackage/net-hermes/description
  2265. +define KernelPackage/hermes/description
  2266. Kernel support for Hermes 802.11b chipsets
  2267. endef
  2268. -define KernelPackage/net-hermes-pci
  2269. +define KernelPackage/hermes-pci
  2270. $(call KernelPackage/mac80211/Default)
  2271. TITLE:=Intersil Prism 2.5 PCI support
  2272. - DEPENDS:=@PCI_SUPPORT +kmod-net-hermes
  2273. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/orinoco/orinoco_pci.ko
  2274. + DEPENDS:=@PCI_SUPPORT +kmod-hermes
  2275. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/orinoco/orinoco_pci.ko
  2276. AUTOLOAD:=$(call AutoProbe,orinoco_pci)
  2277. endef
  2278. -define KernelPackage/net-hermes-pci/description
  2279. +define KernelPackage/hermes-pci/description
  2280. Kernel modules for Intersil Prism 2.5 PCI support
  2281. endef
  2282. -define KernelPackage/net-hermes-plx
  2283. +define KernelPackage/hermes-plx
  2284. $(call KernelPackage/mac80211/Default)
  2285. TITLE:=PLX9052 based PCI adaptor
  2286. - DEPENDS:=@PCI_SUPPORT +kmod-net-hermes
  2287. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/orinoco/orinoco_plx.ko
  2288. + DEPENDS:=@PCI_SUPPORT +kmod-hermes
  2289. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/orinoco/orinoco_plx.ko
  2290. AUTOLOAD:=$(call AutoProbe,orinoco_plx)
  2291. endef
  2292. -define KernelPackage/net-hermes-plx/description
  2293. +define KernelPackage/hermes-plx/description
  2294. Kernel modules for Hermes in PLX9052 based PCI adaptors
  2295. endef
  2296. -define KernelPackage/net-hermes-pcmcia
  2297. +define KernelPackage/hermes-pcmcia
  2298. $(call KernelPackage/mac80211/Default)
  2299. TITLE:=Hermes based PCMCIA adaptors
  2300. - DEPENDS:=@PCMCIA_SUPPORT +kmod-net-hermes @BROKEN
  2301. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/orinoco/orinoco_cs.ko
  2302. + DEPENDS:=@PCMCIA_SUPPORT +kmod-hermes @BROKEN
  2303. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/orinoco/orinoco_cs.ko
  2304. AUTOLOAD:=$(call AutoProbe,orinoco_cs)
  2305. endef
  2306. -define KernelPackage/net-hermes-pcmcia/description
  2307. +define KernelPackage/hermes-pcmcia/description
  2308. Kernel modules for Hermes based PCMCIA adaptors
  2309. endef
  2310. -define KernelPackage/iwlagn
  2311. +
  2312. +define KernelPackage/iwlwifi
  2313. $(call KernelPackage/mac80211/Default)
  2314. - DEPENDS:= +kmod-mac80211 @PCI_SUPPORT +@DRIVER_11N_SUPPORT
  2315. + DEPENDS:= +kmod-mac80211 @PCI_SUPPORT +@DRIVER_11N_SUPPORT +iwlwifi-firmware
  2316. TITLE:=Intel AGN Wireless support
  2317. FILES:= \
  2318. - $(PKG_BUILD_DIR)/drivers/net/wireless/iwlwifi/iwlwifi.ko \
  2319. - $(PKG_BUILD_DIR)/drivers/net/wireless/iwlwifi/dvm/iwldvm.ko
  2320. - AUTOLOAD:=$(call AutoProbe,iwlwifi iwldvm)
  2321. + $(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlwifi/iwlwifi.ko \
  2322. + $(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlwifi/dvm/iwldvm.ko \
  2323. + $(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlwifi/mvm/iwlmvm.ko
  2324. + AUTOLOAD:=$(call AutoProbe,iwlwifi iwldvm iwlmvm)
  2325. MENU:=1
  2326. endef
  2327. -define KernelPackage/iwlagn/description
  2328. - iwlagn kernel module for Intel 5000/5150/1000/6000/6050/6005/6030/100 support
  2329. -endef
  2330. -
  2331. -define KernelPackage/iwlagn/config
  2332. - if PACKAGE_kmod-iwlagn
  2333. -
  2334. - config IWL5000_FW
  2335. - bool "Intel 5000 Firmware"
  2336. - default y
  2337. - help
  2338. - Download and install firmware for:
  2339. - Intel Wireless WiFi 5100AGN, 5300AGN, and 5350AGN
  2340. -
  2341. - config IWL5150_FW
  2342. - bool "Intel 5150 Firmware"
  2343. - default y
  2344. - help
  2345. - Download and install firmware for:
  2346. - Intel Wireless WiFi 5150AGN
  2347. -
  2348. - config IWL1000_FW
  2349. - bool "Intel 1000 Firmware"
  2350. - default y
  2351. - help
  2352. - Download and install firmware for:
  2353. - Intel Centrino Wireless-N 1000
  2354. -
  2355. - config IWL6000_FW
  2356. - bool "Intel 6000 Firmware"
  2357. - default y
  2358. - help
  2359. - Download and install firmware for:
  2360. - Intel Centrino Ultimate-N 6300 and Advanced-N 6200
  2361. -
  2362. - config IWL6050_FW
  2363. - bool "Intel 6050 Firmware"
  2364. - default y
  2365. - help
  2366. - Download and install firmware for:
  2367. - Intel Centrino Advanced-N + WiMAX 6250 and Wireless-N + WiMAX 6150
  2368. -
  2369. - config IWL6005_FW
  2370. - bool "Intel 6005 Firmware"
  2371. - default y
  2372. +define KernelPackage/iwlwifi/description
  2373. + iwlwifi kernel module for
  2374. + Intel Wireless WiFi Link 6250AGN Adapter
  2375. + Intel 6000 Series Wi-Fi Adapters (6200AGN and 6300AGN)
  2376. + Intel WiFi Link 1000BGN
  2377. + Intel Wireless WiFi 5150AGN
  2378. + Intel Wireless WiFi 5100AGN, 5300AGN, and 5350AGN
  2379. + Intel 6005 Series Wi-Fi Adapters
  2380. + Intel 6030 Series Wi-Fi Adapters
  2381. + Intel Wireless WiFi Link 6150BGN 2 Adapter
  2382. + Intel 100 Series Wi-Fi Adapters (100BGN and 130BGN)
  2383. + Intel 2000 Series Wi-Fi Adapters
  2384. + Intel 7260 Wi-Fi Adapter
  2385. + Intel 3160 Wi-Fi Adapter
  2386. + Intel 7265 Wi-Fi Adapter
  2387. + Intel 8260 Wi-Fi Adapter
  2388. + Intel 3165 Wi-Fi Adapter
  2389. +endef
  2390. +
  2391. +define KernelPackage/iwlwifi/config
  2392. + if PACKAGE_kmod-iwlwifi
  2393. +
  2394. + config PACKAGE_IWLWIFI_DEBUG
  2395. + bool "Enable full debugging output in the iwlwifi driver"
  2396. + default n
  2397. help
  2398. - Download and install firmware for:
  2399. - Intel Centrino Advanced-N 6205
  2400. + This option will enable debug tracing output for the iwlwifi drivers
  2401. - config IWL6030_FW
  2402. - bool "Intel 6030 Firmware"
  2403. - default y
  2404. - help
  2405. - Download and install firmware for:
  2406. - Intel Centrino Advanced-N 6230, Wireless-N 1030, Wireless-N 130 and Advanced-N 6235
  2407. + This will result in the kernel module being ~100k larger. You can
  2408. + control which debug output is sent to the kernel log by setting the
  2409. + value in
  2410. - config IWL7260_FW
  2411. - bool "Intel 7260 Firmware"
  2412. - default y
  2413. - help
  2414. - Download and install firmware for:
  2415. - Intel Dual Band Wireless-N 7260 and Intel Dual Band Wireless-AC 7260
  2416. + /sys/module/iwlwifi/parameters/debug
  2417. - config IWL7265_FW
  2418. - bool "Intel 7265 Firmware"
  2419. - default y
  2420. - help
  2421. - Download and install firmware for:
  2422. - Intel Wireless 7265
  2423. + This entry will only exist if this option is enabled.
  2424. - config IWL100_FW
  2425. - bool "Intel 100 Firmware"
  2426. - default y
  2427. - help
  2428. - Download and install firmware for:
  2429. - Intel Centrino Wireless-N 100
  2430. + To set a value, simply echo an 8-byte hex value to the same file:
  2431. - config IWL2000_FW
  2432. - bool "Intel 2000 Firmware"
  2433. - default y
  2434. - help
  2435. - Download and install firmware for:
  2436. - Intel Centrino Wireless-N 2200
  2437. + % echo 0x43fff > /sys/module/iwlwifi/parameters/debug
  2438. - config IWL2030_FW
  2439. - bool "Intel 2030 Firmware"
  2440. - default y
  2441. - help
  2442. - Download and install firmware for:
  2443. - Intel Centrino Wireless-N 2230
  2444. + You can find the list of debug mask values in:
  2445. + drivers/net/wireless/intel/iwlwifi/iwl-debug.h
  2446. - config IWL105_FW
  2447. - bool "Intel 105 Firmware"
  2448. - default y
  2449. - help
  2450. - Download and install firmware for:
  2451. - Intel Centrino Wireless-N 105
  2452. + If this is your first time using this driver, you should say Y here
  2453. + as the debug information can assist others in helping you resolve
  2454. + any problems you may encounter.
  2455. - config IWL135_FW
  2456. - bool "Intel 135 Firmware"
  2457. - default y
  2458. + config PACKAGE_IWLWIFI_DEBUGFS
  2459. + bool "iwlwifi debugfs support"
  2460. + depends on PACKAGE_MAC80211_DEBUGFS
  2461. + default n
  2462. help
  2463. - Download and install firmware for:
  2464. - Intel Centrino Wireless-N 135
  2465. + Enable creation of debugfs files for the iwlwifi drivers. This
  2466. + is a low-impact option that allows getting insight into the
  2467. + driver's state at runtime.
  2468. - config IWL3160_FW
  2469. - bool "Intel 3160 Firmware"
  2470. - default y
  2471. - help
  2472. - Download and install firmware for:
  2473. - Intel Wireless 3160
  2474. endif
  2475. endef
  2476. @@ -942,7 +834,7 @@ define KernelPackage/iwl-legacy
  2477. $(call KernelPackage/mac80211/Default)
  2478. DEPENDS:= +kmod-mac80211 @PCI_SUPPORT
  2479. TITLE:=Intel legacy Wireless support
  2480. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/iwlegacy/iwlegacy.ko
  2481. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlegacy/iwlegacy.ko
  2482. AUTOLOAD:=$(call AutoProbe,iwlegacy)
  2483. endef
  2484. @@ -952,9 +844,9 @@ endef
  2485. define KernelPackage/iwl3945
  2486. $(call KernelPackage/mac80211/Default)
  2487. - DEPENDS:= +kmod-mac80211 +kmod-iwl-legacy
  2488. + DEPENDS:= +kmod-mac80211 +kmod-iwl-legacy +iwl3945-firmware
  2489. TITLE:=Intel iwl3945 Wireless support
  2490. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/iwlegacy/iwl3945.ko
  2491. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlegacy/iwl3945.ko
  2492. AUTOLOAD:=$(call AutoProbe,iwl3945)
  2493. endef
  2494. @@ -964,9 +856,9 @@ endef
  2495. define KernelPackage/iwl4965
  2496. $(call KernelPackage/mac80211/Default)
  2497. - DEPENDS:= +kmod-mac80211 +kmod-iwl-legacy +@DRIVER_11N_SUPPORT
  2498. + DEPENDS:= +kmod-mac80211 +kmod-iwl-legacy +@DRIVER_11N_SUPPORT +iwl4965-firmware
  2499. TITLE:=Intel iwl4965 Wireless support
  2500. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/iwlegacy/iwl4965.ko
  2501. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlegacy/iwl4965.ko
  2502. AUTOLOAD:=$(call AutoProbe,iwl4965)
  2503. endef
  2504. @@ -975,557 +867,562 @@ define KernelPackage/iwl4965/description
  2505. endef
  2506. -define KernelPackage/mwl8k
  2507. - $(call KernelPackage/mac80211/Default)
  2508. - TITLE:=Driver for Marvell TOPDOG 802.11 Wireless cards
  2509. - URL:=http://wireless.kernel.org/en/users/Drivers/mwl8k
  2510. - DEPENDS+= @PCI_SUPPORT +kmod-mac80211 +@DRIVER_11N_SUPPORT
  2511. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mwl8k.ko
  2512. - AUTOLOAD:=$(call AutoProbe,mwl8k)
  2513. -endef
  2514. -
  2515. -define KernelPackage/mwl8k/description
  2516. - Kernel modules for Marvell TOPDOG 802.11 Wireless cards
  2517. -endef
  2518. -
  2519. -
  2520. -define KernelPackage/mwifiex-pcie
  2521. - $(call KernelPackage/mac80211/Default)
  2522. - TITLE:=Driver for Marvell 802.11n/802.11ac PCIe Wireless cards
  2523. - URL:=http://wireless.kernel.org/en/users/Drivers/mwifiex
  2524. - DEPENDS+= @PCI_SUPPORT +kmod-mac80211 +@DRIVER_11N_SUPPORT
  2525. - FILES:= \
  2526. - $(PKG_BUILD_DIR)/drivers/net/wireless/mwifiex/mwifiex.ko \
  2527. - $(PKG_BUILD_DIR)/drivers/net/wireless/mwifiex/mwifiex_pcie.ko
  2528. - AUTOLOAD:=$(call AutoProbe,mwifiex_pcie)
  2529. -endef
  2530. -
  2531. -define KernelPackage/mwifiex-pcie/description
  2532. - Kernel modules for Marvell 802.11n/802.11ac PCIe Wireless cards
  2533. -endef
  2534. -
  2535. -
  2536. -define KernelPackage/wlcore
  2537. +define KernelPackage/lib80211
  2538. $(call KernelPackage/mac80211/Default)
  2539. - TITLE:=TI common driver part
  2540. - DEPENDS+= @TARGET_omap +kmod-mac80211 +@DRIVER_11N_SUPPORT
  2541. + TITLE:=802.11 Networking stack
  2542. + DEPENDS:=+kmod-cfg80211
  2543. FILES:= \
  2544. - $(PKG_BUILD_DIR)/drivers/net/wireless/ti/wlcore/wlcore.ko \
  2545. - $(PKG_BUILD_DIR)/drivers/net/wireless/ti/wlcore/wlcore_sdio.ko
  2546. - AUTOLOAD:=$(call AutoProbe,wlcore wlcore_sdio)
  2547. -endef
  2548. -
  2549. -define KernelPackage/wlcore/description
  2550. - This module contains some common parts needed by TI Wireless drivers.
  2551. -endef
  2552. -
  2553. -define KernelPackage/wl12xx
  2554. - $(call KernelPackage/mac80211/Default)
  2555. - TITLE:=Driver for TI WL12xx
  2556. - URL:=http://wireless.kernel.org/en/users/Drivers/wl12xx
  2557. - DEPENDS+= +kmod-wlcore
  2558. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ti/wl12xx/wl12xx.ko
  2559. - AUTOLOAD:=$(call AutoProbe,wl12xx)
  2560. -endef
  2561. -
  2562. -define KernelPackage/wl12xx/description
  2563. - Kernel modules for TI WL12xx
  2564. -endef
  2565. -
  2566. -define KernelPackage/wl18xx
  2567. - $(call KernelPackage/mac80211/Default)
  2568. - TITLE:=Driver for TI WL18xx
  2569. - URL:=http://wireless.kernel.org/en/users/Drivers/wl18xx
  2570. - DEPENDS+= +kmod-wlcore
  2571. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ti/wl18xx/wl18xx.ko
  2572. - AUTOLOAD:=$(call AutoProbe,wl18xx)
  2573. -endef
  2574. -
  2575. -define KernelPackage/wl18xx/description
  2576. - Kernel modules for TI WL18xx
  2577. -endef
  2578. -
  2579. -
  2580. -#Broadcom firmware
  2581. -ifneq ($(CONFIG_B43_FW_6_30),)
  2582. - PKG_B43_FWV4_NAME:=broadcom-wl
  2583. - PKG_B43_FWV4_VERSION:=6.30.163.46
  2584. - PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).wl_apsta.o
  2585. - PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  2586. - PKG_B43_FWV4_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/
  2587. - PKG_B43_FWV4_MD5SUM:=6fe97e9368d25342a1ab943d3cf3496d
  2588. -else
  2589. -ifneq ($(CONFIG_B43_FW_5_10),)
  2590. - PKG_B43_FWV4_NAME:=broadcom-wl
  2591. - PKG_B43_FWV4_VERSION:=5.10.56.27.3
  2592. - PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/driver/wl_apsta/wl_prebuilt.o
  2593. - PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)_mipsel.tar.bz2
  2594. - PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
  2595. - PKG_B43_FWV4_MD5SUM:=3363e3a6b3d9d73c49dea870c7834eac
  2596. -else
  2597. -ifneq ($(CONFIG_B43_FW_4_178),)
  2598. - PKG_B43_FWV4_NAME:=broadcom-wl
  2599. - PKG_B43_FWV4_VERSION:=4.178.10.4
  2600. - PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/linux/wl_apsta.o
  2601. - PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  2602. - PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
  2603. - PKG_B43_FWV4_MD5SUM:=14477e8cbbb91b11896affac9b219fdb
  2604. -else
  2605. -ifneq ($(CONFIG_B43_FW_5_100_138),)
  2606. - PKG_B43_FWV4_NAME:=broadcom-wl
  2607. - PKG_B43_FWV4_VERSION:=5.100.138
  2608. - PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/linux/wl_apsta.o
  2609. - PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  2610. - PKG_B43_FWV4_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/
  2611. - PKG_B43_FWV4_MD5SUM:=f4e357b09eaf5d8b1f1920cf3493a555
  2612. -else
  2613. - PKG_B43_FWV4_NAME:=broadcom-wl
  2614. - PKG_B43_FWV4_VERSION:=4.150.10.5
  2615. - PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/driver/wl_apsta_mimo.o
  2616. - PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  2617. - PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
  2618. - PKG_B43_FWV4_MD5SUM:=0c6ba9687114c6b598e8019e262d9a60
  2619. -endif
  2620. -endif
  2621. -endif
  2622. -endif
  2623. -ifneq ($(CONFIG_B43_OPENFIRMWARE),)
  2624. - PKG_B43_FWV4_NAME:=broadcom-wl
  2625. - PKG_B43_FWV4_VERSION:=5.2
  2626. - PKG_B43_FWV4_OBJECT:=openfwwf-$(PKG_B43_FWV4_VERSION)
  2627. - PKG_B43_FWV4_SOURCE:=openfwwf-$(PKG_B43_FWV4_VERSION).tar.gz
  2628. - PKG_B43_FWV4_SOURCE_URL:=http://www.ing.unibs.it/openfwwf/firmware/
  2629. - PKG_B43_FWV4_MD5SUM:=e045a135453274e439ae183f8498b0fa
  2630. -endif
  2631. -
  2632. -
  2633. -PKG_B43_FWV3_NAME:=wl_apsta
  2634. -PKG_B43_FWV3_VERSION:=3.130.20.0
  2635. -PKG_B43_FWV3_SOURCE:=$(PKG_B43_FWV3_NAME)-$(PKG_B43_FWV3_VERSION).o
  2636. -PKG_B43_FWV3_SOURCE_URL:=http://downloads.openwrt.org/sources/
  2637. -PKG_B43_FWV3_MD5SUM:=e08665c5c5b66beb9c3b2dd54aa80cb3
  2638. -
  2639. -define Download/b43
  2640. - FILE:=$(PKG_B43_FWV4_SOURCE)
  2641. - URL:=$(PKG_B43_FWV4_SOURCE_URL)
  2642. - MD5SUM:=$(PKG_B43_FWV4_MD5SUM)
  2643. -endef
  2644. -$(eval $(call Download,b43))
  2645. -
  2646. -define Download/b43legacy
  2647. - FILE:=$(PKG_B43_FWV3_SOURCE)
  2648. - URL:=$(PKG_B43_FWV3_SOURCE_URL)
  2649. - MD5SUM:=$(PKG_B43_FWV3_MD5SUM)
  2650. + $(PKG_BUILD_DIR)/net/wireless/lib80211.ko \
  2651. + $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_wep.ko \
  2652. + $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_ccmp.ko \
  2653. + $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_tkip.ko
  2654. + AUTOLOAD:=$(call AutoProbe, \
  2655. + lib80211 \
  2656. + lib80211_crypt_wep \
  2657. + lib80211_crypt_ccmp \
  2658. + lib80211_crypt_tkip \
  2659. + )
  2660. endef
  2661. -$(eval $(call Download,b43legacy))
  2662. -
  2663. -define KernelPackage/b43
  2664. - $(call KernelPackage/mac80211/Default)
  2665. - TITLE:=Broadcom 43xx wireless support
  2666. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/b43
  2667. - KCONFIG:= \
  2668. - CONFIG_HW_RANDOM=y
  2669. - # Depend on PCI_SUPPORT to make sure we can select kmod-bcma or kmod-ssb
  2670. - DEPENDS += \
  2671. - @PCI_SUPPORT +kmod-mac80211 \
  2672. - $(if $(CONFIG_PACKAGE_B43_USE_SSB),+kmod-ssb) \
  2673. - $(if $(CONFIG_PACKAGE_B43_USE_BCMA),+kmod-bcma)
  2674. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/b43/b43.ko
  2675. - AUTOLOAD:=$(call AutoProbe,b43)
  2676. - MENU:=1
  2677. +define KernelPackage/lib80211/description
  2678. + Kernel modules for 802.11 Networking stack
  2679. + Includes:
  2680. + - lib80211
  2681. + - lib80211_crypt_wep
  2682. + - lib80211_crypt_tkip
  2683. + - lib80211_crytp_ccmp
  2684. endef
  2685. -define KernelPackage/b43/config
  2686. -
  2687. -config PACKAGE_B43_USE_SSB
  2688. - select PACKAGE_kmod-ssb
  2689. - tristate
  2690. - depends on !TARGET_brcm47xx && !TARGET_brcm63xx
  2691. - default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA_AND_SSB
  2692. - default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_SSB
  2693. -
  2694. -config PACKAGE_B43_USE_BCMA
  2695. - select PACKAGE_kmod-bcma
  2696. - tristate
  2697. - depends on !TARGET_brcm47xx && !TARGET_bcm53xx
  2698. - default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA_AND_SSB
  2699. - default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA
  2700. -
  2701. - if PACKAGE_kmod-b43
  2702. - choice
  2703. - prompt "b43 firmware version"
  2704. - default B43_FW_5_100_138
  2705. - help
  2706. - This option allows you to select the version of the b43 firmware.
  2707. +define KernelPackage/libipw
  2708. + $(call KernelPackage/mac80211/Default)
  2709. + TITLE:=libipw for ipw2100 and ipw2200
  2710. + DEPENDS:=@PCI_SUPPORT +kmod-crypto-michael-mic +kmod-lib80211 +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT @!BIG_ENDIAN
  2711. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/ipw2x00/libipw.ko
  2712. + AUTOLOAD:=$(call AutoProbe,libipw)
  2713. +endef
  2714. - config B43_FW_4_150
  2715. - bool "Firmware 410.2160 from driver 4.150.10.5 (old stable)"
  2716. - help
  2717. - Old stable firmware for BCM43xx devices.
  2718. +define KernelPackage/libipw/description
  2719. + Hardware independent IEEE 802.11 networking stack for ipw2100 and ipw2200.
  2720. +endef
  2721. - If unsure, select this.
  2722. +IPW2100_NAME:=ipw2100-fw
  2723. +IPW2100_VERSION:=1.3
  2724. - config B43_FW_4_178
  2725. - bool "Firmware 478.104 from driver 4.178.10.4"
  2726. - help
  2727. - Older firmware for BCM43xx devices.
  2728. +define Download/ipw2100
  2729. + URL:=http://bughost.org/firmware/
  2730. + FILE:=$(IPW2100_NAME)-$(IPW2100_VERSION).tgz
  2731. + MD5SUM=46aa75bcda1a00efa841f9707bbbd113
  2732. +endef
  2733. +$(eval $(call Download,ipw2100))
  2734. - If unsure, select the "stable" firmware.
  2735. +define KernelPackage/ipw2100
  2736. + $(call KernelPackage/mac80211/Default)
  2737. + TITLE:=Intel IPW2100 driver
  2738. + DEPENDS:=@PCI_SUPPORT +kmod-libipw
  2739. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/ipw2x00/ipw2100.ko
  2740. + AUTOLOAD:=$(call AutoProbe,ipw2100)
  2741. +endef
  2742. - config B43_FW_5_10
  2743. - bool "Firmware 508.1084 from driver 5.10.56.27"
  2744. - help
  2745. - Older firmware for BCM43xx devices.
  2746. +define KernelPackage/ipw2100/description
  2747. + Kernel support for Intel IPW2100
  2748. + Includes:
  2749. + - ipw2100
  2750. +endef
  2751. - If unsure, select the "stable" firmware.
  2752. +IPW2200_NAME:=ipw2200-fw
  2753. +IPW2200_VERSION:=3.1
  2754. - config B43_FW_5_100_138
  2755. - bool "Firmware 666.2 from driver 5.100.138 (stable)"
  2756. - help
  2757. - The currently default firmware for BCM43xx devices.
  2758. +define Download/ipw2200
  2759. + URL:=http://bughost.org/firmware/
  2760. + FILE:=$(IPW2200_NAME)-$(IPW2200_VERSION).tgz
  2761. + MD5SUM=eaba788643c7cc7483dd67ace70f6e99
  2762. +endef
  2763. +$(eval $(call Download,ipw2200))
  2764. - This firmware currently gets most of the testing and is needed for some N-PHY devices.
  2765. +define KernelPackage/ipw2200
  2766. + $(call KernelPackage/mac80211/Default)
  2767. + TITLE:=Intel IPW2200 driver
  2768. + DEPENDS:=@PCI_SUPPORT +kmod-libipw
  2769. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/ipw2x00/ipw2200.ko
  2770. + AUTOLOAD:=$(call AutoProbe,ipw2200)
  2771. +endef
  2772. - If unsure, select the this firmware.
  2773. +define KernelPackage/ipw2200/description
  2774. + Kernel support for Intel IPW2200
  2775. + Includes:
  2776. + - ipw2200
  2777. +endef
  2778. - config B43_FW_6_30
  2779. - bool "Firmware 784.2 from driver 6.30.163.46 (experimental)"
  2780. - help
  2781. - Newer experimental firmware for BCM43xx devices.
  2782. - This firmware is mostly untested.
  2783. +define KernelPackage/libertas-usb
  2784. + $(call KernelPackage/mac80211/Default)
  2785. + DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +kmod-usb-core +kmod-lib80211 +@DRIVER_WEXT_SUPPORT +libertas-usb-firmware
  2786. + TITLE:=Marvell 88W8015 Wireless Driver
  2787. + FILES:= \
  2788. + $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/libertas/libertas.ko \
  2789. + $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/libertas/usb8xxx.ko
  2790. + AUTOLOAD:=$(call AutoProbe,libertas usb8xxx)
  2791. +endef
  2792. - If unsure, select the "stable" firmware.
  2793. +define KernelPackage/libertas-sdio
  2794. + $(call KernelPackage/mac80211/Default)
  2795. + DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +kmod-mmc +@DRIVER_WEXT_SUPPORT @!TARGET_uml +libertas-sdio-firmware
  2796. + TITLE:=Marvell 88W8686 Wireless Driver
  2797. + FILES:= \
  2798. + $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/libertas/libertas.ko \
  2799. + $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/libertas/libertas_sdio.ko
  2800. + AUTOLOAD:=$(call AutoProbe,libertas libertas_sdio)
  2801. +endef
  2802. - config B43_OPENFIRMWARE
  2803. - bool "Open FirmWare for WiFi networks"
  2804. - help
  2805. - Opensource firmware for BCM43xx devices.
  2806. +define KernelPackage/mac80211-hwsim
  2807. + $(call KernelPackage/mac80211/Default)
  2808. + TITLE:=mac80211 HW simulation device
  2809. + DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT
  2810. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mac80211_hwsim.ko
  2811. + AUTOLOAD:=$(call AutoProbe,mac80211_hwsim)
  2812. +endef
  2813. - Do _not_ select this, unless you know what you are doing.
  2814. - The Opensource firmware is not suitable for embedded devices, yet.
  2815. - It does not support QoS, which is bad for AccessPoints.
  2816. - It does not support hardware crypto acceleration, which is a showstopper
  2817. - for embedded devices with low CPU resources.
  2818. - If unsure, select the "stable" firmware.
  2819. +define KernelPackage/mt7601u
  2820. + $(call KernelPackage/mac80211/Default)
  2821. + TITLE:=MT7601U-based USB dongles Wireless Driver
  2822. + DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT @USB_SUPPORT +kmod-usb-core +mt7601u-firmware
  2823. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mediatek/mt7601u/mt7601u.ko
  2824. + AUTOLOAD:=$(call AutoProbe,mt7601u)
  2825. +endef
  2826. - endchoice
  2827. - config B43_FW_SQUASH
  2828. - bool "Remove unnecessary firmware files"
  2829. - depends on !B43_OPENFIRMWARE
  2830. - default y
  2831. - help
  2832. - This options allows you to remove unnecessary b43 firmware files
  2833. - from the final rootfs image. This can reduce the rootfs size by
  2834. - up to 200k.
  2835. +define KernelPackage/mwl8k
  2836. + $(call KernelPackage/mac80211/Default)
  2837. + TITLE:=Driver for Marvell TOPDOG 802.11 Wireless cards
  2838. + URL:=http://wireless.kernel.org/en/users/Drivers/mwl8k
  2839. + DEPENDS+= @PCI_SUPPORT +kmod-mac80211 +@DRIVER_11N_SUPPORT +mwl8k-firmware
  2840. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mwl8k.ko
  2841. + AUTOLOAD:=$(call AutoProbe,mwl8k)
  2842. +endef
  2843. - If unsure, say Y.
  2844. +define KernelPackage/mwl8k/description
  2845. + Kernel modules for Marvell TOPDOG 802.11 Wireless cards
  2846. +endef
  2847. - config B43_FW_SQUASH_COREREVS
  2848. - string "Core revisions to include"
  2849. - depends on B43_FW_SQUASH
  2850. - default "5,6,7,8,9,10,11,13,15" if TARGET_brcm47xx_legacy
  2851. - default "16,28,29,30" if TARGET_brcm47xx_mips74k
  2852. - default "5,6,7,8,9,10,11,13,15,16,28,29,30"
  2853. - help
  2854. - This is a comma seperated list of core revision numbers.
  2855. - Example (keep files for rev5 only):
  2856. - 5
  2857. +define KernelPackage/mwifiex-pcie
  2858. + $(call KernelPackage/mac80211/Default)
  2859. + TITLE:=Driver for Marvell 802.11n/802.11ac PCIe Wireless cards
  2860. + URL:=http://wireless.kernel.org/en/users/Drivers/mwifiex
  2861. + DEPENDS+= @PCI_SUPPORT +kmod-mac80211 +@DRIVER_11N_SUPPORT +mwifiex-pcie-firmware
  2862. + FILES:= \
  2863. + $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mwifiex/mwifiex.ko \
  2864. + $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mwifiex/mwifiex_pcie.ko
  2865. + AUTOLOAD:=$(call AutoProbe,mwifiex_pcie)
  2866. +endef
  2867. - Example (keep files for rev5 and rev11):
  2868. - 5,11
  2869. +define KernelPackage/mwifiex-pcie/description
  2870. + Kernel modules for Marvell 802.11n/802.11ac PCIe Wireless cards
  2871. +endef
  2872. - config B43_FW_SQUASH_PHYTYPES
  2873. - string "PHY types to include"
  2874. - depends on B43_FW_SQUASH
  2875. - default "G,N,LP" if TARGET_brcm47xx_legacy
  2876. - default "N,HT" if TARGET_brcm47xx_mips74k
  2877. - default "G,N,LP,HT"
  2878. - help
  2879. - This is a comma seperated list of PHY types:
  2880. - A => A-PHY
  2881. - AG => Dual A-PHY G-PHY
  2882. - G => G-PHY
  2883. - LP => LP-PHY
  2884. - N => N-PHY
  2885. - HT => HT-PHY
  2886. - LCN => LCN-PHY
  2887. - LCN40 => LCN40-PHY
  2888. - AC => AC-PHY
  2889. - Example (keep files for G-PHY only):
  2890. - G
  2891. +# Prism54 drivers
  2892. +P54PCIFW:=2.13.12.0.arm
  2893. +P54USBFW:=2.13.24.0.lm87.arm
  2894. +P54SPIFW:=2.13.0.0.a.13.14.arm
  2895. - Example (keep files for G-PHY and N-PHY):
  2896. - G,N
  2897. +define Download/p54usb
  2898. + FILE:=$(P54USBFW)
  2899. + URL:=http://daemonizer.de/prism54/prism54-fw/fw-usb
  2900. + MD5SUM:=8e8ab005a4f8f0123bcdc51bc25b47f6
  2901. +endef
  2902. +$(eval $(call Download,p54usb))
  2903. - choice
  2904. - prompt "Supported buses"
  2905. - default PACKAGE_B43_BUSES_BCMA_AND_SSB
  2906. - help
  2907. - This allows choosing buses that b43 should support.
  2908. +define Download/p54pci
  2909. + FILE:=$(P54PCIFW)
  2910. + URL:=http://daemonizer.de/prism54/prism54-fw/fw-softmac
  2911. + MD5SUM:=ff7536af2092b1c4b21315bd103ef4c4
  2912. +endef
  2913. +$(eval $(call Download,p54pci))
  2914. - config PACKAGE_B43_BUSES_BCMA_AND_SSB
  2915. - depends on !TARGET_brcm47xx_legacy && !TARGET_brcm47xx_mips74k && !TARGET_bcm53xx
  2916. - bool "BCMA and SSB"
  2917. +define Download/p54spi
  2918. + FILE:=$(P54SPIFW)
  2919. + URL:=http://daemonizer.de/prism54/prism54-fw/stlc4560
  2920. + MD5SUM:=42661f8ecbadd88012807493f596081d
  2921. +endef
  2922. +$(eval $(call Download,p54spi))
  2923. - config PACKAGE_B43_BUSES_BCMA
  2924. - depends on !TARGET_brcm47xx_legacy
  2925. - bool "BCMA only"
  2926. +define KernelPackage/p54/Default
  2927. + $(call KernelPackage/mac80211/Default)
  2928. + TITLE:=Prism54 Drivers
  2929. +endef
  2930. - config PACKAGE_B43_BUSES_SSB
  2931. - depends on !TARGET_brcm47xx_mips74k && !TARGET_bcm53xx
  2932. - bool "SSB only"
  2933. +define KernelPackage/p54/description
  2934. + Kernel module for Prism54 chipsets (mac80211)
  2935. +endef
  2936. - endchoice
  2937. +define KernelPackage/p54-common
  2938. + $(call KernelPackage/p54/Default)
  2939. + DEPENDS+= @PCI_SUPPORT||@USB_SUPPORT||@TARGET_omap24xx +kmod-mac80211 +kmod-lib-crc-ccitt
  2940. + TITLE+= (COMMON)
  2941. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/p54/p54common.ko
  2942. +endef
  2943. - config PACKAGE_B43_DEBUG
  2944. - bool "Enable debug output and debugfs for b43"
  2945. - default n
  2946. - help
  2947. - Enable additional debug output and runtime sanity checks for b43
  2948. - and enables the debugfs interface.
  2949. +define KernelPackage/p54-pci
  2950. + $(call KernelPackage/p54/Default)
  2951. + TITLE+= (PCI)
  2952. + DEPENDS+= @PCI_SUPPORT +kmod-p54-common
  2953. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/p54/p54pci.ko
  2954. + AUTOLOAD:=$(call AutoProbe,p54pci)
  2955. +endef
  2956. - If unsure, say N.
  2957. +define KernelPackage/p54-usb
  2958. + $(call KernelPackage/p54/Default)
  2959. + TITLE+= (USB)
  2960. + DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-p54-common
  2961. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/p54/p54usb.ko
  2962. + AUTOLOAD:=$(call AutoProbe,p54usb)
  2963. +endef
  2964. - config PACKAGE_B43_PIO
  2965. - bool "Enable support for PIO transfer mode"
  2966. - default n
  2967. - help
  2968. - Enable support for using PIO instead of DMA. Unless you have DMA
  2969. - transfer problems you don't need this.
  2970. +define KernelPackage/p54-spi
  2971. + $(call KernelPackage/p54/Default)
  2972. + TITLE+= (SPI)
  2973. + DEPENDS+= @TARGET_omap24xx +kmod-p54-common
  2974. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/p54/p54spi.ko
  2975. + AUTOLOAD:=$(call AutoProbe,p54spi)
  2976. +endef
  2977. - If unsure, say N.
  2978. +define KernelPackage/rt2x00/Default
  2979. + $(call KernelPackage/mac80211/Default)
  2980. + TITLE:=Ralink Drivers for RT2x00 cards
  2981. +endef
  2982. - config PACKAGE_B43_PHY_G
  2983. - bool "Enable support for G-PHYs"
  2984. - default n if TARGET_brcm47xx_mips74k
  2985. - default y
  2986. - help
  2987. - Enable support for G-PHY. This includes support for the following devices:
  2988. - PCI: BCM4306, BCM4311, BCM4318
  2989. - SoC: BCM5352E, BCM4712
  2990. +define KernelPackage/rt2x00-lib
  2991. +$(call KernelPackage/rt2x00/Default)
  2992. + DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-mac80211 +kmod-lib-crc-itu-t
  2993. + TITLE+= (LIB)
  2994. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2x00lib.ko
  2995. + MENU:=1
  2996. +endef
  2997. - If unsure, say Y.
  2998. +define KernelPackage/rt2x00-lib/config
  2999. + if PACKAGE_kmod-rt2x00-lib
  3000. - config PACKAGE_B43_PHY_N
  3001. - bool "Enable support for N-PHYs"
  3002. - default y
  3003. + config PACKAGE_RT2X00_LIB_DEBUGFS
  3004. + bool "Enable rt2x00 debugfs support"
  3005. + depends on PACKAGE_MAC80211_DEBUGFS
  3006. help
  3007. - Enable support for N-PHY. This includes support for the following devices:
  3008. - PCI: BCM4321, BCM4322, BCM43222, BCM43224, BCM43225
  3009. - SoC: BCM4716, BCM4717, BCM4718
  3010. + Enable creation of debugfs files for the rt2x00 drivers.
  3011. + These debugfs files support both reading and writing of the
  3012. + most important register types of the rt2x00 hardware.
  3013. - Currently only 11g speed is available.
  3014. + config PACKAGE_RT2X00_DEBUG
  3015. + bool "Enable rt2x00 debug output"
  3016. + help
  3017. + Enable debugging output for all rt2x00 modules
  3018. - If unsure, say Y.
  3019. + endif
  3020. +endef
  3021. - config PACKAGE_B43_PHY_LP
  3022. - bool "Enable support for LP-PHYs"
  3023. - default n if TARGET_brcm47xx_mips74k
  3024. - default y
  3025. - help
  3026. - Enable support for LP-PHY. This includes support for the following devices:
  3027. - PCI: BCM4312
  3028. - SoC: BCM5354
  3029. +define KernelPackage/rt2x00-mmio
  3030. +$(call KernelPackage/rt2x00/Default)
  3031. + DEPENDS+= @(PCI_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib +kmod-eeprom-93cx6
  3032. + HIDDEN:=1
  3033. + TITLE+= (MMIO)
  3034. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2x00mmio.ko
  3035. +endef
  3036. - If unsure, say Y.
  3037. +define KernelPackage/rt2x00-pci
  3038. +$(call KernelPackage/rt2x00/Default)
  3039. + DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-mmio +kmod-rt2x00-lib
  3040. + HIDDEN:=1
  3041. + TITLE+= (PCI)
  3042. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2x00pci.ko
  3043. + AUTOLOAD:=$(call AutoProbe,rt2x00pci)
  3044. +endef
  3045. - config PACKAGE_B43_PHY_HT
  3046. - bool "Enable support for HT-PHYs"
  3047. - default n if TARGET_brcm47xx_legacy
  3048. - default y
  3049. - help
  3050. - Enable support for HT-PHY. This includes support for the following devices:
  3051. - PCI: BCM4331
  3052. +define KernelPackage/rt2x00-usb
  3053. +$(call KernelPackage/rt2x00/Default)
  3054. + DEPENDS+= @USB_SUPPORT +kmod-rt2x00-lib +kmod-usb-core
  3055. + HIDDEN:=1
  3056. + TITLE+= (USB)
  3057. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2x00usb.ko
  3058. + AUTOLOAD:=$(call AutoProbe,rt2x00usb)
  3059. +endef
  3060. - Currently only 11g speed is available.
  3061. +define KernelPackage/rt2800-lib
  3062. +$(call KernelPackage/rt2x00/Default)
  3063. + DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib +kmod-lib-crc-ccitt +@DRIVER_11N_SUPPORT
  3064. + HIDDEN:=1
  3065. + TITLE+= (rt2800 LIB)
  3066. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2800lib.ko
  3067. +endef
  3068. - If unsure, say Y.
  3069. +define KernelPackage/rt2400-pci
  3070. +$(call KernelPackage/rt2x00/Default)
  3071. + DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
  3072. + TITLE+= (RT2400 PCI)
  3073. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2400pci.ko
  3074. + AUTOLOAD:=$(call AutoProbe,rt2400pci)
  3075. +endef
  3076. - config PACKAGE_B43_PHY_LCN
  3077. - bool "Enable support for LCN-PHYs"
  3078. - depends on BROKEN
  3079. - default n
  3080. - help
  3081. - Currently broken.
  3082. +define KernelPackage/rt2500-pci
  3083. +$(call KernelPackage/rt2x00/Default)
  3084. + DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
  3085. + TITLE+= (RT2500 PCI)
  3086. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2500pci.ko
  3087. + AUTOLOAD:=$(call AutoProbe,rt2500pci)
  3088. +endef
  3089. - If unsure, say N.
  3090. +define KernelPackage/rt2500-usb
  3091. +$(call KernelPackage/rt2x00/Default)
  3092. + DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb
  3093. + TITLE+= (RT2500 USB)
  3094. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2500usb.ko
  3095. + AUTOLOAD:=$(call AutoProbe,rt2500usb)
  3096. +endef
  3097. - endif
  3098. +define KernelPackage/rt2800-mmio
  3099. +$(call KernelPackage/rt2x00/Default)
  3100. + TITLE += (RT28xx/RT3xxx MMIO)
  3101. + DEPENDS += +kmod-rt2800-lib +kmod-rt2x00-mmio
  3102. + HIDDEN:=1
  3103. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2800mmio.ko
  3104. endef
  3105. -define KernelPackage/b43/description
  3106. -Kernel module for Broadcom 43xx wireless support (mac80211 stack) new
  3107. +define KernelPackage/rt2800-soc
  3108. +$(call KernelPackage/rt2x00/Default)
  3109. + DEPENDS += @(TARGET_ramips_rt288x||TARGET_ramips_rt305x||TARGET_ramips_rt3883||TARGET_ramips_mt7620) +kmod-rt2800-mmio +kmod-rt2800-lib
  3110. + TITLE += (RT28xx/RT3xxx SoC)
  3111. + FILES := \
  3112. + $(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2x00soc.ko \
  3113. + $(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2800soc.ko
  3114. + AUTOLOAD:=$(call AutoProbe,rt2800soc)
  3115. endef
  3116. -define KernelPackage/b43legacy
  3117. - $(call KernelPackage/mac80211/Default)
  3118. - TITLE:=Broadcom 43xx-legacy wireless support
  3119. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/b43
  3120. - KCONFIG:= \
  3121. - CONFIG_HW_RANDOM=y
  3122. - DEPENDS+= +kmod-mac80211 +!(TARGET_brcm47xx||TARGET_brcm63xx):kmod-ssb
  3123. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/b43legacy/b43legacy.ko
  3124. - AUTOLOAD:=$(call AutoProbe,b43legacy)
  3125. - MENU:=1
  3126. +define KernelPackage/rt2800-pci
  3127. +$(call KernelPackage/rt2x00/Default)
  3128. + DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci +kmod-rt2800-lib +kmod-rt2800-mmio +rt2800-pci-firmware
  3129. + TITLE+= (RT2860 PCI)
  3130. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2800pci.ko
  3131. + AUTOLOAD:=$(call AutoProbe,rt2800pci)
  3132. endef
  3133. -define KernelPackage/b43legacy/config
  3134. - if PACKAGE_kmod-b43legacy
  3135. +define KernelPackage/rt2800-usb
  3136. +$(call KernelPackage/rt2x00/Default)
  3137. + DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb +kmod-rt2800-lib +kmod-lib-crc-ccitt +rt2800-usb-firmware
  3138. + TITLE+= (RT2870 USB)
  3139. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2800usb.ko
  3140. + AUTOLOAD:=$(call AutoProbe,rt2800usb)
  3141. +endef
  3142. - config B43LEGACY_FW_SQUASH
  3143. - bool "Remove unnecessary firmware files"
  3144. - default y
  3145. - help
  3146. - This options allows you to remove unnecessary b43legacy firmware files
  3147. - from the final rootfs image. This can reduce the rootfs size by
  3148. - up to 50k.
  3149. - If unsure, say Y.
  3150. +define KernelPackage/rt61-pci
  3151. +$(call KernelPackage/rt2x00/Default)
  3152. + DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci +rt61-pci-firmware
  3153. + TITLE+= (RT2x61 PCI)
  3154. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt61pci.ko
  3155. + AUTOLOAD:=$(call AutoProbe,rt61pci)
  3156. +endef
  3157. - config B43LEGACY_FW_SQUASH_COREREVS
  3158. - string "Core revisions to include"
  3159. - depends on B43LEGACY_FW_SQUASH
  3160. - default "1,2,3,4"
  3161. - help
  3162. - This is a comma seperated list of core revision numbers.
  3163. +define KernelPackage/rt73-usb
  3164. + $(call KernelPackage/rt2x00/Default)
  3165. + DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb +rt73-usb-firmware
  3166. + TITLE+= (RT73 USB)
  3167. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt73usb.ko
  3168. + AUTOLOAD:=$(call AutoProbe,rt73usb)
  3169. +endef
  3170. - Example (keep files for rev4 only):
  3171. - 4
  3172. - Example (keep files for rev2 and rev4):
  3173. - 2,4
  3174. +define KernelPackage/rtl818x/Default
  3175. + $(call KernelPackage/mac80211/Default)
  3176. + TITLE:=Realtek Drivers for RTL818x devices
  3177. + URL:=http://wireless.kernel.org/en/users/Drivers/rtl8187
  3178. + DEPENDS+= +kmod-eeprom-93cx6 +kmod-mac80211
  3179. +endef
  3180. - endif
  3181. +define KernelPackage/rtl8180
  3182. + $(call KernelPackage/rtl818x/Default)
  3183. + DEPENDS+= @PCI_SUPPORT
  3184. + TITLE+= (RTL8180 PCI)
  3185. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtl818x/rtl8180/rtl818x_pci.ko
  3186. + AUTOLOAD:=$(call AutoProbe,rtl818x_pci)
  3187. endef
  3188. -define KernelPackage/b43legacy/description
  3189. -Kernel module for Broadcom 43xx-legacy wireless support (mac80211 stack) new
  3190. +define KernelPackage/rtl8187
  3191. +$(call KernelPackage/rtl818x/Default)
  3192. + DEPENDS+= @USB_SUPPORT +kmod-usb-core
  3193. + TITLE+= (RTL8187 USB)
  3194. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8187.ko
  3195. + AUTOLOAD:=$(call AutoProbe,rtl8187)
  3196. endef
  3197. +define KernelPackage/rtlwifi/config
  3198. + config PACKAGE_RTLWIFI_DEBUG
  3199. + bool "Realtek wireless debugging"
  3200. + depends on PACKAGE_kmod-rtlwifi
  3201. + help
  3202. + Say Y, if you want to debug realtek wireless drivers.
  3203. +
  3204. +endef
  3205. -define KernelPackage/brcmutil
  3206. +define KernelPackage/rtlwifi
  3207. $(call KernelPackage/mac80211/Default)
  3208. - TITLE:=Broadcom IEEE802.11n common driver parts
  3209. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
  3210. - DEPENDS+=@PCI_SUPPORT||USB_SUPPORT
  3211. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/brcm80211/brcmutil/brcmutil.ko
  3212. - AUTOLOAD:=$(call AutoProbe,brcmutil)
  3213. - MENU:=1
  3214. + TITLE:=Realtek common driver part
  3215. + DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT) +kmod-mac80211 +@DRIVER_11N_SUPPORT
  3216. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtlwifi.ko
  3217. + HIDDEN:=1
  3218. endef
  3219. -define KernelPackage/brcmutil/description
  3220. - This module contains some common parts needed by Broadcom Wireless drivers brcmsmac and brcmfmac.
  3221. +define KernelPackage/rtlwifi-pci
  3222. + $(call KernelPackage/mac80211/Default)
  3223. + TITLE:=Realtek common driver part (PCI support)
  3224. + DEPENDS+= @PCI_SUPPORT +kmod-rtlwifi
  3225. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl_pci.ko
  3226. + AUTOLOAD:=$(call AutoProbe,rtl_pci)
  3227. + HIDDEN:=1
  3228. endef
  3229. -define KernelPackage/brcmutil/config
  3230. - if PACKAGE_kmod-brcmutil
  3231. +define KernelPackage/rtlwifi-usb
  3232. + $(call KernelPackage/mac80211/Default)
  3233. + TITLE:=Realtek common driver part (USB support)
  3234. + DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-rtlwifi
  3235. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl_usb.ko
  3236. + AUTOLOAD:=$(call AutoProbe,rtl_usb)
  3237. + HIDDEN:=1
  3238. +endef
  3239. - config PACKAGE_BRCM80211_DEBUG
  3240. - bool "Broadcom wireless driver debugging"
  3241. - help
  3242. - Say Y, if you want to debug brcmsmac and brcmfmac wireless driver.
  3243. +define KernelPackage/rtl8192c-common
  3244. + $(call KernelPackage/mac80211/Default)
  3245. + TITLE:=Realtek RTL8192CE/RTL8192CU common support module
  3246. + DEPENDS+= +kmod-rtlwifi
  3247. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl8192c/rtl8192c-common.ko
  3248. + HIDDEN:=1
  3249. +endef
  3250. - endif
  3251. +define KernelPackage/rtl8192ce
  3252. + $(call KernelPackage/mac80211/Default)
  3253. + TITLE:=Realtek RTL8192CE/RTL8188CE support
  3254. + DEPENDS+= +kmod-rtlwifi-pci +kmod-rtl8192c-common +rtl8192ce-firmware
  3255. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/rtl8192ce.ko
  3256. + AUTOLOAD:=$(call AutoProbe,rtl8192ce)
  3257. endef
  3258. -PKG_BRCMSMAC_FW_NAME:=broadcom-wl
  3259. -PKG_BRCMSMAC_FW_VERSION:=5.100.138
  3260. -PKG_BRCMSMAC_FW_OBJECT:=$(PKG_BRCMSMAC_FW_NAME)-$(PKG_BRCMSMAC_FW_VERSION)/linux/wl_apsta.o
  3261. -PKG_BRCMSMAC_FW_SOURCE:=$(PKG_BRCMSMAC_FW_NAME)-$(PKG_BRCMSMAC_FW_VERSION).tar.bz2
  3262. -PKG_BRCMSMAC_FW_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/
  3263. -PKG_BRCMSMAC_FW_MD5SUM:=f4e357b09eaf5d8b1f1920cf3493a555
  3264. +define KernelPackage/rtl8192se
  3265. + $(call KernelPackage/mac80211/Default)
  3266. + TITLE:=Realtek RTL8192SE/RTL8191SE support
  3267. + DEPENDS+= +kmod-rtlwifi-pci +rtl8192se-firmware
  3268. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl8192se/rtl8192se.ko
  3269. + AUTOLOAD:=$(call AutoProbe,rtl8192se)
  3270. +endef
  3271. -define Download/brcmsmac
  3272. - FILE:=$(PKG_BRCMSMAC_FW_SOURCE)
  3273. - URL:=$(PKG_BRCMSMAC_FW_SOURCE_URL)
  3274. - MD5SUM:=$(PKG_BRCMSMAC_FW_MD5SUM)
  3275. +define KernelPackage/rtl8192de
  3276. + $(call KernelPackage/mac80211/Default)
  3277. + TITLE:=Realtek RTL8192DE/RTL8188DE support
  3278. + DEPENDS+= +kmod-rtlwifi-pci +rtl8192de-firmware
  3279. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl8192de/rtl8192de.ko
  3280. + AUTOLOAD:=$(call AutoProbe,rtl8192de)
  3281. endef
  3282. -$(eval $(call Download,brcmsmac))
  3283. -define KernelPackage/brcmsmac
  3284. +define KernelPackage/rtl8192cu
  3285. $(call KernelPackage/mac80211/Default)
  3286. - TITLE:=Broadcom IEEE802.11n PCIe SoftMAC WLAN driver
  3287. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
  3288. - DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT +!TARGET_brcm47xx:kmod-bcma +kmod-lib-cordic +kmod-lib-crc8 +kmod-brcmutil
  3289. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/brcm80211/brcmsmac/brcmsmac.ko
  3290. - AUTOLOAD:=$(call AutoProbe,brcmsmac)
  3291. - MENU:=1
  3292. + TITLE:=Realtek RTL8192CU/RTL8188CU support
  3293. + DEPENDS+= +kmod-rtlwifi-usb +kmod-rtl8192c-common +rtl8192cu-firmware
  3294. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/rtl8192cu.ko
  3295. + AUTOLOAD:=$(call AutoProbe,rtl8192cu)
  3296. endef
  3297. -define KernelPackage/brcmsmac/description
  3298. - Kernel module for Broadcom IEEE802.11n PCIe Wireless cards
  3299. +
  3300. +define KernelPackage/rtl8xxxu
  3301. + $(call KernelPackage/mac80211/Default)
  3302. + TITLE:=alternative Realtek RTL8XXXU support
  3303. + DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-mac80211
  3304. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.ko
  3305. + AUTOLOAD:=$(call AutoProbe,rtl8xxxu)
  3306. endef
  3307. -define KernelPackage/brcmsmac/config
  3308. - if PACKAGE_kmod-brcmsmac
  3309. +define KernelPackage/rtl8xxxu/description
  3310. + This is an alternative driver for various Realtek RTL8XXX
  3311. + parts written to utilize the Linux mac80211 stack.
  3312. + The driver is known to work with a number of RTL8723AU,
  3313. + RL8188CU, RTL8188RU, RTL8191CU, and RTL8192CU devices
  3314. - config BRCMSMAC_USE_FW_FROM_WL
  3315. - bool "Use firmware extracted from broadcom proprietary driver"
  3316. - default y
  3317. - help
  3318. - Instead of using the official brcmsmac firmware a firmware
  3319. - version 666.2 extracted from the proprietary Broadcom driver
  3320. - is used. This is needed to get core rev 17 used in bcm4716
  3321. - to work.
  3322. + This driver is under development and has a limited feature
  3323. + set. In particular it does not yet support 40MHz channels
  3324. + and power management. However it should have a smaller
  3325. + memory footprint than the vendor drivers and benetifs
  3326. + from the in kernel mac80211 stack.
  3327. +
  3328. + It can coexist with drivers from drivers/staging/rtl8723au,
  3329. + drivers/staging/rtl8192u, and drivers/net/wireless/rtlwifi,
  3330. + but you will need to control which module you wish to load.
  3331. - If unsure, say Y.
  3332. + RTL8XXXU_UNTESTED is enabled
  3333. + This option enables detection of Realtek 8723/8188/8191/8192 WiFi
  3334. + USB devices which have not been tested directly by the driver
  3335. + author or reported to be working by third parties.
  3336. - endif
  3337. + Please report your results!
  3338. endef
  3339. -define KernelPackage/brcmfmac
  3340. +define KernelPackage/wlcore
  3341. $(call KernelPackage/mac80211/Default)
  3342. - TITLE:=Broadcom IEEE802.11n USB FullMAC WLAN driver
  3343. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
  3344. - DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +@DRIVER_11N_SUPPORT +kmod-brcmutil +BRCMFMAC_SDIO:kmod-mmc +BRCMFMAC_USB:kmod-usb-core
  3345. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/brcm80211/brcmfmac/brcmfmac.ko
  3346. - AUTOLOAD:=$(call AutoProbe,brcmfmac)
  3347. + TITLE:=TI common driver part
  3348. + DEPENDS+= @TARGET_omap +kmod-mac80211 +@DRIVER_11N_SUPPORT
  3349. + FILES:= \
  3350. + $(PKG_BUILD_DIR)/drivers/net/wireless/ti/wlcore/wlcore.ko \
  3351. + $(PKG_BUILD_DIR)/drivers/net/wireless/ti/wlcore/wlcore_sdio.ko
  3352. + AUTOLOAD:=$(call AutoProbe,wlcore wlcore_sdio)
  3353. endef
  3354. -define KernelPackage/brcmfmac/description
  3355. - Kernel module for Broadcom IEEE802.11n USB Wireless cards
  3356. +define KernelPackage/wlcore/description
  3357. + This module contains some common parts needed by TI Wireless drivers.
  3358. endef
  3359. -define KernelPackage/brcmfmac/config
  3360. - if PACKAGE_kmod-brcmfmac
  3361. +define KernelPackage/wl12xx
  3362. + $(call KernelPackage/mac80211/Default)
  3363. + TITLE:=Driver for TI WL12xx
  3364. + URL:=http://wireless.kernel.org/en/users/Drivers/wl12xx
  3365. + DEPENDS+= +kmod-wlcore +wl12xx-firmware
  3366. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ti/wl12xx/wl12xx.ko
  3367. + AUTOLOAD:=$(call AutoProbe,wl12xx)
  3368. +endef
  3369. - config BRCMFMAC_SDIO
  3370. - bool "Enable SDIO bus interface support"
  3371. - default n
  3372. - help
  3373. - Enable support for cards attached to an SDIO bus.
  3374. - Select this option only if you are sure that your
  3375. - board has a Broadcom wireless chip atacched to
  3376. - that bus.
  3377. +define KernelPackage/wl12xx/description
  3378. + Kernel modules for TI WL12xx
  3379. +endef
  3380. - config BRCMFMAC_USB
  3381. - bool "Enable USB bus interface support"
  3382. - depends on USB_SUPPORT
  3383. - default y
  3384. - help
  3385. - Supported USB connected chipsets:
  3386. - BCM43235, BCM43236, BCM43238 (all in revision 3 only)
  3387. - BCM43143, BCM43242, BCM43566, BCM43569
  3388. +define KernelPackage/wl18xx
  3389. + $(call KernelPackage/mac80211/Default)
  3390. + TITLE:=Driver for TI WL18xx
  3391. + URL:=http://wireless.kernel.org/en/users/Drivers/wl18xx
  3392. + DEPENDS+= +kmod-wlcore +wl18xx-firmware
  3393. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ti/wl18xx/wl18xx.ko
  3394. + AUTOLOAD:=$(call AutoProbe,wl18xx)
  3395. +endef
  3396. - config BRCMFMAC_PCIE
  3397. - bool "Enable PCIE bus interface support"
  3398. - depends on PCI_SUPPORT
  3399. - default y
  3400. - help
  3401. - Supported PCIe connected chipsets:
  3402. - BCM4354, BCM4356, BCM43567, BCM43570, BCM43602
  3403. +define KernelPackage/wl18xx/description
  3404. + Kernel modules for TI WL18xx
  3405. +endef
  3406. - endif
  3407. +
  3408. +ZD1211FW_NAME:=zd1211-firmware
  3409. +ZD1211FW_VERSION:=1.4
  3410. +define Download/zd1211rw
  3411. + FILE:=$(ZD1211FW_NAME)-$(ZD1211FW_VERSION).tar.bz2
  3412. + URL:=@SF/zd1211/
  3413. + MD5SUM:=19f28781d76569af8551c9d11294c870
  3414. +endef
  3415. +$(eval $(call Download,zd1211rw))
  3416. +
  3417. +define KernelPackage/zd1211rw
  3418. + $(call KernelPackage/mac80211/Default)
  3419. + TITLE:=Zydas ZD1211 support
  3420. + DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-mac80211
  3421. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/zydas/zd1211rw/zd1211rw.ko
  3422. + AUTOLOAD:=$(call AutoProbe,zd1211rw)
  3423. endef
  3424. +
  3425. +
  3426. config_package=$(if $(CONFIG_PACKAGE_kmod-$(1)),m)
  3427. config-y:= \
  3428. @@ -1538,6 +1435,20 @@ config-y:= \
  3429. MAC80211_RC_MINSTREL_HT \
  3430. MAC80211_RC_MINSTREL_VHT \
  3431. MAC80211_RC_DEFAULT_MINSTREL \
  3432. + WLAN_VENDOR_ADMTEK \
  3433. + WLAN_VENDOR_ATH \
  3434. + WLAN_VENDOR_ATMEL \
  3435. + WLAN_VENDOR_BROADCOM \
  3436. + WLAN_VENDOR_INTEL \
  3437. + WLAN_VENDOR_INTERSIL \
  3438. + WLAN_VENDOR_MARVELL \
  3439. + WLAN_VENDOR_MEDIATEK \
  3440. + WLAN_VENDOR_RALINK \
  3441. + WLAN_VENDOR_REALTEK \
  3442. + WLAN_VENDOR_RSI \
  3443. + WLAN_VENDOR_ST \
  3444. + WLAN_VENDOR_TI \
  3445. + WLAN_VENDOR_ZYDAS \
  3446. config-$(call config_package,cfg80211) += CFG80211
  3447. @@ -1554,6 +1465,16 @@ ifdef CONFIG_PACKAGE_MAC80211_DEBUGFS
  3448. ATH5K_DEBUG
  3449. endif
  3450. +ifdef CONFIG_PACKAGE_MAC80211_TRACING
  3451. + config-y += \
  3452. + ATH10K_TRACING \
  3453. + ATH6KL_TRACING \
  3454. + ATH_TRACEPOINTS \
  3455. + WIL6210_TRACING \
  3456. + ATH5K_TRACER \
  3457. + IWLWIFI_DEVICE_TRACING
  3458. +endif
  3459. +
  3460. config-$(call config_package,lib80211) += LIB80211 LIB80211_CRYPT_WEP LIB80211_CRYPT_CCMP LIB80211_CRYPT_TKIP
  3461. config-$(call config_package,ath) += ATH_CARDS ATH_COMMON
  3462. @@ -1602,6 +1523,8 @@ config-$(CONFIG_BRCMFMAC_PCIE) += BRCMFMAC_PCIE
  3463. config-$(CONFIG_PACKAGE_BRCM80211_DEBUG) += BRCMDBG
  3464. config-$(call config_package,mac80211-hwsim) += MAC80211_HWSIM
  3465. +config-$(call config_package,mt7601u) += MT7601U
  3466. +config-y += WL_MEDIATEK
  3467. config-$(call config_package,rt2x00-lib) += RT2X00 RT2X00_LIB
  3468. config-$(call config_package,rt2x00-pci) += RT2X00_LIB_PCI
  3469. @@ -1623,26 +1546,28 @@ config-$(call config_package,rt2800-pci) += RT2800PCI
  3470. config-y += RT2800PCI_RT33XX RT2800PCI_RT35XX RT2800PCI_RT53XX RT2800PCI_RT3290
  3471. config-$(call config_package,rt2800-usb) += RT2800USB
  3472. -config-y += RT2800USB_RT33XX RT2800USB_RT35XX RT2800USB_RT3573 RT2800USB_RT53XX RT2800USB_RT55XX
  3473. +config-y += RT2800USB_RT33XX RT2800USB_RT35XX RT2800USB_RT3573 RT2800USB_RT53XX RT2800USB_RT55XX RT2800USB_UNKNOWN
  3474. config-$(call config_package,iwl-legacy) += IWLEGACY
  3475. config-$(call config_package,iwl3945) += IWL3945
  3476. config-$(call config_package,iwl4965) += IWL4965
  3477. -config-$(call config_package,iwlagn) += IWLWIFI IWLDVM
  3478. +config-$(call config_package,iwlwifi) += IWLWIFI IWLDVM IWLMVM
  3479. +config-$(CONFIG_PACKAGE_IWLWIFI_DEBUG)+= IWLWIFI_DEBUG
  3480. +config-$(CONFIG_PACKAGE_IWLWIFI_DEBUGFS)+= IWLWIFI_DEBUGFS
  3481. -config-$(call config_package,net-libipw) += LIBIPW
  3482. -config-$(call config_package,net-ipw2100) += IPW2100
  3483. -config-$(call config_package,net-ipw2200) += IPW2200
  3484. +config-$(call config_package,libipw) += LIBIPW
  3485. +config-$(call config_package,ipw2100) += IPW2100
  3486. +config-$(call config_package,ipw2200) += IPW2200
  3487. config-$(call config_package,p54-common) += P54_COMMON
  3488. config-$(call config_package,p54-pci) += P54_PCI
  3489. config-$(call config_package,p54-usb) += P54_USB
  3490. config-$(call config_package,p54-spi) += P54_SPI
  3491. -config-$(call config_package,net-hermes) += HERMES
  3492. -config-$(call config_package,net-hermes-pci) += PCI_HERMES
  3493. -config-$(call config_package,net-hermes-plx) += PLX_HERMES
  3494. -config-$(call config_package,net-hermes-pcmcia) += PCMCIA_HERMES
  3495. +config-$(call config_package,hermes) += HERMES
  3496. +config-$(call config_package,hermes-pci) += PCI_HERMES
  3497. +config-$(call config_package,hermes-plx) += PLX_HERMES
  3498. +config-$(call config_package,hermes-pcmcia) += PCMCIA_HERMES
  3499. config-y += HERMES_PRISM
  3500. config-$(call config_package,adm8211) += ADM8211
  3501. @@ -1668,12 +1593,15 @@ config-$(call config_package,rtl8192de) += RTL8192DE
  3502. config-$(call config_package,rtl8192cu) += RTL8192CU
  3503. config-$(CONFIG_PACKAGE_RTLWIFI_DEBUG) += RTLWIFI_DEBUG
  3504. +config-$(call config_package,rtl8xxxu) += RTL8XXXU
  3505. +config-y += RTL8XXXU_UNTESTED
  3506. +
  3507. config-$(CONFIG_LEDS_TRIGGERS) += MAC80211_LEDS B43_LEDS B43LEGACY_LEDS
  3508. MAKE_OPTS:= -C "$(PKG_BUILD_DIR)" \
  3509. CROSS_COMPILE="$(KERNEL_CROSS)" \
  3510. ARCH="$(LINUX_KARCH)" \
  3511. - EXTRA_CFLAGS="-I$(PKG_BUILD_DIR)/include" \
  3512. + EXTRA_CFLAGS="-I$(PKG_BUILD_DIR)/include $(IREMAP_CFLAGS)" \
  3513. KLIB_BUILD="$(LINUX_DIR)" \
  3514. MODPROBE=true \
  3515. KLIB=$(TARGET_MODULES_DIR) \
  3516. @@ -1702,8 +1630,6 @@ define Build/Prepare
  3517. $(TAR) -C $(PKG_BUILD_DIR) -xzf $(DL_DIR)/$(IPW2100_NAME)-$(IPW2100_VERSION).tgz
  3518. $(TAR) -C $(PKG_BUILD_DIR) -xzf $(DL_DIR)/$(IPW2200_NAME)-$(IPW2200_VERSION).tgz
  3519. $(TAR) -C $(PKG_BUILD_DIR) -xjf $(DL_DIR)/$(ZD1211FW_NAME)-$(ZD1211FW_VERSION).tar.bz2
  3520. - $(TAR) -C $(PKG_BUILD_DIR) -xjf $(DL_DIR)/$(PKG_LINUX_FIRMWARE_SOURCE)
  3521. - $(TAR) -C $(PKG_BUILD_DIR) -xjf $(DL_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SOURCE)
  3522. rm -rf \
  3523. $(PKG_BUILD_DIR)/include/linux/ssb \
  3524. $(PKG_BUILD_DIR)/include/linux/bcma \
  3525. @@ -1715,7 +1641,8 @@ define Build/Prepare
  3526. $(PKG_BUILD_DIR)/include/linux/eeprom_93cx6.h \
  3527. $(PKG_BUILD_DIR)/include/linux/wl12xx.h \
  3528. $(PKG_BUILD_DIR)/include/linux/spi/libertas_spi.h \
  3529. - $(PKG_BUILD_DIR)/include/net/ieee80211.h
  3530. + $(PKG_BUILD_DIR)/include/net/ieee80211.h \
  3531. + $(PKG_BUILD_DIR)/backport-include/linux/bcm47xx_nvram.h
  3532. echo 'compat-wireless-$(PKG_VERSION)-$(PKG_RELEASE)-$(REVISION)' > $(PKG_BUILD_DIR)/compat_version
  3533. $(CP) ./files/regdb.txt $(PKG_BUILD_DIR)/net/wireless/db.txt
  3534. @@ -1753,220 +1680,6 @@ define Build/InstallDev
  3535. rm -f $(1)/usr/include/mac80211-backport/linux/module.h
  3536. endef
  3537. -define KernelPackage/libertas-usb/install
  3538. - $(INSTALL_DIR) $(1)/lib/firmware/libertas
  3539. - $(INSTALL_DATA) \
  3540. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/usb8388_v9.bin \
  3541. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/usb8682.bin \
  3542. - $(1)/lib/firmware/libertas/
  3543. -endef
  3544. -
  3545. -define KernelPackage/libertas-sdio/install
  3546. - $(INSTALL_DIR) $(1)/lib/firmware/libertas
  3547. - $(INSTALL_DATA) \
  3548. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8385_helper.bin \
  3549. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8385.bin \
  3550. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8686_v9_helper.bin \
  3551. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8686_v9.bin \
  3552. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8688_helper.bin \
  3553. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8688.bin \
  3554. - $(1)/lib/firmware/libertas
  3555. -endef
  3556. -
  3557. -define KernelPackage/cfg80211/install
  3558. - $(INSTALL_DIR) $(1)/lib/wifi $(1)/lib/netifd/wireless
  3559. - $(INSTALL_DATA) ./files/lib/wifi/mac80211.sh $(1)/lib/wifi
  3560. - $(INSTALL_BIN) ./files/lib/netifd/wireless/mac80211.sh $(1)/lib/netifd/wireless
  3561. -endef
  3562. -
  3563. -define KernelPackage/p54-pci/install
  3564. - $(INSTALL_DIR) $(1)/lib/firmware
  3565. - $(INSTALL_DATA) $(DL_DIR)/$(P54PCIFW) $(1)/lib/firmware/isl3886pci
  3566. -endef
  3567. -
  3568. -define KernelPackage/p54-usb/install
  3569. - $(INSTALL_DIR) $(1)/lib/firmware
  3570. - $(INSTALL_DATA) $(DL_DIR)/$(P54USBFW) $(1)/lib/firmware/isl3887usb
  3571. -endef
  3572. -
  3573. -define KernelPackage/p54-spi/install
  3574. - $(INSTALL_DIR) $(1)/lib/firmware
  3575. - $(INSTALL_DATA) $(DL_DIR)/$(P54SPIFW) $(1)/lib/firmware/3826.arm
  3576. -endef
  3577. -
  3578. -define KernelPackage/rt61-pci/install
  3579. - $(INSTALL_DIR) $(1)/lib/firmware
  3580. - $(INSTALL_DATA) \
  3581. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2561.bin \
  3582. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2561s.bin \
  3583. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2661.bin \
  3584. - $(1)/lib/firmware/
  3585. -endef
  3586. -
  3587. -define KernelPackage/rt73-usb/install
  3588. - $(INSTALL_DIR) $(1)/lib/firmware
  3589. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt73.bin $(1)/lib/firmware/
  3590. -endef
  3591. -
  3592. -define KernelPackage/rt2800-pci/install
  3593. - $(INSTALL_DIR) $(1)/lib/firmware
  3594. - $(INSTALL_DATA) \
  3595. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2860.bin \
  3596. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt3290.bin \
  3597. - $(1)/lib/firmware
  3598. -endef
  3599. -
  3600. -define KernelPackage/rt2800-usb/install
  3601. - $(INSTALL_DIR) $(1)/lib/firmware
  3602. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2870.bin $(1)/lib/firmware/
  3603. -endef
  3604. -
  3605. -define KernelPackage/wl12xx/install
  3606. - $(INSTALL_DIR) $(1)/lib/firmware/ti-connectivity
  3607. - $(INSTALL_DATA) \
  3608. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl127x-fw-5-mr.bin \
  3609. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl127x-fw-5-plt.bin \
  3610. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl127x-fw-5-sr.bin \
  3611. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl1271-nvs.bin \
  3612. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-fw-5-mr.bin \
  3613. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-fw-5-plt.bin \
  3614. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-fw-5-sr.bin \
  3615. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-nvs.bin \
  3616. - $(1)/lib/firmware/ti-connectivity
  3617. -endef
  3618. -
  3619. -define KernelPackage/wl18xx/install
  3620. - $(INSTALL_DIR) $(1)/lib/firmware/ti-connectivity
  3621. - $(INSTALL_DATA) \
  3622. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl18xx-conf.bin \
  3623. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl18xx-fw-3.bin \
  3624. - $(1)/lib/firmware/ti-connectivity
  3625. -endef
  3626. -
  3627. -define KernelPackage/zd1211rw/install
  3628. - $(INSTALL_DIR) $(1)/lib/firmware/zd1211
  3629. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(ZD1211FW_NAME)/zd1211* $(1)/lib/firmware/zd1211
  3630. -endef
  3631. -
  3632. -define KernelPackage/carl9170/install
  3633. - $(INSTALL_DIR) $(1)/lib/firmware
  3634. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/carl9170-1.fw $(1)/lib/firmware
  3635. -endef
  3636. -
  3637. -define KernelPackage/ath9k-htc/install
  3638. - $(INSTALL_DIR) $(1)/lib/firmware
  3639. - $(INSTALL_DATA) \
  3640. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/htc_9271.fw \
  3641. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/htc_7010.fw \
  3642. - $(1)/lib/firmware/
  3643. -endef
  3644. -
  3645. -define KernelPackage/ath10k/install
  3646. - $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
  3647. - $(INSTALL_DATA) \
  3648. - $(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/ath10k/QCA988X/hw2.0/board.bin \
  3649. - $(1)/lib/firmware/ath10k/QCA988X/hw2.0/
  3650. -ifeq ($(CONFIG_ATH10K_STA_FW),y)
  3651. - $(INSTALL_DATA) \
  3652. - $(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/main/firmware-2.bin_999.999.0.636 \
  3653. - $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-2.bin
  3654. -else ifeq ($(CONFIG_ATH10K_API2_FW),y)
  3655. - $(INSTALL_DATA) \
  3656. - $(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/10.1/firmware-2.bin_10.1.467.2-1 \
  3657. - $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-2.bin
  3658. -else
  3659. - $(INSTALL_DATA) \
  3660. - $(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/10.2.4/firmware-4.bin_10.2.4.45 \
  3661. - $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-4.bin
  3662. -endif
  3663. -endef
  3664. -
  3665. -define KernelPackage/mwl8k/install
  3666. - $(INSTALL_DIR) $(1)/lib/firmware/mwl8k
  3667. - $(INSTALL_DATA) \
  3668. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/fmimage_8366_ap-3.fw \
  3669. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/fmimage_8366.fw \
  3670. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/helper_8366.fw \
  3671. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/fmimage_8687.fw \
  3672. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/helper_8687.fw \
  3673. - $(1)/lib/firmware/mwl8k/
  3674. -endef
  3675. -
  3676. -define KernelPackage/mwifiex-pcie/install
  3677. - $(INSTALL_DIR) $(1)/lib/firmware/mrvl
  3678. - $(INSTALL_DATA) \
  3679. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mrvl/pcie8897_uapsta.bin \
  3680. - $(1)/lib/firmware/mrvl/
  3681. -endef
  3682. -
  3683. -define KernelPackage/net-ipw2100/install
  3684. - $(INSTALL_DIR) $(1)/lib/firmware
  3685. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/ipw2100-$(IPW2100_VERSION)*.fw $(1)/lib/firmware
  3686. -endef
  3687. -
  3688. -define KernelPackage/net-ipw2200/install
  3689. - $(INSTALL_DIR) $(1)/lib/firmware
  3690. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(IPW2200_NAME)-$(IPW2200_VERSION)/ipw2200*.fw $(1)/lib/firmware
  3691. -endef
  3692. -
  3693. -define KernelPackage/iwlagn/install
  3694. - $(INSTALL_DIR) $(1)/lib/firmware
  3695. -ifneq ($(CONFIG_IWL5000_FW),)
  3696. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-5000-5.ucode $(1)/lib/firmware
  3697. -endif
  3698. -ifneq ($(CONFIG_IWL5150_FW),)
  3699. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-5150-2.ucode $(1)/lib/firmware
  3700. -endif
  3701. -ifneq ($(CONFIG_IWL1000_FW),)
  3702. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-1000-5.ucode $(1)/lib/firmware
  3703. -endif
  3704. -ifneq ($(CONFIG_IWL6000_FW),)
  3705. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6000-4.ucode $(1)/lib/firmware
  3706. -endif
  3707. -ifneq ($(CONFIG_IWL6050_FW),)
  3708. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6050-5.ucode $(1)/lib/firmware
  3709. -endif
  3710. -ifneq ($(CONFIG_IWL6005_FW),)
  3711. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6000g2a-6.ucode $(1)/lib/firmware
  3712. -endif
  3713. -ifneq ($(CONFIG_IWL6030_FW),)
  3714. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6000g2b-6.ucode $(1)/lib/firmware
  3715. -endif
  3716. -ifneq ($(CONFIG_IWL7260_FW),)
  3717. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-7260-9.ucode $(1)/lib/firmware
  3718. -endif
  3719. -ifneq ($(CONFIG_IWL7265_FW),)
  3720. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-7265-9.ucode $(1)/lib/firmware
  3721. -endif
  3722. -ifneq ($(CONFIG_IWL100_FW),)
  3723. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-100-5.ucode $(1)/lib/firmware
  3724. -endif
  3725. -ifneq ($(CONFIG_IWL2000_FW),)
  3726. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-2000-6.ucode $(1)/lib/firmware
  3727. -endif
  3728. -ifneq ($(CONFIG_IWL2030_FW),)
  3729. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-2030-6.ucode $(1)/lib/firmware
  3730. -endif
  3731. -ifneq ($(CONFIG_IWL105_FW),)
  3732. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-105-6.ucode $(1)/lib/firmware
  3733. -endif
  3734. -ifneq ($(CONFIG_IWL135_FW),)
  3735. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-135-6.ucode $(1)/lib/firmware
  3736. -endif
  3737. -ifneq ($(CONFIG_IWL3160_FW),)
  3738. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-3160-9.ucode $(1)/lib/firmware
  3739. -endif
  3740. -endef
  3741. -
  3742. -define KernelPackage/iwl3945/install
  3743. - $(INSTALL_DIR) $(1)/lib/firmware
  3744. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-3945-2.ucode $(1)/lib/firmware
  3745. -endef
  3746. -
  3747. -define KernelPackage/iwl4965/install
  3748. - $(INSTALL_DIR) $(1)/lib/firmware
  3749. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-4965-2.ucode $(1)/lib/firmware
  3750. -endef
  3751. define KernelPackage/b43/install
  3752. rm -rf $(1)/lib/firmware/
  3753. @@ -1990,51 +1703,84 @@ ifneq ($(CONFIG_B43_FW_SQUASH),)
  3754. endif
  3755. endef
  3756. -define KernelPackage/b43legacy/install
  3757. - $(INSTALL_DIR) $(1)/lib/firmware/
  3758. - b43-fwcutter --unsupported -w $(1)/lib/firmware/ $(DL_DIR)/$(PKG_B43_FWV3_SOURCE)
  3759. -ifneq ($(CONFIG_B43LEGACY_FW_SQUASH),)
  3760. - b43-fwsquash.py "G" "$(CONFIG_B43LEGACY_FW_SQUASH_COREREVS)" "$(1)/lib/firmware/b43legacy"
  3761. -endif
  3762. -endef
  3763. -
  3764. define KernelPackage/brcmsmac/install
  3765. $(INSTALL_DIR) $(1)/lib/firmware/brcm
  3766. ifeq ($(CONFIG_BRCMSMAC_USE_FW_FROM_WL),y)
  3767. tar xjf "$(DL_DIR)/$(PKG_BRCMSMAC_FW_SOURCE)" -C "$(PKG_BUILD_DIR)"
  3768. b43-fwcutter --brcmsmac -w $(1)/lib/firmware/ $(PKG_BUILD_DIR)/$(PKG_BRCMSMAC_FW_OBJECT)
  3769. -else
  3770. - $(INSTALL_DATA) \
  3771. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/brcm/bcm43xx-0.fw \
  3772. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/brcm/bcm43xx_hdr-0.fw \
  3773. - $(1)/lib/firmware/brcm/
  3774. endif
  3775. endef
  3776. -define KernelPackage/brcmfmac/install
  3777. - $(INSTALL_DIR) $(1)/lib/firmware/brcm
  3778. -ifneq ($(CONFIG_BRCMFMAC_USB),)
  3779. - $(INSTALL_DATA) \
  3780. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/brcm/brcmfmac43236b.bin \
  3781. - $(1)/lib/firmware/brcm/
  3782. - $(INSTALL_DATA) \
  3783. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/brcm/brcmfmac43143.bin \
  3784. - $(1)/lib/firmware/brcm/
  3785. -endif
  3786. -ifneq ($(CONFIG_BRCMFMAC_PCIE),)
  3787. - $(INSTALL_DATA) \
  3788. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/brcm/brcmfmac43602-pcie.ap.bin \
  3789. - $(1)/lib/firmware/brcm/brcmfmac43602-pcie.bin
  3790. -endif
  3791. +define KernelPackage/cfg80211/install
  3792. + $(INSTALL_DIR) $(1)/lib/wifi $(1)/lib/netifd/wireless
  3793. + $(INSTALL_DATA) ./files/lib/wifi/mac80211.sh $(1)/lib/wifi
  3794. + $(INSTALL_BIN) ./files/lib/netifd/wireless/mac80211.sh $(1)/lib/netifd/wireless
  3795. +endef
  3796. +
  3797. +define KernelPackage/ipw2100/install
  3798. + $(INSTALL_DIR) $(1)/lib/firmware
  3799. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/ipw2100-$(IPW2100_VERSION)*.fw $(1)/lib/firmware
  3800. +endef
  3801. +
  3802. +define KernelPackage/ipw2200/install
  3803. + $(INSTALL_DIR) $(1)/lib/firmware
  3804. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(IPW2200_NAME)-$(IPW2200_VERSION)/ipw2200*.fw $(1)/lib/firmware
  3805. +endef
  3806. +
  3807. +define KernelPackage/p54-pci/install
  3808. + $(INSTALL_DIR) $(1)/lib/firmware
  3809. + $(INSTALL_DATA) $(DL_DIR)/$(P54PCIFW) $(1)/lib/firmware/isl3886pci
  3810. +endef
  3811. +
  3812. +define KernelPackage/p54-usb/install
  3813. + $(INSTALL_DIR) $(1)/lib/firmware
  3814. + $(INSTALL_DATA) $(DL_DIR)/$(P54USBFW) $(1)/lib/firmware/isl3887usb
  3815. +endef
  3816. +
  3817. +define KernelPackage/p54-spi/install
  3818. + $(INSTALL_DIR) $(1)/lib/firmware
  3819. + $(INSTALL_DATA) $(DL_DIR)/$(P54SPIFW) $(1)/lib/firmware/3826.arm
  3820. endef
  3821. +define KernelPackage/zd1211rw/install
  3822. + $(INSTALL_DIR) $(1)/lib/firmware/zd1211
  3823. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(ZD1211FW_NAME)/zd1211* $(1)/lib/firmware/zd1211
  3824. +endef
  3825. +
  3826. +
  3827. $(eval $(call KernelPackage,adm8211))
  3828. +$(eval $(call KernelPackage,ath))
  3829. +$(eval $(call KernelPackage,ath10k))
  3830. $(eval $(call KernelPackage,ath5k))
  3831. +$(eval $(call KernelPackage,ath9k))
  3832. +$(eval $(call KernelPackage,ath9k-common))
  3833. +$(eval $(call KernelPackage,ath9k-htc))
  3834. +$(eval $(call KernelPackage,b43))
  3835. +$(eval $(call KernelPackage,b43legacy))
  3836. +$(eval $(call KernelPackage,brcmsmac))
  3837. +$(eval $(call KernelPackage,brcmfmac))
  3838. +$(eval $(call KernelPackage,brcmutil))
  3839. +$(eval $(call KernelPackage,carl9170))
  3840. +$(eval $(call KernelPackage,cfg80211))
  3841. +$(eval $(call KernelPackage,hermes))
  3842. +$(eval $(call KernelPackage,hermes-pci))
  3843. +$(eval $(call KernelPackage,hermes-plx))
  3844. +$(eval $(call KernelPackage,hermes-pcmcia))
  3845. +$(eval $(call KernelPackage,iwlwifi))
  3846. +$(eval $(call KernelPackage,iwl-legacy))
  3847. +$(eval $(call KernelPackage,iwl4965))
  3848. +$(eval $(call KernelPackage,iwl3945))
  3849. $(eval $(call KernelPackage,lib80211))
  3850. $(eval $(call KernelPackage,libertas-usb))
  3851. $(eval $(call KernelPackage,libertas-sdio))
  3852. -$(eval $(call KernelPackage,cfg80211))
  3853. +$(eval $(call KernelPackage,libipw))
  3854. +$(eval $(call KernelPackage,ipw2100))
  3855. +$(eval $(call KernelPackage,ipw2200))
  3856. $(eval $(call KernelPackage,mac80211))
  3857. +$(eval $(call KernelPackage,mac80211-hwsim))
  3858. +$(eval $(call KernelPackage,mt7601u))
  3859. +$(eval $(call KernelPackage,mwl8k))
  3860. +$(eval $(call KernelPackage,mwifiex-pcie))
  3861. $(eval $(call KernelPackage,p54-common))
  3862. $(eval $(call KernelPackage,p54-pci))
  3863. $(eval $(call KernelPackage,p54-usb))
  3864. @@ -2047,12 +1793,12 @@ $(eval $(call KernelPackage,rt2800-lib))
  3865. $(eval $(call KernelPackage,rt2400-pci))
  3866. $(eval $(call KernelPackage,rt2500-pci))
  3867. $(eval $(call KernelPackage,rt2500-usb))
  3868. -$(eval $(call KernelPackage,rt61-pci))
  3869. -$(eval $(call KernelPackage,rt73-usb))
  3870. $(eval $(call KernelPackage,rt2800-mmio))
  3871. $(eval $(call KernelPackage,rt2800-soc))
  3872. $(eval $(call KernelPackage,rt2800-pci))
  3873. $(eval $(call KernelPackage,rt2800-usb))
  3874. +$(eval $(call KernelPackage,rt61-pci))
  3875. +$(eval $(call KernelPackage,rt73-usb))
  3876. $(eval $(call KernelPackage,rtl8180))
  3877. $(eval $(call KernelPackage,rtl8187))
  3878. $(eval $(call KernelPackage,rtlwifi))
  3879. @@ -2063,32 +1809,8 @@ $(eval $(call KernelPackage,rtl8192ce))
  3880. $(eval $(call KernelPackage,rtl8192se))
  3881. $(eval $(call KernelPackage,rtl8192de))
  3882. $(eval $(call KernelPackage,rtl8192cu))
  3883. -$(eval $(call KernelPackage,zd1211rw))
  3884. -$(eval $(call KernelPackage,mac80211-hwsim))
  3885. -$(eval $(call KernelPackage,ath9k-common))
  3886. -$(eval $(call KernelPackage,ath9k))
  3887. -$(eval $(call KernelPackage,ath9k-htc))
  3888. -$(eval $(call KernelPackage,ath10k))
  3889. -$(eval $(call KernelPackage,ath))
  3890. -$(eval $(call KernelPackage,carl9170))
  3891. -$(eval $(call KernelPackage,b43))
  3892. -$(eval $(call KernelPackage,b43legacy))
  3893. -$(eval $(call KernelPackage,brcmutil))
  3894. -$(eval $(call KernelPackage,brcmsmac))
  3895. -$(eval $(call KernelPackage,brcmfmac))
  3896. -$(eval $(call KernelPackage,net-libipw))
  3897. -$(eval $(call KernelPackage,net-ipw2100))
  3898. -$(eval $(call KernelPackage,net-ipw2200))
  3899. -$(eval $(call KernelPackage,iwlagn))
  3900. -$(eval $(call KernelPackage,iwl-legacy))
  3901. -$(eval $(call KernelPackage,iwl4965))
  3902. -$(eval $(call KernelPackage,iwl3945))
  3903. -$(eval $(call KernelPackage,mwl8k))
  3904. -$(eval $(call KernelPackage,mwifiex-pcie))
  3905. -$(eval $(call KernelPackage,net-hermes))
  3906. -$(eval $(call KernelPackage,net-hermes-pci))
  3907. -$(eval $(call KernelPackage,net-hermes-plx))
  3908. -$(eval $(call KernelPackage,net-hermes-pcmcia))
  3909. +$(eval $(call KernelPackage,rtl8xxxu))
  3910. $(eval $(call KernelPackage,wlcore))
  3911. $(eval $(call KernelPackage,wl12xx))
  3912. $(eval $(call KernelPackage,wl18xx))
  3913. +$(eval $(call KernelPackage,zd1211rw))
  3914. diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  3915. index 2852f3e..02c195e 100644
  3916. --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  3917. +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  3918. @@ -23,6 +23,7 @@ drv_mac80211_init_device_config() {
  3919. config_add_int rxantenna txantenna antenna_gain txpower distance
  3920. config_add_boolean noscan ht_coex
  3921. config_add_array ht_capab
  3922. + config_add_array channels
  3923. config_add_boolean \
  3924. rxldpc \
  3925. short_gi_80 \
  3926. @@ -89,6 +90,7 @@ mac80211_hostapd_setup_base() {
  3927. json_select config
  3928. [ "$auto_channel" -gt 0 ] && channel=acs_survey
  3929. + [ "$auto_channel" -gt 0 ] && json_get_values channel_list channels
  3930. json_get_vars noscan ht_coex
  3931. json_get_values ht_capab_list ht_capab
  3932. @@ -301,6 +303,7 @@ mac80211_hostapd_setup_base() {
  3933. hostapd_prepare_device_config "$hostapd_conf_file" nl80211
  3934. cat >> "$hostapd_conf_file" <<EOF
  3935. ${channel:+channel=$channel}
  3936. +${channel_list:+chanlist=$channel_list}
  3937. ${noscan:+noscan=$noscan}
  3938. $base_cfg
  3939. @@ -391,11 +394,10 @@ mac80211_generate_mac() {
  3940. find_phy() {
  3941. [ -n "$phy" -a -d /sys/class/ieee80211/$phy ] && return 0
  3942. [ -n "$path" ] && {
  3943. - for phy in /sys/devices/$path/ieee80211/phy*; do
  3944. - [ -e "$phy" ] && {
  3945. - phy="${phy##*/}"
  3946. - return 0
  3947. - }
  3948. + for phy in $(ls /sys/class/ieee80211 2>/dev/null); do
  3949. + case "$(readlink -f /sys/class/ieee80211/$phy/device)" in
  3950. + *$path) return 0;;
  3951. + esac
  3952. done
  3953. }
  3954. [ -n "$macaddr" ] && {
  3955. @@ -455,12 +457,7 @@ mac80211_prepare_vif() {
  3956. }
  3957. ;;
  3958. mesh)
  3959. - json_get_vars key mesh_id
  3960. - if [ -n "$key" ]; then
  3961. - iw phy "$phy" interface add "$ifname" type mp
  3962. - else
  3963. - iw phy "$phy" interface add "$ifname" type mp mesh_id "$mesh_id"
  3964. - fi
  3965. + iw phy "$phy" interface add "$ifname" type mp
  3966. ;;
  3967. monitor)
  3968. iw phy "$phy" interface add "$ifname" type monitor
  3969. @@ -486,7 +483,7 @@ mac80211_prepare_vif() {
  3970. # All interfaces must have unique mac addresses
  3971. # which can either be explicitly set in the device
  3972. # section, or automatically generated
  3973. - ifconfig "$ifname" hw ether "$macaddr"
  3974. + ip link set dev "$ifname" address "$macaddr"
  3975. fi
  3976. json_select ..
  3977. @@ -501,7 +498,7 @@ mac80211_setup_supplicant() {
  3978. mac80211_setup_adhoc_htmode() {
  3979. case "$htmode" in
  3980. VHT20|HT20) ibss_htmode=HT20;;
  3981. - HT40*|VHT40|VHT80|VHT160)
  3982. + HT40*|VHT40|VHT160)
  3983. case "$hwmode" in
  3984. a)
  3985. case "$(( ($channel / 4) % 2 ))" in
  3986. @@ -525,6 +522,9 @@ mac80211_setup_adhoc_htmode() {
  3987. esac
  3988. [ "$auto_channel" -gt 0 ] && ibss_htmode="HT40+"
  3989. ;;
  3990. + VHT80)
  3991. + ibss_htmode="80MHZ"
  3992. + ;;
  3993. NONE|NOHT)
  3994. ibss_htmode="NOHT"
  3995. ;;
  3996. @@ -585,7 +585,7 @@ mac80211_setup_vif() {
  3997. json_get_vars mode
  3998. json_get_var vif_txpower txpower
  3999. - ifconfig "$ifname" up || {
  4000. + ip link set dev "$ifname" up || {
  4001. wireless_setup_vif_failed IFUP_ERROR
  4002. json_select ..
  4003. return
  4004. @@ -606,6 +606,13 @@ mac80211_setup_vif() {
  4005. wireless_vif_parse_encryption
  4006. mac80211_setup_supplicant || failed=1
  4007. fi
  4008. + else
  4009. + json_get_vars mesh_id mcast_rate
  4010. +
  4011. + mcval=
  4012. + [ -n "$mcast_rate" ] && wpa_supplicant_add_rate mcval "$mcast_rate"
  4013. +
  4014. + iw dev "$ifname" mesh join "$mesh_id" ${mcval:+mcast-rate $mcval}
  4015. fi
  4016. for var in $MP_CONFIG_INT $MP_CONFIG_BOOL $MP_CONFIG_STRING; do
  4017. @@ -641,7 +648,7 @@ mac80211_interface_cleanup() {
  4018. local phy="$1"
  4019. for wdev in $(list_phy_interfaces "$phy"); do
  4020. - ifconfig "$wdev" down 2>/dev/null
  4021. + ip link set dev "$wdev" down 2>/dev/null
  4022. iw dev "$wdev" del
  4023. done
  4024. }
  4025. diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
  4026. index ea229d6..06f3b8b 100644
  4027. --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh
  4028. +++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
  4029. @@ -9,11 +9,10 @@ lookup_phy() {
  4030. local devpath
  4031. config_get devpath "$device" path
  4032. [ -n "$devpath" ] && {
  4033. - for _phy in /sys/devices/$devpath/ieee80211/phy*; do
  4034. - [ -e "$_phy" ] && {
  4035. - phy="${_phy##*/}"
  4036. - return
  4037. - }
  4038. + for phy in $(ls /sys/class/ieee80211 2>/dev/null); do
  4039. + case "$(readlink -f /sys/class/ieee80211/$phy/device)" in
  4040. + *$devpath) return;;
  4041. + esac
  4042. done
  4043. }
  4044. @@ -102,6 +101,9 @@ detect_mac80211() {
  4045. fi
  4046. if [ -n "$path" ]; then
  4047. path="${path##/sys/devices/}"
  4048. + case "$path" in
  4049. + platform*/pci*) path="${path##platform/}";;
  4050. + esac
  4051. dev_id=" option path '$path'"
  4052. else
  4053. dev_id=" option macaddr $(cat /sys/class/ieee80211/${dev}/macaddress)"
  4054. diff --git a/package/kernel/mac80211/patches/001-fix_build.patch b/package/kernel/mac80211/patches/001-fix_build.patch
  4055. index 818983e..402649d 100644
  4056. --- a/package/kernel/mac80211/patches/001-fix_build.patch
  4057. +++ b/package/kernel/mac80211/patches/001-fix_build.patch
  4058. @@ -27,7 +27,7 @@
  4059. @set -e ; test -f .local-symbols || ( \
  4060. echo "/--------------" ;\
  4061. echo "| You shouldn't run make in the backports tree, but only in" ;\
  4062. -@@ -60,56 +62,60 @@ mrproper:
  4063. +@@ -60,57 +62,61 @@ mrproper:
  4064. echo "| (that isn't currently running.)" ;\
  4065. echo "\\--" ;\
  4066. false)
  4067. @@ -56,11 +56,12 @@
  4068. - done \
  4069. - ) > Kconfig.kernel ;\
  4070. - kver=$$($(MAKE) --no-print-directory -C $(KLIB_BUILD) kernelversion | \
  4071. -- sed 's/^\(\(3\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\
  4072. +- sed 's/^\(\([3-4]\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\
  4073. - test "$$kver" != "" || echo "Kernel version parse failed!" ;\
  4074. - test "$$kver" != "" ;\
  4075. - kvers="$$(seq 14 39 | sed 's/^/2.6./')" ;\
  4076. -- kvers="$$kvers $$(seq 0 99 | sed 's/^/3./')" ;\
  4077. +- kvers="$$kvers $$(seq 0 19 | sed 's/^/3./')" ;\
  4078. +- kvers="$$kvers $$(seq 0 99 | sed 's/^/4./')" ;\
  4079. - print=0 ;\
  4080. - for v in $$kvers ; do \
  4081. - if [ "$$print" = "1" ] ; then \
  4082. @@ -111,11 +112,12 @@
  4083. +
  4084. +Kconfig.versions: Kconfig.kernel
  4085. + @kver=$$($(MAKE) --no-print-directory -C $(KLIB_BUILD) kernelversion | \
  4086. -+ sed 's/^\(\(3\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\
  4087. ++ sed 's/^\(\([3-4]\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\
  4088. + test "$$kver" != "" || echo "Kernel version parse failed!" ;\
  4089. + test "$$kver" != "" ;\
  4090. + kvers="$$(seq 14 39 | sed 's/^/2.6./')" ;\
  4091. -+ kvers="$$kvers $$(seq 0 99 | sed 's/^/3./')" ;\
  4092. ++ kvers="$$kvers $$(seq 0 19 | sed 's/^/3./')" ;\
  4093. ++ kvers="$$kvers $$(seq 0 99 | sed 's/^/4./')" ;\
  4094. + print=0 ;\
  4095. + for v in $$kvers ; do \
  4096. + if [ "$$print" = "1" ] ; then \
  4097. diff --git a/package/kernel/mac80211/patches/002-change_allconfig.patch b/package/kernel/mac80211/patches/002-change_allconfig.patch
  4098. index 91ad20f..bd5bebf 100644
  4099. --- a/package/kernel/mac80211/patches/002-change_allconfig.patch
  4100. +++ b/package/kernel/mac80211/patches/002-change_allconfig.patch
  4101. @@ -1,6 +1,6 @@
  4102. --- a/kconf/conf.c
  4103. +++ b/kconf/conf.c
  4104. -@@ -578,40 +578,12 @@ int main(int ac, char **av)
  4105. +@@ -593,40 +593,12 @@ int main(int ac, char **av)
  4106. case oldconfig:
  4107. case listnewconfig:
  4108. case olddefconfig:
  4109. @@ -42,3 +42,23 @@
  4110. break;
  4111. default:
  4112. break;
  4113. +--- a/kconf/confdata.c
  4114. ++++ b/kconf/confdata.c
  4115. +@@ -1169,6 +1169,8 @@ bool conf_set_all_new_symbols(enum conf_
  4116. + }
  4117. + bool has_changed = false;
  4118. +
  4119. ++ sym_clear_all_valid();
  4120. ++
  4121. + for_all_symbols(i, sym) {
  4122. + if (sym_has_value(sym) || (sym->flags & SYMBOL_VALID))
  4123. + continue;
  4124. +@@ -1212,8 +1214,6 @@ bool conf_set_all_new_symbols(enum conf_
  4125. +
  4126. + }
  4127. +
  4128. +- sym_clear_all_valid();
  4129. +-
  4130. + /*
  4131. + * We have different type of choice blocks.
  4132. + * If curr.tri equals to mod then we can select several
  4133. diff --git a/package/kernel/mac80211/patches/004-backports-add-skb_free_frag.patch b/package/kernel/mac80211/patches/004-backports-add-skb_free_frag.patch
  4134. new file mode 100644
  4135. index 0000000..9adfd8f
  4136. --- /dev/null
  4137. +++ b/package/kernel/mac80211/patches/004-backports-add-skb_free_frag.patch
  4138. @@ -0,0 +1,21 @@
  4139. +From: Felix Fietkau <nbd@openwrt.org>
  4140. +Date: Thu, 28 Jan 2016 15:16:35 +0100
  4141. +Subject: [PATCH] backports: add skb_free_frag()
  4142. +
  4143. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  4144. +---
  4145. +
  4146. +--- a/backport-include/linux/skbuff.h
  4147. ++++ b/backport-include/linux/skbuff.h
  4148. +@@ -300,4 +300,11 @@ int skb_ensure_writable(struct sk_buff *
  4149. +
  4150. + #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) */
  4151. +
  4152. ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
  4153. ++static inline void skb_free_frag(void *data)
  4154. ++{
  4155. ++ put_page(virt_to_head_page(data));
  4156. ++}
  4157. ++#endif
  4158. ++
  4159. + #endif /* __BACKPORT_SKBUFF_H */
  4160. diff --git a/package/kernel/mac80211/patches/004-backports_debugfs_fix.patch b/package/kernel/mac80211/patches/004-backports_debugfs_fix.patch
  4161. deleted file mode 100644
  4162. index d48a723..0000000
  4163. --- a/package/kernel/mac80211/patches/004-backports_debugfs_fix.patch
  4164. +++ /dev/null
  4165. @@ -1,10 +0,0 @@
  4166. ---- a/backport-include/linux/debugfs.h
  4167. -+++ b/backport-include/linux/debugfs.h
  4168. -@@ -3,6 +3,7 @@
  4169. - #include_next <linux/debugfs.h>
  4170. - #include <linux/version.h>
  4171. - #include <generated/utsrelease.h>
  4172. -+#include <linux/device.h>
  4173. -
  4174. - #if defined(CONFIG_DEBUG_FS)
  4175. - struct dentry *debugfs_create_devm_seqfile(struct device *dev, const char *name,
  4176. diff --git a/package/kernel/mac80211/patches/005-backports-add-napi_alloc_frag.patch b/package/kernel/mac80211/patches/005-backports-add-napi_alloc_frag.patch
  4177. new file mode 100644
  4178. index 0000000..9b672a8
  4179. --- /dev/null
  4180. +++ b/package/kernel/mac80211/patches/005-backports-add-napi_alloc_frag.patch
  4181. @@ -0,0 +1,20 @@
  4182. +From: Felix Fietkau <nbd@openwrt.org>
  4183. +Date: Thu, 28 Jan 2016 15:19:22 +0100
  4184. +Subject: [PATCH] backports: add napi_alloc_frag
  4185. +
  4186. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  4187. +---
  4188. +
  4189. +--- a/backport-include/linux/netdevice.h
  4190. ++++ b/backport-include/linux/netdevice.h
  4191. +@@ -232,6 +232,10 @@ static inline void backport_unregister_n
  4192. + #define unregister_netdevice_many LINUX_BACKPORT(unregister_netdevice_many)
  4193. + #endif
  4194. +
  4195. ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
  4196. ++#define napi_alloc_frag netdev_alloc_frag
  4197. ++#endif
  4198. ++
  4199. + /*
  4200. + * Complicated way of saying: We only backport netdev_rss_key stuff on kernels
  4201. + * that either already have net_get_random_once() (>= 3.13) or where we've been
  4202. diff --git a/package/kernel/mac80211/patches/008-fix_netdev_unregister.patch b/package/kernel/mac80211/patches/008-fix_netdev_unregister.patch
  4203. deleted file mode 100644
  4204. index e07f323..0000000
  4205. --- a/package/kernel/mac80211/patches/008-fix_netdev_unregister.patch
  4206. +++ /dev/null
  4207. @@ -1,16 +0,0 @@
  4208. ---- a/net/mac80211/iface.c
  4209. -+++ b/net/mac80211/iface.c
  4210. -@@ -1858,6 +1858,13 @@ void ieee80211_remove_interfaces(struct
  4211. - }
  4212. - mutex_unlock(&local->iflist_mtx);
  4213. - unregister_netdevice_many(&unreg_list);
  4214. -+#if (!(LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,45) && \
  4215. -+ LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)) && \
  4216. -+ !(LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,9) && \
  4217. -+ LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0)) && \
  4218. -+ (LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)))
  4219. -+ list_del(&unreg_list);
  4220. -+#endif
  4221. -
  4222. - list_for_each_entry_safe(sdata, tmp, &wdev_list, list) {
  4223. - list_del(&sdata->list);
  4224. diff --git a/package/kernel/mac80211/patches/020-add_mpls_h.patch b/package/kernel/mac80211/patches/020-add_mpls_h.patch
  4225. deleted file mode 100644
  4226. index e5310bc..0000000
  4227. --- a/package/kernel/mac80211/patches/020-add_mpls_h.patch
  4228. +++ /dev/null
  4229. @@ -1,37 +0,0 @@
  4230. ---- /dev/null
  4231. -+++ b/include/uapi/linux/mpls.h
  4232. -@@ -0,0 +1,34 @@
  4233. -+#ifndef _UAPI_MPLS_H
  4234. -+#define _UAPI_MPLS_H
  4235. -+
  4236. -+#include <linux/types.h>
  4237. -+#include <asm/byteorder.h>
  4238. -+
  4239. -+/* Reference: RFC 5462, RFC 3032
  4240. -+ *
  4241. -+ * 0 1 2 3
  4242. -+ * 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
  4243. -+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4244. -+ * | Label | TC |S| TTL |
  4245. -+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4246. -+ *
  4247. -+ * Label: Label Value, 20 bits
  4248. -+ * TC: Traffic Class field, 3 bits
  4249. -+ * S: Bottom of Stack, 1 bit
  4250. -+ * TTL: Time to Live, 8 bits
  4251. -+ */
  4252. -+
  4253. -+struct mpls_label {
  4254. -+ __be32 entry;
  4255. -+};
  4256. -+
  4257. -+#define MPLS_LS_LABEL_MASK 0xFFFFF000
  4258. -+#define MPLS_LS_LABEL_SHIFT 12
  4259. -+#define MPLS_LS_TC_MASK 0x00000E00
  4260. -+#define MPLS_LS_TC_SHIFT 9
  4261. -+#define MPLS_LS_S_MASK 0x00000100
  4262. -+#define MPLS_LS_S_SHIFT 8
  4263. -+#define MPLS_LS_TTL_MASK 0x000000FF
  4264. -+#define MPLS_LS_TTL_SHIFT 0
  4265. -+
  4266. -+#endif /* _UAPI_MPLS_H */
  4267. diff --git a/package/kernel/mac80211/patches/030-rt2x00_options.patch b/package/kernel/mac80211/patches/030-rt2x00_options.patch
  4268. index 35b5b5d..a4ca884 100644
  4269. --- a/package/kernel/mac80211/patches/030-rt2x00_options.patch
  4270. +++ b/package/kernel/mac80211/patches/030-rt2x00_options.patch
  4271. @@ -1,5 +1,5 @@
  4272. ---- a/drivers/net/wireless/rt2x00/Kconfig
  4273. -+++ b/drivers/net/wireless/rt2x00/Kconfig
  4274. +--- a/drivers/net/wireless/ralink/rt2x00/Kconfig
  4275. ++++ b/drivers/net/wireless/ralink/rt2x00/Kconfig
  4276. @@ -225,36 +225,37 @@ config RT2800SOC
  4277. @@ -43,5 +43,5 @@
  4278. - tristate
  4279. + tristate "RT2x00 support"
  4280. depends on m
  4281. - select BPAUTO_AVERAGE
  4282. + config RT2X00_LIB_FIRMWARE
  4283. diff --git a/package/kernel/mac80211/patches/040-brcmutil_option.patch b/package/kernel/mac80211/patches/040-brcmutil_option.patch
  4284. index 8a6cae6..167332d 100644
  4285. --- a/package/kernel/mac80211/patches/040-brcmutil_option.patch
  4286. +++ b/package/kernel/mac80211/patches/040-brcmutil_option.patch
  4287. @@ -1,5 +1,5 @@
  4288. ---- a/drivers/net/wireless/brcm80211/Kconfig
  4289. -+++ b/drivers/net/wireless/brcm80211/Kconfig
  4290. +--- a/drivers/net/wireless/broadcom/brcm80211/Kconfig
  4291. ++++ b/drivers/net/wireless/broadcom/brcm80211/Kconfig
  4292. @@ -1,5 +1,5 @@
  4293. config BRCMUTIL
  4294. - tristate
  4295. diff --git a/package/kernel/mac80211/patches/045-bcma-from-4.1.patch b/package/kernel/mac80211/patches/045-bcma-from-4.1.patch
  4296. deleted file mode 100644
  4297. index dce217f..0000000
  4298. --- a/package/kernel/mac80211/patches/045-bcma-from-4.1.patch
  4299. +++ /dev/null
  4300. @@ -1,104 +0,0 @@
  4301. ---- a/drivers/bcma/driver_pci.c
  4302. -+++ b/drivers/bcma/driver_pci.c
  4303. -@@ -282,39 +282,6 @@ void bcma_core_pci_power_save(struct bcm
  4304. - }
  4305. - EXPORT_SYMBOL_GPL(bcma_core_pci_power_save);
  4306. -
  4307. --int bcma_core_pci_irq_ctl(struct bcma_bus *bus, struct bcma_device *core,
  4308. -- bool enable)
  4309. --{
  4310. -- struct pci_dev *pdev;
  4311. -- u32 coremask, tmp;
  4312. -- int err = 0;
  4313. --
  4314. -- if (bus->hosttype != BCMA_HOSTTYPE_PCI) {
  4315. -- /* This bcma device is not on a PCI host-bus. So the IRQs are
  4316. -- * not routed through the PCI core.
  4317. -- * So we must not enable routing through the PCI core. */
  4318. -- goto out;
  4319. -- }
  4320. --
  4321. -- pdev = bus->host_pci;
  4322. --
  4323. -- err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp);
  4324. -- if (err)
  4325. -- goto out;
  4326. --
  4327. -- coremask = BIT(core->core_index) << 8;
  4328. -- if (enable)
  4329. -- tmp |= coremask;
  4330. -- else
  4331. -- tmp &= ~coremask;
  4332. --
  4333. -- err = pci_write_config_dword(pdev, BCMA_PCI_IRQMASK, tmp);
  4334. --
  4335. --out:
  4336. -- return err;
  4337. --}
  4338. --EXPORT_SYMBOL_GPL(bcma_core_pci_irq_ctl);
  4339. --
  4340. - static void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend)
  4341. - {
  4342. - u32 w;
  4343. ---- a/drivers/bcma/host_pci.c
  4344. -+++ b/drivers/bcma/host_pci.c
  4345. -@@ -351,3 +351,37 @@ void bcma_host_pci_down(struct bcma_bus
  4346. - bcma_core_pci_down(&bus->drv_pci[0]);
  4347. - }
  4348. - EXPORT_SYMBOL_GPL(bcma_host_pci_down);
  4349. -+
  4350. -+/* See also si_pci_setup */
  4351. -+int bcma_host_pci_irq_ctl(struct bcma_bus *bus, struct bcma_device *core,
  4352. -+ bool enable)
  4353. -+{
  4354. -+ struct pci_dev *pdev;
  4355. -+ u32 coremask, tmp;
  4356. -+ int err = 0;
  4357. -+
  4358. -+ if (bus->hosttype != BCMA_HOSTTYPE_PCI) {
  4359. -+ /* This bcma device is not on a PCI host-bus. So the IRQs are
  4360. -+ * not routed through the PCI core.
  4361. -+ * So we must not enable routing through the PCI core. */
  4362. -+ goto out;
  4363. -+ }
  4364. -+
  4365. -+ pdev = bus->host_pci;
  4366. -+
  4367. -+ err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp);
  4368. -+ if (err)
  4369. -+ goto out;
  4370. -+
  4371. -+ coremask = BIT(core->core_index) << 8;
  4372. -+ if (enable)
  4373. -+ tmp |= coremask;
  4374. -+ else
  4375. -+ tmp &= ~coremask;
  4376. -+
  4377. -+ err = pci_write_config_dword(pdev, BCMA_PCI_IRQMASK, tmp);
  4378. -+
  4379. -+out:
  4380. -+ return err;
  4381. -+}
  4382. -+EXPORT_SYMBOL_GPL(bcma_host_pci_irq_ctl);
  4383. ---- a/drivers/net/wireless/b43/main.c
  4384. -+++ b/drivers/net/wireless/b43/main.c
  4385. -@@ -4866,7 +4866,7 @@ static int b43_wireless_core_init(struct
  4386. - switch (dev->dev->bus_type) {
  4387. - #ifdef CPTCFG_B43_BCMA
  4388. - case B43_BUS_BCMA:
  4389. -- bcma_core_pci_irq_ctl(dev->dev->bdev->bus,
  4390. -+ bcma_host_pci_irq_ctl(dev->dev->bdev->bus,
  4391. - dev->dev->bdev, true);
  4392. - bcma_host_pci_up(dev->dev->bdev->bus);
  4393. - break;
  4394. ---- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
  4395. -+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
  4396. -@@ -4959,7 +4959,7 @@ static int brcms_b_up_prep(struct brcms_
  4397. - * Configure pci/pcmcia here instead of in brcms_c_attach()
  4398. - * to allow mfg hotswap: down, hotswap (chip power cycle), up.
  4399. - */
  4400. -- bcma_core_pci_irq_ctl(wlc_hw->d11core->bus, wlc_hw->d11core,
  4401. -+ bcma_host_pci_irq_ctl(wlc_hw->d11core->bus, wlc_hw->d11core,
  4402. - true);
  4403. -
  4404. - /*
  4405. diff --git a/package/kernel/mac80211/patches/050-lib80211_option.patch b/package/kernel/mac80211/patches/050-lib80211_option.patch
  4406. index 5fe5558..3fc8c05 100644
  4407. --- a/package/kernel/mac80211/patches/050-lib80211_option.patch
  4408. +++ b/package/kernel/mac80211/patches/050-lib80211_option.patch
  4409. @@ -1,6 +1,6 @@
  4410. --- a/net/wireless/Kconfig
  4411. +++ b/net/wireless/Kconfig
  4412. -@@ -174,7 +174,7 @@ config CFG80211_WEXT_EXPORT
  4413. +@@ -171,7 +171,7 @@ config CFG80211_WEXT_EXPORT
  4414. wext compatibility symbols to be exported.
  4415. config LIB80211
  4416. @@ -9,7 +9,7 @@
  4417. depends on m
  4418. default n
  4419. help
  4420. -@@ -184,15 +184,15 @@ config LIB80211
  4421. +@@ -181,15 +181,15 @@ config LIB80211
  4422. Drivers should select this themselves if needed.
  4423. config LIB80211_CRYPT_WEP
  4424. diff --git a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  4425. index d307949..fd1e1cf 100644
  4426. --- a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  4427. +++ b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  4428. @@ -1,9 +1,9 @@
  4429. --- a/.local-symbols
  4430. +++ b/.local-symbols
  4431. -@@ -344,40 +344,3 @@ USB_CDC_PHONET=
  4432. - USB_IPHETH=
  4433. +@@ -476,44 +476,6 @@ USB_IPHETH=
  4434. USB_SIERRA_NET=
  4435. USB_VL600=
  4436. + USB_NET_CH9200=
  4437. -SSB_POSSIBLE=
  4438. -SSB=
  4439. -SSB_SPROM=
  4440. @@ -15,6 +15,7 @@
  4441. -SSB_PCMCIAHOST=
  4442. -SSB_SDIOHOST_POSSIBLE=
  4443. -SSB_SDIOHOST=
  4444. +-SSB_HOST_SOC=
  4445. -SSB_SILENT=
  4446. -SSB_DEBUG=
  4447. -SSB_SERIAL=
  4448. @@ -32,28 +33,20 @@
  4449. -BCMA_BLOCKIO=
  4450. -BCMA_HOST_PCI_POSSIBLE=
  4451. -BCMA_HOST_PCI=
  4452. --BCMA_DRIVER_PCI_HOSTMODE=
  4453. -BCMA_HOST_SOC=
  4454. -BCMA_DRIVER_PCI=
  4455. +-BCMA_DRIVER_PCI_HOSTMODE=
  4456. -BCMA_DRIVER_MIPS=
  4457. -BCMA_SFLASH=
  4458. -BCMA_NFLASH=
  4459. -BCMA_DRIVER_GMAC_CMN=
  4460. -BCMA_DRIVER_GPIO=
  4461. -BCMA_DEBUG=
  4462. ---- a/Makefile.kernel
  4463. -+++ b/Makefile.kernel
  4464. -@@ -38,8 +38,6 @@ obj-$(CPTCFG_MAC80211) += net/mac80211/
  4465. - obj-$(CPTCFG_WLAN) += drivers/net/wireless/
  4466. - #obj-$(CPTCFG_BT) += net/bluetooth/
  4467. - #obj-$(CPTCFG_BT) += drivers/bluetooth/
  4468. --obj-$(CPTCFG_SSB) += drivers/ssb/
  4469. --obj-$(CPTCFG_BCMA) += drivers/bcma/
  4470. - #obj-$(CPTCFG_ETHERNET) += drivers/net/ethernet/
  4471. - obj-$(CPTCFG_USB_NET_RNDIS_WLAN) += drivers/net/usb/
  4472. - #obj-$(CPTCFG_NFC) += net/nfc/
  4473. ---- a/drivers/net/wireless/b43/main.c
  4474. -+++ b/drivers/net/wireless/b43/main.c
  4475. + NFC=
  4476. + NFC_DIGITAL=
  4477. + NFC_NCI=
  4478. +--- a/drivers/net/wireless/broadcom/b43/main.c
  4479. ++++ b/drivers/net/wireless/broadcom/b43/main.c
  4480. @@ -2866,7 +2866,7 @@ static struct ssb_device *b43_ssb_gpio_d
  4481. {
  4482. struct ssb_bus *bus = dev->dev->sdev->bus;
  4483. @@ -63,7 +56,7 @@
  4484. return (bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev);
  4485. #else
  4486. return bus->chipco.dev;
  4487. -@@ -4907,7 +4907,7 @@ static int b43_wireless_core_init(struct
  4488. +@@ -4903,7 +4903,7 @@ static int b43_wireless_core_init(struct
  4489. }
  4490. if (sprom->boardflags_lo & B43_BFL_XTAL_NOSLOW)
  4491. hf |= B43_HF_DSCRQ; /* Disable slowclock requests from ucode. */
  4492. @@ -72,8 +65,8 @@
  4493. if (dev->dev->bus_type == B43_BUS_SSB &&
  4494. dev->dev->sdev->bus->bustype == SSB_BUSTYPE_PCI &&
  4495. dev->dev->sdev->bus->pcicore.dev->id.revision <= 10)
  4496. ---- a/drivers/net/wireless/b43legacy/main.c
  4497. -+++ b/drivers/net/wireless/b43legacy/main.c
  4498. +--- a/drivers/net/wireless/broadcom/b43legacy/main.c
  4499. ++++ b/drivers/net/wireless/broadcom/b43legacy/main.c
  4500. @@ -1937,7 +1937,7 @@ static int b43legacy_gpio_init(struct b4
  4501. if (dev->dev->id.revision >= 2)
  4502. mask |= 0x0010; /* FIXME: This is redundant. */
  4503. @@ -92,8 +85,8 @@
  4504. pcidev = bus->pcicore.dev;
  4505. #endif
  4506. gpiodev = bus->chipco.dev ? : pcidev;
  4507. ---- a/drivers/net/wireless/brcm80211/brcmsmac/Makefile
  4508. -+++ b/drivers/net/wireless/brcm80211/brcmsmac/Makefile
  4509. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/Makefile
  4510. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/Makefile
  4511. @@ -43,6 +43,6 @@ brcmsmac-y := \
  4512. brcms_trace_events.o \
  4513. debug.o
  4514. @@ -102,8 +95,8 @@
  4515. +brcmsmac-$(CONFIG_BCMA_DRIVER_GPIO) += led.o
  4516. obj-$(CPTCFG_BRCMSMAC) += brcmsmac.o
  4517. ---- a/drivers/net/wireless/brcm80211/brcmsmac/led.h
  4518. -+++ b/drivers/net/wireless/brcm80211/brcmsmac/led.h
  4519. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/led.h
  4520. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/led.h
  4521. @@ -22,7 +22,7 @@ struct brcms_led {
  4522. bool active_low;
  4523. };
  4524. @@ -116,12 +109,23 @@
  4525. --- a/Kconfig.sources
  4526. +++ b/Kconfig.sources
  4527. @@ -9,9 +9,6 @@ source "$BACKPORT_DIR/drivers/net/wirele
  4528. - #source "$BACKPORT_DIR/drivers/net/ethernet/Kconfig"
  4529. + source "$BACKPORT_DIR/drivers/net/ethernet/Kconfig"
  4530. source "$BACKPORT_DIR/drivers/net/usb/Kconfig"
  4531. -source "$BACKPORT_DIR/drivers/ssb/Kconfig"
  4532. -source "$BACKPORT_DIR/drivers/bcma/Kconfig"
  4533. -
  4534. - #source "$BACKPORT_DIR/net/nfc/Kconfig"
  4535. + source "$BACKPORT_DIR/net/nfc/Kconfig"
  4536. - #source "$BACKPORT_DIR/drivers/media/Kconfig"
  4537. + source "$BACKPORT_DIR/drivers/media/Kconfig"
  4538. +--- a/Makefile.kernel
  4539. ++++ b/Makefile.kernel
  4540. +@@ -38,8 +38,6 @@ obj-$(CPTCFG_MAC80211) += net/mac80211/
  4541. + obj-$(CPTCFG_WLAN) += drivers/net/wireless/
  4542. + obj-$(CPTCFG_BT) += net/bluetooth/
  4543. + obj-$(CPTCFG_BT) += drivers/bluetooth/
  4544. +-obj-$(CPTCFG_SSB) += drivers/ssb/
  4545. +-obj-$(CPTCFG_BCMA) += drivers/bcma/
  4546. + obj-$(CPTCFG_ETHERNET) += drivers/net/ethernet/
  4547. + obj-$(CPTCFG_USB_NET_RNDIS_WLAN) += drivers/net/usb/
  4548. + obj-$(CPTCFG_NFC) += net/nfc/
  4549. diff --git a/package/kernel/mac80211/patches/070-ath_common_config.patch b/package/kernel/mac80211/patches/070-ath_common_config.patch
  4550. index c6e9cd8..41774fe 100644
  4551. --- a/package/kernel/mac80211/patches/070-ath_common_config.patch
  4552. +++ b/package/kernel/mac80211/patches/070-ath_common_config.patch
  4553. @@ -1,10 +1,9 @@
  4554. --- a/drivers/net/wireless/ath/Kconfig
  4555. +++ b/drivers/net/wireless/ath/Kconfig
  4556. -@@ -6,6 +6,7 @@ menuconfig ATH_CARDS
  4557. - tristate "Atheros Wireless Cards"
  4558. +@@ -1,5 +1,5 @@
  4559. + config ATH_COMMON
  4560. +- tristate
  4561. ++ tristate "ath.ko"
  4562. depends on m
  4563. - depends on CFG80211 && (!UML || BROKEN)
  4564. -+ select ATH_COMMON
  4565. - ---help---
  4566. - This will enable the support for the Atheros wireless drivers.
  4567. - ath5k, ath9k, ath9k_htc and ar9170 drivers share some common code, this option
  4568. +
  4569. + config WLAN_VENDOR_ATH
  4570. 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
  4571. deleted file mode 100644
  4572. index 85c5280..0000000
  4573. --- a/package/kernel/mac80211/patches/090-linux_3_18_12_compat.patch
  4574. +++ /dev/null
  4575. @@ -1,29 +0,0 @@
  4576. ---- a/backport-include/linux/wait.h
  4577. -+++ b/backport-include/linux/wait.h
  4578. -@@ -23,7 +23,7 @@ backport_wait_on_bit_io(void *word, int
  4579. -
  4580. - #endif
  4581. -
  4582. --#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
  4583. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,12)
  4584. - #define WQ_FLAG_WOKEN 0x02
  4585. -
  4586. - #define wait_woken LINUX_BACKPORT(wait_woken)
  4587. ---- a/compat/backport-3.19.c
  4588. -+++ b/compat/backport-3.19.c
  4589. -@@ -15,6 +15,7 @@
  4590. - #include <linux/netdevice.h>
  4591. - #include <linux/debugfs.h>
  4592. -
  4593. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,12)
  4594. - static inline bool is_kthread_should_stop(void)
  4595. - {
  4596. - return (current->flags & PF_KTHREAD) && kthread_should_stop();
  4597. -@@ -79,6 +80,7 @@ int woken_wake_function(wait_queue_t *wa
  4598. - return default_wake_function(wait, mode, sync, key);
  4599. - }
  4600. - EXPORT_SYMBOL(woken_wake_function);
  4601. -+#endif
  4602. -
  4603. - #ifdef __BACKPORT_NETDEV_RSS_KEY_FILL
  4604. - u8 netdev_rss_key[NETDEV_RSS_KEY_LEN];
  4605. diff --git a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  4606. new file mode 100644
  4607. index 0000000..02f46c7
  4608. --- /dev/null
  4609. +++ b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  4610. @@ -0,0 +1,376 @@
  4611. +--- a/net/mac80211/Kconfig
  4612. ++++ b/net/mac80211/Kconfig
  4613. +@@ -5,8 +5,6 @@ config MAC80211
  4614. + depends on CRYPTO
  4615. + depends on CRYPTO_ARC4
  4616. + depends on CRYPTO_AES
  4617. +- select BPAUTO_CRYPTO_CCM
  4618. +- depends on CRYPTO_GCM
  4619. + depends on CRC32
  4620. + ---help---
  4621. + This option enables the hardware independent IEEE 802.11
  4622. +--- a/net/mac80211/Makefile
  4623. ++++ b/net/mac80211/Makefile
  4624. +@@ -16,9 +16,7 @@ mac80211-y := \
  4625. + michael.o \
  4626. + tkip.o \
  4627. + aes_ccm.o \
  4628. +- aes_gcm.o \
  4629. + aes_cmac.o \
  4630. +- aes_gmac.o \
  4631. + cfg.o \
  4632. + ethtool.o \
  4633. + rx.o \
  4634. +--- a/net/mac80211/aes_ccm.c
  4635. ++++ b/net/mac80211/aes_ccm.c
  4636. +@@ -13,89 +13,132 @@
  4637. + #include <linux/types.h>
  4638. + #include <linux/err.h>
  4639. + #include <crypto/aead.h>
  4640. ++#include <crypto/aes.h>
  4641. +
  4642. + #include <net/mac80211.h>
  4643. + #include "key.h"
  4644. + #include "aes_ccm.h"
  4645. +
  4646. +-void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  4647. +- u8 *data, size_t data_len, u8 *mic,
  4648. +- size_t mic_len)
  4649. ++static void aes_ccm_prepare(struct crypto_cipher *tfm, u8 *b_0, u8 *aad, u8 *s_0,
  4650. ++ u8 *a, u8 *b)
  4651. + {
  4652. +- struct scatterlist sg[3];
  4653. ++ int i;
  4654. ++
  4655. ++ crypto_cipher_encrypt_one(tfm, b, b_0);
  4656. ++
  4657. ++ /* Extra Authenticate-only data (always two AES blocks) */
  4658. ++ for (i = 0; i < AES_BLOCK_SIZE; i++)
  4659. ++ aad[i] ^= b[i];
  4660. ++ crypto_cipher_encrypt_one(tfm, b, aad);
  4661. ++
  4662. ++ aad += AES_BLOCK_SIZE;
  4663. ++
  4664. ++ for (i = 0; i < AES_BLOCK_SIZE; i++)
  4665. ++ aad[i] ^= b[i];
  4666. ++ crypto_cipher_encrypt_one(tfm, a, aad);
  4667. +
  4668. +- char aead_req_data[sizeof(struct aead_request) +
  4669. +- crypto_aead_reqsize(tfm)]
  4670. +- __aligned(__alignof__(struct aead_request));
  4671. +- struct aead_request *aead_req = (void *) aead_req_data;
  4672. ++ /* Mask out bits from auth-only-b_0 */
  4673. ++ b_0[0] &= 0x07;
  4674. +
  4675. +- memset(aead_req, 0, sizeof(aead_req_data));
  4676. ++ /* S_0 is used to encrypt T (= MIC) */
  4677. ++ b_0[14] = 0;
  4678. ++ b_0[15] = 0;
  4679. ++ crypto_cipher_encrypt_one(tfm, s_0, b_0);
  4680. ++}
  4681. +
  4682. +- sg_init_table(sg, 3);
  4683. +- sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad));
  4684. +- sg_set_buf(&sg[1], data, data_len);
  4685. +- sg_set_buf(&sg[2], mic, mic_len);
  4686. +
  4687. +- aead_request_set_tfm(aead_req, tfm);
  4688. +- aead_request_set_crypt(aead_req, sg, sg, data_len, b_0);
  4689. +- aead_request_set_ad(aead_req, sg[0].length);
  4690. ++void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
  4691. ++ u8 *data, size_t data_len, u8 *mic,
  4692. ++ size_t mic_len)
  4693. ++{
  4694. ++ int i, j, last_len, num_blocks;
  4695. ++ u8 b[AES_BLOCK_SIZE];
  4696. ++ u8 s_0[AES_BLOCK_SIZE];
  4697. ++ u8 e[AES_BLOCK_SIZE];
  4698. ++ u8 *pos, *cpos;
  4699. ++
  4700. ++ num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
  4701. ++ last_len = data_len % AES_BLOCK_SIZE;
  4702. ++ aes_ccm_prepare(tfm, b_0, aad, s_0, b, b);
  4703. ++
  4704. ++ /* Process payload blocks */
  4705. ++ pos = data;
  4706. ++ cpos = data;
  4707. ++ for (j = 1; j <= num_blocks; j++) {
  4708. ++ int blen = (j == num_blocks && last_len) ?
  4709. ++ last_len : AES_BLOCK_SIZE;
  4710. ++
  4711. ++ /* Authentication followed by encryption */
  4712. ++ for (i = 0; i < blen; i++)
  4713. ++ b[i] ^= pos[i];
  4714. ++ crypto_cipher_encrypt_one(tfm, b, b);
  4715. ++
  4716. ++ b_0[14] = (j >> 8) & 0xff;
  4717. ++ b_0[15] = j & 0xff;
  4718. ++ crypto_cipher_encrypt_one(tfm, e, b_0);
  4719. ++ for (i = 0; i < blen; i++)
  4720. ++ *cpos++ = *pos++ ^ e[i];
  4721. ++ }
  4722. +
  4723. +- crypto_aead_encrypt(aead_req);
  4724. ++ for (i = 0; i < mic_len; i++)
  4725. ++ mic[i] = b[i] ^ s_0[i];
  4726. + }
  4727. +
  4728. +-int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  4729. ++int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
  4730. + u8 *data, size_t data_len, u8 *mic,
  4731. + size_t mic_len)
  4732. + {
  4733. +- struct scatterlist sg[3];
  4734. +- char aead_req_data[sizeof(struct aead_request) +
  4735. +- crypto_aead_reqsize(tfm)]
  4736. +- __aligned(__alignof__(struct aead_request));
  4737. +- struct aead_request *aead_req = (void *) aead_req_data;
  4738. +-
  4739. +- if (data_len == 0)
  4740. +- return -EINVAL;
  4741. +-
  4742. +- memset(aead_req, 0, sizeof(aead_req_data));
  4743. +-
  4744. +- sg_init_table(sg, 3);
  4745. +- sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad));
  4746. +- sg_set_buf(&sg[1], data, data_len);
  4747. +- sg_set_buf(&sg[2], mic, mic_len);
  4748. +-
  4749. +- aead_request_set_tfm(aead_req, tfm);
  4750. +- aead_request_set_crypt(aead_req, sg, sg, data_len + mic_len, b_0);
  4751. +- aead_request_set_ad(aead_req, sg[0].length);
  4752. ++ int i, j, last_len, num_blocks;
  4753. ++ u8 *pos, *cpos;
  4754. ++ u8 a[AES_BLOCK_SIZE];
  4755. ++ u8 b[AES_BLOCK_SIZE];
  4756. ++ u8 s_0[AES_BLOCK_SIZE];
  4757. ++
  4758. ++ num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
  4759. ++ last_len = data_len % AES_BLOCK_SIZE;
  4760. ++ aes_ccm_prepare(tfm, b_0, aad, s_0, a, b);
  4761. ++
  4762. ++ /* Process payload blocks */
  4763. ++ cpos = data;
  4764. ++ pos = data;
  4765. ++ for (j = 1; j <= num_blocks; j++) {
  4766. ++ int blen = (j == num_blocks && last_len) ?
  4767. ++ last_len : AES_BLOCK_SIZE;
  4768. ++
  4769. ++ /* Decryption followed by authentication */
  4770. ++ b_0[14] = (j >> 8) & 0xff;
  4771. ++ b_0[15] = j & 0xff;
  4772. ++ crypto_cipher_encrypt_one(tfm, b, b_0);
  4773. ++ for (i = 0; i < blen; i++) {
  4774. ++ *pos = *cpos++ ^ b[i];
  4775. ++ a[i] ^= *pos++;
  4776. ++ }
  4777. ++ crypto_cipher_encrypt_one(tfm, a, a);
  4778. ++ }
  4779. ++
  4780. ++ for (i = 0; i < mic_len; i++) {
  4781. ++ if ((mic[i] ^ s_0[i]) != a[i])
  4782. ++ return -1;
  4783. ++ }
  4784. +
  4785. +- return crypto_aead_decrypt(aead_req);
  4786. ++ return 0;
  4787. + }
  4788. +
  4789. +-struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[],
  4790. +- size_t key_len,
  4791. +- size_t mic_len)
  4792. ++struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[],
  4793. ++ size_t key_len,
  4794. ++ size_t mic_len)
  4795. + {
  4796. +- struct crypto_aead *tfm;
  4797. +- int err;
  4798. ++ struct crypto_cipher *tfm;
  4799. +
  4800. +- tfm = crypto_alloc_aead("ccm(aes)", 0, CRYPTO_ALG_ASYNC);
  4801. +- if (IS_ERR(tfm))
  4802. +- return tfm;
  4803. +-
  4804. +- err = crypto_aead_setkey(tfm, key, key_len);
  4805. +- if (err)
  4806. +- goto free_aead;
  4807. +- err = crypto_aead_setauthsize(tfm, mic_len);
  4808. +- if (err)
  4809. +- goto free_aead;
  4810. ++ tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
  4811. ++ if (!IS_ERR(tfm))
  4812. ++ crypto_cipher_setkey(tfm, key, key_len);
  4813. +
  4814. + return tfm;
  4815. +-
  4816. +-free_aead:
  4817. +- crypto_free_aead(tfm);
  4818. +- return ERR_PTR(err);
  4819. + }
  4820. +
  4821. +-void ieee80211_aes_key_free(struct crypto_aead *tfm)
  4822. ++
  4823. ++void ieee80211_aes_key_free(struct crypto_cipher *tfm)
  4824. + {
  4825. +- crypto_free_aead(tfm);
  4826. ++ crypto_free_cipher(tfm);
  4827. + }
  4828. +--- a/net/mac80211/aes_ccm.h
  4829. ++++ b/net/mac80211/aes_ccm.h
  4830. +@@ -12,15 +12,15 @@
  4831. +
  4832. + #include <linux/crypto.h>
  4833. +
  4834. +-struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[],
  4835. +- size_t key_len,
  4836. +- size_t mic_len);
  4837. +-void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  4838. ++struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[],
  4839. ++ size_t key_len,
  4840. ++ size_t mic_len);
  4841. ++void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
  4842. + u8 *data, size_t data_len, u8 *mic,
  4843. + size_t mic_len);
  4844. +-int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  4845. ++int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
  4846. + u8 *data, size_t data_len, u8 *mic,
  4847. + size_t mic_len);
  4848. +-void ieee80211_aes_key_free(struct crypto_aead *tfm);
  4849. ++void ieee80211_aes_key_free(struct crypto_cipher *tfm);
  4850. +
  4851. + #endif /* AES_CCM_H */
  4852. +--- a/net/mac80211/aes_gcm.h
  4853. ++++ b/net/mac80211/aes_gcm.h
  4854. +@@ -11,12 +11,28 @@
  4855. +
  4856. + #include <linux/crypto.h>
  4857. +
  4858. +-void ieee80211_aes_gcm_encrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  4859. +- u8 *data, size_t data_len, u8 *mic);
  4860. +-int ieee80211_aes_gcm_decrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  4861. +- u8 *data, size_t data_len, u8 *mic);
  4862. +-struct crypto_aead *ieee80211_aes_gcm_key_setup_encrypt(const u8 key[],
  4863. +- size_t key_len);
  4864. +-void ieee80211_aes_gcm_key_free(struct crypto_aead *tfm);
  4865. ++static inline void
  4866. ++ieee80211_aes_gcm_encrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  4867. ++ u8 *data, size_t data_len, u8 *mic)
  4868. ++{
  4869. ++}
  4870. ++
  4871. ++static inline int
  4872. ++ieee80211_aes_gcm_decrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  4873. ++ u8 *data, size_t data_len, u8 *mic)
  4874. ++{
  4875. ++ return -EOPNOTSUPP;
  4876. ++}
  4877. ++
  4878. ++static inline struct crypto_aead *
  4879. ++ieee80211_aes_gcm_key_setup_encrypt(const u8 key[], size_t key_len)
  4880. ++{
  4881. ++ return NULL;
  4882. ++}
  4883. ++
  4884. ++static inline void
  4885. ++ieee80211_aes_gcm_key_free(struct crypto_aead *tfm)
  4886. ++{
  4887. ++}
  4888. +
  4889. + #endif /* AES_GCM_H */
  4890. +--- a/net/mac80211/aes_gmac.h
  4891. ++++ b/net/mac80211/aes_gmac.h
  4892. +@@ -11,10 +11,22 @@
  4893. +
  4894. + #include <linux/crypto.h>
  4895. +
  4896. +-struct crypto_aead *ieee80211_aes_gmac_key_setup(const u8 key[],
  4897. +- size_t key_len);
  4898. +-int ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce,
  4899. +- const u8 *data, size_t data_len, u8 *mic);
  4900. +-void ieee80211_aes_gmac_key_free(struct crypto_aead *tfm);
  4901. ++static inline struct crypto_aead *
  4902. ++ieee80211_aes_gmac_key_setup(const u8 key[], size_t key_len)
  4903. ++{
  4904. ++ return NULL;
  4905. ++}
  4906. ++
  4907. ++static inline int
  4908. ++ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce,
  4909. ++ const u8 *data, size_t data_len, u8 *mic)
  4910. ++{
  4911. ++ return -EOPNOTSUPP;
  4912. ++}
  4913. ++
  4914. ++static inline void
  4915. ++ieee80211_aes_gmac_key_free(struct crypto_aead *tfm)
  4916. ++{
  4917. ++}
  4918. +
  4919. + #endif /* AES_GMAC_H */
  4920. +--- a/net/mac80211/key.h
  4921. ++++ b/net/mac80211/key.h
  4922. +@@ -84,7 +84,7 @@ struct ieee80211_key {
  4923. + * Management frames.
  4924. + */
  4925. + u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_CCMP_PN_LEN];
  4926. +- struct crypto_aead *tfm;
  4927. ++ struct crypto_cipher *tfm;
  4928. + u32 replays; /* dot11RSNAStatsCCMPReplays */
  4929. + } ccmp;
  4930. + struct {
  4931. +--- a/net/mac80211/wpa.c
  4932. ++++ b/net/mac80211/wpa.c
  4933. +@@ -307,7 +307,8 @@ ieee80211_crypto_tkip_decrypt(struct iee
  4934. + }
  4935. +
  4936. +
  4937. +-static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad)
  4938. ++static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad,
  4939. ++ u16 data_len)
  4940. + {
  4941. + __le16 mask_fc;
  4942. + int a4_included, mgmt;
  4943. +@@ -337,14 +338,8 @@ static void ccmp_special_blocks(struct s
  4944. + else
  4945. + qos_tid = 0;
  4946. +
  4947. +- /* In CCM, the initial vectors (IV) used for CTR mode encryption and CBC
  4948. +- * mode authentication are not allowed to collide, yet both are derived
  4949. +- * from this vector b_0. We only set L := 1 here to indicate that the
  4950. +- * data size can be represented in (L+1) bytes. The CCM layer will take
  4951. +- * care of storing the data length in the top (L+1) bytes and setting
  4952. +- * and clearing the other bits as is required to derive the two IVs.
  4953. +- */
  4954. +- b_0[0] = 0x1;
  4955. ++ /* First block, b_0 */
  4956. ++ b_0[0] = 0x59; /* flags: Adata: 1, M: 011, L: 001 */
  4957. +
  4958. + /* Nonce: Nonce Flags | A2 | PN
  4959. + * Nonce Flags: Priority (b0..b3) | Management (b4) | Reserved (b5..b7)
  4960. +@@ -352,6 +347,8 @@ static void ccmp_special_blocks(struct s
  4961. + b_0[1] = qos_tid | (mgmt << 4);
  4962. + memcpy(&b_0[2], hdr->addr2, ETH_ALEN);
  4963. + memcpy(&b_0[8], pn, IEEE80211_CCMP_PN_LEN);
  4964. ++ /* l(m) */
  4965. ++ put_unaligned_be16(data_len, &b_0[14]);
  4966. +
  4967. + /* AAD (extra authenticate-only data) / masked 802.11 header
  4968. + * FC | A1 | A2 | A3 | SC | [A4] | [QC] */
  4969. +@@ -463,7 +460,7 @@ static int ccmp_encrypt_skb(struct ieee8
  4970. + return 0;
  4971. +
  4972. + pos += IEEE80211_CCMP_HDR_LEN;
  4973. +- ccmp_special_blocks(skb, pn, b_0, aad);
  4974. ++ ccmp_special_blocks(skb, pn, b_0, aad, len);
  4975. + ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, b_0, aad, pos, len,
  4976. + skb_put(skb, mic_len), mic_len);
  4977. +
  4978. +@@ -534,7 +531,7 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  4979. + u8 aad[2 * AES_BLOCK_SIZE];
  4980. + u8 b_0[AES_BLOCK_SIZE];
  4981. + /* hardware didn't decrypt/verify MIC */
  4982. +- ccmp_special_blocks(skb, pn, b_0, aad);
  4983. ++ ccmp_special_blocks(skb, pn, b_0, aad, data_len);
  4984. +
  4985. + if (ieee80211_aes_ccm_decrypt(
  4986. + key->u.ccmp.tfm, b_0, aad,
  4987. diff --git a/package/kernel/mac80211/patches/100-revert-cryptoapi-ports.patch b/package/kernel/mac80211/patches/100-revert-cryptoapi-ports.patch
  4988. deleted file mode 100644
  4989. index ceca952..0000000
  4990. --- a/package/kernel/mac80211/patches/100-revert-cryptoapi-ports.patch
  4991. +++ /dev/null
  4992. @@ -1,2055 +0,0 @@
  4993. -This patch reverts the following commits from wireless-testing:
  4994. -
  4995. -8ade538bf39b1ee53418528fdacd36b8e65621b9
  4996. -56c52da2d554f081e8fce58ecbcf6a40c605b95b
  4997. -2b2ba0db1c820d04d5143452d70012cd44d7b578
  4998. -00b9cfa3ff38401bd70c34b250ca13e5ea347b4a
  4999. -4f031fa9f188b2b0641ac20087d9e16bcfb4e49d
  5000. -6e1ee5d2e9e411892b5d84e3ea93e3fc88ac786c
  5001. -30ef7ef9672d92ab2cac37f60a31955c118321e7
  5002. -f359d3fe832e49eeec2232b2af5a9e3aee6b4862 (only the changes in aes_cmac.{c,h})
  5003. -7ec7c4a9a686c608315739ab6a2b0527a240883c
  5004. ----
  5005. -
  5006. ---- a/include/linux/ieee80211.h
  5007. -+++ b/include/linux/ieee80211.h
  5008. -@@ -1017,15 +1017,6 @@ struct ieee80211_mmie {
  5009. - u8 mic[8];
  5010. - } __packed;
  5011. -
  5012. --/* Management MIC information element (IEEE 802.11w) for GMAC and CMAC-256 */
  5013. --struct ieee80211_mmie_16 {
  5014. -- u8 element_id;
  5015. -- u8 length;
  5016. -- __le16 key_id;
  5017. -- u8 sequence_number[6];
  5018. -- u8 mic[16];
  5019. --} __packed;
  5020. --
  5021. - struct ieee80211_vendor_ie {
  5022. - u8 element_id;
  5023. - u8 len;
  5024. ---- a/include/net/mac80211.h
  5025. -+++ b/include/net/mac80211.h
  5026. -@@ -1306,8 +1306,8 @@ struct ieee80211_vif *wdev_to_ieee80211_
  5027. - * @IEEE80211_KEY_FLAG_PAIRWISE: Set by mac80211, this flag indicates
  5028. - * that the key is pairwise rather then a shared key.
  5029. - * @IEEE80211_KEY_FLAG_SW_MGMT_TX: This flag should be set by the driver for a
  5030. -- * CCMP/GCMP key if it requires CCMP/GCMP encryption of management frames
  5031. -- * (MFP) to be done in software.
  5032. -+ * CCMP key if it requires CCMP encryption of management frames (MFP) to
  5033. -+ * be done in software.
  5034. - * @IEEE80211_KEY_FLAG_PUT_IV_SPACE: This flag should be set by the driver
  5035. - * if space should be prepared for the IV, but the IV
  5036. - * itself should not be generated. Do not set together with
  5037. -@@ -1322,7 +1322,7 @@ struct ieee80211_vif *wdev_to_ieee80211_
  5038. - * RX, if your crypto engine can't deal with TX you can also set the
  5039. - * %IEEE80211_KEY_FLAG_SW_MGMT_TX flag to encrypt such frames in SW.
  5040. - * @IEEE80211_KEY_FLAG_GENERATE_IV_MGMT: This flag should be set by the
  5041. -- * driver for a CCMP/GCMP key to indicate that is requires IV generation
  5042. -+ * driver for a CCMP key to indicate that is requires IV generation
  5043. - * only for managment frames (MFP).
  5044. - * @IEEE80211_KEY_FLAG_RESERVE_TAILROOM: This flag should be set by the
  5045. - * driver for a key to indicate that sufficient tailroom must always
  5046. -@@ -4112,10 +4112,6 @@ void ieee80211_aes_cmac_calculate_k1_k2(
  5047. - * reverse order than in packet)
  5048. - * @aes_cmac: PN data, most significant byte first (big endian,
  5049. - * reverse order than in packet)
  5050. -- * @aes_gmac: PN data, most significant byte first (big endian,
  5051. -- * reverse order than in packet)
  5052. -- * @gcmp: PN data, most significant byte first (big endian,
  5053. -- * reverse order than in packet)
  5054. - */
  5055. - struct ieee80211_key_seq {
  5056. - union {
  5057. -@@ -4129,12 +4125,6 @@ struct ieee80211_key_seq {
  5058. - struct {
  5059. - u8 pn[6];
  5060. - } aes_cmac;
  5061. -- struct {
  5062. -- u8 pn[6];
  5063. -- } aes_gmac;
  5064. -- struct {
  5065. -- u8 pn[6];
  5066. -- } gcmp;
  5067. - };
  5068. - };
  5069. -
  5070. -@@ -4159,7 +4149,7 @@ void ieee80211_get_key_tx_seq(struct iee
  5071. - * ieee80211_get_key_rx_seq - get key RX sequence counter
  5072. - *
  5073. - * @keyconf: the parameter passed with the set key
  5074. -- * @tid: The TID, or -1 for the management frame value (CCMP/GCMP only);
  5075. -+ * @tid: The TID, or -1 for the management frame value (CCMP only);
  5076. - * the value on TID 0 is also used for non-QoS frames. For
  5077. - * CMAC, only TID 0 is valid.
  5078. - * @seq: buffer to receive the sequence data
  5079. -@@ -4195,7 +4185,7 @@ void ieee80211_set_key_tx_seq(struct iee
  5080. - * ieee80211_set_key_rx_seq - set key RX sequence counter
  5081. - *
  5082. - * @keyconf: the parameter passed with the set key
  5083. -- * @tid: The TID, or -1 for the management frame value (CCMP/GCMP only);
  5084. -+ * @tid: The TID, or -1 for the management frame value (CCMP only);
  5085. - * the value on TID 0 is also used for non-QoS frames. For
  5086. - * CMAC, only TID 0 is valid.
  5087. - * @seq: new sequence data
  5088. ---- a/net/mac80211/Kconfig
  5089. -+++ b/net/mac80211/Kconfig
  5090. -@@ -5,8 +5,6 @@ config MAC80211
  5091. - depends on CRYPTO
  5092. - depends on CRYPTO_ARC4
  5093. - depends on CRYPTO_AES
  5094. -- select BPAUTO_CRYPTO_CCM
  5095. -- depends on CRYPTO_GCM
  5096. - depends on CRC32
  5097. - select BPAUTO_AVERAGE
  5098. - ---help---
  5099. ---- a/net/mac80211/Makefile
  5100. -+++ b/net/mac80211/Makefile
  5101. -@@ -15,9 +15,7 @@ mac80211-y := \
  5102. - michael.o \
  5103. - tkip.o \
  5104. - aes_ccm.o \
  5105. -- aes_gcm.o \
  5106. - aes_cmac.o \
  5107. -- aes_gmac.o \
  5108. - cfg.o \
  5109. - ethtool.o \
  5110. - rx.o \
  5111. ---- a/net/mac80211/aes_ccm.c
  5112. -+++ b/net/mac80211/aes_ccm.c
  5113. -@@ -2,8 +2,6 @@
  5114. - * Copyright 2003-2004, Instant802 Networks, Inc.
  5115. - * Copyright 2005-2006, Devicescape Software, Inc.
  5116. - *
  5117. -- * Rewrite: Copyright (C) 2013 Linaro Ltd <ard.biesheuvel@linaro.org>
  5118. -- *
  5119. - * This program is free software; you can redistribute it and/or modify
  5120. - * it under the terms of the GNU General Public License version 2 as
  5121. - * published by the Free Software Foundation.
  5122. -@@ -19,82 +17,134 @@
  5123. - #include "key.h"
  5124. - #include "aes_ccm.h"
  5125. -
  5126. --void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  5127. -- u8 *data, size_t data_len, u8 *mic,
  5128. -- size_t mic_len)
  5129. -+static void aes_ccm_prepare(struct crypto_cipher *tfm, u8 *scratch, u8 *a)
  5130. -+{
  5131. -+ int i;
  5132. -+ u8 *b_0, *aad, *b, *s_0;
  5133. -+
  5134. -+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
  5135. -+ aad = scratch + 4 * AES_BLOCK_SIZE;
  5136. -+ b = scratch;
  5137. -+ s_0 = scratch + AES_BLOCK_SIZE;
  5138. -+
  5139. -+ crypto_cipher_encrypt_one(tfm, b, b_0);
  5140. -+
  5141. -+ /* Extra Authenticate-only data (always two AES blocks) */
  5142. -+ for (i = 0; i < AES_BLOCK_SIZE; i++)
  5143. -+ aad[i] ^= b[i];
  5144. -+ crypto_cipher_encrypt_one(tfm, b, aad);
  5145. -+
  5146. -+ aad += AES_BLOCK_SIZE;
  5147. -+
  5148. -+ for (i = 0; i < AES_BLOCK_SIZE; i++)
  5149. -+ aad[i] ^= b[i];
  5150. -+ crypto_cipher_encrypt_one(tfm, a, aad);
  5151. -+
  5152. -+ /* Mask out bits from auth-only-b_0 */
  5153. -+ b_0[0] &= 0x07;
  5154. -+
  5155. -+ /* S_0 is used to encrypt T (= MIC) */
  5156. -+ b_0[14] = 0;
  5157. -+ b_0[15] = 0;
  5158. -+ crypto_cipher_encrypt_one(tfm, s_0, b_0);
  5159. -+}
  5160. -+
  5161. -+
  5162. -+void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch,
  5163. -+ u8 *data, size_t data_len,
  5164. -+ u8 *cdata, u8 *mic)
  5165. - {
  5166. -- struct scatterlist assoc, pt, ct[2];
  5167. -+ int i, j, last_len, num_blocks;
  5168. -+ u8 *pos, *cpos, *b, *s_0, *e, *b_0;
  5169. -
  5170. -- char aead_req_data[sizeof(struct aead_request) +
  5171. -- crypto_aead_reqsize(tfm)]
  5172. -- __aligned(__alignof__(struct aead_request));
  5173. -- struct aead_request *aead_req = (void *) aead_req_data;
  5174. --
  5175. -- memset(aead_req, 0, sizeof(aead_req_data));
  5176. --
  5177. -- sg_init_one(&pt, data, data_len);
  5178. -- sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad));
  5179. -- sg_init_table(ct, 2);
  5180. -- sg_set_buf(&ct[0], data, data_len);
  5181. -- sg_set_buf(&ct[1], mic, mic_len);
  5182. --
  5183. -- aead_request_set_tfm(aead_req, tfm);
  5184. -- aead_request_set_assoc(aead_req, &assoc, assoc.length);
  5185. -- aead_request_set_crypt(aead_req, &pt, ct, data_len, b_0);
  5186. -+ b = scratch;
  5187. -+ s_0 = scratch + AES_BLOCK_SIZE;
  5188. -+ e = scratch + 2 * AES_BLOCK_SIZE;
  5189. -+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
  5190. -+
  5191. -+ num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
  5192. -+ last_len = data_len % AES_BLOCK_SIZE;
  5193. -+ aes_ccm_prepare(tfm, scratch, b);
  5194. -+
  5195. -+ /* Process payload blocks */
  5196. -+ pos = data;
  5197. -+ cpos = cdata;
  5198. -+ for (j = 1; j <= num_blocks; j++) {
  5199. -+ int blen = (j == num_blocks && last_len) ?
  5200. -+ last_len : AES_BLOCK_SIZE;
  5201. -+
  5202. -+ /* Authentication followed by encryption */
  5203. -+ for (i = 0; i < blen; i++)
  5204. -+ b[i] ^= pos[i];
  5205. -+ crypto_cipher_encrypt_one(tfm, b, b);
  5206. -+
  5207. -+ b_0[14] = (j >> 8) & 0xff;
  5208. -+ b_0[15] = j & 0xff;
  5209. -+ crypto_cipher_encrypt_one(tfm, e, b_0);
  5210. -+ for (i = 0; i < blen; i++)
  5211. -+ *cpos++ = *pos++ ^ e[i];
  5212. -+ }
  5213. -
  5214. -- crypto_aead_encrypt(aead_req);
  5215. -+ for (i = 0; i < IEEE80211_CCMP_MIC_LEN; i++)
  5216. -+ mic[i] = b[i] ^ s_0[i];
  5217. - }
  5218. -
  5219. --int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  5220. -- u8 *data, size_t data_len, u8 *mic,
  5221. -- size_t mic_len)
  5222. -+
  5223. -+int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *scratch,
  5224. -+ u8 *cdata, size_t data_len, u8 *mic, u8 *data)
  5225. - {
  5226. -- struct scatterlist assoc, pt, ct[2];
  5227. -- char aead_req_data[sizeof(struct aead_request) +
  5228. -- crypto_aead_reqsize(tfm)]
  5229. -- __aligned(__alignof__(struct aead_request));
  5230. -- struct aead_request *aead_req = (void *) aead_req_data;
  5231. --
  5232. -- if (data_len == 0)
  5233. -- return -EINVAL;
  5234. --
  5235. -- memset(aead_req, 0, sizeof(aead_req_data));
  5236. --
  5237. -- sg_init_one(&pt, data, data_len);
  5238. -- sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad));
  5239. -- sg_init_table(ct, 2);
  5240. -- sg_set_buf(&ct[0], data, data_len);
  5241. -- sg_set_buf(&ct[1], mic, mic_len);
  5242. --
  5243. -- aead_request_set_tfm(aead_req, tfm);
  5244. -- aead_request_set_assoc(aead_req, &assoc, assoc.length);
  5245. -- aead_request_set_crypt(aead_req, ct, &pt, data_len + mic_len, b_0);
  5246. -+ int i, j, last_len, num_blocks;
  5247. -+ u8 *pos, *cpos, *b, *s_0, *a, *b_0;
  5248. -+
  5249. -+ b = scratch;
  5250. -+ s_0 = scratch + AES_BLOCK_SIZE;
  5251. -+ a = scratch + 2 * AES_BLOCK_SIZE;
  5252. -+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
  5253. -+
  5254. -+ num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
  5255. -+ last_len = data_len % AES_BLOCK_SIZE;
  5256. -+ aes_ccm_prepare(tfm, scratch, a);
  5257. -+
  5258. -+ /* Process payload blocks */
  5259. -+ cpos = cdata;
  5260. -+ pos = data;
  5261. -+ for (j = 1; j <= num_blocks; j++) {
  5262. -+ int blen = (j == num_blocks && last_len) ?
  5263. -+ last_len : AES_BLOCK_SIZE;
  5264. -+
  5265. -+ /* Decryption followed by authentication */
  5266. -+ b_0[14] = (j >> 8) & 0xff;
  5267. -+ b_0[15] = j & 0xff;
  5268. -+ crypto_cipher_encrypt_one(tfm, b, b_0);
  5269. -+ for (i = 0; i < blen; i++) {
  5270. -+ *pos = *cpos++ ^ b[i];
  5271. -+ a[i] ^= *pos++;
  5272. -+ }
  5273. -+ crypto_cipher_encrypt_one(tfm, a, a);
  5274. -+ }
  5275. -+
  5276. -+ for (i = 0; i < IEEE80211_CCMP_MIC_LEN; i++) {
  5277. -+ if ((mic[i] ^ s_0[i]) != a[i])
  5278. -+ return -1;
  5279. -+ }
  5280. -
  5281. -- return crypto_aead_decrypt(aead_req);
  5282. -+ return 0;
  5283. - }
  5284. -
  5285. --struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[],
  5286. -- size_t key_len,
  5287. -- size_t mic_len)
  5288. -+
  5289. -+struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[])
  5290. - {
  5291. -- struct crypto_aead *tfm;
  5292. -- int err;
  5293. -+ struct crypto_cipher *tfm;
  5294. -
  5295. -- tfm = crypto_alloc_aead("ccm(aes)", 0, CRYPTO_ALG_ASYNC);
  5296. -- if (IS_ERR(tfm))
  5297. -- return tfm;
  5298. --
  5299. -- err = crypto_aead_setkey(tfm, key, key_len);
  5300. -- if (!err)
  5301. -- err = crypto_aead_setauthsize(tfm, mic_len);
  5302. -- if (!err)
  5303. -- return tfm;
  5304. -+ tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
  5305. -+ if (!IS_ERR(tfm))
  5306. -+ crypto_cipher_setkey(tfm, key, WLAN_KEY_LEN_CCMP);
  5307. -
  5308. -- crypto_free_aead(tfm);
  5309. -- return ERR_PTR(err);
  5310. -+ return tfm;
  5311. - }
  5312. -
  5313. --void ieee80211_aes_key_free(struct crypto_aead *tfm)
  5314. -+
  5315. -+void ieee80211_aes_key_free(struct crypto_cipher *tfm)
  5316. - {
  5317. -- crypto_free_aead(tfm);
  5318. -+ crypto_free_cipher(tfm);
  5319. - }
  5320. ---- a/net/mac80211/aes_ccm.h
  5321. -+++ b/net/mac80211/aes_ccm.h
  5322. -@@ -12,15 +12,13 @@
  5323. -
  5324. - #include <linux/crypto.h>
  5325. -
  5326. --struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[],
  5327. -- size_t key_len,
  5328. -- size_t mic_len);
  5329. --void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  5330. -- u8 *data, size_t data_len, u8 *mic,
  5331. -- size_t mic_len);
  5332. --int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  5333. -- u8 *data, size_t data_len, u8 *mic,
  5334. -- size_t mic_len);
  5335. --void ieee80211_aes_key_free(struct crypto_aead *tfm);
  5336. -+struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[]);
  5337. -+void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch,
  5338. -+ u8 *data, size_t data_len,
  5339. -+ u8 *cdata, u8 *mic);
  5340. -+int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *scratch,
  5341. -+ u8 *cdata, size_t data_len,
  5342. -+ u8 *mic, u8 *data);
  5343. -+void ieee80211_aes_key_free(struct crypto_cipher *tfm);
  5344. -
  5345. - #endif /* AES_CCM_H */
  5346. ---- a/net/mac80211/aes_cmac.c
  5347. -+++ b/net/mac80211/aes_cmac.c
  5348. -@@ -18,8 +18,8 @@
  5349. - #include "key.h"
  5350. - #include "aes_cmac.h"
  5351. -
  5352. -+#define AES_CMAC_KEY_LEN 16
  5353. - #define CMAC_TLEN 8 /* CMAC TLen = 64 bits (8 octets) */
  5354. --#define CMAC_TLEN_256 16 /* CMAC TLen = 128 bits (16 octets) */
  5355. - #define AAD_LEN 20
  5356. -
  5357. -
  5358. -@@ -35,9 +35,9 @@ static void gf_mulx(u8 *pad)
  5359. - pad[AES_BLOCK_SIZE - 1] ^= 0x87;
  5360. - }
  5361. -
  5362. --static void aes_cmac_vector(struct crypto_cipher *tfm, size_t num_elem,
  5363. -- const u8 *addr[], const size_t *len, u8 *mac,
  5364. -- size_t mac_len)
  5365. -+
  5366. -+static void aes_128_cmac_vector(struct crypto_cipher *tfm, size_t num_elem,
  5367. -+ const u8 *addr[], const size_t *len, u8 *mac)
  5368. - {
  5369. - u8 cbc[AES_BLOCK_SIZE], pad[AES_BLOCK_SIZE];
  5370. - const u8 *pos, *end;
  5371. -@@ -88,7 +88,7 @@ static void aes_cmac_vector(struct crypt
  5372. - for (i = 0; i < AES_BLOCK_SIZE; i++)
  5373. - pad[i] ^= cbc[i];
  5374. - crypto_cipher_encrypt_one(tfm, pad, pad);
  5375. -- memcpy(mac, pad, mac_len);
  5376. -+ memcpy(mac, pad, CMAC_TLEN);
  5377. - }
  5378. -
  5379. -
  5380. -@@ -107,35 +107,17 @@ void ieee80211_aes_cmac(struct crypto_ci
  5381. - addr[2] = zero;
  5382. - len[2] = CMAC_TLEN;
  5383. -
  5384. -- aes_cmac_vector(tfm, 3, addr, len, mic, CMAC_TLEN);
  5385. -+ aes_128_cmac_vector(tfm, 3, addr, len, mic);
  5386. - }
  5387. -
  5388. --void ieee80211_aes_cmac_256(struct crypto_cipher *tfm, const u8 *aad,
  5389. -- const u8 *data, size_t data_len, u8 *mic)
  5390. --{
  5391. -- const u8 *addr[3];
  5392. -- size_t len[3];
  5393. -- u8 zero[CMAC_TLEN_256];
  5394. --
  5395. -- memset(zero, 0, CMAC_TLEN_256);
  5396. -- addr[0] = aad;
  5397. -- len[0] = AAD_LEN;
  5398. -- addr[1] = data;
  5399. -- len[1] = data_len - CMAC_TLEN_256;
  5400. -- addr[2] = zero;
  5401. -- len[2] = CMAC_TLEN_256;
  5402. --
  5403. -- aes_cmac_vector(tfm, 3, addr, len, mic, CMAC_TLEN_256);
  5404. --}
  5405. -
  5406. --struct crypto_cipher *ieee80211_aes_cmac_key_setup(const u8 key[],
  5407. -- size_t key_len)
  5408. -+struct crypto_cipher * ieee80211_aes_cmac_key_setup(const u8 key[])
  5409. - {
  5410. - struct crypto_cipher *tfm;
  5411. -
  5412. - tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
  5413. - if (!IS_ERR(tfm))
  5414. -- crypto_cipher_setkey(tfm, key, key_len);
  5415. -+ crypto_cipher_setkey(tfm, key, AES_CMAC_KEY_LEN);
  5416. -
  5417. - return tfm;
  5418. - }
  5419. ---- a/net/mac80211/aes_cmac.h
  5420. -+++ b/net/mac80211/aes_cmac.h
  5421. -@@ -11,12 +11,9 @@
  5422. -
  5423. - #include <linux/crypto.h>
  5424. -
  5425. --struct crypto_cipher *ieee80211_aes_cmac_key_setup(const u8 key[],
  5426. -- size_t key_len);
  5427. -+struct crypto_cipher * ieee80211_aes_cmac_key_setup(const u8 key[]);
  5428. - void ieee80211_aes_cmac(struct crypto_cipher *tfm, const u8 *aad,
  5429. - const u8 *data, size_t data_len, u8 *mic);
  5430. --void ieee80211_aes_cmac_256(struct crypto_cipher *tfm, const u8 *aad,
  5431. -- const u8 *data, size_t data_len, u8 *mic);
  5432. - void ieee80211_aes_cmac_key_free(struct crypto_cipher *tfm);
  5433. -
  5434. - #endif /* AES_CMAC_H */
  5435. ---- a/net/mac80211/aes_gcm.c
  5436. -+++ /dev/null
  5437. -@@ -1,95 +0,0 @@
  5438. --/*
  5439. -- * Copyright 2014-2015, Qualcomm Atheros, Inc.
  5440. -- *
  5441. -- * This program is free software; you can redistribute it and/or modify
  5442. -- * it under the terms of the GNU General Public License version 2 as
  5443. -- * published by the Free Software Foundation.
  5444. -- */
  5445. --
  5446. --#include <linux/kernel.h>
  5447. --#include <linux/types.h>
  5448. --#include <linux/crypto.h>
  5449. --#include <linux/err.h>
  5450. --#include <crypto/aes.h>
  5451. --
  5452. --#include <net/mac80211.h>
  5453. --#include "key.h"
  5454. --#include "aes_gcm.h"
  5455. --
  5456. --void ieee80211_aes_gcm_encrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  5457. -- u8 *data, size_t data_len, u8 *mic)
  5458. --{
  5459. -- struct scatterlist assoc, pt, ct[2];
  5460. --
  5461. -- char aead_req_data[sizeof(struct aead_request) +
  5462. -- crypto_aead_reqsize(tfm)]
  5463. -- __aligned(__alignof__(struct aead_request));
  5464. -- struct aead_request *aead_req = (void *)aead_req_data;
  5465. --
  5466. -- memset(aead_req, 0, sizeof(aead_req_data));
  5467. --
  5468. -- sg_init_one(&pt, data, data_len);
  5469. -- sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad));
  5470. -- sg_init_table(ct, 2);
  5471. -- sg_set_buf(&ct[0], data, data_len);
  5472. -- sg_set_buf(&ct[1], mic, IEEE80211_GCMP_MIC_LEN);
  5473. --
  5474. -- aead_request_set_tfm(aead_req, tfm);
  5475. -- aead_request_set_assoc(aead_req, &assoc, assoc.length);
  5476. -- aead_request_set_crypt(aead_req, &pt, ct, data_len, j_0);
  5477. --
  5478. -- crypto_aead_encrypt(aead_req);
  5479. --}
  5480. --
  5481. --int ieee80211_aes_gcm_decrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  5482. -- u8 *data, size_t data_len, u8 *mic)
  5483. --{
  5484. -- struct scatterlist assoc, pt, ct[2];
  5485. -- char aead_req_data[sizeof(struct aead_request) +
  5486. -- crypto_aead_reqsize(tfm)]
  5487. -- __aligned(__alignof__(struct aead_request));
  5488. -- struct aead_request *aead_req = (void *)aead_req_data;
  5489. --
  5490. -- if (data_len == 0)
  5491. -- return -EINVAL;
  5492. --
  5493. -- memset(aead_req, 0, sizeof(aead_req_data));
  5494. --
  5495. -- sg_init_one(&pt, data, data_len);
  5496. -- sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad));
  5497. -- sg_init_table(ct, 2);
  5498. -- sg_set_buf(&ct[0], data, data_len);
  5499. -- sg_set_buf(&ct[1], mic, IEEE80211_GCMP_MIC_LEN);
  5500. --
  5501. -- aead_request_set_tfm(aead_req, tfm);
  5502. -- aead_request_set_assoc(aead_req, &assoc, assoc.length);
  5503. -- aead_request_set_crypt(aead_req, ct, &pt,
  5504. -- data_len + IEEE80211_GCMP_MIC_LEN, j_0);
  5505. --
  5506. -- return crypto_aead_decrypt(aead_req);
  5507. --}
  5508. --
  5509. --struct crypto_aead *ieee80211_aes_gcm_key_setup_encrypt(const u8 key[],
  5510. -- size_t key_len)
  5511. --{
  5512. -- struct crypto_aead *tfm;
  5513. -- int err;
  5514. --
  5515. -- tfm = crypto_alloc_aead("gcm(aes)", 0, CRYPTO_ALG_ASYNC);
  5516. -- if (IS_ERR(tfm))
  5517. -- return tfm;
  5518. --
  5519. -- err = crypto_aead_setkey(tfm, key, key_len);
  5520. -- if (!err)
  5521. -- err = crypto_aead_setauthsize(tfm, IEEE80211_GCMP_MIC_LEN);
  5522. -- if (!err)
  5523. -- return tfm;
  5524. --
  5525. -- crypto_free_aead(tfm);
  5526. -- return ERR_PTR(err);
  5527. --}
  5528. --
  5529. --void ieee80211_aes_gcm_key_free(struct crypto_aead *tfm)
  5530. --{
  5531. -- crypto_free_aead(tfm);
  5532. --}
  5533. ---- a/net/mac80211/aes_gcm.h
  5534. -+++ /dev/null
  5535. -@@ -1,22 +0,0 @@
  5536. --/*
  5537. -- * Copyright 2014-2015, Qualcomm Atheros, Inc.
  5538. -- *
  5539. -- * This program is free software; you can redistribute it and/or modify
  5540. -- * it under the terms of the GNU General Public License version 2 as
  5541. -- * published by the Free Software Foundation.
  5542. -- */
  5543. --
  5544. --#ifndef AES_GCM_H
  5545. --#define AES_GCM_H
  5546. --
  5547. --#include <linux/crypto.h>
  5548. --
  5549. --void ieee80211_aes_gcm_encrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  5550. -- u8 *data, size_t data_len, u8 *mic);
  5551. --int ieee80211_aes_gcm_decrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  5552. -- u8 *data, size_t data_len, u8 *mic);
  5553. --struct crypto_aead *ieee80211_aes_gcm_key_setup_encrypt(const u8 key[],
  5554. -- size_t key_len);
  5555. --void ieee80211_aes_gcm_key_free(struct crypto_aead *tfm);
  5556. --
  5557. --#endif /* AES_GCM_H */
  5558. ---- a/net/mac80211/aes_gmac.c
  5559. -+++ /dev/null
  5560. -@@ -1,84 +0,0 @@
  5561. --/*
  5562. -- * AES-GMAC for IEEE 802.11 BIP-GMAC-128 and BIP-GMAC-256
  5563. -- * Copyright 2015, Qualcomm Atheros, Inc.
  5564. -- *
  5565. -- * This program is free software; you can redistribute it and/or modify
  5566. -- * it under the terms of the GNU General Public License version 2 as
  5567. -- * published by the Free Software Foundation.
  5568. -- */
  5569. --
  5570. --#include <linux/kernel.h>
  5571. --#include <linux/types.h>
  5572. --#include <linux/crypto.h>
  5573. --#include <linux/err.h>
  5574. --#include <crypto/aes.h>
  5575. --
  5576. --#include <net/mac80211.h>
  5577. --#include "key.h"
  5578. --#include "aes_gmac.h"
  5579. --
  5580. --#define GMAC_MIC_LEN 16
  5581. --#define GMAC_NONCE_LEN 12
  5582. --#define AAD_LEN 20
  5583. --
  5584. --int ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce,
  5585. -- const u8 *data, size_t data_len, u8 *mic)
  5586. --{
  5587. -- struct scatterlist sg[3], ct[1];
  5588. -- char aead_req_data[sizeof(struct aead_request) +
  5589. -- crypto_aead_reqsize(tfm)]
  5590. -- __aligned(__alignof__(struct aead_request));
  5591. -- struct aead_request *aead_req = (void *)aead_req_data;
  5592. -- u8 zero[GMAC_MIC_LEN], iv[AES_BLOCK_SIZE];
  5593. --
  5594. -- if (data_len < GMAC_MIC_LEN)
  5595. -- return -EINVAL;
  5596. --
  5597. -- memset(aead_req, 0, sizeof(aead_req_data));
  5598. --
  5599. -- memset(zero, 0, GMAC_MIC_LEN);
  5600. -- sg_init_table(sg, 3);
  5601. -- sg_set_buf(&sg[0], aad, AAD_LEN);
  5602. -- sg_set_buf(&sg[1], data, data_len - GMAC_MIC_LEN);
  5603. -- sg_set_buf(&sg[2], zero, GMAC_MIC_LEN);
  5604. --
  5605. -- memcpy(iv, nonce, GMAC_NONCE_LEN);
  5606. -- memset(iv + GMAC_NONCE_LEN, 0, sizeof(iv) - GMAC_NONCE_LEN);
  5607. -- iv[AES_BLOCK_SIZE - 1] = 0x01;
  5608. --
  5609. -- sg_init_table(ct, 1);
  5610. -- sg_set_buf(&ct[0], mic, GMAC_MIC_LEN);
  5611. --
  5612. -- aead_request_set_tfm(aead_req, tfm);
  5613. -- aead_request_set_assoc(aead_req, sg, AAD_LEN + data_len);
  5614. -- aead_request_set_crypt(aead_req, NULL, ct, 0, iv);
  5615. --
  5616. -- crypto_aead_encrypt(aead_req);
  5617. --
  5618. -- return 0;
  5619. --}
  5620. --
  5621. --struct crypto_aead *ieee80211_aes_gmac_key_setup(const u8 key[],
  5622. -- size_t key_len)
  5623. --{
  5624. -- struct crypto_aead *tfm;
  5625. -- int err;
  5626. --
  5627. -- tfm = crypto_alloc_aead("gcm(aes)", 0, CRYPTO_ALG_ASYNC);
  5628. -- if (IS_ERR(tfm))
  5629. -- return tfm;
  5630. --
  5631. -- err = crypto_aead_setkey(tfm, key, key_len);
  5632. -- if (!err)
  5633. -- return tfm;
  5634. -- if (!err)
  5635. -- err = crypto_aead_setauthsize(tfm, GMAC_MIC_LEN);
  5636. --
  5637. -- crypto_free_aead(tfm);
  5638. -- return ERR_PTR(err);
  5639. --}
  5640. --
  5641. --void ieee80211_aes_gmac_key_free(struct crypto_aead *tfm)
  5642. --{
  5643. -- crypto_free_aead(tfm);
  5644. --}
  5645. ---- a/net/mac80211/aes_gmac.h
  5646. -+++ /dev/null
  5647. -@@ -1,20 +0,0 @@
  5648. --/*
  5649. -- * Copyright 2015, Qualcomm Atheros, Inc.
  5650. -- *
  5651. -- * This program is free software; you can redistribute it and/or modify
  5652. -- * it under the terms of the GNU General Public License version 2 as
  5653. -- * published by the Free Software Foundation.
  5654. -- */
  5655. --
  5656. --#ifndef AES_GMAC_H
  5657. --#define AES_GMAC_H
  5658. --
  5659. --#include <linux/crypto.h>
  5660. --
  5661. --struct crypto_aead *ieee80211_aes_gmac_key_setup(const u8 key[],
  5662. -- size_t key_len);
  5663. --int ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce,
  5664. -- const u8 *data, size_t data_len, u8 *mic);
  5665. --void ieee80211_aes_gmac_key_free(struct crypto_aead *tfm);
  5666. --
  5667. --#endif /* AES_GMAC_H */
  5668. ---- a/net/mac80211/cfg.c
  5669. -+++ b/net/mac80211/cfg.c
  5670. -@@ -162,13 +162,8 @@ static int ieee80211_add_key(struct wiph
  5671. - return -EINVAL;
  5672. - break;
  5673. - case WLAN_CIPHER_SUITE_CCMP:
  5674. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5675. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5676. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5677. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5678. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5679. - case WLAN_CIPHER_SUITE_GCMP:
  5680. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5681. - break;
  5682. - default:
  5683. - cs = ieee80211_cs_get(local, params->cipher, sdata->vif.type);
  5684. -@@ -353,7 +348,6 @@ static int ieee80211_get_key(struct wiph
  5685. - params.seq_len = 6;
  5686. - break;
  5687. - case WLAN_CIPHER_SUITE_CCMP:
  5688. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5689. - pn64 = atomic64_read(&key->u.ccmp.tx_pn);
  5690. - seq[0] = pn64;
  5691. - seq[1] = pn64 >> 8;
  5692. -@@ -365,35 +359,10 @@ static int ieee80211_get_key(struct wiph
  5693. - params.seq_len = 6;
  5694. - break;
  5695. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5696. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5697. - pn64 = atomic64_read(&key->u.aes_cmac.tx_pn);
  5698. - seq[0] = pn64;
  5699. - seq[1] = pn64 >> 8;
  5700. - seq[2] = pn64 >> 16;
  5701. -- seq[3] = pn64 >> 24;
  5702. -- seq[4] = pn64 >> 32;
  5703. -- seq[5] = pn64 >> 40;
  5704. -- params.seq = seq;
  5705. -- params.seq_len = 6;
  5706. -- break;
  5707. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5708. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5709. -- pn64 = atomic64_read(&key->u.aes_gmac.tx_pn);
  5710. -- seq[0] = pn64;
  5711. -- seq[1] = pn64 >> 8;
  5712. -- seq[2] = pn64 >> 16;
  5713. -- seq[3] = pn64 >> 24;
  5714. -- seq[4] = pn64 >> 32;
  5715. -- seq[5] = pn64 >> 40;
  5716. -- params.seq = seq;
  5717. -- params.seq_len = 6;
  5718. -- break;
  5719. -- case WLAN_CIPHER_SUITE_GCMP:
  5720. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5721. -- pn64 = atomic64_read(&key->u.gcmp.tx_pn);
  5722. -- seq[0] = pn64;
  5723. -- seq[1] = pn64 >> 8;
  5724. -- seq[2] = pn64 >> 16;
  5725. - seq[3] = pn64 >> 24;
  5726. - seq[4] = pn64 >> 32;
  5727. - seq[5] = pn64 >> 40;
  5728. ---- a/net/mac80211/debugfs_key.c
  5729. -+++ b/net/mac80211/debugfs_key.c
  5730. -@@ -94,33 +94,17 @@ static ssize_t key_tx_spec_read(struct f
  5731. - key->u.tkip.tx.iv16);
  5732. - break;
  5733. - case WLAN_CIPHER_SUITE_CCMP:
  5734. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5735. - pn = atomic64_read(&key->u.ccmp.tx_pn);
  5736. - len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n",
  5737. - (u8)(pn >> 40), (u8)(pn >> 32), (u8)(pn >> 24),
  5738. - (u8)(pn >> 16), (u8)(pn >> 8), (u8)pn);
  5739. - break;
  5740. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5741. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5742. - pn = atomic64_read(&key->u.aes_cmac.tx_pn);
  5743. - len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n",
  5744. - (u8)(pn >> 40), (u8)(pn >> 32), (u8)(pn >> 24),
  5745. - (u8)(pn >> 16), (u8)(pn >> 8), (u8)pn);
  5746. - break;
  5747. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5748. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5749. -- pn = atomic64_read(&key->u.aes_gmac.tx_pn);
  5750. -- len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n",
  5751. -- (u8)(pn >> 40), (u8)(pn >> 32), (u8)(pn >> 24),
  5752. -- (u8)(pn >> 16), (u8)(pn >> 8), (u8)pn);
  5753. -- break;
  5754. -- case WLAN_CIPHER_SUITE_GCMP:
  5755. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5756. -- pn = atomic64_read(&key->u.gcmp.tx_pn);
  5757. -- len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n",
  5758. -- (u8)(pn >> 40), (u8)(pn >> 32), (u8)(pn >> 24),
  5759. -- (u8)(pn >> 16), (u8)(pn >> 8), (u8)pn);
  5760. -- break;
  5761. - default:
  5762. - return 0;
  5763. - }
  5764. -@@ -150,7 +134,6 @@ static ssize_t key_rx_spec_read(struct f
  5765. - len = p - buf;
  5766. - break;
  5767. - case WLAN_CIPHER_SUITE_CCMP:
  5768. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5769. - for (i = 0; i < IEEE80211_NUM_TIDS + 1; i++) {
  5770. - rpn = key->u.ccmp.rx_pn[i];
  5771. - p += scnprintf(p, sizeof(buf)+buf-p,
  5772. -@@ -161,7 +144,6 @@ static ssize_t key_rx_spec_read(struct f
  5773. - len = p - buf;
  5774. - break;
  5775. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5776. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5777. - rpn = key->u.aes_cmac.rx_pn;
  5778. - p += scnprintf(p, sizeof(buf)+buf-p,
  5779. - "%02x%02x%02x%02x%02x%02x\n",
  5780. -@@ -169,26 +151,6 @@ static ssize_t key_rx_spec_read(struct f
  5781. - rpn[3], rpn[4], rpn[5]);
  5782. - len = p - buf;
  5783. - break;
  5784. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5785. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5786. -- rpn = key->u.aes_gmac.rx_pn;
  5787. -- p += scnprintf(p, sizeof(buf)+buf-p,
  5788. -- "%02x%02x%02x%02x%02x%02x\n",
  5789. -- rpn[0], rpn[1], rpn[2],
  5790. -- rpn[3], rpn[4], rpn[5]);
  5791. -- len = p - buf;
  5792. -- break;
  5793. -- case WLAN_CIPHER_SUITE_GCMP:
  5794. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5795. -- for (i = 0; i < IEEE80211_NUM_TIDS + 1; i++) {
  5796. -- rpn = key->u.gcmp.rx_pn[i];
  5797. -- p += scnprintf(p, sizeof(buf)+buf-p,
  5798. -- "%02x%02x%02x%02x%02x%02x\n",
  5799. -- rpn[0], rpn[1], rpn[2],
  5800. -- rpn[3], rpn[4], rpn[5]);
  5801. -- }
  5802. -- len = p - buf;
  5803. -- break;
  5804. - default:
  5805. - return 0;
  5806. - }
  5807. -@@ -205,23 +167,12 @@ static ssize_t key_replays_read(struct f
  5808. -
  5809. - switch (key->conf.cipher) {
  5810. - case WLAN_CIPHER_SUITE_CCMP:
  5811. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5812. - len = scnprintf(buf, sizeof(buf), "%u\n", key->u.ccmp.replays);
  5813. - break;
  5814. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5815. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5816. - len = scnprintf(buf, sizeof(buf), "%u\n",
  5817. - key->u.aes_cmac.replays);
  5818. - break;
  5819. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5820. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5821. -- len = scnprintf(buf, sizeof(buf), "%u\n",
  5822. -- key->u.aes_gmac.replays);
  5823. -- break;
  5824. -- case WLAN_CIPHER_SUITE_GCMP:
  5825. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5826. -- len = scnprintf(buf, sizeof(buf), "%u\n", key->u.gcmp.replays);
  5827. -- break;
  5828. - default:
  5829. - return 0;
  5830. - }
  5831. -@@ -238,15 +189,9 @@ static ssize_t key_icverrors_read(struct
  5832. -
  5833. - switch (key->conf.cipher) {
  5834. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5835. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5836. - len = scnprintf(buf, sizeof(buf), "%u\n",
  5837. - key->u.aes_cmac.icverrors);
  5838. - break;
  5839. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5840. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5841. -- len = scnprintf(buf, sizeof(buf), "%u\n",
  5842. -- key->u.aes_gmac.icverrors);
  5843. -- break;
  5844. - default:
  5845. - return 0;
  5846. - }
  5847. ---- a/net/mac80211/key.c
  5848. -+++ b/net/mac80211/key.c
  5849. -@@ -24,8 +24,6 @@
  5850. - #include "debugfs_key.h"
  5851. - #include "aes_ccm.h"
  5852. - #include "aes_cmac.h"
  5853. --#include "aes_gmac.h"
  5854. --#include "aes_gcm.h"
  5855. -
  5856. -
  5857. - /**
  5858. -@@ -164,13 +162,7 @@ static int ieee80211_key_enable_hw_accel
  5859. - case WLAN_CIPHER_SUITE_WEP104:
  5860. - case WLAN_CIPHER_SUITE_TKIP:
  5861. - case WLAN_CIPHER_SUITE_CCMP:
  5862. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5863. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5864. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5865. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5866. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5867. -- case WLAN_CIPHER_SUITE_GCMP:
  5868. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5869. - /* all of these we can do in software - if driver can */
  5870. - if (ret == 1)
  5871. - return 0;
  5872. -@@ -394,26 +386,7 @@ ieee80211_key_alloc(u32 cipher, int idx,
  5873. - * Initialize AES key state here as an optimization so that
  5874. - * it does not need to be initialized for every packet.
  5875. - */
  5876. -- key->u.ccmp.tfm = ieee80211_aes_key_setup_encrypt(
  5877. -- key_data, key_len, IEEE80211_CCMP_MIC_LEN);
  5878. -- if (IS_ERR(key->u.ccmp.tfm)) {
  5879. -- err = PTR_ERR(key->u.ccmp.tfm);
  5880. -- kfree(key);
  5881. -- return ERR_PTR(err);
  5882. -- }
  5883. -- break;
  5884. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5885. -- key->conf.iv_len = IEEE80211_CCMP_256_HDR_LEN;
  5886. -- key->conf.icv_len = IEEE80211_CCMP_256_MIC_LEN;
  5887. -- for (i = 0; seq && i < IEEE80211_NUM_TIDS + 1; i++)
  5888. -- for (j = 0; j < IEEE80211_CCMP_256_PN_LEN; j++)
  5889. -- key->u.ccmp.rx_pn[i][j] =
  5890. -- seq[IEEE80211_CCMP_256_PN_LEN - j - 1];
  5891. -- /* Initialize AES key state here as an optimization so that
  5892. -- * it does not need to be initialized for every packet.
  5893. -- */
  5894. -- key->u.ccmp.tfm = ieee80211_aes_key_setup_encrypt(
  5895. -- key_data, key_len, IEEE80211_CCMP_256_MIC_LEN);
  5896. -+ key->u.ccmp.tfm = ieee80211_aes_key_setup_encrypt(key_data);
  5897. - if (IS_ERR(key->u.ccmp.tfm)) {
  5898. - err = PTR_ERR(key->u.ccmp.tfm);
  5899. - kfree(key);
  5900. -@@ -421,12 +394,8 @@ ieee80211_key_alloc(u32 cipher, int idx,
  5901. - }
  5902. - break;
  5903. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5904. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5905. - key->conf.iv_len = 0;
  5906. -- if (cipher == WLAN_CIPHER_SUITE_AES_CMAC)
  5907. -- key->conf.icv_len = sizeof(struct ieee80211_mmie);
  5908. -- else
  5909. -- key->conf.icv_len = sizeof(struct ieee80211_mmie_16);
  5910. -+ key->conf.icv_len = sizeof(struct ieee80211_mmie);
  5911. - if (seq)
  5912. - for (j = 0; j < IEEE80211_CMAC_PN_LEN; j++)
  5913. - key->u.aes_cmac.rx_pn[j] =
  5914. -@@ -436,51 +405,13 @@ ieee80211_key_alloc(u32 cipher, int idx,
  5915. - * it does not need to be initialized for every packet.
  5916. - */
  5917. - key->u.aes_cmac.tfm =
  5918. -- ieee80211_aes_cmac_key_setup(key_data, key_len);
  5919. -+ ieee80211_aes_cmac_key_setup(key_data);
  5920. - if (IS_ERR(key->u.aes_cmac.tfm)) {
  5921. - err = PTR_ERR(key->u.aes_cmac.tfm);
  5922. - kfree(key);
  5923. - return ERR_PTR(err);
  5924. - }
  5925. - break;
  5926. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5927. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5928. -- key->conf.iv_len = 0;
  5929. -- key->conf.icv_len = sizeof(struct ieee80211_mmie_16);
  5930. -- if (seq)
  5931. -- for (j = 0; j < IEEE80211_GMAC_PN_LEN; j++)
  5932. -- key->u.aes_gmac.rx_pn[j] =
  5933. -- seq[IEEE80211_GMAC_PN_LEN - j - 1];
  5934. -- /* Initialize AES key state here as an optimization so that
  5935. -- * it does not need to be initialized for every packet.
  5936. -- */
  5937. -- key->u.aes_gmac.tfm =
  5938. -- ieee80211_aes_gmac_key_setup(key_data, key_len);
  5939. -- if (IS_ERR(key->u.aes_gmac.tfm)) {
  5940. -- err = PTR_ERR(key->u.aes_gmac.tfm);
  5941. -- kfree(key);
  5942. -- return ERR_PTR(err);
  5943. -- }
  5944. -- break;
  5945. -- case WLAN_CIPHER_SUITE_GCMP:
  5946. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5947. -- key->conf.iv_len = IEEE80211_GCMP_HDR_LEN;
  5948. -- key->conf.icv_len = IEEE80211_GCMP_MIC_LEN;
  5949. -- for (i = 0; seq && i < IEEE80211_NUM_TIDS + 1; i++)
  5950. -- for (j = 0; j < IEEE80211_GCMP_PN_LEN; j++)
  5951. -- key->u.gcmp.rx_pn[i][j] =
  5952. -- seq[IEEE80211_GCMP_PN_LEN - j - 1];
  5953. -- /* Initialize AES key state here as an optimization so that
  5954. -- * it does not need to be initialized for every packet.
  5955. -- */
  5956. -- key->u.gcmp.tfm = ieee80211_aes_gcm_key_setup_encrypt(key_data,
  5957. -- key_len);
  5958. -- if (IS_ERR(key->u.gcmp.tfm)) {
  5959. -- err = PTR_ERR(key->u.gcmp.tfm);
  5960. -- kfree(key);
  5961. -- return ERR_PTR(err);
  5962. -- }
  5963. -- break;
  5964. - default:
  5965. - if (cs) {
  5966. - size_t len = (seq_len > MAX_PN_LEN) ?
  5967. -@@ -502,24 +433,10 @@ ieee80211_key_alloc(u32 cipher, int idx,
  5968. -
  5969. - static void ieee80211_key_free_common(struct ieee80211_key *key)
  5970. - {
  5971. -- switch (key->conf.cipher) {
  5972. -- case WLAN_CIPHER_SUITE_CCMP:
  5973. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5974. -+ if (key->conf.cipher == WLAN_CIPHER_SUITE_CCMP)
  5975. - ieee80211_aes_key_free(key->u.ccmp.tfm);
  5976. -- break;
  5977. -- case WLAN_CIPHER_SUITE_AES_CMAC:
  5978. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5979. -+ if (key->conf.cipher == WLAN_CIPHER_SUITE_AES_CMAC)
  5980. - ieee80211_aes_cmac_key_free(key->u.aes_cmac.tfm);
  5981. -- break;
  5982. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5983. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5984. -- ieee80211_aes_gmac_key_free(key->u.aes_gmac.tfm);
  5985. -- break;
  5986. -- case WLAN_CIPHER_SUITE_GCMP:
  5987. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5988. -- ieee80211_aes_gcm_key_free(key->u.gcmp.tfm);
  5989. -- break;
  5990. -- }
  5991. - kzfree(key);
  5992. - }
  5993. -
  5994. -@@ -826,7 +743,6 @@ void ieee80211_get_key_tx_seq(struct iee
  5995. - seq->tkip.iv16 = key->u.tkip.tx.iv16;
  5996. - break;
  5997. - case WLAN_CIPHER_SUITE_CCMP:
  5998. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5999. - pn64 = atomic64_read(&key->u.ccmp.tx_pn);
  6000. - seq->ccmp.pn[5] = pn64;
  6001. - seq->ccmp.pn[4] = pn64 >> 8;
  6002. -@@ -836,7 +752,6 @@ void ieee80211_get_key_tx_seq(struct iee
  6003. - seq->ccmp.pn[0] = pn64 >> 40;
  6004. - break;
  6005. - case WLAN_CIPHER_SUITE_AES_CMAC:
  6006. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  6007. - pn64 = atomic64_read(&key->u.aes_cmac.tx_pn);
  6008. - seq->ccmp.pn[5] = pn64;
  6009. - seq->ccmp.pn[4] = pn64 >> 8;
  6010. -@@ -845,26 +760,6 @@ void ieee80211_get_key_tx_seq(struct iee
  6011. - seq->ccmp.pn[1] = pn64 >> 32;
  6012. - seq->ccmp.pn[0] = pn64 >> 40;
  6013. - break;
  6014. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  6015. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  6016. -- pn64 = atomic64_read(&key->u.aes_gmac.tx_pn);
  6017. -- seq->ccmp.pn[5] = pn64;
  6018. -- seq->ccmp.pn[4] = pn64 >> 8;
  6019. -- seq->ccmp.pn[3] = pn64 >> 16;
  6020. -- seq->ccmp.pn[2] = pn64 >> 24;
  6021. -- seq->ccmp.pn[1] = pn64 >> 32;
  6022. -- seq->ccmp.pn[0] = pn64 >> 40;
  6023. -- break;
  6024. -- case WLAN_CIPHER_SUITE_GCMP:
  6025. -- case WLAN_CIPHER_SUITE_GCMP_256:
  6026. -- pn64 = atomic64_read(&key->u.gcmp.tx_pn);
  6027. -- seq->gcmp.pn[5] = pn64;
  6028. -- seq->gcmp.pn[4] = pn64 >> 8;
  6029. -- seq->gcmp.pn[3] = pn64 >> 16;
  6030. -- seq->gcmp.pn[2] = pn64 >> 24;
  6031. -- seq->gcmp.pn[1] = pn64 >> 32;
  6032. -- seq->gcmp.pn[0] = pn64 >> 40;
  6033. -- break;
  6034. - default:
  6035. - WARN_ON(1);
  6036. - }
  6037. -@@ -887,7 +782,6 @@ void ieee80211_get_key_rx_seq(struct iee
  6038. - seq->tkip.iv16 = key->u.tkip.rx[tid].iv16;
  6039. - break;
  6040. - case WLAN_CIPHER_SUITE_CCMP:
  6041. -- case WLAN_CIPHER_SUITE_CCMP_256:
  6042. - if (WARN_ON(tid < -1 || tid >= IEEE80211_NUM_TIDS))
  6043. - return;
  6044. - if (tid < 0)
  6045. -@@ -897,29 +791,11 @@ void ieee80211_get_key_rx_seq(struct iee
  6046. - memcpy(seq->ccmp.pn, pn, IEEE80211_CCMP_PN_LEN);
  6047. - break;
  6048. - case WLAN_CIPHER_SUITE_AES_CMAC:
  6049. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  6050. - if (WARN_ON(tid != 0))
  6051. - return;
  6052. - pn = key->u.aes_cmac.rx_pn;
  6053. - memcpy(seq->aes_cmac.pn, pn, IEEE80211_CMAC_PN_LEN);
  6054. - break;
  6055. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  6056. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  6057. -- if (WARN_ON(tid != 0))
  6058. -- return;
  6059. -- pn = key->u.aes_gmac.rx_pn;
  6060. -- memcpy(seq->aes_gmac.pn, pn, IEEE80211_GMAC_PN_LEN);
  6061. -- break;
  6062. -- case WLAN_CIPHER_SUITE_GCMP:
  6063. -- case WLAN_CIPHER_SUITE_GCMP_256:
  6064. -- if (WARN_ON(tid < -1 || tid >= IEEE80211_NUM_TIDS))
  6065. -- return;
  6066. -- if (tid < 0)
  6067. -- pn = key->u.gcmp.rx_pn[IEEE80211_NUM_TIDS];
  6068. -- else
  6069. -- pn = key->u.gcmp.rx_pn[tid];
  6070. -- memcpy(seq->gcmp.pn, pn, IEEE80211_GCMP_PN_LEN);
  6071. -- break;
  6072. - }
  6073. - }
  6074. - EXPORT_SYMBOL(ieee80211_get_key_rx_seq);
  6075. -@@ -938,7 +814,6 @@ void ieee80211_set_key_tx_seq(struct iee
  6076. - key->u.tkip.tx.iv16 = seq->tkip.iv16;
  6077. - break;
  6078. - case WLAN_CIPHER_SUITE_CCMP:
  6079. -- case WLAN_CIPHER_SUITE_CCMP_256:
  6080. - pn64 = (u64)seq->ccmp.pn[5] |
  6081. - ((u64)seq->ccmp.pn[4] << 8) |
  6082. - ((u64)seq->ccmp.pn[3] << 16) |
  6083. -@@ -948,7 +823,6 @@ void ieee80211_set_key_tx_seq(struct iee
  6084. - atomic64_set(&key->u.ccmp.tx_pn, pn64);
  6085. - break;
  6086. - case WLAN_CIPHER_SUITE_AES_CMAC:
  6087. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  6088. - pn64 = (u64)seq->aes_cmac.pn[5] |
  6089. - ((u64)seq->aes_cmac.pn[4] << 8) |
  6090. - ((u64)seq->aes_cmac.pn[3] << 16) |
  6091. -@@ -957,26 +831,6 @@ void ieee80211_set_key_tx_seq(struct iee
  6092. - ((u64)seq->aes_cmac.pn[0] << 40);
  6093. - atomic64_set(&key->u.aes_cmac.tx_pn, pn64);
  6094. - break;
  6095. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  6096. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  6097. -- pn64 = (u64)seq->aes_gmac.pn[5] |
  6098. -- ((u64)seq->aes_gmac.pn[4] << 8) |
  6099. -- ((u64)seq->aes_gmac.pn[3] << 16) |
  6100. -- ((u64)seq->aes_gmac.pn[2] << 24) |
  6101. -- ((u64)seq->aes_gmac.pn[1] << 32) |
  6102. -- ((u64)seq->aes_gmac.pn[0] << 40);
  6103. -- atomic64_set(&key->u.aes_gmac.tx_pn, pn64);
  6104. -- break;
  6105. -- case WLAN_CIPHER_SUITE_GCMP:
  6106. -- case WLAN_CIPHER_SUITE_GCMP_256:
  6107. -- pn64 = (u64)seq->gcmp.pn[5] |
  6108. -- ((u64)seq->gcmp.pn[4] << 8) |
  6109. -- ((u64)seq->gcmp.pn[3] << 16) |
  6110. -- ((u64)seq->gcmp.pn[2] << 24) |
  6111. -- ((u64)seq->gcmp.pn[1] << 32) |
  6112. -- ((u64)seq->gcmp.pn[0] << 40);
  6113. -- atomic64_set(&key->u.gcmp.tx_pn, pn64);
  6114. -- break;
  6115. - default:
  6116. - WARN_ON(1);
  6117. - break;
  6118. -@@ -1000,7 +854,6 @@ void ieee80211_set_key_rx_seq(struct iee
  6119. - key->u.tkip.rx[tid].iv16 = seq->tkip.iv16;
  6120. - break;
  6121. - case WLAN_CIPHER_SUITE_CCMP:
  6122. -- case WLAN_CIPHER_SUITE_CCMP_256:
  6123. - if (WARN_ON(tid < -1 || tid >= IEEE80211_NUM_TIDS))
  6124. - return;
  6125. - if (tid < 0)
  6126. -@@ -1010,29 +863,11 @@ void ieee80211_set_key_rx_seq(struct iee
  6127. - memcpy(pn, seq->ccmp.pn, IEEE80211_CCMP_PN_LEN);
  6128. - break;
  6129. - case WLAN_CIPHER_SUITE_AES_CMAC:
  6130. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  6131. - if (WARN_ON(tid != 0))
  6132. - return;
  6133. - pn = key->u.aes_cmac.rx_pn;
  6134. - memcpy(pn, seq->aes_cmac.pn, IEEE80211_CMAC_PN_LEN);
  6135. - break;
  6136. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  6137. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  6138. -- if (WARN_ON(tid != 0))
  6139. -- return;
  6140. -- pn = key->u.aes_gmac.rx_pn;
  6141. -- memcpy(pn, seq->aes_gmac.pn, IEEE80211_GMAC_PN_LEN);
  6142. -- break;
  6143. -- case WLAN_CIPHER_SUITE_GCMP:
  6144. -- case WLAN_CIPHER_SUITE_GCMP_256:
  6145. -- if (WARN_ON(tid < -1 || tid >= IEEE80211_NUM_TIDS))
  6146. -- return;
  6147. -- if (tid < 0)
  6148. -- pn = key->u.gcmp.rx_pn[IEEE80211_NUM_TIDS];
  6149. -- else
  6150. -- pn = key->u.gcmp.rx_pn[tid];
  6151. -- memcpy(pn, seq->gcmp.pn, IEEE80211_GCMP_PN_LEN);
  6152. -- break;
  6153. - default:
  6154. - WARN_ON(1);
  6155. - break;
  6156. ---- a/net/mac80211/key.h
  6157. -+++ b/net/mac80211/key.h
  6158. -@@ -84,7 +84,7 @@ struct ieee80211_key {
  6159. - * Management frames.
  6160. - */
  6161. - u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_CCMP_PN_LEN];
  6162. -- struct crypto_aead *tfm;
  6163. -+ struct crypto_cipher *tfm;
  6164. - u32 replays; /* dot11RSNAStatsCCMPReplays */
  6165. - } ccmp;
  6166. - struct {
  6167. -@@ -95,24 +95,6 @@ struct ieee80211_key {
  6168. - u32 icverrors; /* dot11RSNAStatsCMACICVErrors */
  6169. - } aes_cmac;
  6170. - struct {
  6171. -- atomic64_t tx_pn;
  6172. -- u8 rx_pn[IEEE80211_GMAC_PN_LEN];
  6173. -- struct crypto_aead *tfm;
  6174. -- u32 replays; /* dot11RSNAStatsCMACReplays */
  6175. -- u32 icverrors; /* dot11RSNAStatsCMACICVErrors */
  6176. -- } aes_gmac;
  6177. -- struct {
  6178. -- atomic64_t tx_pn;
  6179. -- /* Last received packet number. The first
  6180. -- * IEEE80211_NUM_TIDS counters are used with Data
  6181. -- * frames and the last counter is used with Robust
  6182. -- * Management frames.
  6183. -- */
  6184. -- u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_GCMP_PN_LEN];
  6185. -- struct crypto_aead *tfm;
  6186. -- u32 replays; /* dot11RSNAStatsGCMPReplays */
  6187. -- } gcmp;
  6188. -- struct {
  6189. - /* generic cipher scheme */
  6190. - u8 rx_pn[IEEE80211_NUM_TIDS + 1][MAX_PN_LEN];
  6191. - } gen;
  6192. ---- a/net/mac80211/main.c
  6193. -+++ b/net/mac80211/main.c
  6194. -@@ -666,15 +666,9 @@ static int ieee80211_init_cipher_suites(
  6195. - WLAN_CIPHER_SUITE_WEP104,
  6196. - WLAN_CIPHER_SUITE_TKIP,
  6197. - WLAN_CIPHER_SUITE_CCMP,
  6198. -- WLAN_CIPHER_SUITE_CCMP_256,
  6199. -- WLAN_CIPHER_SUITE_GCMP,
  6200. -- WLAN_CIPHER_SUITE_GCMP_256,
  6201. -
  6202. - /* keep last -- depends on hw flags! */
  6203. -- WLAN_CIPHER_SUITE_AES_CMAC,
  6204. -- WLAN_CIPHER_SUITE_BIP_CMAC_256,
  6205. -- WLAN_CIPHER_SUITE_BIP_GMAC_128,
  6206. -- WLAN_CIPHER_SUITE_BIP_GMAC_256,
  6207. -+ WLAN_CIPHER_SUITE_AES_CMAC
  6208. - };
  6209. -
  6210. - if (local->hw.flags & IEEE80211_HW_SW_CRYPTO_CONTROL ||
  6211. -@@ -713,7 +707,7 @@ static int ieee80211_init_cipher_suites(
  6212. - local->hw.wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  6213. -
  6214. - if (!have_mfp)
  6215. -- local->hw.wiphy->n_cipher_suites -= 4;
  6216. -+ local->hw.wiphy->n_cipher_suites--;
  6217. -
  6218. - if (!have_wep) {
  6219. - local->hw.wiphy->cipher_suites += 2;
  6220. -@@ -730,42 +724,32 @@ static int ieee80211_init_cipher_suites(
  6221. - /* Driver specifies cipher schemes only (but not cipher suites
  6222. - * including the schemes)
  6223. - *
  6224. -- * We start counting ciphers defined by schemes, TKIP, CCMP,
  6225. -- * CCMP-256, GCMP, and GCMP-256
  6226. -+ * We start counting ciphers defined by schemes, TKIP and CCMP
  6227. - */
  6228. -- n_suites = local->hw.n_cipher_schemes + 5;
  6229. -+ n_suites = local->hw.n_cipher_schemes + 2;
  6230. -
  6231. - /* check if we have WEP40 and WEP104 */
  6232. - if (have_wep)
  6233. - n_suites += 2;
  6234. -
  6235. -- /* check if we have AES_CMAC, BIP-CMAC-256, BIP-GMAC-128,
  6236. -- * BIP-GMAC-256
  6237. -- */
  6238. -+ /* check if we have AES_CMAC */
  6239. - if (have_mfp)
  6240. -- n_suites += 4;
  6241. -+ n_suites++;
  6242. -
  6243. - suites = kmalloc(sizeof(u32) * n_suites, GFP_KERNEL);
  6244. - if (!suites)
  6245. - return -ENOMEM;
  6246. -
  6247. - suites[w++] = WLAN_CIPHER_SUITE_CCMP;
  6248. -- suites[w++] = WLAN_CIPHER_SUITE_CCMP_256;
  6249. - suites[w++] = WLAN_CIPHER_SUITE_TKIP;
  6250. -- suites[w++] = WLAN_CIPHER_SUITE_GCMP;
  6251. -- suites[w++] = WLAN_CIPHER_SUITE_GCMP_256;
  6252. -
  6253. - if (have_wep) {
  6254. - suites[w++] = WLAN_CIPHER_SUITE_WEP40;
  6255. - suites[w++] = WLAN_CIPHER_SUITE_WEP104;
  6256. - }
  6257. -
  6258. -- if (have_mfp) {
  6259. -+ if (have_mfp)
  6260. - suites[w++] = WLAN_CIPHER_SUITE_AES_CMAC;
  6261. -- suites[w++] = WLAN_CIPHER_SUITE_BIP_CMAC_256;
  6262. -- suites[w++] = WLAN_CIPHER_SUITE_BIP_GMAC_128;
  6263. -- suites[w++] = WLAN_CIPHER_SUITE_BIP_GMAC_256;
  6264. -- }
  6265. -
  6266. - for (r = 0; r < local->hw.n_cipher_schemes; r++)
  6267. - suites[w++] = cs[r].cipher;
  6268. ---- a/net/mac80211/rx.c
  6269. -+++ b/net/mac80211/rx.c
  6270. -@@ -647,7 +647,6 @@ static int ieee80211_get_mmie_keyidx(str
  6271. - {
  6272. - struct ieee80211_mgmt *hdr = (struct ieee80211_mgmt *) skb->data;
  6273. - struct ieee80211_mmie *mmie;
  6274. -- struct ieee80211_mmie_16 *mmie16;
  6275. -
  6276. - if (skb->len < 24 + sizeof(*mmie) || !is_multicast_ether_addr(hdr->da))
  6277. - return -1;
  6278. -@@ -657,18 +656,11 @@ static int ieee80211_get_mmie_keyidx(str
  6279. -
  6280. - mmie = (struct ieee80211_mmie *)
  6281. - (skb->data + skb->len - sizeof(*mmie));
  6282. -- if (mmie->element_id == WLAN_EID_MMIE &&
  6283. -- mmie->length == sizeof(*mmie) - 2)
  6284. -- return le16_to_cpu(mmie->key_id);
  6285. --
  6286. -- mmie16 = (struct ieee80211_mmie_16 *)
  6287. -- (skb->data + skb->len - sizeof(*mmie16));
  6288. -- if (skb->len >= 24 + sizeof(*mmie16) &&
  6289. -- mmie16->element_id == WLAN_EID_MMIE &&
  6290. -- mmie16->length == sizeof(*mmie16) - 2)
  6291. -- return le16_to_cpu(mmie16->key_id);
  6292. -+ if (mmie->element_id != WLAN_EID_MMIE ||
  6293. -+ mmie->length != sizeof(*mmie) - 2)
  6294. -+ return -1;
  6295. -
  6296. -- return -1;
  6297. -+ return le16_to_cpu(mmie->key_id);
  6298. - }
  6299. -
  6300. - static int iwl80211_get_cs_keyid(const struct ieee80211_cipher_scheme *cs,
  6301. -@@ -1658,27 +1650,11 @@ ieee80211_rx_h_decrypt(struct ieee80211_
  6302. - result = ieee80211_crypto_tkip_decrypt(rx);
  6303. - break;
  6304. - case WLAN_CIPHER_SUITE_CCMP:
  6305. -- result = ieee80211_crypto_ccmp_decrypt(
  6306. -- rx, IEEE80211_CCMP_MIC_LEN);
  6307. -- break;
  6308. -- case WLAN_CIPHER_SUITE_CCMP_256:
  6309. -- result = ieee80211_crypto_ccmp_decrypt(
  6310. -- rx, IEEE80211_CCMP_256_MIC_LEN);
  6311. -+ result = ieee80211_crypto_ccmp_decrypt(rx);
  6312. - break;
  6313. - case WLAN_CIPHER_SUITE_AES_CMAC:
  6314. - result = ieee80211_crypto_aes_cmac_decrypt(rx);
  6315. - break;
  6316. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  6317. -- result = ieee80211_crypto_aes_cmac_256_decrypt(rx);
  6318. -- break;
  6319. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  6320. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  6321. -- result = ieee80211_crypto_aes_gmac_decrypt(rx);
  6322. -- break;
  6323. -- case WLAN_CIPHER_SUITE_GCMP:
  6324. -- case WLAN_CIPHER_SUITE_GCMP_256:
  6325. -- result = ieee80211_crypto_gcmp_decrypt(rx);
  6326. -- break;
  6327. - default:
  6328. - result = ieee80211_crypto_hw_decrypt(rx);
  6329. - }
  6330. -@@ -1805,9 +1781,7 @@ ieee80211_rx_h_defragment(struct ieee802
  6331. - /* This is the first fragment of a new frame. */
  6332. - entry = ieee80211_reassemble_add(rx->sdata, frag, seq,
  6333. - rx->seqno_idx, &(rx->skb));
  6334. -- if (rx->key &&
  6335. -- (rx->key->conf.cipher == WLAN_CIPHER_SUITE_CCMP ||
  6336. -- rx->key->conf.cipher == WLAN_CIPHER_SUITE_CCMP_256) &&
  6337. -+ if (rx->key && rx->key->conf.cipher == WLAN_CIPHER_SUITE_CCMP &&
  6338. - ieee80211_has_protected(fc)) {
  6339. - int queue = rx->security_idx;
  6340. - /* Store CCMP PN so that we can verify that the next
  6341. -@@ -1836,9 +1810,7 @@ ieee80211_rx_h_defragment(struct ieee802
  6342. - int i;
  6343. - u8 pn[IEEE80211_CCMP_PN_LEN], *rpn;
  6344. - int queue;
  6345. -- if (!rx->key ||
  6346. -- (rx->key->conf.cipher != WLAN_CIPHER_SUITE_CCMP &&
  6347. -- rx->key->conf.cipher != WLAN_CIPHER_SUITE_CCMP_256))
  6348. -+ if (!rx->key || rx->key->conf.cipher != WLAN_CIPHER_SUITE_CCMP)
  6349. - return RX_DROP_UNUSABLE;
  6350. - memcpy(pn, entry->last_pn, IEEE80211_CCMP_PN_LEN);
  6351. - for (i = IEEE80211_CCMP_PN_LEN - 1; i >= 0; i--) {
  6352. ---- a/net/mac80211/tx.c
  6353. -+++ b/net/mac80211/tx.c
  6354. -@@ -626,9 +626,6 @@ ieee80211_tx_h_select_key(struct ieee802
  6355. - tx->key = NULL;
  6356. - break;
  6357. - case WLAN_CIPHER_SUITE_CCMP:
  6358. -- case WLAN_CIPHER_SUITE_CCMP_256:
  6359. -- case WLAN_CIPHER_SUITE_GCMP:
  6360. -- case WLAN_CIPHER_SUITE_GCMP_256:
  6361. - if (!ieee80211_is_data_present(hdr->frame_control) &&
  6362. - !ieee80211_use_mfp(hdr->frame_control, tx->sta,
  6363. - tx->skb))
  6364. -@@ -639,9 +636,6 @@ ieee80211_tx_h_select_key(struct ieee802
  6365. - ieee80211_is_mgmt(hdr->frame_control);
  6366. - break;
  6367. - case WLAN_CIPHER_SUITE_AES_CMAC:
  6368. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  6369. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  6370. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  6371. - if (!ieee80211_is_mgmt(hdr->frame_control))
  6372. - tx->key = NULL;
  6373. - break;
  6374. -@@ -1017,21 +1011,9 @@ ieee80211_tx_h_encrypt(struct ieee80211_
  6375. - case WLAN_CIPHER_SUITE_TKIP:
  6376. - return ieee80211_crypto_tkip_encrypt(tx);
  6377. - case WLAN_CIPHER_SUITE_CCMP:
  6378. -- return ieee80211_crypto_ccmp_encrypt(
  6379. -- tx, IEEE80211_CCMP_MIC_LEN);
  6380. -- case WLAN_CIPHER_SUITE_CCMP_256:
  6381. -- return ieee80211_crypto_ccmp_encrypt(
  6382. -- tx, IEEE80211_CCMP_256_MIC_LEN);
  6383. -+ return ieee80211_crypto_ccmp_encrypt(tx);
  6384. - case WLAN_CIPHER_SUITE_AES_CMAC:
  6385. - return ieee80211_crypto_aes_cmac_encrypt(tx);
  6386. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  6387. -- return ieee80211_crypto_aes_cmac_256_encrypt(tx);
  6388. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  6389. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  6390. -- return ieee80211_crypto_aes_gmac_encrypt(tx);
  6391. -- case WLAN_CIPHER_SUITE_GCMP:
  6392. -- case WLAN_CIPHER_SUITE_GCMP_256:
  6393. -- return ieee80211_crypto_gcmp_encrypt(tx);
  6394. - default:
  6395. - return ieee80211_crypto_hw_encrypt(tx);
  6396. - }
  6397. ---- a/net/mac80211/wpa.c
  6398. -+++ b/net/mac80211/wpa.c
  6399. -@@ -22,8 +22,6 @@
  6400. - #include "tkip.h"
  6401. - #include "aes_ccm.h"
  6402. - #include "aes_cmac.h"
  6403. --#include "aes_gmac.h"
  6404. --#include "aes_gcm.h"
  6405. - #include "wpa.h"
  6406. -
  6407. - ieee80211_tx_result
  6408. -@@ -304,15 +302,22 @@ ieee80211_crypto_tkip_decrypt(struct iee
  6409. - }
  6410. -
  6411. -
  6412. --static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad)
  6413. -+static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *scratch,
  6414. -+ int encrypted)
  6415. - {
  6416. - __le16 mask_fc;
  6417. - int a4_included, mgmt;
  6418. - u8 qos_tid;
  6419. -- u16 len_a;
  6420. -+ u8 *b_0, *aad;
  6421. -+ u16 data_len, len_a;
  6422. - unsigned int hdrlen;
  6423. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  6424. -
  6425. -+ memset(scratch, 0, 6 * AES_BLOCK_SIZE);
  6426. -+
  6427. -+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
  6428. -+ aad = scratch + 4 * AES_BLOCK_SIZE;
  6429. -+
  6430. - /*
  6431. - * Mask FC: zero subtype b4 b5 b6 (if not mgmt)
  6432. - * Retry, PwrMgt, MoreData; set Protected
  6433. -@@ -334,21 +339,20 @@ static void ccmp_special_blocks(struct s
  6434. - else
  6435. - qos_tid = 0;
  6436. -
  6437. -- /* In CCM, the initial vectors (IV) used for CTR mode encryption and CBC
  6438. -- * mode authentication are not allowed to collide, yet both are derived
  6439. -- * from this vector b_0. We only set L := 1 here to indicate that the
  6440. -- * data size can be represented in (L+1) bytes. The CCM layer will take
  6441. -- * care of storing the data length in the top (L+1) bytes and setting
  6442. -- * and clearing the other bits as is required to derive the two IVs.
  6443. -- */
  6444. -- b_0[0] = 0x1;
  6445. -+ data_len = skb->len - hdrlen - IEEE80211_CCMP_HDR_LEN;
  6446. -+ if (encrypted)
  6447. -+ data_len -= IEEE80211_CCMP_MIC_LEN;
  6448. -
  6449. -+ /* First block, b_0 */
  6450. -+ b_0[0] = 0x59; /* flags: Adata: 1, M: 011, L: 001 */
  6451. - /* Nonce: Nonce Flags | A2 | PN
  6452. - * Nonce Flags: Priority (b0..b3) | Management (b4) | Reserved (b5..b7)
  6453. - */
  6454. - b_0[1] = qos_tid | (mgmt << 4);
  6455. - memcpy(&b_0[2], hdr->addr2, ETH_ALEN);
  6456. - memcpy(&b_0[8], pn, IEEE80211_CCMP_PN_LEN);
  6457. -+ /* l(m) */
  6458. -+ put_unaligned_be16(data_len, &b_0[14]);
  6459. -
  6460. - /* AAD (extra authenticate-only data) / masked 802.11 header
  6461. - * FC | A1 | A2 | A3 | SC | [A4] | [QC] */
  6462. -@@ -395,8 +399,7 @@ static inline void ccmp_hdr2pn(u8 *pn, u
  6463. - }
  6464. -
  6465. -
  6466. --static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb,
  6467. -- unsigned int mic_len)
  6468. -+static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
  6469. - {
  6470. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  6471. - struct ieee80211_key *key = tx->key;
  6472. -@@ -405,8 +408,7 @@ static int ccmp_encrypt_skb(struct ieee8
  6473. - u8 *pos;
  6474. - u8 pn[6];
  6475. - u64 pn64;
  6476. -- u8 aad[2 * AES_BLOCK_SIZE];
  6477. -- u8 b_0[AES_BLOCK_SIZE];
  6478. -+ u8 scratch[6 * AES_BLOCK_SIZE];
  6479. -
  6480. - if (info->control.hw_key &&
  6481. - !(info->control.hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) &&
  6482. -@@ -427,7 +429,7 @@ static int ccmp_encrypt_skb(struct ieee8
  6483. - if (info->control.hw_key)
  6484. - tail = 0;
  6485. - else
  6486. -- tail = mic_len;
  6487. -+ tail = IEEE80211_CCMP_MIC_LEN;
  6488. -
  6489. - if (WARN_ON(skb_tailroom(skb) < tail ||
  6490. - skb_headroom(skb) < IEEE80211_CCMP_HDR_LEN))
  6491. -@@ -460,24 +462,23 @@ static int ccmp_encrypt_skb(struct ieee8
  6492. - return 0;
  6493. -
  6494. - pos += IEEE80211_CCMP_HDR_LEN;
  6495. -- ccmp_special_blocks(skb, pn, b_0, aad);
  6496. -- ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, b_0, aad, pos, len,
  6497. -- skb_put(skb, mic_len), mic_len);
  6498. -+ ccmp_special_blocks(skb, pn, scratch, 0);
  6499. -+ ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, scratch, pos, len,
  6500. -+ pos, skb_put(skb, IEEE80211_CCMP_MIC_LEN));
  6501. -
  6502. - return 0;
  6503. - }
  6504. -
  6505. -
  6506. - ieee80211_tx_result
  6507. --ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx,
  6508. -- unsigned int mic_len)
  6509. -+ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx)
  6510. - {
  6511. - struct sk_buff *skb;
  6512. -
  6513. - ieee80211_tx_set_protected(tx);
  6514. -
  6515. - skb_queue_walk(&tx->skbs, skb) {
  6516. -- if (ccmp_encrypt_skb(tx, skb, mic_len) < 0)
  6517. -+ if (ccmp_encrypt_skb(tx, skb) < 0)
  6518. - return TX_DROP;
  6519. - }
  6520. -
  6521. -@@ -486,8 +487,7 @@ ieee80211_crypto_ccmp_encrypt(struct iee
  6522. -
  6523. -
  6524. - ieee80211_rx_result
  6525. --ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx,
  6526. -- unsigned int mic_len)
  6527. -+ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx)
  6528. - {
  6529. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
  6530. - int hdrlen;
  6531. -@@ -504,7 +504,8 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  6532. - !ieee80211_is_robust_mgmt_frame(skb))
  6533. - return RX_CONTINUE;
  6534. -
  6535. -- data_len = skb->len - hdrlen - IEEE80211_CCMP_HDR_LEN - mic_len;
  6536. -+ data_len = skb->len - hdrlen - IEEE80211_CCMP_HDR_LEN -
  6537. -+ IEEE80211_CCMP_MIC_LEN;
  6538. - if (!rx->sta || data_len < 0)
  6539. - return RX_DROP_UNUSABLE;
  6540. -
  6541. -@@ -526,23 +527,23 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  6542. - }
  6543. -
  6544. - if (!(status->flag & RX_FLAG_DECRYPTED)) {
  6545. -- u8 aad[2 * AES_BLOCK_SIZE];
  6546. -- u8 b_0[AES_BLOCK_SIZE];
  6547. -+ u8 scratch[6 * AES_BLOCK_SIZE];
  6548. - /* hardware didn't decrypt/verify MIC */
  6549. -- ccmp_special_blocks(skb, pn, b_0, aad);
  6550. -+ ccmp_special_blocks(skb, pn, scratch, 1);
  6551. -
  6552. - if (ieee80211_aes_ccm_decrypt(
  6553. -- key->u.ccmp.tfm, b_0, aad,
  6554. -+ key->u.ccmp.tfm, scratch,
  6555. - skb->data + hdrlen + IEEE80211_CCMP_HDR_LEN,
  6556. - data_len,
  6557. -- skb->data + skb->len - mic_len, mic_len))
  6558. -+ skb->data + skb->len - IEEE80211_CCMP_MIC_LEN,
  6559. -+ skb->data + hdrlen + IEEE80211_CCMP_HDR_LEN))
  6560. - return RX_DROP_UNUSABLE;
  6561. - }
  6562. -
  6563. - memcpy(key->u.ccmp.rx_pn[queue], pn, IEEE80211_CCMP_PN_LEN);
  6564. -
  6565. - /* Remove CCMP header and MIC */
  6566. -- if (pskb_trim(skb, skb->len - mic_len))
  6567. -+ if (pskb_trim(skb, skb->len - IEEE80211_CCMP_MIC_LEN))
  6568. - return RX_DROP_UNUSABLE;
  6569. - memmove(skb->data + IEEE80211_CCMP_HDR_LEN, skb->data, hdrlen);
  6570. - skb_pull(skb, IEEE80211_CCMP_HDR_LEN);
  6571. -@@ -550,229 +551,6 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  6572. - return RX_CONTINUE;
  6573. - }
  6574. -
  6575. --static void gcmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *j_0, u8 *aad)
  6576. --{
  6577. -- __le16 mask_fc;
  6578. -- u8 qos_tid;
  6579. -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  6580. --
  6581. -- memcpy(j_0, hdr->addr2, ETH_ALEN);
  6582. -- memcpy(&j_0[ETH_ALEN], pn, IEEE80211_GCMP_PN_LEN);
  6583. -- j_0[13] = 0;
  6584. -- j_0[14] = 0;
  6585. -- j_0[AES_BLOCK_SIZE - 1] = 0x01;
  6586. --
  6587. -- /* AAD (extra authenticate-only data) / masked 802.11 header
  6588. -- * FC | A1 | A2 | A3 | SC | [A4] | [QC]
  6589. -- */
  6590. -- put_unaligned_be16(ieee80211_hdrlen(hdr->frame_control) - 2, &aad[0]);
  6591. -- /* Mask FC: zero subtype b4 b5 b6 (if not mgmt)
  6592. -- * Retry, PwrMgt, MoreData; set Protected
  6593. -- */
  6594. -- mask_fc = hdr->frame_control;
  6595. -- mask_fc &= ~cpu_to_le16(IEEE80211_FCTL_RETRY |
  6596. -- IEEE80211_FCTL_PM | IEEE80211_FCTL_MOREDATA);
  6597. -- if (!ieee80211_is_mgmt(hdr->frame_control))
  6598. -- mask_fc &= ~cpu_to_le16(0x0070);
  6599. -- mask_fc |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
  6600. --
  6601. -- put_unaligned(mask_fc, (__le16 *)&aad[2]);
  6602. -- memcpy(&aad[4], &hdr->addr1, 3 * ETH_ALEN);
  6603. --
  6604. -- /* Mask Seq#, leave Frag# */
  6605. -- aad[22] = *((u8 *)&hdr->seq_ctrl) & 0x0f;
  6606. -- aad[23] = 0;
  6607. --
  6608. -- if (ieee80211_is_data_qos(hdr->frame_control))
  6609. -- qos_tid = *ieee80211_get_qos_ctl(hdr) &
  6610. -- IEEE80211_QOS_CTL_TID_MASK;
  6611. -- else
  6612. -- qos_tid = 0;
  6613. --
  6614. -- if (ieee80211_has_a4(hdr->frame_control)) {
  6615. -- memcpy(&aad[24], hdr->addr4, ETH_ALEN);
  6616. -- aad[30] = qos_tid;
  6617. -- aad[31] = 0;
  6618. -- } else {
  6619. -- memset(&aad[24], 0, ETH_ALEN + IEEE80211_QOS_CTL_LEN);
  6620. -- aad[24] = qos_tid;
  6621. -- }
  6622. --}
  6623. --
  6624. --static inline void gcmp_pn2hdr(u8 *hdr, const u8 *pn, int key_id)
  6625. --{
  6626. -- hdr[0] = pn[5];
  6627. -- hdr[1] = pn[4];
  6628. -- hdr[2] = 0;
  6629. -- hdr[3] = 0x20 | (key_id << 6);
  6630. -- hdr[4] = pn[3];
  6631. -- hdr[5] = pn[2];
  6632. -- hdr[6] = pn[1];
  6633. -- hdr[7] = pn[0];
  6634. --}
  6635. --
  6636. --static inline void gcmp_hdr2pn(u8 *pn, const u8 *hdr)
  6637. --{
  6638. -- pn[0] = hdr[7];
  6639. -- pn[1] = hdr[6];
  6640. -- pn[2] = hdr[5];
  6641. -- pn[3] = hdr[4];
  6642. -- pn[4] = hdr[1];
  6643. -- pn[5] = hdr[0];
  6644. --}
  6645. --
  6646. --static int gcmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
  6647. --{
  6648. -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  6649. -- struct ieee80211_key *key = tx->key;
  6650. -- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  6651. -- int hdrlen, len, tail;
  6652. -- u8 *pos;
  6653. -- u8 pn[6];
  6654. -- u64 pn64;
  6655. -- u8 aad[2 * AES_BLOCK_SIZE];
  6656. -- u8 j_0[AES_BLOCK_SIZE];
  6657. --
  6658. -- if (info->control.hw_key &&
  6659. -- !(info->control.hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) &&
  6660. -- !(info->control.hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE) &&
  6661. -- !((info->control.hw_key->flags &
  6662. -- IEEE80211_KEY_FLAG_GENERATE_IV_MGMT) &&
  6663. -- ieee80211_is_mgmt(hdr->frame_control))) {
  6664. -- /* hwaccel has no need for preallocated room for GCMP
  6665. -- * header or MIC fields
  6666. -- */
  6667. -- return 0;
  6668. -- }
  6669. --
  6670. -- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  6671. -- len = skb->len - hdrlen;
  6672. --
  6673. -- if (info->control.hw_key)
  6674. -- tail = 0;
  6675. -- else
  6676. -- tail = IEEE80211_GCMP_MIC_LEN;
  6677. --
  6678. -- if (WARN_ON(skb_tailroom(skb) < tail ||
  6679. -- skb_headroom(skb) < IEEE80211_GCMP_HDR_LEN))
  6680. -- return -1;
  6681. --
  6682. -- pos = skb_push(skb, IEEE80211_GCMP_HDR_LEN);
  6683. -- memmove(pos, pos + IEEE80211_GCMP_HDR_LEN, hdrlen);
  6684. -- skb_set_network_header(skb, skb_network_offset(skb) +
  6685. -- IEEE80211_GCMP_HDR_LEN);
  6686. --
  6687. -- /* the HW only needs room for the IV, but not the actual IV */
  6688. -- if (info->control.hw_key &&
  6689. -- (info->control.hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE))
  6690. -- return 0;
  6691. --
  6692. -- hdr = (struct ieee80211_hdr *)pos;
  6693. -- pos += hdrlen;
  6694. --
  6695. -- pn64 = atomic64_inc_return(&key->u.gcmp.tx_pn);
  6696. --
  6697. -- pn[5] = pn64;
  6698. -- pn[4] = pn64 >> 8;
  6699. -- pn[3] = pn64 >> 16;
  6700. -- pn[2] = pn64 >> 24;
  6701. -- pn[1] = pn64 >> 32;
  6702. -- pn[0] = pn64 >> 40;
  6703. --
  6704. -- gcmp_pn2hdr(pos, pn, key->conf.keyidx);
  6705. --
  6706. -- /* hwaccel - with software GCMP header */
  6707. -- if (info->control.hw_key)
  6708. -- return 0;
  6709. --
  6710. -- pos += IEEE80211_GCMP_HDR_LEN;
  6711. -- gcmp_special_blocks(skb, pn, j_0, aad);
  6712. -- ieee80211_aes_gcm_encrypt(key->u.gcmp.tfm, j_0, aad, pos, len,
  6713. -- skb_put(skb, IEEE80211_GCMP_MIC_LEN));
  6714. --
  6715. -- return 0;
  6716. --}
  6717. --
  6718. --ieee80211_tx_result
  6719. --ieee80211_crypto_gcmp_encrypt(struct ieee80211_tx_data *tx)
  6720. --{
  6721. -- struct sk_buff *skb;
  6722. --
  6723. -- ieee80211_tx_set_protected(tx);
  6724. --
  6725. -- skb_queue_walk(&tx->skbs, skb) {
  6726. -- if (gcmp_encrypt_skb(tx, skb) < 0)
  6727. -- return TX_DROP;
  6728. -- }
  6729. --
  6730. -- return TX_CONTINUE;
  6731. --}
  6732. --
  6733. --ieee80211_rx_result
  6734. --ieee80211_crypto_gcmp_decrypt(struct ieee80211_rx_data *rx)
  6735. --{
  6736. -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
  6737. -- int hdrlen;
  6738. -- struct ieee80211_key *key = rx->key;
  6739. -- struct sk_buff *skb = rx->skb;
  6740. -- struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
  6741. -- u8 pn[IEEE80211_GCMP_PN_LEN];
  6742. -- int data_len;
  6743. -- int queue;
  6744. --
  6745. -- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  6746. --
  6747. -- if (!ieee80211_is_data(hdr->frame_control) &&
  6748. -- !ieee80211_is_robust_mgmt_frame(skb))
  6749. -- return RX_CONTINUE;
  6750. --
  6751. -- data_len = skb->len - hdrlen - IEEE80211_GCMP_HDR_LEN -
  6752. -- IEEE80211_GCMP_MIC_LEN;
  6753. -- if (!rx->sta || data_len < 0)
  6754. -- return RX_DROP_UNUSABLE;
  6755. --
  6756. -- if (status->flag & RX_FLAG_DECRYPTED) {
  6757. -- if (!pskb_may_pull(rx->skb, hdrlen + IEEE80211_GCMP_HDR_LEN))
  6758. -- return RX_DROP_UNUSABLE;
  6759. -- } else {
  6760. -- if (skb_linearize(rx->skb))
  6761. -- return RX_DROP_UNUSABLE;
  6762. -- }
  6763. --
  6764. -- gcmp_hdr2pn(pn, skb->data + hdrlen);
  6765. --
  6766. -- queue = rx->security_idx;
  6767. --
  6768. -- if (memcmp(pn, key->u.gcmp.rx_pn[queue], IEEE80211_GCMP_PN_LEN) <= 0) {
  6769. -- key->u.gcmp.replays++;
  6770. -- return RX_DROP_UNUSABLE;
  6771. -- }
  6772. --
  6773. -- if (!(status->flag & RX_FLAG_DECRYPTED)) {
  6774. -- u8 aad[2 * AES_BLOCK_SIZE];
  6775. -- u8 j_0[AES_BLOCK_SIZE];
  6776. -- /* hardware didn't decrypt/verify MIC */
  6777. -- gcmp_special_blocks(skb, pn, j_0, aad);
  6778. --
  6779. -- if (ieee80211_aes_gcm_decrypt(
  6780. -- key->u.gcmp.tfm, j_0, aad,
  6781. -- skb->data + hdrlen + IEEE80211_GCMP_HDR_LEN,
  6782. -- data_len,
  6783. -- skb->data + skb->len - IEEE80211_GCMP_MIC_LEN))
  6784. -- return RX_DROP_UNUSABLE;
  6785. -- }
  6786. --
  6787. -- memcpy(key->u.gcmp.rx_pn[queue], pn, IEEE80211_GCMP_PN_LEN);
  6788. --
  6789. -- /* Remove GCMP header and MIC */
  6790. -- if (pskb_trim(skb, skb->len - IEEE80211_GCMP_MIC_LEN))
  6791. -- return RX_DROP_UNUSABLE;
  6792. -- memmove(skb->data + IEEE80211_GCMP_HDR_LEN, skb->data, hdrlen);
  6793. -- skb_pull(skb, IEEE80211_GCMP_HDR_LEN);
  6794. --
  6795. -- return RX_CONTINUE;
  6796. --}
  6797. --
  6798. - static ieee80211_tx_result
  6799. - ieee80211_crypto_cs_encrypt(struct ieee80211_tx_data *tx,
  6800. - struct sk_buff *skb)
  6801. -@@ -956,48 +734,6 @@ ieee80211_crypto_aes_cmac_encrypt(struct
  6802. - return TX_CONTINUE;
  6803. - }
  6804. -
  6805. --ieee80211_tx_result
  6806. --ieee80211_crypto_aes_cmac_256_encrypt(struct ieee80211_tx_data *tx)
  6807. --{
  6808. -- struct sk_buff *skb;
  6809. -- struct ieee80211_tx_info *info;
  6810. -- struct ieee80211_key *key = tx->key;
  6811. -- struct ieee80211_mmie_16 *mmie;
  6812. -- u8 aad[20];
  6813. -- u64 pn64;
  6814. --
  6815. -- if (WARN_ON(skb_queue_len(&tx->skbs) != 1))
  6816. -- return TX_DROP;
  6817. --
  6818. -- skb = skb_peek(&tx->skbs);
  6819. --
  6820. -- info = IEEE80211_SKB_CB(skb);
  6821. --
  6822. -- if (info->control.hw_key)
  6823. -- return TX_CONTINUE;
  6824. --
  6825. -- if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie)))
  6826. -- return TX_DROP;
  6827. --
  6828. -- mmie = (struct ieee80211_mmie_16 *)skb_put(skb, sizeof(*mmie));
  6829. -- mmie->element_id = WLAN_EID_MMIE;
  6830. -- mmie->length = sizeof(*mmie) - 2;
  6831. -- mmie->key_id = cpu_to_le16(key->conf.keyidx);
  6832. --
  6833. -- /* PN = PN + 1 */
  6834. -- pn64 = atomic64_inc_return(&key->u.aes_cmac.tx_pn);
  6835. --
  6836. -- bip_ipn_set64(mmie->sequence_number, pn64);
  6837. --
  6838. -- bip_aad(skb, aad);
  6839. --
  6840. -- /* MIC = AES-256-CMAC(IGTK, AAD || Management Frame Body || MMIE, 128)
  6841. -- */
  6842. -- ieee80211_aes_cmac_256(key->u.aes_cmac.tfm, aad,
  6843. -- skb->data + 24, skb->len - 24, mmie->mic);
  6844. --
  6845. -- return TX_CONTINUE;
  6846. --}
  6847. -
  6848. - ieee80211_rx_result
  6849. - ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx)
  6850. -@@ -1045,160 +781,6 @@ ieee80211_crypto_aes_cmac_decrypt(struct
  6851. -
  6852. - /* Remove MMIE */
  6853. - skb_trim(skb, skb->len - sizeof(*mmie));
  6854. --
  6855. -- return RX_CONTINUE;
  6856. --}
  6857. --
  6858. --ieee80211_rx_result
  6859. --ieee80211_crypto_aes_cmac_256_decrypt(struct ieee80211_rx_data *rx)
  6860. --{
  6861. -- struct sk_buff *skb = rx->skb;
  6862. -- struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
  6863. -- struct ieee80211_key *key = rx->key;
  6864. -- struct ieee80211_mmie_16 *mmie;
  6865. -- u8 aad[20], mic[16], ipn[6];
  6866. -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  6867. --
  6868. -- if (!ieee80211_is_mgmt(hdr->frame_control))
  6869. -- return RX_CONTINUE;
  6870. --
  6871. -- /* management frames are already linear */
  6872. --
  6873. -- if (skb->len < 24 + sizeof(*mmie))
  6874. -- return RX_DROP_UNUSABLE;
  6875. --
  6876. -- mmie = (struct ieee80211_mmie_16 *)
  6877. -- (skb->data + skb->len - sizeof(*mmie));
  6878. -- if (mmie->element_id != WLAN_EID_MMIE ||
  6879. -- mmie->length != sizeof(*mmie) - 2)
  6880. -- return RX_DROP_UNUSABLE; /* Invalid MMIE */
  6881. --
  6882. -- bip_ipn_swap(ipn, mmie->sequence_number);
  6883. --
  6884. -- if (memcmp(ipn, key->u.aes_cmac.rx_pn, 6) <= 0) {
  6885. -- key->u.aes_cmac.replays++;
  6886. -- return RX_DROP_UNUSABLE;
  6887. -- }
  6888. --
  6889. -- if (!(status->flag & RX_FLAG_DECRYPTED)) {
  6890. -- /* hardware didn't decrypt/verify MIC */
  6891. -- bip_aad(skb, aad);
  6892. -- ieee80211_aes_cmac_256(key->u.aes_cmac.tfm, aad,
  6893. -- skb->data + 24, skb->len - 24, mic);
  6894. -- if (memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) {
  6895. -- key->u.aes_cmac.icverrors++;
  6896. -- return RX_DROP_UNUSABLE;
  6897. -- }
  6898. -- }
  6899. --
  6900. -- memcpy(key->u.aes_cmac.rx_pn, ipn, 6);
  6901. --
  6902. -- /* Remove MMIE */
  6903. -- skb_trim(skb, skb->len - sizeof(*mmie));
  6904. --
  6905. -- return RX_CONTINUE;
  6906. --}
  6907. --
  6908. --ieee80211_tx_result
  6909. --ieee80211_crypto_aes_gmac_encrypt(struct ieee80211_tx_data *tx)
  6910. --{
  6911. -- struct sk_buff *skb;
  6912. -- struct ieee80211_tx_info *info;
  6913. -- struct ieee80211_key *key = tx->key;
  6914. -- struct ieee80211_mmie_16 *mmie;
  6915. -- struct ieee80211_hdr *hdr;
  6916. -- u8 aad[20];
  6917. -- u64 pn64;
  6918. -- u8 nonce[12];
  6919. --
  6920. -- if (WARN_ON(skb_queue_len(&tx->skbs) != 1))
  6921. -- return TX_DROP;
  6922. --
  6923. -- skb = skb_peek(&tx->skbs);
  6924. --
  6925. -- info = IEEE80211_SKB_CB(skb);
  6926. --
  6927. -- if (info->control.hw_key)
  6928. -- return TX_CONTINUE;
  6929. --
  6930. -- if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie)))
  6931. -- return TX_DROP;
  6932. --
  6933. -- mmie = (struct ieee80211_mmie_16 *)skb_put(skb, sizeof(*mmie));
  6934. -- mmie->element_id = WLAN_EID_MMIE;
  6935. -- mmie->length = sizeof(*mmie) - 2;
  6936. -- mmie->key_id = cpu_to_le16(key->conf.keyidx);
  6937. --
  6938. -- /* PN = PN + 1 */
  6939. -- pn64 = atomic64_inc_return(&key->u.aes_gmac.tx_pn);
  6940. --
  6941. -- bip_ipn_set64(mmie->sequence_number, pn64);
  6942. --
  6943. -- bip_aad(skb, aad);
  6944. --
  6945. -- hdr = (struct ieee80211_hdr *)skb->data;
  6946. -- memcpy(nonce, hdr->addr2, ETH_ALEN);
  6947. -- bip_ipn_swap(nonce + ETH_ALEN, mmie->sequence_number);
  6948. --
  6949. -- /* MIC = AES-GMAC(IGTK, AAD || Management Frame Body || MMIE, 128) */
  6950. -- if (ieee80211_aes_gmac(key->u.aes_gmac.tfm, aad, nonce,
  6951. -- skb->data + 24, skb->len - 24, mmie->mic) < 0)
  6952. -- return TX_DROP;
  6953. --
  6954. -- return TX_CONTINUE;
  6955. --}
  6956. --
  6957. --ieee80211_rx_result
  6958. --ieee80211_crypto_aes_gmac_decrypt(struct ieee80211_rx_data *rx)
  6959. --{
  6960. -- struct sk_buff *skb = rx->skb;
  6961. -- struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
  6962. -- struct ieee80211_key *key = rx->key;
  6963. -- struct ieee80211_mmie_16 *mmie;
  6964. -- u8 aad[20], mic[16], ipn[6], nonce[12];
  6965. -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  6966. --
  6967. -- if (!ieee80211_is_mgmt(hdr->frame_control))
  6968. -- return RX_CONTINUE;
  6969. --
  6970. -- /* management frames are already linear */
  6971. --
  6972. -- if (skb->len < 24 + sizeof(*mmie))
  6973. -- return RX_DROP_UNUSABLE;
  6974. --
  6975. -- mmie = (struct ieee80211_mmie_16 *)
  6976. -- (skb->data + skb->len - sizeof(*mmie));
  6977. -- if (mmie->element_id != WLAN_EID_MMIE ||
  6978. -- mmie->length != sizeof(*mmie) - 2)
  6979. -- return RX_DROP_UNUSABLE; /* Invalid MMIE */
  6980. --
  6981. -- bip_ipn_swap(ipn, mmie->sequence_number);
  6982. --
  6983. -- if (memcmp(ipn, key->u.aes_gmac.rx_pn, 6) <= 0) {
  6984. -- key->u.aes_gmac.replays++;
  6985. -- return RX_DROP_UNUSABLE;
  6986. -- }
  6987. --
  6988. -- if (!(status->flag & RX_FLAG_DECRYPTED)) {
  6989. -- /* hardware didn't decrypt/verify MIC */
  6990. -- bip_aad(skb, aad);
  6991. --
  6992. -- memcpy(nonce, hdr->addr2, ETH_ALEN);
  6993. -- memcpy(nonce + ETH_ALEN, ipn, 6);
  6994. --
  6995. -- if (ieee80211_aes_gmac(key->u.aes_gmac.tfm, aad, nonce,
  6996. -- skb->data + 24, skb->len - 24,
  6997. -- mic) < 0 ||
  6998. -- memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) {
  6999. -- key->u.aes_gmac.icverrors++;
  7000. -- return RX_DROP_UNUSABLE;
  7001. -- }
  7002. -- }
  7003. --
  7004. -- memcpy(key->u.aes_gmac.rx_pn, ipn, 6);
  7005. --
  7006. -- /* Remove MMIE */
  7007. -- skb_trim(skb, skb->len - sizeof(*mmie));
  7008. -
  7009. - return RX_CONTINUE;
  7010. - }
  7011. ---- a/net/mac80211/wpa.h
  7012. -+++ b/net/mac80211/wpa.h
  7013. -@@ -24,32 +24,17 @@ ieee80211_rx_result
  7014. - ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx);
  7015. -
  7016. - ieee80211_tx_result
  7017. --ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx,
  7018. -- unsigned int mic_len);
  7019. -+ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx);
  7020. - ieee80211_rx_result
  7021. --ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx,
  7022. -- unsigned int mic_len);
  7023. -+ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx);
  7024. -
  7025. - ieee80211_tx_result
  7026. - ieee80211_crypto_aes_cmac_encrypt(struct ieee80211_tx_data *tx);
  7027. --ieee80211_tx_result
  7028. --ieee80211_crypto_aes_cmac_256_encrypt(struct ieee80211_tx_data *tx);
  7029. - ieee80211_rx_result
  7030. - ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx);
  7031. --ieee80211_rx_result
  7032. --ieee80211_crypto_aes_cmac_256_decrypt(struct ieee80211_rx_data *rx);
  7033. --ieee80211_tx_result
  7034. --ieee80211_crypto_aes_gmac_encrypt(struct ieee80211_tx_data *tx);
  7035. --ieee80211_rx_result
  7036. --ieee80211_crypto_aes_gmac_decrypt(struct ieee80211_rx_data *rx);
  7037. - ieee80211_tx_result
  7038. - ieee80211_crypto_hw_encrypt(struct ieee80211_tx_data *tx);
  7039. - ieee80211_rx_result
  7040. - ieee80211_crypto_hw_decrypt(struct ieee80211_rx_data *rx);
  7041. -
  7042. --ieee80211_tx_result
  7043. --ieee80211_crypto_gcmp_encrypt(struct ieee80211_tx_data *tx);
  7044. --ieee80211_rx_result
  7045. --ieee80211_crypto_gcmp_decrypt(struct ieee80211_rx_data *rx);
  7046. --
  7047. - #endif /* WPA_H */
  7048. 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
  7049. index 41a3c4f..d1d9fbd 100644
  7050. --- a/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
  7051. +++ b/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
  7052. @@ -2,7 +2,7 @@ Used for AP+STA support in OpenWrt - preserve AP mode keys across STA reconnects
  7053. --- a/net/mac80211/cfg.c
  7054. +++ b/net/mac80211/cfg.c
  7055. -@@ -856,7 +856,6 @@ static int ieee80211_stop_ap(struct wiph
  7056. +@@ -846,7 +846,6 @@ static int ieee80211_stop_ap(struct wiph
  7057. sdata->u.ap.driver_smps_mode = IEEE80211_SMPS_OFF;
  7058. __sta_info_flush(sdata, true);
  7059. diff --git a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  7060. index de79bd2..2855a88 100644
  7061. --- a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  7062. +++ b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  7063. @@ -1,6 +1,6 @@
  7064. --- a/net/mac80211/main.c
  7065. +++ b/net/mac80211/main.c
  7066. -@@ -287,7 +287,7 @@ void ieee80211_restart_hw(struct ieee802
  7067. +@@ -291,7 +291,7 @@ void ieee80211_restart_hw(struct ieee802
  7068. }
  7069. EXPORT_SYMBOL(ieee80211_restart_hw);
  7070. @@ -9,7 +9,7 @@
  7071. static int ieee80211_ifa_changed(struct notifier_block *nb,
  7072. unsigned long data, void *arg)
  7073. {
  7074. -@@ -346,7 +346,7 @@ static int ieee80211_ifa_changed(struct
  7075. +@@ -350,7 +350,7 @@ static int ieee80211_ifa_changed(struct
  7076. }
  7077. #endif
  7078. @@ -18,9 +18,9 @@
  7079. static int ieee80211_ifa6_changed(struct notifier_block *nb,
  7080. unsigned long data, void *arg)
  7081. {
  7082. -@@ -1057,14 +1057,14 @@ int ieee80211_register_hw(struct ieee802
  7083. - if (result)
  7084. - goto fail_pm_qos;
  7085. +@@ -1087,14 +1087,14 @@ int ieee80211_register_hw(struct ieee802
  7086. +
  7087. + rtnl_unlock();
  7088. -#ifdef CONFIG_INET
  7089. +#ifdef __disabled__CONFIG_INET
  7090. @@ -35,7 +35,7 @@
  7091. local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed;
  7092. result = register_inet6addr_notifier(&local->ifa6_notifier);
  7093. if (result)
  7094. -@@ -1073,13 +1073,13 @@ int ieee80211_register_hw(struct ieee802
  7095. +@@ -1103,13 +1103,13 @@ int ieee80211_register_hw(struct ieee802
  7096. return 0;
  7097. @@ -50,12 +50,12 @@
  7098. -#if defined(CONFIG_INET) || defined(CONFIG_IPV6)
  7099. +#if defined(__disabled__CONFIG_INET) || defined(__disabled__CONFIG_IPV6)
  7100. fail_ifa:
  7101. - pm_qos_remove_notifier(PM_QOS_NETWORK_LATENCY,
  7102. - &local->network_latency_notifier);
  7103. -@@ -1124,10 +1124,10 @@ void ieee80211_unregister_hw(struct ieee
  7104. + #endif
  7105. + rtnl_lock();
  7106. +@@ -1137,10 +1137,10 @@ void ieee80211_unregister_hw(struct ieee
  7107. + tasklet_kill(&local->tx_pending_tasklet);
  7108. + tasklet_kill(&local->tasklet);
  7109. - pm_qos_remove_notifier(PM_QOS_NETWORK_LATENCY,
  7110. - &local->network_latency_notifier);
  7111. -#ifdef CONFIG_INET
  7112. +#ifdef __disabled__CONFIG_INET
  7113. unregister_inetaddr_notifier(&local->ifa_notifier);
  7114. diff --git a/package/kernel/mac80211/patches/210-ap_scan.patch b/package/kernel/mac80211/patches/210-ap_scan.patch
  7115. index 47dcec3..a99cbd2 100644
  7116. --- a/package/kernel/mac80211/patches/210-ap_scan.patch
  7117. +++ b/package/kernel/mac80211/patches/210-ap_scan.patch
  7118. @@ -1,6 +1,6 @@
  7119. --- a/net/mac80211/cfg.c
  7120. +++ b/net/mac80211/cfg.c
  7121. -@@ -1963,7 +1963,7 @@ static int ieee80211_scan(struct wiphy *
  7122. +@@ -1999,7 +1999,7 @@ static int ieee80211_scan(struct wiphy *
  7123. * the frames sent while scanning on other channel will be
  7124. * lost)
  7125. */
  7126. 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
  7127. new file mode 100644
  7128. index 0000000..bddb15a
  7129. --- /dev/null
  7130. +++ b/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch
  7131. @@ -0,0 +1,31 @@
  7132. +From: Felix Fietkau <nbd@openwrt.org>
  7133. +Date: Sun, 7 Jun 2015 13:53:35 +0200
  7134. +Subject: [PATCH] ath9k: force rx_clear when disabling rx
  7135. +
  7136. +This makes stopping Rx more reliable and should reduce the frequency of
  7137. +Rx related DMA stop warnings
  7138. +
  7139. +Cc: stable@vger.kernel.org
  7140. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  7141. +---
  7142. +
  7143. +--- a/drivers/net/wireless/ath/ath9k/mac.c
  7144. ++++ b/drivers/net/wireless/ath/ath9k/mac.c
  7145. +@@ -677,13 +677,15 @@ void ath9k_hw_startpcureceive(struct ath
  7146. +
  7147. + ath9k_ani_reset(ah, is_scanning);
  7148. +
  7149. +- REG_CLR_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT));
  7150. ++ REG_CLR_BIT(ah, AR_DIAG_SW,
  7151. ++ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  7152. + }
  7153. + EXPORT_SYMBOL(ath9k_hw_startpcureceive);
  7154. +
  7155. + void ath9k_hw_abortpcurecv(struct ath_hw *ah)
  7156. + {
  7157. +- REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_ABORT | AR_DIAG_RX_DIS);
  7158. ++ REG_SET_BIT(ah, AR_DIAG_SW,
  7159. ++ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  7160. +
  7161. + ath9k_hw_disable_mib_counters(ah);
  7162. + }
  7163. 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
  7164. deleted file mode 100644
  7165. index 237121b..0000000
  7166. --- a/package/kernel/mac80211/patches/300-mac80211-add-an-intermediate-software-queue-implemen.patch
  7167. +++ /dev/null
  7168. @@ -1,882 +0,0 @@
  7169. -From: Felix Fietkau <nbd@openwrt.org>
  7170. -Date: Tue, 18 Nov 2014 23:58:51 +0100
  7171. -Subject: [PATCH] mac80211: add an intermediate software queue implementation
  7172. -
  7173. -This allows drivers to request per-vif and per-sta-tid queues from which
  7174. -they can pull frames. This makes it easier to keep the hardware queues
  7175. -short, and to improve fairness between clients and vifs.
  7176. -
  7177. -The task of scheduling packet transmission is left up to the driver -
  7178. -queueing is controlled by mac80211. Drivers can only dequeue packets by
  7179. -calling ieee80211_tx_dequeue. This makes it possible to add active queue
  7180. -management later without changing drivers using this code.
  7181. -
  7182. -This can also be used as a starting point to implement A-MSDU
  7183. -aggregation in a way that does not add artificially induced latency.
  7184. -
  7185. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  7186. ----
  7187. -
  7188. ---- a/include/net/mac80211.h
  7189. -+++ b/include/net/mac80211.h
  7190. -@@ -84,6 +84,39 @@
  7191. - *
  7192. - */
  7193. -
  7194. -+/**
  7195. -+ * DOC: mac80211 software tx queueing
  7196. -+ *
  7197. -+ * mac80211 provides an optional intermediate queueing implementation designed
  7198. -+ * to allow the driver to keep hardware queues short and provide some fairness
  7199. -+ * between different stations/interfaces.
  7200. -+ * In this model, the driver pulls data frames from the mac80211 queue instead
  7201. -+ * of letting mac80211 push them via drv_tx().
  7202. -+ * Other frames (e.g. control or management) are still pushed using drv_tx().
  7203. -+ *
  7204. -+ * Drivers indicate that they use this model by implementing the .wake_tx_queue
  7205. -+ * driver operation.
  7206. -+ *
  7207. -+ * Intermediate queues (struct ieee80211_txq) are kept per-sta per-tid, with a
  7208. -+ * single per-vif queue for multicast data frames.
  7209. -+ *
  7210. -+ * The driver is expected to initialize its private per-queue data for stations
  7211. -+ * and interfaces in the .add_interface and .sta_add ops.
  7212. -+ *
  7213. -+ * The driver can't access the queue directly. To dequeue a frame, it calls
  7214. -+ * ieee80211_tx_dequeue(). Whenever mac80211 adds a new frame to a queue, it
  7215. -+ * calls the .wake_tx_queue driver op.
  7216. -+ *
  7217. -+ * For AP powersave TIM handling, the driver only needs to indicate if it has
  7218. -+ * buffered packets in the driver specific data structures by calling
  7219. -+ * ieee80211_sta_set_buffered(). For frames buffered in the ieee80211_txq
  7220. -+ * struct, mac80211 sets the appropriate TIM PVB bits and calls
  7221. -+ * .release_buffered_frames().
  7222. -+ * In that callback the driver is therefore expected to release its own
  7223. -+ * buffered frames and afterwards also frames from the ieee80211_txq (obtained
  7224. -+ * via the usual ieee80211_tx_dequeue).
  7225. -+ */
  7226. -+
  7227. - struct device;
  7228. -
  7229. - /**
  7230. -@@ -1246,6 +1279,7 @@ enum ieee80211_vif_flags {
  7231. - * monitor interface (if that is requested.)
  7232. - * @drv_priv: data area for driver use, will always be aligned to
  7233. - * sizeof(void *).
  7234. -+ * @txq: the multicast data TX queue (if driver uses the TXQ abstraction)
  7235. - */
  7236. - struct ieee80211_vif {
  7237. - enum nl80211_iftype type;
  7238. -@@ -1257,6 +1291,8 @@ struct ieee80211_vif {
  7239. - u8 cab_queue;
  7240. - u8 hw_queue[IEEE80211_NUM_ACS];
  7241. -
  7242. -+ struct ieee80211_txq *txq;
  7243. -+
  7244. - struct ieee80211_chanctx_conf __rcu *chanctx_conf;
  7245. -
  7246. - u32 driver_flags;
  7247. -@@ -1501,6 +1537,7 @@ struct ieee80211_sta_rates {
  7248. - * @tdls_initiator: indicates the STA is an initiator of the TDLS link. Only
  7249. - * valid if the STA is a TDLS peer in the first place.
  7250. - * @mfp: indicates whether the STA uses management frame protection or not.
  7251. -+ * @txq: per-TID data TX queues (if driver uses the TXQ abstraction)
  7252. - */
  7253. - struct ieee80211_sta {
  7254. - u32 supp_rates[IEEE80211_NUM_BANDS];
  7255. -@@ -1519,6 +1556,8 @@ struct ieee80211_sta {
  7256. - bool tdls_initiator;
  7257. - bool mfp;
  7258. -
  7259. -+ struct ieee80211_txq *txq[IEEE80211_NUM_TIDS];
  7260. -+
  7261. - /* must be last */
  7262. - u8 drv_priv[0] __aligned(sizeof(void *));
  7263. - };
  7264. -@@ -1547,6 +1586,27 @@ struct ieee80211_tx_control {
  7265. - };
  7266. -
  7267. - /**
  7268. -+ * struct ieee80211_txq - Software intermediate tx queue
  7269. -+ *
  7270. -+ * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  7271. -+ * @sta: station table entry, %NULL for per-vif queue
  7272. -+ * @tid: the TID for this queue (unused for per-vif queue)
  7273. -+ * @ac: the AC for this queue
  7274. -+ *
  7275. -+ * The driver can obtain packets from this queue by calling
  7276. -+ * ieee80211_tx_dequeue().
  7277. -+ */
  7278. -+struct ieee80211_txq {
  7279. -+ struct ieee80211_vif *vif;
  7280. -+ struct ieee80211_sta *sta;
  7281. -+ u8 tid;
  7282. -+ u8 ac;
  7283. -+
  7284. -+ /* must be last */
  7285. -+ u8 drv_priv[0] __aligned(sizeof(void *));
  7286. -+};
  7287. -+
  7288. -+/**
  7289. - * enum ieee80211_hw_flags - hardware flags
  7290. - *
  7291. - * These flags are used to indicate hardware capabilities to
  7292. -@@ -1770,6 +1830,8 @@ enum ieee80211_hw_flags {
  7293. - * within &struct ieee80211_sta.
  7294. - * @chanctx_data_size: size (in bytes) of the drv_priv data area
  7295. - * within &struct ieee80211_chanctx_conf.
  7296. -+ * @txq_data_size: size (in bytes) of the drv_priv data area
  7297. -+ * within @struct ieee80211_txq.
  7298. - *
  7299. - * @max_rates: maximum number of alternate rate retry stages the hw
  7300. - * can handle.
  7301. -@@ -1818,6 +1880,9 @@ enum ieee80211_hw_flags {
  7302. - * @n_cipher_schemes: a size of an array of cipher schemes definitions.
  7303. - * @cipher_schemes: a pointer to an array of cipher scheme definitions
  7304. - * supported by HW.
  7305. -+ *
  7306. -+ * @txq_ac_max_pending: maximum number of frames per AC pending in all txq
  7307. -+ * entries for a vif.
  7308. - */
  7309. - struct ieee80211_hw {
  7310. - struct ieee80211_conf conf;
  7311. -@@ -1830,6 +1895,7 @@ struct ieee80211_hw {
  7312. - int vif_data_size;
  7313. - int sta_data_size;
  7314. - int chanctx_data_size;
  7315. -+ int txq_data_size;
  7316. - u16 queues;
  7317. - u16 max_listen_interval;
  7318. - s8 max_signal;
  7319. -@@ -1846,6 +1912,7 @@ struct ieee80211_hw {
  7320. - u8 uapsd_max_sp_len;
  7321. - u8 n_cipher_schemes;
  7322. - const struct ieee80211_cipher_scheme *cipher_schemes;
  7323. -+ int txq_ac_max_pending;
  7324. - };
  7325. -
  7326. - /**
  7327. -@@ -3007,6 +3074,8 @@ enum ieee80211_reconfig_type {
  7328. - * response template is provided, together with the location of the
  7329. - * switch-timing IE within the template. The skb can only be used within
  7330. - * the function call.
  7331. -+ *
  7332. -+ * @wake_tx_queue: Called when new packets have been added to the queue.
  7333. - */
  7334. - struct ieee80211_ops {
  7335. - void (*tx)(struct ieee80211_hw *hw,
  7336. -@@ -3238,6 +3307,9 @@ struct ieee80211_ops {
  7337. - void (*tdls_recv_channel_switch)(struct ieee80211_hw *hw,
  7338. - struct ieee80211_vif *vif,
  7339. - struct ieee80211_tdls_ch_sw_params *params);
  7340. -+
  7341. -+ void (*wake_tx_queue)(struct ieee80211_hw *hw,
  7342. -+ struct ieee80211_txq *txq);
  7343. - };
  7344. -
  7345. - /**
  7346. -@@ -5249,4 +5321,15 @@ void ieee80211_unreserve_tid(struct ieee
  7347. - */
  7348. - size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
  7349. - const u8 *ids, int n_ids, size_t offset);
  7350. -+
  7351. -+/**
  7352. -+ * ieee80211_tx_dequeue - dequeue a packet from a software tx queue
  7353. -+ *
  7354. -+ * @hw: pointer as obtained from ieee80211_alloc_hw()
  7355. -+ * @txq: pointer obtained from station or virtual interface
  7356. -+ *
  7357. -+ * Returns the skb if successful, %NULL if no frame was available.
  7358. -+ */
  7359. -+struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
  7360. -+ struct ieee80211_txq *txq);
  7361. - #endif /* MAC80211_H */
  7362. ---- a/net/mac80211/driver-ops.h
  7363. -+++ b/net/mac80211/driver-ops.h
  7364. -@@ -1367,4 +1367,16 @@ drv_tdls_recv_channel_switch(struct ieee
  7365. - trace_drv_return_void(local);
  7366. - }
  7367. -
  7368. -+static inline void drv_wake_tx_queue(struct ieee80211_local *local,
  7369. -+ struct txq_info *txq)
  7370. -+{
  7371. -+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->txq.vif);
  7372. -+
  7373. -+ if (!check_sdata_in_driver(sdata))
  7374. -+ return;
  7375. -+
  7376. -+ trace_drv_wake_tx_queue(local, sdata, txq);
  7377. -+ local->ops->wake_tx_queue(&local->hw, &txq->txq);
  7378. -+}
  7379. -+
  7380. - #endif /* __MAC80211_DRIVER_OPS */
  7381. ---- a/net/mac80211/ieee80211_i.h
  7382. -+++ b/net/mac80211/ieee80211_i.h
  7383. -@@ -809,6 +809,19 @@ struct mac80211_qos_map {
  7384. - struct rcu_head rcu_head;
  7385. - };
  7386. -
  7387. -+enum txq_info_flags {
  7388. -+ IEEE80211_TXQ_STOP,
  7389. -+ IEEE80211_TXQ_AMPDU,
  7390. -+};
  7391. -+
  7392. -+struct txq_info {
  7393. -+ struct sk_buff_head queue;
  7394. -+ unsigned long flags;
  7395. -+
  7396. -+ /* keep last! */
  7397. -+ struct ieee80211_txq txq;
  7398. -+};
  7399. -+
  7400. - struct ieee80211_sub_if_data {
  7401. - struct list_head list;
  7402. -
  7403. -@@ -853,6 +866,7 @@ struct ieee80211_sub_if_data {
  7404. - bool control_port_no_encrypt;
  7405. - int encrypt_headroom;
  7406. -
  7407. -+ atomic_t txqs_len[IEEE80211_NUM_ACS];
  7408. - struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS];
  7409. - struct mac80211_qos_map __rcu *qos_map;
  7410. -
  7411. -@@ -1453,6 +1467,10 @@ static inline struct ieee80211_local *hw
  7412. - return container_of(hw, struct ieee80211_local, hw);
  7413. - }
  7414. -
  7415. -+static inline struct txq_info *to_txq_info(struct ieee80211_txq *txq)
  7416. -+{
  7417. -+ return container_of(txq, struct txq_info, txq);
  7418. -+}
  7419. -
  7420. - static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr)
  7421. - {
  7422. -@@ -1905,6 +1923,9 @@ static inline bool ieee80211_can_run_wor
  7423. - return true;
  7424. - }
  7425. -
  7426. -+void ieee80211_init_tx_queue(struct ieee80211_sub_if_data *sdata,
  7427. -+ struct sta_info *sta,
  7428. -+ struct txq_info *txq, int tid);
  7429. - void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
  7430. - u16 transaction, u16 auth_alg, u16 status,
  7431. - const u8 *extra, size_t extra_len, const u8 *bssid,
  7432. ---- a/net/mac80211/iface.c
  7433. -+++ b/net/mac80211/iface.c
  7434. -@@ -969,6 +969,13 @@ static void ieee80211_do_stop(struct iee
  7435. - }
  7436. - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
  7437. -
  7438. -+ if (sdata->vif.txq) {
  7439. -+ struct txq_info *txqi = to_txq_info(sdata->vif.txq);
  7440. -+
  7441. -+ ieee80211_purge_tx_queue(&local->hw, &txqi->queue);
  7442. -+ atomic_set(&sdata->txqs_len[txqi->txq.ac], 0);
  7443. -+ }
  7444. -+
  7445. - if (local->open_count == 0)
  7446. - ieee80211_clear_tx_pending(local);
  7447. -
  7448. -@@ -1674,6 +1681,7 @@ int ieee80211_if_add(struct ieee80211_lo
  7449. - {
  7450. - struct net_device *ndev = NULL;
  7451. - struct ieee80211_sub_if_data *sdata = NULL;
  7452. -+ struct txq_info *txqi;
  7453. - int ret, i;
  7454. - int txqs = 1;
  7455. -
  7456. -@@ -1693,10 +1701,18 @@ int ieee80211_if_add(struct ieee80211_lo
  7457. - ieee80211_assign_perm_addr(local, wdev->address, type);
  7458. - memcpy(sdata->vif.addr, wdev->address, ETH_ALEN);
  7459. - } else {
  7460. -+ int size = ALIGN(sizeof(*sdata) + local->hw.vif_data_size,
  7461. -+ sizeof(void *));
  7462. -+ int txq_size = 0;
  7463. -+
  7464. -+ if (local->ops->wake_tx_queue)
  7465. -+ txq_size += sizeof(struct txq_info) +
  7466. -+ local->hw.txq_data_size;
  7467. -+
  7468. - if (local->hw.queues >= IEEE80211_NUM_ACS)
  7469. - txqs = IEEE80211_NUM_ACS;
  7470. -
  7471. -- ndev = alloc_netdev_mqs(sizeof(*sdata) + local->hw.vif_data_size,
  7472. -+ ndev = alloc_netdev_mqs(size + txq_size,
  7473. - name, NET_NAME_UNKNOWN,
  7474. - ieee80211_if_setup, txqs, 1);
  7475. - if (!ndev)
  7476. -@@ -1731,6 +1747,11 @@ int ieee80211_if_add(struct ieee80211_lo
  7477. - memcpy(sdata->vif.addr, ndev->dev_addr, ETH_ALEN);
  7478. - memcpy(sdata->name, ndev->name, IFNAMSIZ);
  7479. -
  7480. -+ if (txq_size) {
  7481. -+ txqi = netdev_priv(ndev) + size;
  7482. -+ ieee80211_init_tx_queue(sdata, NULL, txqi, 0);
  7483. -+ }
  7484. -+
  7485. - sdata->dev = ndev;
  7486. - }
  7487. -
  7488. ---- a/net/mac80211/main.c
  7489. -+++ b/net/mac80211/main.c
  7490. -@@ -1019,6 +1019,9 @@ int ieee80211_register_hw(struct ieee802
  7491. -
  7492. - local->dynamic_ps_forced_timeout = -1;
  7493. -
  7494. -+ if (!local->hw.txq_ac_max_pending)
  7495. -+ local->hw.txq_ac_max_pending = 64;
  7496. -+
  7497. - result = ieee80211_wep_init(local);
  7498. - if (result < 0)
  7499. - wiphy_debug(local->hw.wiphy, "Failed to initialize wep: %d\n",
  7500. ---- a/net/mac80211/sta_info.c
  7501. -+++ b/net/mac80211/sta_info.c
  7502. -@@ -118,6 +118,16 @@ static void __cleanup_single_sta(struct
  7503. - atomic_dec(&ps->num_sta_ps);
  7504. - }
  7505. -
  7506. -+ if (sta->sta.txq[0]) {
  7507. -+ for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) {
  7508. -+ struct txq_info *txqi = to_txq_info(sta->sta.txq[i]);
  7509. -+ int n = skb_queue_len(&txqi->queue);
  7510. -+
  7511. -+ ieee80211_purge_tx_queue(&local->hw, &txqi->queue);
  7512. -+ atomic_sub(n, &sdata->txqs_len[txqi->txq.ac]);
  7513. -+ }
  7514. -+ }
  7515. -+
  7516. - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
  7517. - local->total_ps_buffered -= skb_queue_len(&sta->ps_tx_buf[ac]);
  7518. - ieee80211_purge_tx_queue(&local->hw, &sta->ps_tx_buf[ac]);
  7519. -@@ -234,6 +244,8 @@ void sta_info_free(struct ieee80211_loca
  7520. -
  7521. - sta_dbg(sta->sdata, "Destroyed STA %pM\n", sta->sta.addr);
  7522. -
  7523. -+ if (sta->sta.txq[0])
  7524. -+ kfree(to_txq_info(sta->sta.txq[0]));
  7525. - kfree(rcu_dereference_raw(sta->sta.rates));
  7526. - kfree(sta);
  7527. - }
  7528. -@@ -285,11 +297,12 @@ struct sta_info *sta_info_alloc(struct i
  7529. - const u8 *addr, gfp_t gfp)
  7530. - {
  7531. - struct ieee80211_local *local = sdata->local;
  7532. -+ struct ieee80211_hw *hw = &local->hw;
  7533. - struct sta_info *sta;
  7534. - struct timespec uptime;
  7535. - int i;
  7536. -
  7537. -- sta = kzalloc(sizeof(*sta) + local->hw.sta_data_size, gfp);
  7538. -+ sta = kzalloc(sizeof(*sta) + hw->sta_data_size, gfp);
  7539. - if (!sta)
  7540. - return NULL;
  7541. -
  7542. -@@ -321,11 +334,25 @@ struct sta_info *sta_info_alloc(struct i
  7543. - for (i = 0; i < ARRAY_SIZE(sta->chain_signal_avg); i++)
  7544. - ewma_init(&sta->chain_signal_avg[i], 1024, 8);
  7545. -
  7546. -- if (sta_prepare_rate_control(local, sta, gfp)) {
  7547. -- kfree(sta);
  7548. -- return NULL;
  7549. -+ if (local->ops->wake_tx_queue) {
  7550. -+ void *txq_data;
  7551. -+ int size = sizeof(struct txq_info) +
  7552. -+ ALIGN(hw->txq_data_size, sizeof(void *));
  7553. -+
  7554. -+ txq_data = kcalloc(ARRAY_SIZE(sta->sta.txq), size, gfp);
  7555. -+ if (!txq_data)
  7556. -+ goto free;
  7557. -+
  7558. -+ for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) {
  7559. -+ struct txq_info *txq = txq_data + i * size;
  7560. -+
  7561. -+ ieee80211_init_tx_queue(sdata, sta, txq, i);
  7562. -+ }
  7563. - }
  7564. -
  7565. -+ if (sta_prepare_rate_control(local, sta, gfp))
  7566. -+ goto free_txq;
  7567. -+
  7568. - for (i = 0; i < IEEE80211_NUM_TIDS; i++) {
  7569. - /*
  7570. - * timer_to_tid must be initialized with identity mapping
  7571. -@@ -346,7 +373,7 @@ struct sta_info *sta_info_alloc(struct i
  7572. - if (sdata->vif.type == NL80211_IFTYPE_AP ||
  7573. - sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
  7574. - struct ieee80211_supported_band *sband =
  7575. -- local->hw.wiphy->bands[ieee80211_get_sdata_band(sdata)];
  7576. -+ hw->wiphy->bands[ieee80211_get_sdata_band(sdata)];
  7577. - u8 smps = (sband->ht_cap.cap & IEEE80211_HT_CAP_SM_PS) >>
  7578. - IEEE80211_HT_CAP_SM_PS_SHIFT;
  7579. - /*
  7580. -@@ -371,6 +398,13 @@ struct sta_info *sta_info_alloc(struct i
  7581. - sta_dbg(sdata, "Allocated STA %pM\n", sta->sta.addr);
  7582. -
  7583. - return sta;
  7584. -+
  7585. -+free_txq:
  7586. -+ if (sta->sta.txq[0])
  7587. -+ kfree(to_txq_info(sta->sta.txq[0]));
  7588. -+free:
  7589. -+ kfree(sta);
  7590. -+ return NULL;
  7591. - }
  7592. -
  7593. - static int sta_info_insert_check(struct sta_info *sta)
  7594. -@@ -640,6 +674,8 @@ static void __sta_info_recalc_tim(struct
  7595. -
  7596. - indicate_tim |=
  7597. - sta->driver_buffered_tids & tids;
  7598. -+ indicate_tim |=
  7599. -+ sta->txq_buffered_tids & tids;
  7600. - }
  7601. -
  7602. - done:
  7603. -@@ -1071,7 +1107,7 @@ void ieee80211_sta_ps_deliver_wakeup(str
  7604. - struct ieee80211_sub_if_data *sdata = sta->sdata;
  7605. - struct ieee80211_local *local = sdata->local;
  7606. - struct sk_buff_head pending;
  7607. -- int filtered = 0, buffered = 0, ac;
  7608. -+ int filtered = 0, buffered = 0, ac, i;
  7609. - unsigned long flags;
  7610. - struct ps_data *ps;
  7611. -
  7612. -@@ -1090,10 +1126,22 @@ void ieee80211_sta_ps_deliver_wakeup(str
  7613. -
  7614. - BUILD_BUG_ON(BITS_TO_LONGS(IEEE80211_NUM_TIDS) > 1);
  7615. - sta->driver_buffered_tids = 0;
  7616. -+ sta->txq_buffered_tids = 0;
  7617. -
  7618. - if (!(local->hw.flags & IEEE80211_HW_AP_LINK_PS))
  7619. - drv_sta_notify(local, sdata, STA_NOTIFY_AWAKE, &sta->sta);
  7620. -
  7621. -+ if (sta->sta.txq[0]) {
  7622. -+ for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) {
  7623. -+ struct txq_info *txqi = to_txq_info(sta->sta.txq[i]);
  7624. -+
  7625. -+ if (!skb_queue_len(&txqi->queue))
  7626. -+ continue;
  7627. -+
  7628. -+ drv_wake_tx_queue(local, txqi);
  7629. -+ }
  7630. -+ }
  7631. -+
  7632. - skb_queue_head_init(&pending);
  7633. -
  7634. - /* sync with ieee80211_tx_h_unicast_ps_buf */
  7635. -@@ -1275,8 +1323,10 @@ ieee80211_sta_ps_deliver_response(struct
  7636. - /* if we already have frames from software, then we can't also
  7637. - * release from hardware queues
  7638. - */
  7639. -- if (skb_queue_empty(&frames))
  7640. -+ if (skb_queue_empty(&frames)) {
  7641. - driver_release_tids |= sta->driver_buffered_tids & tids;
  7642. -+ driver_release_tids |= sta->txq_buffered_tids & tids;
  7643. -+ }
  7644. -
  7645. - if (driver_release_tids) {
  7646. - /* If the driver has data on more than one TID then
  7647. -@@ -1447,6 +1497,9 @@ ieee80211_sta_ps_deliver_response(struct
  7648. -
  7649. - sta_info_recalc_tim(sta);
  7650. - } else {
  7651. -+ unsigned long tids = sta->txq_buffered_tids & driver_release_tids;
  7652. -+ int tid;
  7653. -+
  7654. - /*
  7655. - * We need to release a frame that is buffered somewhere in the
  7656. - * driver ... it'll have to handle that.
  7657. -@@ -1466,8 +1519,22 @@ ieee80211_sta_ps_deliver_response(struct
  7658. - * that the TID(s) became empty before returning here from the
  7659. - * release function.
  7660. - * Either way, however, when the driver tells us that the TID(s)
  7661. -- * became empty we'll do the TIM recalculation.
  7662. -+ * became empty or we find that a txq became empty, we'll do the
  7663. -+ * TIM recalculation.
  7664. - */
  7665. -+
  7666. -+ if (!sta->sta.txq[0])
  7667. -+ return;
  7668. -+
  7669. -+ for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) {
  7670. -+ struct txq_info *txqi = to_txq_info(sta->sta.txq[tid]);
  7671. -+
  7672. -+ if (!(tids & BIT(tid)) || skb_queue_len(&txqi->queue))
  7673. -+ continue;
  7674. -+
  7675. -+ sta_info_recalc_tim(sta);
  7676. -+ break;
  7677. -+ }
  7678. - }
  7679. - }
  7680. -
  7681. ---- a/net/mac80211/sta_info.h
  7682. -+++ b/net/mac80211/sta_info.h
  7683. -@@ -274,6 +274,7 @@ struct sta_ampdu_mlme {
  7684. - * entered power saving state, these are also delivered to
  7685. - * the station when it leaves powersave or polls for frames
  7686. - * @driver_buffered_tids: bitmap of TIDs the driver has data buffered on
  7687. -+ * @txq_buffered_tids: bitmap of TIDs that mac80211 has txq data buffered on
  7688. - * @rx_packets: Number of MSDUs received from this STA
  7689. - * @rx_bytes: Number of bytes received from this STA
  7690. - * @last_rx: time (in jiffies) when last frame was received from this STA
  7691. -@@ -368,6 +369,7 @@ struct sta_info {
  7692. - struct sk_buff_head ps_tx_buf[IEEE80211_NUM_ACS];
  7693. - struct sk_buff_head tx_filtered[IEEE80211_NUM_ACS];
  7694. - unsigned long driver_buffered_tids;
  7695. -+ unsigned long txq_buffered_tids;
  7696. -
  7697. - /* Updated from RX path only, no locking requirements */
  7698. - unsigned long rx_packets;
  7699. ---- a/net/mac80211/trace.h
  7700. -+++ b/net/mac80211/trace.h
  7701. -@@ -2312,6 +2312,37 @@ TRACE_EVENT(drv_tdls_recv_channel_switch
  7702. - )
  7703. - );
  7704. -
  7705. -+TRACE_EVENT(drv_wake_tx_queue,
  7706. -+ TP_PROTO(struct ieee80211_local *local,
  7707. -+ struct ieee80211_sub_if_data *sdata,
  7708. -+ struct txq_info *txq),
  7709. -+
  7710. -+ TP_ARGS(local, sdata, txq),
  7711. -+
  7712. -+ TP_STRUCT__entry(
  7713. -+ LOCAL_ENTRY
  7714. -+ VIF_ENTRY
  7715. -+ STA_ENTRY
  7716. -+ __field(u8, ac)
  7717. -+ __field(u8, tid)
  7718. -+ ),
  7719. -+
  7720. -+ TP_fast_assign(
  7721. -+ struct ieee80211_sta *sta = txq->txq.sta;
  7722. -+
  7723. -+ LOCAL_ASSIGN;
  7724. -+ VIF_ASSIGN;
  7725. -+ STA_ASSIGN;
  7726. -+ __entry->ac = txq->txq.ac;
  7727. -+ __entry->tid = txq->txq.tid;
  7728. -+ ),
  7729. -+
  7730. -+ TP_printk(
  7731. -+ LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " ac:%d tid:%d",
  7732. -+ LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->ac, __entry->tid
  7733. -+ )
  7734. -+);
  7735. -+
  7736. - #ifdef CPTCFG_MAC80211_MESSAGE_TRACING
  7737. - #undef TRACE_SYSTEM
  7738. - #define TRACE_SYSTEM mac80211_msg
  7739. ---- a/net/mac80211/tx.c
  7740. -+++ b/net/mac80211/tx.c
  7741. -@@ -776,12 +776,22 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021
  7742. - return TX_CONTINUE;
  7743. - }
  7744. -
  7745. -+static __le16 ieee80211_tx_next_seq(struct sta_info *sta, int tid)
  7746. -+{
  7747. -+ u16 *seq = &sta->tid_seq[tid];
  7748. -+ __le16 ret = cpu_to_le16(*seq);
  7749. -+
  7750. -+ /* Increase the sequence number. */
  7751. -+ *seq = (*seq + 0x10) & IEEE80211_SCTL_SEQ;
  7752. -+
  7753. -+ return ret;
  7754. -+}
  7755. -+
  7756. - static ieee80211_tx_result debug_noinline
  7757. - ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx)
  7758. - {
  7759. - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
  7760. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
  7761. -- u16 *seq;
  7762. - u8 *qc;
  7763. - int tid;
  7764. -
  7765. -@@ -832,13 +842,10 @@ ieee80211_tx_h_sequence(struct ieee80211
  7766. -
  7767. - qc = ieee80211_get_qos_ctl(hdr);
  7768. - tid = *qc & IEEE80211_QOS_CTL_TID_MASK;
  7769. -- seq = &tx->sta->tid_seq[tid];
  7770. - tx->sta->tx_msdu[tid]++;
  7771. -
  7772. -- hdr->seq_ctrl = cpu_to_le16(*seq);
  7773. --
  7774. -- /* Increase the sequence number. */
  7775. -- *seq = (*seq + 0x10) & IEEE80211_SCTL_SEQ;
  7776. -+ if (!tx->sta->sta.txq[0])
  7777. -+ hdr->seq_ctrl = ieee80211_tx_next_seq(tx->sta, tid);
  7778. -
  7779. - return TX_CONTINUE;
  7780. - }
  7781. -@@ -1067,7 +1074,7 @@ static bool ieee80211_tx_prep_agg(struct
  7782. - * nothing -- this aggregation session is being started
  7783. - * but that might still fail with the driver
  7784. - */
  7785. -- } else {
  7786. -+ } else if (!tx->sta->sta.txq[tid]) {
  7787. - spin_lock(&tx->sta->lock);
  7788. - /*
  7789. - * Need to re-check now, because we may get here
  7790. -@@ -1201,13 +1208,102 @@ ieee80211_tx_prepare(struct ieee80211_su
  7791. - return TX_CONTINUE;
  7792. - }
  7793. -
  7794. -+static void ieee80211_drv_tx(struct ieee80211_local *local,
  7795. -+ struct ieee80211_vif *vif,
  7796. -+ struct ieee80211_sta *pubsta,
  7797. -+ struct sk_buff *skb)
  7798. -+{
  7799. -+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  7800. -+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
  7801. -+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  7802. -+ struct ieee80211_tx_control control = {
  7803. -+ .sta = pubsta,
  7804. -+ };
  7805. -+ struct ieee80211_txq *txq = NULL;
  7806. -+ struct txq_info *txqi;
  7807. -+ u8 ac;
  7808. -+
  7809. -+ if (info->control.flags & IEEE80211_TX_CTRL_PS_RESPONSE)
  7810. -+ goto tx_normal;
  7811. -+
  7812. -+ if (!ieee80211_is_data(hdr->frame_control))
  7813. -+ goto tx_normal;
  7814. -+
  7815. -+ if (pubsta) {
  7816. -+ u8 tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK;
  7817. -+
  7818. -+ txq = pubsta->txq[tid];
  7819. -+ } else if (vif) {
  7820. -+ txq = vif->txq;
  7821. -+ }
  7822. -+
  7823. -+ if (!txq)
  7824. -+ goto tx_normal;
  7825. -+
  7826. -+ ac = txq->ac;
  7827. -+ txqi = to_txq_info(txq);
  7828. -+ atomic_inc(&sdata->txqs_len[ac]);
  7829. -+ if (atomic_read(&sdata->txqs_len[ac]) >= local->hw.txq_ac_max_pending)
  7830. -+ netif_stop_subqueue(sdata->dev, ac);
  7831. -+
  7832. -+ skb_queue_tail(&txqi->queue, skb);
  7833. -+ drv_wake_tx_queue(local, txqi);
  7834. -+
  7835. -+ return;
  7836. -+
  7837. -+tx_normal:
  7838. -+ drv_tx(local, &control, skb);
  7839. -+}
  7840. -+
  7841. -+struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
  7842. -+ struct ieee80211_txq *txq)
  7843. -+{
  7844. -+ struct ieee80211_local *local = hw_to_local(hw);
  7845. -+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->vif);
  7846. -+ struct txq_info *txqi = container_of(txq, struct txq_info, txq);
  7847. -+ struct ieee80211_hdr *hdr;
  7848. -+ struct sk_buff *skb = NULL;
  7849. -+ u8 ac = txq->ac;
  7850. -+
  7851. -+ spin_lock_bh(&txqi->queue.lock);
  7852. -+
  7853. -+ if (test_bit(IEEE80211_TXQ_STOP, &txqi->flags))
  7854. -+ goto out;
  7855. -+
  7856. -+ skb = __skb_dequeue(&txqi->queue);
  7857. -+ if (!skb)
  7858. -+ goto out;
  7859. -+
  7860. -+ atomic_dec(&sdata->txqs_len[ac]);
  7861. -+ if (__netif_subqueue_stopped(sdata->dev, ac))
  7862. -+ ieee80211_propagate_queue_wake(local, sdata->vif.hw_queue[ac]);
  7863. -+
  7864. -+ hdr = (struct ieee80211_hdr *)skb->data;
  7865. -+ if (txq->sta && ieee80211_is_data_qos(hdr->frame_control)) {
  7866. -+ struct sta_info *sta = container_of(txq->sta, struct sta_info,
  7867. -+ sta);
  7868. -+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  7869. -+
  7870. -+ hdr->seq_ctrl = ieee80211_tx_next_seq(sta, txq->tid);
  7871. -+ if (test_bit(IEEE80211_TXQ_AMPDU, &txqi->flags))
  7872. -+ info->flags |= IEEE80211_TX_CTL_AMPDU;
  7873. -+ else
  7874. -+ info->flags &= ~IEEE80211_TX_CTL_AMPDU;
  7875. -+ }
  7876. -+
  7877. -+out:
  7878. -+ spin_unlock_bh(&txqi->queue.lock);
  7879. -+
  7880. -+ return skb;
  7881. -+}
  7882. -+EXPORT_SYMBOL(ieee80211_tx_dequeue);
  7883. -+
  7884. - static bool ieee80211_tx_frags(struct ieee80211_local *local,
  7885. - struct ieee80211_vif *vif,
  7886. - struct ieee80211_sta *sta,
  7887. - struct sk_buff_head *skbs,
  7888. - bool txpending)
  7889. - {
  7890. -- struct ieee80211_tx_control control;
  7891. - struct sk_buff *skb, *tmp;
  7892. - unsigned long flags;
  7893. -
  7894. -@@ -1265,10 +1361,9 @@ static bool ieee80211_tx_frags(struct ie
  7895. - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
  7896. -
  7897. - info->control.vif = vif;
  7898. -- control.sta = sta;
  7899. -
  7900. - __skb_unlink(skb, skbs);
  7901. -- drv_tx(local, &control, skb);
  7902. -+ ieee80211_drv_tx(local, vif, sta, skb);
  7903. - }
  7904. -
  7905. - return true;
  7906. ---- a/net/mac80211/util.c
  7907. -+++ b/net/mac80211/util.c
  7908. -@@ -308,6 +308,11 @@ void ieee80211_propagate_queue_wake(stru
  7909. - for (ac = 0; ac < n_acs; ac++) {
  7910. - int ac_queue = sdata->vif.hw_queue[ac];
  7911. -
  7912. -+ if (local->ops->wake_tx_queue &&
  7913. -+ (atomic_read(&sdata->txqs_len[ac]) >
  7914. -+ local->hw.txq_ac_max_pending))
  7915. -+ continue;
  7916. -+
  7917. - if (ac_queue == queue ||
  7918. - (sdata->vif.cab_queue == queue &&
  7919. - local->queue_stop_reasons[ac_queue] == 0 &&
  7920. -@@ -3307,3 +3312,20 @@ u8 *ieee80211_add_wmm_info_ie(u8 *buf, u
  7921. -
  7922. - return buf;
  7923. - }
  7924. -+
  7925. -+void ieee80211_init_tx_queue(struct ieee80211_sub_if_data *sdata,
  7926. -+ struct sta_info *sta,
  7927. -+ struct txq_info *txqi, int tid)
  7928. -+{
  7929. -+ skb_queue_head_init(&txqi->queue);
  7930. -+ txqi->txq.vif = &sdata->vif;
  7931. -+
  7932. -+ if (sta) {
  7933. -+ txqi->txq.sta = &sta->sta;
  7934. -+ sta->sta.txq[tid] = &txqi->txq;
  7935. -+ txqi->txq.ac = ieee802_1d_to_ac[tid & 7];
  7936. -+ } else {
  7937. -+ sdata->vif.txq = &txqi->txq;
  7938. -+ txqi->txq.ac = IEEE80211_AC_BE;
  7939. -+ }
  7940. -+}
  7941. ---- a/net/mac80211/rx.c
  7942. -+++ b/net/mac80211/rx.c
  7943. -@@ -1176,6 +1176,7 @@ static void sta_ps_start(struct sta_info
  7944. - struct ieee80211_sub_if_data *sdata = sta->sdata;
  7945. - struct ieee80211_local *local = sdata->local;
  7946. - struct ps_data *ps;
  7947. -+ int tid;
  7948. -
  7949. - if (sta->sdata->vif.type == NL80211_IFTYPE_AP ||
  7950. - sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
  7951. -@@ -1189,6 +1190,18 @@ static void sta_ps_start(struct sta_info
  7952. - drv_sta_notify(local, sdata, STA_NOTIFY_SLEEP, &sta->sta);
  7953. - ps_dbg(sdata, "STA %pM aid %d enters power save mode\n",
  7954. - sta->sta.addr, sta->sta.aid);
  7955. -+
  7956. -+ if (!sta->sta.txq[0])
  7957. -+ return;
  7958. -+
  7959. -+ for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) {
  7960. -+ struct txq_info *txqi = to_txq_info(sta->sta.txq[tid]);
  7961. -+
  7962. -+ if (!skb_queue_len(&txqi->queue))
  7963. -+ set_bit(tid, &sta->txq_buffered_tids);
  7964. -+ else
  7965. -+ clear_bit(tid, &sta->txq_buffered_tids);
  7966. -+ }
  7967. - }
  7968. -
  7969. - static void sta_ps_end(struct sta_info *sta)
  7970. ---- a/net/mac80211/agg-tx.c
  7971. -+++ b/net/mac80211/agg-tx.c
  7972. -@@ -188,6 +188,43 @@ ieee80211_wake_queue_agg(struct ieee8021
  7973. - __release(agg_queue);
  7974. - }
  7975. -
  7976. -+static void
  7977. -+ieee80211_agg_stop_txq(struct sta_info *sta, int tid)
  7978. -+{
  7979. -+ struct ieee80211_txq *txq = sta->sta.txq[tid];
  7980. -+ struct txq_info *txqi;
  7981. -+
  7982. -+ if (!txq)
  7983. -+ return;
  7984. -+
  7985. -+ txqi = to_txq_info(txq);
  7986. -+
  7987. -+ /* Lock here to protect against further seqno updates on dequeue */
  7988. -+ spin_lock_bh(&txqi->queue.lock);
  7989. -+ set_bit(IEEE80211_TXQ_STOP, &txqi->flags);
  7990. -+ spin_unlock_bh(&txqi->queue.lock);
  7991. -+}
  7992. -+
  7993. -+static void
  7994. -+ieee80211_agg_start_txq(struct sta_info *sta, int tid, bool enable)
  7995. -+{
  7996. -+ struct ieee80211_txq *txq = sta->sta.txq[tid];
  7997. -+ struct txq_info *txqi;
  7998. -+
  7999. -+ if (!txq)
  8000. -+ return;
  8001. -+
  8002. -+ txqi = to_txq_info(txq);
  8003. -+
  8004. -+ if (enable)
  8005. -+ set_bit(IEEE80211_TXQ_AMPDU, &txqi->flags);
  8006. -+ else
  8007. -+ clear_bit(IEEE80211_TXQ_AMPDU, &txqi->flags);
  8008. -+
  8009. -+ clear_bit(IEEE80211_TXQ_STOP, &txqi->flags);
  8010. -+ drv_wake_tx_queue(sta->sdata->local, txqi);
  8011. -+}
  8012. -+
  8013. - /*
  8014. - * splice packets from the STA's pending to the local pending,
  8015. - * requires a call to ieee80211_agg_splice_finish later
  8016. -@@ -247,6 +284,7 @@ static void ieee80211_remove_tid_tx(stru
  8017. - ieee80211_assign_tid_tx(sta, tid, NULL);
  8018. -
  8019. - ieee80211_agg_splice_finish(sta->sdata, tid);
  8020. -+ ieee80211_agg_start_txq(sta, tid, false);
  8021. -
  8022. - kfree_rcu(tid_tx, rcu_head);
  8023. - }
  8024. -@@ -418,6 +456,8 @@ void ieee80211_tx_ba_session_handle_star
  8025. - */
  8026. - clear_bit(HT_AGG_STATE_WANT_START, &tid_tx->state);
  8027. -
  8028. -+ ieee80211_agg_stop_txq(sta, tid);
  8029. -+
  8030. - /*
  8031. - * Make sure no packets are being processed. This ensures that
  8032. - * we have a valid starting sequence number and that in-flight
  8033. -@@ -440,6 +480,8 @@ void ieee80211_tx_ba_session_handle_star
  8034. - ieee80211_agg_splice_finish(sdata, tid);
  8035. - spin_unlock_bh(&sta->lock);
  8036. -
  8037. -+ ieee80211_agg_start_txq(sta, tid, false);
  8038. -+
  8039. - kfree_rcu(tid_tx, rcu_head);
  8040. - return;
  8041. - }
  8042. -@@ -666,6 +708,8 @@ static void ieee80211_agg_tx_operational
  8043. - ieee80211_agg_splice_finish(sta->sdata, tid);
  8044. -
  8045. - spin_unlock_bh(&sta->lock);
  8046. -+
  8047. -+ ieee80211_agg_start_txq(sta, tid, true);
  8048. - }
  8049. -
  8050. - void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid)
  8051. 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
  8052. new file mode 100644
  8053. index 0000000..a160dc4
  8054. --- /dev/null
  8055. +++ b/package/kernel/mac80211/patches/301-ath9k-limit-retries-for-powersave-response-frames.patch
  8056. @@ -0,0 +1,121 @@
  8057. +From: Felix Fietkau <nbd@openwrt.org>
  8058. +Date: Thu, 2 Jul 2015 15:20:56 +0200
  8059. +Subject: [PATCH] ath9k: limit retries for powersave response frames
  8060. +
  8061. +In some cases, the channel might be busy enough that an ath9k AP's
  8062. +response to PS-Poll frames might be too slow and the station has already
  8063. +gone to sleep. To avoid wasting too much airtime on this, limit the
  8064. +number of retries on such frames and ensure that no sample rate gets
  8065. +used.
  8066. +
  8067. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8068. +---
  8069. +
  8070. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  8071. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  8072. +@@ -136,10 +136,25 @@ static void ath_send_bar(struct ath_atx_
  8073. + }
  8074. +
  8075. + static void ath_set_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta,
  8076. +- struct ath_buf *bf)
  8077. ++ struct ath_buf *bf, bool ps)
  8078. + {
  8079. ++ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(bf->bf_mpdu);
  8080. ++
  8081. ++ if (ps) {
  8082. ++ /* Clear the first rate to avoid using a sample rate for PS frames */
  8083. ++ info->control.rates[0].idx = -1;
  8084. ++ info->control.rates[0].count = 0;
  8085. ++ }
  8086. ++
  8087. + ieee80211_get_tx_rates(vif, sta, bf->bf_mpdu, bf->rates,
  8088. + ARRAY_SIZE(bf->rates));
  8089. ++ if (!ps)
  8090. ++ return;
  8091. ++
  8092. ++ if (bf->rates[0].count > 2)
  8093. ++ bf->rates[0].count = 2;
  8094. ++
  8095. ++ bf->rates[1].idx = -1;
  8096. + }
  8097. +
  8098. + static void ath_txq_skb_done(struct ath_softc *sc, struct ath_txq *txq,
  8099. +@@ -1419,7 +1434,7 @@ ath_tx_form_burst(struct ath_softc *sc,
  8100. + if (tx_info->flags & IEEE80211_TX_CTL_AMPDU)
  8101. + break;
  8102. +
  8103. +- ath_set_rates(tid->an->vif, tid->an->sta, bf);
  8104. ++ ath_set_rates(tid->an->vif, tid->an->sta, bf, false);
  8105. + } while (1);
  8106. + }
  8107. +
  8108. +@@ -1450,7 +1465,7 @@ static bool ath_tx_sched_aggr(struct ath
  8109. + return false;
  8110. + }
  8111. +
  8112. +- ath_set_rates(tid->an->vif, tid->an->sta, bf);
  8113. ++ ath_set_rates(tid->an->vif, tid->an->sta, bf, false);
  8114. + if (aggr)
  8115. + last = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf,
  8116. + tid_q, &aggr_len);
  8117. +@@ -1647,7 +1662,7 @@ void ath9k_release_buffered_frames(struc
  8118. +
  8119. + __skb_unlink(bf->bf_mpdu, tid_q);
  8120. + list_add_tail(&bf->list, &bf_q);
  8121. +- ath_set_rates(tid->an->vif, tid->an->sta, bf);
  8122. ++ ath_set_rates(tid->an->vif, tid->an->sta, bf, true);
  8123. + if (bf_isampdu(bf)) {
  8124. + ath_tx_addto_baw(sc, tid, bf);
  8125. + bf->bf_state.bf_type &= ~BUF_AGGR;
  8126. +@@ -2293,7 +2308,7 @@ int ath_tx_start(struct ieee80211_hw *hw
  8127. + struct ath_txq *txq = txctl->txq;
  8128. + struct ath_atx_tid *tid = NULL;
  8129. + struct ath_buf *bf;
  8130. +- bool queue, skip_uapsd = false, ps_resp;
  8131. ++ bool queue, ps_resp;
  8132. + int q, ret;
  8133. +
  8134. + if (vif)
  8135. +@@ -2346,13 +2361,13 @@ int ath_tx_start(struct ieee80211_hw *hw
  8136. + if (!txctl->an)
  8137. + txctl->an = &avp->mcast_node;
  8138. + queue = true;
  8139. +- skip_uapsd = true;
  8140. ++ ps_resp = false;
  8141. + }
  8142. +
  8143. + if (txctl->an && queue)
  8144. + tid = ath_get_skb_tid(sc, txctl->an, skb);
  8145. +
  8146. +- if (!skip_uapsd && ps_resp) {
  8147. ++ if (ps_resp) {
  8148. + ath_txq_unlock(sc, txq);
  8149. + txq = sc->tx.uapsdq;
  8150. + ath_txq_lock(sc, txq);
  8151. +@@ -2390,7 +2405,7 @@ int ath_tx_start(struct ieee80211_hw *hw
  8152. + if (txctl->paprd)
  8153. + bf->bf_state.bfs_paprd_timestamp = jiffies;
  8154. +
  8155. +- ath_set_rates(vif, sta, bf);
  8156. ++ ath_set_rates(vif, sta, bf, ps_resp);
  8157. + ath_tx_send_normal(sc, txq, tid, skb);
  8158. +
  8159. + out:
  8160. +@@ -2429,7 +2444,7 @@ void ath_tx_cabq(struct ieee80211_hw *hw
  8161. + break;
  8162. +
  8163. + bf->bf_lastbf = bf;
  8164. +- ath_set_rates(vif, NULL, bf);
  8165. ++ ath_set_rates(vif, NULL, bf, false);
  8166. + ath_buf_set_rate(sc, bf, &info, fi->framelen, false);
  8167. + duration += info.rates[0].PktDuration;
  8168. + if (bf_tail)
  8169. +@@ -2932,7 +2947,7 @@ int ath9k_tx99_send(struct ath_softc *sc
  8170. + return -EINVAL;
  8171. + }
  8172. +
  8173. +- ath_set_rates(sc->tx99_vif, NULL, bf);
  8174. ++ ath_set_rates(sc->tx99_vif, NULL, bf, false);
  8175. +
  8176. + ath9k_hw_set_desc_link(sc->sc_ah, bf->bf_desc, bf->bf_daddr);
  8177. + ath9k_hw_tx99_start(sc->sc_ah, txctl->txq->axq_qnum);
  8178. diff --git a/package/kernel/mac80211/patches/301-mac80211-lock-rate-control.patch b/package/kernel/mac80211/patches/301-mac80211-lock-rate-control.patch
  8179. deleted file mode 100644
  8180. index 465d943..0000000
  8181. --- a/package/kernel/mac80211/patches/301-mac80211-lock-rate-control.patch
  8182. +++ /dev/null
  8183. @@ -1,125 +0,0 @@
  8184. -From: Johannes Berg <johannes.berg@intel.com>
  8185. -Date: Wed, 11 Mar 2015 09:14:15 +0100
  8186. -Subject: [PATCH] mac80211: lock rate control
  8187. -
  8188. -Both minstrel (reported by Sven Eckelmann) and the iwlwifi rate
  8189. -control aren't properly taking concurrency into account. It's
  8190. -likely that the same is true for other rate control algorithms.
  8191. -
  8192. -In the case of minstrel this manifests itself in crashes when an
  8193. -update and other data access are run concurrently, for example
  8194. -when the stations change bandwidth or similar. In iwlwifi, this
  8195. -can cause firmware crashes.
  8196. -
  8197. -Since fixing all rate control algorithms will be very difficult,
  8198. -just provide locking for invocations. This protects the internal
  8199. -data structures the algorithms maintain.
  8200. -
  8201. -I've manipulated hostapd to test this, by having it change its
  8202. -advertised bandwidth roughly ever 150ms. At the same time, I'm
  8203. -running a flood ping between the client and the AP, which causes
  8204. -this race of update vs. get_rate/status to easily happen on the
  8205. -client. With this change, the system survives this test.
  8206. -
  8207. -Reported-by: Sven Eckelmann <sven@open-mesh.com>
  8208. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  8209. ----
  8210. -
  8211. ---- a/net/mac80211/rate.c
  8212. -+++ b/net/mac80211/rate.c
  8213. -@@ -683,7 +683,13 @@ void rate_control_get_rate(struct ieee80
  8214. - if (sdata->local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL)
  8215. - return;
  8216. -
  8217. -- ref->ops->get_rate(ref->priv, ista, priv_sta, txrc);
  8218. -+ if (ista) {
  8219. -+ spin_lock_bh(&sta->rate_ctrl_lock);
  8220. -+ ref->ops->get_rate(ref->priv, ista, priv_sta, txrc);
  8221. -+ spin_unlock_bh(&sta->rate_ctrl_lock);
  8222. -+ } else {
  8223. -+ ref->ops->get_rate(ref->priv, NULL, NULL, txrc);
  8224. -+ }
  8225. -
  8226. - if (sdata->local->hw.flags & IEEE80211_HW_SUPPORTS_RC_TABLE)
  8227. - return;
  8228. ---- a/net/mac80211/rate.h
  8229. -+++ b/net/mac80211/rate.h
  8230. -@@ -42,10 +42,12 @@ static inline void rate_control_tx_statu
  8231. - if (!ref || !test_sta_flag(sta, WLAN_STA_RATE_CONTROL))
  8232. - return;
  8233. -
  8234. -+ spin_lock_bh(&sta->rate_ctrl_lock);
  8235. - if (ref->ops->tx_status)
  8236. - ref->ops->tx_status(ref->priv, sband, ista, priv_sta, skb);
  8237. - else
  8238. - ref->ops->tx_status_noskb(ref->priv, sband, ista, priv_sta, info);
  8239. -+ spin_unlock_bh(&sta->rate_ctrl_lock);
  8240. - }
  8241. -
  8242. - static inline void
  8243. -@@ -64,7 +66,9 @@ rate_control_tx_status_noskb(struct ieee
  8244. - if (WARN_ON_ONCE(!ref->ops->tx_status_noskb))
  8245. - return;
  8246. -
  8247. -+ spin_lock_bh(&sta->rate_ctrl_lock);
  8248. - ref->ops->tx_status_noskb(ref->priv, sband, ista, priv_sta, info);
  8249. -+ spin_unlock_bh(&sta->rate_ctrl_lock);
  8250. - }
  8251. -
  8252. - static inline void rate_control_rate_init(struct sta_info *sta)
  8253. -@@ -91,8 +95,10 @@ static inline void rate_control_rate_ini
  8254. -
  8255. - sband = local->hw.wiphy->bands[chanctx_conf->def.chan->band];
  8256. -
  8257. -+ spin_lock_bh(&sta->rate_ctrl_lock);
  8258. - ref->ops->rate_init(ref->priv, sband, &chanctx_conf->def, ista,
  8259. - priv_sta);
  8260. -+ spin_unlock_bh(&sta->rate_ctrl_lock);
  8261. - rcu_read_unlock();
  8262. - set_sta_flag(sta, WLAN_STA_RATE_CONTROL);
  8263. - }
  8264. -@@ -115,18 +121,20 @@ static inline void rate_control_rate_upd
  8265. - return;
  8266. - }
  8267. -
  8268. -+ spin_lock_bh(&sta->rate_ctrl_lock);
  8269. - ref->ops->rate_update(ref->priv, sband, &chanctx_conf->def,
  8270. - ista, priv_sta, changed);
  8271. -+ spin_unlock_bh(&sta->rate_ctrl_lock);
  8272. - rcu_read_unlock();
  8273. - }
  8274. - drv_sta_rc_update(local, sta->sdata, &sta->sta, changed);
  8275. - }
  8276. -
  8277. - static inline void *rate_control_alloc_sta(struct rate_control_ref *ref,
  8278. -- struct ieee80211_sta *sta,
  8279. -- gfp_t gfp)
  8280. -+ struct sta_info *sta, gfp_t gfp)
  8281. - {
  8282. -- return ref->ops->alloc_sta(ref->priv, sta, gfp);
  8283. -+ spin_lock_init(&sta->rate_ctrl_lock);
  8284. -+ return ref->ops->alloc_sta(ref->priv, &sta->sta, gfp);
  8285. - }
  8286. -
  8287. - static inline void rate_control_free_sta(struct sta_info *sta)
  8288. ---- a/net/mac80211/sta_info.c
  8289. -+++ b/net/mac80211/sta_info.c
  8290. -@@ -286,7 +286,7 @@ static int sta_prepare_rate_control(stru
  8291. -
  8292. - sta->rate_ctrl = local->rate_ctrl;
  8293. - sta->rate_ctrl_priv = rate_control_alloc_sta(sta->rate_ctrl,
  8294. -- &sta->sta, gfp);
  8295. -+ sta, gfp);
  8296. - if (!sta->rate_ctrl_priv)
  8297. - return -ENOMEM;
  8298. -
  8299. ---- a/net/mac80211/sta_info.h
  8300. -+++ b/net/mac80211/sta_info.h
  8301. -@@ -349,6 +349,7 @@ struct sta_info {
  8302. - u8 ptk_idx;
  8303. - struct rate_control_ref *rate_ctrl;
  8304. - void *rate_ctrl_priv;
  8305. -+ spinlock_t rate_ctrl_lock;
  8306. - spinlock_t lock;
  8307. -
  8308. - struct work_struct drv_deliver_wk;
  8309. 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
  8310. deleted file mode 100644
  8311. index e54e16e..0000000
  8312. --- a/package/kernel/mac80211/patches/302-ath9k-restart-only-triggering-DFS-detector-line.patch
  8313. +++ /dev/null
  8314. @@ -1,21 +0,0 @@
  8315. -From: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  8316. -Date: Tue, 10 Mar 2015 17:49:29 +0100
  8317. -Subject: [PATCH] ath9k: restart only triggering DFS detector line
  8318. -
  8319. -To support HT40 DFS mode, a triggering detector must
  8320. -reset only itself but not other detector lines.
  8321. -
  8322. -Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  8323. ----
  8324. -
  8325. ---- a/drivers/net/wireless/ath/dfs_pattern_detector.c
  8326. -+++ b/drivers/net/wireless/ath/dfs_pattern_detector.c
  8327. -@@ -289,7 +289,7 @@ dpd_add_pulse(struct dfs_pattern_detecto
  8328. - "count=%d, count_false=%d\n",
  8329. - event->freq, pd->rs->type_id,
  8330. - ps->pri, ps->count, ps->count_falses);
  8331. -- channel_detector_reset(dpd, cd);
  8332. -+ pd->reset(pd, dpd->last_pulse_ts);
  8333. - return true;
  8334. - }
  8335. - }
  8336. diff --git a/package/kernel/mac80211/patches/302-ath9k_hw-add-low-power-tx-gain-table-for-AR953x.patch b/package/kernel/mac80211/patches/302-ath9k_hw-add-low-power-tx-gain-table-for-AR953x.patch
  8337. new file mode 100644
  8338. index 0000000..22b987a
  8339. --- /dev/null
  8340. +++ b/package/kernel/mac80211/patches/302-ath9k_hw-add-low-power-tx-gain-table-for-AR953x.patch
  8341. @@ -0,0 +1,95 @@
  8342. +From: Felix Fietkau <nbd@openwrt.org>
  8343. +Date: Thu, 14 Jan 2016 03:14:03 +0100
  8344. +Subject: [PATCH] ath9k_hw: add low power tx gain table for AR953x
  8345. +
  8346. +Used in some newer TP-Link AR9533 devices.
  8347. +
  8348. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8349. +---
  8350. +
  8351. +--- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c
  8352. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
  8353. +@@ -698,6 +698,9 @@ static void ar9003_tx_gain_table_mode2(s
  8354. + else if (AR_SREV_9340(ah))
  8355. + INIT_INI_ARRAY(&ah->iniModesTxGain,
  8356. + ar9340Modes_low_ob_db_tx_gain_table_1p0);
  8357. ++ else if (AR_SREV_9531_11(ah))
  8358. ++ INIT_INI_ARRAY(&ah->iniModesTxGain,
  8359. ++ qca953x_1p1_modes_no_xpa_low_power_tx_gain_table);
  8360. + else if (AR_SREV_9485_11_OR_LATER(ah))
  8361. + INIT_INI_ARRAY(&ah->iniModesTxGain,
  8362. + ar9485Modes_low_ob_db_tx_gain_1_1);
  8363. +--- a/drivers/net/wireless/ath/ath9k/ar953x_initvals.h
  8364. ++++ b/drivers/net/wireless/ath/ath9k/ar953x_initvals.h
  8365. +@@ -757,6 +757,71 @@ static const u32 qca953x_1p1_modes_xpa_t
  8366. + {0x00016448, 0x6c927a70},
  8367. + };
  8368. +
  8369. ++static const u32 qca953x_1p1_modes_no_xpa_low_power_tx_gain_table[][2] = {
  8370. ++ /* Addr allmodes */
  8371. ++ {0x0000a2dc, 0xfff55592},
  8372. ++ {0x0000a2e0, 0xfff99924},
  8373. ++ {0x0000a2e4, 0xfffe1e00},
  8374. ++ {0x0000a2e8, 0xffffe000},
  8375. ++ {0x0000a410, 0x000050d6},
  8376. ++ {0x0000a500, 0x00000069},
  8377. ++ {0x0000a504, 0x0400006b},
  8378. ++ {0x0000a508, 0x0800006d},
  8379. ++ {0x0000a50c, 0x0c000269},
  8380. ++ {0x0000a510, 0x1000026b},
  8381. ++ {0x0000a514, 0x1400026d},
  8382. ++ {0x0000a518, 0x18000669},
  8383. ++ {0x0000a51c, 0x1c00066b},
  8384. ++ {0x0000a520, 0x1d000a68},
  8385. ++ {0x0000a524, 0x21000a6a},
  8386. ++ {0x0000a528, 0x25000a6c},
  8387. ++ {0x0000a52c, 0x29000a6e},
  8388. ++ {0x0000a530, 0x2d0012a9},
  8389. ++ {0x0000a534, 0x310012ab},
  8390. ++ {0x0000a538, 0x350012ad},
  8391. ++ {0x0000a53c, 0x39001b0a},
  8392. ++ {0x0000a540, 0x3d001b0c},
  8393. ++ {0x0000a544, 0x41001b0e},
  8394. ++ {0x0000a548, 0x43001bae},
  8395. ++ {0x0000a54c, 0x45001914},
  8396. ++ {0x0000a550, 0x47001916},
  8397. ++ {0x0000a554, 0x49001b96},
  8398. ++ {0x0000a558, 0x49001b96},
  8399. ++ {0x0000a55c, 0x49001b96},
  8400. ++ {0x0000a560, 0x49001b96},
  8401. ++ {0x0000a564, 0x49001b96},
  8402. ++ {0x0000a568, 0x49001b96},
  8403. ++ {0x0000a56c, 0x49001b96},
  8404. ++ {0x0000a570, 0x49001b96},
  8405. ++ {0x0000a574, 0x49001b96},
  8406. ++ {0x0000a578, 0x49001b96},
  8407. ++ {0x0000a57c, 0x49001b96},
  8408. ++ {0x0000a600, 0x00000000},
  8409. ++ {0x0000a604, 0x00000000},
  8410. ++ {0x0000a608, 0x00000000},
  8411. ++ {0x0000a60c, 0x00000000},
  8412. ++ {0x0000a610, 0x00000000},
  8413. ++ {0x0000a614, 0x00000000},
  8414. ++ {0x0000a618, 0x00804201},
  8415. ++ {0x0000a61c, 0x01408201},
  8416. ++ {0x0000a620, 0x01408502},
  8417. ++ {0x0000a624, 0x01408502},
  8418. ++ {0x0000a628, 0x01408502},
  8419. ++ {0x0000a62c, 0x01408502},
  8420. ++ {0x0000a630, 0x01408502},
  8421. ++ {0x0000a634, 0x01408502},
  8422. ++ {0x0000a638, 0x01408502},
  8423. ++ {0x0000a63c, 0x01408502},
  8424. ++ {0x0000b2dc, 0xfff55592},
  8425. ++ {0x0000b2e0, 0xfff99924},
  8426. ++ {0x0000b2e4, 0xfffe1e00},
  8427. ++ {0x0000b2e8, 0xffffe000},
  8428. ++ {0x00016044, 0x044922db},
  8429. ++ {0x00016048, 0x6c927a70},
  8430. ++ {0x00016444, 0x044922db},
  8431. ++ {0x00016448, 0x6c927a70},
  8432. ++};
  8433. ++
  8434. + static const u32 qca953x_2p0_baseband_core[][2] = {
  8435. + /* Addr allmodes */
  8436. + {0x00009800, 0xafe68e30},
  8437. 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
  8438. deleted file mode 100644
  8439. index ed268ea..0000000
  8440. --- a/package/kernel/mac80211/patches/303-ath9k-add-DFS-support-for-extension-channel.patch
  8441. +++ /dev/null
  8442. @@ -1,76 +0,0 @@
  8443. -From: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  8444. -Date: Tue, 10 Mar 2015 17:49:30 +0100
  8445. -Subject: [PATCH] ath9k: add DFS support for extension channel
  8446. -
  8447. -In HT40 modes, pulse events on primary and extension
  8448. -channel are processed individually. If valid, a pulse
  8449. -event will be fed into the detector
  8450. -* for primary frequency, or
  8451. -* for extension frequency (+/-20MHz based on HT40-mode)
  8452. -* or both
  8453. -
  8454. -With that, a 40MHz radar will result in two individual
  8455. -radar events.
  8456. -
  8457. -Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  8458. ----
  8459. -
  8460. ---- a/drivers/net/wireless/ath/ath9k/dfs.c
  8461. -+++ b/drivers/net/wireless/ath/ath9k/dfs.c
  8462. -@@ -126,8 +126,19 @@ ath9k_postprocess_radar_event(struct ath
  8463. - DFS_STAT_INC(sc, pulses_detected);
  8464. - return true;
  8465. - }
  8466. --#undef PRI_CH_RADAR_FOUND
  8467. --#undef EXT_CH_RADAR_FOUND
  8468. -+
  8469. -+static void
  8470. -+ath9k_dfs_process_radar_pulse(struct ath_softc *sc, struct pulse_event *pe)
  8471. -+{
  8472. -+ struct dfs_pattern_detector *pd = sc->dfs_detector;
  8473. -+ DFS_STAT_INC(sc, pulses_processed);
  8474. -+ if (pd == NULL)
  8475. -+ return;
  8476. -+ if (!pd->add_pulse(pd, pe))
  8477. -+ return;
  8478. -+ DFS_STAT_INC(sc, radar_detected);
  8479. -+ ieee80211_radar_detected(sc->hw);
  8480. -+}
  8481. -
  8482. - /*
  8483. - * DFS: check PHY-error for radar pulse and feed the detector
  8484. -@@ -176,18 +187,21 @@ void ath9k_dfs_process_phyerr(struct ath
  8485. - ard.pulse_length_pri = vdata_end[-3];
  8486. - pe.freq = ah->curchan->channel;
  8487. - pe.ts = mactime;
  8488. -- if (ath9k_postprocess_radar_event(sc, &ard, &pe)) {
  8489. -- struct dfs_pattern_detector *pd = sc->dfs_detector;
  8490. -- ath_dbg(common, DFS,
  8491. -- "ath9k_dfs_process_phyerr: channel=%d, ts=%llu, "
  8492. -- "width=%d, rssi=%d, delta_ts=%llu\n",
  8493. -- pe.freq, pe.ts, pe.width, pe.rssi,
  8494. -- pe.ts - sc->dfs_prev_pulse_ts);
  8495. -- sc->dfs_prev_pulse_ts = pe.ts;
  8496. -- DFS_STAT_INC(sc, pulses_processed);
  8497. -- if (pd != NULL && pd->add_pulse(pd, &pe)) {
  8498. -- DFS_STAT_INC(sc, radar_detected);
  8499. -- ieee80211_radar_detected(sc->hw);
  8500. -- }
  8501. -+ if (!ath9k_postprocess_radar_event(sc, &ard, &pe))
  8502. -+ return;
  8503. -+
  8504. -+ ath_dbg(common, DFS,
  8505. -+ "ath9k_dfs_process_phyerr: type=%d, freq=%d, ts=%llu, "
  8506. -+ "width=%d, rssi=%d, delta_ts=%llu\n",
  8507. -+ ard.pulse_bw_info, pe.freq, pe.ts, pe.width, pe.rssi,
  8508. -+ pe.ts - sc->dfs_prev_pulse_ts);
  8509. -+ sc->dfs_prev_pulse_ts = pe.ts;
  8510. -+ if (ard.pulse_bw_info & PRI_CH_RADAR_FOUND)
  8511. -+ ath9k_dfs_process_radar_pulse(sc, &pe);
  8512. -+ if (ard.pulse_bw_info & EXT_CH_RADAR_FOUND) {
  8513. -+ pe.freq += IS_CHAN_HT40PLUS(ah->curchan) ? 20 : -20;
  8514. -+ ath9k_dfs_process_radar_pulse(sc, &pe);
  8515. - }
  8516. - }
  8517. -+#undef PRI_CH_RADAR_FOUND
  8518. -+#undef EXT_CH_RADAR_FOUND
  8519. diff --git a/package/kernel/mac80211/patches/303-rt2x00-fix-monitor-mode-regression.patch b/package/kernel/mac80211/patches/303-rt2x00-fix-monitor-mode-regression.patch
  8520. new file mode 100644
  8521. index 0000000..7bb7435
  8522. --- /dev/null
  8523. +++ b/package/kernel/mac80211/patches/303-rt2x00-fix-monitor-mode-regression.patch
  8524. @@ -0,0 +1,156 @@
  8525. +From: Eli Cooper <elicooper@gmx.com>
  8526. +Date: Thu, 14 Jan 2016 00:07:12 +0800
  8527. +Subject: [PATCH] rt2x00: fix monitor mode regression
  8528. +
  8529. +Since commit df1404650ccbfeb76a84f301f22316be0d00a864 monitor mode for rt2x00
  8530. +has been made effectively useless because the hardware filter is configured to
  8531. +drop packets whose intended recipient is not the device, regardless of the
  8532. +presence of monitor mode interfaces.
  8533. +
  8534. +This patch fixes this regression by adding explicit monitor mode support, and
  8535. +configuring the hardware filter accordingly.
  8536. +
  8537. +Signed-off-by: Eli Cooper <elicooper@gmx.com>
  8538. +---
  8539. +
  8540. +--- a/drivers/net/wireless/ralink/rt2x00/rt2400pci.c
  8541. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2400pci.c
  8542. +@@ -273,8 +273,10 @@ static void rt2400pci_config_filter(stru
  8543. + !(filter_flags & FIF_PLCPFAIL));
  8544. + rt2x00_set_field32(&reg, RXCSR0_DROP_CONTROL,
  8545. + !(filter_flags & FIF_CONTROL));
  8546. +- rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME, 1);
  8547. ++ rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME,
  8548. ++ !rt2x00dev->is_monitoring);
  8549. + rt2x00_set_field32(&reg, RXCSR0_DROP_TODS,
  8550. ++ !rt2x00dev->is_monitoring &&
  8551. + !rt2x00dev->intf_ap_count);
  8552. + rt2x00_set_field32(&reg, RXCSR0_DROP_VERSION_ERROR, 1);
  8553. + rt2x00mmio_register_write(rt2x00dev, RXCSR0, reg);
  8554. +--- a/drivers/net/wireless/ralink/rt2x00/rt2500pci.c
  8555. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2500pci.c
  8556. +@@ -274,8 +274,10 @@ static void rt2500pci_config_filter(stru
  8557. + !(filter_flags & FIF_PLCPFAIL));
  8558. + rt2x00_set_field32(&reg, RXCSR0_DROP_CONTROL,
  8559. + !(filter_flags & FIF_CONTROL));
  8560. +- rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME, 1);
  8561. ++ rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME,
  8562. ++ !rt2x00dev->is_monitoring);
  8563. + rt2x00_set_field32(&reg, RXCSR0_DROP_TODS,
  8564. ++ !rt2x00dev->is_monitoring &&
  8565. + !rt2x00dev->intf_ap_count);
  8566. + rt2x00_set_field32(&reg, RXCSR0_DROP_VERSION_ERROR, 1);
  8567. + rt2x00_set_field32(&reg, RXCSR0_DROP_MCAST,
  8568. +--- a/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
  8569. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
  8570. +@@ -437,8 +437,10 @@ static void rt2500usb_config_filter(stru
  8571. + !(filter_flags & FIF_PLCPFAIL));
  8572. + rt2x00_set_field16(&reg, TXRX_CSR2_DROP_CONTROL,
  8573. + !(filter_flags & FIF_CONTROL));
  8574. +- rt2x00_set_field16(&reg, TXRX_CSR2_DROP_NOT_TO_ME, 1);
  8575. ++ rt2x00_set_field16(&reg, TXRX_CSR2_DROP_NOT_TO_ME,
  8576. ++ !rt2x00dev->is_monitoring);
  8577. + rt2x00_set_field16(&reg, TXRX_CSR2_DROP_TODS,
  8578. ++ !rt2x00dev->is_monitoring &&
  8579. + !rt2x00dev->intf_ap_count);
  8580. + rt2x00_set_field16(&reg, TXRX_CSR2_DROP_VERSION_ERROR, 1);
  8581. + rt2x00_set_field16(&reg, TXRX_CSR2_DROP_MULTICAST,
  8582. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  8583. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  8584. +@@ -1490,7 +1490,8 @@ void rt2800_config_filter(struct rt2x00_
  8585. + !(filter_flags & FIF_FCSFAIL));
  8586. + rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_PHY_ERROR,
  8587. + !(filter_flags & FIF_PLCPFAIL));
  8588. +- rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_TO_ME, 1);
  8589. ++ rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_TO_ME,
  8590. ++ !rt2x00dev->is_monitoring);
  8591. + rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_MY_BSSD, 0);
  8592. + rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_VER_ERROR, 1);
  8593. + rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_MULTICAST,
  8594. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  8595. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  8596. +@@ -844,11 +844,13 @@ struct rt2x00_dev {
  8597. + * - Open sta interface count.
  8598. + * - Association count.
  8599. + * - Beaconing enabled count.
  8600. ++ * - Whether the device is monitoring.
  8601. + */
  8602. + unsigned int intf_ap_count;
  8603. + unsigned int intf_sta_count;
  8604. + unsigned int intf_associated;
  8605. + unsigned int intf_beaconing;
  8606. ++ bool is_monitoring;
  8607. +
  8608. + /*
  8609. + * Interface combinations
  8610. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00config.c
  8611. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00config.c
  8612. +@@ -244,6 +244,16 @@ void rt2x00lib_config(struct rt2x00_dev
  8613. + (ieee80211_flags & IEEE80211_CONF_CHANGE_PS))
  8614. + cancel_delayed_work_sync(&rt2x00dev->autowakeup_work);
  8615. +
  8616. ++ if (ieee80211_flags & IEEE80211_CONF_CHANGE_MONITOR) {
  8617. ++ if (conf->flags & IEEE80211_CONF_MONITOR) {
  8618. ++ rt2x00_dbg(rt2x00dev, "Monitor mode is enabled\n");
  8619. ++ rt2x00dev->is_monitoring = true;
  8620. ++ } else {
  8621. ++ rt2x00_dbg(rt2x00dev, "Monitor mode is disabled\n");
  8622. ++ rt2x00dev->is_monitoring = false;
  8623. ++ }
  8624. ++ }
  8625. ++
  8626. + /*
  8627. + * Start configuration.
  8628. + */
  8629. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  8630. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  8631. +@@ -1204,6 +1204,7 @@ int rt2x00lib_start(struct rt2x00_dev *r
  8632. + rt2x00dev->intf_ap_count = 0;
  8633. + rt2x00dev->intf_sta_count = 0;
  8634. + rt2x00dev->intf_associated = 0;
  8635. ++ rt2x00dev->is_monitoring = false;
  8636. +
  8637. + /* Enable the radio */
  8638. + retval = rt2x00lib_enable_radio(rt2x00dev);
  8639. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
  8640. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
  8641. +@@ -385,11 +385,6 @@ void rt2x00mac_configure_filter(struct i
  8642. + *total_flags |= FIF_PSPOLL;
  8643. + }
  8644. +
  8645. +- /*
  8646. +- * Check if there is any work left for us.
  8647. +- */
  8648. +- if (rt2x00dev->packet_filter == *total_flags)
  8649. +- return;
  8650. + rt2x00dev->packet_filter = *total_flags;
  8651. +
  8652. + rt2x00dev->ops->lib->config_filter(rt2x00dev, *total_flags);
  8653. +--- a/drivers/net/wireless/ralink/rt2x00/rt61pci.c
  8654. ++++ b/drivers/net/wireless/ralink/rt2x00/rt61pci.c
  8655. +@@ -530,8 +530,10 @@ static void rt61pci_config_filter(struct
  8656. + !(filter_flags & FIF_PLCPFAIL));
  8657. + rt2x00_set_field32(&reg, TXRX_CSR0_DROP_CONTROL,
  8658. + !(filter_flags & (FIF_CONTROL | FIF_PSPOLL)));
  8659. +- rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME, 1);
  8660. ++ rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME,
  8661. ++ !rt2x00dev->is_monitoring);
  8662. + rt2x00_set_field32(&reg, TXRX_CSR0_DROP_TO_DS,
  8663. ++ !rt2x00dev->is_monitoring &&
  8664. + !rt2x00dev->intf_ap_count);
  8665. + rt2x00_set_field32(&reg, TXRX_CSR0_DROP_VERSION_ERROR, 1);
  8666. + rt2x00_set_field32(&reg, TXRX_CSR0_DROP_MULTICAST,
  8667. +--- a/drivers/net/wireless/ralink/rt2x00/rt73usb.c
  8668. ++++ b/drivers/net/wireless/ralink/rt2x00/rt73usb.c
  8669. +@@ -480,8 +480,10 @@ static void rt73usb_config_filter(struct
  8670. + !(filter_flags & FIF_PLCPFAIL));
  8671. + rt2x00_set_field32(&reg, TXRX_CSR0_DROP_CONTROL,
  8672. + !(filter_flags & (FIF_CONTROL | FIF_PSPOLL)));
  8673. +- rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME, 1);
  8674. ++ rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME,
  8675. ++ !rt2x00dev->is_monitoring);
  8676. + rt2x00_set_field32(&reg, TXRX_CSR0_DROP_TO_DS,
  8677. ++ !rt2x00dev->is_monitoring &&
  8678. + !rt2x00dev->intf_ap_count);
  8679. + rt2x00_set_field32(&reg, TXRX_CSR0_DROP_VERSION_ERROR, 1);
  8680. + rt2x00_set_field32(&reg, TXRX_CSR0_DROP_MULTICAST,
  8681. 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
  8682. deleted file mode 100644
  8683. index e1eab64..0000000
  8684. --- a/package/kernel/mac80211/patches/304-ath9k-allow-40MHz-radar-detection-width.patch
  8685. +++ /dev/null
  8686. @@ -1,19 +0,0 @@
  8687. -From: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  8688. -Date: Tue, 10 Mar 2015 17:49:31 +0100
  8689. -Subject: [PATCH] ath9k: allow 40MHz radar detection width
  8690. -
  8691. -Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  8692. ----
  8693. -
  8694. ---- a/drivers/net/wireless/ath/ath9k/init.c
  8695. -+++ b/drivers/net/wireless/ath/ath9k/init.c
  8696. -@@ -763,7 +763,8 @@ static const struct ieee80211_iface_comb
  8697. - .num_different_channels = 1,
  8698. - .beacon_int_infra_match = true,
  8699. - .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
  8700. -- BIT(NL80211_CHAN_WIDTH_20),
  8701. -+ BIT(NL80211_CHAN_WIDTH_20) |
  8702. -+ BIT(NL80211_CHAN_WIDTH_40),
  8703. - }
  8704. - #endif
  8705. - };
  8706. diff --git a/package/kernel/mac80211/patches/304-ath9k-avoid-ANI-restart-if-no-trigger.patch b/package/kernel/mac80211/patches/304-ath9k-avoid-ANI-restart-if-no-trigger.patch
  8707. new file mode 100644
  8708. index 0000000..049059a
  8709. --- /dev/null
  8710. +++ b/package/kernel/mac80211/patches/304-ath9k-avoid-ANI-restart-if-no-trigger.patch
  8711. @@ -0,0 +1,32 @@
  8712. +From: Miaoqing Pan <miaoqing@codeaurora.org>
  8713. +Date: Fri, 15 Jan 2016 18:17:17 +0800
  8714. +Subject: [PATCH] ath9k: avoid ANI restart if no trigger
  8715. +
  8716. +Fixes commit 54da20d83f0e ("ath9k_hw: improve ANI processing and rx desensitizing parameters")
  8717. +
  8718. +Call ath9k_ani_restart() only when the phy error rate reach the
  8719. +ANI immunity threshold. Sync the logic with internal code base.
  8720. +
  8721. +Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  8722. +---
  8723. +
  8724. +--- a/drivers/net/wireless/ath/ath9k/ani.c
  8725. ++++ b/drivers/net/wireless/ath/ath9k/ani.c
  8726. +@@ -444,14 +444,16 @@ void ath9k_hw_ani_monitor(struct ath_hw
  8727. + ofdmPhyErrRate < ah->config.ofdm_trig_low) {
  8728. + ath9k_hw_ani_lower_immunity(ah);
  8729. + aniState->ofdmsTurn = !aniState->ofdmsTurn;
  8730. ++ ath9k_ani_restart(ah);
  8731. + } else if (ofdmPhyErrRate > ah->config.ofdm_trig_high) {
  8732. + ath9k_hw_ani_ofdm_err_trigger(ah);
  8733. + aniState->ofdmsTurn = false;
  8734. ++ ath9k_ani_restart(ah);
  8735. + } else if (cckPhyErrRate > ah->config.cck_trig_high) {
  8736. + ath9k_hw_ani_cck_err_trigger(ah);
  8737. + aniState->ofdmsTurn = true;
  8738. ++ ath9k_ani_restart(ah);
  8739. + }
  8740. +- ath9k_ani_restart(ah);
  8741. + }
  8742. + }
  8743. + EXPORT_SYMBOL(ath9k_hw_ani_monitor);
  8744. diff --git a/package/kernel/mac80211/patches/305-ath5k-channel-change-fix.patch b/package/kernel/mac80211/patches/305-ath5k-channel-change-fix.patch
  8745. deleted file mode 100644
  8746. index 4cfa53f..0000000
  8747. --- a/package/kernel/mac80211/patches/305-ath5k-channel-change-fix.patch
  8748. +++ /dev/null
  8749. @@ -1,137 +0,0 @@
  8750. -From: Sergey Ryazanov <ryazanov.s.a@gmail.com>
  8751. -Date: Wed, 4 Mar 2015 05:12:10 +0300
  8752. -Subject: [PATCH] ath5k: channel change fix
  8753. -
  8754. -ath5k updates the channel pointer and after that it stops the Rx logic
  8755. -and apply channel to HW. In case of channel switch, such sequence
  8756. -creates a small window when a frame, which is received on the old
  8757. -channel is considered as a frame received on the new one.
  8758. -
  8759. -The most notable consequence of this situation occurs during the switch
  8760. -from 2 GHz band (CCK+OFDM) to the 5GHz band (OFDM-only). Frame received
  8761. -with CCK rate, e.g. beacon received at the 1mbps, causes the following
  8762. -warning:
  8763. -
  8764. - WARNING: at ath5k/base.c:589 ath5k_tasklet_rx+0x318/0x6ec [ath5k]()
  8765. - invalid hw_rix: 1a
  8766. - [..]
  8767. - Call Trace:
  8768. - [<802656a8>] show_stack+0x48/0x70
  8769. - [<802dd92c>] warn_slowpath_common+0x88/0xbc
  8770. - [<802dd98c>] warn_slowpath_fmt+0x2c/0x38
  8771. - [<81b51be8>] ath5k_tasklet_rx+0x318/0x6ec [ath5k]
  8772. - [<8028ac64>] tasklet_action+0x8c/0xf0
  8773. - [<80075804>] __do_softirq+0x180/0x32c
  8774. - [<80196ce8>] irq_exit+0x54/0x70
  8775. - [<80041848>] ret_from_irq+0x0/0x4
  8776. - [<80182fdc>] ioread32+0x4/0xc
  8777. - [<81b4c42c>] ath5k_hw_set_sleep_clock+0x2ec/0x474 [ath5k]
  8778. - [<81b4cf28>] ath5k_hw_reset+0x50/0xeb8 [ath5k]
  8779. - [<81b50900>] ath5k_reset+0xd4/0x310 [ath5k]
  8780. - [<81b557e8>] ath5k_config+0x4c/0x104 [ath5k]
  8781. - [<80d01770>] ieee80211_hw_config+0x2f4/0x35c [mac80211]
  8782. - [<80d09aa8>] ieee80211_scan_work+0x2e4/0x414 [mac80211]
  8783. - [<8022c3f4>] process_one_work+0x28c/0x400
  8784. - [<802df8f8>] worker_thread+0x258/0x3c0
  8785. - [<801b5710>] kthread+0xe0/0xec
  8786. - [<800418a8>] ret_from_kernel_thread+0x14/0x1c
  8787. -
  8788. -The easiest way to reproduce this warning is to run scan with dualband
  8789. -NIC in noisy environments, when the channel 11 runs multiple APs. In my
  8790. -tests if the APs num >= 12, the warning appears in the first few
  8791. -seconds of scanning.
  8792. -
  8793. -In order to fix this, the Rx disable code moved to a higher level and
  8794. -placed before the channel pointer update. This is also makes the code a
  8795. -bit more symmetrical, since we disable and enable the Rx in the same
  8796. -function.
  8797. -
  8798. -In fact, at the pointer update time new frames should not appear,
  8799. -because interrupt generation at this point should already be disabled.
  8800. -The next patch should address this issue.
  8801. -
  8802. -CC: Jiri Slaby <jirislaby@gmail.com>
  8803. -CC: Nick Kossifidis <mickflemm@gmail.com>
  8804. -CC: Luis R. Rodriguez <mcgrof@do-not-panic.com>
  8805. -Reported-by: Christophe Prevotaux <cprevotaux@nltinc.com>
  8806. -Tested-by: Christophe Prevotaux <cprevotaux@nltinc.com>
  8807. -Tested-by: Eric Bree <ebree@nltinc.com>
  8808. -Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
  8809. ----
  8810. -
  8811. ---- a/drivers/net/wireless/ath/ath5k/base.c
  8812. -+++ b/drivers/net/wireless/ath/ath5k/base.c
  8813. -@@ -2858,7 +2858,7 @@ ath5k_reset(struct ath5k_hw *ah, struct
  8814. - {
  8815. - struct ath_common *common = ath5k_hw_common(ah);
  8816. - int ret, ani_mode;
  8817. -- bool fast;
  8818. -+ bool fast = chan && modparam_fastchanswitch ? 1 : 0;
  8819. -
  8820. - ATH5K_DBG(ah, ATH5K_DEBUG_RESET, "resetting\n");
  8821. -
  8822. -@@ -2876,11 +2876,29 @@ ath5k_reset(struct ath5k_hw *ah, struct
  8823. - * so we should also free any remaining
  8824. - * tx buffers */
  8825. - ath5k_drain_tx_buffs(ah);
  8826. -+
  8827. -+ /* Stop PCU */
  8828. -+ ath5k_hw_stop_rx_pcu(ah);
  8829. -+
  8830. -+ /* Stop DMA
  8831. -+ *
  8832. -+ * Note: If DMA didn't stop continue
  8833. -+ * since only a reset will fix it.
  8834. -+ */
  8835. -+ ret = ath5k_hw_dma_stop(ah);
  8836. -+
  8837. -+ /* RF Bus grant won't work if we have pending
  8838. -+ * frames
  8839. -+ */
  8840. -+ if (ret && fast) {
  8841. -+ ATH5K_DBG(ah, ATH5K_DEBUG_RESET,
  8842. -+ "DMA didn't stop, falling back to normal reset\n");
  8843. -+ fast = false;
  8844. -+ }
  8845. -+
  8846. - if (chan)
  8847. - ah->curchan = chan;
  8848. -
  8849. -- fast = ((chan != NULL) && modparam_fastchanswitch) ? 1 : 0;
  8850. --
  8851. - ret = ath5k_hw_reset(ah, ah->opmode, ah->curchan, fast, skip_pcu);
  8852. - if (ret) {
  8853. - ATH5K_ERR(ah, "can't reset hardware (%d)\n", ret);
  8854. ---- a/drivers/net/wireless/ath/ath5k/reset.c
  8855. -+++ b/drivers/net/wireless/ath/ath5k/reset.c
  8856. -@@ -1169,30 +1169,6 @@ ath5k_hw_reset(struct ath5k_hw *ah, enum
  8857. - if (ah->ah_version == AR5K_AR5212)
  8858. - ath5k_hw_set_sleep_clock(ah, false);
  8859. -
  8860. -- /*
  8861. -- * Stop PCU
  8862. -- */
  8863. -- ath5k_hw_stop_rx_pcu(ah);
  8864. --
  8865. -- /*
  8866. -- * Stop DMA
  8867. -- *
  8868. -- * Note: If DMA didn't stop continue
  8869. -- * since only a reset will fix it.
  8870. -- */
  8871. -- ret = ath5k_hw_dma_stop(ah);
  8872. --
  8873. -- /* RF Bus grant won't work if we have pending
  8874. -- * frames */
  8875. -- if (ret && fast) {
  8876. -- ATH5K_DBG(ah, ATH5K_DEBUG_RESET,
  8877. -- "DMA didn't stop, falling back to normal reset\n");
  8878. -- fast = false;
  8879. -- /* Non fatal, just continue with
  8880. -- * normal reset */
  8881. -- ret = 0;
  8882. -- }
  8883. --
  8884. - mode = channel->hw_value;
  8885. - switch (mode) {
  8886. - case AR5K_MODE_11A:
  8887. diff --git a/package/kernel/mac80211/patches/305-ath9k-clean-up-ANI-per-channel-pointer-checking.patch b/package/kernel/mac80211/patches/305-ath9k-clean-up-ANI-per-channel-pointer-checking.patch
  8888. new file mode 100644
  8889. index 0000000..a1ac67c
  8890. --- /dev/null
  8891. +++ b/package/kernel/mac80211/patches/305-ath9k-clean-up-ANI-per-channel-pointer-checking.patch
  8892. @@ -0,0 +1,91 @@
  8893. +From: Miaoqing Pan <miaoqing@codeaurora.org>
  8894. +Date: Fri, 15 Jan 2016 18:17:18 +0800
  8895. +Subject: [PATCH] ath9k: clean up ANI per-channel pointer checking
  8896. +
  8897. +commit c24bd3620c50 ("ath9k: Do not maintain ANI state per-channel")
  8898. +removed per-channel handling, the code to check 'curchan' also
  8899. +should be removed as never used.
  8900. +
  8901. +Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  8902. +---
  8903. +
  8904. +--- a/drivers/net/wireless/ath/ath9k/ani.c
  8905. ++++ b/drivers/net/wireless/ath/ath9k/ani.c
  8906. +@@ -126,12 +126,8 @@ static void ath9k_hw_update_mibstats(str
  8907. +
  8908. + static void ath9k_ani_restart(struct ath_hw *ah)
  8909. + {
  8910. +- struct ar5416AniState *aniState;
  8911. +-
  8912. +- if (!ah->curchan)
  8913. +- return;
  8914. ++ struct ar5416AniState *aniState = &ah->ani;
  8915. +
  8916. +- aniState = &ah->ani;
  8917. + aniState->listenTime = 0;
  8918. +
  8919. + ENABLE_REGWRITE_BUFFER(ah);
  8920. +@@ -221,12 +217,7 @@ static void ath9k_hw_set_ofdm_nil(struct
  8921. +
  8922. + static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah)
  8923. + {
  8924. +- struct ar5416AniState *aniState;
  8925. +-
  8926. +- if (!ah->curchan)
  8927. +- return;
  8928. +-
  8929. +- aniState = &ah->ani;
  8930. ++ struct ar5416AniState *aniState = &ah->ani;
  8931. +
  8932. + if (aniState->ofdmNoiseImmunityLevel < ATH9K_ANI_OFDM_MAX_LEVEL)
  8933. + ath9k_hw_set_ofdm_nil(ah, aniState->ofdmNoiseImmunityLevel + 1, false);
  8934. +@@ -281,12 +272,7 @@ static void ath9k_hw_set_cck_nil(struct
  8935. +
  8936. + static void ath9k_hw_ani_cck_err_trigger(struct ath_hw *ah)
  8937. + {
  8938. +- struct ar5416AniState *aniState;
  8939. +-
  8940. +- if (!ah->curchan)
  8941. +- return;
  8942. +-
  8943. +- aniState = &ah->ani;
  8944. ++ struct ar5416AniState *aniState = &ah->ani;
  8945. +
  8946. + if (aniState->cckNoiseImmunityLevel < ATH9K_ANI_CCK_MAX_LEVEL)
  8947. + ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel + 1,
  8948. +@@ -299,9 +285,7 @@ static void ath9k_hw_ani_cck_err_trigger
  8949. + */
  8950. + static void ath9k_hw_ani_lower_immunity(struct ath_hw *ah)
  8951. + {
  8952. +- struct ar5416AniState *aniState;
  8953. +-
  8954. +- aniState = &ah->ani;
  8955. ++ struct ar5416AniState *aniState = &ah->ani;
  8956. +
  8957. + /* lower OFDM noise immunity */
  8958. + if (aniState->ofdmNoiseImmunityLevel > 0 &&
  8959. +@@ -329,7 +313,7 @@ void ath9k_ani_reset(struct ath_hw *ah,
  8960. + struct ath_common *common = ath9k_hw_common(ah);
  8961. + int ofdm_nil, cck_nil;
  8962. +
  8963. +- if (!ah->curchan)
  8964. ++ if (!chan)
  8965. + return;
  8966. +
  8967. + BUG_ON(aniState == NULL);
  8968. +@@ -416,14 +400,10 @@ static bool ath9k_hw_ani_read_counters(s
  8969. +
  8970. + void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan)
  8971. + {
  8972. +- struct ar5416AniState *aniState;
  8973. ++ struct ar5416AniState *aniState = &ah->ani;
  8974. + struct ath_common *common = ath9k_hw_common(ah);
  8975. + u32 ofdmPhyErrRate, cckPhyErrRate;
  8976. +
  8977. +- if (!ah->curchan)
  8978. +- return;
  8979. +-
  8980. +- aniState = &ah->ani;
  8981. + if (!ath9k_hw_ani_read_counters(ah))
  8982. + return;
  8983. +
  8984. diff --git a/package/kernel/mac80211/patches/306-ath5k-fix-reset-race.patch b/package/kernel/mac80211/patches/306-ath5k-fix-reset-race.patch
  8985. deleted file mode 100644
  8986. index 85a1904..0000000
  8987. --- a/package/kernel/mac80211/patches/306-ath5k-fix-reset-race.patch
  8988. +++ /dev/null
  8989. @@ -1,96 +0,0 @@
  8990. -From: Sergey Ryazanov <ryazanov.s.a@gmail.com>
  8991. -Date: Wed, 4 Mar 2015 05:12:11 +0300
  8992. -Subject: [PATCH] ath5k: fix reset race
  8993. -
  8994. -To prepare for reset ath5k should finish all asynchronous tasks. At
  8995. -first, it disables the interrupt generation, then it waits for the
  8996. -interrupt handler and tasklets completion, and then proceeds to the HW
  8997. -configuration update. But it does not consider that the interrupt
  8998. -handler or tasklet re-enables the interrupt generation. And we fall in a
  8999. -situation when ath5k assumes that interrupts are disabled, but it is
  9000. -not.
  9001. -
  9002. -This can lead to different consequences, such as reception of the frame,
  9003. -when we do not expect it. Under certain circumstances, this can lead to
  9004. -the following warning:
  9005. -
  9006. - WARNING: at ath5k/base.c:589 ath5k_tasklet_rx+0x318/0x6ec [ath5k]()
  9007. - invalid hw_rix: 1a
  9008. - [..]
  9009. - Call Trace:
  9010. - [<802656a8>] show_stack+0x48/0x70
  9011. - [<802dd92c>] warn_slowpath_common+0x88/0xbc
  9012. - [<802dd98c>] warn_slowpath_fmt+0x2c/0x38
  9013. - [<81b51be8>] ath5k_tasklet_rx+0x318/0x6ec [ath5k]
  9014. - [<8028ac64>] tasklet_action+0x8c/0xf0
  9015. - [<80075804>] __do_softirq+0x180/0x32c
  9016. - [<80196ce8>] irq_exit+0x54/0x70
  9017. - [<80041848>] ret_from_irq+0x0/0x4
  9018. - [<80182fdc>] ioread32+0x4/0xc
  9019. - [<81b4c42c>] ath5k_hw_set_sleep_clock+0x2ec/0x474 [ath5k]
  9020. - [<81b4cf28>] ath5k_hw_reset+0x50/0xeb8 [ath5k]
  9021. - [<81b50900>] ath5k_reset+0xd4/0x310 [ath5k]
  9022. - [<81b557e8>] ath5k_config+0x4c/0x104 [ath5k]
  9023. - [<80d01770>] ieee80211_hw_config+0x2f4/0x35c [mac80211]
  9024. - [<80d09aa8>] ieee80211_scan_work+0x2e4/0x414 [mac80211]
  9025. - [<8022c3f4>] process_one_work+0x28c/0x400
  9026. - [<802df8f8>] worker_thread+0x258/0x3c0
  9027. - [<801b5710>] kthread+0xe0/0xec
  9028. - [<800418a8>] ret_from_kernel_thread+0x14/0x1c
  9029. -
  9030. -Fix this issue by adding a new status flag, which forbids to re-enable
  9031. -the interrupt generation until the HW configuration is completed.
  9032. -
  9033. -Note: previous patch, which reorders the Rx disable code helps to avoid
  9034. -the above warning, but not fixes the root cause of unexpected frame
  9035. -receiving.
  9036. -
  9037. -CC: Jiri Slaby <jirislaby@gmail.com>
  9038. -CC: Nick Kossifidis <mickflemm@gmail.com>
  9039. -CC: Luis R. Rodriguez <mcgrof@do-not-panic.com>
  9040. -Reported-by: Christophe Prevotaux <cprevotaux@nltinc.com>
  9041. -Tested-by: Christophe Prevotaux <cprevotaux@nltinc.com>
  9042. -Tested-by: Eric Bree <ebree@nltinc.com>
  9043. -Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
  9044. ----
  9045. -
  9046. ---- a/drivers/net/wireless/ath/ath5k/ath5k.h
  9047. -+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
  9048. -@@ -1283,6 +1283,7 @@ struct ath5k_hw {
  9049. - #define ATH_STAT_PROMISC 1
  9050. - #define ATH_STAT_LEDSOFT 2 /* enable LED gpio status */
  9051. - #define ATH_STAT_STARTED 3 /* opened & irqs enabled */
  9052. -+#define ATH_STAT_RESET 4 /* hw reset */
  9053. -
  9054. - unsigned int filter_flags; /* HW flags, AR5K_RX_FILTER_* */
  9055. - unsigned int fif_filter_flags; /* Current FIF_* filter flags */
  9056. ---- a/drivers/net/wireless/ath/ath5k/base.c
  9057. -+++ b/drivers/net/wireless/ath/ath5k/base.c
  9058. -@@ -1523,6 +1523,9 @@ ath5k_set_current_imask(struct ath5k_hw
  9059. - enum ath5k_int imask;
  9060. - unsigned long flags;
  9061. -
  9062. -+ if (test_bit(ATH_STAT_RESET, ah->status))
  9063. -+ return;
  9064. -+
  9065. - spin_lock_irqsave(&ah->irqlock, flags);
  9066. - imask = ah->imask;
  9067. - if (ah->rx_pending)
  9068. -@@ -2862,6 +2865,8 @@ ath5k_reset(struct ath5k_hw *ah, struct
  9069. -
  9070. - ATH5K_DBG(ah, ATH5K_DEBUG_RESET, "resetting\n");
  9071. -
  9072. -+ __set_bit(ATH_STAT_RESET, ah->status);
  9073. -+
  9074. - ath5k_hw_set_imr(ah, 0);
  9075. - synchronize_irq(ah->irq);
  9076. - ath5k_stop_tasklets(ah);
  9077. -@@ -2952,6 +2957,8 @@ ath5k_reset(struct ath5k_hw *ah, struct
  9078. - */
  9079. - /* ath5k_chan_change(ah, c); */
  9080. -
  9081. -+ __clear_bit(ATH_STAT_RESET, ah->status);
  9082. -+
  9083. - ath5k_beacon_config(ah);
  9084. - /* intrs are enabled by ath5k_beacon_config */
  9085. -
  9086. diff --git a/package/kernel/mac80211/patches/306-ath9k-do-not-reset-while-BB-panic-0x4000409-on-ar956.patch b/package/kernel/mac80211/patches/306-ath9k-do-not-reset-while-BB-panic-0x4000409-on-ar956.patch
  9087. new file mode 100644
  9088. index 0000000..cf8194a
  9089. --- /dev/null
  9090. +++ b/package/kernel/mac80211/patches/306-ath9k-do-not-reset-while-BB-panic-0x4000409-on-ar956.patch
  9091. @@ -0,0 +1,31 @@
  9092. +From: Miaoqing Pan <miaoqing@codeaurora.org>
  9093. +Date: Fri, 15 Jan 2016 18:17:19 +0800
  9094. +Subject: [PATCH] ath9k: do not reset while BB panic(0x4000409) on ar9561
  9095. +
  9096. +BB panic(0x4000409) observed while AP enabling/disabling
  9097. +bursting.
  9098. +
  9099. +Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  9100. +---
  9101. +
  9102. +--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  9103. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  9104. +@@ -2071,7 +2071,8 @@ void ar9003_hw_attach_phy_ops(struct ath
  9105. + * to be disabled.
  9106. + *
  9107. + * 0x04000409: Packet stuck on receive.
  9108. +- * Full chip reset is required for all chips except AR9340.
  9109. ++ * Full chip reset is required for all chips except
  9110. ++ * AR9340, AR9531 and AR9561.
  9111. + */
  9112. +
  9113. + /*
  9114. +@@ -2100,7 +2101,7 @@ bool ar9003_hw_bb_watchdog_check(struct
  9115. + case 0x04000b09:
  9116. + return true;
  9117. + case 0x04000409:
  9118. +- if (AR_SREV_9340(ah) || AR_SREV_9531(ah))
  9119. ++ if (AR_SREV_9340(ah) || AR_SREV_9531(ah) || AR_SREV_9561(ah))
  9120. + return false;
  9121. + else
  9122. + return true;
  9123. diff --git a/package/kernel/mac80211/patches/307-ath9k-fix-inconsistent-use-of-tab-and-space-in-inden.patch b/package/kernel/mac80211/patches/307-ath9k-fix-inconsistent-use-of-tab-and-space-in-inden.patch
  9124. new file mode 100644
  9125. index 0000000..80b781c
  9126. --- /dev/null
  9127. +++ b/package/kernel/mac80211/patches/307-ath9k-fix-inconsistent-use-of-tab-and-space-in-inden.patch
  9128. @@ -0,0 +1,27 @@
  9129. +From: Miaoqing Pan <miaoqing@codeaurora.org>
  9130. +Date: Fri, 15 Jan 2016 18:17:20 +0800
  9131. +Subject: [PATCH] ath9k: fix inconsistent use of tab and space in
  9132. + indentation
  9133. +
  9134. +Minor changes for indenting.
  9135. +
  9136. +Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  9137. +---
  9138. +
  9139. +--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  9140. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  9141. +@@ -5485,11 +5485,11 @@ unsigned int ar9003_get_paprd_scale_fact
  9142. + AR9300_PAPRD_SCALE_1);
  9143. + else {
  9144. + if (chan->channel >= 5700)
  9145. +- return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20),
  9146. +- AR9300_PAPRD_SCALE_1);
  9147. ++ return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20),
  9148. ++ AR9300_PAPRD_SCALE_1);
  9149. + else if (chan->channel >= 5400)
  9150. + return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt40),
  9151. +- AR9300_PAPRD_SCALE_2);
  9152. ++ AR9300_PAPRD_SCALE_2);
  9153. + else
  9154. + return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt40),
  9155. + AR9300_PAPRD_SCALE_1);
  9156. 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
  9157. deleted file mode 100644
  9158. index ab9771e..0000000
  9159. --- a/package/kernel/mac80211/patches/307-ath9k-fix-tracking-of-enabled-AP-beacons.patch
  9160. +++ /dev/null
  9161. @@ -1,76 +0,0 @@
  9162. -From: Felix Fietkau <nbd@openwrt.org>
  9163. -Date: Thu, 12 Mar 2015 17:10:50 +0100
  9164. -Subject: [PATCH] ath9k: fix tracking of enabled AP beacons
  9165. -
  9166. -sc->nbcnvifs tracks assigned beacon slots, not enabled beacons.
  9167. -Therefore, it cannot be used to decide if cur_conf->enable_beacon (bool)
  9168. -should be updated, or if beacons have been enabled already.
  9169. -With the current code (depending on the order of calls), beacons often
  9170. -do not get enabled in an AP+STA setup.
  9171. -To fix tracking of enabled beacons, convert cur_conf->enable_beacon to a
  9172. -bitmask of enabled beacon slots.
  9173. -
  9174. -Cc: stable@vger.kernel.org
  9175. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9176. ----
  9177. -
  9178. ---- a/drivers/net/wireless/ath/ath9k/beacon.c
  9179. -+++ b/drivers/net/wireless/ath/ath9k/beacon.c
  9180. -@@ -219,12 +219,15 @@ void ath9k_beacon_remove_slot(struct ath
  9181. - struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  9182. - struct ath_vif *avp = (void *)vif->drv_priv;
  9183. - struct ath_buf *bf = avp->av_bcbuf;
  9184. -+ struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon;
  9185. -
  9186. - ath_dbg(common, CONFIG, "Removing interface at beacon slot: %d\n",
  9187. - avp->av_bslot);
  9188. -
  9189. - tasklet_disable(&sc->bcon_tasklet);
  9190. -
  9191. -+ cur_conf->enable_beacon &= ~BIT(avp->av_bslot);
  9192. -+
  9193. - if (bf && bf->bf_mpdu) {
  9194. - struct sk_buff *skb = bf->bf_mpdu;
  9195. - dma_unmap_single(sc->dev, bf->bf_buf_addr,
  9196. -@@ -521,8 +524,7 @@ static bool ath9k_allow_beacon_config(st
  9197. - }
  9198. -
  9199. - if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) {
  9200. -- if ((vif->type != NL80211_IFTYPE_AP) ||
  9201. -- (sc->nbcnvifs > 1)) {
  9202. -+ if (vif->type != NL80211_IFTYPE_AP) {
  9203. - ath_dbg(common, CONFIG,
  9204. - "An AP interface is already present !\n");
  9205. - return false;
  9206. -@@ -616,12 +618,14 @@ void ath9k_beacon_config(struct ath_soft
  9207. - * enabling/disabling SWBA.
  9208. - */
  9209. - if (changed & BSS_CHANGED_BEACON_ENABLED) {
  9210. -- if (!bss_conf->enable_beacon &&
  9211. -- (sc->nbcnvifs <= 1)) {
  9212. -- cur_conf->enable_beacon = false;
  9213. -- } else if (bss_conf->enable_beacon) {
  9214. -- cur_conf->enable_beacon = true;
  9215. -- ath9k_cache_beacon_config(sc, ctx, bss_conf);
  9216. -+ bool enabled = cur_conf->enable_beacon;
  9217. -+
  9218. -+ if (!bss_conf->enable_beacon) {
  9219. -+ cur_conf->enable_beacon &= ~BIT(avp->av_bslot);
  9220. -+ } else {
  9221. -+ cur_conf->enable_beacon |= BIT(avp->av_bslot);
  9222. -+ if (!enabled)
  9223. -+ ath9k_cache_beacon_config(sc, ctx, bss_conf);
  9224. - }
  9225. - }
  9226. -
  9227. ---- a/drivers/net/wireless/ath/ath9k/common.h
  9228. -+++ b/drivers/net/wireless/ath/ath9k/common.h
  9229. -@@ -54,7 +54,7 @@ struct ath_beacon_config {
  9230. - u16 dtim_period;
  9231. - u16 bmiss_timeout;
  9232. - u8 dtim_count;
  9233. -- bool enable_beacon;
  9234. -+ u8 enable_beacon;
  9235. - bool ibss_creator;
  9236. - u32 nexttbtt;
  9237. - u32 intval;
  9238. diff --git a/package/kernel/mac80211/patches/308-ath9k-fix-data-bus-error-on-ar9300-and-ar9580.patch b/package/kernel/mac80211/patches/308-ath9k-fix-data-bus-error-on-ar9300-and-ar9580.patch
  9239. new file mode 100644
  9240. index 0000000..d408866
  9241. --- /dev/null
  9242. +++ b/package/kernel/mac80211/patches/308-ath9k-fix-data-bus-error-on-ar9300-and-ar9580.patch
  9243. @@ -0,0 +1,65 @@
  9244. +From: Miaoqing Pan <miaoqing@codeaurora.org>
  9245. +Date: Fri, 15 Jan 2016 18:17:21 +0800
  9246. +Subject: [PATCH] ath9k: fix data bus error on ar9300 and ar9580
  9247. +
  9248. +One crash issue be found on ar9300: RTC_RC reg read leads crash, leading
  9249. +the data bus error, due to RTC_RC reg write not happen properly.
  9250. +
  9251. +Warm Reset trigger in continuous beacon stuck for one of the customer for
  9252. +other chip, noticed the MAC was stuck in RTC reset. After analysis noticed
  9253. +DMA did not complete when RTC was put in reset.
  9254. +
  9255. +So, before resetting the MAC need to make sure there are no pending DMA
  9256. +transactions because this reset does not reset all parts of the chip.
  9257. +
  9258. +The 12th and 11th bit of MAC _DMA_CFG register used to do that.
  9259. + 12 cfg_halt_ack 0x0
  9260. + 0 DMA has not yet halted
  9261. + 1 DMA has halted
  9262. + 11 cfg_halt_req 0x0
  9263. + 0 DMA logic operates normally
  9264. + 1 Request DMA logic to stop so software can reset the MAC
  9265. +
  9266. +The Bit [12] of this register indicates when the halt has taken effect or
  9267. +not. the DMA halt IS NOT recoverable; once software sets bit [11] to
  9268. +request a DMA halt, software must wait for bit [12] to be set and reset
  9269. +the MAC.
  9270. +
  9271. +So, the same thing we implemented for ar9580 chip.
  9272. +
  9273. +Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  9274. +---
  9275. +
  9276. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  9277. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  9278. +@@ -1368,6 +1368,16 @@ static bool ath9k_hw_set_reset(struct at
  9279. + if (ath9k_hw_mci_is_enabled(ah))
  9280. + ar9003_mci_check_gpm_offset(ah);
  9281. +
  9282. ++ /* DMA HALT added to resolve ar9300 and ar9580 bus error during
  9283. ++ * RTC_RC reg read
  9284. ++ */
  9285. ++ if (AR_SREV_9300(ah) || AR_SREV_9580(ah)) {
  9286. ++ REG_SET_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  9287. ++ ath9k_hw_wait(ah, AR_CFG, AR_CFG_HALT_ACK, AR_CFG_HALT_ACK,
  9288. ++ 20 * AH_WAIT_TIMEOUT);
  9289. ++ REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  9290. ++ }
  9291. ++
  9292. + REG_WRITE(ah, AR_RTC_RC, rst_flags);
  9293. +
  9294. + REGWRITE_BUFFER_FLUSH(ah);
  9295. +--- a/drivers/net/wireless/ath/ath9k/reg.h
  9296. ++++ b/drivers/net/wireless/ath/ath9k/reg.h
  9297. +@@ -34,8 +34,10 @@
  9298. + #define AR_CFG_SWRG 0x00000010
  9299. + #define AR_CFG_AP_ADHOC_INDICATION 0x00000020
  9300. + #define AR_CFG_PHOK 0x00000100
  9301. +-#define AR_CFG_CLK_GATE_DIS 0x00000400
  9302. + #define AR_CFG_EEBS 0x00000200
  9303. ++#define AR_CFG_CLK_GATE_DIS 0x00000400
  9304. ++#define AR_CFG_HALT_REQ 0x00000800
  9305. ++#define AR_CFG_HALT_ACK 0x00001000
  9306. + #define AR_CFG_PCI_MASTER_REQ_Q_THRESH 0x00060000
  9307. + #define AR_CFG_PCI_MASTER_REQ_Q_THRESH_S 17
  9308. +
  9309. 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
  9310. deleted file mode 100644
  9311. index d132636..0000000
  9312. --- a/package/kernel/mac80211/patches/308-mac80211-minstrel_ht-fix-rounding-issue-in-MCS-durat.patch
  9313. +++ /dev/null
  9314. @@ -1,43 +0,0 @@
  9315. -From: Felix Fietkau <nbd@openwrt.org>
  9316. -Date: Fri, 13 Mar 2015 10:49:40 +0100
  9317. -Subject: [PATCH] mac80211: minstrel_ht: fix rounding issue in MCS duration
  9318. - calculation
  9319. -
  9320. -On very high MCS bitrates, the calculated duration of rates that are
  9321. -next to each other can be very imprecise, due to the small packet size
  9322. -used as reference (1200 bytes).
  9323. -This is most visible in VHT80 nss=2 MCS8/9, for which minstrel shows the
  9324. -same throughput when the probability is also the same. This leads to a
  9325. -bad rate selection for such rates.
  9326. -
  9327. -Fix this issue by introducing an average A-MPDU size factor into the
  9328. -calculation.
  9329. -
  9330. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9331. ----
  9332. -
  9333. ---- a/net/mac80211/rc80211_minstrel_ht.c
  9334. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  9335. -@@ -17,10 +17,11 @@
  9336. - #include "rc80211_minstrel.h"
  9337. - #include "rc80211_minstrel_ht.h"
  9338. -
  9339. -+#define AVG_AMPDU_SIZE 16
  9340. - #define AVG_PKT_SIZE 1200
  9341. -
  9342. - /* Number of bits for an average sized packet */
  9343. --#define MCS_NBITS (AVG_PKT_SIZE << 3)
  9344. -+#define MCS_NBITS ((AVG_PKT_SIZE * AVG_AMPDU_SIZE) << 3)
  9345. -
  9346. - /* Number of symbols for a packet with (bps) bits per symbol */
  9347. - #define MCS_NSYMS(bps) DIV_ROUND_UP(MCS_NBITS, (bps))
  9348. -@@ -33,7 +34,8 @@
  9349. - )
  9350. -
  9351. - /* Transmit duration for the raw data part of an average sized packet */
  9352. --#define MCS_DURATION(streams, sgi, bps) MCS_SYMBOL_TIME(sgi, MCS_NSYMS((streams) * (bps)))
  9353. -+#define MCS_DURATION(streams, sgi, bps) \
  9354. -+ (MCS_SYMBOL_TIME(sgi, MCS_NSYMS((streams) * (bps))) / AVG_AMPDU_SIZE)
  9355. -
  9356. - #define BW_20 0
  9357. - #define BW_40 1
  9358. 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
  9359. deleted file mode 100644
  9360. index 945fbce..0000000
  9361. --- a/package/kernel/mac80211/patches/309-ath9k-disable-TPC-support-again-for-now.patch
  9362. +++ /dev/null
  9363. @@ -1,22 +0,0 @@
  9364. -From: Felix Fietkau <nbd@openwrt.org>
  9365. -Date: Sun, 15 Mar 2015 08:02:37 +0100
  9366. -Subject: [PATCH] ath9k: disable TPC support again (for now)
  9367. -
  9368. -TPC support has been observed to cause some tx power fluctuations on
  9369. -some devices with at least AR934x and AR938x chips.
  9370. -Disable it for now until the bugs have been found and fixed
  9371. -
  9372. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9373. ----
  9374. -
  9375. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  9376. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  9377. -@@ -424,7 +424,7 @@ static void ath9k_hw_init_defaults(struc
  9378. - ah->power_mode = ATH9K_PM_UNDEFINED;
  9379. - ah->htc_reset_init = true;
  9380. -
  9381. -- ah->tpc_enabled = true;
  9382. -+ ah->tpc_enabled = false;
  9383. -
  9384. - ah->ani_function = ATH9K_ANI_ALL;
  9385. - if (!AR_SREV_9300_20_OR_LATER(ah))
  9386. diff --git a/package/kernel/mac80211/patches/309-brcmfmac-add-missing-include.patch b/package/kernel/mac80211/patches/309-brcmfmac-add-missing-include.patch
  9387. new file mode 100644
  9388. index 0000000..d9511c8
  9389. --- /dev/null
  9390. +++ b/package/kernel/mac80211/patches/309-brcmfmac-add-missing-include.patch
  9391. @@ -0,0 +1,19 @@
  9392. +From: Felix Fietkau <nbd@openwrt.org>
  9393. +Date: Fri, 15 Jan 2016 15:59:45 +0100
  9394. +Subject: [PATCH] brcmfmac: add missing include
  9395. +
  9396. +linux/module.h is required for defining module parameters
  9397. +
  9398. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9399. +---
  9400. +
  9401. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  9402. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  9403. +@@ -17,6 +17,7 @@
  9404. + #include <linux/kernel.h>
  9405. + #include <linux/string.h>
  9406. + #include <linux/netdevice.h>
  9407. ++#include <linux/module.h>
  9408. + #include <brcmu_wifi.h>
  9409. + #include <brcmu_utils.h>
  9410. + #include "core.h"
  9411. diff --git a/package/kernel/mac80211/patches/310-ath9k_hw-ignore-eeprom-magic-mismatch-on-flash-based.patch b/package/kernel/mac80211/patches/310-ath9k_hw-ignore-eeprom-magic-mismatch-on-flash-based.patch
  9412. new file mode 100644
  9413. index 0000000..287d6e1
  9414. --- /dev/null
  9415. +++ b/package/kernel/mac80211/patches/310-ath9k_hw-ignore-eeprom-magic-mismatch-on-flash-based.patch
  9416. @@ -0,0 +1,38 @@
  9417. +From: Felix Fietkau <nbd@openwrt.org>
  9418. +Date: Thu, 21 Jan 2016 16:28:44 +0100
  9419. +Subject: [PATCH] ath9k_hw: ignore eeprom magic mismatch on flash based devices
  9420. +
  9421. +Many AR913x based devices (maybe others too) do not have a valid EEPROM
  9422. +magic in their calibration data partition.
  9423. +
  9424. +Fixes: 6fa658fd5ab2 ("ath9k: Simplify and fix eeprom endianness swapping")
  9425. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9426. +---
  9427. +
  9428. +--- a/drivers/net/wireless/ath/ath9k/eeprom.c
  9429. ++++ b/drivers/net/wireless/ath/ath9k/eeprom.c
  9430. +@@ -150,18 +150,18 @@ int ath9k_hw_nvram_swap_data(struct ath_
  9431. + return -EIO;
  9432. + }
  9433. +
  9434. +- if (magic == AR5416_EEPROM_MAGIC) {
  9435. +- *swap_needed = false;
  9436. +- } else if (swab16(magic) == AR5416_EEPROM_MAGIC) {
  9437. ++ *swap_needed = false;
  9438. ++ if (swab16(magic) == AR5416_EEPROM_MAGIC) {
  9439. + if (ah->ah_flags & AH_NO_EEP_SWAP) {
  9440. + ath_info(common,
  9441. + "Ignoring endianness difference in EEPROM magic bytes.\n");
  9442. +-
  9443. +- *swap_needed = false;
  9444. + } else {
  9445. + *swap_needed = true;
  9446. + }
  9447. +- } else {
  9448. ++ } else if (magic != AR5416_EEPROM_MAGIC) {
  9449. ++ if (ath9k_hw_use_flash(ah))
  9450. ++ return 0;
  9451. ++
  9452. + ath_err(common,
  9453. + "Invalid EEPROM Magic (0x%04x).\n", magic);
  9454. + return -EINVAL;
  9455. 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
  9456. deleted file mode 100644
  9457. index bd3050e..0000000
  9458. --- a/package/kernel/mac80211/patches/310-mac80211-don-t-look-up-stations-for-multicast-addres.patch
  9459. +++ /dev/null
  9460. @@ -1,21 +0,0 @@
  9461. -From: Johannes Berg <johannes.berg@intel.com>
  9462. -Date: Tue, 24 Feb 2015 00:28:18 +0100
  9463. -Subject: [PATCH] mac80211: don't look up stations for multicast addresses
  9464. -
  9465. -Since multicast addresses don't exist as stations, don't attempt
  9466. -to look them up in the hashtable on TX.
  9467. -
  9468. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9469. ----
  9470. -
  9471. ---- a/net/mac80211/tx.c
  9472. -+++ b/net/mac80211/tx.c
  9473. -@@ -1161,7 +1161,7 @@ ieee80211_tx_prepare(struct ieee80211_su
  9474. - tx->sdata->control_port_protocol == tx->skb->protocol) {
  9475. - tx->sta = sta_info_get_bss(sdata, hdr->addr1);
  9476. - }
  9477. -- if (!tx->sta)
  9478. -+ if (!tx->sta && !is_multicast_ether_addr(hdr->addr1))
  9479. - tx->sta = sta_info_get(sdata, hdr->addr1);
  9480. -
  9481. - if (tx->sta && ieee80211_is_data_qos(hdr->frame_control) &&
  9482. diff --git a/package/kernel/mac80211/patches/311-ath9k-do-not-limit-the-number-of-DFS-interfaces-to-1.patch b/package/kernel/mac80211/patches/311-ath9k-do-not-limit-the-number-of-DFS-interfaces-to-1.patch
  9483. new file mode 100644
  9484. index 0000000..070efa9
  9485. --- /dev/null
  9486. +++ b/package/kernel/mac80211/patches/311-ath9k-do-not-limit-the-number-of-DFS-interfaces-to-1.patch
  9487. @@ -0,0 +1,55 @@
  9488. +From: Felix Fietkau <nbd@openwrt.org>
  9489. +Date: Fri, 22 Jan 2016 01:05:56 +0100
  9490. +Subject: [PATCH] ath9k: do not limit the number of DFS interfaces to 1
  9491. +
  9492. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9493. +---
  9494. +
  9495. +--- a/drivers/net/wireless/ath/ath9k/init.c
  9496. ++++ b/drivers/net/wireless/ath/ath9k/init.c
  9497. +@@ -751,14 +751,6 @@ static const struct ieee80211_iface_comb
  9498. +
  9499. + #endif /* CPTCFG_ATH9K_CHANNEL_CONTEXT */
  9500. +
  9501. +-static const struct ieee80211_iface_limit if_dfs_limits[] = {
  9502. +- { .max = 1, .types = BIT(NL80211_IFTYPE_AP) |
  9503. +-#ifdef CPTCFG_MAC80211_MESH
  9504. +- BIT(NL80211_IFTYPE_MESH_POINT) |
  9505. +-#endif
  9506. +- BIT(NL80211_IFTYPE_ADHOC) },
  9507. +-};
  9508. +-
  9509. + static const struct ieee80211_iface_combination if_comb[] = {
  9510. + {
  9511. + .limits = if_limits,
  9512. +@@ -766,6 +758,11 @@ static const struct ieee80211_iface_comb
  9513. + .max_interfaces = 2048,
  9514. + .num_different_channels = 1,
  9515. + .beacon_int_infra_match = true,
  9516. ++#ifdef CPTCFG_ATH9K_DFS_CERTIFIED
  9517. ++ .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
  9518. ++ BIT(NL80211_CHAN_WIDTH_20) |
  9519. ++ BIT(NL80211_CHAN_WIDTH_40),
  9520. ++#endif
  9521. + },
  9522. + {
  9523. + .limits = wds_limits,
  9524. +@@ -774,18 +771,6 @@ static const struct ieee80211_iface_comb
  9525. + .num_different_channels = 1,
  9526. + .beacon_int_infra_match = true,
  9527. + },
  9528. +-#ifdef CPTCFG_ATH9K_DFS_CERTIFIED
  9529. +- {
  9530. +- .limits = if_dfs_limits,
  9531. +- .n_limits = ARRAY_SIZE(if_dfs_limits),
  9532. +- .max_interfaces = 1,
  9533. +- .num_different_channels = 1,
  9534. +- .beacon_int_infra_match = true,
  9535. +- .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
  9536. +- BIT(NL80211_CHAN_WIDTH_20) |
  9537. +- BIT(NL80211_CHAN_WIDTH_40),
  9538. +- }
  9539. +-#endif
  9540. + };
  9541. +
  9542. + #ifdef CPTCFG_ATH9K_CHANNEL_CONTEXT
  9543. 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
  9544. deleted file mode 100644
  9545. index b2475b9..0000000
  9546. --- a/package/kernel/mac80211/patches/311-mac80211-remove-drop_unencrypted-code.patch
  9547. +++ /dev/null
  9548. @@ -1,130 +0,0 @@
  9549. -From: Johannes Berg <johannes.berg@intel.com>
  9550. -Date: Fri, 20 Mar 2015 11:41:58 +0100
  9551. -Subject: [PATCH] mac80211: remove drop_unencrypted code
  9552. -
  9553. -This mechanism was historic, and only ever used by IBSS, which
  9554. -also doesn't need to have it as it properly manages station's
  9555. -802.1X PAE state (or, with WEP, always has a key.)
  9556. -
  9557. -Remove the mechanism to clean up the code.
  9558. -
  9559. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9560. ----
  9561. -
  9562. ---- a/net/mac80211/debugfs.c
  9563. -+++ b/net/mac80211/debugfs.c
  9564. -@@ -274,8 +274,6 @@ void debugfs_hw_add(struct ieee80211_loc
  9565. - #ifdef CPTCFG_MAC80211_DEBUG_COUNTERS
  9566. - DEBUGFS_STATS_ADD(tx_handlers_drop, local->tx_handlers_drop);
  9567. - DEBUGFS_STATS_ADD(tx_handlers_queued, local->tx_handlers_queued);
  9568. -- DEBUGFS_STATS_ADD(tx_handlers_drop_unencrypted,
  9569. -- local->tx_handlers_drop_unencrypted);
  9570. - DEBUGFS_STATS_ADD(tx_handlers_drop_fragment,
  9571. - local->tx_handlers_drop_fragment);
  9572. - DEBUGFS_STATS_ADD(tx_handlers_drop_wep,
  9573. ---- a/net/mac80211/debugfs_netdev.c
  9574. -+++ b/net/mac80211/debugfs_netdev.c
  9575. -@@ -177,7 +177,6 @@ static ssize_t ieee80211_if_write_##name
  9576. - IEEE80211_IF_FILE_R(name)
  9577. -
  9578. - /* common attributes */
  9579. --IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC);
  9580. - IEEE80211_IF_FILE(rc_rateidx_mask_2ghz, rc_rateidx_mask[IEEE80211_BAND_2GHZ],
  9581. - HEX);
  9582. - IEEE80211_IF_FILE(rc_rateidx_mask_5ghz, rc_rateidx_mask[IEEE80211_BAND_5GHZ],
  9583. -@@ -562,7 +561,6 @@ IEEE80211_IF_FILE(dot11MeshAwakeWindowDu
  9584. -
  9585. - static void add_common_files(struct ieee80211_sub_if_data *sdata)
  9586. - {
  9587. -- DEBUGFS_ADD(drop_unencrypted);
  9588. - DEBUGFS_ADD(rc_rateidx_mask_2ghz);
  9589. - DEBUGFS_ADD(rc_rateidx_mask_5ghz);
  9590. - DEBUGFS_ADD(rc_rateidx_mcs_mask_2ghz);
  9591. ---- a/net/mac80211/ibss.c
  9592. -+++ b/net/mac80211/ibss.c
  9593. -@@ -249,8 +249,6 @@ static void __ieee80211_sta_join_ibss(st
  9594. - if (presp)
  9595. - kfree_rcu(presp, rcu_head);
  9596. -
  9597. -- sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0;
  9598. --
  9599. - /* make a copy of the chandef, it could be modified below. */
  9600. - chandef = *req_chandef;
  9601. - chan = chandef.chan;
  9602. -@@ -1289,8 +1287,6 @@ static void ieee80211_sta_create_ibss(st
  9603. -
  9604. - if (ifibss->privacy)
  9605. - capability |= WLAN_CAPABILITY_PRIVACY;
  9606. -- else
  9607. -- sdata->drop_unencrypted = 0;
  9608. -
  9609. - __ieee80211_sta_join_ibss(sdata, bssid, sdata->vif.bss_conf.beacon_int,
  9610. - &ifibss->chandef, ifibss->basic_rates,
  9611. ---- a/net/mac80211/ieee80211_i.h
  9612. -+++ b/net/mac80211/ieee80211_i.h
  9613. -@@ -842,8 +842,6 @@ struct ieee80211_sub_if_data {
  9614. -
  9615. - unsigned long state;
  9616. -
  9617. -- int drop_unencrypted;
  9618. --
  9619. - char name[IFNAMSIZ];
  9620. -
  9621. - /* Fragment table for host-based reassembly */
  9622. -@@ -1289,7 +1287,6 @@ struct ieee80211_local {
  9623. - /* TX/RX handler statistics */
  9624. - unsigned int tx_handlers_drop;
  9625. - unsigned int tx_handlers_queued;
  9626. -- unsigned int tx_handlers_drop_unencrypted;
  9627. - unsigned int tx_handlers_drop_fragment;
  9628. - unsigned int tx_handlers_drop_wep;
  9629. - unsigned int tx_handlers_drop_not_assoc;
  9630. ---- a/net/mac80211/iface.c
  9631. -+++ b/net/mac80211/iface.c
  9632. -@@ -1535,7 +1535,6 @@ int ieee80211_if_change_type(struct ieee
  9633. - }
  9634. -
  9635. - /* reset some values that shouldn't be kept across type changes */
  9636. -- sdata->drop_unencrypted = 0;
  9637. - if (type == NL80211_IFTYPE_STATION)
  9638. - sdata->u.mgd.use_4addr = false;
  9639. -
  9640. ---- a/net/mac80211/rx.c
  9641. -+++ b/net/mac80211/rx.c
  9642. -@@ -1897,8 +1897,7 @@ static int ieee80211_drop_unencrypted(st
  9643. - /* Drop unencrypted frames if key is set. */
  9644. - if (unlikely(!ieee80211_has_protected(fc) &&
  9645. - !ieee80211_is_nullfunc(fc) &&
  9646. -- ieee80211_is_data(fc) &&
  9647. -- (rx->key || rx->sdata->drop_unencrypted)))
  9648. -+ ieee80211_is_data(fc) && rx->key))
  9649. - return -EACCES;
  9650. -
  9651. - return 0;
  9652. ---- a/net/mac80211/tx.c
  9653. -+++ b/net/mac80211/tx.c
  9654. -@@ -594,23 +594,8 @@ ieee80211_tx_h_select_key(struct ieee802
  9655. - else if (!is_multicast_ether_addr(hdr->addr1) &&
  9656. - (key = rcu_dereference(tx->sdata->default_unicast_key)))
  9657. - tx->key = key;
  9658. -- else if (info->flags & IEEE80211_TX_CTL_INJECTED)
  9659. -+ else
  9660. - tx->key = NULL;
  9661. -- else if (!tx->sdata->drop_unencrypted)
  9662. -- tx->key = NULL;
  9663. -- else if (tx->skb->protocol == tx->sdata->control_port_protocol)
  9664. -- tx->key = NULL;
  9665. -- else if (ieee80211_is_robust_mgmt_frame(tx->skb) &&
  9666. -- !(ieee80211_is_action(hdr->frame_control) &&
  9667. -- tx->sta && test_sta_flag(tx->sta, WLAN_STA_MFP)))
  9668. -- tx->key = NULL;
  9669. -- else if (ieee80211_is_mgmt(hdr->frame_control) &&
  9670. -- !ieee80211_is_robust_mgmt_frame(tx->skb))
  9671. -- tx->key = NULL;
  9672. -- else {
  9673. -- I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted);
  9674. -- return TX_DROP;
  9675. -- }
  9676. -
  9677. - if (tx->key) {
  9678. - bool skip_hw = false;
  9679. 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
  9680. deleted file mode 100644
  9681. index 02a7fab..0000000
  9682. --- a/package/kernel/mac80211/patches/312-mac80211-don-t-look-up-destination-station-twice.patch
  9683. +++ /dev/null
  9684. @@ -1,71 +0,0 @@
  9685. -From: Johannes Berg <johannes.berg@intel.com>
  9686. -Date: Fri, 20 Mar 2015 16:24:21 +0100
  9687. -Subject: [PATCH] mac80211: don't look up destination station twice
  9688. -
  9689. -There's no need to look up the destination station twice while
  9690. -building the 802.11 header for a given frame if the frame will
  9691. -actually be transmitted to the station we initially looked up.
  9692. -
  9693. -This happens for 4-addr VLAN interfaces and TDLS connections, which
  9694. -both directly send the frame to the station they looked up, though
  9695. -in the case of TDLS some station conditions need to be checked.
  9696. -
  9697. -To avoid that, add a variable indicating that we've looked up the
  9698. -station that the frame is going to be transmitted to, and avoid the
  9699. -lookup/flag checking if it already has been done.
  9700. -
  9701. -In the TDLS case, also move the authorized/wme_sta flag assignment
  9702. -to the correct place, i.e. only when that station is really used.
  9703. -Before this change, the new lookup should always have succeeded so
  9704. -that the potentially erroneous data would be overwritten.
  9705. -
  9706. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9707. ----
  9708. -
  9709. ---- a/net/mac80211/tx.c
  9710. -+++ b/net/mac80211/tx.c
  9711. -@@ -1894,6 +1894,7 @@ static struct sk_buff *ieee80211_build_h
  9712. - bool wme_sta = false, authorized = false, tdls_auth = false;
  9713. - bool tdls_peer = false, tdls_setup_frame = false;
  9714. - bool multicast;
  9715. -+ bool have_station = false;
  9716. - u16 info_id = 0;
  9717. - struct ieee80211_chanctx_conf *chanctx_conf;
  9718. - struct ieee80211_sub_if_data *ap_sdata;
  9719. -@@ -1918,6 +1919,7 @@ static struct sk_buff *ieee80211_build_h
  9720. - hdrlen = 30;
  9721. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  9722. - wme_sta = sta->sta.wme;
  9723. -+ have_station = true;
  9724. - }
  9725. - ap_sdata = container_of(sdata->bss, struct ieee80211_sub_if_data,
  9726. - u.ap);
  9727. -@@ -2034,9 +2036,6 @@ static struct sk_buff *ieee80211_build_h
  9728. - if (sdata->wdev.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) {
  9729. - sta = sta_info_get(sdata, skb->data);
  9730. - if (sta) {
  9731. -- authorized = test_sta_flag(sta,
  9732. -- WLAN_STA_AUTHORIZED);
  9733. -- wme_sta = sta->sta.wme;
  9734. - tdls_peer = test_sta_flag(sta,
  9735. - WLAN_STA_TDLS_PEER);
  9736. - tdls_auth = test_sta_flag(sta,
  9737. -@@ -2068,6 +2067,9 @@ static struct sk_buff *ieee80211_build_h
  9738. - memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN);
  9739. - memcpy(hdr.addr3, sdata->u.mgd.bssid, ETH_ALEN);
  9740. - hdrlen = 24;
  9741. -+ have_station = true;
  9742. -+ authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  9743. -+ wme_sta = sta->sta.wme;
  9744. - } else if (sdata->u.mgd.use_4addr &&
  9745. - cpu_to_be16(ethertype) != sdata->control_port_protocol) {
  9746. - fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS |
  9747. -@@ -2130,7 +2132,7 @@ static struct sk_buff *ieee80211_build_h
  9748. - * in AP mode)
  9749. - */
  9750. - multicast = is_multicast_ether_addr(hdr.addr1);
  9751. -- if (!multicast) {
  9752. -+ if (!multicast && !have_station) {
  9753. - sta = sta_info_get(sdata, hdr.addr1);
  9754. - if (sta) {
  9755. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  9756. diff --git a/package/kernel/mac80211/patches/312-mac80211-fix-txq-queue-related-crashes.patch b/package/kernel/mac80211/patches/312-mac80211-fix-txq-queue-related-crashes.patch
  9757. new file mode 100644
  9758. index 0000000..61cafc7
  9759. --- /dev/null
  9760. +++ b/package/kernel/mac80211/patches/312-mac80211-fix-txq-queue-related-crashes.patch
  9761. @@ -0,0 +1,27 @@
  9762. +From: Michal Kazior <michal.kazior@tieto.com>
  9763. +Date: Thu, 21 Jan 2016 14:23:07 +0100
  9764. +Subject: [PATCH] mac80211: fix txq queue related crashes
  9765. +
  9766. +The driver can access the queue simultanously
  9767. +while mac80211 tears down the interface. Without
  9768. +spinlock protection this could lead to corrupting
  9769. +sk_buff_head and subsequently to an invalid
  9770. +pointer dereference.
  9771. +
  9772. +Fixes: ba8c3d6f16a1 ("mac80211: add an intermediate software queue implementation")
  9773. +Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
  9774. +---
  9775. +
  9776. +--- a/net/mac80211/iface.c
  9777. ++++ b/net/mac80211/iface.c
  9778. +@@ -977,7 +977,10 @@ static void ieee80211_do_stop(struct iee
  9779. + if (sdata->vif.txq) {
  9780. + struct txq_info *txqi = to_txq_info(sdata->vif.txq);
  9781. +
  9782. ++ spin_lock_bh(&txqi->queue.lock);
  9783. + ieee80211_purge_tx_queue(&local->hw, &txqi->queue);
  9784. ++ spin_unlock_bh(&txqi->queue.lock);
  9785. ++
  9786. + atomic_set(&sdata->txqs_len[txqi->txq.ac], 0);
  9787. + }
  9788. +
  9789. 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
  9790. deleted file mode 100644
  9791. index 4125351..0000000
  9792. --- a/package/kernel/mac80211/patches/313-mac80211-drop-4-addr-VLAN-frames-earlier-if-not-conn.patch
  9793. +++ /dev/null
  9794. @@ -1,27 +0,0 @@
  9795. -From: Johannes Berg <johannes.berg@intel.com>
  9796. -Date: Fri, 20 Mar 2015 16:24:22 +0100
  9797. -Subject: [PATCH] mac80211: drop 4-addr VLAN frames earlier if not
  9798. - connected
  9799. -
  9800. -If there's no station on the 4-addr VLAN interface, then frames
  9801. -cannot be transmitted. Drop such frames earlier, before setting
  9802. -up all the information for them.
  9803. -
  9804. -We should keep the old check though since that code might be used
  9805. -for other internally-generated frames.
  9806. -
  9807. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9808. ----
  9809. -
  9810. ---- a/net/mac80211/tx.c
  9811. -+++ b/net/mac80211/tx.c
  9812. -@@ -1920,6 +1920,9 @@ static struct sk_buff *ieee80211_build_h
  9813. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  9814. - wme_sta = sta->sta.wme;
  9815. - have_station = true;
  9816. -+ } else if (sdata->wdev.use_4addr) {
  9817. -+ ret = -ENOLINK;
  9818. -+ goto free;
  9819. - }
  9820. - ap_sdata = container_of(sdata->bss, struct ieee80211_sub_if_data,
  9821. - u.ap);
  9822. diff --git a/package/kernel/mac80211/patches/313-mac80211-fix-unnecessary-frame-drops-in-mesh-fwding.patch b/package/kernel/mac80211/patches/313-mac80211-fix-unnecessary-frame-drops-in-mesh-fwding.patch
  9823. new file mode 100644
  9824. index 0000000..844d43b
  9825. --- /dev/null
  9826. +++ b/package/kernel/mac80211/patches/313-mac80211-fix-unnecessary-frame-drops-in-mesh-fwding.patch
  9827. @@ -0,0 +1,57 @@
  9828. +From: Michal Kazior <michal.kazior@tieto.com>
  9829. +Date: Mon, 25 Jan 2016 14:43:24 +0100
  9830. +Subject: [PATCH] mac80211: fix unnecessary frame drops in mesh fwding
  9831. +
  9832. +The ieee80211_queue_stopped() expects hw queue
  9833. +number but it was given raw WMM AC number instead.
  9834. +
  9835. +This could cause frame drops and problems with
  9836. +traffic in some cases - most notably if driver
  9837. +doesn't map AC numbers to queue numbers 1:1 and
  9838. +uses ieee80211_stop_queues() and
  9839. +ieee80211_wake_queue() only without ever calling
  9840. +ieee80211_wake_queues().
  9841. +
  9842. +On ath10k it was possible to hit this problem in
  9843. +the following case:
  9844. +
  9845. + 1. wlan0 uses queue 0
  9846. + (ath10k maps queues per vif)
  9847. + 2. offchannel uses queue 15
  9848. + 3. queues 1-14 are unused
  9849. + 4. ieee80211_stop_queues()
  9850. + 5. ieee80211_wake_queue(q=0)
  9851. + 6. ieee80211_wake_queue(q=15)
  9852. + (other queues are not woken up because both
  9853. + driver and mac80211 know other queues are
  9854. + unused)
  9855. + 7. ieee80211_rx_h_mesh_fwding()
  9856. + 8. ieee80211_select_queue_80211() returns 2
  9857. + 9. ieee80211_queue_stopped(q=2) returns true
  9858. + 10. frame is dropped (oops!)
  9859. +
  9860. +Fixes: d3c1597b8d1b ("mac80211: fix forwarded mesh frame queue mapping")
  9861. +Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
  9862. +---
  9863. +
  9864. +--- a/net/mac80211/rx.c
  9865. ++++ b/net/mac80211/rx.c
  9866. +@@ -2235,7 +2235,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  9867. + struct ieee80211_local *local = rx->local;
  9868. + struct ieee80211_sub_if_data *sdata = rx->sdata;
  9869. + struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
  9870. +- u16 q, hdrlen;
  9871. ++ u16 ac, q, hdrlen;
  9872. +
  9873. + hdr = (struct ieee80211_hdr *) skb->data;
  9874. + hdrlen = ieee80211_hdrlen(hdr->frame_control);
  9875. +@@ -2304,7 +2304,8 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  9876. + ether_addr_equal(sdata->vif.addr, hdr->addr3))
  9877. + return RX_CONTINUE;
  9878. +
  9879. +- q = ieee80211_select_queue_80211(sdata, skb, hdr);
  9880. ++ ac = ieee80211_select_queue_80211(sdata, skb, hdr);
  9881. ++ q = sdata->vif.hw_queue[ac];
  9882. + if (ieee80211_queue_stopped(&local->hw, q)) {
  9883. + IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_congestion);
  9884. + return RX_DROP_MONITOR;
  9885. diff --git a/package/kernel/mac80211/patches/314-mac80211-Requeue-work-after-scan-complete-for-all-VI.patch b/package/kernel/mac80211/patches/314-mac80211-Requeue-work-after-scan-complete-for-all-VI.patch
  9886. new file mode 100644
  9887. index 0000000..5b3efbd
  9888. --- /dev/null
  9889. +++ b/package/kernel/mac80211/patches/314-mac80211-Requeue-work-after-scan-complete-for-all-VI.patch
  9890. @@ -0,0 +1,103 @@
  9891. +From: Sachin Kulkarni <Sachin.Kulkarni@imgtec.com>
  9892. +Date: Tue, 12 Jan 2016 14:30:19 +0530
  9893. +Subject: [PATCH] mac80211: Requeue work after scan complete for all VIF
  9894. + types.
  9895. +
  9896. +During a sw scan ieee80211_iface_work ignores work items for all vifs.
  9897. +However after the scan complete work is requeued only for STA, ADHOC
  9898. +and MESH iftypes.
  9899. +
  9900. +This occasionally results in event processing getting delayed/not
  9901. +processed for iftype AP when it coexists with a STA. This can result
  9902. +in data halt and eventually disconnection on the AP interface.
  9903. +
  9904. +Signed-off-by: Sachin Kulkarni <Sachin.Kulkarni@imgtec.com>
  9905. +Cc: linux-wireless@vger.kernel.org
  9906. +Cc: johannes@sipsolutions.net
  9907. +---
  9908. +
  9909. +--- a/net/mac80211/ibss.c
  9910. ++++ b/net/mac80211/ibss.c
  9911. +@@ -1731,7 +1731,6 @@ void ieee80211_ibss_notify_scan_complete
  9912. + if (sdata->vif.type != NL80211_IFTYPE_ADHOC)
  9913. + continue;
  9914. + sdata->u.ibss.last_scan_completed = jiffies;
  9915. +- ieee80211_queue_work(&local->hw, &sdata->work);
  9916. + }
  9917. + mutex_unlock(&local->iflist_mtx);
  9918. + }
  9919. +--- a/net/mac80211/mesh.c
  9920. ++++ b/net/mac80211/mesh.c
  9921. +@@ -1369,17 +1369,6 @@ out:
  9922. + sdata_unlock(sdata);
  9923. + }
  9924. +
  9925. +-void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local)
  9926. +-{
  9927. +- struct ieee80211_sub_if_data *sdata;
  9928. +-
  9929. +- rcu_read_lock();
  9930. +- list_for_each_entry_rcu(sdata, &local->interfaces, list)
  9931. +- if (ieee80211_vif_is_mesh(&sdata->vif) &&
  9932. +- ieee80211_sdata_running(sdata))
  9933. +- ieee80211_queue_work(&local->hw, &sdata->work);
  9934. +- rcu_read_unlock();
  9935. +-}
  9936. +
  9937. + void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata)
  9938. + {
  9939. +--- a/net/mac80211/mesh.h
  9940. ++++ b/net/mac80211/mesh.h
  9941. +@@ -362,14 +362,10 @@ static inline bool mesh_path_sel_is_hwmp
  9942. + return sdata->u.mesh.mesh_pp_id == IEEE80211_PATH_PROTOCOL_HWMP;
  9943. + }
  9944. +
  9945. +-void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local);
  9946. +-
  9947. + void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata);
  9948. + void mesh_sync_adjust_tbtt(struct ieee80211_sub_if_data *sdata);
  9949. + void ieee80211s_stop(void);
  9950. + #else
  9951. +-static inline void
  9952. +-ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local) {}
  9953. + static inline bool mesh_path_sel_is_hwmp(struct ieee80211_sub_if_data *sdata)
  9954. + { return false; }
  9955. + static inline void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata)
  9956. +--- a/net/mac80211/mlme.c
  9957. ++++ b/net/mac80211/mlme.c
  9958. +@@ -3978,8 +3978,6 @@ static void ieee80211_restart_sta_timer(
  9959. + if (!ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR))
  9960. + ieee80211_queue_work(&sdata->local->hw,
  9961. + &sdata->u.mgd.monitor_work);
  9962. +- /* and do all the other regular work too */
  9963. +- ieee80211_queue_work(&sdata->local->hw, &sdata->work);
  9964. + }
  9965. + }
  9966. +
  9967. +--- a/net/mac80211/scan.c
  9968. ++++ b/net/mac80211/scan.c
  9969. +@@ -314,6 +314,7 @@ static void __ieee80211_scan_completed(s
  9970. + bool was_scanning = local->scanning;
  9971. + struct cfg80211_scan_request *scan_req;
  9972. + struct ieee80211_sub_if_data *scan_sdata;
  9973. ++ struct ieee80211_sub_if_data *sdata;
  9974. +
  9975. + lockdep_assert_held(&local->mtx);
  9976. +
  9977. +@@ -373,7 +374,15 @@ static void __ieee80211_scan_completed(s
  9978. +
  9979. + ieee80211_mlme_notify_scan_completed(local);
  9980. + ieee80211_ibss_notify_scan_completed(local);
  9981. +- ieee80211_mesh_notify_scan_completed(local);
  9982. ++
  9983. ++ /* Requeue all the work that might have been ignored while
  9984. ++ * the scan was in progress
  9985. ++ */
  9986. ++ list_for_each_entry_rcu(sdata, &local->interfaces, list) {
  9987. ++ if (ieee80211_sdata_running(sdata))
  9988. ++ ieee80211_queue_work(&sdata->local->hw, &sdata->work);
  9989. ++ }
  9990. ++
  9991. + if (was_scanning)
  9992. + ieee80211_start_next_roc(local);
  9993. + }
  9994. 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
  9995. deleted file mode 100644
  9996. index 9105a64..0000000
  9997. --- a/package/kernel/mac80211/patches/314-mac80211-mesh-avoid-pointless-station-lookup.patch
  9998. +++ /dev/null
  9999. @@ -1,33 +0,0 @@
  10000. -From: Johannes Berg <johannes.berg@intel.com>
  10001. -Date: Fri, 20 Mar 2015 16:24:23 +0100
  10002. -Subject: [PATCH] mac80211: mesh: avoid pointless station lookup
  10003. -
  10004. -In ieee80211_build_hdr(), the station is looked up to build the
  10005. -header correctly (QoS field) and to check for authorization. For
  10006. -mesh, authorization isn't checked here, and QoS capability is
  10007. -mandatory, so the station lookup can be avoided.
  10008. -
  10009. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  10010. ----
  10011. -
  10012. ---- a/net/mac80211/tx.c
  10013. -+++ b/net/mac80211/tx.c
  10014. -@@ -2130,12 +2130,14 @@ static struct sk_buff *ieee80211_build_h
  10015. - }
  10016. -
  10017. - /*
  10018. -- * There's no need to try to look up the destination
  10019. -- * if it is a multicast address (which can only happen
  10020. -- * in AP mode)
  10021. -+ * There's no need to try to look up the destination station
  10022. -+ * if it is a multicast address. In mesh, there's no need to
  10023. -+ * look up the station at all as it always must be QoS capable
  10024. -+ * and mesh mode checks authorization later.
  10025. - */
  10026. - multicast = is_multicast_ether_addr(hdr.addr1);
  10027. -- if (!multicast && !have_station) {
  10028. -+ if (!multicast && !have_station &&
  10029. -+ !ieee80211_vif_is_mesh(&sdata->vif)) {
  10030. - sta = sta_info_get(sdata, hdr.addr1);
  10031. - if (sta) {
  10032. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  10033. 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
  10034. deleted file mode 100644
  10035. index d143025..0000000
  10036. --- a/package/kernel/mac80211/patches/315-mac80211-avoid-duplicate-TX-path-station-lookup.patch
  10037. +++ /dev/null
  10038. @@ -1,267 +0,0 @@
  10039. -From: Johannes Berg <johannes.berg@intel.com>
  10040. -Date: Fri, 20 Mar 2015 14:18:27 +0100
  10041. -Subject: [PATCH] mac80211: avoid duplicate TX path station lookup
  10042. -
  10043. -Instead of looking up the destination station twice in the TX path
  10044. -(first to build the header, and then for control processing), save
  10045. -it when building the header and use it later in the TX path.
  10046. -
  10047. -To avoid having to look up the station in the many callers, allow
  10048. -those to pass %NULL which keeps the existing lookup.
  10049. -
  10050. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  10051. ----
  10052. -
  10053. ---- a/net/mac80211/cfg.c
  10054. -+++ b/net/mac80211/cfg.c
  10055. -@@ -3565,7 +3565,7 @@ static int ieee80211_probe_client(struct
  10056. - nullfunc->qos_ctrl = cpu_to_le16(7);
  10057. -
  10058. - local_bh_disable();
  10059. -- ieee80211_xmit(sdata, skb);
  10060. -+ ieee80211_xmit(sdata, sta, skb);
  10061. - local_bh_enable();
  10062. - rcu_read_unlock();
  10063. -
  10064. ---- a/net/mac80211/ieee80211_i.h
  10065. -+++ b/net/mac80211/ieee80211_i.h
  10066. -@@ -1775,7 +1775,8 @@ void mac80211_ev_michael_mic_failure(str
  10067. - gfp_t gfp);
  10068. - void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata,
  10069. - bool bss_notify);
  10070. --void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb);
  10071. -+void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
  10072. -+ struct sta_info *sta, struct sk_buff *skb);
  10073. -
  10074. - void __ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata,
  10075. - struct sk_buff *skb, int tid,
  10076. ---- a/net/mac80211/sta_info.c
  10077. -+++ b/net/mac80211/sta_info.c
  10078. -@@ -1279,7 +1279,7 @@ static void ieee80211_send_null_response
  10079. - }
  10080. -
  10081. - info->band = chanctx_conf->def.chan->band;
  10082. -- ieee80211_xmit(sdata, skb);
  10083. -+ ieee80211_xmit(sdata, sta, skb);
  10084. - rcu_read_unlock();
  10085. - }
  10086. -
  10087. ---- a/net/mac80211/tx.c
  10088. -+++ b/net/mac80211/tx.c
  10089. -@@ -1110,11 +1110,13 @@ static bool ieee80211_tx_prep_agg(struct
  10090. -
  10091. - /*
  10092. - * initialises @tx
  10093. -+ * pass %NULL for the station if unknown, a valid pointer if known
  10094. -+ * or an ERR_PTR() if the station is known not to exist
  10095. - */
  10096. - static ieee80211_tx_result
  10097. - ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata,
  10098. - struct ieee80211_tx_data *tx,
  10099. -- struct sk_buff *skb)
  10100. -+ struct sta_info *sta, struct sk_buff *skb)
  10101. - {
  10102. - struct ieee80211_local *local = sdata->local;
  10103. - struct ieee80211_hdr *hdr;
  10104. -@@ -1137,17 +1139,22 @@ ieee80211_tx_prepare(struct ieee80211_su
  10105. -
  10106. - hdr = (struct ieee80211_hdr *) skb->data;
  10107. -
  10108. -- if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
  10109. -- tx->sta = rcu_dereference(sdata->u.vlan.sta);
  10110. -- if (!tx->sta && sdata->dev->ieee80211_ptr->use_4addr)
  10111. -- return TX_DROP;
  10112. -- } else if (info->flags & (IEEE80211_TX_CTL_INJECTED |
  10113. -- IEEE80211_TX_INTFL_NL80211_FRAME_TX) ||
  10114. -- tx->sdata->control_port_protocol == tx->skb->protocol) {
  10115. -- tx->sta = sta_info_get_bss(sdata, hdr->addr1);
  10116. -+ if (likely(sta)) {
  10117. -+ if (!IS_ERR(sta))
  10118. -+ tx->sta = sta;
  10119. -+ } else {
  10120. -+ if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
  10121. -+ tx->sta = rcu_dereference(sdata->u.vlan.sta);
  10122. -+ if (!tx->sta && sdata->wdev.use_4addr)
  10123. -+ return TX_DROP;
  10124. -+ } else if (info->flags & (IEEE80211_TX_INTFL_NL80211_FRAME_TX |
  10125. -+ IEEE80211_TX_CTL_INJECTED) ||
  10126. -+ tx->sdata->control_port_protocol == tx->skb->protocol) {
  10127. -+ tx->sta = sta_info_get_bss(sdata, hdr->addr1);
  10128. -+ }
  10129. -+ if (!tx->sta && !is_multicast_ether_addr(hdr->addr1))
  10130. -+ tx->sta = sta_info_get(sdata, hdr->addr1);
  10131. - }
  10132. -- if (!tx->sta && !is_multicast_ether_addr(hdr->addr1))
  10133. -- tx->sta = sta_info_get(sdata, hdr->addr1);
  10134. -
  10135. - if (tx->sta && ieee80211_is_data_qos(hdr->frame_control) &&
  10136. - !ieee80211_is_qos_nullfunc(hdr->frame_control) &&
  10137. -@@ -1485,7 +1492,7 @@ bool ieee80211_tx_prepare_skb(struct iee
  10138. - struct ieee80211_tx_data tx;
  10139. - struct sk_buff *skb2;
  10140. -
  10141. -- if (ieee80211_tx_prepare(sdata, &tx, skb) == TX_DROP)
  10142. -+ if (ieee80211_tx_prepare(sdata, &tx, NULL, skb) == TX_DROP)
  10143. - return false;
  10144. -
  10145. - info->band = band;
  10146. -@@ -1518,7 +1525,8 @@ EXPORT_SYMBOL(ieee80211_tx_prepare_skb);
  10147. - * Returns false if the frame couldn't be transmitted but was queued instead.
  10148. - */
  10149. - static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata,
  10150. -- struct sk_buff *skb, bool txpending)
  10151. -+ struct sta_info *sta, struct sk_buff *skb,
  10152. -+ bool txpending)
  10153. - {
  10154. - struct ieee80211_local *local = sdata->local;
  10155. - struct ieee80211_tx_data tx;
  10156. -@@ -1534,7 +1542,7 @@ static bool ieee80211_tx(struct ieee8021
  10157. -
  10158. - /* initialises tx */
  10159. - led_len = skb->len;
  10160. -- res_prepare = ieee80211_tx_prepare(sdata, &tx, skb);
  10161. -+ res_prepare = ieee80211_tx_prepare(sdata, &tx, sta, skb);
  10162. -
  10163. - if (unlikely(res_prepare == TX_DROP)) {
  10164. - ieee80211_free_txskb(&local->hw, skb);
  10165. -@@ -1590,7 +1598,8 @@ static int ieee80211_skb_resize(struct i
  10166. - return 0;
  10167. - }
  10168. -
  10169. --void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb)
  10170. -+void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
  10171. -+ struct sta_info *sta, struct sk_buff *skb)
  10172. - {
  10173. - struct ieee80211_local *local = sdata->local;
  10174. - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  10175. -@@ -1625,7 +1634,7 @@ void ieee80211_xmit(struct ieee80211_sub
  10176. - }
  10177. -
  10178. - ieee80211_set_qos_hdr(sdata, skb);
  10179. -- ieee80211_tx(sdata, skb, false);
  10180. -+ ieee80211_tx(sdata, sta, skb, false);
  10181. - }
  10182. -
  10183. - static bool ieee80211_parse_tx_radiotap(struct sk_buff *skb)
  10184. -@@ -1846,7 +1855,7 @@ netdev_tx_t ieee80211_monitor_start_xmit
  10185. - goto fail_rcu;
  10186. -
  10187. - info->band = chandef->chan->band;
  10188. -- ieee80211_xmit(sdata, skb);
  10189. -+ ieee80211_xmit(sdata, NULL, skb);
  10190. - rcu_read_unlock();
  10191. -
  10192. - return NETDEV_TX_OK;
  10193. -@@ -1877,7 +1886,8 @@ fail:
  10194. - * Returns: the (possibly reallocated) skb or an ERR_PTR() code
  10195. - */
  10196. - static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
  10197. -- struct sk_buff *skb, u32 info_flags)
  10198. -+ struct sk_buff *skb, u32 info_flags,
  10199. -+ struct sta_info **sta_out)
  10200. - {
  10201. - struct ieee80211_local *local = sdata->local;
  10202. - struct ieee80211_tx_info *info;
  10203. -@@ -1920,6 +1930,7 @@ static struct sk_buff *ieee80211_build_h
  10204. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  10205. - wme_sta = sta->sta.wme;
  10206. - have_station = true;
  10207. -+ *sta_out = sta;
  10208. - } else if (sdata->wdev.use_4addr) {
  10209. - ret = -ENOLINK;
  10210. - goto free;
  10211. -@@ -2073,6 +2084,7 @@ static struct sk_buff *ieee80211_build_h
  10212. - have_station = true;
  10213. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  10214. - wme_sta = sta->sta.wme;
  10215. -+ *sta_out = sta;
  10216. - } else if (sdata->u.mgd.use_4addr &&
  10217. - cpu_to_be16(ethertype) != sdata->control_port_protocol) {
  10218. - fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS |
  10219. -@@ -2136,13 +2148,18 @@ static struct sk_buff *ieee80211_build_h
  10220. - * and mesh mode checks authorization later.
  10221. - */
  10222. - multicast = is_multicast_ether_addr(hdr.addr1);
  10223. -- if (!multicast && !have_station &&
  10224. -- !ieee80211_vif_is_mesh(&sdata->vif)) {
  10225. -- sta = sta_info_get(sdata, hdr.addr1);
  10226. -+ if (multicast) {
  10227. -+ *sta_out = ERR_PTR(-ENOENT);
  10228. -+ } else if (!have_station && !ieee80211_vif_is_mesh(&sdata->vif)) {
  10229. -+ if (sdata->control_port_protocol == skb->protocol)
  10230. -+ sta = sta_info_get_bss(sdata, hdr.addr1);
  10231. -+ else
  10232. -+ sta = sta_info_get(sdata, hdr.addr1);
  10233. - if (sta) {
  10234. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  10235. - wme_sta = sta->sta.wme;
  10236. - }
  10237. -+ *sta_out = sta ?: ERR_PTR(-ENOENT);
  10238. - }
  10239. -
  10240. - /* For mesh, the use of the QoS header is mandatory */
  10241. -@@ -2320,6 +2337,7 @@ void __ieee80211_subif_start_xmit(struct
  10242. - u32 info_flags)
  10243. - {
  10244. - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  10245. -+ struct sta_info *sta = NULL;
  10246. -
  10247. - if (unlikely(skb->len < ETH_HLEN)) {
  10248. - kfree_skb(skb);
  10249. -@@ -2328,7 +2346,7 @@ void __ieee80211_subif_start_xmit(struct
  10250. -
  10251. - rcu_read_lock();
  10252. -
  10253. -- skb = ieee80211_build_hdr(sdata, skb, info_flags);
  10254. -+ skb = ieee80211_build_hdr(sdata, skb, info_flags, &sta);
  10255. - if (IS_ERR(skb))
  10256. - goto out;
  10257. -
  10258. -@@ -2336,7 +2354,7 @@ void __ieee80211_subif_start_xmit(struct
  10259. - dev->stats.tx_bytes += skb->len;
  10260. - dev->trans_start = jiffies;
  10261. -
  10262. -- ieee80211_xmit(sdata, skb);
  10263. -+ ieee80211_xmit(sdata, sta, skb);
  10264. - out:
  10265. - rcu_read_unlock();
  10266. - }
  10267. -@@ -2364,10 +2382,11 @@ ieee80211_build_data_template(struct iee
  10268. - .local = sdata->local,
  10269. - .sdata = sdata,
  10270. - };
  10271. -+ struct sta_info *sta_ignore;
  10272. -
  10273. - rcu_read_lock();
  10274. -
  10275. -- skb = ieee80211_build_hdr(sdata, skb, info_flags);
  10276. -+ skb = ieee80211_build_hdr(sdata, skb, info_flags, &sta_ignore);
  10277. - if (IS_ERR(skb))
  10278. - goto out;
  10279. -
  10280. -@@ -2425,7 +2444,7 @@ static bool ieee80211_tx_pending_skb(str
  10281. - return true;
  10282. - }
  10283. - info->band = chanctx_conf->def.chan->band;
  10284. -- result = ieee80211_tx(sdata, skb, true);
  10285. -+ result = ieee80211_tx(sdata, NULL, skb, true);
  10286. - } else {
  10287. - struct sk_buff_head skbs;
  10288. -
  10289. -@@ -3163,7 +3182,7 @@ ieee80211_get_buffered_bc(struct ieee802
  10290. -
  10291. - if (sdata->vif.type == NL80211_IFTYPE_AP)
  10292. - sdata = IEEE80211_DEV_TO_SUB_IF(skb->dev);
  10293. -- if (!ieee80211_tx_prepare(sdata, &tx, skb))
  10294. -+ if (!ieee80211_tx_prepare(sdata, &tx, NULL, skb))
  10295. - break;
  10296. - dev_kfree_skb_any(skb);
  10297. - }
  10298. -@@ -3295,6 +3314,6 @@ void __ieee80211_tx_skb_tid_band(struct
  10299. - */
  10300. - local_bh_disable();
  10301. - IEEE80211_SKB_CB(skb)->band = band;
  10302. -- ieee80211_xmit(sdata, skb);
  10303. -+ ieee80211_xmit(sdata, NULL, skb);
  10304. - local_bh_enable();
  10305. - }
  10306. diff --git a/package/kernel/mac80211/patches/315-mac80211-fix-ibss-scan-parameters.patch b/package/kernel/mac80211/patches/315-mac80211-fix-ibss-scan-parameters.patch
  10307. new file mode 100644
  10308. index 0000000..52fecb9
  10309. --- /dev/null
  10310. +++ b/package/kernel/mac80211/patches/315-mac80211-fix-ibss-scan-parameters.patch
  10311. @@ -0,0 +1,57 @@
  10312. +From: Sara Sharon <sara.sharon@intel.com>
  10313. +Date: Mon, 25 Jan 2016 15:46:35 +0200
  10314. +Subject: [PATCH] mac80211: fix ibss scan parameters
  10315. +
  10316. +When joining IBSS a full scan should be initiated in order to search
  10317. +for existing cell, unless the fixed_channel parameter was set.
  10318. +A default channel to create the IBSS on if no cell was found is
  10319. +provided as well.
  10320. +However - a scan is initiated only on the default channel provided
  10321. +regardless of whether ifibss->fixed_channel is set or not, with the
  10322. +obvious result of the cell not joining existing IBSS cell that is
  10323. +on another channel.
  10324. +
  10325. +Fixes: 76bed0f43b27 ("mac80211: IBSS fix scan request")
  10326. +Signed-off-by: Sara Sharon <sara.sharon@intel.com>
  10327. +Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
  10328. +---
  10329. +
  10330. +--- a/net/mac80211/ibss.c
  10331. ++++ b/net/mac80211/ibss.c
  10332. +@@ -7,6 +7,7 @@
  10333. + * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
  10334. + * Copyright 2009, Johannes Berg <johannes@sipsolutions.net>
  10335. + * Copyright 2013-2014 Intel Mobile Communications GmbH
  10336. ++ * Copyright(c) 2016 Intel Deutschland GmbH
  10337. + *
  10338. + * This program is free software; you can redistribute it and/or modify
  10339. + * it under the terms of the GNU General Public License version 2 as
  10340. +@@ -1483,14 +1484,21 @@ static void ieee80211_sta_find_ibss(stru
  10341. +
  10342. + sdata_info(sdata, "Trigger new scan to find an IBSS to join\n");
  10343. +
  10344. +- num = ieee80211_ibss_setup_scan_channels(local->hw.wiphy,
  10345. +- &ifibss->chandef,
  10346. +- channels,
  10347. +- ARRAY_SIZE(channels));
  10348. + scan_width = cfg80211_chandef_to_scan_width(&ifibss->chandef);
  10349. +- ieee80211_request_ibss_scan(sdata, ifibss->ssid,
  10350. +- ifibss->ssid_len, channels, num,
  10351. +- scan_width);
  10352. ++
  10353. ++ if (ifibss->fixed_channel) {
  10354. ++ num = ieee80211_ibss_setup_scan_channels(local->hw.wiphy,
  10355. ++ &ifibss->chandef,
  10356. ++ channels,
  10357. ++ ARRAY_SIZE(channels));
  10358. ++ ieee80211_request_ibss_scan(sdata, ifibss->ssid,
  10359. ++ ifibss->ssid_len, channels,
  10360. ++ num, scan_width);
  10361. ++ } else {
  10362. ++ ieee80211_request_ibss_scan(sdata, ifibss->ssid,
  10363. ++ ifibss->ssid_len, NULL,
  10364. ++ 0, scan_width);
  10365. ++ }
  10366. + } else {
  10367. + int interval = IEEE80211_SCAN_INTERVAL;
  10368. +
  10369. 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
  10370. deleted file mode 100644
  10371. index 77a82c2..0000000
  10372. --- a/package/kernel/mac80211/patches/316-mac80211-reduce-log-spam-from-ieee80211_handle_pwr_c.patch
  10373. +++ /dev/null
  10374. @@ -1,38 +0,0 @@
  10375. -From: John Linville <linville@tuxdriver.com>
  10376. -Date: Tue, 31 Mar 2015 10:49:14 -0400
  10377. -Subject: [PATCH] mac80211: reduce log spam from ieee80211_handle_pwr_constr
  10378. -
  10379. -This changes a couple of messages from sdata_info to sdata_dbg.
  10380. -This should reduce some log spam, as reported here:
  10381. -
  10382. - https://bugzilla.redhat.com/show_bug.cgi?id=1206468
  10383. -
  10384. -Signed-off-by: John W. Linville <linville@tuxdriver.com>
  10385. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  10386. ----
  10387. -
  10388. ---- a/net/mac80211/mlme.c
  10389. -+++ b/net/mac80211/mlme.c
  10390. -@@ -1347,15 +1347,15 @@ static u32 ieee80211_handle_pwr_constr(s
  10391. - */
  10392. - if (has_80211h_pwr &&
  10393. - (!has_cisco_pwr || pwr_level_80211h <= pwr_level_cisco)) {
  10394. -- sdata_info(sdata,
  10395. -- "Limiting TX power to %d (%d - %d) dBm as advertised by %pM\n",
  10396. -- pwr_level_80211h, chan_pwr, pwr_reduction_80211h,
  10397. -- sdata->u.mgd.bssid);
  10398. -+ sdata_dbg(sdata,
  10399. -+ "Limiting TX power to %d (%d - %d) dBm as advertised by %pM\n",
  10400. -+ pwr_level_80211h, chan_pwr, pwr_reduction_80211h,
  10401. -+ sdata->u.mgd.bssid);
  10402. - new_ap_level = pwr_level_80211h;
  10403. - } else { /* has_cisco_pwr is always true here. */
  10404. -- sdata_info(sdata,
  10405. -- "Limiting TX power to %d dBm as advertised by %pM\n",
  10406. -- pwr_level_cisco, sdata->u.mgd.bssid);
  10407. -+ sdata_dbg(sdata,
  10408. -+ "Limiting TX power to %d dBm as advertised by %pM\n",
  10409. -+ pwr_level_cisco, sdata->u.mgd.bssid);
  10410. - new_ap_level = pwr_level_cisco;
  10411. - }
  10412. -
  10413. diff --git a/package/kernel/mac80211/patches/316-net-mac80211-agg-rx.c-fix-use-of-uninitialised-value.patch b/package/kernel/mac80211/patches/316-net-mac80211-agg-rx.c-fix-use-of-uninitialised-value.patch
  10414. new file mode 100644
  10415. index 0000000..e78df36
  10416. --- /dev/null
  10417. +++ b/package/kernel/mac80211/patches/316-net-mac80211-agg-rx.c-fix-use-of-uninitialised-value.patch
  10418. @@ -0,0 +1,50 @@
  10419. +From: Chris Bainbridge <chris.bainbridge@gmail.com>
  10420. +Date: Wed, 27 Jan 2016 15:46:18 +0000
  10421. +Subject: [PATCH] net/mac80211/agg-rx.c: fix use of uninitialised values
  10422. +
  10423. +Use kzalloc instead of kmalloc for struct tid_ampdu_rx. Fixes:
  10424. +
  10425. +[ 7.976605] UBSAN: Undefined behaviour in net/mac80211/rx.c:932:29
  10426. +[ 7.976608] load of value 2 is not a valid value for type '_Bool'
  10427. +[ 7.976611] CPU: 3 PID: 1134 Comm: kworker/u16:7 Not tainted 4.5.0-rc1+ #265
  10428. +[ 7.976613] Hardware name: Apple Inc. MacBookPro10,2/Mac-AFD8A9D944EA4843, BIOS MBP102.88Z.0106.B0A.1509130955 09/13/2015
  10429. +[ 7.976616] Workqueue: phy0 rt2x00usb_work_rxdone
  10430. +[ 7.976619] 0000000000000004 ffff880254a7ba50 ffffffff8181d866 0000000000000007
  10431. +[ 7.976622] ffff880254a7ba78 ffff880254a7ba68 ffffffff8188422d ffffffff8379b500
  10432. +[ 7.976626] ffff880254a7bab8 ffffffff81884747 0000000000000202 0000000348620032
  10433. +[ 7.976629] Call Trace:
  10434. +[ 7.976633] [<ffffffff8181d866>] dump_stack+0x45/0x5f
  10435. +[ 7.976637] [<ffffffff8188422d>] ubsan_epilogue+0xd/0x40
  10436. +[ 7.976642] [<ffffffff81884747>] __ubsan_handle_load_invalid_value+0x67/0x70
  10437. +[ 7.976646] [<ffffffff82227b4d>] ieee80211_sta_reorder_release.isra.16+0x5ed/0x730
  10438. +[ 7.976650] [<ffffffff8222ca14>] ieee80211_prepare_and_rx_handle+0xd04/0x1c00
  10439. +[ 7.976654] [<ffffffff81cb27ce>] ? usb_hcd_map_urb_for_dma+0x65e/0x960
  10440. +[ 7.976659] [<ffffffff8222db03>] __ieee80211_rx_handle_packet+0x1f3/0x750
  10441. +[ 7.976663] [<ffffffff8222e4a7>] ieee80211_rx_napi+0x447/0x990
  10442. +[ 7.976667] [<ffffffff81c5fb85>] rt2x00lib_rxdone+0x305/0xbd0
  10443. +[ 7.976670] [<ffffffff811ac23f>] ? dequeue_task_fair+0x64f/0x1de0
  10444. +[ 7.976674] [<ffffffff811a1516>] ? sched_clock_cpu+0xe6/0x150
  10445. +[ 7.976678] [<ffffffff81c6c45c>] rt2x00usb_work_rxdone+0x7c/0x140
  10446. +[ 7.976682] [<ffffffff8117aef6>] process_one_work+0x226/0x860
  10447. +[ 7.976686] [<ffffffff8117b58c>] worker_thread+0x5c/0x680
  10448. +[ 7.976690] [<ffffffff8117b530>] ? process_one_work+0x860/0x860
  10449. +[ 7.976693] [<ffffffff81184f86>] kthread+0xf6/0x150
  10450. +[ 7.976697] [<ffffffff81184e90>] ? kthread_worker_fn+0x310/0x310
  10451. +[ 7.976700] [<ffffffff822a94df>] ret_from_fork+0x3f/0x70
  10452. +[ 7.976703] [<ffffffff81184e90>] ? kthread_worker_fn+0x310/0x310
  10453. +
  10454. +Link: https://lkml.org/lkml/2016/1/26/230
  10455. +Signed-off-by: Chris Bainbridge <chris.bainbridge@gmail.com>
  10456. +---
  10457. +
  10458. +--- a/net/mac80211/agg-rx.c
  10459. ++++ b/net/mac80211/agg-rx.c
  10460. +@@ -327,7 +327,7 @@ void __ieee80211_start_rx_ba_session(str
  10461. + }
  10462. +
  10463. + /* prepare A-MPDU MLME for Rx aggregation */
  10464. +- tid_agg_rx = kmalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL);
  10465. ++ tid_agg_rx = kzalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL);
  10466. + if (!tid_agg_rx)
  10467. + goto end;
  10468. +
  10469. 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
  10470. deleted file mode 100644
  10471. index e005fe7..0000000
  10472. --- a/package/kernel/mac80211/patches/317-brcmfmac-Fix-race-condition-in-msgbuf-ioctl-processi.patch
  10473. +++ /dev/null
  10474. @@ -1,35 +0,0 @@
  10475. -From: Hante Meuleman <meuleman@broadcom.com>
  10476. -Date: Fri, 6 Mar 2015 18:40:41 +0100
  10477. -Subject: [PATCH] brcmfmac: Fix race condition in msgbuf ioctl processing.
  10478. -
  10479. -Msgbuf is using a wait_event_timeout to wait for the response on
  10480. -an ioctl. The wakeup routine uses waitqueue_active to see if
  10481. -wait_event_timeout has been called. There is a chance that the
  10482. -response arrives before wait_event_timeout is called, this
  10483. -will result in situation that wait_event_timeout never gets
  10484. -woken again and assumed result will be a timeout. This patch
  10485. -removes that errornous situation by always setting the
  10486. -ctl_completed var before checking for queue active.
  10487. -
  10488. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  10489. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10490. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  10491. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10492. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10493. ----
  10494. -
  10495. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  10496. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  10497. -@@ -481,10 +481,9 @@ static int brcmf_msgbuf_ioctl_resp_wait(
  10498. -
  10499. - static void brcmf_msgbuf_ioctl_resp_wake(struct brcmf_msgbuf *msgbuf)
  10500. - {
  10501. -- if (waitqueue_active(&msgbuf->ioctl_resp_wait)) {
  10502. -- msgbuf->ctl_completed = true;
  10503. -+ msgbuf->ctl_completed = true;
  10504. -+ if (waitqueue_active(&msgbuf->ioctl_resp_wait))
  10505. - wake_up(&msgbuf->ioctl_resp_wait);
  10506. -- }
  10507. - }
  10508. -
  10509. -
  10510. diff --git a/package/kernel/mac80211/patches/317-mac80211-minstrel_ht-fix-out-of-bound-in-minstrel_ht.patch b/package/kernel/mac80211/patches/317-mac80211-minstrel_ht-fix-out-of-bound-in-minstrel_ht.patch
  10511. new file mode 100644
  10512. index 0000000..5bf53b9
  10513. --- /dev/null
  10514. +++ b/package/kernel/mac80211/patches/317-mac80211-minstrel_ht-fix-out-of-bound-in-minstrel_ht.patch
  10515. @@ -0,0 +1,45 @@
  10516. +From: Konstantin Khlebnikov <koct9i@gmail.com>
  10517. +Date: Fri, 29 Jan 2016 11:35:12 +0300
  10518. +Subject: [PATCH] mac80211: minstrel_ht: fix out-of-bound in
  10519. + minstrel_ht_set_best_prob_rate
  10520. +
  10521. +Patch fixes this splat
  10522. +
  10523. +BUG: KASAN: slab-out-of-bounds in minstrel_ht_update_stats.isra.7+0x6e1/0x9e0
  10524. +[mac80211] at addr ffff8800cee640f4 Read of size 4 by task swapper/3/0
  10525. +
  10526. +Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
  10527. +Link: http://lkml.kernel.org/r/CALYGNiNyJhSaVnE35qS6UCGaSb2Dx1_i5HcRavuOX14oTz2P+w@mail.gmail.com
  10528. +---
  10529. +
  10530. +--- a/net/mac80211/rc80211_minstrel_ht.c
  10531. ++++ b/net/mac80211/rc80211_minstrel_ht.c
  10532. +@@ -414,15 +414,16 @@ minstrel_ht_set_best_prob_rate(struct mi
  10533. + (max_tp_group != MINSTREL_CCK_GROUP))
  10534. + return;
  10535. +
  10536. ++ max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES;
  10537. ++ max_gpr_idx = mg->max_group_prob_rate % MCS_GROUP_RATES;
  10538. ++ max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_ewma;
  10539. ++
  10540. + if (mrs->prob_ewma > MINSTREL_FRAC(75, 100)) {
  10541. + cur_tp_avg = minstrel_ht_get_tp_avg(mi, cur_group, cur_idx,
  10542. + mrs->prob_ewma);
  10543. + if (cur_tp_avg > tmp_tp_avg)
  10544. + mi->max_prob_rate = index;
  10545. +
  10546. +- max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES;
  10547. +- max_gpr_idx = mg->max_group_prob_rate % MCS_GROUP_RATES;
  10548. +- max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_ewma;
  10549. + max_gpr_tp_avg = minstrel_ht_get_tp_avg(mi, max_gpr_group,
  10550. + max_gpr_idx,
  10551. + max_gpr_prob);
  10552. +@@ -431,7 +432,7 @@ minstrel_ht_set_best_prob_rate(struct mi
  10553. + } else {
  10554. + if (mrs->prob_ewma > tmp_prob)
  10555. + mi->max_prob_rate = index;
  10556. +- if (mrs->prob_ewma > mg->rates[mg->max_group_prob_rate].prob_ewma)
  10557. ++ if (mrs->prob_ewma > max_gpr_prob)
  10558. + mg->max_group_prob_rate = index;
  10559. + }
  10560. + }
  10561. 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
  10562. deleted file mode 100644
  10563. index c2cd1c5..0000000
  10564. --- a/package/kernel/mac80211/patches/318-brcmfmac-Update-msgbuf-commonring-size-for-improved-.patch
  10565. +++ /dev/null
  10566. @@ -1,30 +0,0 @@
  10567. -From: Hante Meuleman <meuleman@broadcom.com>
  10568. -Date: Wed, 18 Mar 2015 13:25:23 +0100
  10569. -Subject: [PATCH] brcmfmac: Update msgbuf commonring size for improved
  10570. - throughput.
  10571. -
  10572. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  10573. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10574. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  10575. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10576. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10577. ----
  10578. -
  10579. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h
  10580. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h
  10581. -@@ -17,11 +17,11 @@
  10582. -
  10583. - #ifdef CPTCFG_BRCMFMAC_PROTO_MSGBUF
  10584. -
  10585. --#define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_MAX_ITEM 20
  10586. --#define BRCMF_H2D_MSGRING_RXPOST_SUBMIT_MAX_ITEM 256
  10587. --#define BRCMF_D2H_MSGRING_CONTROL_COMPLETE_MAX_ITEM 20
  10588. -+#define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_MAX_ITEM 64
  10589. -+#define BRCMF_H2D_MSGRING_RXPOST_SUBMIT_MAX_ITEM 512
  10590. -+#define BRCMF_D2H_MSGRING_CONTROL_COMPLETE_MAX_ITEM 64
  10591. - #define BRCMF_D2H_MSGRING_TX_COMPLETE_MAX_ITEM 1024
  10592. --#define BRCMF_D2H_MSGRING_RX_COMPLETE_MAX_ITEM 256
  10593. -+#define BRCMF_D2H_MSGRING_RX_COMPLETE_MAX_ITEM 512
  10594. - #define BRCMF_H2D_TXFLOWRING_MAX_ITEM 512
  10595. -
  10596. - #define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_ITEMSIZE 40
  10597. diff --git a/package/kernel/mac80211/patches/318-mac80211-move-A-MSDU-skb_linearize-call-to-ieee80211.patch b/package/kernel/mac80211/patches/318-mac80211-move-A-MSDU-skb_linearize-call-to-ieee80211.patch
  10598. new file mode 100644
  10599. index 0000000..655dc4b
  10600. --- /dev/null
  10601. +++ b/package/kernel/mac80211/patches/318-mac80211-move-A-MSDU-skb_linearize-call-to-ieee80211.patch
  10602. @@ -0,0 +1,35 @@
  10603. +From: Felix Fietkau <nbd@openwrt.org>
  10604. +Date: Tue, 2 Feb 2016 14:39:08 +0100
  10605. +Subject: [PATCH] mac80211: move A-MSDU skb_linearize call to
  10606. + ieee80211_amsdu_to_8023s
  10607. +
  10608. +Prepararation for zero-copy A-MSDU support with page fragment SKBs
  10609. +
  10610. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  10611. +Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  10612. +---
  10613. +
  10614. +--- a/net/mac80211/rx.c
  10615. ++++ b/net/mac80211/rx.c
  10616. +@@ -2203,9 +2203,6 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx
  10617. + skb->dev = dev;
  10618. + __skb_queue_head_init(&frame_list);
  10619. +
  10620. +- if (skb_linearize(skb))
  10621. +- return RX_DROP_UNUSABLE;
  10622. +-
  10623. + ieee80211_amsdu_to_8023s(skb, &frame_list, dev->dev_addr,
  10624. + rx->sdata->vif.type,
  10625. + rx->local->hw.extra_tx_headroom, true);
  10626. +--- a/net/wireless/util.c
  10627. ++++ b/net/wireless/util.c
  10628. +@@ -657,6 +657,9 @@ void ieee80211_amsdu_to_8023s(struct sk_
  10629. + int remaining, err;
  10630. + u8 dst[ETH_ALEN], src[ETH_ALEN];
  10631. +
  10632. ++ if (skb_linearize(skb))
  10633. ++ goto out;
  10634. ++
  10635. + if (has_80211_header) {
  10636. + err = ieee80211_data_to_8023(skb, addr, iftype);
  10637. + if (err)
  10638. 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
  10639. deleted file mode 100644
  10640. index 6af69eb..0000000
  10641. --- a/package/kernel/mac80211/patches/319-ath9k_htc-add-new-WMI_REG_RMW_CMDID-command.patch
  10642. +++ /dev/null
  10643. @@ -1,307 +0,0 @@
  10644. -From: Oleksij Rempel <linux@rempel-privat.de>
  10645. -Date: Sun, 22 Mar 2015 19:29:46 +0100
  10646. -Subject: [PATCH] ath9k_htc: add new WMI_REG_RMW_CMDID command
  10647. -
  10648. -Since usb bus add extra delay on each request, a command
  10649. -with read + write requests is too expensive. We can dramtically
  10650. -reduce usb load by moving this command to firmware.
  10651. -
  10652. -In my tests, this patch will reduce channel scan time
  10653. -for about 5-10 seconds.
  10654. -
  10655. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  10656. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10657. ----
  10658. -
  10659. ---- a/drivers/net/wireless/ath/ath.h
  10660. -+++ b/drivers/net/wireless/ath/ath.h
  10661. -@@ -131,6 +131,9 @@ struct ath_ops {
  10662. - void (*enable_write_buffer)(void *);
  10663. - void (*write_flush) (void *);
  10664. - u32 (*rmw)(void *, u32 reg_offset, u32 set, u32 clr);
  10665. -+ void (*enable_rmw_buffer)(void *);
  10666. -+ void (*rmw_flush) (void *);
  10667. -+
  10668. - };
  10669. -
  10670. - struct ath_common;
  10671. ---- a/drivers/net/wireless/ath/ath9k/htc.h
  10672. -+++ b/drivers/net/wireless/ath/ath9k/htc.h
  10673. -@@ -444,6 +444,10 @@ static inline void ath9k_htc_stop_btcoex
  10674. - #define OP_BT_SCAN BIT(4)
  10675. - #define OP_TSF_RESET BIT(6)
  10676. -
  10677. -+enum htc_op_flags {
  10678. -+ HTC_FWFLAG_NO_RMW,
  10679. -+};
  10680. -+
  10681. - struct ath9k_htc_priv {
  10682. - struct device *dev;
  10683. - struct ieee80211_hw *hw;
  10684. -@@ -482,6 +486,7 @@ struct ath9k_htc_priv {
  10685. - bool reconfig_beacon;
  10686. - unsigned int rxfilter;
  10687. - unsigned long op_flags;
  10688. -+ unsigned long fw_flags;
  10689. -
  10690. - struct ath9k_hw_cal_data caldata;
  10691. - struct ath_spec_scan_priv spec_priv;
  10692. ---- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
  10693. -+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
  10694. -@@ -376,17 +376,139 @@ static void ath9k_regwrite_flush(void *h
  10695. - mutex_unlock(&priv->wmi->multi_write_mutex);
  10696. - }
  10697. -
  10698. --static u32 ath9k_reg_rmw(void *hw_priv, u32 reg_offset, u32 set, u32 clr)
  10699. -+static void ath9k_reg_rmw_buffer(void *hw_priv,
  10700. -+ u32 reg_offset, u32 set, u32 clr)
  10701. -+{
  10702. -+ struct ath_hw *ah = (struct ath_hw *) hw_priv;
  10703. -+ struct ath_common *common = ath9k_hw_common(ah);
  10704. -+ struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
  10705. -+ u32 rsp_status;
  10706. -+ int r;
  10707. -+
  10708. -+ mutex_lock(&priv->wmi->multi_rmw_mutex);
  10709. -+
  10710. -+ /* Store the register/value */
  10711. -+ priv->wmi->multi_rmw[priv->wmi->multi_rmw_idx].reg =
  10712. -+ cpu_to_be32(reg_offset);
  10713. -+ priv->wmi->multi_rmw[priv->wmi->multi_rmw_idx].set =
  10714. -+ cpu_to_be32(set);
  10715. -+ priv->wmi->multi_rmw[priv->wmi->multi_rmw_idx].clr =
  10716. -+ cpu_to_be32(clr);
  10717. -+
  10718. -+ priv->wmi->multi_rmw_idx++;
  10719. -+
  10720. -+ /* If the buffer is full, send it out. */
  10721. -+ if (priv->wmi->multi_rmw_idx == MAX_RMW_CMD_NUMBER) {
  10722. -+ r = ath9k_wmi_cmd(priv->wmi, WMI_REG_RMW_CMDID,
  10723. -+ (u8 *) &priv->wmi->multi_rmw,
  10724. -+ sizeof(struct register_write) * priv->wmi->multi_rmw_idx,
  10725. -+ (u8 *) &rsp_status, sizeof(rsp_status),
  10726. -+ 100);
  10727. -+ if (unlikely(r)) {
  10728. -+ ath_dbg(common, WMI,
  10729. -+ "REGISTER RMW FAILED, multi len: %d\n",
  10730. -+ priv->wmi->multi_rmw_idx);
  10731. -+ }
  10732. -+ priv->wmi->multi_rmw_idx = 0;
  10733. -+ }
  10734. -+
  10735. -+ mutex_unlock(&priv->wmi->multi_rmw_mutex);
  10736. -+}
  10737. -+
  10738. -+static void ath9k_reg_rmw_flush(void *hw_priv)
  10739. - {
  10740. -- u32 val;
  10741. -+ struct ath_hw *ah = (struct ath_hw *) hw_priv;
  10742. -+ struct ath_common *common = ath9k_hw_common(ah);
  10743. -+ struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
  10744. -+ u32 rsp_status;
  10745. -+ int r;
  10746. -+
  10747. -+ if (test_bit(HTC_FWFLAG_NO_RMW, &priv->fw_flags))
  10748. -+ return;
  10749. -+
  10750. -+ atomic_dec(&priv->wmi->m_rmw_cnt);
  10751. -+
  10752. -+ mutex_lock(&priv->wmi->multi_rmw_mutex);
  10753. -+
  10754. -+ if (priv->wmi->multi_rmw_idx) {
  10755. -+ r = ath9k_wmi_cmd(priv->wmi, WMI_REG_RMW_CMDID,
  10756. -+ (u8 *) &priv->wmi->multi_rmw,
  10757. -+ sizeof(struct register_rmw) * priv->wmi->multi_rmw_idx,
  10758. -+ (u8 *) &rsp_status, sizeof(rsp_status),
  10759. -+ 100);
  10760. -+ if (unlikely(r)) {
  10761. -+ ath_dbg(common, WMI,
  10762. -+ "REGISTER RMW FAILED, multi len: %d\n",
  10763. -+ priv->wmi->multi_rmw_idx);
  10764. -+ }
  10765. -+ priv->wmi->multi_rmw_idx = 0;
  10766. -+ }
  10767. -
  10768. -- val = ath9k_regread(hw_priv, reg_offset);
  10769. -- val &= ~clr;
  10770. -- val |= set;
  10771. -- ath9k_regwrite(hw_priv, val, reg_offset);
  10772. -+ mutex_unlock(&priv->wmi->multi_rmw_mutex);
  10773. -+}
  10774. -+
  10775. -+static void ath9k_enable_rmw_buffer(void *hw_priv)
  10776. -+{
  10777. -+ struct ath_hw *ah = (struct ath_hw *) hw_priv;
  10778. -+ struct ath_common *common = ath9k_hw_common(ah);
  10779. -+ struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
  10780. -+
  10781. -+ if (test_bit(HTC_FWFLAG_NO_RMW, &priv->fw_flags))
  10782. -+ return;
  10783. -+
  10784. -+ atomic_inc(&priv->wmi->m_rmw_cnt);
  10785. -+}
  10786. -+
  10787. -+static u32 ath9k_reg_rmw_single(void *hw_priv,
  10788. -+ u32 reg_offset, u32 set, u32 clr)
  10789. -+{
  10790. -+ struct ath_hw *ah = (struct ath_hw *) hw_priv;
  10791. -+ struct ath_common *common = ath9k_hw_common(ah);
  10792. -+ struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
  10793. -+ struct register_rmw buf, buf_ret;
  10794. -+ int ret;
  10795. -+ u32 val = 0;
  10796. -+
  10797. -+ buf.reg = cpu_to_be32(reg_offset);
  10798. -+ buf.set = cpu_to_be32(set);
  10799. -+ buf.clr = cpu_to_be32(clr);
  10800. -+
  10801. -+ ret = ath9k_wmi_cmd(priv->wmi, WMI_REG_RMW_CMDID,
  10802. -+ (u8 *) &buf, sizeof(buf),
  10803. -+ (u8 *) &buf_ret, sizeof(buf_ret),
  10804. -+ 100);
  10805. -+ if (unlikely(ret)) {
  10806. -+ ath_dbg(common, WMI, "REGISTER RMW FAILED:(0x%04x, %d)\n",
  10807. -+ reg_offset, ret);
  10808. -+ }
  10809. - return val;
  10810. - }
  10811. -
  10812. -+static u32 ath9k_reg_rmw(void *hw_priv, u32 reg_offset, u32 set, u32 clr)
  10813. -+{
  10814. -+ struct ath_hw *ah = (struct ath_hw *) hw_priv;
  10815. -+ struct ath_common *common = ath9k_hw_common(ah);
  10816. -+ struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
  10817. -+
  10818. -+ if (test_bit(HTC_FWFLAG_NO_RMW, &priv->fw_flags)) {
  10819. -+ u32 val;
  10820. -+
  10821. -+ val = REG_READ(ah, reg_offset);
  10822. -+ val &= ~clr;
  10823. -+ val |= set;
  10824. -+ REG_WRITE(ah, reg_offset, val);
  10825. -+
  10826. -+ return 0;
  10827. -+ }
  10828. -+
  10829. -+ if (atomic_read(&priv->wmi->m_rmw_cnt))
  10830. -+ ath9k_reg_rmw_buffer(hw_priv, reg_offset, set, clr);
  10831. -+ else
  10832. -+ ath9k_reg_rmw_single(hw_priv, reg_offset, set, clr);
  10833. -+
  10834. -+ return 0;
  10835. -+}
  10836. -+
  10837. - static void ath_usb_read_cachesize(struct ath_common *common, int *csz)
  10838. - {
  10839. - *csz = L1_CACHE_BYTES >> 2;
  10840. -@@ -501,6 +623,8 @@ static int ath9k_init_priv(struct ath9k_
  10841. - ah->reg_ops.write = ath9k_regwrite;
  10842. - ah->reg_ops.enable_write_buffer = ath9k_enable_regwrite_buffer;
  10843. - ah->reg_ops.write_flush = ath9k_regwrite_flush;
  10844. -+ ah->reg_ops.enable_rmw_buffer = ath9k_enable_rmw_buffer;
  10845. -+ ah->reg_ops.rmw_flush = ath9k_reg_rmw_flush;
  10846. - ah->reg_ops.rmw = ath9k_reg_rmw;
  10847. - priv->ah = ah;
  10848. -
  10849. -@@ -686,6 +810,12 @@ static int ath9k_init_firmware_version(s
  10850. - return -EINVAL;
  10851. - }
  10852. -
  10853. -+ if (priv->fw_version_major == 1 && priv->fw_version_minor < 4)
  10854. -+ set_bit(HTC_FWFLAG_NO_RMW, &priv->fw_flags);
  10855. -+
  10856. -+ dev_info(priv->dev, "FW RMW support: %s\n",
  10857. -+ test_bit(HTC_FWFLAG_NO_RMW, &priv->fw_flags) ? "Off" : "On");
  10858. -+
  10859. - return 0;
  10860. - }
  10861. -
  10862. ---- a/drivers/net/wireless/ath/ath9k/hw.h
  10863. -+++ b/drivers/net/wireless/ath/ath9k/hw.h
  10864. -@@ -100,6 +100,18 @@
  10865. - (_ah)->reg_ops.write_flush((_ah)); \
  10866. - } while (0)
  10867. -
  10868. -+#define ENABLE_REG_RMW_BUFFER(_ah) \
  10869. -+ do { \
  10870. -+ if ((_ah)->reg_ops.enable_rmw_buffer) \
  10871. -+ (_ah)->reg_ops.enable_rmw_buffer((_ah)); \
  10872. -+ } while (0)
  10873. -+
  10874. -+#define REG_RMW_BUFFER_FLUSH(_ah) \
  10875. -+ do { \
  10876. -+ if ((_ah)->reg_ops.rmw_flush) \
  10877. -+ (_ah)->reg_ops.rmw_flush((_ah)); \
  10878. -+ } while (0)
  10879. -+
  10880. - #define PR_EEP(_s, _val) \
  10881. - do { \
  10882. - len += scnprintf(buf + len, size - len, "%20s : %10d\n",\
  10883. ---- a/drivers/net/wireless/ath/ath9k/wmi.c
  10884. -+++ b/drivers/net/wireless/ath/ath9k/wmi.c
  10885. -@@ -61,6 +61,8 @@ static const char *wmi_cmd_to_name(enum
  10886. - return "WMI_REG_READ_CMDID";
  10887. - case WMI_REG_WRITE_CMDID:
  10888. - return "WMI_REG_WRITE_CMDID";
  10889. -+ case WMI_REG_RMW_CMDID:
  10890. -+ return "WMI_REG_RMW_CMDID";
  10891. - case WMI_RC_STATE_CHANGE_CMDID:
  10892. - return "WMI_RC_STATE_CHANGE_CMDID";
  10893. - case WMI_RC_RATE_UPDATE_CMDID:
  10894. -@@ -101,6 +103,7 @@ struct wmi *ath9k_init_wmi(struct ath9k_
  10895. - spin_lock_init(&wmi->event_lock);
  10896. - mutex_init(&wmi->op_mutex);
  10897. - mutex_init(&wmi->multi_write_mutex);
  10898. -+ mutex_init(&wmi->multi_rmw_mutex);
  10899. - init_completion(&wmi->cmd_wait);
  10900. - INIT_LIST_HEAD(&wmi->pending_tx_events);
  10901. - tasklet_init(&wmi->wmi_event_tasklet, ath9k_wmi_event_tasklet,
  10902. ---- a/drivers/net/wireless/ath/ath9k/wmi.h
  10903. -+++ b/drivers/net/wireless/ath/ath9k/wmi.h
  10904. -@@ -112,6 +112,7 @@ enum wmi_cmd_id {
  10905. - WMI_TX_STATS_CMDID,
  10906. - WMI_RX_STATS_CMDID,
  10907. - WMI_BITRATE_MASK_CMDID,
  10908. -+ WMI_REG_RMW_CMDID,
  10909. - };
  10910. -
  10911. - enum wmi_event_id {
  10912. -@@ -125,12 +126,19 @@ enum wmi_event_id {
  10913. - };
  10914. -
  10915. - #define MAX_CMD_NUMBER 62
  10916. -+#define MAX_RMW_CMD_NUMBER 15
  10917. -
  10918. - struct register_write {
  10919. - __be32 reg;
  10920. - __be32 val;
  10921. - };
  10922. -
  10923. -+struct register_rmw {
  10924. -+ __be32 reg;
  10925. -+ __be32 set;
  10926. -+ __be32 clr;
  10927. -+} __packed;
  10928. -+
  10929. - struct ath9k_htc_tx_event {
  10930. - int count;
  10931. - struct __wmi_event_txstatus txs;
  10932. -@@ -156,10 +164,18 @@ struct wmi {
  10933. -
  10934. - spinlock_t wmi_lock;
  10935. -
  10936. -+ /* multi write section */
  10937. - atomic_t mwrite_cnt;
  10938. - struct register_write multi_write[MAX_CMD_NUMBER];
  10939. - u32 multi_write_idx;
  10940. - struct mutex multi_write_mutex;
  10941. -+
  10942. -+ /* multi rmw section */
  10943. -+ atomic_t m_rmw_cnt;
  10944. -+ struct register_rmw multi_rmw[MAX_RMW_CMD_NUMBER];
  10945. -+ u32 multi_rmw_idx;
  10946. -+ struct mutex multi_rmw_mutex;
  10947. -+
  10948. - };
  10949. -
  10950. - struct wmi *ath9k_init_wmi(struct ath9k_htc_priv *priv);
  10951. diff --git a/package/kernel/mac80211/patches/319-cfg80211-add-function-for-802.3-conversion-with-sepa.patch b/package/kernel/mac80211/patches/319-cfg80211-add-function-for-802.3-conversion-with-sepa.patch
  10952. new file mode 100644
  10953. index 0000000..b646ab3
  10954. --- /dev/null
  10955. +++ b/package/kernel/mac80211/patches/319-cfg80211-add-function-for-802.3-conversion-with-sepa.patch
  10956. @@ -0,0 +1,186 @@
  10957. +From: Felix Fietkau <nbd@openwrt.org>
  10958. +Date: Tue, 2 Feb 2016 14:39:09 +0100
  10959. +Subject: [PATCH] cfg80211: add function for 802.3 conversion with separate
  10960. + output buffer
  10961. +
  10962. +Use skb_copy_bits in preparation for allowing fragmented skbs
  10963. +
  10964. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  10965. +Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  10966. +---
  10967. +
  10968. +--- a/net/wireless/util.c
  10969. ++++ b/net/wireless/util.c
  10970. +@@ -393,9 +393,9 @@ unsigned int ieee80211_get_hdrlen_from_s
  10971. + }
  10972. + EXPORT_SYMBOL(ieee80211_get_hdrlen_from_skb);
  10973. +
  10974. +-unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
  10975. ++static unsigned int __ieee80211_get_mesh_hdrlen(u8 flags)
  10976. + {
  10977. +- int ae = meshhdr->flags & MESH_FLAGS_AE;
  10978. ++ int ae = flags & MESH_FLAGS_AE;
  10979. + /* 802.11-2012, 8.2.4.7.3 */
  10980. + switch (ae) {
  10981. + default:
  10982. +@@ -407,21 +407,31 @@ unsigned int ieee80211_get_mesh_hdrlen(s
  10983. + return 18;
  10984. + }
  10985. + }
  10986. ++
  10987. ++unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
  10988. ++{
  10989. ++ return __ieee80211_get_mesh_hdrlen(meshhdr->flags);
  10990. ++}
  10991. + EXPORT_SYMBOL(ieee80211_get_mesh_hdrlen);
  10992. +
  10993. +-int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
  10994. +- enum nl80211_iftype iftype)
  10995. ++static int __ieee80211_data_to_8023(struct sk_buff *skb, struct ethhdr *ehdr,
  10996. ++ const u8 *addr, enum nl80211_iftype iftype)
  10997. + {
  10998. + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  10999. +- u16 hdrlen, ethertype;
  11000. +- u8 *payload;
  11001. +- u8 dst[ETH_ALEN];
  11002. +- u8 src[ETH_ALEN] __aligned(2);
  11003. ++ struct {
  11004. ++ u8 hdr[ETH_ALEN] __aligned(2);
  11005. ++ __be16 proto;
  11006. ++ } payload;
  11007. ++ struct ethhdr tmp;
  11008. ++ u16 hdrlen;
  11009. ++ u8 mesh_flags = 0;
  11010. +
  11011. + if (unlikely(!ieee80211_is_data_present(hdr->frame_control)))
  11012. + return -1;
  11013. +
  11014. + hdrlen = ieee80211_hdrlen(hdr->frame_control);
  11015. ++ if (skb->len < hdrlen + 8)
  11016. ++ return -1;
  11017. +
  11018. + /* convert IEEE 802.11 header + possible LLC headers into Ethernet
  11019. + * header
  11020. +@@ -432,8 +442,11 @@ int ieee80211_data_to_8023(struct sk_buf
  11021. + * 1 0 BSSID SA DA n/a
  11022. + * 1 1 RA TA DA SA
  11023. + */
  11024. +- memcpy(dst, ieee80211_get_DA(hdr), ETH_ALEN);
  11025. +- memcpy(src, ieee80211_get_SA(hdr), ETH_ALEN);
  11026. ++ memcpy(tmp.h_dest, ieee80211_get_DA(hdr), ETH_ALEN);
  11027. ++ memcpy(tmp.h_source, ieee80211_get_SA(hdr), ETH_ALEN);
  11028. ++
  11029. ++ if (iftype == NL80211_IFTYPE_MESH_POINT)
  11030. ++ skb_copy_bits(skb, hdrlen, &mesh_flags, 1);
  11031. +
  11032. + switch (hdr->frame_control &
  11033. + cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) {
  11034. +@@ -450,44 +463,31 @@ int ieee80211_data_to_8023(struct sk_buf
  11035. + iftype != NL80211_IFTYPE_STATION))
  11036. + return -1;
  11037. + if (iftype == NL80211_IFTYPE_MESH_POINT) {
  11038. +- struct ieee80211s_hdr *meshdr =
  11039. +- (struct ieee80211s_hdr *) (skb->data + hdrlen);
  11040. +- /* make sure meshdr->flags is on the linear part */
  11041. +- if (!pskb_may_pull(skb, hdrlen + 1))
  11042. +- return -1;
  11043. +- if (meshdr->flags & MESH_FLAGS_AE_A4)
  11044. ++ if (mesh_flags & MESH_FLAGS_AE_A4)
  11045. + return -1;
  11046. +- if (meshdr->flags & MESH_FLAGS_AE_A5_A6) {
  11047. ++ if (mesh_flags & MESH_FLAGS_AE_A5_A6) {
  11048. + skb_copy_bits(skb, hdrlen +
  11049. + offsetof(struct ieee80211s_hdr, eaddr1),
  11050. +- dst, ETH_ALEN);
  11051. +- skb_copy_bits(skb, hdrlen +
  11052. +- offsetof(struct ieee80211s_hdr, eaddr2),
  11053. +- src, ETH_ALEN);
  11054. ++ tmp.h_dest, 2 * ETH_ALEN);
  11055. + }
  11056. +- hdrlen += ieee80211_get_mesh_hdrlen(meshdr);
  11057. ++ hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags);
  11058. + }
  11059. + break;
  11060. + case cpu_to_le16(IEEE80211_FCTL_FROMDS):
  11061. + if ((iftype != NL80211_IFTYPE_STATION &&
  11062. + iftype != NL80211_IFTYPE_P2P_CLIENT &&
  11063. + iftype != NL80211_IFTYPE_MESH_POINT) ||
  11064. +- (is_multicast_ether_addr(dst) &&
  11065. +- ether_addr_equal(src, addr)))
  11066. ++ (is_multicast_ether_addr(tmp.h_dest) &&
  11067. ++ ether_addr_equal(tmp.h_source, addr)))
  11068. + return -1;
  11069. + if (iftype == NL80211_IFTYPE_MESH_POINT) {
  11070. +- struct ieee80211s_hdr *meshdr =
  11071. +- (struct ieee80211s_hdr *) (skb->data + hdrlen);
  11072. +- /* make sure meshdr->flags is on the linear part */
  11073. +- if (!pskb_may_pull(skb, hdrlen + 1))
  11074. +- return -1;
  11075. +- if (meshdr->flags & MESH_FLAGS_AE_A5_A6)
  11076. ++ if (mesh_flags & MESH_FLAGS_AE_A5_A6)
  11077. + return -1;
  11078. +- if (meshdr->flags & MESH_FLAGS_AE_A4)
  11079. ++ if (mesh_flags & MESH_FLAGS_AE_A4)
  11080. + skb_copy_bits(skb, hdrlen +
  11081. + offsetof(struct ieee80211s_hdr, eaddr1),
  11082. +- src, ETH_ALEN);
  11083. +- hdrlen += ieee80211_get_mesh_hdrlen(meshdr);
  11084. ++ tmp.h_source, ETH_ALEN);
  11085. ++ hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags);
  11086. + }
  11087. + break;
  11088. + case cpu_to_le16(0):
  11089. +@@ -498,33 +498,33 @@ int ieee80211_data_to_8023(struct sk_buf
  11090. + break;
  11091. + }
  11092. +
  11093. +- if (!pskb_may_pull(skb, hdrlen + 8))
  11094. +- return -1;
  11095. +-
  11096. +- payload = skb->data + hdrlen;
  11097. +- ethertype = (payload[6] << 8) | payload[7];
  11098. ++ skb_copy_bits(skb, hdrlen, &payload, sizeof(payload));
  11099. ++ tmp.h_proto = payload.proto;
  11100. +
  11101. +- if (likely((ether_addr_equal(payload, rfc1042_header) &&
  11102. +- ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) ||
  11103. +- ether_addr_equal(payload, bridge_tunnel_header))) {
  11104. ++ if (likely((ether_addr_equal(payload.hdr, rfc1042_header) &&
  11105. ++ tmp.h_proto != htons(ETH_P_AARP) &&
  11106. ++ tmp.h_proto != htons(ETH_P_IPX)) ||
  11107. ++ ether_addr_equal(payload.hdr, bridge_tunnel_header)))
  11108. + /* remove RFC1042 or Bridge-Tunnel encapsulation and
  11109. + * replace EtherType */
  11110. +- skb_pull(skb, hdrlen + 6);
  11111. +- memcpy(skb_push(skb, ETH_ALEN), src, ETH_ALEN);
  11112. +- memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN);
  11113. +- } else {
  11114. +- struct ethhdr *ehdr;
  11115. +- __be16 len;
  11116. ++ hdrlen += ETH_ALEN + 2;
  11117. ++ else
  11118. ++ tmp.h_proto = htons(skb->len);
  11119. +
  11120. +- skb_pull(skb, hdrlen);
  11121. +- len = htons(skb->len);
  11122. ++ pskb_pull(skb, hdrlen);
  11123. ++
  11124. ++ if (!ehdr)
  11125. + ehdr = (struct ethhdr *) skb_push(skb, sizeof(struct ethhdr));
  11126. +- memcpy(ehdr->h_dest, dst, ETH_ALEN);
  11127. +- memcpy(ehdr->h_source, src, ETH_ALEN);
  11128. +- ehdr->h_proto = len;
  11129. +- }
  11130. ++ memcpy(ehdr, &tmp, sizeof(tmp));
  11131. ++
  11132. + return 0;
  11133. + }
  11134. ++
  11135. ++int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
  11136. ++ enum nl80211_iftype iftype)
  11137. ++{
  11138. ++ return __ieee80211_data_to_8023(skb, NULL, addr, iftype);
  11139. ++}
  11140. + EXPORT_SYMBOL(ieee80211_data_to_8023);
  11141. +
  11142. + int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr,
  11143. 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
  11144. deleted file mode 100644
  11145. index c4dd1af..0000000
  11146. --- a/package/kernel/mac80211/patches/320-ath9k-ar9271_hw_pa_cal-use-defs-instead-of-magin-num.patch
  11147. +++ /dev/null
  11148. @@ -1,89 +0,0 @@
  11149. -From: Oleksij Rempel <linux@rempel-privat.de>
  11150. -Date: Sun, 22 Mar 2015 19:29:47 +0100
  11151. -Subject: [PATCH] ath9k: ar9271_hw_pa_cal - use defs instead of magin
  11152. - numbers
  11153. -
  11154. -This function uses mixed styles for register names/numbers which
  11155. -is make harder reading and optimisation.
  11156. -
  11157. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  11158. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11159. ----
  11160. -
  11161. ---- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  11162. -+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  11163. -@@ -430,22 +430,22 @@ static void ar9271_hw_pa_cal(struct ath_
  11164. - u32 regVal;
  11165. - unsigned int i;
  11166. - u32 regList[][2] = {
  11167. -- { 0x786c, 0 },
  11168. -- { 0x7854, 0 },
  11169. -- { 0x7820, 0 },
  11170. -- { 0x7824, 0 },
  11171. -- { 0x7868, 0 },
  11172. -- { 0x783c, 0 },
  11173. -- { 0x7838, 0 } ,
  11174. -- { 0x7828, 0 } ,
  11175. -+ { AR9285_AN_TOP3, 0 },
  11176. -+ { AR9285_AN_RXTXBB1, 0 },
  11177. -+ { AR9285_AN_RF2G1, 0 },
  11178. -+ { AR9285_AN_RF2G2, 0 },
  11179. -+ { AR9285_AN_TOP2, 0 },
  11180. -+ { AR9285_AN_RF2G8, 0 },
  11181. -+ { AR9285_AN_RF2G7, 0 } ,
  11182. -+ { AR9285_AN_RF2G3, 0 } ,
  11183. - };
  11184. -
  11185. - for (i = 0; i < ARRAY_SIZE(regList); i++)
  11186. - regList[i][1] = REG_READ(ah, regList[i][0]);
  11187. -
  11188. -- regVal = REG_READ(ah, 0x7834);
  11189. -+ regVal = REG_READ(ah, AR9285_AN_RF2G6);
  11190. - regVal &= (~(0x1));
  11191. -- REG_WRITE(ah, 0x7834, regVal);
  11192. -+ REG_WRITE(ah, AR9285_AN_RF2G6, regVal);
  11193. - regVal = REG_READ(ah, 0x9808);
  11194. - regVal |= (0x1 << 27);
  11195. - REG_WRITE(ah, 0x9808, regVal);
  11196. -@@ -477,7 +477,7 @@ static void ar9271_hw_pa_cal(struct ath_
  11197. - * does not matter since we turn it off
  11198. - */
  11199. - REG_RMW_FIELD(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PADRVGN2TAB0, 0);
  11200. --
  11201. -+ /* 7828, b0-11, ccom=fff */
  11202. - REG_RMW_FIELD(ah, AR9285_AN_RF2G3, AR9271_AN_RF2G3_CCOMP, 0xfff);
  11203. -
  11204. - /* Set:
  11205. -@@ -490,15 +490,16 @@ static void ar9271_hw_pa_cal(struct ath_
  11206. -
  11207. - /* find off_6_1; */
  11208. - for (i = 6; i > 0; i--) {
  11209. -- regVal = REG_READ(ah, 0x7834);
  11210. -+ regVal = REG_READ(ah, AR9285_AN_RF2G6);
  11211. - regVal |= (1 << (20 + i));
  11212. -- REG_WRITE(ah, 0x7834, regVal);
  11213. -+ REG_WRITE(ah, AR9285_AN_RF2G6, regVal);
  11214. - udelay(1);
  11215. - /* regVal = REG_READ(ah, 0x7834); */
  11216. - regVal &= (~(0x1 << (20 + i)));
  11217. -- regVal |= (MS(REG_READ(ah, 0x7840), AR9285_AN_RXTXBB1_SPARE9)
  11218. -+ regVal |= (MS(REG_READ(ah, AR9285_AN_RF2G9),
  11219. -+ AR9285_AN_RXTXBB1_SPARE9)
  11220. - << (20 + i));
  11221. -- REG_WRITE(ah, 0x7834, regVal);
  11222. -+ REG_WRITE(ah, AR9285_AN_RF2G6, regVal);
  11223. - }
  11224. -
  11225. - regVal = (regVal >> 20) & 0x7f;
  11226. -@@ -517,9 +518,9 @@ static void ar9271_hw_pa_cal(struct ath_
  11227. -
  11228. - ENABLE_REGWRITE_BUFFER(ah);
  11229. -
  11230. -- regVal = REG_READ(ah, 0x7834);
  11231. -+ regVal = REG_READ(ah, AR_AN_RF2G1_CH1);
  11232. - regVal |= 0x1;
  11233. -- REG_WRITE(ah, 0x7834, regVal);
  11234. -+ REG_WRITE(ah, AR_AN_RF2G1_CH1, regVal);
  11235. - regVal = REG_READ(ah, 0x9808);
  11236. - regVal &= (~(0x1 << 27));
  11237. - REG_WRITE(ah, 0x9808, regVal);
  11238. diff --git a/package/kernel/mac80211/patches/320-cfg80211-add-support-for-non-linear-skbs-in-ieee8021.patch b/package/kernel/mac80211/patches/320-cfg80211-add-support-for-non-linear-skbs-in-ieee8021.patch
  11239. new file mode 100644
  11240. index 0000000..2eeed22
  11241. --- /dev/null
  11242. +++ b/package/kernel/mac80211/patches/320-cfg80211-add-support-for-non-linear-skbs-in-ieee8021.patch
  11243. @@ -0,0 +1,159 @@
  11244. +From: Felix Fietkau <nbd@openwrt.org>
  11245. +Date: Tue, 2 Feb 2016 14:39:10 +0100
  11246. +Subject: [PATCH] cfg80211: add support for non-linear skbs in
  11247. + ieee80211_amsdu_to_8023s
  11248. +
  11249. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  11250. +Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  11251. +---
  11252. +
  11253. +--- a/net/wireless/util.c
  11254. ++++ b/net/wireless/util.c
  11255. +@@ -644,73 +644,75 @@ int ieee80211_data_from_8023(struct sk_b
  11256. + }
  11257. + EXPORT_SYMBOL(ieee80211_data_from_8023);
  11258. +
  11259. ++static struct sk_buff *
  11260. ++__ieee80211_amsdu_copy(struct sk_buff *skb, unsigned int hlen,
  11261. ++ int offset, int len)
  11262. ++{
  11263. ++ struct sk_buff *frame;
  11264. ++
  11265. ++ if (skb->len - offset < len)
  11266. ++ return NULL;
  11267. ++
  11268. ++ /*
  11269. ++ * Allocate and reserve two bytes more for payload
  11270. ++ * alignment since sizeof(struct ethhdr) is 14.
  11271. ++ */
  11272. ++ frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + len);
  11273. ++
  11274. ++ skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2);
  11275. ++ skb_copy_bits(skb, offset, skb_put(frame, len), len);
  11276. ++
  11277. ++ return frame;
  11278. ++}
  11279. +
  11280. + void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
  11281. + const u8 *addr, enum nl80211_iftype iftype,
  11282. + const unsigned int extra_headroom,
  11283. + bool has_80211_header)
  11284. + {
  11285. ++ unsigned int hlen = ALIGN(extra_headroom, 4);
  11286. + struct sk_buff *frame = NULL;
  11287. + u16 ethertype;
  11288. + u8 *payload;
  11289. +- const struct ethhdr *eth;
  11290. +- int remaining, err;
  11291. +- u8 dst[ETH_ALEN], src[ETH_ALEN];
  11292. +-
  11293. +- if (skb_linearize(skb))
  11294. +- goto out;
  11295. ++ int offset = 0, remaining, err;
  11296. ++ struct ethhdr eth;
  11297. ++ bool reuse_skb = true;
  11298. ++ bool last = false;
  11299. +
  11300. + if (has_80211_header) {
  11301. +- err = ieee80211_data_to_8023(skb, addr, iftype);
  11302. ++ err = __ieee80211_data_to_8023(skb, &eth, addr, iftype);
  11303. + if (err)
  11304. + goto out;
  11305. +-
  11306. +- /* skip the wrapping header */
  11307. +- eth = (struct ethhdr *) skb_pull(skb, sizeof(struct ethhdr));
  11308. +- if (!eth)
  11309. +- goto out;
  11310. +- } else {
  11311. +- eth = (struct ethhdr *) skb->data;
  11312. + }
  11313. +
  11314. +- while (skb != frame) {
  11315. ++ while (!last) {
  11316. ++ unsigned int subframe_len;
  11317. ++ int len;
  11318. + u8 padding;
  11319. +- __be16 len = eth->h_proto;
  11320. +- unsigned int subframe_len = sizeof(struct ethhdr) + ntohs(len);
  11321. +-
  11322. +- remaining = skb->len;
  11323. +- memcpy(dst, eth->h_dest, ETH_ALEN);
  11324. +- memcpy(src, eth->h_source, ETH_ALEN);
  11325. +
  11326. ++ skb_copy_bits(skb, offset, &eth, sizeof(eth));
  11327. ++ len = ntohs(eth.h_proto);
  11328. ++ subframe_len = sizeof(struct ethhdr) + len;
  11329. + padding = (4 - subframe_len) & 0x3;
  11330. ++
  11331. + /* the last MSDU has no padding */
  11332. ++ remaining = skb->len - offset;
  11333. + if (subframe_len > remaining)
  11334. + goto purge;
  11335. +
  11336. +- skb_pull(skb, sizeof(struct ethhdr));
  11337. ++ offset += sizeof(struct ethhdr);
  11338. + /* reuse skb for the last subframe */
  11339. +- if (remaining <= subframe_len + padding)
  11340. ++ last = remaining <= subframe_len + padding;
  11341. ++ if (!skb_is_nonlinear(skb) && last) {
  11342. ++ skb_pull(skb, offset);
  11343. + frame = skb;
  11344. +- else {
  11345. +- unsigned int hlen = ALIGN(extra_headroom, 4);
  11346. +- /*
  11347. +- * Allocate and reserve two bytes more for payload
  11348. +- * alignment since sizeof(struct ethhdr) is 14.
  11349. +- */
  11350. +- frame = dev_alloc_skb(hlen + subframe_len + 2);
  11351. ++ reuse_skb = true;
  11352. ++ } else {
  11353. ++ frame = __ieee80211_amsdu_copy(skb, hlen, offset, len);
  11354. + if (!frame)
  11355. + goto purge;
  11356. +
  11357. +- skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2);
  11358. +- memcpy(skb_put(frame, ntohs(len)), skb->data,
  11359. +- ntohs(len));
  11360. +-
  11361. +- eth = (struct ethhdr *)skb_pull(skb, ntohs(len) +
  11362. +- padding);
  11363. +- if (!eth) {
  11364. +- dev_kfree_skb(frame);
  11365. +- goto purge;
  11366. +- }
  11367. ++ offset += len + padding;
  11368. + }
  11369. +
  11370. + skb_reset_network_header(frame);
  11371. +@@ -719,24 +721,20 @@ void ieee80211_amsdu_to_8023s(struct sk_
  11372. +
  11373. + payload = frame->data;
  11374. + ethertype = (payload[6] << 8) | payload[7];
  11375. +-
  11376. + if (likely((ether_addr_equal(payload, rfc1042_header) &&
  11377. + ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) ||
  11378. + ether_addr_equal(payload, bridge_tunnel_header))) {
  11379. +- /* remove RFC1042 or Bridge-Tunnel
  11380. +- * encapsulation and replace EtherType */
  11381. +- skb_pull(frame, 6);
  11382. +- memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN);
  11383. +- memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN);
  11384. +- } else {
  11385. +- memcpy(skb_push(frame, sizeof(__be16)), &len,
  11386. +- sizeof(__be16));
  11387. +- memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN);
  11388. +- memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN);
  11389. ++ eth.h_proto = htons(ethertype);
  11390. ++ skb_pull(frame, ETH_ALEN + 2);
  11391. + }
  11392. ++
  11393. ++ memcpy(skb_push(frame, sizeof(eth)), &eth, sizeof(eth));
  11394. + __skb_queue_tail(list, frame);
  11395. + }
  11396. +
  11397. ++ if (!reuse_skb)
  11398. ++ dev_kfree_skb(skb);
  11399. ++
  11400. + return;
  11401. +
  11402. + purge:
  11403. 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
  11404. deleted file mode 100644
  11405. index f05287d..0000000
  11406. --- a/package/kernel/mac80211/patches/321-ath9k-ar9271_hw_pa_cal-use-proper-makroses.patch
  11407. +++ /dev/null
  11408. @@ -1,79 +0,0 @@
  11409. -From: Oleksij Rempel <linux@rempel-privat.de>
  11410. -Date: Sun, 22 Mar 2015 19:29:48 +0100
  11411. -Subject: [PATCH] ath9k: ar9271_hw_pa_cal: use proper makroses.
  11412. -
  11413. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  11414. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11415. ----
  11416. -
  11417. ---- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  11418. -+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  11419. -@@ -443,33 +443,30 @@ static void ar9271_hw_pa_cal(struct ath_
  11420. - for (i = 0; i < ARRAY_SIZE(regList); i++)
  11421. - regList[i][1] = REG_READ(ah, regList[i][0]);
  11422. -
  11423. -- regVal = REG_READ(ah, AR9285_AN_RF2G6);
  11424. -- regVal &= (~(0x1));
  11425. -- REG_WRITE(ah, AR9285_AN_RF2G6, regVal);
  11426. -- regVal = REG_READ(ah, 0x9808);
  11427. -- regVal |= (0x1 << 27);
  11428. -- REG_WRITE(ah, 0x9808, regVal);
  11429. --
  11430. -+ /* 7834, b1=0 */
  11431. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G6, 1 << 0);
  11432. -+ /* 9808, b27=1 */
  11433. -+ REG_SET_BIT(ah, 0x9808, 1 << 27);
  11434. - /* 786c,b23,1, pwddac=1 */
  11435. -- REG_RMW_FIELD(ah, AR9285_AN_TOP3, AR9285_AN_TOP3_PWDDAC, 1);
  11436. -+ REG_SET_BIT(ah, AR9285_AN_TOP3, AR9285_AN_TOP3_PWDDAC);
  11437. - /* 7854, b5,1, pdrxtxbb=1 */
  11438. -- REG_RMW_FIELD(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDRXTXBB1, 1);
  11439. -+ REG_SET_BIT(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDRXTXBB1);
  11440. - /* 7854, b7,1, pdv2i=1 */
  11441. -- REG_RMW_FIELD(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDV2I, 1);
  11442. -+ REG_SET_BIT(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDV2I);
  11443. - /* 7854, b8,1, pddacinterface=1 */
  11444. -- REG_RMW_FIELD(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDDACIF, 1);
  11445. -+ REG_SET_BIT(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDDACIF);
  11446. - /* 7824,b12,0, offcal=0 */
  11447. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G2, AR9285_AN_RF2G2_OFFCAL, 0);
  11448. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G2, AR9285_AN_RF2G2_OFFCAL);
  11449. - /* 7838, b1,0, pwddb=0 */
  11450. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PWDDB, 0);
  11451. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PWDDB);
  11452. - /* 7820,b11,0, enpacal=0 */
  11453. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_ENPACAL, 0);
  11454. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_ENPACAL);
  11455. - /* 7820,b25,1, pdpadrv1=0 */
  11456. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPADRV1, 0);
  11457. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPADRV1);
  11458. - /* 7820,b24,0, pdpadrv2=0 */
  11459. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPADRV2, 0);
  11460. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPADRV2);
  11461. - /* 7820,b23,0, pdpaout=0 */
  11462. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPAOUT, 0);
  11463. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPAOUT);
  11464. - /* 783c,b14-16,7, padrvgn2tab_0=7 */
  11465. - REG_RMW_FIELD(ah, AR9285_AN_RF2G8, AR9285_AN_RF2G8_PADRVGN2TAB0, 7);
  11466. - /*
  11467. -@@ -516,15 +513,13 @@ static void ar9271_hw_pa_cal(struct ath_
  11468. - ah->pacal_info.prev_offset = regVal;
  11469. - }
  11470. -
  11471. -- ENABLE_REGWRITE_BUFFER(ah);
  11472. -
  11473. -- regVal = REG_READ(ah, AR_AN_RF2G1_CH1);
  11474. -- regVal |= 0x1;
  11475. -- REG_WRITE(ah, AR_AN_RF2G1_CH1, regVal);
  11476. -- regVal = REG_READ(ah, 0x9808);
  11477. -- regVal &= (~(0x1 << 27));
  11478. -- REG_WRITE(ah, 0x9808, regVal);
  11479. -+ /* 7834, b1=1 */
  11480. -+ REG_SET_BIT(ah, AR9285_AN_RF2G6, 1 << 0);
  11481. -+ /* 9808, b27=0 */
  11482. -+ REG_CLR_BIT(ah, 0x9808, 1 << 27);
  11483. -
  11484. -+ ENABLE_REGWRITE_BUFFER(ah);
  11485. - for (i = 0; i < ARRAY_SIZE(regList); i++)
  11486. - REG_WRITE(ah, regList[i][0], regList[i][1]);
  11487. -
  11488. diff --git a/package/kernel/mac80211/patches/321-mac80211-Parse-legacy-and-HT-rate-in-injected-frames.patch b/package/kernel/mac80211/patches/321-mac80211-Parse-legacy-and-HT-rate-in-injected-frames.patch
  11489. new file mode 100644
  11490. index 0000000..c4155a1
  11491. --- /dev/null
  11492. +++ b/package/kernel/mac80211/patches/321-mac80211-Parse-legacy-and-HT-rate-in-injected-frames.patch
  11493. @@ -0,0 +1,155 @@
  11494. +From: Sven Eckelmann <sven@narfation.org>
  11495. +Date: Tue, 26 Jan 2016 17:11:13 +0100
  11496. +Subject: [PATCH] mac80211: Parse legacy and HT rate in injected frames
  11497. +
  11498. +Drivers/devices without their own rate control algorithm can get the
  11499. +information what rates they should use from either the radiotap header of
  11500. +injected frames or from the rate control algorithm. But the parsing of the
  11501. +legacy rate information from the radiotap header was removed in commit
  11502. +e6a9854b05c1 ("mac80211/drivers: rewrite the rate control API").
  11503. +
  11504. +The removal of this feature heavily reduced the usefulness of frame
  11505. +injection when wanting to simulate specific transmission behavior. Having
  11506. +rate parsing together with MCS rates and retry support allows a fine
  11507. +grained selection of the tx behavior of injected frames for these kind of
  11508. +tests.
  11509. +
  11510. +Signed-off-by: Sven Eckelmann <sven@narfation.org>
  11511. +Cc: Simon Wunderlich <sw@simonwunderlich.de>
  11512. +Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  11513. +---
  11514. +
  11515. +--- a/include/net/mac80211.h
  11516. ++++ b/include/net/mac80211.h
  11517. +@@ -708,12 +708,14 @@ enum mac80211_tx_info_flags {
  11518. + * protocol frame (e.g. EAP)
  11519. + * @IEEE80211_TX_CTRL_PS_RESPONSE: This frame is a response to a poll
  11520. + * frame (PS-Poll or uAPSD).
  11521. ++ * @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information
  11522. + *
  11523. + * These flags are used in tx_info->control.flags.
  11524. + */
  11525. + enum mac80211_tx_control_flags {
  11526. + IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0),
  11527. + IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1),
  11528. ++ IEEE80211_TX_CTRL_RATE_INJECT = BIT(2),
  11529. + };
  11530. +
  11531. + /*
  11532. +--- a/net/mac80211/tx.c
  11533. ++++ b/net/mac80211/tx.c
  11534. +@@ -710,6 +710,10 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021
  11535. +
  11536. + info->control.short_preamble = txrc.short_preamble;
  11537. +
  11538. ++ /* don't ask rate control when rate already injected via radiotap */
  11539. ++ if (info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT)
  11540. ++ return TX_CONTINUE;
  11541. ++
  11542. + if (tx->sta)
  11543. + assoc = test_sta_flag(tx->sta, WLAN_STA_ASSOC);
  11544. +
  11545. +@@ -1665,15 +1669,24 @@ void ieee80211_xmit(struct ieee80211_sub
  11546. + ieee80211_tx(sdata, sta, skb, false);
  11547. + }
  11548. +
  11549. +-static bool ieee80211_parse_tx_radiotap(struct sk_buff *skb)
  11550. ++static bool ieee80211_parse_tx_radiotap(struct ieee80211_local *local,
  11551. ++ struct sk_buff *skb)
  11552. + {
  11553. + struct ieee80211_radiotap_iterator iterator;
  11554. + struct ieee80211_radiotap_header *rthdr =
  11555. + (struct ieee80211_radiotap_header *) skb->data;
  11556. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  11557. ++ struct ieee80211_supported_band *sband =
  11558. ++ local->hw.wiphy->bands[info->band];
  11559. + int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len,
  11560. + NULL);
  11561. + u16 txflags;
  11562. ++ u16 rate = 0;
  11563. ++ bool rate_found = false;
  11564. ++ u8 rate_retries = 0;
  11565. ++ u16 rate_flags = 0;
  11566. ++ u8 mcs_known, mcs_flags;
  11567. ++ int i;
  11568. +
  11569. + info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
  11570. + IEEE80211_TX_CTL_DONTFRAG;
  11571. +@@ -1724,6 +1737,35 @@ static bool ieee80211_parse_tx_radiotap(
  11572. + info->flags |= IEEE80211_TX_CTL_NO_ACK;
  11573. + break;
  11574. +
  11575. ++ case IEEE80211_RADIOTAP_RATE:
  11576. ++ rate = *iterator.this_arg;
  11577. ++ rate_flags = 0;
  11578. ++ rate_found = true;
  11579. ++ break;
  11580. ++
  11581. ++ case IEEE80211_RADIOTAP_DATA_RETRIES:
  11582. ++ rate_retries = *iterator.this_arg;
  11583. ++ break;
  11584. ++
  11585. ++ case IEEE80211_RADIOTAP_MCS:
  11586. ++ mcs_known = iterator.this_arg[0];
  11587. ++ mcs_flags = iterator.this_arg[1];
  11588. ++ if (!(mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_MCS))
  11589. ++ break;
  11590. ++
  11591. ++ rate_found = true;
  11592. ++ rate = iterator.this_arg[2];
  11593. ++ rate_flags = IEEE80211_TX_RC_MCS;
  11594. ++
  11595. ++ if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_GI &&
  11596. ++ mcs_flags & IEEE80211_RADIOTAP_MCS_SGI)
  11597. ++ rate_flags |= IEEE80211_TX_RC_SHORT_GI;
  11598. ++
  11599. ++ if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_BW &&
  11600. ++ mcs_flags & IEEE80211_RADIOTAP_MCS_BW_40)
  11601. ++ rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
  11602. ++ break;
  11603. ++
  11604. + /*
  11605. + * Please update the file
  11606. + * Documentation/networking/mac80211-injection.txt
  11607. +@@ -1738,6 +1780,32 @@ static bool ieee80211_parse_tx_radiotap(
  11608. + if (ret != -ENOENT) /* ie, if we didn't simply run out of fields */
  11609. + return false;
  11610. +
  11611. ++ if (rate_found) {
  11612. ++ info->control.flags |= IEEE80211_TX_CTRL_RATE_INJECT;
  11613. ++
  11614. ++ for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
  11615. ++ info->control.rates[i].idx = -1;
  11616. ++ info->control.rates[i].flags = 0;
  11617. ++ info->control.rates[i].count = 0;
  11618. ++ }
  11619. ++
  11620. ++ if (rate_flags & IEEE80211_TX_RC_MCS) {
  11621. ++ info->control.rates[0].idx = rate;
  11622. ++ } else {
  11623. ++ for (i = 0; i < sband->n_bitrates; i++) {
  11624. ++ if (rate * 5 != sband->bitrates[i].bitrate)
  11625. ++ continue;
  11626. ++
  11627. ++ info->control.rates[0].idx = i;
  11628. ++ break;
  11629. ++ }
  11630. ++ }
  11631. ++
  11632. ++ info->control.rates[0].flags = rate_flags;
  11633. ++ info->control.rates[0].count = min_t(u8, rate_retries + 1,
  11634. ++ local->hw.max_rate_tries);
  11635. ++ }
  11636. ++
  11637. + /*
  11638. + * remove the radiotap header
  11639. + * iterator->_max_length was sanity-checked against
  11640. +@@ -1819,7 +1887,7 @@ netdev_tx_t ieee80211_monitor_start_xmit
  11641. + IEEE80211_TX_CTL_INJECTED;
  11642. +
  11643. + /* process and remove the injection radiotap header */
  11644. +- if (!ieee80211_parse_tx_radiotap(skb))
  11645. ++ if (!ieee80211_parse_tx_radiotap(local, skb))
  11646. + goto fail;
  11647. +
  11648. + rcu_read_lock();
  11649. 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
  11650. deleted file mode 100644
  11651. index 7247369..0000000
  11652. --- a/package/kernel/mac80211/patches/322-ath9k-ar9271_hw_pa_cal-use-RMW-buffer.patch
  11653. +++ /dev/null
  11654. @@ -1,48 +0,0 @@
  11655. -From: Oleksij Rempel <linux@rempel-privat.de>
  11656. -Date: Sun, 22 Mar 2015 19:29:49 +0100
  11657. -Subject: [PATCH] ath9k: ar9271_hw_pa_cal: use RMW buffer
  11658. -
  11659. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  11660. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11661. ----
  11662. -
  11663. ---- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  11664. -+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  11665. -@@ -436,13 +436,14 @@ static void ar9271_hw_pa_cal(struct ath_
  11666. - { AR9285_AN_RF2G2, 0 },
  11667. - { AR9285_AN_TOP2, 0 },
  11668. - { AR9285_AN_RF2G8, 0 },
  11669. -- { AR9285_AN_RF2G7, 0 } ,
  11670. -- { AR9285_AN_RF2G3, 0 } ,
  11671. -+ { AR9285_AN_RF2G7, 0 },
  11672. -+ { AR9285_AN_RF2G3, 0 },
  11673. - };
  11674. -
  11675. - for (i = 0; i < ARRAY_SIZE(regList); i++)
  11676. - regList[i][1] = REG_READ(ah, regList[i][0]);
  11677. -
  11678. -+ ENABLE_REG_RMW_BUFFER(ah);
  11679. - /* 7834, b1=0 */
  11680. - REG_CLR_BIT(ah, AR9285_AN_RF2G6, 1 << 0);
  11681. - /* 9808, b27=1 */
  11682. -@@ -476,6 +477,7 @@ static void ar9271_hw_pa_cal(struct ath_
  11683. - REG_RMW_FIELD(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PADRVGN2TAB0, 0);
  11684. - /* 7828, b0-11, ccom=fff */
  11685. - REG_RMW_FIELD(ah, AR9285_AN_RF2G3, AR9271_AN_RF2G3_CCOMP, 0xfff);
  11686. -+ REG_RMW_BUFFER_FLUSH(ah);
  11687. -
  11688. - /* Set:
  11689. - * localmode=1,bmode=1,bmoderxtx=1,synthon=1,
  11690. -@@ -514,10 +516,12 @@ static void ar9271_hw_pa_cal(struct ath_
  11691. - }
  11692. -
  11693. -
  11694. -+ ENABLE_REG_RMW_BUFFER(ah);
  11695. - /* 7834, b1=1 */
  11696. - REG_SET_BIT(ah, AR9285_AN_RF2G6, 1 << 0);
  11697. - /* 9808, b27=0 */
  11698. - REG_CLR_BIT(ah, 0x9808, 1 << 27);
  11699. -+ REG_RMW_BUFFER_FLUSH(ah);
  11700. -
  11701. - ENABLE_REGWRITE_BUFFER(ah);
  11702. - for (i = 0; i < ARRAY_SIZE(regList); i++)
  11703. diff --git a/package/kernel/mac80211/patches/322-mac80211-add-A-MSDU-tx-support.patch b/package/kernel/mac80211/patches/322-mac80211-add-A-MSDU-tx-support.patch
  11704. new file mode 100644
  11705. index 0000000..d55f772
  11706. --- /dev/null
  11707. +++ b/package/kernel/mac80211/patches/322-mac80211-add-A-MSDU-tx-support.patch
  11708. @@ -0,0 +1,292 @@
  11709. +From: Felix Fietkau <nbd@openwrt.org>
  11710. +Date: Fri, 5 Feb 2016 01:38:51 +0100
  11711. +Subject: [PATCH] mac80211: add A-MSDU tx support
  11712. +
  11713. +Requires software tx queueing support. frag_list support (for zero-copy)
  11714. +is optional.
  11715. +
  11716. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  11717. +---
  11718. +
  11719. +--- a/include/net/mac80211.h
  11720. ++++ b/include/net/mac80211.h
  11721. +@@ -709,6 +709,7 @@ enum mac80211_tx_info_flags {
  11722. + * @IEEE80211_TX_CTRL_PS_RESPONSE: This frame is a response to a poll
  11723. + * frame (PS-Poll or uAPSD).
  11724. + * @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information
  11725. ++ * @IEEE80211_TX_CTRL_AMSDU: This frame is an A-MSDU frame
  11726. + *
  11727. + * These flags are used in tx_info->control.flags.
  11728. + */
  11729. +@@ -716,6 +717,7 @@ enum mac80211_tx_control_flags {
  11730. + IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0),
  11731. + IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1),
  11732. + IEEE80211_TX_CTRL_RATE_INJECT = BIT(2),
  11733. ++ IEEE80211_TX_CTRL_AMSDU = BIT(3),
  11734. + };
  11735. +
  11736. + /*
  11737. +@@ -1961,6 +1963,12 @@ struct ieee80211_txq {
  11738. + * order and does not need to manage its own reorder buffer or BA session
  11739. + * timeout.
  11740. + *
  11741. ++ * @IEEE80211_HW_TX_AMSDU: Hardware (or driver) supports software aggregated
  11742. ++ * A-MSDU frames. Requires software tx queueing support.
  11743. ++ *
  11744. ++ * @IEEE80211_HW_TX_FRAG_LIST: Hardware (or driver) supports sending frag_list
  11745. ++ * skbs, needed for zero-copy software A-MSDU.
  11746. ++ *
  11747. + * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
  11748. + */
  11749. + enum ieee80211_hw_flags {
  11750. +@@ -1998,6 +2006,8 @@ enum ieee80211_hw_flags {
  11751. + IEEE80211_HW_BEACON_TX_STATUS,
  11752. + IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR,
  11753. + IEEE80211_HW_SUPPORTS_REORDERING_BUFFER,
  11754. ++ IEEE80211_HW_TX_AMSDU,
  11755. ++ IEEE80211_HW_TX_FRAG_LIST,
  11756. +
  11757. + /* keep last, obviously */
  11758. + NUM_IEEE80211_HW_FLAGS
  11759. +@@ -2070,6 +2080,8 @@ enum ieee80211_hw_flags {
  11760. + * size is smaller (an example is LinkSys WRT120N with FW v1.0.07
  11761. + * build 002 Jun 18 2012).
  11762. + *
  11763. ++ * @max_tx_fragments: maximum fragments per (A-)MSDU.
  11764. ++ *
  11765. + * @offchannel_tx_hw_queue: HW queue ID to use for offchannel TX
  11766. + * (if %IEEE80211_HW_QUEUE_CONTROL is set)
  11767. + *
  11768. +@@ -2124,6 +2136,7 @@ struct ieee80211_hw {
  11769. + u8 max_rate_tries;
  11770. + u8 max_rx_aggregation_subframes;
  11771. + u8 max_tx_aggregation_subframes;
  11772. ++ u8 max_tx_fragments;
  11773. + u8 offchannel_tx_hw_queue;
  11774. + u8 radiotap_mcs_details;
  11775. + u16 radiotap_vht_details;
  11776. +--- a/net/mac80211/agg-tx.c
  11777. ++++ b/net/mac80211/agg-tx.c
  11778. +@@ -935,6 +935,7 @@ void ieee80211_process_addba_resp(struct
  11779. + size_t len)
  11780. + {
  11781. + struct tid_ampdu_tx *tid_tx;
  11782. ++ struct ieee80211_txq *txq;
  11783. + u16 capab, tid;
  11784. + u8 buf_size;
  11785. + bool amsdu;
  11786. +@@ -945,6 +946,10 @@ void ieee80211_process_addba_resp(struct
  11787. + buf_size = (capab & IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK) >> 6;
  11788. + buf_size = min(buf_size, local->hw.max_tx_aggregation_subframes);
  11789. +
  11790. ++ txq = sta->sta.txq[tid];
  11791. ++ if (!amsdu && txq)
  11792. ++ set_bit(IEEE80211_TXQ_NO_AMSDU, &to_txq_info(txq)->flags);
  11793. ++
  11794. + mutex_lock(&sta->ampdu_mlme.mtx);
  11795. +
  11796. + tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
  11797. +--- a/net/mac80211/debugfs.c
  11798. ++++ b/net/mac80211/debugfs.c
  11799. +@@ -127,6 +127,8 @@ static const char *hw_flag_names[NUM_IEE
  11800. + FLAG(BEACON_TX_STATUS),
  11801. + FLAG(NEEDS_UNIQUE_STA_ADDR),
  11802. + FLAG(SUPPORTS_REORDERING_BUFFER),
  11803. ++ FLAG(TX_AMSDU),
  11804. ++ FLAG(TX_FRAG_LIST),
  11805. +
  11806. + /* keep last for the build bug below */
  11807. + (void *)0x1
  11808. +--- a/net/mac80211/ieee80211_i.h
  11809. ++++ b/net/mac80211/ieee80211_i.h
  11810. +@@ -799,6 +799,7 @@ struct mac80211_qos_map {
  11811. + enum txq_info_flags {
  11812. + IEEE80211_TXQ_STOP,
  11813. + IEEE80211_TXQ_AMPDU,
  11814. ++ IEEE80211_TXQ_NO_AMSDU,
  11815. + };
  11816. +
  11817. + struct txq_info {
  11818. +--- a/net/mac80211/tx.c
  11819. ++++ b/net/mac80211/tx.c
  11820. +@@ -1318,6 +1318,10 @@ struct sk_buff *ieee80211_tx_dequeue(str
  11821. + out:
  11822. + spin_unlock_bh(&txqi->queue.lock);
  11823. +
  11824. ++ if (skb && skb_has_frag_list(skb) &&
  11825. ++ !ieee80211_hw_check(&local->hw, TX_FRAG_LIST))
  11826. ++ skb_linearize(skb);
  11827. ++
  11828. + return skb;
  11829. + }
  11830. + EXPORT_SYMBOL(ieee80211_tx_dequeue);
  11831. +@@ -2757,6 +2761,158 @@ void ieee80211_clear_fast_xmit(struct st
  11832. + kfree_rcu(fast_tx, rcu_head);
  11833. + }
  11834. +
  11835. ++static int ieee80211_amsdu_pad(struct sk_buff *skb, int subframe_len)
  11836. ++{
  11837. ++ int amsdu_len = subframe_len + sizeof(struct ethhdr);
  11838. ++ int padding = (4 - amsdu_len) & 3;
  11839. ++
  11840. ++ if (padding)
  11841. ++ memset(skb_put(skb, padding), 0, padding);
  11842. ++
  11843. ++ return padding;
  11844. ++}
  11845. ++
  11846. ++static bool ieee80211_amsdu_prepare_head(struct ieee80211_sub_if_data *sdata,
  11847. ++ struct ieee80211_fast_tx *fast_tx,
  11848. ++ struct sk_buff *skb)
  11849. ++{
  11850. ++ struct ieee80211_local *local = sdata->local;
  11851. ++ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  11852. ++ struct ieee80211_hdr *hdr;
  11853. ++ struct ethhdr amsdu_hdr;
  11854. ++ int hdr_len = fast_tx->hdr_len - sizeof(rfc1042_header);
  11855. ++ int subframe_len = skb->len - hdr_len;
  11856. ++ void *data;
  11857. ++ u8 *qc;
  11858. ++
  11859. ++ if (info->control.flags & IEEE80211_TX_CTRL_AMSDU)
  11860. ++ return true;
  11861. ++
  11862. ++ if (skb_headroom(skb) < sizeof(amsdu_hdr) || skb_tailroom(skb) < 3) {
  11863. ++ I802_DEBUG_INC(local->tx_expand_skb_head);
  11864. ++
  11865. ++ if (pskb_expand_head(skb, sizeof(amsdu_hdr), 3, GFP_ATOMIC)) {
  11866. ++ wiphy_debug(local->hw.wiphy,
  11867. ++ "failed to reallocate TX buffer\n");
  11868. ++ return false;
  11869. ++ }
  11870. ++ }
  11871. ++
  11872. ++ subframe_len += ieee80211_amsdu_pad(skb, subframe_len);
  11873. ++
  11874. ++ amsdu_hdr.h_proto = cpu_to_be16(subframe_len);
  11875. ++ memcpy(amsdu_hdr.h_source, skb->data + fast_tx->sa_offs, ETH_ALEN);
  11876. ++ memcpy(amsdu_hdr.h_dest, skb->data + fast_tx->da_offs, ETH_ALEN);
  11877. ++
  11878. ++ data = skb_push(skb, sizeof(amsdu_hdr));
  11879. ++ memmove(data, data + sizeof(amsdu_hdr), hdr_len);
  11880. ++ memcpy(data + hdr_len, &amsdu_hdr, sizeof(amsdu_hdr));
  11881. ++
  11882. ++ hdr = data;
  11883. ++ qc = ieee80211_get_qos_ctl(hdr);
  11884. ++ *qc |= IEEE80211_QOS_CTL_A_MSDU_PRESENT;
  11885. ++
  11886. ++ info->control.flags |= IEEE80211_TX_CTRL_AMSDU;
  11887. ++
  11888. ++ return true;
  11889. ++}
  11890. ++
  11891. ++static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata,
  11892. ++ struct sta_info *sta,
  11893. ++ struct ieee80211_fast_tx *fast_tx,
  11894. ++ struct sk_buff *skb)
  11895. ++{
  11896. ++ struct ieee80211_local *local = sdata->local;
  11897. ++ u8 tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
  11898. ++ struct ieee80211_txq *txq = sta->sta.txq[tid];
  11899. ++ struct txq_info *txqi;
  11900. ++ struct sk_buff **frag_tail, *head;
  11901. ++ int subframe_len = skb->len - ETH_ALEN;
  11902. ++ u8 max_subframes = sta->sta.max_amsdu_subframes;
  11903. ++ int max_frags = local->hw.max_tx_fragments;
  11904. ++ int max_amsdu_len;
  11905. ++ __be16 len;
  11906. ++ void *data;
  11907. ++ bool ret = false;
  11908. ++ int n = 1, nfrags;
  11909. ++
  11910. ++ if (!ieee80211_hw_check(&local->hw, TX_AMSDU))
  11911. ++ return false;
  11912. ++
  11913. ++ if (!txq)
  11914. ++ return false;
  11915. ++
  11916. ++ txqi = to_txq_info(txq);
  11917. ++ if (test_bit(IEEE80211_TXQ_NO_AMSDU, &txqi->flags))
  11918. ++ return false;
  11919. ++
  11920. ++ spin_lock_bh(&txqi->queue.lock);
  11921. ++
  11922. ++ head = skb_peek_tail(&txqi->queue);
  11923. ++ if (!head)
  11924. ++ goto out;
  11925. ++
  11926. ++ if (skb->len + head->len > max_amsdu_len)
  11927. ++ goto out;
  11928. ++
  11929. ++ /*
  11930. ++ * HT A-MPDU limits maximum MPDU size to 4095 bytes. Since aggregation
  11931. ++ * sessions are started/stopped without txq flush, use the limit here
  11932. ++ * to avoid having to de-aggregate later.
  11933. ++ */
  11934. ++ if (skb->len + head->len > 4095 &&
  11935. ++ !sta->sta.vht_cap.vht_supported)
  11936. ++ goto out;
  11937. ++
  11938. ++ if (!ieee80211_amsdu_prepare_head(sdata, fast_tx, head))
  11939. ++ goto out;
  11940. ++
  11941. ++ nfrags = 1 + skb_shinfo(skb)->nr_frags;
  11942. ++ nfrags += 1 + skb_shinfo(head)->nr_frags;
  11943. ++ frag_tail = &skb_shinfo(head)->frag_list;
  11944. ++ while (*frag_tail) {
  11945. ++ nfrags += 1 + skb_shinfo(*frag_tail)->nr_frags;
  11946. ++ frag_tail = &(*frag_tail)->next;
  11947. ++ n++;
  11948. ++ }
  11949. ++
  11950. ++ if (max_subframes && n > max_subframes)
  11951. ++ goto out;
  11952. ++
  11953. ++ if (max_frags && nfrags > max_frags)
  11954. ++ goto out;
  11955. ++
  11956. ++ if (skb_headroom(skb) < 8 || skb_tailroom(skb) < 3) {
  11957. ++ I802_DEBUG_INC(local->tx_expand_skb_head);
  11958. ++
  11959. ++ if (pskb_expand_head(skb, 8, 3, GFP_ATOMIC)) {
  11960. ++ wiphy_debug(local->hw.wiphy,
  11961. ++ "failed to reallocate TX buffer\n");
  11962. ++ goto out;
  11963. ++ }
  11964. ++ }
  11965. ++
  11966. ++ subframe_len += ieee80211_amsdu_pad(skb, subframe_len);
  11967. ++
  11968. ++ ret = true;
  11969. ++ data = skb_push(skb, ETH_ALEN + 2);
  11970. ++ memmove(data, data + ETH_ALEN + 2, 2 * ETH_ALEN);
  11971. ++
  11972. ++ data += 2 * ETH_ALEN;
  11973. ++ len = cpu_to_be16(subframe_len);
  11974. ++ memcpy(data, &len, 2);
  11975. ++ memcpy(data + 2, rfc1042_header, ETH_ALEN);
  11976. ++
  11977. ++ head->len += skb->len;
  11978. ++ head->data_len += skb->len;
  11979. ++ *frag_tail = skb;
  11980. ++
  11981. ++out:
  11982. ++ spin_unlock_bh(&txqi->queue.lock);
  11983. ++
  11984. ++ return ret;
  11985. ++}
  11986. ++
  11987. + static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
  11988. + struct net_device *dev, struct sta_info *sta,
  11989. + struct ieee80211_fast_tx *fast_tx,
  11990. +@@ -2811,6 +2967,10 @@ static bool ieee80211_xmit_fast(struct i
  11991. +
  11992. + ieee80211_tx_stats(dev, skb->len + extra_head);
  11993. +
  11994. ++ if ((hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) &&
  11995. ++ ieee80211_amsdu_aggregate(sdata, sta, fast_tx, skb))
  11996. ++ return true;
  11997. ++
  11998. + /* will not be crypto-handled beyond what we do here, so use false
  11999. + * as the may-encrypt argument for the resize to not account for
  12000. + * more room than we already have in 'extra_head'
  12001. diff --git a/package/kernel/mac80211/patches/323-0001-brcmfmac-analyze-descriptors-of-current-component-on.patch b/package/kernel/mac80211/patches/323-0001-brcmfmac-analyze-descriptors-of-current-component-on.patch
  12002. new file mode 100644
  12003. index 0000000..d7018da
  12004. --- /dev/null
  12005. +++ b/package/kernel/mac80211/patches/323-0001-brcmfmac-analyze-descriptors-of-current-component-on.patch
  12006. @@ -0,0 +1,51 @@
  12007. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  12008. +Date: Tue, 26 Jan 2016 17:57:01 +0100
  12009. +Subject: [PATCH] brcmfmac: analyze descriptors of current component only
  12010. +MIME-Version: 1.0
  12011. +Content-Type: text/plain; charset=UTF-8
  12012. +Content-Transfer-Encoding: 8bit
  12013. +
  12014. +So far we were looking for address descriptors without a check for
  12015. +crossing current component border. In case of dealing with unsupported
  12016. +descriptor or descriptor missing at all the code would incorrectly get
  12017. +data from another component.
  12018. +
  12019. +Consider this binary-described component from BCM4366 EROM:
  12020. +4bf83b01 TAG==CI CID==0x83b
  12021. +20080201 TAG==CI PORTS==0+1 WRAPPERS==0+1
  12022. +18400035 TAG==ADDR SZ_SZD TYPE_SLAVE
  12023. +00050000
  12024. +18107085 TAG==ADDR SZ_4K TYPE_SWRAP
  12025. +
  12026. +Driver was assigning invalid base address to this core:
  12027. +brcmfmac: [6 ] core 0x83b:32 base 0x18109000 wrap 0x18107000
  12028. +which came from totally different component defined in EROM:
  12029. +43b36701 TAG==CI CID==0x367
  12030. +00000201 TAG==CI PORTS==0+1 WRAPPERS==0+0
  12031. +18109005 TAG==ADDR SZ_4K TYPE_SLAVE
  12032. +
  12033. +This change will also allow us to support components without wrapper
  12034. +address in the future.
  12035. +
  12036. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  12037. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12038. +---
  12039. +
  12040. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  12041. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  12042. +@@ -803,7 +803,14 @@ static int brcmf_chip_dmp_get_regaddr(st
  12043. + *eromaddr -= 4;
  12044. + return -EFAULT;
  12045. + }
  12046. +- } while (desc != DMP_DESC_ADDRESS);
  12047. ++ } while (desc != DMP_DESC_ADDRESS &&
  12048. ++ desc != DMP_DESC_COMPONENT);
  12049. ++
  12050. ++ /* stop if we crossed current component border */
  12051. ++ if (desc == DMP_DESC_COMPONENT) {
  12052. ++ *eromaddr -= 4;
  12053. ++ return 0;
  12054. ++ }
  12055. +
  12056. + /* skip upper 32-bit address descriptor */
  12057. + if (val & DMP_DESC_ADDRSIZE_GT32)
  12058. diff --git a/package/kernel/mac80211/patches/323-0002-brcmfmac-allow-storing-PMU-core-without-wrapper-addr.patch b/package/kernel/mac80211/patches/323-0002-brcmfmac-allow-storing-PMU-core-without-wrapper-addr.patch
  12059. new file mode 100644
  12060. index 0000000..045ab49
  12061. --- /dev/null
  12062. +++ b/package/kernel/mac80211/patches/323-0002-brcmfmac-allow-storing-PMU-core-without-wrapper-addr.patch
  12063. @@ -0,0 +1,28 @@
  12064. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  12065. +Date: Tue, 26 Jan 2016 17:57:02 +0100
  12066. +Subject: [PATCH] brcmfmac: allow storing PMU core without wrapper address
  12067. +MIME-Version: 1.0
  12068. +Content-Type: text/plain; charset=UTF-8
  12069. +Content-Transfer-Encoding: 8bit
  12070. +
  12071. +Separated PMU core can be found in new devices and should be used for
  12072. +accessing PMU registers (which were routed through ChipCommon so far).
  12073. +This core is one of exceptions that doesn't have or need wrapper address
  12074. +to be still safely accessible.
  12075. +
  12076. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  12077. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12078. +---
  12079. +
  12080. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  12081. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  12082. +@@ -883,7 +883,8 @@ int brcmf_chip_dmp_erom_scan(struct brcm
  12083. + rev = (val & DMP_COMP_REVISION) >> DMP_COMP_REVISION_S;
  12084. +
  12085. + /* need core with ports */
  12086. +- if (nmw + nsw == 0)
  12087. ++ if (nmw + nsw == 0 &&
  12088. ++ id != BCMA_CORE_PMU)
  12089. + continue;
  12090. +
  12091. + /* try to obtain register address info */
  12092. diff --git a/package/kernel/mac80211/patches/323-0003-brcmfmac-read-extended-capabilities-of-ChipCommon-co.patch b/package/kernel/mac80211/patches/323-0003-brcmfmac-read-extended-capabilities-of-ChipCommon-co.patch
  12093. new file mode 100644
  12094. index 0000000..7b7ba4f
  12095. --- /dev/null
  12096. +++ b/package/kernel/mac80211/patches/323-0003-brcmfmac-read-extended-capabilities-of-ChipCommon-co.patch
  12097. @@ -0,0 +1,43 @@
  12098. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  12099. +Date: Tue, 26 Jan 2016 17:57:03 +0100
  12100. +Subject: [PATCH] brcmfmac: read extended capabilities of ChipCommon core
  12101. +MIME-Version: 1.0
  12102. +Content-Type: text/plain; charset=UTF-8
  12103. +Content-Transfer-Encoding: 8bit
  12104. +
  12105. +This is an extra bitfield with info about some present hardware.
  12106. +
  12107. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  12108. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12109. +---
  12110. +
  12111. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  12112. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  12113. +@@ -1025,6 +1025,9 @@ static int brcmf_chip_setup(struct brcmf
  12114. + /* get chipcommon capabilites */
  12115. + pub->cc_caps = chip->ops->read32(chip->ctx,
  12116. + CORE_CC_REG(base, capabilities));
  12117. ++ pub->cc_caps_ext = chip->ops->read32(chip->ctx,
  12118. ++ CORE_CC_REG(base,
  12119. ++ capabilities_ext));
  12120. +
  12121. + /* get pmu caps & rev */
  12122. + if (pub->cc_caps & CC_CAP_PMU) {
  12123. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  12124. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  12125. +@@ -27,6 +27,7 @@
  12126. + * @chip: chip identifier.
  12127. + * @chiprev: chip revision.
  12128. + * @cc_caps: chipcommon core capabilities.
  12129. ++ * @cc_caps_ext: chipcommon core extended capabilities.
  12130. + * @pmucaps: PMU capabilities.
  12131. + * @pmurev: PMU revision.
  12132. + * @rambase: RAM base address (only applicable for ARM CR4 chips).
  12133. +@@ -38,6 +39,7 @@ struct brcmf_chip {
  12134. + u32 chip;
  12135. + u32 chiprev;
  12136. + u32 cc_caps;
  12137. ++ u32 cc_caps_ext;
  12138. + u32 pmucaps;
  12139. + u32 pmurev;
  12140. + u32 rambase;
  12141. diff --git a/package/kernel/mac80211/patches/323-0004-brcmfmac-access-PMU-registers-using-standalone-PMU-c.patch b/package/kernel/mac80211/patches/323-0004-brcmfmac-access-PMU-registers-using-standalone-PMU-c.patch
  12142. new file mode 100644
  12143. index 0000000..2af6fd9
  12144. --- /dev/null
  12145. +++ b/package/kernel/mac80211/patches/323-0004-brcmfmac-access-PMU-registers-using-standalone-PMU-c.patch
  12146. @@ -0,0 +1,148 @@
  12147. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  12148. +Date: Tue, 26 Jan 2016 17:57:04 +0100
  12149. +Subject: [PATCH] brcmfmac: access PMU registers using standalone PMU core if
  12150. + available
  12151. +MIME-Version: 1.0
  12152. +Content-Type: text/plain; charset=UTF-8
  12153. +Content-Transfer-Encoding: 8bit
  12154. +
  12155. +On recent Broadcom chipsets PMU is present as separated core and it
  12156. +can't be accessed using ChipCommon anymore as it fails with e.g.:
  12157. +[ 18.198412] Unhandled fault: imprecise external abort (0x1406) at 0xb6da200f
  12158. +
  12159. +Add a new helper function that will return a proper core that should be
  12160. +used for accessing PMU registers.
  12161. +
  12162. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  12163. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12164. +---
  12165. +
  12166. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  12167. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  12168. +@@ -1014,6 +1014,7 @@ static int brcmf_chip_setup(struct brcmf
  12169. + {
  12170. + struct brcmf_chip *pub;
  12171. + struct brcmf_core_priv *cc;
  12172. ++ struct brcmf_core *pmu;
  12173. + u32 base;
  12174. + u32 val;
  12175. + int ret = 0;
  12176. +@@ -1030,9 +1031,10 @@ static int brcmf_chip_setup(struct brcmf
  12177. + capabilities_ext));
  12178. +
  12179. + /* get pmu caps & rev */
  12180. ++ pmu = brcmf_chip_get_pmu(pub); /* after reading cc_caps_ext */
  12181. + if (pub->cc_caps & CC_CAP_PMU) {
  12182. + val = chip->ops->read32(chip->ctx,
  12183. +- CORE_CC_REG(base, pmucapabilities));
  12184. ++ CORE_CC_REG(pmu->base, pmucapabilities));
  12185. + pub->pmurev = val & PCAP_REV_MASK;
  12186. + pub->pmucaps = val;
  12187. + }
  12188. +@@ -1131,6 +1133,23 @@ struct brcmf_core *brcmf_chip_get_chipco
  12189. + return &cc->pub;
  12190. + }
  12191. +
  12192. ++struct brcmf_core *brcmf_chip_get_pmu(struct brcmf_chip *pub)
  12193. ++{
  12194. ++ struct brcmf_core *cc = brcmf_chip_get_chipcommon(pub);
  12195. ++ struct brcmf_core *pmu;
  12196. ++
  12197. ++ /* See if there is separated PMU core available */
  12198. ++ if (cc->rev >= 35 &&
  12199. ++ pub->cc_caps_ext & BCMA_CC_CAP_EXT_AOB_PRESENT) {
  12200. ++ pmu = brcmf_chip_get_core(pub, BCMA_CORE_PMU);
  12201. ++ if (pmu)
  12202. ++ return pmu;
  12203. ++ }
  12204. ++
  12205. ++ /* Fallback to ChipCommon core for older hardware */
  12206. ++ return cc;
  12207. ++}
  12208. ++
  12209. + bool brcmf_chip_iscoreup(struct brcmf_core *pub)
  12210. + {
  12211. + struct brcmf_core_priv *core;
  12212. +@@ -1301,6 +1320,7 @@ bool brcmf_chip_sr_capable(struct brcmf_
  12213. + {
  12214. + u32 base, addr, reg, pmu_cc3_mask = ~0;
  12215. + struct brcmf_chip_priv *chip;
  12216. ++ struct brcmf_core *pmu = brcmf_chip_get_pmu(pub);
  12217. +
  12218. + brcmf_dbg(TRACE, "Enter\n");
  12219. +
  12220. +@@ -1320,9 +1340,9 @@ bool brcmf_chip_sr_capable(struct brcmf_
  12221. + case BRCM_CC_4335_CHIP_ID:
  12222. + case BRCM_CC_4339_CHIP_ID:
  12223. + /* read PMU chipcontrol register 3 */
  12224. +- addr = CORE_CC_REG(base, chipcontrol_addr);
  12225. ++ addr = CORE_CC_REG(pmu->base, chipcontrol_addr);
  12226. + chip->ops->write32(chip->ctx, addr, 3);
  12227. +- addr = CORE_CC_REG(base, chipcontrol_data);
  12228. ++ addr = CORE_CC_REG(pmu->base, chipcontrol_data);
  12229. + reg = chip->ops->read32(chip->ctx, addr);
  12230. + return (reg & pmu_cc3_mask) != 0;
  12231. + case BRCM_CC_43430_CHIP_ID:
  12232. +@@ -1330,12 +1350,12 @@ bool brcmf_chip_sr_capable(struct brcmf_
  12233. + reg = chip->ops->read32(chip->ctx, addr);
  12234. + return reg != 0;
  12235. + default:
  12236. +- addr = CORE_CC_REG(base, pmucapabilities_ext);
  12237. ++ addr = CORE_CC_REG(pmu->base, pmucapabilities_ext);
  12238. + reg = chip->ops->read32(chip->ctx, addr);
  12239. + if ((reg & PCAPEXT_SR_SUPPORTED_MASK) == 0)
  12240. + return false;
  12241. +
  12242. +- addr = CORE_CC_REG(base, retention_ctl);
  12243. ++ addr = CORE_CC_REG(pmu->base, retention_ctl);
  12244. + reg = chip->ops->read32(chip->ctx, addr);
  12245. + return (reg & (PMU_RCTL_MACPHY_DISABLE_MASK |
  12246. + PMU_RCTL_LOGIC_DISABLE_MASK)) == 0;
  12247. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  12248. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  12249. +@@ -85,6 +85,7 @@ struct brcmf_chip *brcmf_chip_attach(voi
  12250. + void brcmf_chip_detach(struct brcmf_chip *chip);
  12251. + struct brcmf_core *brcmf_chip_get_core(struct brcmf_chip *chip, u16 coreid);
  12252. + struct brcmf_core *brcmf_chip_get_chipcommon(struct brcmf_chip *chip);
  12253. ++struct brcmf_core *brcmf_chip_get_pmu(struct brcmf_chip *pub);
  12254. + bool brcmf_chip_iscoreup(struct brcmf_core *core);
  12255. + void brcmf_chip_coredisable(struct brcmf_core *core, u32 prereset, u32 reset);
  12256. + void brcmf_chip_resetcore(struct brcmf_core *core, u32 prereset, u32 reset,
  12257. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  12258. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  12259. +@@ -3615,7 +3615,6 @@ brcmf_sdio_drivestrengthinit(struct brcm
  12260. + const struct sdiod_drive_str *str_tab = NULL;
  12261. + u32 str_mask;
  12262. + u32 str_shift;
  12263. +- u32 base;
  12264. + u32 i;
  12265. + u32 drivestrength_sel = 0;
  12266. + u32 cc_data_temp;
  12267. +@@ -3658,14 +3657,15 @@ brcmf_sdio_drivestrengthinit(struct brcm
  12268. + }
  12269. +
  12270. + if (str_tab != NULL) {
  12271. ++ struct brcmf_core *pmu = brcmf_chip_get_pmu(ci);
  12272. ++
  12273. + for (i = 0; str_tab[i].strength != 0; i++) {
  12274. + if (drivestrength >= str_tab[i].strength) {
  12275. + drivestrength_sel = str_tab[i].sel;
  12276. + break;
  12277. + }
  12278. + }
  12279. +- base = brcmf_chip_get_chipcommon(ci)->base;
  12280. +- addr = CORE_CC_REG(base, chipcontrol_addr);
  12281. ++ addr = CORE_CC_REG(pmu->base, chipcontrol_addr);
  12282. + brcmf_sdiod_regwl(sdiodev, addr, 1, NULL);
  12283. + cc_data_temp = brcmf_sdiod_regrl(sdiodev, addr, NULL);
  12284. + cc_data_temp &= ~str_mask;
  12285. +@@ -3835,8 +3835,7 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
  12286. + goto fail;
  12287. +
  12288. + /* set PMUControl so a backplane reset does PMU state reload */
  12289. +- reg_addr = CORE_CC_REG(brcmf_chip_get_chipcommon(bus->ci)->base,
  12290. +- pmucontrol);
  12291. ++ reg_addr = CORE_CC_REG(brcmf_chip_get_pmu(bus->ci)->base, pmucontrol);
  12292. + reg_val = brcmf_sdiod_regrl(bus->sdiodev, reg_addr, &err);
  12293. + if (err)
  12294. + goto fail;
  12295. diff --git a/package/kernel/mac80211/patches/323-0005-brcmfmac-add-support-for-14e4-4365-PCI-ID-with-BCM43.patch b/package/kernel/mac80211/patches/323-0005-brcmfmac-add-support-for-14e4-4365-PCI-ID-with-BCM43.patch
  12296. new file mode 100644
  12297. index 0000000..35887fc
  12298. --- /dev/null
  12299. +++ b/package/kernel/mac80211/patches/323-0005-brcmfmac-add-support-for-14e4-4365-PCI-ID-with-BCM43.patch
  12300. @@ -0,0 +1,38 @@
  12301. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  12302. +Date: Tue, 26 Jan 2016 17:57:05 +0100
  12303. +Subject: [PATCH] brcmfmac: add support for 14e4:4365 PCI ID with BCM4366
  12304. + chipset
  12305. +MIME-Version: 1.0
  12306. +Content-Type: text/plain; charset=UTF-8
  12307. +Content-Transfer-Encoding: 8bit
  12308. +
  12309. +On Broadcom ARM routers BCM4366 cards are available with 14e4:4365 ID.
  12310. +Unfortunately this ID was already used by Broadcom for cards with
  12311. +BCM43142, a totally different chipset requiring SoftMAC driver. To avoid
  12312. +a conflict between brcmfmac and bcma use more specific ID entry with
  12313. +subvendor and subdevice specified.
  12314. +
  12315. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  12316. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12317. +---
  12318. +
  12319. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  12320. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  12321. +@@ -1951,6 +1951,9 @@ static const struct dev_pm_ops brcmf_pci
  12322. +
  12323. + #define BRCMF_PCIE_DEVICE(dev_id) { BRCM_PCIE_VENDOR_ID_BROADCOM, dev_id,\
  12324. + PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 }
  12325. ++#define BRCMF_PCIE_DEVICE_SUB(dev_id, subvend, subdev) { \
  12326. ++ BRCM_PCIE_VENDOR_ID_BROADCOM, dev_id,\
  12327. ++ subvend, subdev, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 }
  12328. +
  12329. + static struct pci_device_id brcmf_pcie_devid_table[] = {
  12330. + BRCMF_PCIE_DEVICE(BRCM_PCIE_4350_DEVICE_ID),
  12331. +@@ -1966,6 +1969,7 @@ static struct pci_device_id brcmf_pcie_d
  12332. + BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_DEVICE_ID),
  12333. + BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_2G_DEVICE_ID),
  12334. + BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_5G_DEVICE_ID),
  12335. ++ BRCMF_PCIE_DEVICE_SUB(0x4365, BRCM_PCIE_VENDOR_ID_BROADCOM, 0x4365),
  12336. + BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_DEVICE_ID),
  12337. + BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_2G_DEVICE_ID),
  12338. + BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_5G_DEVICE_ID),
  12339. 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
  12340. deleted file mode 100644
  12341. index 246bb9d..0000000
  12342. --- a/package/kernel/mac80211/patches/323-ath9k-add-multi_read-to-be-compatible-with-ath9k_htc.patch
  12343. +++ /dev/null
  12344. @@ -1,35 +0,0 @@
  12345. -From: Oleksij Rempel <linux@rempel-privat.de>
  12346. -Date: Sun, 22 Mar 2015 19:29:50 +0100
  12347. -Subject: [PATCH] ath9k: add multi_read to be compatible with ath9k_htc
  12348. -
  12349. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12350. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12351. ----
  12352. -
  12353. ---- a/drivers/net/wireless/ath/ath9k/init.c
  12354. -+++ b/drivers/net/wireless/ath/ath9k/init.c
  12355. -@@ -141,6 +141,16 @@ static unsigned int ath9k_ioread32(void
  12356. - return val;
  12357. - }
  12358. -
  12359. -+static void ath9k_multi_ioread32(void *hw_priv, u32 *addr,
  12360. -+ u32 *val, u16 count)
  12361. -+{
  12362. -+ int i;
  12363. -+
  12364. -+ for (i = 0; i < count; i++)
  12365. -+ val[i] = ath9k_ioread32(hw_priv, addr[i]);
  12366. -+}
  12367. -+
  12368. -+
  12369. - static unsigned int __ath9k_reg_rmw(struct ath_softc *sc, u32 reg_offset,
  12370. - u32 set, u32 clr)
  12371. - {
  12372. -@@ -530,6 +540,7 @@ static int ath9k_init_softc(u16 devid, s
  12373. - ah->hw = sc->hw;
  12374. - ah->hw_version.devid = devid;
  12375. - ah->reg_ops.read = ath9k_ioread32;
  12376. -+ ah->reg_ops.multi_read = ath9k_multi_ioread32;
  12377. - ah->reg_ops.write = ath9k_iowrite32;
  12378. - ah->reg_ops.rmw = ath9k_reg_rmw;
  12379. - pCap = &ah->caps;
  12380. 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
  12381. deleted file mode 100644
  12382. index 2eda1c9..0000000
  12383. --- a/package/kernel/mac80211/patches/324-ath9k-add-new-function-ath9k_hw_read_array.patch
  12384. +++ /dev/null
  12385. @@ -1,69 +0,0 @@
  12386. -From: Oleksij Rempel <linux@rempel-privat.de>
  12387. -Date: Sun, 22 Mar 2015 19:29:51 +0100
  12388. -Subject: [PATCH] ath9k: add new function ath9k_hw_read_array
  12389. -
  12390. -REG_READ generate most overhead on usb bus. It send and read micro packages
  12391. -and reduce usb bandwidth. To reduce this overhead we should read in batches.
  12392. -
  12393. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12394. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12395. ----
  12396. -
  12397. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  12398. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  12399. -@@ -121,6 +121,36 @@ void ath9k_hw_write_array(struct ath_hw
  12400. - REGWRITE_BUFFER_FLUSH(ah);
  12401. - }
  12402. -
  12403. -+void ath9k_hw_read_array(struct ath_hw *ah, u32 array[][2], int size)
  12404. -+{
  12405. -+ u32 *tmp_reg_list, *tmp_data;
  12406. -+ int i;
  12407. -+
  12408. -+ tmp_reg_list = kmalloc(size * sizeof(u32), GFP_KERNEL);
  12409. -+ if (!tmp_reg_list) {
  12410. -+ dev_err(ah->dev, "%s: tmp_reg_list: alloc filed\n", __func__);
  12411. -+ return;
  12412. -+ }
  12413. -+
  12414. -+ tmp_data = kmalloc(size * sizeof(u32), GFP_KERNEL);
  12415. -+ if (!tmp_data) {
  12416. -+ dev_err(ah->dev, "%s tmp_data: alloc filed\n", __func__);
  12417. -+ goto error_tmp_data;
  12418. -+ }
  12419. -+
  12420. -+ for (i = 0; i < size; i++)
  12421. -+ tmp_reg_list[i] = array[i][0];
  12422. -+
  12423. -+ REG_READ_MULTI(ah, tmp_reg_list, tmp_data, size);
  12424. -+
  12425. -+ for (i = 0; i < size; i++)
  12426. -+ array[i][1] = tmp_data[i];
  12427. -+
  12428. -+ kfree(tmp_data);
  12429. -+error_tmp_data:
  12430. -+ kfree(tmp_reg_list);
  12431. -+}
  12432. -+
  12433. - u32 ath9k_hw_reverse_bits(u32 val, u32 n)
  12434. - {
  12435. - u32 retval;
  12436. ---- a/drivers/net/wireless/ath/ath9k/hw.h
  12437. -+++ b/drivers/net/wireless/ath/ath9k/hw.h
  12438. -@@ -138,6 +138,8 @@
  12439. -
  12440. - #define REG_WRITE_ARRAY(iniarray, column, regWr) \
  12441. - ath9k_hw_write_array(ah, iniarray, column, &(regWr))
  12442. -+#define REG_READ_ARRAY(ah, array, size) \
  12443. -+ ath9k_hw_read_array(ah, array, size)
  12444. -
  12445. - #define AR_GPIO_OUTPUT_MUX_AS_OUTPUT 0
  12446. - #define AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED 1
  12447. -@@ -1020,6 +1022,7 @@ void ath9k_hw_synth_delay(struct ath_hw
  12448. - bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout);
  12449. - void ath9k_hw_write_array(struct ath_hw *ah, const struct ar5416IniArray *array,
  12450. - int column, unsigned int *writecnt);
  12451. -+void ath9k_hw_read_array(struct ath_hw *ah, u32 array[][2], int size);
  12452. - u32 ath9k_hw_reverse_bits(u32 val, u32 n);
  12453. - u16 ath9k_hw_computetxtime(struct ath_hw *ah,
  12454. - u8 phy, int kbps,
  12455. diff --git a/package/kernel/mac80211/patches/324-brcmfmac-treat-NULL-character-in-NVRAM-as-separator.patch b/package/kernel/mac80211/patches/324-brcmfmac-treat-NULL-character-in-NVRAM-as-separator.patch
  12456. new file mode 100644
  12457. index 0000000..6ce60f1
  12458. --- /dev/null
  12459. +++ b/package/kernel/mac80211/patches/324-brcmfmac-treat-NULL-character-in-NVRAM-as-separator.patch
  12460. @@ -0,0 +1,32 @@
  12461. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  12462. +Date: Sun, 31 Jan 2016 12:14:34 +0100
  12463. +Subject: [PATCH] brcmfmac: treat NULL character in NVRAM as separator
  12464. +MIME-Version: 1.0
  12465. +Content-Type: text/plain; charset=UTF-8
  12466. +Content-Transfer-Encoding: 8bit
  12467. +
  12468. +Platform NVRAM (stored on a flash partition) has entries separated by a
  12469. +NULL (\0) char. Our parsing code switches from VALUE state to IDLE
  12470. +whenever it meets a NULL (\0). When that happens our IDLE handler should
  12471. +simply consume it and analyze whatever is placed ahead.
  12472. +
  12473. +This fixes harmless warnings spamming debugging output:
  12474. +[ 155.165624] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=20: ignoring invalid character
  12475. +[ 155.180806] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=44: ignoring invalid character
  12476. +[ 155.195971] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=63: ignoring invalid character
  12477. +
  12478. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  12479. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12480. +---
  12481. +
  12482. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  12483. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  12484. +@@ -93,7 +93,7 @@ static enum nvram_parser_state brcmf_nvr
  12485. + c = nvp->data[nvp->pos];
  12486. + if (c == '\n')
  12487. + return COMMENT;
  12488. +- if (is_whitespace(c))
  12489. ++ if (is_whitespace(c) || c == '\0')
  12490. + goto proceed;
  12491. + if (c == '#')
  12492. + return COMMENT;
  12493. 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
  12494. deleted file mode 100644
  12495. index 4e4888f..0000000
  12496. --- a/package/kernel/mac80211/patches/325-ath9k-ar9271_hw_pa_cal-use-REG_READ_ARRAY.patch
  12497. +++ /dev/null
  12498. @@ -1,24 +0,0 @@
  12499. -From: Oleksij Rempel <linux@rempel-privat.de>
  12500. -Date: Sun, 22 Mar 2015 19:29:52 +0100
  12501. -Subject: [PATCH] ath9k: ar9271_hw_pa_cal: use REG_READ_ARRAY
  12502. -
  12503. -insted of reading each register separatly
  12504. -and waste 4ms on each operation, we can
  12505. -use one shot read.
  12506. -
  12507. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12508. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12509. ----
  12510. -
  12511. ---- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  12512. -+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  12513. -@@ -440,8 +440,7 @@ static void ar9271_hw_pa_cal(struct ath_
  12514. - { AR9285_AN_RF2G3, 0 },
  12515. - };
  12516. -
  12517. -- for (i = 0; i < ARRAY_SIZE(regList); i++)
  12518. -- regList[i][1] = REG_READ(ah, regList[i][0]);
  12519. -+ REG_READ_ARRAY(ah, regList, ARRAY_SIZE(regList));
  12520. -
  12521. - ENABLE_REG_RMW_BUFFER(ah);
  12522. - /* 7834, b1=0 */
  12523. diff --git a/package/kernel/mac80211/patches/325-brcmfmac-sdio-Increase-the-default-timeouts-a-bit.patch b/package/kernel/mac80211/patches/325-brcmfmac-sdio-Increase-the-default-timeouts-a-bit.patch
  12524. new file mode 100644
  12525. index 0000000..012dea1
  12526. --- /dev/null
  12527. +++ b/package/kernel/mac80211/patches/325-brcmfmac-sdio-Increase-the-default-timeouts-a-bit.patch
  12528. @@ -0,0 +1,41 @@
  12529. +From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
  12530. +Date: Mon, 25 Jan 2016 11:47:29 +0100
  12531. +Subject: [PATCH] brcmfmac: sdio: Increase the default timeouts a bit
  12532. +
  12533. +On a Radxa Rock2 board with a Ampak AP6335 (Broadcom 4339 core) it seems
  12534. +the card responds very quickly most of the time, unfortunately during
  12535. +initialisation it sometimes seems to take just a bit over 2 seconds to
  12536. +respond.
  12537. +
  12538. +This results intialization failing with message like:
  12539. + brcmf_c_preinit_dcmds: Retreiving cur_etheraddr failed, -52
  12540. + brcmf_bus_start: failed: -52
  12541. + brcmf_sdio_firmware_callback: dongle is not responding
  12542. +
  12543. +Increasing the timeout to allow for a bit more headroom allows the
  12544. +card to initialize reliably.
  12545. +
  12546. +A quick search online after diagnosing/fixing this showed that Google
  12547. +has a similar patch in their ChromeOS tree, so this doesn't seem
  12548. +specific to the board I'm using.
  12549. +
  12550. +Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
  12551. +Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
  12552. +Acked-by: Arend van Spriel <arend@broadcom.com>
  12553. +Reviewed-by: Douglas Anderson <dianders@chromium.org>
  12554. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12555. +---
  12556. +
  12557. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  12558. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  12559. +@@ -45,8 +45,8 @@
  12560. + #include "chip.h"
  12561. + #include "firmware.h"
  12562. +
  12563. +-#define DCMD_RESP_TIMEOUT msecs_to_jiffies(2000)
  12564. +-#define CTL_DONE_TIMEOUT msecs_to_jiffies(2000)
  12565. ++#define DCMD_RESP_TIMEOUT msecs_to_jiffies(2500)
  12566. ++#define CTL_DONE_TIMEOUT msecs_to_jiffies(2500)
  12567. +
  12568. + #ifdef DEBUG
  12569. +
  12570. diff --git a/package/kernel/mac80211/patches/326-ath9k-make-NF-load-complete-quickly-and-reliably.patch b/package/kernel/mac80211/patches/326-ath9k-make-NF-load-complete-quickly-and-reliably.patch
  12571. new file mode 100644
  12572. index 0000000..71f7a40
  12573. --- /dev/null
  12574. +++ b/package/kernel/mac80211/patches/326-ath9k-make-NF-load-complete-quickly-and-reliably.patch
  12575. @@ -0,0 +1,87 @@
  12576. +From: Miaoqing Pan <miaoqing@codeaurora.org>
  12577. +Date: Fri, 5 Feb 2016 09:45:50 +0800
  12578. +Subject: [PATCH] ath9k: make NF load complete quickly and reliably
  12579. +
  12580. +Make NF load complete quickly and reliably. NF load execution
  12581. +is delayed by HW to end of frame if frame Rx or Tx is ongoing.
  12582. +Increasing timeout to max frame duration. If NF cal is ongoing
  12583. +before NF load, stop it before load, and restart it afterwards.
  12584. +
  12585. +Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  12586. +---
  12587. +
  12588. +--- a/drivers/net/wireless/ath/ath9k/calib.c
  12589. ++++ b/drivers/net/wireless/ath/ath9k/calib.c
  12590. +@@ -241,6 +241,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  12591. + u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask;
  12592. + struct ath_common *common = ath9k_hw_common(ah);
  12593. + s16 default_nf = ath9k_hw_get_default_nf(ah, chan);
  12594. ++ u32 bb_agc_ctl = REG_READ(ah, AR_PHY_AGC_CONTROL);
  12595. +
  12596. + if (ah->caldata)
  12597. + h = ah->caldata->nfCalHist;
  12598. +@@ -264,6 +265,16 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  12599. + }
  12600. +
  12601. + /*
  12602. ++ * stop NF cal if ongoing to ensure NF load completes immediately
  12603. ++ * (or after end rx/tx frame if ongoing)
  12604. ++ */
  12605. ++ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NF) {
  12606. ++ REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
  12607. ++ REG_RMW_BUFFER_FLUSH(ah);
  12608. ++ ENABLE_REG_RMW_BUFFER(ah);
  12609. ++ }
  12610. ++
  12611. ++ /*
  12612. + * Load software filtered NF value into baseband internal minCCApwr
  12613. + * variable.
  12614. + */
  12615. +@@ -276,18 +287,33 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  12616. +
  12617. + /*
  12618. + * Wait for load to complete, should be fast, a few 10s of us.
  12619. +- * The max delay was changed from an original 250us to 10000us
  12620. +- * since 250us often results in NF load timeout and causes deaf
  12621. +- * condition during stress testing 12/12/2009
  12622. ++ * The max delay was changed from an original 250us to 22.2 msec.
  12623. ++ * This would increase timeout to the longest possible frame
  12624. ++ * (11n max length 22.1 msec)
  12625. + */
  12626. +- for (j = 0; j < 10000; j++) {
  12627. ++ for (j = 0; j < 22200; j++) {
  12628. + if ((REG_READ(ah, AR_PHY_AGC_CONTROL) &
  12629. +- AR_PHY_AGC_CONTROL_NF) == 0)
  12630. ++ AR_PHY_AGC_CONTROL_NF) == 0)
  12631. + break;
  12632. + udelay(10);
  12633. + }
  12634. +
  12635. + /*
  12636. ++ * Restart NF so it can continue.
  12637. ++ */
  12638. ++ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NF) {
  12639. ++ ENABLE_REG_RMW_BUFFER(ah);
  12640. ++ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_ENABLE_NF)
  12641. ++ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
  12642. ++ AR_PHY_AGC_CONTROL_ENABLE_NF);
  12643. ++ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NO_UPDATE_NF)
  12644. ++ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
  12645. ++ AR_PHY_AGC_CONTROL_NO_UPDATE_NF);
  12646. ++ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
  12647. ++ REG_RMW_BUFFER_FLUSH(ah);
  12648. ++ }
  12649. ++
  12650. ++ /*
  12651. + * We timed out waiting for the noisefloor to load, probably due to an
  12652. + * in-progress rx. Simply return here and allow the load plenty of time
  12653. + * to complete before the next calibration interval. We need to avoid
  12654. +@@ -296,7 +322,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  12655. + * here, the baseband nf cal will just be capped by our present
  12656. + * noisefloor until the next calibration timer.
  12657. + */
  12658. +- if (j == 10000) {
  12659. ++ if (j == 22200) {
  12660. + ath_dbg(common, ANY,
  12661. + "Timeout while waiting for nf to load: AR_PHY_AGC_CONTROL=0x%x\n",
  12662. + REG_READ(ah, AR_PHY_AGC_CONTROL));
  12663. 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
  12664. deleted file mode 100644
  12665. index a22cd1d..0000000
  12666. --- a/package/kernel/mac80211/patches/326-ath9k-use-one-shot-read-in-ath9k_hw_update_mibstats.patch
  12667. +++ /dev/null
  12668. @@ -1,39 +0,0 @@
  12669. -From: Oleksij Rempel <linux@rempel-privat.de>
  12670. -Date: Sun, 22 Mar 2015 19:29:53 +0100
  12671. -Subject: [PATCH] ath9k: use one shot read in ath9k_hw_update_mibstats
  12672. -
  12673. -this will reduce some overhead on usb bus.
  12674. -
  12675. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12676. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12677. ----
  12678. -
  12679. ---- a/drivers/net/wireless/ath/ath9k/ani.c
  12680. -+++ b/drivers/net/wireless/ath/ath9k/ani.c
  12681. -@@ -107,11 +107,21 @@ static const struct ani_cck_level_entry
  12682. - static void ath9k_hw_update_mibstats(struct ath_hw *ah,
  12683. - struct ath9k_mib_stats *stats)
  12684. - {
  12685. -- stats->ackrcv_bad += REG_READ(ah, AR_ACK_FAIL);
  12686. -- stats->rts_bad += REG_READ(ah, AR_RTS_FAIL);
  12687. -- stats->fcs_bad += REG_READ(ah, AR_FCS_FAIL);
  12688. -- stats->rts_good += REG_READ(ah, AR_RTS_OK);
  12689. -- stats->beacons += REG_READ(ah, AR_BEACON_CNT);
  12690. -+ u32 addr[5] = {AR_RTS_OK, AR_RTS_FAIL, AR_ACK_FAIL,
  12691. -+ AR_FCS_FAIL, AR_BEACON_CNT};
  12692. -+ u32 data[5];
  12693. -+
  12694. -+ REG_READ_MULTI(ah, &addr[0], &data[0], 5);
  12695. -+ /* AR_RTS_OK */
  12696. -+ stats->rts_good += data[0];
  12697. -+ /* AR_RTS_FAIL */
  12698. -+ stats->rts_bad += data[1];
  12699. -+ /* AR_ACK_FAIL */
  12700. -+ stats->ackrcv_bad += data[2];
  12701. -+ /* AR_FCS_FAIL */
  12702. -+ stats->fcs_bad += data[3];
  12703. -+ /* AR_BEACON_CNT */
  12704. -+ stats->beacons += data[4];
  12705. - }
  12706. -
  12707. - static void ath9k_ani_restart(struct ath_hw *ah)
  12708. 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
  12709. deleted file mode 100644
  12710. index e5a362f..0000000
  12711. --- a/package/kernel/mac80211/patches/327-ath9k-ath9k_hw_loadnf-use-REG_RMW.patch
  12712. +++ /dev/null
  12713. @@ -1,71 +0,0 @@
  12714. -From: Oleksij Rempel <linux@rempel-privat.de>
  12715. -Date: Sun, 22 Mar 2015 19:29:54 +0100
  12716. -Subject: [PATCH] ath9k: ath9k_hw_loadnf: use REG_RMW
  12717. -
  12718. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12719. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12720. ----
  12721. -
  12722. ---- a/drivers/net/wireless/ath/ath9k/calib.c
  12723. -+++ b/drivers/net/wireless/ath/ath9k/calib.c
  12724. -@@ -238,7 +238,6 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  12725. - {
  12726. - struct ath9k_nfcal_hist *h = NULL;
  12727. - unsigned i, j;
  12728. -- int32_t val;
  12729. - u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask;
  12730. - struct ath_common *common = ath9k_hw_common(ah);
  12731. - s16 default_nf = ath9k_hw_get_default_nf(ah, chan);
  12732. -@@ -246,6 +245,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  12733. - if (ah->caldata)
  12734. - h = ah->caldata->nfCalHist;
  12735. -
  12736. -+ ENABLE_REG_RMW_BUFFER(ah);
  12737. - for (i = 0; i < NUM_NF_READINGS; i++) {
  12738. - if (chainmask & (1 << i)) {
  12739. - s16 nfval;
  12740. -@@ -258,10 +258,8 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  12741. - else
  12742. - nfval = default_nf;
  12743. -
  12744. -- val = REG_READ(ah, ah->nf_regs[i]);
  12745. -- val &= 0xFFFFFE00;
  12746. -- val |= (((u32) nfval << 1) & 0x1ff);
  12747. -- REG_WRITE(ah, ah->nf_regs[i], val);
  12748. -+ REG_RMW(ah, ah->nf_regs[i],
  12749. -+ (((u32) nfval << 1) & 0x1ff), 0x1ff);
  12750. - }
  12751. - }
  12752. -
  12753. -@@ -274,6 +272,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  12754. - REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL,
  12755. - AR_PHY_AGC_CONTROL_NO_UPDATE_NF);
  12756. - REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
  12757. -+ REG_RMW_BUFFER_FLUSH(ah);
  12758. -
  12759. - /*
  12760. - * Wait for load to complete, should be fast, a few 10s of us.
  12761. -@@ -309,19 +308,17 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  12762. - * by the median we just loaded. This will be initial (and max) value
  12763. - * of next noise floor calibration the baseband does.
  12764. - */
  12765. -- ENABLE_REGWRITE_BUFFER(ah);
  12766. -+ ENABLE_REG_RMW_BUFFER(ah);
  12767. - for (i = 0; i < NUM_NF_READINGS; i++) {
  12768. - if (chainmask & (1 << i)) {
  12769. - if ((i >= AR5416_MAX_CHAINS) && !IS_CHAN_HT40(chan))
  12770. - continue;
  12771. -
  12772. -- val = REG_READ(ah, ah->nf_regs[i]);
  12773. -- val &= 0xFFFFFE00;
  12774. -- val |= (((u32) (-50) << 1) & 0x1ff);
  12775. -- REG_WRITE(ah, ah->nf_regs[i], val);
  12776. -+ REG_RMW(ah, ah->nf_regs[i],
  12777. -+ (((u32) (-50) << 1) & 0x1ff), 0x1ff);
  12778. - }
  12779. - }
  12780. -- REGWRITE_BUFFER_FLUSH(ah);
  12781. -+ REG_RMW_BUFFER_FLUSH(ah);
  12782. -
  12783. - return 0;
  12784. - }
  12785. diff --git a/package/kernel/mac80211/patches/327-mac80211-Remove-MPP-table-entries-with-MPath.patch b/package/kernel/mac80211/patches/327-mac80211-Remove-MPP-table-entries-with-MPath.patch
  12786. new file mode 100644
  12787. index 0000000..f7f9df9
  12788. --- /dev/null
  12789. +++ b/package/kernel/mac80211/patches/327-mac80211-Remove-MPP-table-entries-with-MPath.patch
  12790. @@ -0,0 +1,54 @@
  12791. +From: Henning Rogge <hrogge@gmail.com>
  12792. +Date: Wed, 3 Feb 2016 13:58:36 +0100
  12793. +Subject: [PATCH] mac80211: Remove MPP table entries with MPath
  12794. +
  12795. +Make the mesh_path_del() function remove all mpp table entries
  12796. +that are proxied by the removed mesh path.
  12797. +
  12798. +Acked-by: Bob Copeland <me@bobcopeland.com>
  12799. +Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
  12800. +Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  12801. +---
  12802. +
  12803. +--- a/net/mac80211/mesh_pathtbl.c
  12804. ++++ b/net/mac80211/mesh_pathtbl.c
  12805. +@@ -835,6 +835,29 @@ void mesh_path_flush_by_nexthop(struct s
  12806. + rcu_read_unlock();
  12807. + }
  12808. +
  12809. ++static void mpp_flush_by_proxy(struct ieee80211_sub_if_data *sdata,
  12810. ++ const u8 *proxy)
  12811. ++{
  12812. ++ struct mesh_table *tbl;
  12813. ++ struct mesh_path *mpp;
  12814. ++ struct mpath_node *node;
  12815. ++ int i;
  12816. ++
  12817. ++ rcu_read_lock();
  12818. ++ read_lock_bh(&pathtbl_resize_lock);
  12819. ++ tbl = resize_dereference_mpp_paths();
  12820. ++ for_each_mesh_entry(tbl, node, i) {
  12821. ++ mpp = node->mpath;
  12822. ++ if (ether_addr_equal(mpp->mpp, proxy)) {
  12823. ++ spin_lock(&tbl->hashwlock[i]);
  12824. ++ __mesh_path_del(tbl, node);
  12825. ++ spin_unlock(&tbl->hashwlock[i]);
  12826. ++ }
  12827. ++ }
  12828. ++ read_unlock_bh(&pathtbl_resize_lock);
  12829. ++ rcu_read_unlock();
  12830. ++}
  12831. ++
  12832. + static void table_flush_by_iface(struct mesh_table *tbl,
  12833. + struct ieee80211_sub_if_data *sdata)
  12834. + {
  12835. +@@ -892,6 +915,9 @@ int mesh_path_del(struct ieee80211_sub_i
  12836. + int hash_idx;
  12837. + int err = 0;
  12838. +
  12839. ++ /* flush relevant mpp entries first */
  12840. ++ mpp_flush_by_proxy(sdata, addr);
  12841. ++
  12842. + read_lock_bh(&pathtbl_resize_lock);
  12843. + tbl = resize_dereference_mesh_paths();
  12844. + hash_idx = mesh_table_hash(addr, sdata, tbl);
  12845. 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
  12846. deleted file mode 100644
  12847. index 01c8011..0000000
  12848. --- a/package/kernel/mac80211/patches/328-ath9k-write-buffer-related-optimisation-in-ar5008_hw.patch
  12849. +++ /dev/null
  12850. @@ -1,27 +0,0 @@
  12851. -From: Oleksij Rempel <linux@rempel-privat.de>
  12852. -Date: Sun, 22 Mar 2015 19:29:55 +0100
  12853. -Subject: [PATCH] ath9k: write buffer related optimisation in
  12854. - ar5008_hw_set_channel_regs
  12855. -
  12856. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12857. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12858. ----
  12859. -
  12860. ---- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  12861. -+++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  12862. -@@ -681,12 +681,13 @@ static void ar5008_hw_set_channel_regs(s
  12863. - phymode |= AR_PHY_FC_DYN2040_PRI_CH;
  12864. -
  12865. - }
  12866. -+ ENABLE_REGWRITE_BUFFER(ah);
  12867. - REG_WRITE(ah, AR_PHY_TURBO, phymode);
  12868. -
  12869. -+ /* This function do only REG_WRITE, so
  12870. -+ * we can include it to REGWRITE_BUFFER. */
  12871. - ath9k_hw_set11nmac2040(ah, chan);
  12872. -
  12873. -- ENABLE_REGWRITE_BUFFER(ah);
  12874. --
  12875. - REG_WRITE(ah, AR_GTXTO, 25 << AR_GTXTO_TIMEOUT_LIMIT_S);
  12876. - REG_WRITE(ah, AR_CST, 0xF << AR_CST_TIMEOUT_LIMIT_S);
  12877. -
  12878. diff --git a/package/kernel/mac80211/patches/328-mac80211-let-unused-MPP-table-entries-timeout.patch b/package/kernel/mac80211/patches/328-mac80211-let-unused-MPP-table-entries-timeout.patch
  12879. new file mode 100644
  12880. index 0000000..740993c
  12881. --- /dev/null
  12882. +++ b/package/kernel/mac80211/patches/328-mac80211-let-unused-MPP-table-entries-timeout.patch
  12883. @@ -0,0 +1,104 @@
  12884. +From: Henning Rogge <hrogge@gmail.com>
  12885. +Date: Wed, 3 Feb 2016 13:58:37 +0100
  12886. +Subject: [PATCH] mac80211: let unused MPP table entries timeout
  12887. +
  12888. +Remember the last time when a mpp table entry is used for
  12889. +rx or tx and remove them after MESH_PATH_EXPIRE time.
  12890. +
  12891. +Acked-by: Bob Copeland <me@bobcopeland.com>
  12892. +Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
  12893. +Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  12894. +---
  12895. +
  12896. +--- a/net/mac80211/mesh_pathtbl.c
  12897. ++++ b/net/mac80211/mesh_pathtbl.c
  12898. +@@ -942,6 +942,46 @@ enddel:
  12899. + }
  12900. +
  12901. + /**
  12902. ++ * mpp_path_del - delete a mesh proxy path from the table
  12903. ++ *
  12904. ++ * @addr: addr address (ETH_ALEN length)
  12905. ++ * @sdata: local subif
  12906. ++ *
  12907. ++ * Returns: 0 if successful
  12908. ++ */
  12909. ++static int mpp_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  12910. ++{
  12911. ++ struct mesh_table *tbl;
  12912. ++ struct mesh_path *mpath;
  12913. ++ struct mpath_node *node;
  12914. ++ struct hlist_head *bucket;
  12915. ++ int hash_idx;
  12916. ++ int err = 0;
  12917. ++
  12918. ++ read_lock_bh(&pathtbl_resize_lock);
  12919. ++ tbl = resize_dereference_mpp_paths();
  12920. ++ hash_idx = mesh_table_hash(addr, sdata, tbl);
  12921. ++ bucket = &tbl->hash_buckets[hash_idx];
  12922. ++
  12923. ++ spin_lock(&tbl->hashwlock[hash_idx]);
  12924. ++ hlist_for_each_entry(node, bucket, list) {
  12925. ++ mpath = node->mpath;
  12926. ++ if (mpath->sdata == sdata &&
  12927. ++ ether_addr_equal(addr, mpath->dst)) {
  12928. ++ __mesh_path_del(tbl, node);
  12929. ++ goto enddel;
  12930. ++ }
  12931. ++ }
  12932. ++
  12933. ++ err = -ENXIO;
  12934. ++enddel:
  12935. ++ mesh_paths_generation++;
  12936. ++ spin_unlock(&tbl->hashwlock[hash_idx]);
  12937. ++ read_unlock_bh(&pathtbl_resize_lock);
  12938. ++ return err;
  12939. ++}
  12940. ++
  12941. ++/**
  12942. + * mesh_path_tx_pending - sends pending frames in a mesh path queue
  12943. + *
  12944. + * @mpath: mesh path to activate
  12945. +@@ -1157,6 +1197,17 @@ void mesh_path_expire(struct ieee80211_s
  12946. + time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE))
  12947. + mesh_path_del(mpath->sdata, mpath->dst);
  12948. + }
  12949. ++
  12950. ++ tbl = rcu_dereference(mpp_paths);
  12951. ++ for_each_mesh_entry(tbl, node, i) {
  12952. ++ if (node->mpath->sdata != sdata)
  12953. ++ continue;
  12954. ++ mpath = node->mpath;
  12955. ++ if ((!(mpath->flags & MESH_PATH_FIXED)) &&
  12956. ++ time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE))
  12957. ++ mpp_path_del(mpath->sdata, mpath->dst);
  12958. ++ }
  12959. ++
  12960. + rcu_read_unlock();
  12961. + }
  12962. +
  12963. +--- a/net/mac80211/rx.c
  12964. ++++ b/net/mac80211/rx.c
  12965. +@@ -2291,6 +2291,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  12966. + spin_lock_bh(&mppath->state_lock);
  12967. + if (!ether_addr_equal(mppath->mpp, mpp_addr))
  12968. + memcpy(mppath->mpp, mpp_addr, ETH_ALEN);
  12969. ++ mppath->exp_time = jiffies;
  12970. + spin_unlock_bh(&mppath->state_lock);
  12971. + }
  12972. + rcu_read_unlock();
  12973. +--- a/net/mac80211/tx.c
  12974. ++++ b/net/mac80211/tx.c
  12975. +@@ -2171,8 +2171,11 @@ static struct sk_buff *ieee80211_build_h
  12976. + mpp_lookup = true;
  12977. + }
  12978. +
  12979. +- if (mpp_lookup)
  12980. ++ if (mpp_lookup) {
  12981. + mppath = mpp_path_lookup(sdata, skb->data);
  12982. ++ if (mppath)
  12983. ++ mppath->exp_time = jiffies;
  12984. ++ }
  12985. +
  12986. + if (mppath && mpath)
  12987. + mesh_path_del(mpath->sdata, mpath->dst);
  12988. 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
  12989. deleted file mode 100644
  12990. index e5219f2..0000000
  12991. --- a/package/kernel/mac80211/patches/329-ath9k-ath9k_hw_set_4k_power_cal_tabl-use-rmw-buffer.patch
  12992. +++ /dev/null
  12993. @@ -1,26 +0,0 @@
  12994. -From: Oleksij Rempel <linux@rempel-privat.de>
  12995. -Date: Sun, 22 Mar 2015 19:29:56 +0100
  12996. -Subject: [PATCH] ath9k: ath9k_hw_set_4k_power_cal_tabl: use rmw buffer
  12997. -
  12998. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12999. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13000. ----
  13001. -
  13002. ---- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  13003. -+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  13004. -@@ -389,6 +389,7 @@ static void ath9k_hw_set_4k_power_cal_ta
  13005. - }
  13006. - }
  13007. -
  13008. -+ ENABLE_REG_RMW_BUFFER(ah);
  13009. - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_NUM_PD_GAIN,
  13010. - (numXpdGain - 1) & 0x3);
  13011. - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_1,
  13012. -@@ -396,6 +397,7 @@ static void ath9k_hw_set_4k_power_cal_ta
  13013. - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_2,
  13014. - xpdGainValues[1]);
  13015. - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_3, 0);
  13016. -+ REG_RMW_BUFFER_FLUSH(ah);
  13017. -
  13018. - for (i = 0; i < AR5416_EEP4K_MAX_CHAINS; i++) {
  13019. - regChainOffset = i * 0x1000;
  13020. diff --git a/package/kernel/mac80211/patches/329-mac80211-Unify-mesh-and-mpp-path-removal-function.patch b/package/kernel/mac80211/patches/329-mac80211-Unify-mesh-and-mpp-path-removal-function.patch
  13021. new file mode 100644
  13022. index 0000000..0c36b1d
  13023. --- /dev/null
  13024. +++ b/package/kernel/mac80211/patches/329-mac80211-Unify-mesh-and-mpp-path-removal-function.patch
  13025. @@ -0,0 +1,143 @@
  13026. +From: Henning Rogge <hrogge@gmail.com>
  13027. +Date: Wed, 3 Feb 2016 13:58:38 +0100
  13028. +Subject: [PATCH] mac80211: Unify mesh and mpp path removal function
  13029. +
  13030. +mpp_path_del() and mesh_path_del() are mostly the same function.
  13031. +Move common code into a new static function.
  13032. +
  13033. +Acked-by: Bob Copeland <me@bobcopeland.com>
  13034. +Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
  13035. +Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  13036. +---
  13037. +
  13038. +--- a/net/mac80211/mesh_pathtbl.c
  13039. ++++ b/net/mac80211/mesh_pathtbl.c
  13040. +@@ -55,16 +55,21 @@ int mpp_paths_generation;
  13041. + static DEFINE_RWLOCK(pathtbl_resize_lock);
  13042. +
  13043. +
  13044. ++static inline struct mesh_table *resize_dereference_paths(
  13045. ++ struct mesh_table __rcu *table)
  13046. ++{
  13047. ++ return rcu_dereference_protected(table,
  13048. ++ lockdep_is_held(&pathtbl_resize_lock));
  13049. ++}
  13050. ++
  13051. + static inline struct mesh_table *resize_dereference_mesh_paths(void)
  13052. + {
  13053. +- return rcu_dereference_protected(mesh_paths,
  13054. +- lockdep_is_held(&pathtbl_resize_lock));
  13055. ++ return resize_dereference_paths(mesh_paths);
  13056. + }
  13057. +
  13058. + static inline struct mesh_table *resize_dereference_mpp_paths(void)
  13059. + {
  13060. +- return rcu_dereference_protected(mpp_paths,
  13061. +- lockdep_is_held(&pathtbl_resize_lock));
  13062. ++ return resize_dereference_paths(mpp_paths);
  13063. + }
  13064. +
  13065. + /*
  13066. +@@ -899,14 +904,17 @@ void mesh_path_flush_by_iface(struct iee
  13067. + }
  13068. +
  13069. + /**
  13070. +- * mesh_path_del - delete a mesh path from the table
  13071. ++ * table_path_del - delete a path from the mesh or mpp table
  13072. + *
  13073. +- * @addr: dst address (ETH_ALEN length)
  13074. ++ * @tbl: mesh or mpp path table
  13075. + * @sdata: local subif
  13076. ++ * @addr: dst address (ETH_ALEN length)
  13077. + *
  13078. + * Returns: 0 if successful
  13079. + */
  13080. +-int mesh_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  13081. ++static int table_path_del(struct mesh_table __rcu *rcu_tbl,
  13082. ++ struct ieee80211_sub_if_data *sdata,
  13083. ++ const u8 *addr)
  13084. + {
  13085. + struct mesh_table *tbl;
  13086. + struct mesh_path *mpath;
  13087. +@@ -915,11 +923,7 @@ int mesh_path_del(struct ieee80211_sub_i
  13088. + int hash_idx;
  13089. + int err = 0;
  13090. +
  13091. +- /* flush relevant mpp entries first */
  13092. +- mpp_flush_by_proxy(sdata, addr);
  13093. +-
  13094. +- read_lock_bh(&pathtbl_resize_lock);
  13095. +- tbl = resize_dereference_mesh_paths();
  13096. ++ tbl = resize_dereference_paths(rcu_tbl);
  13097. + hash_idx = mesh_table_hash(addr, sdata, tbl);
  13098. + bucket = &tbl->hash_buckets[hash_idx];
  13099. +
  13100. +@@ -935,9 +939,30 @@ int mesh_path_del(struct ieee80211_sub_i
  13101. +
  13102. + err = -ENXIO;
  13103. + enddel:
  13104. +- mesh_paths_generation++;
  13105. + spin_unlock(&tbl->hashwlock[hash_idx]);
  13106. ++ return err;
  13107. ++}
  13108. ++
  13109. ++/**
  13110. ++ * mesh_path_del - delete a mesh path from the table
  13111. ++ *
  13112. ++ * @addr: dst address (ETH_ALEN length)
  13113. ++ * @sdata: local subif
  13114. ++ *
  13115. ++ * Returns: 0 if successful
  13116. ++ */
  13117. ++int mesh_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  13118. ++{
  13119. ++ int err = 0;
  13120. ++
  13121. ++ /* flush relevant mpp entries first */
  13122. ++ mpp_flush_by_proxy(sdata, addr);
  13123. ++
  13124. ++ read_lock_bh(&pathtbl_resize_lock);
  13125. ++ err = table_path_del(mesh_paths, sdata, addr);
  13126. ++ mesh_paths_generation++;
  13127. + read_unlock_bh(&pathtbl_resize_lock);
  13128. ++
  13129. + return err;
  13130. + }
  13131. +
  13132. +@@ -951,33 +976,13 @@ enddel:
  13133. + */
  13134. + static int mpp_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  13135. + {
  13136. +- struct mesh_table *tbl;
  13137. +- struct mesh_path *mpath;
  13138. +- struct mpath_node *node;
  13139. +- struct hlist_head *bucket;
  13140. +- int hash_idx;
  13141. + int err = 0;
  13142. +
  13143. + read_lock_bh(&pathtbl_resize_lock);
  13144. +- tbl = resize_dereference_mpp_paths();
  13145. +- hash_idx = mesh_table_hash(addr, sdata, tbl);
  13146. +- bucket = &tbl->hash_buckets[hash_idx];
  13147. +-
  13148. +- spin_lock(&tbl->hashwlock[hash_idx]);
  13149. +- hlist_for_each_entry(node, bucket, list) {
  13150. +- mpath = node->mpath;
  13151. +- if (mpath->sdata == sdata &&
  13152. +- ether_addr_equal(addr, mpath->dst)) {
  13153. +- __mesh_path_del(tbl, node);
  13154. +- goto enddel;
  13155. +- }
  13156. +- }
  13157. +-
  13158. +- err = -ENXIO;
  13159. +-enddel:
  13160. +- mesh_paths_generation++;
  13161. +- spin_unlock(&tbl->hashwlock[hash_idx]);
  13162. ++ err = table_path_del(mpp_paths, sdata, addr);
  13163. ++ mpp_paths_generation++;
  13164. + read_unlock_bh(&pathtbl_resize_lock);
  13165. ++
  13166. + return err;
  13167. + }
  13168. +
  13169. 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
  13170. deleted file mode 100644
  13171. index 6ce3f40..0000000
  13172. --- a/package/kernel/mac80211/patches/330-ath9k-use-rmw-buffer-in-ath9k_hw_set_operating_mode-.patch
  13173. +++ /dev/null
  13174. @@ -1,43 +0,0 @@
  13175. -From: Oleksij Rempel <linux@rempel-privat.de>
  13176. -Date: Sun, 22 Mar 2015 19:29:57 +0100
  13177. -Subject: [PATCH] ath9k: use rmw buffer in ath9k_hw_set_operating_mode
  13178. - and ath9k_hw_reset
  13179. -
  13180. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  13181. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13182. ----
  13183. -
  13184. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  13185. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  13186. -@@ -1227,6 +1227,7 @@ static void ath9k_hw_set_operating_mode(
  13187. - u32 mask = AR_STA_ID1_STA_AP | AR_STA_ID1_ADHOC;
  13188. - u32 set = AR_STA_ID1_KSRCH_MODE;
  13189. -
  13190. -+ ENABLE_REG_RMW_BUFFER(ah);
  13191. - switch (opmode) {
  13192. - case NL80211_IFTYPE_ADHOC:
  13193. - if (!AR_SREV_9340_13(ah)) {
  13194. -@@ -1248,6 +1249,7 @@ static void ath9k_hw_set_operating_mode(
  13195. - break;
  13196. - }
  13197. - REG_RMW(ah, AR_STA_ID1, set, mask);
  13198. -+ REG_RMW_BUFFER_FLUSH(ah);
  13199. - }
  13200. -
  13201. - void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled,
  13202. -@@ -1960,6 +1962,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  13203. - if (!ath9k_hw_mci_is_enabled(ah))
  13204. - REG_WRITE(ah, AR_OBS, 8);
  13205. -
  13206. -+ ENABLE_REG_RMW_BUFFER(ah);
  13207. - if (ah->config.rx_intr_mitigation) {
  13208. - REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_LAST, ah->config.rimt_last);
  13209. - REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_FIRST, ah->config.rimt_first);
  13210. -@@ -1969,6 +1972,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  13211. - REG_RMW_FIELD(ah, AR_TIMT, AR_TIMT_LAST, 300);
  13212. - REG_RMW_FIELD(ah, AR_TIMT, AR_TIMT_FIRST, 750);
  13213. - }
  13214. -+ REG_RMW_BUFFER_FLUSH(ah);
  13215. -
  13216. - ath9k_hw_init_bb(ah, chan);
  13217. -
  13218. diff --git a/package/kernel/mac80211/patches/330-mac80211-minstrel-Change-expected-throughput-unit-ba.patch b/package/kernel/mac80211/patches/330-mac80211-minstrel-Change-expected-throughput-unit-ba.patch
  13219. new file mode 100644
  13220. index 0000000..4dc6d66
  13221. --- /dev/null
  13222. +++ b/package/kernel/mac80211/patches/330-mac80211-minstrel-Change-expected-throughput-unit-ba.patch
  13223. @@ -0,0 +1,51 @@
  13224. +From: Sven Eckelmann <sven.eckelmann@open-mesh.com>
  13225. +Date: Tue, 2 Feb 2016 08:12:26 +0100
  13226. +Subject: [PATCH] mac80211: minstrel: Change expected throughput unit back to
  13227. + Kbps
  13228. +
  13229. +The change from cur_tp to the function
  13230. +minstrel_get_tp_avg/minstrel_ht_get_tp_avg changed the unit used for the
  13231. +current throughput. For example in minstrel_ht the correct
  13232. +conversion between them would be:
  13233. +
  13234. + mrs->cur_tp / 10 == minstrel_ht_get_tp_avg(..).
  13235. +
  13236. +This factor 10 must also be included in the calculation of
  13237. +minstrel_get_expected_throughput and minstrel_ht_get_expected_throughput to
  13238. +return values with the unit [Kbps] instead of [10Kbps]. Otherwise routing
  13239. +algorithms like B.A.T.M.A.N. V will make incorrect decision based on these
  13240. +values. Its kernel based implementation expects expected_throughput always
  13241. +to have the unit [Kbps] and not sometimes [10Kbps] and sometimes [Kbps].
  13242. +
  13243. +The same requirement has iw or olsrdv2's nl80211 based statistics module
  13244. +which retrieve the same data via NL80211_STA_INFO_TX_BITRATE.
  13245. +
  13246. +Cc: stable@vger.kernel.org
  13247. +Fixes: 6a27b2c40b48 ("mac80211: restructure per-rate throughput calculation into function")
  13248. +Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  13249. +Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  13250. +---
  13251. +
  13252. +--- a/net/mac80211/rc80211_minstrel.c
  13253. ++++ b/net/mac80211/rc80211_minstrel.c
  13254. +@@ -711,7 +711,7 @@ static u32 minstrel_get_expected_through
  13255. + * computing cur_tp
  13256. + */
  13257. + tmp_mrs = &mi->r[idx].stats;
  13258. +- tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma);
  13259. ++ tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma) * 10;
  13260. + tmp_cur_tp = tmp_cur_tp * 1200 * 8 / 1024;
  13261. +
  13262. + return tmp_cur_tp;
  13263. +--- a/net/mac80211/rc80211_minstrel_ht.c
  13264. ++++ b/net/mac80211/rc80211_minstrel_ht.c
  13265. +@@ -1335,7 +1335,8 @@ static u32 minstrel_ht_get_expected_thro
  13266. + prob = mi->groups[i].rates[j].prob_ewma;
  13267. +
  13268. + /* convert tp_avg from pkt per second in kbps */
  13269. +- tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * AVG_PKT_SIZE * 8 / 1024;
  13270. ++ tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * 10;
  13271. ++ tp_avg = tp_avg * AVG_PKT_SIZE * 8 / 1024;
  13272. +
  13273. + return tp_avg;
  13274. + }
  13275. 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
  13276. deleted file mode 100644
  13277. index edd6160..0000000
  13278. --- a/package/kernel/mac80211/patches/331-ath9k-ath9k_hw_4k_set_board_values-use-rmw-buffer.patch
  13279. +++ /dev/null
  13280. @@ -1,26 +0,0 @@
  13281. -From: Oleksij Rempel <linux@rempel-privat.de>
  13282. -Date: Sun, 22 Mar 2015 19:29:58 +0100
  13283. -Subject: [PATCH] ath9k: ath9k_hw_4k_set_board_values: use rmw buffer
  13284. -
  13285. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  13286. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13287. ----
  13288. -
  13289. ---- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  13290. -+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  13291. -@@ -1082,6 +1082,7 @@ static void ath9k_hw_4k_set_board_values
  13292. - mask = BIT(0)|BIT(5)|BIT(10)|BIT(15)|BIT(20)|BIT(25);
  13293. - pwrctrl = mask * bb_desired_scale;
  13294. - clr = mask * 0x1f;
  13295. -+ ENABLE_REG_RMW_BUFFER(ah);
  13296. - REG_RMW(ah, AR_PHY_TX_PWRCTRL8, pwrctrl, clr);
  13297. - REG_RMW(ah, AR_PHY_TX_PWRCTRL10, pwrctrl, clr);
  13298. - REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL12, pwrctrl, clr);
  13299. -@@ -1096,6 +1097,7 @@ static void ath9k_hw_4k_set_board_values
  13300. - clr = mask * 0x1f;
  13301. - REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL11, pwrctrl, clr);
  13302. - REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL13, pwrctrl, clr);
  13303. -+ REG_RMW_BUFFER_FLUSH(ah);
  13304. - }
  13305. - }
  13306. -
  13307. diff --git a/package/kernel/mac80211/patches/331-brcmfmac-Increase-nr-of-supported-flowrings.patch b/package/kernel/mac80211/patches/331-brcmfmac-Increase-nr-of-supported-flowrings.patch
  13308. new file mode 100644
  13309. index 0000000..1fd016f
  13310. --- /dev/null
  13311. +++ b/package/kernel/mac80211/patches/331-brcmfmac-Increase-nr-of-supported-flowrings.patch
  13312. @@ -0,0 +1,307 @@
  13313. +From: Hante Meuleman <meuleman@broadcom.com>
  13314. +Date: Sun, 7 Feb 2016 18:08:24 +0100
  13315. +Subject: [PATCH] brcmfmac: Increase nr of supported flowrings.
  13316. +MIME-Version: 1.0
  13317. +Content-Type: text/plain; charset=UTF-8
  13318. +Content-Transfer-Encoding: 8bit
  13319. +
  13320. +New generation devices have firmware which has more than 256 flowrings.
  13321. +E.g. following debugging message comes from 14e4:4365 BCM4366:
  13322. +[ 194.606245] brcmfmac: brcmf_pcie_init_ringbuffers Nr of flowrings is 264
  13323. +
  13324. +At various code places (related to flowrings) we were using u8 which
  13325. +could lead to storing wrong number or infinite loops when indexing with
  13326. +this type. This issue was quite easy to spot in brcmf_flowring_detach
  13327. +where it led to infinite loop e.g. on failed initialization.
  13328. +
  13329. +This patch switches code to proper types and increases the maximum
  13330. +number of supported flowrings to 512.
  13331. +
  13332. +Originally this change was sent in September 2015, but back it was
  13333. +causing a regression on BCM43602 resulting in:
  13334. +Unable to handle kernel NULL pointer dereference at virtual address ...
  13335. +
  13336. +The reason for this regression was missing update (s/u8/u16) of struct
  13337. +brcmf_flowring_ring. This problem was handled in 9f64df9 ("brcmfmac: Fix
  13338. +bug in flowring management."). Starting with that it's safe to apply
  13339. +this original patch as it doesn't cause a regression anymore.
  13340. +
  13341. +This patch fixes an infinite loop on BCM4366 which is supported since
  13342. +4.4 so it makes sense to apply it to stable 4.4+.
  13343. +
  13344. +Cc: <stable@vger.kernel.org> # 4.4+
  13345. +Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  13346. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  13347. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13348. +Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  13349. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13350. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  13351. +---
  13352. +
  13353. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  13354. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  13355. +@@ -32,7 +32,7 @@
  13356. + #define BRCMF_FLOWRING_LOW (BRCMF_FLOWRING_HIGH - 256)
  13357. + #define BRCMF_FLOWRING_INVALID_IFIDX 0xff
  13358. +
  13359. +-#define BRCMF_FLOWRING_HASH_AP(da, fifo, ifidx) (da[5] + fifo + ifidx * 16)
  13360. ++#define BRCMF_FLOWRING_HASH_AP(da, fifo, ifidx) (da[5] * 2 + fifo + ifidx * 16)
  13361. + #define BRCMF_FLOWRING_HASH_STA(fifo, ifidx) (fifo + ifidx * 16)
  13362. +
  13363. + static const u8 brcmf_flowring_prio2fifo[] = {
  13364. +@@ -68,7 +68,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  13365. + u8 prio, u8 ifidx)
  13366. + {
  13367. + struct brcmf_flowring_hash *hash;
  13368. +- u8 hash_idx;
  13369. ++ u16 hash_idx;
  13370. + u32 i;
  13371. + bool found;
  13372. + bool sta;
  13373. +@@ -88,6 +88,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  13374. + }
  13375. + hash_idx = sta ? BRCMF_FLOWRING_HASH_STA(fifo, ifidx) :
  13376. + BRCMF_FLOWRING_HASH_AP(mac, fifo, ifidx);
  13377. ++ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  13378. + found = false;
  13379. + hash = flow->hash;
  13380. + for (i = 0; i < BRCMF_FLOWRING_HASHSIZE; i++) {
  13381. +@@ -98,6 +99,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  13382. + break;
  13383. + }
  13384. + hash_idx++;
  13385. ++ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  13386. + }
  13387. + if (found)
  13388. + return hash[hash_idx].flowid;
  13389. +@@ -111,7 +113,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  13390. + {
  13391. + struct brcmf_flowring_ring *ring;
  13392. + struct brcmf_flowring_hash *hash;
  13393. +- u8 hash_idx;
  13394. ++ u16 hash_idx;
  13395. + u32 i;
  13396. + bool found;
  13397. + u8 fifo;
  13398. +@@ -131,6 +133,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  13399. + }
  13400. + hash_idx = sta ? BRCMF_FLOWRING_HASH_STA(fifo, ifidx) :
  13401. + BRCMF_FLOWRING_HASH_AP(mac, fifo, ifidx);
  13402. ++ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  13403. + found = false;
  13404. + hash = flow->hash;
  13405. + for (i = 0; i < BRCMF_FLOWRING_HASHSIZE; i++) {
  13406. +@@ -140,6 +143,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  13407. + break;
  13408. + }
  13409. + hash_idx++;
  13410. ++ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  13411. + }
  13412. + if (found) {
  13413. + for (i = 0; i < flow->nrofrings; i++) {
  13414. +@@ -169,7 +173,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  13415. + }
  13416. +
  13417. +
  13418. +-u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u8 flowid)
  13419. ++u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u16 flowid)
  13420. + {
  13421. + struct brcmf_flowring_ring *ring;
  13422. +
  13423. +@@ -179,7 +183,7 @@ u8 brcmf_flowring_tid(struct brcmf_flowr
  13424. + }
  13425. +
  13426. +
  13427. +-static void brcmf_flowring_block(struct brcmf_flowring *flow, u8 flowid,
  13428. ++static void brcmf_flowring_block(struct brcmf_flowring *flow, u16 flowid,
  13429. + bool blocked)
  13430. + {
  13431. + struct brcmf_flowring_ring *ring;
  13432. +@@ -228,10 +232,10 @@ static void brcmf_flowring_block(struct
  13433. + }
  13434. +
  13435. +
  13436. +-void brcmf_flowring_delete(struct brcmf_flowring *flow, u8 flowid)
  13437. ++void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid)
  13438. + {
  13439. + struct brcmf_flowring_ring *ring;
  13440. +- u8 hash_idx;
  13441. ++ u16 hash_idx;
  13442. + struct sk_buff *skb;
  13443. +
  13444. + ring = flow->rings[flowid];
  13445. +@@ -253,7 +257,7 @@ void brcmf_flowring_delete(struct brcmf_
  13446. + }
  13447. +
  13448. +
  13449. +-u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  13450. ++u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u16 flowid,
  13451. + struct sk_buff *skb)
  13452. + {
  13453. + struct brcmf_flowring_ring *ring;
  13454. +@@ -279,7 +283,7 @@ u32 brcmf_flowring_enqueue(struct brcmf_
  13455. + }
  13456. +
  13457. +
  13458. +-struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u8 flowid)
  13459. ++struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u16 flowid)
  13460. + {
  13461. + struct brcmf_flowring_ring *ring;
  13462. + struct sk_buff *skb;
  13463. +@@ -300,7 +304,7 @@ struct sk_buff *brcmf_flowring_dequeue(s
  13464. + }
  13465. +
  13466. +
  13467. +-void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u8 flowid,
  13468. ++void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u16 flowid,
  13469. + struct sk_buff *skb)
  13470. + {
  13471. + struct brcmf_flowring_ring *ring;
  13472. +@@ -311,7 +315,7 @@ void brcmf_flowring_reinsert(struct brcm
  13473. + }
  13474. +
  13475. +
  13476. +-u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u8 flowid)
  13477. ++u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u16 flowid)
  13478. + {
  13479. + struct brcmf_flowring_ring *ring;
  13480. +
  13481. +@@ -326,7 +330,7 @@ u32 brcmf_flowring_qlen(struct brcmf_flo
  13482. + }
  13483. +
  13484. +
  13485. +-void brcmf_flowring_open(struct brcmf_flowring *flow, u8 flowid)
  13486. ++void brcmf_flowring_open(struct brcmf_flowring *flow, u16 flowid)
  13487. + {
  13488. + struct brcmf_flowring_ring *ring;
  13489. +
  13490. +@@ -340,10 +344,10 @@ void brcmf_flowring_open(struct brcmf_fl
  13491. + }
  13492. +
  13493. +
  13494. +-u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u8 flowid)
  13495. ++u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u16 flowid)
  13496. + {
  13497. + struct brcmf_flowring_ring *ring;
  13498. +- u8 hash_idx;
  13499. ++ u16 hash_idx;
  13500. +
  13501. + ring = flow->rings[flowid];
  13502. + hash_idx = ring->hash_id;
  13503. +@@ -384,7 +388,7 @@ void brcmf_flowring_detach(struct brcmf_
  13504. + struct brcmf_pub *drvr = bus_if->drvr;
  13505. + struct brcmf_flowring_tdls_entry *search;
  13506. + struct brcmf_flowring_tdls_entry *remove;
  13507. +- u8 flowid;
  13508. ++ u16 flowid;
  13509. +
  13510. + for (flowid = 0; flowid < flow->nrofrings; flowid++) {
  13511. + if (flow->rings[flowid])
  13512. +@@ -408,7 +412,7 @@ void brcmf_flowring_configure_addr_mode(
  13513. + struct brcmf_bus *bus_if = dev_get_drvdata(flow->dev);
  13514. + struct brcmf_pub *drvr = bus_if->drvr;
  13515. + u32 i;
  13516. +- u8 flowid;
  13517. ++ u16 flowid;
  13518. +
  13519. + if (flow->addr_mode[ifidx] != addr_mode) {
  13520. + for (i = 0; i < ARRAY_SIZE(flow->hash); i++) {
  13521. +@@ -434,7 +438,7 @@ void brcmf_flowring_delete_peer(struct b
  13522. + struct brcmf_flowring_tdls_entry *prev;
  13523. + struct brcmf_flowring_tdls_entry *search;
  13524. + u32 i;
  13525. +- u8 flowid;
  13526. ++ u16 flowid;
  13527. + bool sta;
  13528. +
  13529. + sta = (flow->addr_mode[ifidx] == ADDR_INDIRECT);
  13530. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.h
  13531. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.h
  13532. +@@ -16,7 +16,7 @@
  13533. + #define BRCMFMAC_FLOWRING_H
  13534. +
  13535. +
  13536. +-#define BRCMF_FLOWRING_HASHSIZE 256
  13537. ++#define BRCMF_FLOWRING_HASHSIZE 512 /* has to be 2^x */
  13538. + #define BRCMF_FLOWRING_INVALID_ID 0xFFFFFFFF
  13539. +
  13540. +
  13541. +@@ -24,7 +24,7 @@ struct brcmf_flowring_hash {
  13542. + u8 mac[ETH_ALEN];
  13543. + u8 fifo;
  13544. + u8 ifidx;
  13545. +- u8 flowid;
  13546. ++ u16 flowid;
  13547. + };
  13548. +
  13549. + enum ring_status {
  13550. +@@ -61,16 +61,16 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  13551. + u8 prio, u8 ifidx);
  13552. + u32 brcmf_flowring_create(struct brcmf_flowring *flow, u8 da[ETH_ALEN],
  13553. + u8 prio, u8 ifidx);
  13554. +-void brcmf_flowring_delete(struct brcmf_flowring *flow, u8 flowid);
  13555. +-void brcmf_flowring_open(struct brcmf_flowring *flow, u8 flowid);
  13556. +-u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u8 flowid);
  13557. +-u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  13558. ++void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid);
  13559. ++void brcmf_flowring_open(struct brcmf_flowring *flow, u16 flowid);
  13560. ++u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u16 flowid);
  13561. ++u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u16 flowid,
  13562. + struct sk_buff *skb);
  13563. +-struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u8 flowid);
  13564. +-void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u8 flowid,
  13565. ++struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u16 flowid);
  13566. ++void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u16 flowid,
  13567. + struct sk_buff *skb);
  13568. +-u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u8 flowid);
  13569. +-u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u8 flowid);
  13570. ++u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u16 flowid);
  13571. ++u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u16 flowid);
  13572. + struct brcmf_flowring *brcmf_flowring_attach(struct device *dev, u16 nrofrings);
  13573. + void brcmf_flowring_detach(struct brcmf_flowring *flow);
  13574. + void brcmf_flowring_configure_addr_mode(struct brcmf_flowring *flow, int ifidx,
  13575. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  13576. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  13577. +@@ -677,7 +677,7 @@ static u32 brcmf_msgbuf_flowring_create(
  13578. + }
  13579. +
  13580. +
  13581. +-static void brcmf_msgbuf_txflow(struct brcmf_msgbuf *msgbuf, u8 flowid)
  13582. ++static void brcmf_msgbuf_txflow(struct brcmf_msgbuf *msgbuf, u16 flowid)
  13583. + {
  13584. + struct brcmf_flowring *flow = msgbuf->flow;
  13585. + struct brcmf_commonring *commonring;
  13586. +@@ -1310,7 +1310,7 @@ int brcmf_proto_msgbuf_rx_trigger(struct
  13587. + }
  13588. +
  13589. +
  13590. +-void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid)
  13591. ++void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u16 flowid)
  13592. + {
  13593. + struct brcmf_msgbuf *msgbuf = (struct brcmf_msgbuf *)drvr->proto->pd;
  13594. + struct msgbuf_tx_flowring_delete_req *delete;
  13595. +@@ -1415,6 +1415,13 @@ int brcmf_proto_msgbuf_attach(struct brc
  13596. + u32 count;
  13597. +
  13598. + if_msgbuf = drvr->bus_if->msgbuf;
  13599. ++
  13600. ++ if (if_msgbuf->nrof_flowrings >= BRCMF_FLOWRING_HASHSIZE) {
  13601. ++ brcmf_err("driver not configured for this many flowrings %d\n",
  13602. ++ if_msgbuf->nrof_flowrings);
  13603. ++ if_msgbuf->nrof_flowrings = BRCMF_FLOWRING_HASHSIZE - 1;
  13604. ++ }
  13605. ++
  13606. + msgbuf = kzalloc(sizeof(*msgbuf), GFP_KERNEL);
  13607. + if (!msgbuf)
  13608. + goto fail;
  13609. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h
  13610. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h
  13611. +@@ -33,7 +33,7 @@
  13612. +
  13613. +
  13614. + int brcmf_proto_msgbuf_rx_trigger(struct device *dev);
  13615. +-void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid);
  13616. ++void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u16 flowid);
  13617. + int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr);
  13618. + void brcmf_proto_msgbuf_detach(struct brcmf_pub *drvr);
  13619. + #else
  13620. 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
  13621. deleted file mode 100644
  13622. index 3ce4428..0000000
  13623. --- a/package/kernel/mac80211/patches/332-ath9k-ath9k_hw_analog_shift_rmw-use-REG_RMW.patch
  13624. +++ /dev/null
  13625. @@ -1,27 +0,0 @@
  13626. -From: Oleksij Rempel <linux@rempel-privat.de>
  13627. -Date: Sun, 22 Mar 2015 19:29:59 +0100
  13628. -Subject: [PATCH] ath9k: ath9k_hw_analog_shift_rmw: use REG_RMW
  13629. -
  13630. -use REG_RMW in ath9k_hw_analog_shift_rmw.
  13631. -It will double execution speed on usb bus.
  13632. -
  13633. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  13634. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13635. ----
  13636. -
  13637. ---- a/drivers/net/wireless/ath/ath9k/eeprom.c
  13638. -+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
  13639. -@@ -27,12 +27,7 @@ void ath9k_hw_analog_shift_regwrite(stru
  13640. - void ath9k_hw_analog_shift_rmw(struct ath_hw *ah, u32 reg, u32 mask,
  13641. - u32 shift, u32 val)
  13642. - {
  13643. -- u32 regVal;
  13644. --
  13645. -- regVal = REG_READ(ah, reg) & ~mask;
  13646. -- regVal |= (val << shift) & mask;
  13647. --
  13648. -- REG_WRITE(ah, reg, regVal);
  13649. -+ REG_RMW(ah, reg, ((val << shift) & mask), mask);
  13650. -
  13651. - if (ah->config.analog_shiftreg)
  13652. - udelay(100);
  13653. diff --git a/package/kernel/mac80211/patches/332-cfg80211-fix-faulty-variable-initialization-in-ieee8.patch b/package/kernel/mac80211/patches/332-cfg80211-fix-faulty-variable-initialization-in-ieee8.patch
  13654. new file mode 100644
  13655. index 0000000..e414f23
  13656. --- /dev/null
  13657. +++ b/package/kernel/mac80211/patches/332-cfg80211-fix-faulty-variable-initialization-in-ieee8.patch
  13658. @@ -0,0 +1,22 @@
  13659. +From: Felix Fietkau <nbd@openwrt.org>
  13660. +Date: Mon, 8 Feb 2016 14:24:36 +0100
  13661. +Subject: [PATCH] cfg80211: fix faulty variable initialization in
  13662. + ieee80211_amsdu_to_8023s
  13663. +
  13664. +reuse_skb is set to true if the code decides to use the last segment.
  13665. +Fixes a memory leak
  13666. +
  13667. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  13668. +---
  13669. +
  13670. +--- a/net/wireless/util.c
  13671. ++++ b/net/wireless/util.c
  13672. +@@ -676,7 +676,7 @@ void ieee80211_amsdu_to_8023s(struct sk_
  13673. + u8 *payload;
  13674. + int offset = 0, remaining, err;
  13675. + struct ethhdr eth;
  13676. +- bool reuse_skb = true;
  13677. ++ bool reuse_skb = false;
  13678. + bool last = false;
  13679. +
  13680. + if (has_80211_header) {
  13681. 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
  13682. deleted file mode 100644
  13683. index 8f12b36..0000000
  13684. --- a/package/kernel/mac80211/patches/333-ath9k-use-REG_RMW-and-rmw-buffer-in-ath9k_hw_4k_set_.patch
  13685. +++ /dev/null
  13686. @@ -1,47 +0,0 @@
  13687. -From: Oleksij Rempel <linux@rempel-privat.de>
  13688. -Date: Sun, 22 Mar 2015 19:30:01 +0100
  13689. -Subject: [PATCH] ath9k: use REG_RMW and rmw buffer in
  13690. - ath9k_hw_4k_set_gain
  13691. -
  13692. -it is possible to reduce time needed for this function
  13693. -by rplacing REG_WRITE with REG_RMW (plus dummy 0) and putt all commands
  13694. -in same buffer.
  13695. -
  13696. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  13697. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13698. ----
  13699. -
  13700. ---- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  13701. -+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  13702. -@@ -772,15 +772,14 @@ static void ath9k_hw_4k_set_gain(struct
  13703. - struct ar5416_eeprom_4k *eep,
  13704. - u8 txRxAttenLocal)
  13705. - {
  13706. -- REG_WRITE(ah, AR_PHY_SWITCH_CHAIN_0,
  13707. -- pModal->antCtrlChain[0]);
  13708. --
  13709. -- REG_WRITE(ah, AR_PHY_TIMING_CTRL4(0),
  13710. -- (REG_READ(ah, AR_PHY_TIMING_CTRL4(0)) &
  13711. -- ~(AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF |
  13712. -- AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF)) |
  13713. -- SM(pModal->iqCalICh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF) |
  13714. -- SM(pModal->iqCalQCh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF));
  13715. -+ ENABLE_REG_RMW_BUFFER(ah);
  13716. -+ REG_RMW(ah, AR_PHY_SWITCH_CHAIN_0,
  13717. -+ pModal->antCtrlChain[0], 0);
  13718. -+
  13719. -+ REG_RMW(ah, AR_PHY_TIMING_CTRL4(0),
  13720. -+ SM(pModal->iqCalICh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF) |
  13721. -+ SM(pModal->iqCalQCh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF),
  13722. -+ AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF | AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF);
  13723. -
  13724. - if ((eep->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >=
  13725. - AR5416_EEP_MINOR_VER_3) {
  13726. -@@ -819,6 +818,7 @@ static void ath9k_hw_4k_set_gain(struct
  13727. - AR9280_PHY_RXGAIN_TXRX_ATTEN, txRxAttenLocal);
  13728. - REG_RMW_FIELD(ah, AR_PHY_RXGAIN + 0x1000,
  13729. - AR9280_PHY_RXGAIN_TXRX_MARGIN, pModal->rxTxMarginCh[0]);
  13730. -+ REG_RMW_BUFFER_FLUSH(ah);
  13731. - }
  13732. -
  13733. - /*
  13734. diff --git a/package/kernel/mac80211/patches/333-cfg80211-reuse-existing-page-fragments-in-A-MSDU-rx.patch b/package/kernel/mac80211/patches/333-cfg80211-reuse-existing-page-fragments-in-A-MSDU-rx.patch
  13735. new file mode 100644
  13736. index 0000000..6e2d0cf
  13737. --- /dev/null
  13738. +++ b/package/kernel/mac80211/patches/333-cfg80211-reuse-existing-page-fragments-in-A-MSDU-rx.patch
  13739. @@ -0,0 +1,132 @@
  13740. +From: Felix Fietkau <nbd@openwrt.org>
  13741. +Date: Mon, 8 Feb 2016 14:33:19 +0100
  13742. +Subject: [PATCH] cfg80211: reuse existing page fragments in A-MSDU rx
  13743. +
  13744. +This massively reduces data copying and thus improves rx performance
  13745. +
  13746. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  13747. +---
  13748. +
  13749. +--- a/net/wireless/util.c
  13750. ++++ b/net/wireless/util.c
  13751. +@@ -644,23 +644,93 @@ int ieee80211_data_from_8023(struct sk_b
  13752. + }
  13753. + EXPORT_SYMBOL(ieee80211_data_from_8023);
  13754. +
  13755. ++static void
  13756. ++__frame_add_frag(struct sk_buff *skb, struct page *page,
  13757. ++ void *ptr, int len, int size)
  13758. ++{
  13759. ++ struct skb_shared_info *sh = skb_shinfo(skb);
  13760. ++ int page_offset;
  13761. ++
  13762. ++ atomic_inc(&page->_count);
  13763. ++ page_offset = ptr - page_address(page);
  13764. ++ skb_add_rx_frag(skb, sh->nr_frags, page, page_offset, len, size);
  13765. ++}
  13766. ++
  13767. ++static void
  13768. ++__ieee80211_amsdu_copy_frag(struct sk_buff *skb, struct sk_buff *frame,
  13769. ++ int offset, int len)
  13770. ++{
  13771. ++ struct skb_shared_info *sh = skb_shinfo(skb);
  13772. ++ const skb_frag_t *frag = &sh->frags[-1];
  13773. ++ struct page *frag_page;
  13774. ++ void *frag_ptr;
  13775. ++ int frag_len, frag_size;
  13776. ++ int head_size = skb->len - skb->data_len;
  13777. ++ int cur_len;
  13778. ++
  13779. ++ frag_page = virt_to_head_page(skb->head);
  13780. ++ frag_ptr = skb->data;
  13781. ++ frag_size = head_size;
  13782. ++
  13783. ++ while (offset >= frag_size) {
  13784. ++ offset -= frag_size;
  13785. ++ frag++;
  13786. ++ frag_page = skb_frag_page(frag);
  13787. ++ frag_ptr = skb_frag_address(frag);
  13788. ++ frag_size = skb_frag_size(frag);
  13789. ++ }
  13790. ++
  13791. ++ frag_ptr += offset;
  13792. ++ frag_len = frag_size - offset;
  13793. ++
  13794. ++ cur_len = min(len, frag_len);
  13795. ++
  13796. ++ __frame_add_frag(frame, frag_page, frag_ptr, cur_len, frag_size);
  13797. ++ len -= cur_len;
  13798. ++
  13799. ++ while (len > 0) {
  13800. ++ frag++;
  13801. ++ frag_len = skb_frag_size(frag);
  13802. ++ cur_len = min(len, frag_len);
  13803. ++ __frame_add_frag(frame, skb_frag_page(frag),
  13804. ++ skb_frag_address(frag), cur_len, frag_len);
  13805. ++ len -= cur_len;
  13806. ++ }
  13807. ++}
  13808. ++
  13809. + static struct sk_buff *
  13810. + __ieee80211_amsdu_copy(struct sk_buff *skb, unsigned int hlen,
  13811. +- int offset, int len)
  13812. ++ int offset, int len, bool reuse_frag)
  13813. + {
  13814. + struct sk_buff *frame;
  13815. ++ int cur_len = len;
  13816. +
  13817. + if (skb->len - offset < len)
  13818. + return NULL;
  13819. +
  13820. + /*
  13821. ++ * When reusing framents, copy some data to the head to simplify
  13822. ++ * ethernet header handling and speed up protocol header processing
  13823. ++ * in the stack later.
  13824. ++ */
  13825. ++ if (reuse_frag)
  13826. ++ cur_len = min_t(int, len, 32);
  13827. ++
  13828. ++ /*
  13829. + * Allocate and reserve two bytes more for payload
  13830. + * alignment since sizeof(struct ethhdr) is 14.
  13831. + */
  13832. +- frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + len);
  13833. ++ frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + cur_len);
  13834. +
  13835. + skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2);
  13836. +- skb_copy_bits(skb, offset, skb_put(frame, len), len);
  13837. ++ skb_copy_bits(skb, offset, skb_put(frame, cur_len), cur_len);
  13838. ++
  13839. ++ len -= cur_len;
  13840. ++ if (!len)
  13841. ++ return frame;
  13842. ++
  13843. ++ offset += cur_len;
  13844. ++ __ieee80211_amsdu_copy_frag(skb, frame, offset, len);
  13845. +
  13846. + return frame;
  13847. + }
  13848. +@@ -676,6 +746,7 @@ void ieee80211_amsdu_to_8023s(struct sk_
  13849. + u8 *payload;
  13850. + int offset = 0, remaining, err;
  13851. + struct ethhdr eth;
  13852. ++ bool reuse_frag = skb->head_frag && !skb_has_frag_list(skb);
  13853. + bool reuse_skb = false;
  13854. + bool last = false;
  13855. +
  13856. +@@ -703,12 +774,13 @@ void ieee80211_amsdu_to_8023s(struct sk_
  13857. + offset += sizeof(struct ethhdr);
  13858. + /* reuse skb for the last subframe */
  13859. + last = remaining <= subframe_len + padding;
  13860. +- if (!skb_is_nonlinear(skb) && last) {
  13861. ++ if (!skb_is_nonlinear(skb) && !reuse_frag && last) {
  13862. + skb_pull(skb, offset);
  13863. + frame = skb;
  13864. + reuse_skb = true;
  13865. + } else {
  13866. +- frame = __ieee80211_amsdu_copy(skb, hlen, offset, len);
  13867. ++ frame = __ieee80211_amsdu_copy(skb, hlen, offset, len,
  13868. ++ reuse_frag);
  13869. + if (!frame)
  13870. + goto purge;
  13871. +
  13872. 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
  13873. deleted file mode 100644
  13874. index f26e059..0000000
  13875. --- a/package/kernel/mac80211/patches/334-ath9k-use-REG_RMW-and-rmw-buffer-in-ath9k_hw_def_set.patch
  13876. +++ /dev/null
  13877. @@ -1,67 +0,0 @@
  13878. -From: Oleksij Rempel <linux@rempel-privat.de>
  13879. -Date: Sun, 22 Mar 2015 19:30:03 +0100
  13880. -Subject: [PATCH] ath9k: use REG_RMW and rmw buffer in
  13881. - ath9k_hw_def_set_gain
  13882. -
  13883. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  13884. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13885. ----
  13886. -
  13887. ---- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
  13888. -+++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
  13889. -@@ -466,6 +466,7 @@ static void ath9k_hw_def_set_gain(struct
  13890. - struct ar5416_eeprom_def *eep,
  13891. - u8 txRxAttenLocal, int regChainOffset, int i)
  13892. - {
  13893. -+ ENABLE_REG_RMW_BUFFER(ah);
  13894. - if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_3) {
  13895. - txRxAttenLocal = pModal->txRxAttenCh[i];
  13896. -
  13897. -@@ -483,16 +484,12 @@ static void ath9k_hw_def_set_gain(struct
  13898. - AR_PHY_GAIN_2GHZ_XATTEN2_DB,
  13899. - pModal->xatten2Db[i]);
  13900. - } else {
  13901. -- REG_WRITE(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  13902. -- (REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) &
  13903. -- ~AR_PHY_GAIN_2GHZ_BSW_MARGIN)
  13904. -- | SM(pModal-> bswMargin[i],
  13905. -- AR_PHY_GAIN_2GHZ_BSW_MARGIN));
  13906. -- REG_WRITE(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  13907. -- (REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) &
  13908. -- ~AR_PHY_GAIN_2GHZ_BSW_ATTEN)
  13909. -- | SM(pModal->bswAtten[i],
  13910. -- AR_PHY_GAIN_2GHZ_BSW_ATTEN));
  13911. -+ REG_RMW(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  13912. -+ SM(pModal-> bswMargin[i], AR_PHY_GAIN_2GHZ_BSW_MARGIN),
  13913. -+ AR_PHY_GAIN_2GHZ_BSW_MARGIN);
  13914. -+ REG_RMW(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  13915. -+ SM(pModal->bswAtten[i], AR_PHY_GAIN_2GHZ_BSW_ATTEN),
  13916. -+ AR_PHY_GAIN_2GHZ_BSW_ATTEN);
  13917. - }
  13918. - }
  13919. -
  13920. -@@ -504,17 +501,14 @@ static void ath9k_hw_def_set_gain(struct
  13921. - AR_PHY_RXGAIN + regChainOffset,
  13922. - AR9280_PHY_RXGAIN_TXRX_MARGIN, pModal->rxTxMarginCh[i]);
  13923. - } else {
  13924. -- REG_WRITE(ah,
  13925. -- AR_PHY_RXGAIN + regChainOffset,
  13926. -- (REG_READ(ah, AR_PHY_RXGAIN + regChainOffset) &
  13927. -- ~AR_PHY_RXGAIN_TXRX_ATTEN)
  13928. -- | SM(txRxAttenLocal, AR_PHY_RXGAIN_TXRX_ATTEN));
  13929. -- REG_WRITE(ah,
  13930. -- AR_PHY_GAIN_2GHZ + regChainOffset,
  13931. -- (REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) &
  13932. -- ~AR_PHY_GAIN_2GHZ_RXTX_MARGIN) |
  13933. -- SM(pModal->rxTxMarginCh[i], AR_PHY_GAIN_2GHZ_RXTX_MARGIN));
  13934. -+ REG_RMW(ah, AR_PHY_RXGAIN + regChainOffset,
  13935. -+ SM(txRxAttenLocal, AR_PHY_RXGAIN_TXRX_ATTEN),
  13936. -+ AR_PHY_RXGAIN_TXRX_ATTEN);
  13937. -+ REG_RMW(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  13938. -+ SM(pModal->rxTxMarginCh[i], AR_PHY_GAIN_2GHZ_RXTX_MARGIN),
  13939. -+ AR_PHY_GAIN_2GHZ_RXTX_MARGIN);
  13940. - }
  13941. -+ REG_RMW_BUFFER_FLUSH(ah);
  13942. - }
  13943. -
  13944. - static void ath9k_hw_def_set_board_values(struct ath_hw *ah,
  13945. diff --git a/package/kernel/mac80211/patches/335-0001-brcmfmac-Fix-oops-when-SDIO-device-is-removed.patch b/package/kernel/mac80211/patches/335-0001-brcmfmac-Fix-oops-when-SDIO-device-is-removed.patch
  13946. deleted file mode 100644
  13947. index 5e63a80..0000000
  13948. --- a/package/kernel/mac80211/patches/335-0001-brcmfmac-Fix-oops-when-SDIO-device-is-removed.patch
  13949. +++ /dev/null
  13950. @@ -1,44 +0,0 @@
  13951. -From: Hante Meuleman <meuleman@broadcom.com>
  13952. -Date: Fri, 6 Mar 2015 18:40:38 +0100
  13953. -Subject: [PATCH] brcmfmac: Fix oops when SDIO device is removed.
  13954. -
  13955. -On removal of SDIO card both functions of card will be getting
  13956. -a remove call. When the first is hanging in ctrl frame xmit then
  13957. -the second will cause oops. This patch fixes the xmit ctrl
  13958. -handling in case of serious errors and also limits the handling
  13959. -for remove to function 1 only.
  13960. -
  13961. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  13962. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  13963. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13964. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  13965. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  13966. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13967. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13968. ----
  13969. -
  13970. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  13971. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  13972. -@@ -1194,7 +1194,7 @@ static void brcmf_ops_sdio_remove(struct
  13973. - brcmf_dbg(SDIO, "sdio device ID: 0x%04x\n", func->device);
  13974. - brcmf_dbg(SDIO, "Function: %d\n", func->num);
  13975. -
  13976. -- if (func->num != 1 && func->num != 2)
  13977. -+ if (func->num != 1)
  13978. - return;
  13979. -
  13980. - bus_if = dev_get_drvdata(&func->dev);
  13981. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13982. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13983. -@@ -2740,6 +2740,11 @@ static void brcmf_sdio_dpc(struct brcmf_
  13984. - if ((bus->sdiodev->state != BRCMF_SDIOD_DATA) || (err != 0)) {
  13985. - brcmf_err("failed backplane access over SDIO, halting operation\n");
  13986. - atomic_set(&bus->intstatus, 0);
  13987. -+ if (bus->ctrl_frame_stat) {
  13988. -+ bus->ctrl_frame_err = -ENODEV;
  13989. -+ bus->ctrl_frame_stat = false;
  13990. -+ brcmf_sdio_wait_event_wakeup(bus);
  13991. -+ }
  13992. - } else if (atomic_read(&bus->intstatus) ||
  13993. - atomic_read(&bus->ipend) > 0 ||
  13994. - (!atomic_read(&bus->fcstate) &&
  13995. diff --git a/package/kernel/mac80211/patches/335-0002-brcmfmac-Simplify-watchdog-sleep.patch b/package/kernel/mac80211/patches/335-0002-brcmfmac-Simplify-watchdog-sleep.patch
  13996. deleted file mode 100644
  13997. index 201da75..0000000
  13998. --- a/package/kernel/mac80211/patches/335-0002-brcmfmac-Simplify-watchdog-sleep.patch
  13999. +++ /dev/null
  14000. @@ -1,157 +0,0 @@
  14001. -From: Hante Meuleman <meuleman@broadcom.com>
  14002. -Date: Fri, 6 Mar 2015 18:40:39 +0100
  14003. -Subject: [PATCH] brcmfmac: Simplify watchdog sleep.
  14004. -
  14005. -The watchdog thread is used to put the SDIO bus to sleep when the
  14006. -system is idling. This patch simplifies the way it is determined
  14007. -when sleep can be entered.
  14008. -
  14009. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  14010. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  14011. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14012. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  14013. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  14014. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14015. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14016. ----
  14017. -
  14018. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14019. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14020. -@@ -485,10 +485,9 @@ struct brcmf_sdio {
  14021. - #endif /* DEBUG */
  14022. -
  14023. - uint clkstate; /* State of sd and backplane clock(s) */
  14024. -- bool activity; /* Activity flag for clock down */
  14025. - s32 idletime; /* Control for activity timeout */
  14026. -- s32 idlecount; /* Activity timeout counter */
  14027. -- s32 idleclock; /* How to set bus driver when idle */
  14028. -+ s32 idlecount; /* Activity timeout counter */
  14029. -+ s32 idleclock; /* How to set bus driver when idle */
  14030. - bool rxflow_mode; /* Rx flow control mode */
  14031. - bool rxflow; /* Is rx flow control on */
  14032. - bool alp_only; /* Don't use HT clock (ALP only) */
  14033. -@@ -511,6 +510,7 @@ struct brcmf_sdio {
  14034. - struct workqueue_struct *brcmf_wq;
  14035. - struct work_struct datawork;
  14036. - atomic_t dpc_tskcnt;
  14037. -+ atomic_t dpc_running;
  14038. -
  14039. - bool txoff; /* Transmit flow-controlled */
  14040. - struct brcmf_sdio_count sdcnt;
  14041. -@@ -959,13 +959,8 @@ static int brcmf_sdio_clkctl(struct brcm
  14042. - brcmf_dbg(SDIO, "Enter\n");
  14043. -
  14044. - /* Early exit if we're already there */
  14045. -- if (bus->clkstate == target) {
  14046. -- if (target == CLK_AVAIL) {
  14047. -- brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  14048. -- bus->activity = true;
  14049. -- }
  14050. -+ if (bus->clkstate == target)
  14051. - return 0;
  14052. -- }
  14053. -
  14054. - switch (target) {
  14055. - case CLK_AVAIL:
  14056. -@@ -975,7 +970,6 @@ static int brcmf_sdio_clkctl(struct brcm
  14057. - /* Now request HT Avail on the backplane */
  14058. - brcmf_sdio_htclk(bus, true, pendok);
  14059. - brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  14060. -- bus->activity = true;
  14061. - break;
  14062. -
  14063. - case CLK_SDONLY:
  14064. -@@ -1024,17 +1018,6 @@ brcmf_sdio_bus_sleep(struct brcmf_sdio *
  14065. -
  14066. - /* Going to sleep */
  14067. - if (sleep) {
  14068. -- /* Don't sleep if something is pending */
  14069. -- if (atomic_read(&bus->intstatus) ||
  14070. -- atomic_read(&bus->ipend) > 0 ||
  14071. -- bus->ctrl_frame_stat ||
  14072. -- (!atomic_read(&bus->fcstate) &&
  14073. -- brcmu_pktq_mlen(&bus->txq, ~bus->flowcontrol) &&
  14074. -- data_ok(bus))) {
  14075. -- err = -EBUSY;
  14076. -- goto done;
  14077. -- }
  14078. --
  14079. - clkcsr = brcmf_sdiod_regrb(bus->sdiodev,
  14080. - SBSDIO_FUNC1_CHIPCLKCSR,
  14081. - &err);
  14082. -@@ -1045,11 +1028,7 @@ brcmf_sdio_bus_sleep(struct brcmf_sdio *
  14083. - SBSDIO_ALP_AVAIL_REQ, &err);
  14084. - }
  14085. - err = brcmf_sdio_kso_control(bus, false);
  14086. -- /* disable watchdog */
  14087. -- if (!err)
  14088. -- brcmf_sdio_wd_timer(bus, 0);
  14089. - } else {
  14090. -- bus->idlecount = 0;
  14091. - err = brcmf_sdio_kso_control(bus, true);
  14092. - }
  14093. - if (err) {
  14094. -@@ -3566,7 +3545,7 @@ void brcmf_sdio_isr(struct brcmf_sdio *b
  14095. - queue_work(bus->brcmf_wq, &bus->datawork);
  14096. - }
  14097. -
  14098. --static bool brcmf_sdio_bus_watchdog(struct brcmf_sdio *bus)
  14099. -+static void brcmf_sdio_bus_watchdog(struct brcmf_sdio *bus)
  14100. - {
  14101. - brcmf_dbg(TIMER, "Enter\n");
  14102. -
  14103. -@@ -3627,22 +3606,21 @@ static bool brcmf_sdio_bus_watchdog(stru
  14104. - #endif /* DEBUG */
  14105. -
  14106. - /* On idle timeout clear activity flag and/or turn off clock */
  14107. -- if ((bus->idletime > 0) && (bus->clkstate == CLK_AVAIL)) {
  14108. -- if (++bus->idlecount >= bus->idletime) {
  14109. -+ if ((atomic_read(&bus->dpc_tskcnt) == 0) &&
  14110. -+ (atomic_read(&bus->dpc_running) == 0) &&
  14111. -+ (bus->idletime > 0) && (bus->clkstate == CLK_AVAIL)) {
  14112. -+ bus->idlecount++;
  14113. -+ if (bus->idlecount > bus->idletime) {
  14114. -+ brcmf_dbg(SDIO, "idle\n");
  14115. -+ sdio_claim_host(bus->sdiodev->func[1]);
  14116. -+ brcmf_sdio_wd_timer(bus, 0);
  14117. - bus->idlecount = 0;
  14118. -- if (bus->activity) {
  14119. -- bus->activity = false;
  14120. -- brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  14121. -- } else {
  14122. -- brcmf_dbg(SDIO, "idle\n");
  14123. -- sdio_claim_host(bus->sdiodev->func[1]);
  14124. -- brcmf_sdio_bus_sleep(bus, true, false);
  14125. -- sdio_release_host(bus->sdiodev->func[1]);
  14126. -- }
  14127. -+ brcmf_sdio_bus_sleep(bus, true, false);
  14128. -+ sdio_release_host(bus->sdiodev->func[1]);
  14129. - }
  14130. -+ } else {
  14131. -+ bus->idlecount = 0;
  14132. - }
  14133. --
  14134. -- return (atomic_read(&bus->ipend) > 0);
  14135. - }
  14136. -
  14137. - static void brcmf_sdio_dataworker(struct work_struct *work)
  14138. -@@ -3651,8 +3629,11 @@ static void brcmf_sdio_dataworker(struct
  14139. - datawork);
  14140. -
  14141. - while (atomic_read(&bus->dpc_tskcnt)) {
  14142. -+ atomic_set(&bus->dpc_running, 1);
  14143. - atomic_set(&bus->dpc_tskcnt, 0);
  14144. - brcmf_sdio_dpc(bus);
  14145. -+ bus->idlecount = 0;
  14146. -+ atomic_set(&bus->dpc_running, 0);
  14147. - }
  14148. - if (brcmf_sdiod_freezing(bus->sdiodev)) {
  14149. - brcmf_sdiod_change_state(bus->sdiodev, BRCMF_SDIOD_DOWN);
  14150. -@@ -4154,6 +4135,7 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
  14151. - }
  14152. - /* Initialize DPC thread */
  14153. - atomic_set(&bus->dpc_tskcnt, 0);
  14154. -+ atomic_set(&bus->dpc_running, 0);
  14155. -
  14156. - /* Assign bus interface call back */
  14157. - bus->sdiodev->bus_if->dev = bus->sdiodev->dev;
  14158. diff --git a/package/kernel/mac80211/patches/335-0003-brcmfmac-Fix-possible-race-condition.patch b/package/kernel/mac80211/patches/335-0003-brcmfmac-Fix-possible-race-condition.patch
  14159. deleted file mode 100644
  14160. index 3a2de7a..0000000
  14161. --- a/package/kernel/mac80211/patches/335-0003-brcmfmac-Fix-possible-race-condition.patch
  14162. +++ /dev/null
  14163. @@ -1,83 +0,0 @@
  14164. -From: Hante Meuleman <meuleman@broadcom.com>
  14165. -Date: Fri, 6 Mar 2015 18:40:40 +0100
  14166. -Subject: [PATCH] brcmfmac: Fix possible race-condition.
  14167. -
  14168. -SDIO is using a "shared" variable to handoff ctl frames to DPC
  14169. -and to see when they are done. In a timeout situation this can
  14170. -lead to erroneous situation where DPC started to handle the ctl
  14171. -frame while the timeout expired. This patch will fix this by
  14172. -adding locking around the shared variable.
  14173. -
  14174. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  14175. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  14176. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14177. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  14178. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  14179. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14180. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14181. ----
  14182. -
  14183. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14184. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14185. -@@ -2700,11 +2700,13 @@ static void brcmf_sdio_dpc(struct brcmf_
  14186. - if (bus->ctrl_frame_stat && (bus->clkstate == CLK_AVAIL) &&
  14187. - data_ok(bus)) {
  14188. - sdio_claim_host(bus->sdiodev->func[1]);
  14189. -- err = brcmf_sdio_tx_ctrlframe(bus, bus->ctrl_frame_buf,
  14190. -- bus->ctrl_frame_len);
  14191. -+ if (bus->ctrl_frame_stat) {
  14192. -+ err = brcmf_sdio_tx_ctrlframe(bus, bus->ctrl_frame_buf,
  14193. -+ bus->ctrl_frame_len);
  14194. -+ bus->ctrl_frame_err = err;
  14195. -+ bus->ctrl_frame_stat = false;
  14196. -+ }
  14197. - sdio_release_host(bus->sdiodev->func[1]);
  14198. -- bus->ctrl_frame_err = err;
  14199. -- bus->ctrl_frame_stat = false;
  14200. - brcmf_sdio_wait_event_wakeup(bus);
  14201. - }
  14202. - /* Send queued frames (limit 1 if rx may still be pending) */
  14203. -@@ -2720,9 +2722,13 @@ static void brcmf_sdio_dpc(struct brcmf_
  14204. - brcmf_err("failed backplane access over SDIO, halting operation\n");
  14205. - atomic_set(&bus->intstatus, 0);
  14206. - if (bus->ctrl_frame_stat) {
  14207. -- bus->ctrl_frame_err = -ENODEV;
  14208. -- bus->ctrl_frame_stat = false;
  14209. -- brcmf_sdio_wait_event_wakeup(bus);
  14210. -+ sdio_claim_host(bus->sdiodev->func[1]);
  14211. -+ if (bus->ctrl_frame_stat) {
  14212. -+ bus->ctrl_frame_err = -ENODEV;
  14213. -+ bus->ctrl_frame_stat = false;
  14214. -+ brcmf_sdio_wait_event_wakeup(bus);
  14215. -+ }
  14216. -+ sdio_release_host(bus->sdiodev->func[1]);
  14217. - }
  14218. - } else if (atomic_read(&bus->intstatus) ||
  14219. - atomic_read(&bus->ipend) > 0 ||
  14220. -@@ -2930,15 +2936,20 @@ brcmf_sdio_bus_txctl(struct device *dev,
  14221. - brcmf_sdio_trigger_dpc(bus);
  14222. - wait_event_interruptible_timeout(bus->ctrl_wait, !bus->ctrl_frame_stat,
  14223. - msecs_to_jiffies(CTL_DONE_TIMEOUT));
  14224. --
  14225. -- if (!bus->ctrl_frame_stat) {
  14226. -+ ret = 0;
  14227. -+ if (bus->ctrl_frame_stat) {
  14228. -+ sdio_claim_host(bus->sdiodev->func[1]);
  14229. -+ if (bus->ctrl_frame_stat) {
  14230. -+ brcmf_dbg(SDIO, "ctrl_frame timeout\n");
  14231. -+ bus->ctrl_frame_stat = false;
  14232. -+ ret = -ETIMEDOUT;
  14233. -+ }
  14234. -+ sdio_release_host(bus->sdiodev->func[1]);
  14235. -+ }
  14236. -+ if (!ret) {
  14237. - brcmf_dbg(SDIO, "ctrl_frame complete, err=%d\n",
  14238. - bus->ctrl_frame_err);
  14239. - ret = bus->ctrl_frame_err;
  14240. -- } else {
  14241. -- brcmf_dbg(SDIO, "ctrl_frame timeout\n");
  14242. -- bus->ctrl_frame_stat = false;
  14243. -- ret = -ETIMEDOUT;
  14244. - }
  14245. -
  14246. - if (ret)
  14247. diff --git a/package/kernel/mac80211/patches/335-0004-brcmfmac-Add-support-for-BCM4345-SDIO-chipset.patch b/package/kernel/mac80211/patches/335-0004-brcmfmac-Add-support-for-BCM4345-SDIO-chipset.patch
  14248. deleted file mode 100644
  14249. index c9eb900..0000000
  14250. --- a/package/kernel/mac80211/patches/335-0004-brcmfmac-Add-support-for-BCM4345-SDIO-chipset.patch
  14251. +++ /dev/null
  14252. @@ -1,86 +0,0 @@
  14253. -From: Syed Asifful Dayyan <syedd@broadcom.com>
  14254. -Date: Fri, 6 Mar 2015 18:40:42 +0100
  14255. -Subject: [PATCH] brcmfmac: Add support for BCM4345 SDIO chipset.
  14256. -
  14257. -These changes add support for BCM4345 SDIO chipset.
  14258. -
  14259. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14260. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  14261. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14262. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  14263. -Signed-off-by: Syed Asifful Dayyan <syedd@broadcom.com>
  14264. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14265. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14266. ----
  14267. -
  14268. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  14269. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  14270. -@@ -1096,6 +1096,7 @@ static const struct sdio_device_id brcmf
  14271. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43341),
  14272. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43362),
  14273. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4335_4339),
  14274. -+ BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4345),
  14275. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4354),
  14276. - { /* end: all zeroes */ }
  14277. - };
  14278. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  14279. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  14280. -@@ -491,6 +491,10 @@ static void brcmf_chip_get_raminfo(struc
  14281. - case BRCM_CC_43362_CHIP_ID:
  14282. - ci->pub.ramsize = 0x3c000;
  14283. - break;
  14284. -+ case BRCM_CC_4345_CHIP_ID:
  14285. -+ ci->pub.ramsize = 0xc8000;
  14286. -+ ci->pub.rambase = 0x198000;
  14287. -+ break;
  14288. - case BRCM_CC_4339_CHIP_ID:
  14289. - case BRCM_CC_4354_CHIP_ID:
  14290. - case BRCM_CC_4356_CHIP_ID:
  14291. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14292. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14293. -@@ -617,6 +617,8 @@ static const struct sdiod_drive_str sdio
  14294. - #define BCM43362_NVRAM_NAME "brcm/brcmfmac43362-sdio.txt"
  14295. - #define BCM4339_FIRMWARE_NAME "brcm/brcmfmac4339-sdio.bin"
  14296. - #define BCM4339_NVRAM_NAME "brcm/brcmfmac4339-sdio.txt"
  14297. -+#define BCM4345_FIRMWARE_NAME "brcm/brcmfmac4345-sdio.bin"
  14298. -+#define BCM4345_NVRAM_NAME "brcm/brcmfmac4345-sdio.txt"
  14299. - #define BCM4354_FIRMWARE_NAME "brcm/brcmfmac4354-sdio.bin"
  14300. - #define BCM4354_NVRAM_NAME "brcm/brcmfmac4354-sdio.txt"
  14301. -
  14302. -@@ -640,6 +642,8 @@ MODULE_FIRMWARE(BCM43362_FIRMWARE_NAME);
  14303. - MODULE_FIRMWARE(BCM43362_NVRAM_NAME);
  14304. - MODULE_FIRMWARE(BCM4339_FIRMWARE_NAME);
  14305. - MODULE_FIRMWARE(BCM4339_NVRAM_NAME);
  14306. -+MODULE_FIRMWARE(BCM4345_FIRMWARE_NAME);
  14307. -+MODULE_FIRMWARE(BCM4345_NVRAM_NAME);
  14308. - MODULE_FIRMWARE(BCM4354_FIRMWARE_NAME);
  14309. - MODULE_FIRMWARE(BCM4354_NVRAM_NAME);
  14310. -
  14311. -@@ -669,6 +673,7 @@ static const struct brcmf_firmware_names
  14312. - { BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4335) },
  14313. - { BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, BRCMF_FIRMWARE_NVRAM(BCM43362) },
  14314. - { BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4339) },
  14315. -+ { BRCM_CC_4345_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4345) },
  14316. - { BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4354) }
  14317. - };
  14318. -
  14319. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  14320. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  14321. -@@ -37,6 +37,7 @@
  14322. - #define BRCM_CC_43362_CHIP_ID 43362
  14323. - #define BRCM_CC_4335_CHIP_ID 0x4335
  14324. - #define BRCM_CC_4339_CHIP_ID 0x4339
  14325. -+#define BRCM_CC_4345_CHIP_ID 0x4345
  14326. - #define BRCM_CC_4354_CHIP_ID 0x4354
  14327. - #define BRCM_CC_4356_CHIP_ID 0x4356
  14328. - #define BRCM_CC_43566_CHIP_ID 43566
  14329. ---- a/include/linux/mmc/sdio_ids.h
  14330. -+++ b/include/linux/mmc/sdio_ids.h
  14331. -@@ -33,6 +33,7 @@
  14332. - #define SDIO_DEVICE_ID_BROADCOM_43341 0xa94d
  14333. - #define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335
  14334. - #define SDIO_DEVICE_ID_BROADCOM_43362 0xa962
  14335. -+#define SDIO_DEVICE_ID_BROADCOM_4345 0x4345
  14336. - #define SDIO_DEVICE_ID_BROADCOM_4354 0x4354
  14337. -
  14338. - #define SDIO_VENDOR_ID_INTEL 0x0089
  14339. diff --git a/package/kernel/mac80211/patches/336-0001-brcmfmac-remove-duplication-of-ramsize-info.patch b/package/kernel/mac80211/patches/336-0001-brcmfmac-remove-duplication-of-ramsize-info.patch
  14340. deleted file mode 100644
  14341. index 7a688c4..0000000
  14342. --- a/package/kernel/mac80211/patches/336-0001-brcmfmac-remove-duplication-of-ramsize-info.patch
  14343. +++ /dev/null
  14344. @@ -1,48 +0,0 @@
  14345. -From: Arend van Spriel <arend@broadcom.com>
  14346. -Date: Wed, 11 Mar 2015 16:11:27 +0100
  14347. -Subject: [PATCH] brcmfmac: remove duplication of ramsize info
  14348. -
  14349. -Removing the ramsize from the brcmf_sdio structure to avoid
  14350. -duplication. The information is available in brcmf_chip
  14351. -structure.
  14352. -
  14353. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14354. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14355. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14356. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14357. ----
  14358. -
  14359. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14360. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14361. -@@ -432,8 +432,6 @@ struct brcmf_sdio {
  14362. - struct brcmf_sdio_dev *sdiodev; /* sdio device handler */
  14363. - struct brcmf_chip *ci; /* Chip info struct */
  14364. -
  14365. -- u32 ramsize; /* Size of RAM in SOCRAM (bytes) */
  14366. --
  14367. - u32 hostintmask; /* Copy of Host Interrupt Mask */
  14368. - atomic_t intstatus; /* Intstatus bits (events) pending */
  14369. - atomic_t fcstate; /* State of dongle flow-control */
  14370. -@@ -1075,7 +1073,7 @@ static int brcmf_sdio_readshared(struct
  14371. - struct sdpcm_shared_le sh_le;
  14372. - __le32 addr_le;
  14373. -
  14374. -- shaddr = bus->ci->rambase + bus->ramsize - 4;
  14375. -+ shaddr = bus->ci->rambase + bus->ci->ramsize - 4;
  14376. -
  14377. - /*
  14378. - * Read last word in socram to determine
  14379. -@@ -3871,13 +3869,6 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
  14380. - drivestrength = DEFAULT_SDIO_DRIVE_STRENGTH;
  14381. - brcmf_sdio_drivestrengthinit(bus->sdiodev, bus->ci, drivestrength);
  14382. -
  14383. -- /* Get info on the SOCRAM cores... */
  14384. -- bus->ramsize = bus->ci->ramsize;
  14385. -- if (!(bus->ramsize)) {
  14386. -- brcmf_err("failed to find SOCRAM memory!\n");
  14387. -- goto fail;
  14388. -- }
  14389. --
  14390. - /* Set card control so an SDIO card reset does a WLAN backplane reset */
  14391. - reg_val = brcmf_sdiod_regrb(bus->sdiodev,
  14392. - SDIO_CCCR_BRCM_CARDCTRL, &err);
  14393. diff --git a/package/kernel/mac80211/patches/336-0002-brcmfmac-always-perform-cores-checks.patch b/package/kernel/mac80211/patches/336-0002-brcmfmac-always-perform-cores-checks.patch
  14394. deleted file mode 100644
  14395. index e2a2074..0000000
  14396. --- a/package/kernel/mac80211/patches/336-0002-brcmfmac-always-perform-cores-checks.patch
  14397. +++ /dev/null
  14398. @@ -1,74 +0,0 @@
  14399. -From: Arend van Spriel <arend@broadcom.com>
  14400. -Date: Wed, 11 Mar 2015 16:11:28 +0100
  14401. -Subject: [PATCH] brcmfmac: always perform cores checks
  14402. -
  14403. -Instead of checking the cores in the chip only if CONFIG_BRCMDBG
  14404. -is selected perform the check always and extend it with more sanity
  14405. -checking.
  14406. -
  14407. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14408. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14409. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14410. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14411. ----
  14412. -
  14413. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  14414. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  14415. -@@ -419,13 +419,13 @@ static struct brcmf_core *brcmf_chip_add
  14416. - return &core->pub;
  14417. - }
  14418. -
  14419. --#ifdef DEBUG
  14420. - /* safety check for chipinfo */
  14421. - static int brcmf_chip_cores_check(struct brcmf_chip_priv *ci)
  14422. - {
  14423. - struct brcmf_core_priv *core;
  14424. - bool need_socram = false;
  14425. - bool has_socram = false;
  14426. -+ bool cpu_found = false;
  14427. - int idx = 1;
  14428. -
  14429. - list_for_each_entry(core, &ci->cores, list) {
  14430. -@@ -435,12 +435,14 @@ static int brcmf_chip_cores_check(struct
  14431. -
  14432. - switch (core->pub.id) {
  14433. - case BCMA_CORE_ARM_CM3:
  14434. -+ cpu_found = true;
  14435. - need_socram = true;
  14436. - break;
  14437. - case BCMA_CORE_INTERNAL_MEM:
  14438. - has_socram = true;
  14439. - break;
  14440. - case BCMA_CORE_ARM_CR4:
  14441. -+ cpu_found = true;
  14442. - if (ci->pub.rambase == 0) {
  14443. - brcmf_err("RAM base not provided with ARM CR4 core\n");
  14444. - return -ENOMEM;
  14445. -@@ -451,19 +453,21 @@ static int brcmf_chip_cores_check(struct
  14446. - }
  14447. - }
  14448. -
  14449. -+ if (!cpu_found) {
  14450. -+ brcmf_err("CPU core not detected\n");
  14451. -+ return -ENXIO;
  14452. -+ }
  14453. - /* check RAM core presence for ARM CM3 core */
  14454. - if (need_socram && !has_socram) {
  14455. - brcmf_err("RAM core not provided with ARM CM3 core\n");
  14456. - return -ENODEV;
  14457. - }
  14458. -+ if (!ci->pub.ramsize) {
  14459. -+ brcmf_err("RAM size is undetermined\n");
  14460. -+ return -ENOMEM;
  14461. -+ }
  14462. - return 0;
  14463. - }
  14464. --#else /* DEBUG */
  14465. --static inline int brcmf_chip_cores_check(struct brcmf_chip_priv *ci)
  14466. --{
  14467. -- return 0;
  14468. --}
  14469. --#endif
  14470. -
  14471. - static void brcmf_chip_get_raminfo(struct brcmf_chip_priv *ci)
  14472. - {
  14473. diff --git a/package/kernel/mac80211/patches/336-0003-brcmfmac-rename-chip-download-functions.patch b/package/kernel/mac80211/patches/336-0003-brcmfmac-rename-chip-download-functions.patch
  14474. deleted file mode 100644
  14475. index a272800..0000000
  14476. --- a/package/kernel/mac80211/patches/336-0003-brcmfmac-rename-chip-download-functions.patch
  14477. +++ /dev/null
  14478. @@ -1,240 +0,0 @@
  14479. -From: Arend van Spriel <arend@broadcom.com>
  14480. -Date: Wed, 11 Mar 2015 16:11:29 +0100
  14481. -Subject: [PATCH] brcmfmac: rename chip download functions
  14482. -
  14483. -The functions brcmf_chip_[enter/exit]_download() are not exclusively
  14484. -used for firmware download so rename these more appropriate.
  14485. -
  14486. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14487. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14488. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14489. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14490. ----
  14491. -
  14492. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  14493. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  14494. -@@ -807,7 +807,7 @@ struct brcmf_chip *brcmf_chip_attach(voi
  14495. - err = -EINVAL;
  14496. - if (WARN_ON(!ops->prepare))
  14497. - err = -EINVAL;
  14498. -- if (WARN_ON(!ops->exit_dl))
  14499. -+ if (WARN_ON(!ops->activate))
  14500. - err = -EINVAL;
  14501. - if (err < 0)
  14502. - return ERR_PTR(-EINVAL);
  14503. -@@ -905,7 +905,7 @@ void brcmf_chip_resetcore(struct brcmf_c
  14504. - }
  14505. -
  14506. - static void
  14507. --brcmf_chip_cm3_enterdl(struct brcmf_chip_priv *chip)
  14508. -+brcmf_chip_cm3_set_passive(struct brcmf_chip_priv *chip)
  14509. - {
  14510. - struct brcmf_core *core;
  14511. -
  14512. -@@ -919,7 +919,7 @@ brcmf_chip_cm3_enterdl(struct brcmf_chip
  14513. - brcmf_chip_resetcore(core, 0, 0, 0);
  14514. - }
  14515. -
  14516. --static bool brcmf_chip_cm3_exitdl(struct brcmf_chip_priv *chip)
  14517. -+static bool brcmf_chip_cm3_set_active(struct brcmf_chip_priv *chip)
  14518. - {
  14519. - struct brcmf_core *core;
  14520. -
  14521. -@@ -929,7 +929,7 @@ static bool brcmf_chip_cm3_exitdl(struct
  14522. - return false;
  14523. - }
  14524. -
  14525. -- chip->ops->exit_dl(chip->ctx, &chip->pub, 0);
  14526. -+ chip->ops->activate(chip->ctx, &chip->pub, 0);
  14527. -
  14528. - core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_ARM_CM3);
  14529. - brcmf_chip_resetcore(core, 0, 0, 0);
  14530. -@@ -938,7 +938,7 @@ static bool brcmf_chip_cm3_exitdl(struct
  14531. - }
  14532. -
  14533. - static inline void
  14534. --brcmf_chip_cr4_enterdl(struct brcmf_chip_priv *chip)
  14535. -+brcmf_chip_cr4_set_passive(struct brcmf_chip_priv *chip)
  14536. - {
  14537. - struct brcmf_core *core;
  14538. -
  14539. -@@ -951,11 +951,11 @@ brcmf_chip_cr4_enterdl(struct brcmf_chip
  14540. - D11_BCMA_IOCTL_PHYCLOCKEN);
  14541. - }
  14542. -
  14543. --static bool brcmf_chip_cr4_exitdl(struct brcmf_chip_priv *chip, u32 rstvec)
  14544. -+static bool brcmf_chip_cr4_set_active(struct brcmf_chip_priv *chip, u32 rstvec)
  14545. - {
  14546. - struct brcmf_core *core;
  14547. -
  14548. -- chip->ops->exit_dl(chip->ctx, &chip->pub, rstvec);
  14549. -+ chip->ops->activate(chip->ctx, &chip->pub, rstvec);
  14550. -
  14551. - /* restore ARM */
  14552. - core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_ARM_CR4);
  14553. -@@ -964,7 +964,7 @@ static bool brcmf_chip_cr4_exitdl(struct
  14554. - return true;
  14555. - }
  14556. -
  14557. --void brcmf_chip_enter_download(struct brcmf_chip *pub)
  14558. -+void brcmf_chip_set_passive(struct brcmf_chip *pub)
  14559. - {
  14560. - struct brcmf_chip_priv *chip;
  14561. - struct brcmf_core *arm;
  14562. -@@ -974,14 +974,14 @@ void brcmf_chip_enter_download(struct br
  14563. - chip = container_of(pub, struct brcmf_chip_priv, pub);
  14564. - arm = brcmf_chip_get_core(pub, BCMA_CORE_ARM_CR4);
  14565. - if (arm) {
  14566. -- brcmf_chip_cr4_enterdl(chip);
  14567. -+ brcmf_chip_cr4_set_passive(chip);
  14568. - return;
  14569. - }
  14570. -
  14571. -- brcmf_chip_cm3_enterdl(chip);
  14572. -+ brcmf_chip_cm3_set_passive(chip);
  14573. - }
  14574. -
  14575. --bool brcmf_chip_exit_download(struct brcmf_chip *pub, u32 rstvec)
  14576. -+bool brcmf_chip_set_active(struct brcmf_chip *pub, u32 rstvec)
  14577. - {
  14578. - struct brcmf_chip_priv *chip;
  14579. - struct brcmf_core *arm;
  14580. -@@ -991,9 +991,9 @@ bool brcmf_chip_exit_download(struct brc
  14581. - chip = container_of(pub, struct brcmf_chip_priv, pub);
  14582. - arm = brcmf_chip_get_core(pub, BCMA_CORE_ARM_CR4);
  14583. - if (arm)
  14584. -- return brcmf_chip_cr4_exitdl(chip, rstvec);
  14585. -+ return brcmf_chip_cr4_set_active(chip, rstvec);
  14586. -
  14587. -- return brcmf_chip_cm3_exitdl(chip);
  14588. -+ return brcmf_chip_cm3_set_active(chip);
  14589. - }
  14590. -
  14591. - bool brcmf_chip_sr_capable(struct brcmf_chip *pub)
  14592. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  14593. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  14594. -@@ -64,7 +64,7 @@ struct brcmf_core {
  14595. - * @write32: write 32-bit value over bus.
  14596. - * @prepare: prepare bus for core configuration.
  14597. - * @setup: bus-specific core setup.
  14598. -- * @exit_dl: exit download state.
  14599. -+ * @active: chip becomes active.
  14600. - * The callback should use the provided @rstvec when non-zero.
  14601. - */
  14602. - struct brcmf_buscore_ops {
  14603. -@@ -72,7 +72,7 @@ struct brcmf_buscore_ops {
  14604. - void (*write32)(void *ctx, u32 addr, u32 value);
  14605. - int (*prepare)(void *ctx);
  14606. - int (*setup)(void *ctx, struct brcmf_chip *chip);
  14607. -- void (*exit_dl)(void *ctx, struct brcmf_chip *chip, u32 rstvec);
  14608. -+ void (*activate)(void *ctx, struct brcmf_chip *chip, u32 rstvec);
  14609. - };
  14610. -
  14611. - struct brcmf_chip *brcmf_chip_attach(void *ctx,
  14612. -@@ -84,8 +84,8 @@ bool brcmf_chip_iscoreup(struct brcmf_co
  14613. - void brcmf_chip_coredisable(struct brcmf_core *core, u32 prereset, u32 reset);
  14614. - void brcmf_chip_resetcore(struct brcmf_core *core, u32 prereset, u32 reset,
  14615. - u32 postreset);
  14616. --void brcmf_chip_enter_download(struct brcmf_chip *ci);
  14617. --bool brcmf_chip_exit_download(struct brcmf_chip *ci, u32 rstvec);
  14618. -+void brcmf_chip_set_passive(struct brcmf_chip *ci);
  14619. -+bool brcmf_chip_set_active(struct brcmf_chip *ci, u32 rstvec);
  14620. - bool brcmf_chip_sr_capable(struct brcmf_chip *pub);
  14621. -
  14622. - #endif /* BRCMF_AXIDMP_H */
  14623. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  14624. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  14625. -@@ -509,7 +509,7 @@ static void brcmf_pcie_attach(struct brc
  14626. -
  14627. - static int brcmf_pcie_enter_download_state(struct brcmf_pciedev_info *devinfo)
  14628. - {
  14629. -- brcmf_chip_enter_download(devinfo->ci);
  14630. -+ brcmf_chip_set_passive(devinfo->ci);
  14631. -
  14632. - if (devinfo->ci->chip == BRCM_CC_43602_CHIP_ID) {
  14633. - brcmf_pcie_select_core(devinfo, BCMA_CORE_ARM_CR4);
  14634. -@@ -536,7 +536,7 @@ static int brcmf_pcie_exit_download_stat
  14635. - brcmf_chip_resetcore(core, 0, 0, 0);
  14636. - }
  14637. -
  14638. -- return !brcmf_chip_exit_download(devinfo->ci, resetintr);
  14639. -+ return !brcmf_chip_set_active(devinfo->ci, resetintr);
  14640. - }
  14641. -
  14642. -
  14643. -@@ -1566,8 +1566,8 @@ static int brcmf_pcie_buscoreprep(void *
  14644. - }
  14645. -
  14646. -
  14647. --static void brcmf_pcie_buscore_exitdl(void *ctx, struct brcmf_chip *chip,
  14648. -- u32 rstvec)
  14649. -+static void brcmf_pcie_buscore_activate(void *ctx, struct brcmf_chip *chip,
  14650. -+ u32 rstvec)
  14651. - {
  14652. - struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)ctx;
  14653. -
  14654. -@@ -1577,7 +1577,7 @@ static void brcmf_pcie_buscore_exitdl(vo
  14655. -
  14656. - static const struct brcmf_buscore_ops brcmf_pcie_buscore_ops = {
  14657. - .prepare = brcmf_pcie_buscoreprep,
  14658. -- .exit_dl = brcmf_pcie_buscore_exitdl,
  14659. -+ .activate = brcmf_pcie_buscore_activate,
  14660. - .read32 = brcmf_pcie_buscore_read32,
  14661. - .write32 = brcmf_pcie_buscore_write32,
  14662. - };
  14663. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14664. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14665. -@@ -3357,7 +3357,7 @@ static int brcmf_sdio_download_firmware(
  14666. - brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
  14667. -
  14668. - /* Keep arm in reset */
  14669. -- brcmf_chip_enter_download(bus->ci);
  14670. -+ brcmf_chip_set_passive(bus->ci);
  14671. -
  14672. - rstvec = get_unaligned_le32(fw->data);
  14673. - brcmf_dbg(SDIO, "firmware rstvec: %x\n", rstvec);
  14674. -@@ -3378,7 +3378,7 @@ static int brcmf_sdio_download_firmware(
  14675. - }
  14676. -
  14677. - /* Take arm out of reset */
  14678. -- if (!brcmf_chip_exit_download(bus->ci, rstvec)) {
  14679. -+ if (!brcmf_chip_set_active(bus->ci, rstvec)) {
  14680. - brcmf_err("error getting out of ARM core reset\n");
  14681. - goto err;
  14682. - }
  14683. -@@ -3771,8 +3771,8 @@ static int brcmf_sdio_buscoreprep(void *
  14684. - return 0;
  14685. - }
  14686. -
  14687. --static void brcmf_sdio_buscore_exitdl(void *ctx, struct brcmf_chip *chip,
  14688. -- u32 rstvec)
  14689. -+static void brcmf_sdio_buscore_activate(void *ctx, struct brcmf_chip *chip,
  14690. -+ u32 rstvec)
  14691. - {
  14692. - struct brcmf_sdio_dev *sdiodev = ctx;
  14693. - struct brcmf_core *core;
  14694. -@@ -3815,7 +3815,7 @@ static void brcmf_sdio_buscore_write32(v
  14695. -
  14696. - static const struct brcmf_buscore_ops brcmf_sdio_buscore_ops = {
  14697. - .prepare = brcmf_sdio_buscoreprep,
  14698. -- .exit_dl = brcmf_sdio_buscore_exitdl,
  14699. -+ .activate = brcmf_sdio_buscore_activate,
  14700. - .read32 = brcmf_sdio_buscore_read32,
  14701. - .write32 = brcmf_sdio_buscore_write32,
  14702. - };
  14703. -@@ -4239,12 +4239,11 @@ void brcmf_sdio_remove(struct brcmf_sdio
  14704. - sdio_claim_host(bus->sdiodev->func[1]);
  14705. - brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
  14706. - /* Leave the device in state where it is
  14707. -- * 'quiet'. This is done by putting it in
  14708. -- * download_state which essentially resets
  14709. -- * all necessary cores.
  14710. -+ * 'passive'. This is done by resetting all
  14711. -+ * necessary cores.
  14712. - */
  14713. - msleep(20);
  14714. -- brcmf_chip_enter_download(bus->ci);
  14715. -+ brcmf_chip_set_passive(bus->ci);
  14716. - brcmf_sdio_clkctl(bus, CLK_NONE, false);
  14717. - sdio_release_host(bus->sdiodev->func[1]);
  14718. - }
  14719. diff --git a/package/kernel/mac80211/patches/336-0004-brcmfmac-assure-device-is-ready-for-download-after-b.patch b/package/kernel/mac80211/patches/336-0004-brcmfmac-assure-device-is-ready-for-download-after-b.patch
  14720. deleted file mode 100644
  14721. index 6b1dd81..0000000
  14722. --- a/package/kernel/mac80211/patches/336-0004-brcmfmac-assure-device-is-ready-for-download-after-b.patch
  14723. +++ /dev/null
  14724. @@ -1,61 +0,0 @@
  14725. -From: Arend van Spriel <arend@broadcom.com>
  14726. -Date: Wed, 11 Mar 2015 16:11:30 +0100
  14727. -Subject: [PATCH] brcmfmac: assure device is ready for download after
  14728. - brcmf_chip_attach()
  14729. -
  14730. -Make the brcmf_chip_attach() function responsible for putting the
  14731. -device in a state where it is accessible for firmware download.
  14732. -
  14733. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14734. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14735. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14736. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14737. ----
  14738. -
  14739. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  14740. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  14741. -@@ -786,12 +786,6 @@ static int brcmf_chip_setup(struct brcmf
  14742. - if (chip->ops->setup)
  14743. - ret = chip->ops->setup(chip->ctx, pub);
  14744. -
  14745. -- /*
  14746. -- * Make sure any on-chip ARM is off (in case strapping is wrong),
  14747. -- * or downloaded code was already running.
  14748. -- */
  14749. -- brcmf_chip_disable_arm(chip, BCMA_CORE_ARM_CM3);
  14750. -- brcmf_chip_disable_arm(chip, BCMA_CORE_ARM_CR4);
  14751. - return ret;
  14752. - }
  14753. -
  14754. -@@ -833,6 +827,8 @@ struct brcmf_chip *brcmf_chip_attach(voi
  14755. - if (err < 0)
  14756. - goto fail;
  14757. -
  14758. -+ /* assure chip is passive for download */
  14759. -+ brcmf_chip_set_passive(&chip->pub);
  14760. - return &chip->pub;
  14761. -
  14762. - fail:
  14763. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  14764. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  14765. -@@ -509,8 +509,6 @@ static void brcmf_pcie_attach(struct brc
  14766. -
  14767. - static int brcmf_pcie_enter_download_state(struct brcmf_pciedev_info *devinfo)
  14768. - {
  14769. -- brcmf_chip_set_passive(devinfo->ci);
  14770. --
  14771. - if (devinfo->ci->chip == BRCM_CC_43602_CHIP_ID) {
  14772. - brcmf_pcie_select_core(devinfo, BCMA_CORE_ARM_CR4);
  14773. - brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_ARMCR4REG_BANKIDX,
  14774. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14775. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14776. -@@ -3356,9 +3356,6 @@ static int brcmf_sdio_download_firmware(
  14777. - sdio_claim_host(bus->sdiodev->func[1]);
  14778. - brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
  14779. -
  14780. -- /* Keep arm in reset */
  14781. -- brcmf_chip_set_passive(bus->ci);
  14782. --
  14783. - rstvec = get_unaligned_le32(fw->data);
  14784. - brcmf_dbg(SDIO, "firmware rstvec: %x\n", rstvec);
  14785. -
  14786. diff --git a/package/kernel/mac80211/patches/336-0005-brcmfmac-extract-ram-size-info-from-internal-memory-.patch b/package/kernel/mac80211/patches/336-0005-brcmfmac-extract-ram-size-info-from-internal-memory-.patch
  14787. deleted file mode 100644
  14788. index bcc2ed4..0000000
  14789. --- a/package/kernel/mac80211/patches/336-0005-brcmfmac-extract-ram-size-info-from-internal-memory-.patch
  14790. +++ /dev/null
  14791. @@ -1,367 +0,0 @@
  14792. -From: Arend van Spriel <arend@broadcom.com>
  14793. -Date: Wed, 11 Mar 2015 16:11:31 +0100
  14794. -Subject: [PATCH] brcmfmac: extract ram size info from internal memory
  14795. - registers
  14796. -
  14797. -Instead of hard-coded memory sizes it is possible to obtain that
  14798. -information from the internal memory registers.
  14799. -
  14800. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14801. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  14802. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14803. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14804. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14805. ----
  14806. -
  14807. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  14808. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  14809. -@@ -100,9 +100,6 @@
  14810. - #define BCM4329_CORE_SOCRAM_BASE 0x18003000
  14811. - /* ARM Cortex M3 core, ID 0x82a */
  14812. - #define BCM4329_CORE_ARM_BASE 0x18002000
  14813. --#define BCM4329_RAMSIZE 0x48000
  14814. --/* bcm43143 */
  14815. --#define BCM43143_RAMSIZE 0x70000
  14816. -
  14817. - #define CORE_SB(base, field) \
  14818. - (base + SBCONFIGOFF + offsetof(struct sbconfig, field))
  14819. -@@ -150,6 +147,78 @@ struct sbconfig {
  14820. - u32 sbidhigh; /* identification */
  14821. - };
  14822. -
  14823. -+/* bankidx and bankinfo reg defines corerev >= 8 */
  14824. -+#define SOCRAM_BANKINFO_RETNTRAM_MASK 0x00010000
  14825. -+#define SOCRAM_BANKINFO_SZMASK 0x0000007f
  14826. -+#define SOCRAM_BANKIDX_ROM_MASK 0x00000100
  14827. -+
  14828. -+#define SOCRAM_BANKIDX_MEMTYPE_SHIFT 8
  14829. -+/* socram bankinfo memtype */
  14830. -+#define SOCRAM_MEMTYPE_RAM 0
  14831. -+#define SOCRAM_MEMTYPE_R0M 1
  14832. -+#define SOCRAM_MEMTYPE_DEVRAM 2
  14833. -+
  14834. -+#define SOCRAM_BANKINFO_SZBASE 8192
  14835. -+#define SRCI_LSS_MASK 0x00f00000
  14836. -+#define SRCI_LSS_SHIFT 20
  14837. -+#define SRCI_SRNB_MASK 0xf0
  14838. -+#define SRCI_SRNB_SHIFT 4
  14839. -+#define SRCI_SRBSZ_MASK 0xf
  14840. -+#define SRCI_SRBSZ_SHIFT 0
  14841. -+#define SR_BSZ_BASE 14
  14842. -+
  14843. -+struct sbsocramregs {
  14844. -+ u32 coreinfo;
  14845. -+ u32 bwalloc;
  14846. -+ u32 extracoreinfo;
  14847. -+ u32 biststat;
  14848. -+ u32 bankidx;
  14849. -+ u32 standbyctrl;
  14850. -+
  14851. -+ u32 errlogstatus; /* rev 6 */
  14852. -+ u32 errlogaddr; /* rev 6 */
  14853. -+ /* used for patching rev 3 & 5 */
  14854. -+ u32 cambankidx;
  14855. -+ u32 cambankstandbyctrl;
  14856. -+ u32 cambankpatchctrl;
  14857. -+ u32 cambankpatchtblbaseaddr;
  14858. -+ u32 cambankcmdreg;
  14859. -+ u32 cambankdatareg;
  14860. -+ u32 cambankmaskreg;
  14861. -+ u32 PAD[1];
  14862. -+ u32 bankinfo; /* corev 8 */
  14863. -+ u32 bankpda;
  14864. -+ u32 PAD[14];
  14865. -+ u32 extmemconfig;
  14866. -+ u32 extmemparitycsr;
  14867. -+ u32 extmemparityerrdata;
  14868. -+ u32 extmemparityerrcnt;
  14869. -+ u32 extmemwrctrlandsize;
  14870. -+ u32 PAD[84];
  14871. -+ u32 workaround;
  14872. -+ u32 pwrctl; /* corerev >= 2 */
  14873. -+ u32 PAD[133];
  14874. -+ u32 sr_control; /* corerev >= 15 */
  14875. -+ u32 sr_status; /* corerev >= 15 */
  14876. -+ u32 sr_address; /* corerev >= 15 */
  14877. -+ u32 sr_data; /* corerev >= 15 */
  14878. -+};
  14879. -+
  14880. -+#define SOCRAMREGOFFS(_f) offsetof(struct sbsocramregs, _f)
  14881. -+
  14882. -+#define ARMCR4_CAP (0x04)
  14883. -+#define ARMCR4_BANKIDX (0x40)
  14884. -+#define ARMCR4_BANKINFO (0x44)
  14885. -+#define ARMCR4_BANKPDA (0x4C)
  14886. -+
  14887. -+#define ARMCR4_TCBBNB_MASK 0xf0
  14888. -+#define ARMCR4_TCBBNB_SHIFT 4
  14889. -+#define ARMCR4_TCBANB_MASK 0xf
  14890. -+#define ARMCR4_TCBANB_SHIFT 0
  14891. -+
  14892. -+#define ARMCR4_BSZ_MASK 0x3f
  14893. -+#define ARMCR4_BSZ_MULT 8192
  14894. -+
  14895. - struct brcmf_core_priv {
  14896. - struct brcmf_core pub;
  14897. - u32 wrapbase;
  14898. -@@ -443,10 +512,6 @@ static int brcmf_chip_cores_check(struct
  14899. - break;
  14900. - case BCMA_CORE_ARM_CR4:
  14901. - cpu_found = true;
  14902. -- if (ci->pub.rambase == 0) {
  14903. -- brcmf_err("RAM base not provided with ARM CR4 core\n");
  14904. -- return -ENOMEM;
  14905. -- }
  14906. - break;
  14907. - default:
  14908. - break;
  14909. -@@ -462,60 +527,160 @@ static int brcmf_chip_cores_check(struct
  14910. - brcmf_err("RAM core not provided with ARM CM3 core\n");
  14911. - return -ENODEV;
  14912. - }
  14913. -- if (!ci->pub.ramsize) {
  14914. -- brcmf_err("RAM size is undetermined\n");
  14915. -- return -ENOMEM;
  14916. -- }
  14917. - return 0;
  14918. - }
  14919. -
  14920. --static void brcmf_chip_get_raminfo(struct brcmf_chip_priv *ci)
  14921. -+static u32 brcmf_chip_core_read32(struct brcmf_core_priv *core, u16 reg)
  14922. - {
  14923. -- switch (ci->pub.chip) {
  14924. -- case BRCM_CC_4329_CHIP_ID:
  14925. -- ci->pub.ramsize = BCM4329_RAMSIZE;
  14926. -- break;
  14927. -- case BRCM_CC_43143_CHIP_ID:
  14928. -- ci->pub.ramsize = BCM43143_RAMSIZE;
  14929. -- break;
  14930. -- case BRCM_CC_43241_CHIP_ID:
  14931. -- ci->pub.ramsize = 0x90000;
  14932. -- break;
  14933. -- case BRCM_CC_4330_CHIP_ID:
  14934. -- ci->pub.ramsize = 0x48000;
  14935. -- break;
  14936. -+ return core->chip->ops->read32(core->chip->ctx, core->pub.base + reg);
  14937. -+}
  14938. -+
  14939. -+static void brcmf_chip_core_write32(struct brcmf_core_priv *core,
  14940. -+ u16 reg, u32 val)
  14941. -+{
  14942. -+ core->chip->ops->write32(core->chip->ctx, core->pub.base + reg, val);
  14943. -+}
  14944. -+
  14945. -+static bool brcmf_chip_socram_banksize(struct brcmf_core_priv *core, u8 idx,
  14946. -+ u32 *banksize)
  14947. -+{
  14948. -+ u32 bankinfo;
  14949. -+ u32 bankidx = (SOCRAM_MEMTYPE_RAM << SOCRAM_BANKIDX_MEMTYPE_SHIFT);
  14950. -+
  14951. -+ bankidx |= idx;
  14952. -+ brcmf_chip_core_write32(core, SOCRAMREGOFFS(bankidx), bankidx);
  14953. -+ bankinfo = brcmf_chip_core_read32(core, SOCRAMREGOFFS(bankinfo));
  14954. -+ *banksize = (bankinfo & SOCRAM_BANKINFO_SZMASK) + 1;
  14955. -+ *banksize *= SOCRAM_BANKINFO_SZBASE;
  14956. -+ return !!(bankinfo & SOCRAM_BANKINFO_RETNTRAM_MASK);
  14957. -+}
  14958. -+
  14959. -+static void brcmf_chip_socram_ramsize(struct brcmf_core_priv *sr, u32 *ramsize,
  14960. -+ u32 *srsize)
  14961. -+{
  14962. -+ u32 coreinfo;
  14963. -+ uint nb, banksize, lss;
  14964. -+ bool retent;
  14965. -+ int i;
  14966. -+
  14967. -+ *ramsize = 0;
  14968. -+ *srsize = 0;
  14969. -+
  14970. -+ if (WARN_ON(sr->pub.rev < 4))
  14971. -+ return;
  14972. -+
  14973. -+ if (!brcmf_chip_iscoreup(&sr->pub))
  14974. -+ brcmf_chip_resetcore(&sr->pub, 0, 0, 0);
  14975. -+
  14976. -+ /* Get info for determining size */
  14977. -+ coreinfo = brcmf_chip_core_read32(sr, SOCRAMREGOFFS(coreinfo));
  14978. -+ nb = (coreinfo & SRCI_SRNB_MASK) >> SRCI_SRNB_SHIFT;
  14979. -+
  14980. -+ if ((sr->pub.rev <= 7) || (sr->pub.rev == 12)) {
  14981. -+ banksize = (coreinfo & SRCI_SRBSZ_MASK);
  14982. -+ lss = (coreinfo & SRCI_LSS_MASK) >> SRCI_LSS_SHIFT;
  14983. -+ if (lss != 0)
  14984. -+ nb--;
  14985. -+ *ramsize = nb * (1 << (banksize + SR_BSZ_BASE));
  14986. -+ if (lss != 0)
  14987. -+ *ramsize += (1 << ((lss - 1) + SR_BSZ_BASE));
  14988. -+ } else {
  14989. -+ nb = (coreinfo & SRCI_SRNB_MASK) >> SRCI_SRNB_SHIFT;
  14990. -+ for (i = 0; i < nb; i++) {
  14991. -+ retent = brcmf_chip_socram_banksize(sr, i, &banksize);
  14992. -+ *ramsize += banksize;
  14993. -+ if (retent)
  14994. -+ *srsize += banksize;
  14995. -+ }
  14996. -+ }
  14997. -+
  14998. -+ /* hardcoded save&restore memory sizes */
  14999. -+ switch (sr->chip->pub.chip) {
  15000. - case BRCM_CC_4334_CHIP_ID:
  15001. -- case BRCM_CC_43340_CHIP_ID:
  15002. -- ci->pub.ramsize = 0x80000;
  15003. -+ if (sr->chip->pub.chiprev < 2)
  15004. -+ *srsize = (32 * 1024);
  15005. - break;
  15006. -- case BRCM_CC_4335_CHIP_ID:
  15007. -- ci->pub.ramsize = 0xc0000;
  15008. -- ci->pub.rambase = 0x180000;
  15009. -- break;
  15010. -- case BRCM_CC_43362_CHIP_ID:
  15011. -- ci->pub.ramsize = 0x3c000;
  15012. -+ default:
  15013. - break;
  15014. -+ }
  15015. -+}
  15016. -+
  15017. -+/** Return the TCM-RAM size of the ARMCR4 core. */
  15018. -+static u32 brcmf_chip_tcm_ramsize(struct brcmf_core_priv *cr4)
  15019. -+{
  15020. -+ u32 corecap;
  15021. -+ u32 memsize = 0;
  15022. -+ u32 nab;
  15023. -+ u32 nbb;
  15024. -+ u32 totb;
  15025. -+ u32 bxinfo;
  15026. -+ u32 idx;
  15027. -+
  15028. -+ corecap = brcmf_chip_core_read32(cr4, ARMCR4_CAP);
  15029. -+
  15030. -+ nab = (corecap & ARMCR4_TCBANB_MASK) >> ARMCR4_TCBANB_SHIFT;
  15031. -+ nbb = (corecap & ARMCR4_TCBBNB_MASK) >> ARMCR4_TCBBNB_SHIFT;
  15032. -+ totb = nab + nbb;
  15033. -+
  15034. -+ for (idx = 0; idx < totb; idx++) {
  15035. -+ brcmf_chip_core_write32(cr4, ARMCR4_BANKIDX, idx);
  15036. -+ bxinfo = brcmf_chip_core_read32(cr4, ARMCR4_BANKINFO);
  15037. -+ memsize += ((bxinfo & ARMCR4_BSZ_MASK) + 1) * ARMCR4_BSZ_MULT;
  15038. -+ }
  15039. -+
  15040. -+ return memsize;
  15041. -+}
  15042. -+
  15043. -+static u32 brcmf_chip_tcm_rambase(struct brcmf_chip_priv *ci)
  15044. -+{
  15045. -+ switch (ci->pub.chip) {
  15046. - case BRCM_CC_4345_CHIP_ID:
  15047. -- ci->pub.ramsize = 0xc8000;
  15048. -- ci->pub.rambase = 0x198000;
  15049. -- break;
  15050. -+ return 0x198000;
  15051. -+ case BRCM_CC_4335_CHIP_ID:
  15052. - case BRCM_CC_4339_CHIP_ID:
  15053. - case BRCM_CC_4354_CHIP_ID:
  15054. - case BRCM_CC_4356_CHIP_ID:
  15055. - case BRCM_CC_43567_CHIP_ID:
  15056. - case BRCM_CC_43569_CHIP_ID:
  15057. - case BRCM_CC_43570_CHIP_ID:
  15058. -- ci->pub.ramsize = 0xc0000;
  15059. -- ci->pub.rambase = 0x180000;
  15060. -- break;
  15061. - case BRCM_CC_43602_CHIP_ID:
  15062. -- ci->pub.ramsize = 0xf0000;
  15063. -- ci->pub.rambase = 0x180000;
  15064. -- break;
  15065. -+ return 0x180000;
  15066. - default:
  15067. - brcmf_err("unknown chip: %s\n", ci->pub.name);
  15068. - break;
  15069. - }
  15070. -+ return 0;
  15071. -+}
  15072. -+
  15073. -+static int brcmf_chip_get_raminfo(struct brcmf_chip_priv *ci)
  15074. -+{
  15075. -+ struct brcmf_core_priv *mem_core;
  15076. -+ struct brcmf_core *mem;
  15077. -+
  15078. -+ mem = brcmf_chip_get_core(&ci->pub, BCMA_CORE_ARM_CR4);
  15079. -+ if (mem) {
  15080. -+ mem_core = container_of(mem, struct brcmf_core_priv, pub);
  15081. -+ ci->pub.ramsize = brcmf_chip_tcm_ramsize(mem_core);
  15082. -+ ci->pub.rambase = brcmf_chip_tcm_rambase(ci);
  15083. -+ if (!ci->pub.rambase) {
  15084. -+ brcmf_err("RAM base not provided with ARM CR4 core\n");
  15085. -+ return -EINVAL;
  15086. -+ }
  15087. -+ } else {
  15088. -+ mem = brcmf_chip_get_core(&ci->pub, BCMA_CORE_INTERNAL_MEM);
  15089. -+ mem_core = container_of(mem, struct brcmf_core_priv, pub);
  15090. -+ brcmf_chip_socram_ramsize(mem_core, &ci->pub.ramsize,
  15091. -+ &ci->pub.srsize);
  15092. -+ }
  15093. -+ brcmf_dbg(INFO, "RAM: base=0x%x size=%d (0x%x) sr=%d (0x%x)\n",
  15094. -+ ci->pub.rambase, ci->pub.ramsize, ci->pub.ramsize,
  15095. -+ ci->pub.srsize, ci->pub.srsize);
  15096. -+
  15097. -+ if (!ci->pub.ramsize) {
  15098. -+ brcmf_err("RAM size is undetermined\n");
  15099. -+ return -ENOMEM;
  15100. -+ }
  15101. -+ return 0;
  15102. - }
  15103. -
  15104. - static u32 brcmf_chip_dmp_get_desc(struct brcmf_chip_priv *ci, u32 *eromaddr,
  15105. -@@ -668,6 +833,7 @@ static int brcmf_chip_recognition(struct
  15106. - struct brcmf_core *core;
  15107. - u32 regdata;
  15108. - u32 socitype;
  15109. -+ int ret;
  15110. -
  15111. - /* Get CC core rev
  15112. - * Chipid is assume to be at offset 0 from SI_ENUM_BASE
  15113. -@@ -720,9 +886,13 @@ static int brcmf_chip_recognition(struct
  15114. - return -ENODEV;
  15115. - }
  15116. -
  15117. -- brcmf_chip_get_raminfo(ci);
  15118. --
  15119. -- return brcmf_chip_cores_check(ci);
  15120. -+ ret = brcmf_chip_cores_check(ci);
  15121. -+ if (ret)
  15122. -+ return ret;
  15123. -+
  15124. -+ /* assure chip is passive for core access */
  15125. -+ brcmf_chip_set_passive(&ci->pub);
  15126. -+ return brcmf_chip_get_raminfo(ci);
  15127. - }
  15128. -
  15129. - static void brcmf_chip_disable_arm(struct brcmf_chip_priv *chip, u16 id)
  15130. -@@ -827,8 +997,6 @@ struct brcmf_chip *brcmf_chip_attach(voi
  15131. - if (err < 0)
  15132. - goto fail;
  15133. -
  15134. -- /* assure chip is passive for download */
  15135. -- brcmf_chip_set_passive(&chip->pub);
  15136. - return &chip->pub;
  15137. -
  15138. - fail:
  15139. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  15140. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  15141. -@@ -30,7 +30,8 @@
  15142. - * @pmucaps: PMU capabilities.
  15143. - * @pmurev: PMU revision.
  15144. - * @rambase: RAM base address (only applicable for ARM CR4 chips).
  15145. -- * @ramsize: amount of RAM on chip.
  15146. -+ * @ramsize: amount of RAM on chip including retention.
  15147. -+ * @srsize: amount of retention RAM on chip.
  15148. - * @name: string representation of the chip identifier.
  15149. - */
  15150. - struct brcmf_chip {
  15151. -@@ -41,6 +42,7 @@ struct brcmf_chip {
  15152. - u32 pmurev;
  15153. - u32 rambase;
  15154. - u32 ramsize;
  15155. -+ u32 srsize;
  15156. - char name[8];
  15157. - };
  15158. -
  15159. diff --git a/package/kernel/mac80211/patches/336-0006-brcmfmac-take-save-restore-memory-into-account-for-S.patch b/package/kernel/mac80211/patches/336-0006-brcmfmac-take-save-restore-memory-into-account-for-S.patch
  15160. deleted file mode 100644
  15161. index 69618a7..0000000
  15162. --- a/package/kernel/mac80211/patches/336-0006-brcmfmac-take-save-restore-memory-into-account-for-S.patch
  15163. +++ /dev/null
  15164. @@ -1,96 +0,0 @@
  15165. -From: Arend van Spriel <arend@broadcom.com>
  15166. -Date: Wed, 11 Mar 2015 16:11:32 +0100
  15167. -Subject: [PATCH] brcmfmac: take save&restore memory into account for SDIO
  15168. - shared info
  15169. -
  15170. -The firmware provides pointer to SDIO shared information at end of
  15171. -RAM during firmware initialization. End of RAM is obviously determined
  15172. -by the actual ram size, but part of that may be used for save&restore
  15173. -memory. In that case another location in RAM will hold the pointer.
  15174. -
  15175. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15176. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15177. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15178. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15179. ----
  15180. -
  15181. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15182. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15183. -@@ -1067,44 +1067,47 @@ static inline bool brcmf_sdio_valid_shar
  15184. - static int brcmf_sdio_readshared(struct brcmf_sdio *bus,
  15185. - struct sdpcm_shared *sh)
  15186. - {
  15187. -- u32 addr;
  15188. -+ u32 addr = 0;
  15189. - int rv;
  15190. - u32 shaddr = 0;
  15191. - struct sdpcm_shared_le sh_le;
  15192. - __le32 addr_le;
  15193. -
  15194. -- shaddr = bus->ci->rambase + bus->ci->ramsize - 4;
  15195. -+ sdio_claim_host(bus->sdiodev->func[1]);
  15196. -+ brcmf_sdio_bus_sleep(bus, false, false);
  15197. -
  15198. - /*
  15199. - * Read last word in socram to determine
  15200. - * address of sdpcm_shared structure
  15201. - */
  15202. -- sdio_claim_host(bus->sdiodev->func[1]);
  15203. -- brcmf_sdio_bus_sleep(bus, false, false);
  15204. -- rv = brcmf_sdiod_ramrw(bus->sdiodev, false, shaddr, (u8 *)&addr_le, 4);
  15205. -- sdio_release_host(bus->sdiodev->func[1]);
  15206. -+ shaddr = bus->ci->rambase + bus->ci->ramsize - 4;
  15207. -+ if (!bus->ci->rambase && brcmf_chip_sr_capable(bus->ci))
  15208. -+ shaddr -= bus->ci->srsize;
  15209. -+ rv = brcmf_sdiod_ramrw(bus->sdiodev, false, shaddr,
  15210. -+ (u8 *)&addr_le, 4);
  15211. - if (rv < 0)
  15212. -- return rv;
  15213. --
  15214. -- addr = le32_to_cpu(addr_le);
  15215. --
  15216. -- brcmf_dbg(SDIO, "sdpcm_shared address 0x%08X\n", addr);
  15217. -+ goto fail;
  15218. -
  15219. - /*
  15220. - * Check if addr is valid.
  15221. - * NVRAM length at the end of memory should have been overwritten.
  15222. - */
  15223. -+ addr = le32_to_cpu(addr_le);
  15224. - if (!brcmf_sdio_valid_shared_address(addr)) {
  15225. -- brcmf_err("invalid sdpcm_shared address 0x%08X\n",
  15226. -- addr);
  15227. -- return -EINVAL;
  15228. -+ brcmf_err("invalid sdpcm_shared address 0x%08X\n", addr);
  15229. -+ rv = -EINVAL;
  15230. -+ goto fail;
  15231. - }
  15232. -
  15233. -+ brcmf_dbg(INFO, "sdpcm_shared address 0x%08X\n", addr);
  15234. -+
  15235. - /* Read hndrte_shared structure */
  15236. - rv = brcmf_sdiod_ramrw(bus->sdiodev, false, addr, (u8 *)&sh_le,
  15237. - sizeof(struct sdpcm_shared_le));
  15238. - if (rv < 0)
  15239. -- return rv;
  15240. -+ goto fail;
  15241. -+
  15242. -+ sdio_release_host(bus->sdiodev->func[1]);
  15243. -
  15244. - /* Endianness */
  15245. - sh->flags = le32_to_cpu(sh_le.flags);
  15246. -@@ -1121,8 +1124,13 @@ static int brcmf_sdio_readshared(struct
  15247. - sh->flags & SDPCM_SHARED_VERSION_MASK);
  15248. - return -EPROTO;
  15249. - }
  15250. --
  15251. - return 0;
  15252. -+
  15253. -+fail:
  15254. -+ brcmf_err("unable to obtain sdpcm_shared info: rv=%d (addr=0x%x)\n",
  15255. -+ rv, addr);
  15256. -+ sdio_release_host(bus->sdiodev->func[1]);
  15257. -+ return rv;
  15258. - }
  15259. -
  15260. - static void brcmf_sdio_get_console_addr(struct brcmf_sdio *bus)
  15261. diff --git a/package/kernel/mac80211/patches/336-0007-brcmfmac-fix-watchdog-timer-regression.patch b/package/kernel/mac80211/patches/336-0007-brcmfmac-fix-watchdog-timer-regression.patch
  15262. deleted file mode 100644
  15263. index 1b10dbb..0000000
  15264. --- a/package/kernel/mac80211/patches/336-0007-brcmfmac-fix-watchdog-timer-regression.patch
  15265. +++ /dev/null
  15266. @@ -1,59 +0,0 @@
  15267. -From: Arend van Spriel <arend@broadcom.com>
  15268. -Date: Wed, 11 Mar 2015 16:11:33 +0100
  15269. -Subject: [PATCH] brcmfmac: fix watchdog timer regression
  15270. -
  15271. -The watchdog timer is used to put the device in a low-power mode when
  15272. -it is idle for some time. This timer is stopped during that mode and
  15273. -should be restarted upon activity. This has been broken by commit
  15274. -d4150fced0365 ("brcmfmac: Simplify watchdog sleep."). This patch
  15275. -restores the behaviour as it was before that commit.
  15276. -
  15277. -Reported-by: Pontus Fuchs <pontusf@broadcom.com>
  15278. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15279. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15280. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15281. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15282. ----
  15283. -
  15284. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15285. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15286. -@@ -972,7 +972,6 @@ static int brcmf_sdio_clkctl(struct brcm
  15287. - brcmf_sdio_sdclk(bus, true);
  15288. - /* Now request HT Avail on the backplane */
  15289. - brcmf_sdio_htclk(bus, true, pendok);
  15290. -- brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  15291. - break;
  15292. -
  15293. - case CLK_SDONLY:
  15294. -@@ -984,7 +983,6 @@ static int brcmf_sdio_clkctl(struct brcm
  15295. - else
  15296. - brcmf_err("request for %d -> %d\n",
  15297. - bus->clkstate, target);
  15298. -- brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  15299. - break;
  15300. -
  15301. - case CLK_NONE:
  15302. -@@ -993,7 +991,6 @@ static int brcmf_sdio_clkctl(struct brcm
  15303. - brcmf_sdio_htclk(bus, false, false);
  15304. - /* Now remove the SD clock */
  15305. - brcmf_sdio_sdclk(bus, false);
  15306. -- brcmf_sdio_wd_timer(bus, 0);
  15307. - break;
  15308. - }
  15309. - #ifdef DEBUG
  15310. -@@ -1048,6 +1045,7 @@ end:
  15311. - brcmf_sdio_clkctl(bus, CLK_NONE, pendok);
  15312. - } else {
  15313. - brcmf_sdio_clkctl(bus, CLK_AVAIL, pendok);
  15314. -+ brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  15315. - }
  15316. - bus->sleeping = sleep;
  15317. - brcmf_dbg(SDIO, "new state %s\n",
  15318. -@@ -4242,6 +4240,7 @@ void brcmf_sdio_remove(struct brcmf_sdio
  15319. - if (bus->ci) {
  15320. - if (bus->sdiodev->state != BRCMF_SDIOD_NOMEDIUM) {
  15321. - sdio_claim_host(bus->sdiodev->func[1]);
  15322. -+ brcmf_sdio_wd_timer(bus, 0);
  15323. - brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
  15324. - /* Leave the device in state where it is
  15325. - * 'passive'. This is done by resetting all
  15326. diff --git a/package/kernel/mac80211/patches/337-0001-brcmfmac-avoid-runtime-pm-for-sdio-host-controller.patch b/package/kernel/mac80211/patches/337-0001-brcmfmac-avoid-runtime-pm-for-sdio-host-controller.patch
  15327. deleted file mode 100644
  15328. index af76f13..0000000
  15329. --- a/package/kernel/mac80211/patches/337-0001-brcmfmac-avoid-runtime-pm-for-sdio-host-controller.patch
  15330. +++ /dev/null
  15331. @@ -1,44 +0,0 @@
  15332. -From: Arend van Spriel <arend@broadcom.com>
  15333. -Date: Wed, 18 Mar 2015 13:25:21 +0100
  15334. -Subject: [PATCH] brcmfmac: avoid runtime-pm for sdio host controller
  15335. -
  15336. -Several host controllers supporting runtime-pm are causing issues
  15337. -with our sdio wireless cards because they disable the sdio interrupt
  15338. -upon going into runtime suspend. This patch avoids that by doing
  15339. -a pm_runtime_forbid() call during the probe. Tested with Sony Vaio
  15340. -Duo 13 which uses sdhci-acpi host controller.
  15341. -
  15342. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15343. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  15344. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15345. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15346. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15347. ----
  15348. -
  15349. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  15350. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  15351. -@@ -29,6 +29,7 @@
  15352. - #include <linux/mmc/host.h>
  15353. - #include <linux/platform_device.h>
  15354. - #include <linux/platform_data/brcmfmac-sdio.h>
  15355. -+#include <linux/pm_runtime.h>
  15356. - #include <linux/suspend.h>
  15357. - #include <linux/errno.h>
  15358. - #include <linux/module.h>
  15359. -@@ -1006,6 +1007,7 @@ static int brcmf_sdiod_remove(struct brc
  15360. - sg_free_table(&sdiodev->sgtable);
  15361. - sdiodev->sbwad = 0;
  15362. -
  15363. -+ pm_runtime_allow(sdiodev->func[1]->card->host->parent);
  15364. - return 0;
  15365. - }
  15366. -
  15367. -@@ -1074,7 +1076,7 @@ static int brcmf_sdiod_probe(struct brcm
  15368. - ret = -ENODEV;
  15369. - goto out;
  15370. - }
  15371. --
  15372. -+ pm_runtime_forbid(host->parent);
  15373. - out:
  15374. - if (ret)
  15375. - brcmf_sdiod_remove(sdiodev);
  15376. diff --git a/package/kernel/mac80211/patches/337-0002-brcmfmac-Add-necessary-memory-barriers-for-SDIO.patch b/package/kernel/mac80211/patches/337-0002-brcmfmac-Add-necessary-memory-barriers-for-SDIO.patch
  15377. deleted file mode 100644
  15378. index c419cc6..0000000
  15379. --- a/package/kernel/mac80211/patches/337-0002-brcmfmac-Add-necessary-memory-barriers-for-SDIO.patch
  15380. +++ /dev/null
  15381. @@ -1,171 +0,0 @@
  15382. -From: Hante Meuleman <meuleman@broadcom.com>
  15383. -Date: Wed, 18 Mar 2015 13:25:22 +0100
  15384. -Subject: [PATCH] brcmfmac: Add necessary memory barriers for SDIO.
  15385. -
  15386. -SDIO uses a thread to handle all communication with the device,
  15387. -for this data is exchanged between threads. This data needs proper
  15388. -memory barriers to make sure that data "exchange" is going correct.
  15389. -
  15390. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  15391. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  15392. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15393. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  15394. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  15395. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15396. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15397. ----
  15398. -
  15399. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15400. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15401. -@@ -507,8 +507,8 @@ struct brcmf_sdio {
  15402. -
  15403. - struct workqueue_struct *brcmf_wq;
  15404. - struct work_struct datawork;
  15405. -- atomic_t dpc_tskcnt;
  15406. -- atomic_t dpc_running;
  15407. -+ bool dpc_triggered;
  15408. -+ bool dpc_running;
  15409. -
  15410. - bool txoff; /* Transmit flow-controlled */
  15411. - struct brcmf_sdio_count sdcnt;
  15412. -@@ -2713,6 +2713,7 @@ static void brcmf_sdio_dpc(struct brcmf_
  15413. - err = brcmf_sdio_tx_ctrlframe(bus, bus->ctrl_frame_buf,
  15414. - bus->ctrl_frame_len);
  15415. - bus->ctrl_frame_err = err;
  15416. -+ wmb();
  15417. - bus->ctrl_frame_stat = false;
  15418. - }
  15419. - sdio_release_host(bus->sdiodev->func[1]);
  15420. -@@ -2734,6 +2735,7 @@ static void brcmf_sdio_dpc(struct brcmf_
  15421. - sdio_claim_host(bus->sdiodev->func[1]);
  15422. - if (bus->ctrl_frame_stat) {
  15423. - bus->ctrl_frame_err = -ENODEV;
  15424. -+ wmb();
  15425. - bus->ctrl_frame_stat = false;
  15426. - brcmf_sdio_wait_event_wakeup(bus);
  15427. - }
  15428. -@@ -2744,7 +2746,7 @@ static void brcmf_sdio_dpc(struct brcmf_
  15429. - (!atomic_read(&bus->fcstate) &&
  15430. - brcmu_pktq_mlen(&bus->txq, ~bus->flowcontrol) &&
  15431. - data_ok(bus))) {
  15432. -- atomic_inc(&bus->dpc_tskcnt);
  15433. -+ bus->dpc_triggered = true;
  15434. - }
  15435. - }
  15436. -
  15437. -@@ -2940,6 +2942,7 @@ brcmf_sdio_bus_txctl(struct device *dev,
  15438. - /* Send from dpc */
  15439. - bus->ctrl_frame_buf = msg;
  15440. - bus->ctrl_frame_len = msglen;
  15441. -+ wmb();
  15442. - bus->ctrl_frame_stat = true;
  15443. -
  15444. - brcmf_sdio_trigger_dpc(bus);
  15445. -@@ -2958,6 +2961,7 @@ brcmf_sdio_bus_txctl(struct device *dev,
  15446. - if (!ret) {
  15447. - brcmf_dbg(SDIO, "ctrl_frame complete, err=%d\n",
  15448. - bus->ctrl_frame_err);
  15449. -+ rmb();
  15450. - ret = bus->ctrl_frame_err;
  15451. - }
  15452. -
  15453. -@@ -3526,8 +3530,8 @@ done:
  15454. -
  15455. - void brcmf_sdio_trigger_dpc(struct brcmf_sdio *bus)
  15456. - {
  15457. -- if (atomic_read(&bus->dpc_tskcnt) == 0) {
  15458. -- atomic_inc(&bus->dpc_tskcnt);
  15459. -+ if (!bus->dpc_triggered) {
  15460. -+ bus->dpc_triggered = true;
  15461. - queue_work(bus->brcmf_wq, &bus->datawork);
  15462. - }
  15463. - }
  15464. -@@ -3558,7 +3562,7 @@ void brcmf_sdio_isr(struct brcmf_sdio *b
  15465. - if (!bus->intr)
  15466. - brcmf_err("isr w/o interrupt configured!\n");
  15467. -
  15468. -- atomic_inc(&bus->dpc_tskcnt);
  15469. -+ bus->dpc_triggered = true;
  15470. - queue_work(bus->brcmf_wq, &bus->datawork);
  15471. - }
  15472. -
  15473. -@@ -3578,7 +3582,7 @@ static void brcmf_sdio_bus_watchdog(stru
  15474. - if (!bus->intr ||
  15475. - (bus->sdcnt.intrcount == bus->sdcnt.lastintrs)) {
  15476. -
  15477. -- if (atomic_read(&bus->dpc_tskcnt) == 0) {
  15478. -+ if (!bus->dpc_triggered) {
  15479. - u8 devpend;
  15480. -
  15481. - sdio_claim_host(bus->sdiodev->func[1]);
  15482. -@@ -3596,7 +3600,7 @@ static void brcmf_sdio_bus_watchdog(stru
  15483. - bus->sdcnt.pollcnt++;
  15484. - atomic_set(&bus->ipend, 1);
  15485. -
  15486. -- atomic_inc(&bus->dpc_tskcnt);
  15487. -+ bus->dpc_triggered = true;
  15488. - queue_work(bus->brcmf_wq, &bus->datawork);
  15489. - }
  15490. - }
  15491. -@@ -3623,17 +3627,21 @@ static void brcmf_sdio_bus_watchdog(stru
  15492. - #endif /* DEBUG */
  15493. -
  15494. - /* On idle timeout clear activity flag and/or turn off clock */
  15495. -- if ((atomic_read(&bus->dpc_tskcnt) == 0) &&
  15496. -- (atomic_read(&bus->dpc_running) == 0) &&
  15497. -- (bus->idletime > 0) && (bus->clkstate == CLK_AVAIL)) {
  15498. -- bus->idlecount++;
  15499. -- if (bus->idlecount > bus->idletime) {
  15500. -- brcmf_dbg(SDIO, "idle\n");
  15501. -- sdio_claim_host(bus->sdiodev->func[1]);
  15502. -- brcmf_sdio_wd_timer(bus, 0);
  15503. -+ if (!bus->dpc_triggered) {
  15504. -+ rmb();
  15505. -+ if ((!bus->dpc_running) && (bus->idletime > 0) &&
  15506. -+ (bus->clkstate == CLK_AVAIL)) {
  15507. -+ bus->idlecount++;
  15508. -+ if (bus->idlecount > bus->idletime) {
  15509. -+ brcmf_dbg(SDIO, "idle\n");
  15510. -+ sdio_claim_host(bus->sdiodev->func[1]);
  15511. -+ brcmf_sdio_wd_timer(bus, 0);
  15512. -+ bus->idlecount = 0;
  15513. -+ brcmf_sdio_bus_sleep(bus, true, false);
  15514. -+ sdio_release_host(bus->sdiodev->func[1]);
  15515. -+ }
  15516. -+ } else {
  15517. - bus->idlecount = 0;
  15518. -- brcmf_sdio_bus_sleep(bus, true, false);
  15519. -- sdio_release_host(bus->sdiodev->func[1]);
  15520. - }
  15521. - } else {
  15522. - bus->idlecount = 0;
  15523. -@@ -3645,13 +3653,14 @@ static void brcmf_sdio_dataworker(struct
  15524. - struct brcmf_sdio *bus = container_of(work, struct brcmf_sdio,
  15525. - datawork);
  15526. -
  15527. -- while (atomic_read(&bus->dpc_tskcnt)) {
  15528. -- atomic_set(&bus->dpc_running, 1);
  15529. -- atomic_set(&bus->dpc_tskcnt, 0);
  15530. -+ bus->dpc_running = true;
  15531. -+ wmb();
  15532. -+ while (ACCESS_ONCE(bus->dpc_triggered)) {
  15533. -+ bus->dpc_triggered = false;
  15534. - brcmf_sdio_dpc(bus);
  15535. - bus->idlecount = 0;
  15536. -- atomic_set(&bus->dpc_running, 0);
  15537. - }
  15538. -+ bus->dpc_running = false;
  15539. - if (brcmf_sdiod_freezing(bus->sdiodev)) {
  15540. - brcmf_sdiod_change_state(bus->sdiodev, BRCMF_SDIOD_DOWN);
  15541. - brcmf_sdiod_try_freeze(bus->sdiodev);
  15542. -@@ -4144,8 +4153,8 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
  15543. - bus->watchdog_tsk = NULL;
  15544. - }
  15545. - /* Initialize DPC thread */
  15546. -- atomic_set(&bus->dpc_tskcnt, 0);
  15547. -- atomic_set(&bus->dpc_running, 0);
  15548. -+ bus->dpc_triggered = false;
  15549. -+ bus->dpc_running = false;
  15550. -
  15551. - /* Assign bus interface call back */
  15552. - bus->sdiodev->bus_if->dev = bus->sdiodev->dev;
  15553. diff --git a/package/kernel/mac80211/patches/337-0003-brcmfmac-Remove-unnecessary-new-line-in-pcie-console.patch b/package/kernel/mac80211/patches/337-0003-brcmfmac-Remove-unnecessary-new-line-in-pcie-console.patch
  15554. deleted file mode 100644
  15555. index 1bc98a0..0000000
  15556. --- a/package/kernel/mac80211/patches/337-0003-brcmfmac-Remove-unnecessary-new-line-in-pcie-console.patch
  15557. +++ /dev/null
  15558. @@ -1,26 +0,0 @@
  15559. -From: Hante Meuleman <meuleman@broadcom.com>
  15560. -Date: Wed, 18 Mar 2015 13:25:24 +0100
  15561. -Subject: [PATCH] brcmfmac: Remove unnecessary new-line in pcie console
  15562. - logging.
  15563. -
  15564. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  15565. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15566. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  15567. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15568. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15569. ----
  15570. -
  15571. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  15572. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  15573. -@@ -651,10 +651,9 @@ static void brcmf_pcie_bus_console_read(
  15574. - console->log_str[console->log_idx] = ch;
  15575. - console->log_idx++;
  15576. - }
  15577. --
  15578. - if (ch == '\n') {
  15579. - console->log_str[console->log_idx] = 0;
  15580. -- brcmf_dbg(PCIE, "CONSOLE: %s\n", console->log_str);
  15581. -+ brcmf_dbg(PCIE, "CONSOLE: %s", console->log_str);
  15582. - console->log_idx = 0;
  15583. - }
  15584. - }
  15585. diff --git a/package/kernel/mac80211/patches/337-0004-brcmfmac-add-MODULE_FIRMWARE-macros-for-bcm4356-PCIe.patch b/package/kernel/mac80211/patches/337-0004-brcmfmac-add-MODULE_FIRMWARE-macros-for-bcm4356-PCIe.patch
  15586. deleted file mode 100644
  15587. index fcf0bf3..0000000
  15588. --- a/package/kernel/mac80211/patches/337-0004-brcmfmac-add-MODULE_FIRMWARE-macros-for-bcm4356-PCIe.patch
  15589. +++ /dev/null
  15590. @@ -1,26 +0,0 @@
  15591. -From: Arend van Spriel <arend@broadcom.com>
  15592. -Date: Wed, 18 Mar 2015 13:25:25 +0100
  15593. -Subject: [PATCH] brcmfmac: add MODULE_FIRMWARE() macros for bcm4356 PCIe
  15594. - device
  15595. -
  15596. -The BCM4356 PCIe wireless device was added recently but overlooked
  15597. -the fact that the MODULE_FIRMWARE() macros were missing for the
  15598. -firmwares needed by this device.
  15599. -
  15600. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15601. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15602. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15603. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15604. ----
  15605. -
  15606. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  15607. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  15608. -@@ -189,6 +189,8 @@ MODULE_FIRMWARE(BRCMF_PCIE_43602_FW_NAME
  15609. - MODULE_FIRMWARE(BRCMF_PCIE_43602_NVRAM_NAME);
  15610. - MODULE_FIRMWARE(BRCMF_PCIE_4354_FW_NAME);
  15611. - MODULE_FIRMWARE(BRCMF_PCIE_4354_NVRAM_NAME);
  15612. -+MODULE_FIRMWARE(BRCMF_PCIE_4356_FW_NAME);
  15613. -+MODULE_FIRMWARE(BRCMF_PCIE_4356_NVRAM_NAME);
  15614. - MODULE_FIRMWARE(BRCMF_PCIE_43570_FW_NAME);
  15615. - MODULE_FIRMWARE(BRCMF_PCIE_43570_NVRAM_NAME);
  15616. -
  15617. diff --git a/package/kernel/mac80211/patches/337-0005-brcmfmac-add-support-for-BCM43430-SDIO-chipset.patch b/package/kernel/mac80211/patches/337-0005-brcmfmac-add-support-for-BCM43430-SDIO-chipset.patch
  15618. deleted file mode 100644
  15619. index b3e9bc9..0000000
  15620. --- a/package/kernel/mac80211/patches/337-0005-brcmfmac-add-support-for-BCM43430-SDIO-chipset.patch
  15621. +++ /dev/null
  15622. @@ -1,138 +0,0 @@
  15623. -From: Arend van Spriel <arend@broadcom.com>
  15624. -Date: Wed, 18 Mar 2015 13:25:26 +0100
  15625. -Subject: [PATCH] brcmfmac: add support for BCM43430 SDIO chipset
  15626. -
  15627. -This patch added support for the BCM43430 802.11n SDIO chipset.
  15628. -
  15629. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15630. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  15631. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  15632. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15633. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15634. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15635. ----
  15636. -
  15637. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  15638. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  15639. -@@ -1098,6 +1098,7 @@ static const struct sdio_device_id brcmf
  15640. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43341),
  15641. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43362),
  15642. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4335_4339),
  15643. -+ BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43430),
  15644. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4345),
  15645. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4354),
  15646. - { /* end: all zeroes */ }
  15647. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  15648. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  15649. -@@ -600,6 +600,12 @@ static void brcmf_chip_socram_ramsize(st
  15650. - if (sr->chip->pub.chiprev < 2)
  15651. - *srsize = (32 * 1024);
  15652. - break;
  15653. -+ case BRCM_CC_43430_CHIP_ID:
  15654. -+ /* assume sr for now as we can not check
  15655. -+ * firmware sr capability at this point.
  15656. -+ */
  15657. -+ *srsize = (64 * 1024);
  15658. -+ break;
  15659. - default:
  15660. - break;
  15661. - }
  15662. -@@ -1072,6 +1078,7 @@ static void
  15663. - brcmf_chip_cm3_set_passive(struct brcmf_chip_priv *chip)
  15664. - {
  15665. - struct brcmf_core *core;
  15666. -+ struct brcmf_core_priv *sr;
  15667. -
  15668. - brcmf_chip_disable_arm(chip, BCMA_CORE_ARM_CM3);
  15669. - core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_80211);
  15670. -@@ -1081,6 +1088,13 @@ brcmf_chip_cm3_set_passive(struct brcmf_
  15671. - D11_BCMA_IOCTL_PHYCLOCKEN);
  15672. - core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_INTERNAL_MEM);
  15673. - brcmf_chip_resetcore(core, 0, 0, 0);
  15674. -+
  15675. -+ /* disable bank #3 remap for this device */
  15676. -+ if (chip->pub.chip == BRCM_CC_43430_CHIP_ID) {
  15677. -+ sr = container_of(core, struct brcmf_core_priv, pub);
  15678. -+ brcmf_chip_core_write32(sr, SOCRAMREGOFFS(bankidx), 3);
  15679. -+ brcmf_chip_core_write32(sr, SOCRAMREGOFFS(bankpda), 0);
  15680. -+ }
  15681. - }
  15682. -
  15683. - static bool brcmf_chip_cm3_set_active(struct brcmf_chip_priv *chip)
  15684. -@@ -1188,6 +1202,10 @@ bool brcmf_chip_sr_capable(struct brcmf_
  15685. - addr = CORE_CC_REG(base, chipcontrol_data);
  15686. - reg = chip->ops->read32(chip->ctx, addr);
  15687. - return (reg & pmu_cc3_mask) != 0;
  15688. -+ case BRCM_CC_43430_CHIP_ID:
  15689. -+ addr = CORE_CC_REG(base, sr_control1);
  15690. -+ reg = chip->ops->read32(chip->ctx, addr);
  15691. -+ return reg != 0;
  15692. - default:
  15693. - addr = CORE_CC_REG(base, pmucapabilities_ext);
  15694. - reg = chip->ops->read32(chip->ctx, addr);
  15695. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15696. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15697. -@@ -615,6 +615,8 @@ static const struct sdiod_drive_str sdio
  15698. - #define BCM43362_NVRAM_NAME "brcm/brcmfmac43362-sdio.txt"
  15699. - #define BCM4339_FIRMWARE_NAME "brcm/brcmfmac4339-sdio.bin"
  15700. - #define BCM4339_NVRAM_NAME "brcm/brcmfmac4339-sdio.txt"
  15701. -+#define BCM43430_FIRMWARE_NAME "brcm/brcmfmac43430-sdio.bin"
  15702. -+#define BCM43430_NVRAM_NAME "brcm/brcmfmac43430-sdio.txt"
  15703. - #define BCM4345_FIRMWARE_NAME "brcm/brcmfmac4345-sdio.bin"
  15704. - #define BCM4345_NVRAM_NAME "brcm/brcmfmac4345-sdio.txt"
  15705. - #define BCM4354_FIRMWARE_NAME "brcm/brcmfmac4354-sdio.bin"
  15706. -@@ -640,6 +642,8 @@ MODULE_FIRMWARE(BCM43362_FIRMWARE_NAME);
  15707. - MODULE_FIRMWARE(BCM43362_NVRAM_NAME);
  15708. - MODULE_FIRMWARE(BCM4339_FIRMWARE_NAME);
  15709. - MODULE_FIRMWARE(BCM4339_NVRAM_NAME);
  15710. -+MODULE_FIRMWARE(BCM43430_FIRMWARE_NAME);
  15711. -+MODULE_FIRMWARE(BCM43430_NVRAM_NAME);
  15712. - MODULE_FIRMWARE(BCM4345_FIRMWARE_NAME);
  15713. - MODULE_FIRMWARE(BCM4345_NVRAM_NAME);
  15714. - MODULE_FIRMWARE(BCM4354_FIRMWARE_NAME);
  15715. -@@ -671,6 +675,7 @@ static const struct brcmf_firmware_names
  15716. - { BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4335) },
  15717. - { BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, BRCMF_FIRMWARE_NVRAM(BCM43362) },
  15718. - { BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4339) },
  15719. -+ { BRCM_CC_43430_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM43430) },
  15720. - { BRCM_CC_4345_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4345) },
  15721. - { BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4354) }
  15722. - };
  15723. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  15724. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  15725. -@@ -37,6 +37,7 @@
  15726. - #define BRCM_CC_43362_CHIP_ID 43362
  15727. - #define BRCM_CC_4335_CHIP_ID 0x4335
  15728. - #define BRCM_CC_4339_CHIP_ID 0x4339
  15729. -+#define BRCM_CC_43430_CHIP_ID 43430
  15730. - #define BRCM_CC_4345_CHIP_ID 0x4345
  15731. - #define BRCM_CC_4354_CHIP_ID 0x4354
  15732. - #define BRCM_CC_4356_CHIP_ID 0x4356
  15733. ---- a/drivers/net/wireless/brcm80211/include/chipcommon.h
  15734. -+++ b/drivers/net/wireless/brcm80211/include/chipcommon.h
  15735. -@@ -183,7 +183,14 @@ struct chipcregs {
  15736. - u8 uart1lsr;
  15737. - u8 uart1msr;
  15738. - u8 uart1scratch;
  15739. -- u32 PAD[126];
  15740. -+ u32 PAD[62];
  15741. -+
  15742. -+ /* save/restore, corerev >= 48 */
  15743. -+ u32 sr_capability; /* 0x500 */
  15744. -+ u32 sr_control0; /* 0x504 */
  15745. -+ u32 sr_control1; /* 0x508 */
  15746. -+ u32 gpio_control; /* 0x50C */
  15747. -+ u32 PAD[60];
  15748. -
  15749. - /* PMU registers (corerev >= 20) */
  15750. - u32 pmucontrol; /* 0x600 */
  15751. ---- a/include/linux/mmc/sdio_ids.h
  15752. -+++ b/include/linux/mmc/sdio_ids.h
  15753. -@@ -33,6 +33,7 @@
  15754. - #define SDIO_DEVICE_ID_BROADCOM_43341 0xa94d
  15755. - #define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335
  15756. - #define SDIO_DEVICE_ID_BROADCOM_43362 0xa962
  15757. -+#define SDIO_DEVICE_ID_BROADCOM_43430 0xa9a6
  15758. - #define SDIO_DEVICE_ID_BROADCOM_4345 0x4345
  15759. - #define SDIO_DEVICE_ID_BROADCOM_4354 0x4354
  15760. -
  15761. diff --git a/package/kernel/mac80211/patches/337-0006-brcmfmac-only-support-the-BCM43455-7-device.patch b/package/kernel/mac80211/patches/337-0006-brcmfmac-only-support-the-BCM43455-7-device.patch
  15762. deleted file mode 100644
  15763. index c3d7bc2..0000000
  15764. --- a/package/kernel/mac80211/patches/337-0006-brcmfmac-only-support-the-BCM43455-7-device.patch
  15765. +++ /dev/null
  15766. @@ -1,50 +0,0 @@
  15767. -From: Arend van Spriel <arend@broadcom.com>
  15768. -Date: Wed, 18 Mar 2015 13:25:27 +0100
  15769. -Subject: [PATCH] brcmfmac: only support the BCM43455/7 device
  15770. -
  15771. -Recently support was added for the BCM4345 SDIO chipset by
  15772. -commit 9c51026509d7 ("brcmfmac: Add support for BCM4345 SDIO chipset")
  15773. -however this was verified using a BCM43455 device, which is
  15774. -a more recent revision of the chip. This patch assure that
  15775. -older revisions are not probed as they would fail.
  15776. -
  15777. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15778. -Reviewed-by: Syed Asifful Dayyan <syedd@broadcom.com>
  15779. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15780. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15781. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15782. ----
  15783. -
  15784. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15785. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15786. -@@ -617,8 +617,8 @@ static const struct sdiod_drive_str sdio
  15787. - #define BCM4339_NVRAM_NAME "brcm/brcmfmac4339-sdio.txt"
  15788. - #define BCM43430_FIRMWARE_NAME "brcm/brcmfmac43430-sdio.bin"
  15789. - #define BCM43430_NVRAM_NAME "brcm/brcmfmac43430-sdio.txt"
  15790. --#define BCM4345_FIRMWARE_NAME "brcm/brcmfmac4345-sdio.bin"
  15791. --#define BCM4345_NVRAM_NAME "brcm/brcmfmac4345-sdio.txt"
  15792. -+#define BCM43455_FIRMWARE_NAME "brcm/brcmfmac43455-sdio.bin"
  15793. -+#define BCM43455_NVRAM_NAME "brcm/brcmfmac43455-sdio.txt"
  15794. - #define BCM4354_FIRMWARE_NAME "brcm/brcmfmac4354-sdio.bin"
  15795. - #define BCM4354_NVRAM_NAME "brcm/brcmfmac4354-sdio.txt"
  15796. -
  15797. -@@ -644,8 +644,8 @@ MODULE_FIRMWARE(BCM4339_FIRMWARE_NAME);
  15798. - MODULE_FIRMWARE(BCM4339_NVRAM_NAME);
  15799. - MODULE_FIRMWARE(BCM43430_FIRMWARE_NAME);
  15800. - MODULE_FIRMWARE(BCM43430_NVRAM_NAME);
  15801. --MODULE_FIRMWARE(BCM4345_FIRMWARE_NAME);
  15802. --MODULE_FIRMWARE(BCM4345_NVRAM_NAME);
  15803. -+MODULE_FIRMWARE(BCM43455_FIRMWARE_NAME);
  15804. -+MODULE_FIRMWARE(BCM43455_NVRAM_NAME);
  15805. - MODULE_FIRMWARE(BCM4354_FIRMWARE_NAME);
  15806. - MODULE_FIRMWARE(BCM4354_NVRAM_NAME);
  15807. -
  15808. -@@ -676,7 +676,7 @@ static const struct brcmf_firmware_names
  15809. - { BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, BRCMF_FIRMWARE_NVRAM(BCM43362) },
  15810. - { BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4339) },
  15811. - { BRCM_CC_43430_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM43430) },
  15812. -- { BRCM_CC_4345_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4345) },
  15813. -+ { BRCM_CC_4345_CHIP_ID, 0xFFFFFFC0, BRCMF_FIRMWARE_NVRAM(BCM43455) },
  15814. - { BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4354) }
  15815. - };
  15816. -
  15817. diff --git a/package/kernel/mac80211/patches/337-0007-brcmfmac-remove-support-for-unreleased-BCM4354-PCIe.patch b/package/kernel/mac80211/patches/337-0007-brcmfmac-remove-support-for-unreleased-BCM4354-PCIe.patch
  15818. deleted file mode 100644
  15819. index a62cfdf..0000000
  15820. --- a/package/kernel/mac80211/patches/337-0007-brcmfmac-remove-support-for-unreleased-BCM4354-PCIe.patch
  15821. +++ /dev/null
  15822. @@ -1,52 +0,0 @@
  15823. -From: Arend van Spriel <arend@broadcom.com>
  15824. -Date: Wed, 18 Mar 2015 13:25:28 +0100
  15825. -Subject: [PATCH] brcmfmac: remove support for unreleased BCM4354 PCIe
  15826. -
  15827. -There are no known BCM4354 PCIe devices released so removing
  15828. -support from the driver until proven otherwise.
  15829. -
  15830. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15831. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15832. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15833. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15834. ----
  15835. -
  15836. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  15837. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  15838. -@@ -47,8 +47,6 @@ enum brcmf_pcie_state {
  15839. -
  15840. - #define BRCMF_PCIE_43602_FW_NAME "brcm/brcmfmac43602-pcie.bin"
  15841. - #define BRCMF_PCIE_43602_NVRAM_NAME "brcm/brcmfmac43602-pcie.txt"
  15842. --#define BRCMF_PCIE_4354_FW_NAME "brcm/brcmfmac4354-pcie.bin"
  15843. --#define BRCMF_PCIE_4354_NVRAM_NAME "brcm/brcmfmac4354-pcie.txt"
  15844. - #define BRCMF_PCIE_4356_FW_NAME "brcm/brcmfmac4356-pcie.bin"
  15845. - #define BRCMF_PCIE_4356_NVRAM_NAME "brcm/brcmfmac4356-pcie.txt"
  15846. - #define BRCMF_PCIE_43570_FW_NAME "brcm/brcmfmac43570-pcie.bin"
  15847. -@@ -187,8 +185,6 @@ enum brcmf_pcie_state {
  15848. -
  15849. - MODULE_FIRMWARE(BRCMF_PCIE_43602_FW_NAME);
  15850. - MODULE_FIRMWARE(BRCMF_PCIE_43602_NVRAM_NAME);
  15851. --MODULE_FIRMWARE(BRCMF_PCIE_4354_FW_NAME);
  15852. --MODULE_FIRMWARE(BRCMF_PCIE_4354_NVRAM_NAME);
  15853. - MODULE_FIRMWARE(BRCMF_PCIE_4356_FW_NAME);
  15854. - MODULE_FIRMWARE(BRCMF_PCIE_4356_NVRAM_NAME);
  15855. - MODULE_FIRMWARE(BRCMF_PCIE_43570_FW_NAME);
  15856. -@@ -1327,10 +1323,6 @@ static int brcmf_pcie_get_fwnames(struct
  15857. - fw_name = BRCMF_PCIE_43602_FW_NAME;
  15858. - nvram_name = BRCMF_PCIE_43602_NVRAM_NAME;
  15859. - break;
  15860. -- case BRCM_CC_4354_CHIP_ID:
  15861. -- fw_name = BRCMF_PCIE_4354_FW_NAME;
  15862. -- nvram_name = BRCMF_PCIE_4354_NVRAM_NAME;
  15863. -- break;
  15864. - case BRCM_CC_4356_CHIP_ID:
  15865. - fw_name = BRCMF_PCIE_4356_FW_NAME;
  15866. - nvram_name = BRCMF_PCIE_4356_NVRAM_NAME;
  15867. -@@ -1855,7 +1847,6 @@ cleanup:
  15868. - PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 }
  15869. -
  15870. - static struct pci_device_id brcmf_pcie_devid_table[] = {
  15871. -- BRCMF_PCIE_DEVICE(BRCM_PCIE_4354_DEVICE_ID),
  15872. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4356_DEVICE_ID),
  15873. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43567_DEVICE_ID),
  15874. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43570_DEVICE_ID),
  15875. diff --git a/package/kernel/mac80211/patches/338-brcmfmac-disable-MBSS-feature-for-BCM43362.patch b/package/kernel/mac80211/patches/338-brcmfmac-disable-MBSS-feature-for-BCM43362.patch
  15876. deleted file mode 100644
  15877. index 366ff85..0000000
  15878. --- a/package/kernel/mac80211/patches/338-brcmfmac-disable-MBSS-feature-for-BCM43362.patch
  15879. +++ /dev/null
  15880. @@ -1,28 +0,0 @@
  15881. -From: Arend van Spriel <arend@broadcom.com>
  15882. -Date: Fri, 20 Mar 2015 22:18:17 +0100
  15883. -Subject: [PATCH] brcmfmac: disable MBSS feature for BCM43362
  15884. -
  15885. -The BCM43362 firmware falsely reports it is capable of providing
  15886. -MBSS. As a result AP mode no longer works for this device. Therefor
  15887. -disable MBSS in the driver for this chipset.
  15888. -
  15889. -Cc: stable@vger.kernel.org # 3.19.y
  15890. -Reported-by: Jorg Krause <jkrause@posteo.de>
  15891. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15892. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15893. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15894. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15895. ----
  15896. -
  15897. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  15898. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  15899. -@@ -126,7 +126,8 @@ void brcmf_feat_attach(struct brcmf_pub
  15900. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_MCHAN, "mchan");
  15901. - if (drvr->bus_if->wowl_supported)
  15902. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_WOWL, "wowl");
  15903. -- brcmf_feat_iovar_int_set(ifp, BRCMF_FEAT_MBSS, "mbss", 0);
  15904. -+ if (drvr->bus_if->chip != BRCM_CC_43362_CHIP_ID)
  15905. -+ brcmf_feat_iovar_int_set(ifp, BRCMF_FEAT_MBSS, "mbss", 0);
  15906. -
  15907. - /* set chip related quirks */
  15908. - switch (drvr->bus_if->chip) {
  15909. diff --git a/package/kernel/mac80211/patches/339-0001-brcmfmac-use-static-superset-of-channels-for-wiphy-b.patch b/package/kernel/mac80211/patches/339-0001-brcmfmac-use-static-superset-of-channels-for-wiphy-b.patch
  15910. deleted file mode 100644
  15911. index 6e461f6..0000000
  15912. --- a/package/kernel/mac80211/patches/339-0001-brcmfmac-use-static-superset-of-channels-for-wiphy-b.patch
  15913. +++ /dev/null
  15914. @@ -1,300 +0,0 @@
  15915. -From: Arend van Spriel <arend@broadcom.com>
  15916. -Date: Tue, 14 Apr 2015 20:10:24 +0200
  15917. -Subject: [PATCH] brcmfmac: use static superset of channels for wiphy
  15918. - bands
  15919. -
  15920. -The driver was constructing a list of channels per wiphy band
  15921. -by querying the device. This list is not what the hardware is
  15922. -able to do as it is already filtered by the country setting in
  15923. -the device. As user-space may change the country this would
  15924. -require updating the channel list which is not recommended [1].
  15925. -This patch introduces a superset of channels. The individual
  15926. -channels are disabled appropriately by querying the device.
  15927. -
  15928. -[1] http://mid.gmane.org/1426706320.3001.21.camel@sipsolutions.net
  15929. -
  15930. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15931. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  15932. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15933. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15934. ----
  15935. -
  15936. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  15937. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  15938. -@@ -129,13 +129,47 @@ static struct ieee80211_rate __wl_rates[
  15939. - RATETAB_ENT(BRCM_RATE_54M, 0),
  15940. - };
  15941. -
  15942. --#define wl_a_rates (__wl_rates + 4)
  15943. --#define wl_a_rates_size 8
  15944. - #define wl_g_rates (__wl_rates + 0)
  15945. --#define wl_g_rates_size 12
  15946. -+#define wl_g_rates_size ARRAY_SIZE(__wl_rates)
  15947. -+#define wl_a_rates (__wl_rates + 4)
  15948. -+#define wl_a_rates_size (wl_g_rates_size - 4)
  15949. -+
  15950. -+#define CHAN2G(_channel, _freq) { \
  15951. -+ .band = IEEE80211_BAND_2GHZ, \
  15952. -+ .center_freq = (_freq), \
  15953. -+ .hw_value = (_channel), \
  15954. -+ .flags = IEEE80211_CHAN_DISABLED, \
  15955. -+ .max_antenna_gain = 0, \
  15956. -+ .max_power = 30, \
  15957. -+}
  15958. -+
  15959. -+#define CHAN5G(_channel) { \
  15960. -+ .band = IEEE80211_BAND_5GHZ, \
  15961. -+ .center_freq = 5000 + (5 * (_channel)), \
  15962. -+ .hw_value = (_channel), \
  15963. -+ .flags = IEEE80211_CHAN_DISABLED, \
  15964. -+ .max_antenna_gain = 0, \
  15965. -+ .max_power = 30, \
  15966. -+}
  15967. -+
  15968. -+static struct ieee80211_channel __wl_2ghz_channels[] = {
  15969. -+ CHAN2G(1, 2412), CHAN2G(2, 2417), CHAN2G(3, 2422), CHAN2G(4, 2427),
  15970. -+ CHAN2G(5, 2432), CHAN2G(6, 2437), CHAN2G(7, 2442), CHAN2G(8, 2447),
  15971. -+ CHAN2G(9, 2452), CHAN2G(10, 2457), CHAN2G(11, 2462), CHAN2G(12, 2467),
  15972. -+ CHAN2G(13, 2472), CHAN2G(14, 2484)
  15973. -+};
  15974. -+
  15975. -+static struct ieee80211_channel __wl_5ghz_channels[] = {
  15976. -+ CHAN5G(34), CHAN5G(36), CHAN5G(38), CHAN5G(40), CHAN5G(42),
  15977. -+ CHAN5G(44), CHAN5G(46), CHAN5G(48), CHAN5G(52), CHAN5G(56),
  15978. -+ CHAN5G(60), CHAN5G(64), CHAN5G(100), CHAN5G(104), CHAN5G(108),
  15979. -+ CHAN5G(112), CHAN5G(116), CHAN5G(120), CHAN5G(124), CHAN5G(128),
  15980. -+ CHAN5G(132), CHAN5G(136), CHAN5G(140), CHAN5G(144), CHAN5G(149),
  15981. -+ CHAN5G(153), CHAN5G(157), CHAN5G(161), CHAN5G(165)
  15982. -+};
  15983. -
  15984. - /* Band templates duplicated per wiphy. The channel info
  15985. -- * is filled in after querying the device.
  15986. -+ * above is added to the band during setup.
  15987. - */
  15988. - static const struct ieee80211_supported_band __wl_band_2ghz = {
  15989. - .band = IEEE80211_BAND_2GHZ,
  15990. -@@ -143,7 +177,7 @@ static const struct ieee80211_supported_
  15991. - .n_bitrates = wl_g_rates_size,
  15992. - };
  15993. -
  15994. --static const struct ieee80211_supported_band __wl_band_5ghz_a = {
  15995. -+static const struct ieee80211_supported_band __wl_band_5ghz = {
  15996. - .band = IEEE80211_BAND_5GHZ,
  15997. - .bitrates = wl_a_rates,
  15998. - .n_bitrates = wl_a_rates_size,
  15999. -@@ -5252,40 +5286,6 @@ dongle_scantime_out:
  16000. - return err;
  16001. - }
  16002. -
  16003. --/* Filter the list of channels received from firmware counting only
  16004. -- * the 20MHz channels. The wiphy band data only needs those which get
  16005. -- * flagged to indicate if they can take part in higher bandwidth.
  16006. -- */
  16007. --static void brcmf_count_20mhz_channels(struct brcmf_cfg80211_info *cfg,
  16008. -- struct brcmf_chanspec_list *chlist,
  16009. -- u32 chcnt[])
  16010. --{
  16011. -- u32 total = le32_to_cpu(chlist->count);
  16012. -- struct brcmu_chan ch;
  16013. -- int i;
  16014. --
  16015. -- for (i = 0; i < total; i++) {
  16016. -- ch.chspec = (u16)le32_to_cpu(chlist->element[i]);
  16017. -- cfg->d11inf.decchspec(&ch);
  16018. --
  16019. -- /* Firmware gives a ordered list. We skip non-20MHz
  16020. -- * channels is 2G. For 5G we can abort upon reaching
  16021. -- * a non-20MHz channel in the list.
  16022. -- */
  16023. -- if (ch.bw != BRCMU_CHAN_BW_20) {
  16024. -- if (ch.band == BRCMU_CHAN_BAND_5G)
  16025. -- break;
  16026. -- else
  16027. -- continue;
  16028. -- }
  16029. --
  16030. -- if (ch.band == BRCMU_CHAN_BAND_2G)
  16031. -- chcnt[0] += 1;
  16032. -- else if (ch.band == BRCMU_CHAN_BAND_5G)
  16033. -- chcnt[1] += 1;
  16034. -- }
  16035. --}
  16036. --
  16037. - static void brcmf_update_bw40_channel_flag(struct ieee80211_channel *channel,
  16038. - struct brcmu_chan *ch)
  16039. - {
  16040. -@@ -5321,7 +5321,6 @@ static int brcmf_construct_chaninfo(stru
  16041. - u32 i, j;
  16042. - u32 total;
  16043. - u32 chaninfo;
  16044. -- u32 chcnt[2] = { 0, 0 };
  16045. - u32 index;
  16046. -
  16047. - pbuf = kzalloc(BRCMF_DCMD_MEDLEN, GFP_KERNEL);
  16048. -@@ -5338,42 +5337,15 @@ static int brcmf_construct_chaninfo(stru
  16049. - goto fail_pbuf;
  16050. - }
  16051. -
  16052. -- brcmf_count_20mhz_channels(cfg, list, chcnt);
  16053. - wiphy = cfg_to_wiphy(cfg);
  16054. -- if (chcnt[0]) {
  16055. -- band = kmemdup(&__wl_band_2ghz, sizeof(__wl_band_2ghz),
  16056. -- GFP_KERNEL);
  16057. -- if (band == NULL) {
  16058. -- err = -ENOMEM;
  16059. -- goto fail_pbuf;
  16060. -- }
  16061. -- band->channels = kcalloc(chcnt[0], sizeof(*channel),
  16062. -- GFP_KERNEL);
  16063. -- if (band->channels == NULL) {
  16064. -- kfree(band);
  16065. -- err = -ENOMEM;
  16066. -- goto fail_pbuf;
  16067. -- }
  16068. -- band->n_channels = 0;
  16069. -- wiphy->bands[IEEE80211_BAND_2GHZ] = band;
  16070. -- }
  16071. -- if (chcnt[1]) {
  16072. -- band = kmemdup(&__wl_band_5ghz_a, sizeof(__wl_band_5ghz_a),
  16073. -- GFP_KERNEL);
  16074. -- if (band == NULL) {
  16075. -- err = -ENOMEM;
  16076. -- goto fail_band2g;
  16077. -- }
  16078. -- band->channels = kcalloc(chcnt[1], sizeof(*channel),
  16079. -- GFP_KERNEL);
  16080. -- if (band->channels == NULL) {
  16081. -- kfree(band);
  16082. -- err = -ENOMEM;
  16083. -- goto fail_band2g;
  16084. -- }
  16085. -- band->n_channels = 0;
  16086. -- wiphy->bands[IEEE80211_BAND_5GHZ] = band;
  16087. -- }
  16088. -+ band = wiphy->bands[IEEE80211_BAND_2GHZ];
  16089. -+ if (band)
  16090. -+ for (i = 0; i < band->n_channels; i++)
  16091. -+ band->channels[i].flags = IEEE80211_CHAN_DISABLED;
  16092. -+ band = wiphy->bands[IEEE80211_BAND_5GHZ];
  16093. -+ if (band)
  16094. -+ for (i = 0; i < band->n_channels; i++)
  16095. -+ band->channels[i].flags = IEEE80211_CHAN_DISABLED;
  16096. -
  16097. - total = le32_to_cpu(list->count);
  16098. - for (i = 0; i < total; i++) {
  16099. -@@ -5388,6 +5360,8 @@ static int brcmf_construct_chaninfo(stru
  16100. - brcmf_err("Invalid channel Spec. 0x%x.\n", ch.chspec);
  16101. - continue;
  16102. - }
  16103. -+ if (!band)
  16104. -+ continue;
  16105. - if (!(bw_cap[band->band] & WLC_BW_40MHZ_BIT) &&
  16106. - ch.bw == BRCMU_CHAN_BW_40)
  16107. - continue;
  16108. -@@ -5415,9 +5389,9 @@ static int brcmf_construct_chaninfo(stru
  16109. - } else if (ch.bw == BRCMU_CHAN_BW_40) {
  16110. - brcmf_update_bw40_channel_flag(&channel[index], &ch);
  16111. - } else {
  16112. -- /* disable other bandwidths for now as mentioned
  16113. -- * order assure they are enabled for subsequent
  16114. -- * chanspecs.
  16115. -+ /* enable the channel and disable other bandwidths
  16116. -+ * for now as mentioned order assure they are enabled
  16117. -+ * for subsequent chanspecs.
  16118. - */
  16119. - channel[index].flags = IEEE80211_CHAN_NO_HT40 |
  16120. - IEEE80211_CHAN_NO_80MHZ;
  16121. -@@ -5436,16 +5410,8 @@ static int brcmf_construct_chaninfo(stru
  16122. - IEEE80211_CHAN_NO_IR;
  16123. - }
  16124. - }
  16125. -- if (index == band->n_channels)
  16126. -- band->n_channels++;
  16127. - }
  16128. -- kfree(pbuf);
  16129. -- return 0;
  16130. -
  16131. --fail_band2g:
  16132. -- kfree(wiphy->bands[IEEE80211_BAND_2GHZ]->channels);
  16133. -- kfree(wiphy->bands[IEEE80211_BAND_2GHZ]);
  16134. -- wiphy->bands[IEEE80211_BAND_2GHZ] = NULL;
  16135. - fail_pbuf:
  16136. - kfree(pbuf);
  16137. - return err;
  16138. -@@ -5778,7 +5744,12 @@ static void brcmf_wiphy_wowl_params(stru
  16139. -
  16140. - static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
  16141. - {
  16142. -+ struct ieee80211_supported_band *band;
  16143. - struct ieee80211_iface_combination ifc_combo;
  16144. -+ __le32 bandlist[3];
  16145. -+ u32 n_bands;
  16146. -+ int err, i;
  16147. -+
  16148. - wiphy->max_scan_ssids = WL_NUM_SCAN_MAX;
  16149. - wiphy->max_scan_ie_len = BRCMF_SCAN_IE_LEN_MAX;
  16150. - wiphy->max_num_pmkids = WL_NUM_PMKIDS_MAX;
  16151. -@@ -5820,7 +5791,52 @@ static int brcmf_setup_wiphy(struct wiph
  16152. - if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL))
  16153. - brcmf_wiphy_wowl_params(wiphy);
  16154. -
  16155. -- return brcmf_setup_wiphybands(wiphy);
  16156. -+ err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BANDLIST, &bandlist,
  16157. -+ sizeof(bandlist));
  16158. -+ if (err) {
  16159. -+ brcmf_err("could not obtain band info: err=%d\n", err);
  16160. -+ return err;
  16161. -+ }
  16162. -+ /* first entry in bandlist is number of bands */
  16163. -+ n_bands = le32_to_cpu(bandlist[0]);
  16164. -+ for (i = 1; i <= n_bands && i < ARRAY_SIZE(bandlist); i++) {
  16165. -+ if (bandlist[i] == cpu_to_le32(WLC_BAND_2G)) {
  16166. -+ band = kmemdup(&__wl_band_2ghz, sizeof(__wl_band_2ghz),
  16167. -+ GFP_KERNEL);
  16168. -+ if (!band)
  16169. -+ return -ENOMEM;
  16170. -+
  16171. -+ band->channels = kmemdup(&__wl_2ghz_channels,
  16172. -+ sizeof(__wl_2ghz_channels),
  16173. -+ GFP_KERNEL);
  16174. -+ if (!band->channels) {
  16175. -+ kfree(band);
  16176. -+ return -ENOMEM;
  16177. -+ }
  16178. -+
  16179. -+ band->n_channels = ARRAY_SIZE(__wl_2ghz_channels);
  16180. -+ wiphy->bands[IEEE80211_BAND_2GHZ] = band;
  16181. -+ }
  16182. -+ if (bandlist[i] == cpu_to_le32(WLC_BAND_5G)) {
  16183. -+ band = kmemdup(&__wl_band_5ghz, sizeof(__wl_band_5ghz),
  16184. -+ GFP_KERNEL);
  16185. -+ if (!band)
  16186. -+ return -ENOMEM;
  16187. -+
  16188. -+ band->channels = kmemdup(&__wl_5ghz_channels,
  16189. -+ sizeof(__wl_5ghz_channels),
  16190. -+ GFP_KERNEL);
  16191. -+ if (!band->channels) {
  16192. -+ kfree(band);
  16193. -+ return -ENOMEM;
  16194. -+ }
  16195. -+
  16196. -+ band->n_channels = ARRAY_SIZE(__wl_5ghz_channels);
  16197. -+ wiphy->bands[IEEE80211_BAND_5GHZ] = band;
  16198. -+ }
  16199. -+ }
  16200. -+ err = brcmf_setup_wiphybands(wiphy);
  16201. -+ return err;
  16202. - }
  16203. -
  16204. - static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg)
  16205. -@@ -6011,6 +6027,9 @@ static void brcmf_cfg80211_reg_notifier(
  16206. -
  16207. - static void brcmf_free_wiphy(struct wiphy *wiphy)
  16208. - {
  16209. -+ if (!wiphy)
  16210. -+ return;
  16211. -+
  16212. - kfree(wiphy->iface_combinations);
  16213. - if (wiphy->bands[IEEE80211_BAND_2GHZ]) {
  16214. - kfree(wiphy->bands[IEEE80211_BAND_2GHZ]->channels);
  16215. diff --git a/package/kernel/mac80211/patches/339-0002-brcmfmac-update-wiphy-band-information-upon-updating.patch b/package/kernel/mac80211/patches/339-0002-brcmfmac-update-wiphy-band-information-upon-updating.patch
  16216. deleted file mode 100644
  16217. index a0c22eb..0000000
  16218. --- a/package/kernel/mac80211/patches/339-0002-brcmfmac-update-wiphy-band-information-upon-updating.patch
  16219. +++ /dev/null
  16220. @@ -1,29 +0,0 @@
  16221. -From: Arend van Spriel <arend@broadcom.com>
  16222. -Date: Tue, 14 Apr 2015 20:10:25 +0200
  16223. -Subject: [PATCH] brcmfmac: update wiphy band information upon updating
  16224. - regulatory domain
  16225. -
  16226. -When change the country code the available channels may change. So
  16227. -the wiphy bands should be updated accordingly.
  16228. -
  16229. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  16230. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16231. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16232. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16233. ----
  16234. -
  16235. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  16236. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  16237. -@@ -6022,7 +6022,11 @@ static void brcmf_cfg80211_reg_notifier(
  16238. - memset(&ccreq, 0, sizeof(ccreq));
  16239. - ccreq.rev = cpu_to_le32(-1);
  16240. - memcpy(ccreq.ccode, req->alpha2, sizeof(req->alpha2));
  16241. -- brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq));
  16242. -+ if (brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq))) {
  16243. -+ brcmf_err("firmware rejected country setting\n");
  16244. -+ return;
  16245. -+ }
  16246. -+ brcmf_setup_wiphybands(wiphy);
  16247. - }
  16248. -
  16249. - static void brcmf_free_wiphy(struct wiphy *wiphy)
  16250. diff --git a/package/kernel/mac80211/patches/339-0003-brcmfmac-add-description-for-feature-flags.patch b/package/kernel/mac80211/patches/339-0003-brcmfmac-add-description-for-feature-flags.patch
  16251. deleted file mode 100644
  16252. index 193f507..0000000
  16253. --- a/package/kernel/mac80211/patches/339-0003-brcmfmac-add-description-for-feature-flags.patch
  16254. +++ /dev/null
  16255. @@ -1,24 +0,0 @@
  16256. -From: Arend van Spriel <arend@broadcom.com>
  16257. -Date: Tue, 14 Apr 2015 20:10:26 +0200
  16258. -Subject: [PATCH] brcmfmac: add description for feature flags
  16259. -
  16260. -Some feature flags were not described in the header file. Adding
  16261. -the description.
  16262. -
  16263. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16264. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16265. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16266. ----
  16267. -
  16268. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  16269. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  16270. -@@ -19,7 +19,9 @@
  16271. - /*
  16272. - * Features:
  16273. - *
  16274. -+ * MBSS: multiple BSSID support (eg. guest network in AP mode).
  16275. - * MCHAN: multi-channel for concurrent P2P.
  16276. -+ * WOWL: Wake-On-WLAN.
  16277. - */
  16278. - #define BRCMF_FEAT_LIST \
  16279. - BRCMF_FEAT_DEF(MBSS) \
  16280. diff --git a/package/kernel/mac80211/patches/339-0004-brcmfmac-make-scheduled-scan-support-conditional.patch b/package/kernel/mac80211/patches/339-0004-brcmfmac-make-scheduled-scan-support-conditional.patch
  16281. deleted file mode 100644
  16282. index 42330b4..0000000
  16283. --- a/package/kernel/mac80211/patches/339-0004-brcmfmac-make-scheduled-scan-support-conditional.patch
  16284. +++ /dev/null
  16285. @@ -1,51 +0,0 @@
  16286. -From: Arend van Spriel <arend@broadcom.com>
  16287. -Date: Tue, 14 Apr 2015 20:10:27 +0200
  16288. -Subject: [PATCH] brcmfmac: make scheduled scan support conditional
  16289. -
  16290. -The scheduled scan support depends on firmware supporting the PNO
  16291. -feature. This feature is optional so add a feature flag for this
  16292. -in the driver and announce scheduled scan support accordingly.
  16293. -
  16294. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16295. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16296. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16297. ----
  16298. -
  16299. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  16300. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  16301. -@@ -5782,7 +5782,8 @@ static int brcmf_setup_wiphy(struct wiph
  16302. - wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM;
  16303. - wiphy->mgmt_stypes = brcmf_txrx_stypes;
  16304. - wiphy->max_remain_on_channel_duration = 5000;
  16305. -- brcmf_wiphy_pno_params(wiphy);
  16306. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_PNO))
  16307. -+ brcmf_wiphy_pno_params(wiphy);
  16308. -
  16309. - /* vendor commands/events support */
  16310. - wiphy->vendor_commands = brcmf_vendor_cmds;
  16311. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  16312. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  16313. -@@ -124,6 +124,7 @@ void brcmf_feat_attach(struct brcmf_pub
  16314. - struct brcmf_if *ifp = drvr->iflist[0];
  16315. -
  16316. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_MCHAN, "mchan");
  16317. -+ brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_PNO, "pfn");
  16318. - if (drvr->bus_if->wowl_supported)
  16319. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_WOWL, "wowl");
  16320. - if (drvr->bus_if->chip != BRCM_CC_43362_CHIP_ID)
  16321. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  16322. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  16323. -@@ -21,11 +21,13 @@
  16324. - *
  16325. - * MBSS: multiple BSSID support (eg. guest network in AP mode).
  16326. - * MCHAN: multi-channel for concurrent P2P.
  16327. -+ * PNO: preferred network offload.
  16328. - * WOWL: Wake-On-WLAN.
  16329. - */
  16330. - #define BRCMF_FEAT_LIST \
  16331. - BRCMF_FEAT_DEF(MBSS) \
  16332. - BRCMF_FEAT_DEF(MCHAN) \
  16333. -+ BRCMF_FEAT_DEF(PNO) \
  16334. - BRCMF_FEAT_DEF(WOWL)
  16335. - /*
  16336. - * Quirks:
  16337. diff --git a/package/kernel/mac80211/patches/339-0005-brcmfmac-add-support-for-BCM4324-rev-B5-chipset.patch b/package/kernel/mac80211/patches/339-0005-brcmfmac-add-support-for-BCM4324-rev-B5-chipset.patch
  16338. deleted file mode 100644
  16339. index b859d46..0000000
  16340. --- a/package/kernel/mac80211/patches/339-0005-brcmfmac-add-support-for-BCM4324-rev-B5-chipset.patch
  16341. +++ /dev/null
  16342. @@ -1,43 +0,0 @@
  16343. -From: Arend van Spriel <arend@broadcom.com>
  16344. -Date: Tue, 14 Apr 2015 20:10:28 +0200
  16345. -Subject: [PATCH] brcmfmac: add support for BCM4324 rev B5 chipset
  16346. -
  16347. -This patch adds support for the BCM4324 B5 revision. This device
  16348. -is similar to BCM43241 from driver and firmware perspective. It
  16349. -is known to be used in Lenovo Thinkpad Tablet devices.
  16350. -
  16351. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16352. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16353. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16354. ----
  16355. -
  16356. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  16357. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  16358. -@@ -601,6 +601,8 @@ static const struct sdiod_drive_str sdio
  16359. - #define BCM43241B0_NVRAM_NAME "brcm/brcmfmac43241b0-sdio.txt"
  16360. - #define BCM43241B4_FIRMWARE_NAME "brcm/brcmfmac43241b4-sdio.bin"
  16361. - #define BCM43241B4_NVRAM_NAME "brcm/brcmfmac43241b4-sdio.txt"
  16362. -+#define BCM43241B5_FIRMWARE_NAME "brcm/brcmfmac43241b5-sdio.bin"
  16363. -+#define BCM43241B5_NVRAM_NAME "brcm/brcmfmac43241b5-sdio.txt"
  16364. - #define BCM4329_FIRMWARE_NAME "brcm/brcmfmac4329-sdio.bin"
  16365. - #define BCM4329_NVRAM_NAME "brcm/brcmfmac4329-sdio.txt"
  16366. - #define BCM4330_FIRMWARE_NAME "brcm/brcmfmac4330-sdio.bin"
  16367. -@@ -628,6 +630,8 @@ MODULE_FIRMWARE(BCM43241B0_FIRMWARE_NAME
  16368. - MODULE_FIRMWARE(BCM43241B0_NVRAM_NAME);
  16369. - MODULE_FIRMWARE(BCM43241B4_FIRMWARE_NAME);
  16370. - MODULE_FIRMWARE(BCM43241B4_NVRAM_NAME);
  16371. -+MODULE_FIRMWARE(BCM43241B5_FIRMWARE_NAME);
  16372. -+MODULE_FIRMWARE(BCM43241B5_NVRAM_NAME);
  16373. - MODULE_FIRMWARE(BCM4329_FIRMWARE_NAME);
  16374. - MODULE_FIRMWARE(BCM4329_NVRAM_NAME);
  16375. - MODULE_FIRMWARE(BCM4330_FIRMWARE_NAME);
  16376. -@@ -667,7 +671,8 @@ enum brcmf_firmware_type {
  16377. - static const struct brcmf_firmware_names brcmf_fwname_data[] = {
  16378. - { BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM43143) },
  16379. - { BRCM_CC_43241_CHIP_ID, 0x0000001F, BRCMF_FIRMWARE_NVRAM(BCM43241B0) },
  16380. -- { BRCM_CC_43241_CHIP_ID, 0xFFFFFFE0, BRCMF_FIRMWARE_NVRAM(BCM43241B4) },
  16381. -+ { BRCM_CC_43241_CHIP_ID, 0x00000020, BRCMF_FIRMWARE_NVRAM(BCM43241B4) },
  16382. -+ { BRCM_CC_43241_CHIP_ID, 0xFFFFFFC0, BRCMF_FIRMWARE_NVRAM(BCM43241B5) },
  16383. - { BRCM_CC_4329_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4329) },
  16384. - { BRCM_CC_4330_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4330) },
  16385. - { BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4334) },
  16386. diff --git a/package/kernel/mac80211/patches/339-0006-brcmfmac-process-interrupt-regardless-sdiod-state.patch b/package/kernel/mac80211/patches/339-0006-brcmfmac-process-interrupt-regardless-sdiod-state.patch
  16387. deleted file mode 100644
  16388. index d420308..0000000
  16389. --- a/package/kernel/mac80211/patches/339-0006-brcmfmac-process-interrupt-regardless-sdiod-state.patch
  16390. +++ /dev/null
  16391. @@ -1,27 +0,0 @@
  16392. -From: Arend van Spriel <arend@broadcom.com>
  16393. -Date: Tue, 14 Apr 2015 20:10:29 +0200
  16394. -Subject: [PATCH] brcmfmac: process interrupt regardless sdiod state
  16395. -
  16396. -When the sdio bus state is not ready to process we abort the
  16397. -interrupt service routine. This is not wanted as it keeps the
  16398. -interrupt source active. Better clear the interrupt source.
  16399. -
  16400. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16401. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16402. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  16403. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16404. ----
  16405. -
  16406. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  16407. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  16408. -@@ -3555,10 +3555,6 @@ void brcmf_sdio_isr(struct brcmf_sdio *b
  16409. - return;
  16410. - }
  16411. -
  16412. -- if (bus->sdiodev->state != BRCMF_SDIOD_DATA) {
  16413. -- brcmf_err("bus is down. we have nothing to do\n");
  16414. -- return;
  16415. -- }
  16416. - /* Count the interrupt call */
  16417. - bus->sdcnt.intrcount++;
  16418. - if (in_interrupt())
  16419. diff --git a/package/kernel/mac80211/patches/339-0007-brcmfmac-fix-sdio-suspend-and-resume.patch b/package/kernel/mac80211/patches/339-0007-brcmfmac-fix-sdio-suspend-and-resume.patch
  16420. deleted file mode 100644
  16421. index ac5584e..0000000
  16422. --- a/package/kernel/mac80211/patches/339-0007-brcmfmac-fix-sdio-suspend-and-resume.patch
  16423. +++ /dev/null
  16424. @@ -1,68 +0,0 @@
  16425. -From: Arend van Spriel <arend@broadcom.com>
  16426. -Date: Tue, 14 Apr 2015 20:10:30 +0200
  16427. -Subject: [PATCH] brcmfmac: fix sdio suspend and resume
  16428. -
  16429. -commit 330b4e4be937 ("brcmfmac: Add wowl support for SDIO devices.")
  16430. -changed the behaviour by removing the MMC_PM_KEEP_POWER flag for
  16431. -non-wowl scenario, which needs to be restored. Another necessary
  16432. -change is to mark the card as being non-removable. With this in place
  16433. -the suspend resume test passes successfully doing:
  16434. -
  16435. - # echo devices > /sys/power/pm_test
  16436. - # echo mem > /sys/power/state
  16437. -
  16438. -Note that power may still be switched off when system is going
  16439. -in S3 state.
  16440. -
  16441. -Reported-by: Fu, Zhonghui <<zhonghui.fu@linux.intel.com>
  16442. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16443. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  16444. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16445. ----
  16446. -
  16447. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  16448. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  16449. -@@ -1011,6 +1011,14 @@ static int brcmf_sdiod_remove(struct brc
  16450. - return 0;
  16451. - }
  16452. -
  16453. -+static void brcmf_sdiod_host_fixup(struct mmc_host *host)
  16454. -+{
  16455. -+ /* runtime-pm powers off the device */
  16456. -+ pm_runtime_forbid(host->parent);
  16457. -+ /* avoid removal detection upon resume */
  16458. -+ host->caps |= MMC_CAP_NONREMOVABLE;
  16459. -+}
  16460. -+
  16461. - static int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev)
  16462. - {
  16463. - struct sdio_func *func;
  16464. -@@ -1076,7 +1084,7 @@ static int brcmf_sdiod_probe(struct brcm
  16465. - ret = -ENODEV;
  16466. - goto out;
  16467. - }
  16468. -- pm_runtime_forbid(host->parent);
  16469. -+ brcmf_sdiod_host_fixup(host);
  16470. - out:
  16471. - if (ret)
  16472. - brcmf_sdiod_remove(sdiodev);
  16473. -@@ -1246,15 +1254,15 @@ static int brcmf_ops_sdio_suspend(struct
  16474. - brcmf_sdiod_freezer_on(sdiodev);
  16475. - brcmf_sdio_wd_timer(sdiodev->bus, 0);
  16476. -
  16477. -+ sdio_flags = MMC_PM_KEEP_POWER;
  16478. - if (sdiodev->wowl_enabled) {
  16479. -- sdio_flags = MMC_PM_KEEP_POWER;
  16480. - if (sdiodev->pdata->oob_irq_supported)
  16481. - enable_irq_wake(sdiodev->pdata->oob_irq_nr);
  16482. - else
  16483. -- sdio_flags = MMC_PM_WAKE_SDIO_IRQ;
  16484. -- if (sdio_set_host_pm_flags(sdiodev->func[1], sdio_flags))
  16485. -- brcmf_err("Failed to set pm_flags %x\n", sdio_flags);
  16486. -+ sdio_flags |= MMC_PM_WAKE_SDIO_IRQ;
  16487. - }
  16488. -+ if (sdio_set_host_pm_flags(sdiodev->func[1], sdio_flags))
  16489. -+ brcmf_err("Failed to set pm_flags %x\n", sdio_flags);
  16490. - return 0;
  16491. - }
  16492. -
  16493. diff --git a/package/kernel/mac80211/patches/339-0008-brcmfmac-add-support-for-BCM4358-PCIe-device.patch b/package/kernel/mac80211/patches/339-0008-brcmfmac-add-support-for-BCM4358-PCIe-device.patch
  16494. deleted file mode 100644
  16495. index a521b65..0000000
  16496. --- a/package/kernel/mac80211/patches/339-0008-brcmfmac-add-support-for-BCM4358-PCIe-device.patch
  16497. +++ /dev/null
  16498. @@ -1,77 +0,0 @@
  16499. -From: Arend van Spriel <arend@broadcom.com>
  16500. -Date: Tue, 14 Apr 2015 20:10:31 +0200
  16501. -Subject: [PATCH] brcmfmac: add support for BCM4358 PCIe device
  16502. -
  16503. -This patch adds support for the BCM4358 2x2 11ac device.
  16504. -
  16505. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16506. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16507. ----
  16508. -
  16509. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  16510. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  16511. -@@ -649,6 +649,7 @@ static u32 brcmf_chip_tcm_rambase(struct
  16512. - case BRCM_CC_43567_CHIP_ID:
  16513. - case BRCM_CC_43569_CHIP_ID:
  16514. - case BRCM_CC_43570_CHIP_ID:
  16515. -+ case BRCM_CC_4358_CHIP_ID:
  16516. - case BRCM_CC_43602_CHIP_ID:
  16517. - return 0x180000;
  16518. - default:
  16519. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16520. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16521. -@@ -51,6 +51,8 @@ enum brcmf_pcie_state {
  16522. - #define BRCMF_PCIE_4356_NVRAM_NAME "brcm/brcmfmac4356-pcie.txt"
  16523. - #define BRCMF_PCIE_43570_FW_NAME "brcm/brcmfmac43570-pcie.bin"
  16524. - #define BRCMF_PCIE_43570_NVRAM_NAME "brcm/brcmfmac43570-pcie.txt"
  16525. -+#define BRCMF_PCIE_4358_FW_NAME "brcm/brcmfmac4358-pcie.bin"
  16526. -+#define BRCMF_PCIE_4358_NVRAM_NAME "brcm/brcmfmac4358-pcie.txt"
  16527. -
  16528. - #define BRCMF_PCIE_FW_UP_TIMEOUT 2000 /* msec */
  16529. -
  16530. -@@ -189,6 +191,8 @@ MODULE_FIRMWARE(BRCMF_PCIE_4356_FW_NAME)
  16531. - MODULE_FIRMWARE(BRCMF_PCIE_4356_NVRAM_NAME);
  16532. - MODULE_FIRMWARE(BRCMF_PCIE_43570_FW_NAME);
  16533. - MODULE_FIRMWARE(BRCMF_PCIE_43570_NVRAM_NAME);
  16534. -+MODULE_FIRMWARE(BRCMF_PCIE_4358_FW_NAME);
  16535. -+MODULE_FIRMWARE(BRCMF_PCIE_4358_NVRAM_NAME);
  16536. -
  16537. -
  16538. - struct brcmf_pcie_console {
  16539. -@@ -1333,6 +1337,10 @@ static int brcmf_pcie_get_fwnames(struct
  16540. - fw_name = BRCMF_PCIE_43570_FW_NAME;
  16541. - nvram_name = BRCMF_PCIE_43570_NVRAM_NAME;
  16542. - break;
  16543. -+ case BRCM_CC_4358_CHIP_ID:
  16544. -+ fw_name = BRCMF_PCIE_4358_FW_NAME;
  16545. -+ nvram_name = BRCMF_PCIE_4358_NVRAM_NAME;
  16546. -+ break;
  16547. - default:
  16548. - brcmf_err("Unsupported chip 0x%04x\n", devinfo->ci->chip);
  16549. - return -ENODEV;
  16550. -@@ -1850,6 +1858,7 @@ static struct pci_device_id brcmf_pcie_d
  16551. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4356_DEVICE_ID),
  16552. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43567_DEVICE_ID),
  16553. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43570_DEVICE_ID),
  16554. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4358_DEVICE_ID),
  16555. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_DEVICE_ID),
  16556. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_2G_DEVICE_ID),
  16557. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_5G_DEVICE_ID),
  16558. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  16559. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  16560. -@@ -45,6 +45,7 @@
  16561. - #define BRCM_CC_43567_CHIP_ID 43567
  16562. - #define BRCM_CC_43569_CHIP_ID 43569
  16563. - #define BRCM_CC_43570_CHIP_ID 43570
  16564. -+#define BRCM_CC_4358_CHIP_ID 0x4358
  16565. - #define BRCM_CC_43602_CHIP_ID 43602
  16566. -
  16567. - /* USB Device IDs */
  16568. -@@ -59,6 +60,7 @@
  16569. - #define BRCM_PCIE_4356_DEVICE_ID 0x43ec
  16570. - #define BRCM_PCIE_43567_DEVICE_ID 0x43d3
  16571. - #define BRCM_PCIE_43570_DEVICE_ID 0x43d9
  16572. -+#define BRCM_PCIE_4358_DEVICE_ID 0x43e9
  16573. - #define BRCM_PCIE_43602_DEVICE_ID 0x43ba
  16574. - #define BRCM_PCIE_43602_2G_DEVICE_ID 0x43bb
  16575. - #define BRCM_PCIE_43602_5G_DEVICE_ID 0x43bc
  16576. diff --git a/package/kernel/mac80211/patches/339-0009-brcmfmac-add-additional-43602-pcie-device-id.patch b/package/kernel/mac80211/patches/339-0009-brcmfmac-add-additional-43602-pcie-device-id.patch
  16577. deleted file mode 100644
  16578. index bcbb984..0000000
  16579. --- a/package/kernel/mac80211/patches/339-0009-brcmfmac-add-additional-43602-pcie-device-id.patch
  16580. +++ /dev/null
  16581. @@ -1,30 +0,0 @@
  16582. -From: Hante Meuleman <meuleman@broadcom.com>
  16583. -Date: Tue, 14 Apr 2015 20:10:32 +0200
  16584. -Subject: [PATCH] brcmfmac: add additional 43602 pcie device id.
  16585. -
  16586. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  16587. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16588. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  16589. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16590. ----
  16591. -
  16592. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16593. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16594. -@@ -1862,6 +1862,7 @@ static struct pci_device_id brcmf_pcie_d
  16595. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_DEVICE_ID),
  16596. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_2G_DEVICE_ID),
  16597. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_5G_DEVICE_ID),
  16598. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_RAW_DEVICE_ID),
  16599. - { /* end: all zeroes */ }
  16600. - };
  16601. -
  16602. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  16603. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  16604. -@@ -64,6 +64,7 @@
  16605. - #define BRCM_PCIE_43602_DEVICE_ID 0x43ba
  16606. - #define BRCM_PCIE_43602_2G_DEVICE_ID 0x43bb
  16607. - #define BRCM_PCIE_43602_5G_DEVICE_ID 0x43bc
  16608. -+#define BRCM_PCIE_43602_RAW_DEVICE_ID 43602
  16609. -
  16610. - /* brcmsmac IDs */
  16611. - #define BCM4313_D11N2G_ID 0x4727 /* 4313 802.11n 2.4G device */
  16612. diff --git a/package/kernel/mac80211/patches/339-0010-brcmfmac-Add-support-for-multiple-PCIE-devices-in-nv.patch b/package/kernel/mac80211/patches/339-0010-brcmfmac-Add-support-for-multiple-PCIE-devices-in-nv.patch
  16613. deleted file mode 100644
  16614. index 5f9bbea..0000000
  16615. --- a/package/kernel/mac80211/patches/339-0010-brcmfmac-Add-support-for-multiple-PCIE-devices-in-nv.patch
  16616. +++ /dev/null
  16617. @@ -1,351 +0,0 @@
  16618. -From: Hante Meuleman <meuleman@broadcom.com>
  16619. -Date: Tue, 14 Apr 2015 20:10:33 +0200
  16620. -Subject: [PATCH] brcmfmac: Add support for multiple PCIE devices in
  16621. - nvram.
  16622. -
  16623. -With PCIE it is possible to support multiple devices with the
  16624. -same device type. They all load the same nvram file. In order to
  16625. -support this the nvram can specify which part of the nvram is
  16626. -for which pcie device. This patch adds support for these new
  16627. -types of nvram files.
  16628. -
  16629. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  16630. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  16631. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16632. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  16633. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  16634. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16635. ----
  16636. -
  16637. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  16638. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  16639. -@@ -23,6 +23,10 @@
  16640. - #include "debug.h"
  16641. - #include "firmware.h"
  16642. -
  16643. -+#define BRCMF_FW_MAX_NVRAM_SIZE 64000
  16644. -+#define BRCMF_FW_NVRAM_DEVPATH_LEN 19 /* devpath0=pcie/1/4/ */
  16645. -+#define BRCMF_FW_NVRAM_PCIEDEV_LEN 9 /* pcie/1/4/ */
  16646. -+
  16647. - char brcmf_firmware_path[BRCMF_FW_PATH_LEN];
  16648. - module_param_string(firmware_path, brcmf_firmware_path,
  16649. - BRCMF_FW_PATH_LEN, 0440);
  16650. -@@ -46,6 +50,8 @@ enum nvram_parser_state {
  16651. - * @column: current column in line.
  16652. - * @pos: byte offset in input buffer.
  16653. - * @entry: start position of key,value entry.
  16654. -+ * @multi_dev_v1: detect pcie multi device v1 (compressed).
  16655. -+ * @multi_dev_v2: detect pcie multi device v2.
  16656. - */
  16657. - struct nvram_parser {
  16658. - enum nvram_parser_state state;
  16659. -@@ -56,6 +62,8 @@ struct nvram_parser {
  16660. - u32 column;
  16661. - u32 pos;
  16662. - u32 entry;
  16663. -+ bool multi_dev_v1;
  16664. -+ bool multi_dev_v2;
  16665. - };
  16666. -
  16667. - static bool is_nvram_char(char c)
  16668. -@@ -108,6 +116,10 @@ static enum nvram_parser_state brcmf_nvr
  16669. - st = COMMENT;
  16670. - else
  16671. - st = VALUE;
  16672. -+ if (strncmp(&nvp->fwnv->data[nvp->entry], "devpath", 7) == 0)
  16673. -+ nvp->multi_dev_v1 = true;
  16674. -+ if (strncmp(&nvp->fwnv->data[nvp->entry], "pcie/", 5) == 0)
  16675. -+ nvp->multi_dev_v2 = true;
  16676. - } else if (!is_nvram_char(c)) {
  16677. - brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n",
  16678. - nvp->line, nvp->column);
  16679. -@@ -133,6 +145,8 @@ brcmf_nvram_handle_value(struct nvram_pa
  16680. - ekv = (u8 *)&nvp->fwnv->data[nvp->pos];
  16681. - skv = (u8 *)&nvp->fwnv->data[nvp->entry];
  16682. - cplen = ekv - skv;
  16683. -+ if (nvp->nvram_len + cplen + 1 >= BRCMF_FW_MAX_NVRAM_SIZE)
  16684. -+ return END;
  16685. - /* copy to output buffer */
  16686. - memcpy(&nvp->nvram[nvp->nvram_len], skv, cplen);
  16687. - nvp->nvram_len += cplen;
  16688. -@@ -180,10 +194,18 @@ static enum nvram_parser_state
  16689. - static int brcmf_init_nvram_parser(struct nvram_parser *nvp,
  16690. - const struct firmware *nv)
  16691. - {
  16692. -+ size_t size;
  16693. -+
  16694. - memset(nvp, 0, sizeof(*nvp));
  16695. - nvp->fwnv = nv;
  16696. -+ /* Limit size to MAX_NVRAM_SIZE, some files contain lot of comment */
  16697. -+ if (nv->size > BRCMF_FW_MAX_NVRAM_SIZE)
  16698. -+ size = BRCMF_FW_MAX_NVRAM_SIZE;
  16699. -+ else
  16700. -+ size = nv->size;
  16701. - /* Alloc for extra 0 byte + roundup by 4 + length field */
  16702. -- nvp->nvram = kzalloc(nv->size + 1 + 3 + sizeof(u32), GFP_KERNEL);
  16703. -+ size += 1 + 3 + sizeof(u32);
  16704. -+ nvp->nvram = kzalloc(size, GFP_KERNEL);
  16705. - if (!nvp->nvram)
  16706. - return -ENOMEM;
  16707. -
  16708. -@@ -192,12 +214,136 @@ static int brcmf_init_nvram_parser(struc
  16709. - return 0;
  16710. - }
  16711. -
  16712. -+/* brcmf_fw_strip_multi_v1 :Some nvram files contain settings for multiple
  16713. -+ * devices. Strip it down for one device, use domain_nr/bus_nr to determine
  16714. -+ * which data is to be returned. v1 is the version where nvram is stored
  16715. -+ * compressed and "devpath" maps to index for valid entries.
  16716. -+ */
  16717. -+static void brcmf_fw_strip_multi_v1(struct nvram_parser *nvp, u16 domain_nr,
  16718. -+ u16 bus_nr)
  16719. -+{
  16720. -+ u32 i, j;
  16721. -+ bool found;
  16722. -+ u8 *nvram;
  16723. -+ u8 id;
  16724. -+
  16725. -+ nvram = kzalloc(nvp->nvram_len + 1 + 3 + sizeof(u32), GFP_KERNEL);
  16726. -+ if (!nvram)
  16727. -+ goto fail;
  16728. -+
  16729. -+ /* min length: devpath0=pcie/1/4/ + 0:x=y */
  16730. -+ if (nvp->nvram_len < BRCMF_FW_NVRAM_DEVPATH_LEN + 6)
  16731. -+ goto fail;
  16732. -+
  16733. -+ /* First search for the devpathX and see if it is the configuration
  16734. -+ * for domain_nr/bus_nr. Search complete nvp
  16735. -+ */
  16736. -+ found = false;
  16737. -+ i = 0;
  16738. -+ while (i < nvp->nvram_len - BRCMF_FW_NVRAM_DEVPATH_LEN) {
  16739. -+ /* Format: devpathX=pcie/Y/Z/
  16740. -+ * Y = domain_nr, Z = bus_nr, X = virtual ID
  16741. -+ */
  16742. -+ if ((strncmp(&nvp->nvram[i], "devpath", 7) == 0) &&
  16743. -+ (strncmp(&nvp->nvram[i + 8], "=pcie/", 6) == 0)) {
  16744. -+ if (((nvp->nvram[i + 14] - '0') == domain_nr) &&
  16745. -+ ((nvp->nvram[i + 16] - '0') == bus_nr)) {
  16746. -+ id = nvp->nvram[i + 7] - '0';
  16747. -+ found = true;
  16748. -+ break;
  16749. -+ }
  16750. -+ }
  16751. -+ while (nvp->nvram[i] != 0)
  16752. -+ i++;
  16753. -+ i++;
  16754. -+ }
  16755. -+ if (!found)
  16756. -+ goto fail;
  16757. -+
  16758. -+ /* Now copy all valid entries, release old nvram and assign new one */
  16759. -+ i = 0;
  16760. -+ j = 0;
  16761. -+ while (i < nvp->nvram_len) {
  16762. -+ if ((nvp->nvram[i] - '0' == id) && (nvp->nvram[i + 1] == ':')) {
  16763. -+ i += 2;
  16764. -+ while (nvp->nvram[i] != 0) {
  16765. -+ nvram[j] = nvp->nvram[i];
  16766. -+ i++;
  16767. -+ j++;
  16768. -+ }
  16769. -+ nvram[j] = 0;
  16770. -+ j++;
  16771. -+ }
  16772. -+ while (nvp->nvram[i] != 0)
  16773. -+ i++;
  16774. -+ i++;
  16775. -+ }
  16776. -+ kfree(nvp->nvram);
  16777. -+ nvp->nvram = nvram;
  16778. -+ nvp->nvram_len = j;
  16779. -+ return;
  16780. -+
  16781. -+fail:
  16782. -+ kfree(nvram);
  16783. -+ nvp->nvram_len = 0;
  16784. -+}
  16785. -+
  16786. -+/* brcmf_fw_strip_multi_v2 :Some nvram files contain settings for multiple
  16787. -+ * devices. Strip it down for one device, use domain_nr/bus_nr to determine
  16788. -+ * which data is to be returned. v2 is the version where nvram is stored
  16789. -+ * uncompressed, all relevant valid entries are identified by
  16790. -+ * pcie/domain_nr/bus_nr:
  16791. -+ */
  16792. -+static void brcmf_fw_strip_multi_v2(struct nvram_parser *nvp, u16 domain_nr,
  16793. -+ u16 bus_nr)
  16794. -+{
  16795. -+ u32 i, j;
  16796. -+ u8 *nvram;
  16797. -+
  16798. -+ nvram = kzalloc(nvp->nvram_len + 1 + 3 + sizeof(u32), GFP_KERNEL);
  16799. -+ if (!nvram)
  16800. -+ goto fail;
  16801. -+
  16802. -+ /* Copy all valid entries, release old nvram and assign new one.
  16803. -+ * Valid entries are of type pcie/X/Y/ where X = domain_nr and
  16804. -+ * Y = bus_nr.
  16805. -+ */
  16806. -+ i = 0;
  16807. -+ j = 0;
  16808. -+ while (i < nvp->nvram_len - BRCMF_FW_NVRAM_PCIEDEV_LEN) {
  16809. -+ if ((strncmp(&nvp->nvram[i], "pcie/", 5) == 0) &&
  16810. -+ (nvp->nvram[i + 6] == '/') && (nvp->nvram[i + 8] == '/') &&
  16811. -+ ((nvp->nvram[i + 5] - '0') == domain_nr) &&
  16812. -+ ((nvp->nvram[i + 7] - '0') == bus_nr)) {
  16813. -+ i += BRCMF_FW_NVRAM_PCIEDEV_LEN;
  16814. -+ while (nvp->nvram[i] != 0) {
  16815. -+ nvram[j] = nvp->nvram[i];
  16816. -+ i++;
  16817. -+ j++;
  16818. -+ }
  16819. -+ nvram[j] = 0;
  16820. -+ j++;
  16821. -+ }
  16822. -+ while (nvp->nvram[i] != 0)
  16823. -+ i++;
  16824. -+ i++;
  16825. -+ }
  16826. -+ kfree(nvp->nvram);
  16827. -+ nvp->nvram = nvram;
  16828. -+ nvp->nvram_len = j;
  16829. -+ return;
  16830. -+fail:
  16831. -+ kfree(nvram);
  16832. -+ nvp->nvram_len = 0;
  16833. -+}
  16834. -+
  16835. - /* brcmf_nvram_strip :Takes a buffer of "<var>=<value>\n" lines read from a fil
  16836. - * and ending in a NUL. Removes carriage returns, empty lines, comment lines,
  16837. - * and converts newlines to NULs. Shortens buffer as needed and pads with NULs.
  16838. - * End of buffer is completed with token identifying length of buffer.
  16839. - */
  16840. --static void *brcmf_fw_nvram_strip(const struct firmware *nv, u32 *new_length)
  16841. -+static void *brcmf_fw_nvram_strip(const struct firmware *nv, u32 *new_length,
  16842. -+ u16 domain_nr, u16 bus_nr)
  16843. - {
  16844. - struct nvram_parser nvp;
  16845. - u32 pad;
  16846. -@@ -212,6 +358,16 @@ static void *brcmf_fw_nvram_strip(const
  16847. - if (nvp.state == END)
  16848. - break;
  16849. - }
  16850. -+ if (nvp.multi_dev_v1)
  16851. -+ brcmf_fw_strip_multi_v1(&nvp, domain_nr, bus_nr);
  16852. -+ else if (nvp.multi_dev_v2)
  16853. -+ brcmf_fw_strip_multi_v2(&nvp, domain_nr, bus_nr);
  16854. -+
  16855. -+ if (nvp.nvram_len == 0) {
  16856. -+ kfree(nvp.nvram);
  16857. -+ return NULL;
  16858. -+ }
  16859. -+
  16860. - pad = nvp.nvram_len;
  16861. - *new_length = roundup(nvp.nvram_len + 1, 4);
  16862. - while (pad != *new_length) {
  16863. -@@ -239,6 +395,8 @@ struct brcmf_fw {
  16864. - u16 flags;
  16865. - const struct firmware *code;
  16866. - const char *nvram_name;
  16867. -+ u16 domain_nr;
  16868. -+ u16 bus_nr;
  16869. - void (*done)(struct device *dev, const struct firmware *fw,
  16870. - void *nvram_image, u32 nvram_len);
  16871. - };
  16872. -@@ -254,7 +412,8 @@ static void brcmf_fw_request_nvram_done(
  16873. - goto fail;
  16874. -
  16875. - if (fw) {
  16876. -- nvram = brcmf_fw_nvram_strip(fw, &nvram_length);
  16877. -+ nvram = brcmf_fw_nvram_strip(fw, &nvram_length,
  16878. -+ fwctx->domain_nr, fwctx->bus_nr);
  16879. - release_firmware(fw);
  16880. - if (!nvram && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL))
  16881. - goto fail;
  16882. -@@ -309,11 +468,12 @@ fail:
  16883. - kfree(fwctx);
  16884. - }
  16885. -
  16886. --int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  16887. -- const char *code, const char *nvram,
  16888. -- void (*fw_cb)(struct device *dev,
  16889. -- const struct firmware *fw,
  16890. -- void *nvram_image, u32 nvram_len))
  16891. -+int brcmf_fw_get_firmwares_pcie(struct device *dev, u16 flags,
  16892. -+ const char *code, const char *nvram,
  16893. -+ void (*fw_cb)(struct device *dev,
  16894. -+ const struct firmware *fw,
  16895. -+ void *nvram_image, u32 nvram_len),
  16896. -+ u16 domain_nr, u16 bus_nr)
  16897. - {
  16898. - struct brcmf_fw *fwctx;
  16899. -
  16900. -@@ -333,8 +493,21 @@ int brcmf_fw_get_firmwares(struct device
  16901. - fwctx->done = fw_cb;
  16902. - if (flags & BRCMF_FW_REQUEST_NVRAM)
  16903. - fwctx->nvram_name = nvram;
  16904. -+ fwctx->domain_nr = domain_nr;
  16905. -+ fwctx->bus_nr = bus_nr;
  16906. -
  16907. - return request_firmware_nowait(THIS_MODULE, true, code, dev,
  16908. - GFP_KERNEL, fwctx,
  16909. - brcmf_fw_request_code_done);
  16910. - }
  16911. -+
  16912. -+int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  16913. -+ const char *code, const char *nvram,
  16914. -+ void (*fw_cb)(struct device *dev,
  16915. -+ const struct firmware *fw,
  16916. -+ void *nvram_image, u32 nvram_len))
  16917. -+{
  16918. -+ return brcmf_fw_get_firmwares_pcie(dev, flags, code, nvram, fw_cb, 0,
  16919. -+ 0);
  16920. -+}
  16921. -+
  16922. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.h
  16923. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.h
  16924. -@@ -32,6 +32,12 @@ void brcmf_fw_nvram_free(void *nvram);
  16925. - * fails it will not use the callback, but call device_release_driver()
  16926. - * instead which will call the driver .remove() callback.
  16927. - */
  16928. -+int brcmf_fw_get_firmwares_pcie(struct device *dev, u16 flags,
  16929. -+ const char *code, const char *nvram,
  16930. -+ void (*fw_cb)(struct device *dev,
  16931. -+ const struct firmware *fw,
  16932. -+ void *nvram_image, u32 nvram_len),
  16933. -+ u16 domain_nr, u16 bus_nr);
  16934. - int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  16935. - const char *code, const char *nvram,
  16936. - void (*fw_cb)(struct device *dev,
  16937. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16938. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16939. -@@ -1649,8 +1649,13 @@ brcmf_pcie_probe(struct pci_dev *pdev, c
  16940. - struct brcmf_pciedev_info *devinfo;
  16941. - struct brcmf_pciedev *pcie_bus_dev;
  16942. - struct brcmf_bus *bus;
  16943. -+ u16 domain_nr;
  16944. -+ u16 bus_nr;
  16945. -
  16946. -- brcmf_dbg(PCIE, "Enter %x:%x\n", pdev->vendor, pdev->device);
  16947. -+ domain_nr = pci_domain_nr(pdev->bus) + 1;
  16948. -+ bus_nr = pdev->bus->number;
  16949. -+ brcmf_dbg(PCIE, "Enter %x:%x (%d/%d)\n", pdev->vendor, pdev->device,
  16950. -+ domain_nr, bus_nr);
  16951. -
  16952. - ret = -ENOMEM;
  16953. - devinfo = kzalloc(sizeof(*devinfo), GFP_KERNEL);
  16954. -@@ -1699,10 +1704,10 @@ brcmf_pcie_probe(struct pci_dev *pdev, c
  16955. - if (ret)
  16956. - goto fail_bus;
  16957. -
  16958. -- ret = brcmf_fw_get_firmwares(bus->dev, BRCMF_FW_REQUEST_NVRAM |
  16959. -- BRCMF_FW_REQ_NV_OPTIONAL,
  16960. -- devinfo->fw_name, devinfo->nvram_name,
  16961. -- brcmf_pcie_setup);
  16962. -+ ret = brcmf_fw_get_firmwares_pcie(bus->dev, BRCMF_FW_REQUEST_NVRAM |
  16963. -+ BRCMF_FW_REQ_NV_OPTIONAL,
  16964. -+ devinfo->fw_name, devinfo->nvram_name,
  16965. -+ brcmf_pcie_setup, domain_nr, bus_nr);
  16966. - if (ret == 0)
  16967. - return 0;
  16968. - fail_bus:
  16969. diff --git a/package/kernel/mac80211/patches/340-brcmfmac-cleanup-a-sizeof.patch b/package/kernel/mac80211/patches/340-brcmfmac-cleanup-a-sizeof.patch
  16970. deleted file mode 100644
  16971. index d26e118..0000000
  16972. --- a/package/kernel/mac80211/patches/340-brcmfmac-cleanup-a-sizeof.patch
  16973. +++ /dev/null
  16974. @@ -1,23 +0,0 @@
  16975. -From: Dan Carpenter <dan.carpenter@oracle.com>
  16976. -Date: Thu, 7 May 2015 12:59:19 +0300
  16977. -Subject: [PATCH] brcmfmac: cleanup a sizeof()
  16978. -
  16979. -"flowrings" and "*flowrings" are both pointers so this always returns
  16980. -sizeof(void *) and the current code works fine. But "*flowrings" is
  16981. -intended here and static checkers complain, so lets change it.
  16982. -
  16983. -Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
  16984. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16985. ----
  16986. -
  16987. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16988. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16989. -@@ -1617,7 +1617,7 @@ static void brcmf_pcie_setup(struct devi
  16990. - bus->msgbuf->commonrings[i] =
  16991. - &devinfo->shared.commonrings[i]->commonring;
  16992. -
  16993. -- flowrings = kcalloc(devinfo->shared.nrof_flowrings, sizeof(flowrings),
  16994. -+ flowrings = kcalloc(devinfo->shared.nrof_flowrings, sizeof(*flowrings),
  16995. - GFP_KERNEL);
  16996. - if (!flowrings)
  16997. - goto fail;
  16998. diff --git a/package/kernel/mac80211/patches/341-brcmfmac-check-result-of-USB-firmware-request.patch b/package/kernel/mac80211/patches/341-brcmfmac-check-result-of-USB-firmware-request.patch
  16999. deleted file mode 100644
  17000. index 9b2880d..0000000
  17001. --- a/package/kernel/mac80211/patches/341-brcmfmac-check-result-of-USB-firmware-request.patch
  17002. +++ /dev/null
  17003. @@ -1,33 +0,0 @@
  17004. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17005. -Date: Thu, 7 May 2015 14:13:03 +0200
  17006. -Subject: [PATCH] brcmfmac: check result of USB firmware request
  17007. -MIME-Version: 1.0
  17008. -Content-Type: text/plain; charset=UTF-8
  17009. -Content-Transfer-Encoding: 8bit
  17010. -
  17011. -This prevents silence failures with driver waiting (infinitely) for a
  17012. -callback.
  17013. -
  17014. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  17015. -Acked-by: Arend van Spriel <arend@broadcom.com>
  17016. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17017. ----
  17018. -
  17019. ---- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  17020. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  17021. -@@ -1270,8 +1270,13 @@ static int brcmf_usb_probe_cb(struct brc
  17022. - bus->chiprev = bus_pub->chiprev;
  17023. -
  17024. - /* request firmware here */
  17025. -- brcmf_fw_get_firmwares(dev, 0, brcmf_usb_get_fwname(devinfo), NULL,
  17026. -- brcmf_usb_probe_phase2);
  17027. -+ ret = brcmf_fw_get_firmwares(dev, 0, brcmf_usb_get_fwname(devinfo),
  17028. -+ NULL, brcmf_usb_probe_phase2);
  17029. -+ if (ret) {
  17030. -+ brcmf_err("firmware request failed: %d\n", ret);
  17031. -+ goto fail;
  17032. -+ }
  17033. -+
  17034. - return 0;
  17035. -
  17036. - fail:
  17037. diff --git a/package/kernel/mac80211/patches/342-brcmfmac-prohibit-ACPI-power-management-for-brcmfmac.patch b/package/kernel/mac80211/patches/342-brcmfmac-prohibit-ACPI-power-management-for-brcmfmac.patch
  17038. deleted file mode 100644
  17039. index d46b300..0000000
  17040. --- a/package/kernel/mac80211/patches/342-brcmfmac-prohibit-ACPI-power-management-for-brcmfmac.patch
  17041. +++ /dev/null
  17042. @@ -1,47 +0,0 @@
  17043. -From: "Fu, Zhonghui" <zhonghui.fu@linux.intel.com>
  17044. -Date: Mon, 11 May 2015 10:41:32 +0800
  17045. -Subject: [PATCH] brcmfmac: prohibit ACPI power management for brcmfmac driver
  17046. -
  17047. -ACPI will manage WiFi chip's power state during suspend/resume
  17048. -process on some tablet platforms(such as ASUS T100TA). This is
  17049. -not supported by brcmfmac driver now, and the context of WiFi
  17050. -chip will be damaged after resume. This patch informs ACPI not
  17051. -to manage WiFi chip's power state.
  17052. -
  17053. -Signed-off-by: Zhonghui Fu <zhonghui.fu@linux.intel.com>
  17054. -Acked-by: Arend van Spriel <arend@broadcom.com>
  17055. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17056. ----
  17057. -
  17058. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  17059. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  17060. -@@ -33,6 +33,7 @@
  17061. - #include <linux/suspend.h>
  17062. - #include <linux/errno.h>
  17063. - #include <linux/module.h>
  17064. -+#include <linux/acpi.h>
  17065. - #include <net/cfg80211.h>
  17066. -
  17067. - #include <defs.h>
  17068. -@@ -1122,6 +1123,8 @@ static int brcmf_ops_sdio_probe(struct s
  17069. - int err;
  17070. - struct brcmf_sdio_dev *sdiodev;
  17071. - struct brcmf_bus *bus_if;
  17072. -+ struct device *dev;
  17073. -+ struct acpi_device *adev;
  17074. -
  17075. - brcmf_dbg(SDIO, "Enter\n");
  17076. - brcmf_dbg(SDIO, "Class=%x\n", func->class);
  17077. -@@ -1129,6 +1132,12 @@ static int brcmf_ops_sdio_probe(struct s
  17078. - brcmf_dbg(SDIO, "sdio device ID: 0x%04x\n", func->device);
  17079. - brcmf_dbg(SDIO, "Function#: %d\n", func->num);
  17080. -
  17081. -+ /* prohibit ACPI power management for this device */
  17082. -+ dev = &func->dev;
  17083. -+ adev = ACPI_COMPANION(dev);
  17084. -+ if (adev)
  17085. -+ adev->flags.power_manageable = 0;
  17086. -+
  17087. - /* Consume func num 1 but dont do anything with it. */
  17088. - if (func->num == 1)
  17089. - return 0;
  17090. diff --git a/package/kernel/mac80211/patches/343-brcmfmac-avoid-gcc-5.1-warning.patch b/package/kernel/mac80211/patches/343-brcmfmac-avoid-gcc-5.1-warning.patch
  17091. deleted file mode 100644
  17092. index 9b4609f..0000000
  17093. --- a/package/kernel/mac80211/patches/343-brcmfmac-avoid-gcc-5.1-warning.patch
  17094. +++ /dev/null
  17095. @@ -1,30 +0,0 @@
  17096. -From: Arnd Bergmann <arnd@arndb.de>
  17097. -Date: Tue, 12 May 2015 23:54:25 +0200
  17098. -Subject: [PATCH] brcmfmac: avoid gcc-5.1 warning
  17099. -
  17100. -gcc-5.0 gained a new warning in the fwsignal portion of the brcmfmac
  17101. -driver:
  17102. -
  17103. -drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c: In function 'brcmf_fws_txs_process':
  17104. -drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c:1478:8: warning: 'skb' may be used uninitialized in this function [-Wmaybe-uninitialized]
  17105. -
  17106. -This is a false positive, and marking the brcmf_fws_hanger_poppkt function
  17107. -as 'static inline' makes the warning go away. I have checked the object
  17108. -file output and while a little code gets moved around, the size of
  17109. -the binary remains identical.
  17110. -
  17111. -Signed-off-by: Arnd Bergmann <arnd@arndb.de>
  17112. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17113. ----
  17114. -
  17115. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  17116. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  17117. -@@ -635,7 +635,7 @@ static int brcmf_fws_hanger_pushpkt(stru
  17118. - return 0;
  17119. - }
  17120. -
  17121. --static int brcmf_fws_hanger_poppkt(struct brcmf_fws_hanger *h,
  17122. -+static inline int brcmf_fws_hanger_poppkt(struct brcmf_fws_hanger *h,
  17123. - u32 slot_id, struct sk_buff **pktout,
  17124. - bool remove_item)
  17125. - {
  17126. diff --git a/package/kernel/mac80211/patches/344-0001-brcmfmac-allow-device-tree-node-without-interrupts-p.patch b/package/kernel/mac80211/patches/344-0001-brcmfmac-allow-device-tree-node-without-interrupts-p.patch
  17127. deleted file mode 100644
  17128. index b16782d..0000000
  17129. --- a/package/kernel/mac80211/patches/344-0001-brcmfmac-allow-device-tree-node-without-interrupts-p.patch
  17130. +++ /dev/null
  17131. @@ -1,45 +0,0 @@
  17132. -From: Arend van Spriel <arend@broadcom.com>
  17133. -Date: Wed, 20 May 2015 14:09:47 +0200
  17134. -Subject: [PATCH] brcmfmac: allow device tree node without 'interrupts'
  17135. - property
  17136. -
  17137. -As described in the device tree bindings for 'brcm,bcm4329-fmac'
  17138. -nodes, the interrupts property is optional. So adding a check
  17139. -for the presence of this property before attempting to parse
  17140. -and map the interrupt. If not present or parsing fails return
  17141. -and fallback to in-band sdio interrupt.
  17142. -
  17143. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  17144. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17145. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17146. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17147. ----
  17148. -
  17149. ---- a/drivers/net/wireless/brcm80211/brcmfmac/of.c
  17150. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/of.c
  17151. -@@ -39,10 +39,16 @@ void brcmf_of_probe(struct brcmf_sdio_de
  17152. - if (!sdiodev->pdata)
  17153. - return;
  17154. -
  17155. -+ if (of_property_read_u32(np, "brcm,drive-strength", &val) == 0)
  17156. -+ sdiodev->pdata->drive_strength = val;
  17157. -+
  17158. -+ /* make sure there are interrupts defined in the node */
  17159. -+ if (!of_find_property(np, "interrupts", NULL))
  17160. -+ return;
  17161. -+
  17162. - irq = irq_of_parse_and_map(np, 0);
  17163. - if (!irq) {
  17164. - brcmf_err("interrupt could not be mapped\n");
  17165. -- devm_kfree(dev, sdiodev->pdata);
  17166. - return;
  17167. - }
  17168. - irqf = irqd_get_trigger_type(irq_get_irq_data(irq));
  17169. -@@ -50,7 +56,4 @@ void brcmf_of_probe(struct brcmf_sdio_de
  17170. - sdiodev->pdata->oob_irq_supported = true;
  17171. - sdiodev->pdata->oob_irq_nr = irq;
  17172. - sdiodev->pdata->oob_irq_flags = irqf;
  17173. --
  17174. -- if (of_property_read_u32(np, "brcm,drive-strength", &val) == 0)
  17175. -- sdiodev->pdata->drive_strength = val;
  17176. - }
  17177. diff --git a/package/kernel/mac80211/patches/344-0002-brcmfmac-Improve-throughput-by-scheduling-msbug-flow.patch b/package/kernel/mac80211/patches/344-0002-brcmfmac-Improve-throughput-by-scheduling-msbug-flow.patch
  17178. deleted file mode 100644
  17179. index f81250e..0000000
  17180. --- a/package/kernel/mac80211/patches/344-0002-brcmfmac-Improve-throughput-by-scheduling-msbug-flow.patch
  17181. +++ /dev/null
  17182. @@ -1,87 +0,0 @@
  17183. -From: Hante Meuleman <meuleman@broadcom.com>
  17184. -Date: Wed, 20 May 2015 14:09:48 +0200
  17185. -Subject: [PATCH] brcmfmac: Improve throughput by scheduling msbug flow worker.
  17186. -
  17187. -The tx flow worker in msgbuf gets scheduled at tx till a certain
  17188. -threshold has been reached. Then the tx completes will take over
  17189. -the scheduling. When amsdu and ampdu is used the frames are
  17190. -transferred wireless in a very bulky fashion, in combination
  17191. -with this scheduling algorithm and buffer limiters in the stack
  17192. -this can result in limited throughput. This change causes the
  17193. -flow worker to be scheduled more frequently from tx.
  17194. -
  17195. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  17196. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  17197. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17198. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  17199. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  17200. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17201. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17202. ----
  17203. -
  17204. ---- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  17205. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  17206. -@@ -249,8 +249,8 @@ void brcmf_flowring_delete(struct brcmf_
  17207. - }
  17208. -
  17209. -
  17210. --void brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  17211. -- struct sk_buff *skb)
  17212. -+u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  17213. -+ struct sk_buff *skb)
  17214. - {
  17215. - struct brcmf_flowring_ring *ring;
  17216. -
  17217. -@@ -271,6 +271,7 @@ void brcmf_flowring_enqueue(struct brcmf
  17218. - if (skb_queue_len(&ring->skblist) < BRCMF_FLOWRING_LOW)
  17219. - brcmf_flowring_block(flow, flowid, false);
  17220. - }
  17221. -+ return skb_queue_len(&ring->skblist);
  17222. - }
  17223. -
  17224. -
  17225. ---- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.h
  17226. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.h
  17227. -@@ -64,8 +64,8 @@ u32 brcmf_flowring_create(struct brcmf_f
  17228. - void brcmf_flowring_delete(struct brcmf_flowring *flow, u8 flowid);
  17229. - void brcmf_flowring_open(struct brcmf_flowring *flow, u8 flowid);
  17230. - u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u8 flowid);
  17231. --void brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  17232. -- struct sk_buff *skb);
  17233. -+u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  17234. -+ struct sk_buff *skb);
  17235. - struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u8 flowid);
  17236. - void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u8 flowid,
  17237. - struct sk_buff *skb);
  17238. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  17239. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  17240. -@@ -73,7 +73,7 @@
  17241. - #define BRCMF_MSGBUF_TX_FLUSH_CNT1 32
  17242. - #define BRCMF_MSGBUF_TX_FLUSH_CNT2 96
  17243. -
  17244. --#define BRCMF_MSGBUF_DELAY_TXWORKER_THRS 64
  17245. -+#define BRCMF_MSGBUF_DELAY_TXWORKER_THRS 96
  17246. - #define BRCMF_MSGBUF_TRICKLE_TXWORKER_THRS 32
  17247. -
  17248. - struct msgbuf_common_hdr {
  17249. -@@ -797,6 +797,8 @@ static int brcmf_msgbuf_txdata(struct br
  17250. - struct brcmf_flowring *flow = msgbuf->flow;
  17251. - struct ethhdr *eh = (struct ethhdr *)(skb->data);
  17252. - u32 flowid;
  17253. -+ u32 queue_count;
  17254. -+ bool force;
  17255. -
  17256. - flowid = brcmf_flowring_lookup(flow, eh->h_dest, skb->priority, ifidx);
  17257. - if (flowid == BRCMF_FLOWRING_INVALID_ID) {
  17258. -@@ -804,8 +806,9 @@ static int brcmf_msgbuf_txdata(struct br
  17259. - if (flowid == BRCMF_FLOWRING_INVALID_ID)
  17260. - return -ENOMEM;
  17261. - }
  17262. -- brcmf_flowring_enqueue(flow, flowid, skb);
  17263. -- brcmf_msgbuf_schedule_txdata(msgbuf, flowid, false);
  17264. -+ queue_count = brcmf_flowring_enqueue(flow, flowid, skb);
  17265. -+ force = ((queue_count % BRCMF_MSGBUF_TRICKLE_TXWORKER_THRS) == 0);
  17266. -+ brcmf_msgbuf_schedule_txdata(msgbuf, flowid, force);
  17267. -
  17268. - return 0;
  17269. - }
  17270. diff --git a/package/kernel/mac80211/patches/344-0003-brcmfmac-remove-pci-shared-structure-rev4-support.patch b/package/kernel/mac80211/patches/344-0003-brcmfmac-remove-pci-shared-structure-rev4-support.patch
  17271. deleted file mode 100644
  17272. index 61153c4..0000000
  17273. --- a/package/kernel/mac80211/patches/344-0003-brcmfmac-remove-pci-shared-structure-rev4-support.patch
  17274. +++ /dev/null
  17275. @@ -1,41 +0,0 @@
  17276. -From: Franky Lin <frankyl@broadcom.com>
  17277. -Date: Wed, 20 May 2015 14:09:49 +0200
  17278. -Subject: [PATCH] brcmfmac: remove pci shared structure rev4 support
  17279. -
  17280. -All pcie full dongle chips supported by fmac are using rev 5+ shared
  17281. -structure. This patch removes the rev4 related code.
  17282. -
  17283. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17284. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  17285. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  17286. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  17287. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17288. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17289. ----
  17290. -
  17291. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  17292. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  17293. -@@ -112,10 +112,9 @@ enum brcmf_pcie_state {
  17294. - BRCMF_PCIE_MB_INT_D2H3_DB0 | \
  17295. - BRCMF_PCIE_MB_INT_D2H3_DB1)
  17296. -
  17297. --#define BRCMF_PCIE_MIN_SHARED_VERSION 4
  17298. -+#define BRCMF_PCIE_MIN_SHARED_VERSION 5
  17299. - #define BRCMF_PCIE_MAX_SHARED_VERSION 5
  17300. - #define BRCMF_PCIE_SHARED_VERSION_MASK 0x00FF
  17301. --#define BRCMF_PCIE_SHARED_TXPUSH_SUPPORT 0x4000
  17302. -
  17303. - #define BRCMF_PCIE_FLAGS_HTOD_SPLIT 0x4000
  17304. - #define BRCMF_PCIE_FLAGS_DTOH_SPLIT 0x8000
  17305. -@@ -1280,11 +1279,6 @@ brcmf_pcie_init_share_ram_info(struct br
  17306. - brcmf_err("Unsupported PCIE version %d\n", version);
  17307. - return -EINVAL;
  17308. - }
  17309. -- if (shared->flags & BRCMF_PCIE_SHARED_TXPUSH_SUPPORT) {
  17310. -- brcmf_err("Unsupported legacy TX mode 0x%x\n",
  17311. -- shared->flags & BRCMF_PCIE_SHARED_TXPUSH_SUPPORT);
  17312. -- return -EINVAL;
  17313. -- }
  17314. -
  17315. - addr = sharedram_addr + BRCMF_SHARED_MAX_RXBUFPOST_OFFSET;
  17316. - shared->max_rxbufpost = brcmf_pcie_read_tcm16(devinfo, addr);
  17317. diff --git a/package/kernel/mac80211/patches/344-0004-brcmfmac-remove-dummy-cache-flush-invalidate-functio.patch b/package/kernel/mac80211/patches/344-0004-brcmfmac-remove-dummy-cache-flush-invalidate-functio.patch
  17318. deleted file mode 100644
  17319. index 8c8eebe..0000000
  17320. --- a/package/kernel/mac80211/patches/344-0004-brcmfmac-remove-dummy-cache-flush-invalidate-functio.patch
  17321. +++ /dev/null
  17322. @@ -1,120 +0,0 @@
  17323. -From: Franky Lin <frankyl@broadcom.com>
  17324. -Date: Wed, 20 May 2015 14:09:50 +0200
  17325. -Subject: [PATCH] brcmfmac: remove dummy cache flush/invalidate function
  17326. -
  17327. -brcmf_dma_flush and brcmf_dma_invalidate_cache are not necessary and
  17328. -have never been implemented.
  17329. -
  17330. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17331. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  17332. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  17333. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  17334. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17335. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17336. ----
  17337. -
  17338. ---- a/drivers/net/wireless/brcm80211/brcmfmac/commonring.c
  17339. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/commonring.c
  17340. -@@ -22,17 +22,6 @@
  17341. - #include "core.h"
  17342. - #include "commonring.h"
  17343. -
  17344. --
  17345. --/* dma flushing needs implementation for mips and arm platforms. Should
  17346. -- * be put in util. Note, this is not real flushing. It is virtual non
  17347. -- * cached memory. Only write buffers should have to be drained. Though
  17348. -- * this may be different depending on platform......
  17349. -- * SEE ALSO msgbuf.c
  17350. -- */
  17351. --#define brcmf_dma_flush(addr, len)
  17352. --#define brcmf_dma_invalidate_cache(addr, len)
  17353. --
  17354. --
  17355. - void brcmf_commonring_register_cb(struct brcmf_commonring *commonring,
  17356. - int (*cr_ring_bell)(void *ctx),
  17357. - int (*cr_update_rptr)(void *ctx),
  17358. -@@ -206,14 +195,9 @@ int brcmf_commonring_write_complete(stru
  17359. - address = commonring->buf_addr;
  17360. - address += (commonring->f_ptr * commonring->item_len);
  17361. - if (commonring->f_ptr > commonring->w_ptr) {
  17362. -- brcmf_dma_flush(address,
  17363. -- (commonring->depth - commonring->f_ptr) *
  17364. -- commonring->item_len);
  17365. - address = commonring->buf_addr;
  17366. - commonring->f_ptr = 0;
  17367. - }
  17368. -- brcmf_dma_flush(address, (commonring->w_ptr - commonring->f_ptr) *
  17369. -- commonring->item_len);
  17370. -
  17371. - commonring->f_ptr = commonring->w_ptr;
  17372. -
  17373. -@@ -258,8 +242,6 @@ void *brcmf_commonring_get_read_ptr(stru
  17374. - if (commonring->r_ptr == commonring->depth)
  17375. - commonring->r_ptr = 0;
  17376. -
  17377. -- brcmf_dma_invalidate_cache(ret_addr, *n_ items * commonring->item_len);
  17378. --
  17379. - return ret_addr;
  17380. - }
  17381. -
  17382. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  17383. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  17384. -@@ -278,16 +278,6 @@ struct brcmf_msgbuf_pktids {
  17385. - struct brcmf_msgbuf_pktid *array;
  17386. - };
  17387. -
  17388. --
  17389. --/* dma flushing needs implementation for mips and arm platforms. Should
  17390. -- * be put in util. Note, this is not real flushing. It is virtual non
  17391. -- * cached memory. Only write buffers should have to be drained. Though
  17392. -- * this may be different depending on platform......
  17393. -- */
  17394. --#define brcmf_dma_flush(addr, len)
  17395. --#define brcmf_dma_invalidate_cache(addr, len)
  17396. --
  17397. --
  17398. - static void brcmf_msgbuf_rxbuf_ioctlresp_post(struct brcmf_msgbuf *msgbuf);
  17399. -
  17400. -
  17401. -@@ -462,7 +452,6 @@ static int brcmf_msgbuf_tx_ioctl(struct
  17402. - memcpy(msgbuf->ioctbuf, buf, buf_len);
  17403. - else
  17404. - memset(msgbuf->ioctbuf, 0, buf_len);
  17405. -- brcmf_dma_flush(ioctl_buf, buf_len);
  17406. -
  17407. - err = brcmf_commonring_write_complete(commonring);
  17408. - brcmf_commonring_unlock(commonring);
  17409. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  17410. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  17411. -@@ -276,15 +276,6 @@ static const u32 brcmf_ring_itemsize[BRC
  17412. - };
  17413. -
  17414. -
  17415. --/* dma flushing needs implementation for mips and arm platforms. Should
  17416. -- * be put in util. Note, this is not real flushing. It is virtual non
  17417. -- * cached memory. Only write buffers should have to be drained. Though
  17418. -- * this may be different depending on platform......
  17419. -- */
  17420. --#define brcmf_dma_flush(addr, len)
  17421. --#define brcmf_dma_invalidate_cache(addr, len)
  17422. --
  17423. --
  17424. - static u32
  17425. - brcmf_pcie_read_reg32(struct brcmf_pciedev_info *devinfo, u32 reg_offset)
  17426. - {
  17427. -@@ -1174,7 +1165,6 @@ static int brcmf_pcie_init_scratchbuffer
  17428. - goto fail;
  17429. -
  17430. - memset(devinfo->shared.scratch, 0, BRCMF_DMA_D2H_SCRATCH_BUF_LEN);
  17431. -- brcmf_dma_flush(devinfo->shared.scratch, BRCMF_DMA_D2H_SCRATCH_BUF_LEN);
  17432. -
  17433. - addr = devinfo->shared.tcm_base_address +
  17434. - BRCMF_SHARED_DMA_SCRATCH_ADDR_OFFSET;
  17435. -@@ -1192,7 +1182,6 @@ static int brcmf_pcie_init_scratchbuffer
  17436. - goto fail;
  17437. -
  17438. - memset(devinfo->shared.ringupd, 0, BRCMF_DMA_D2H_RINGUPD_BUF_LEN);
  17439. -- brcmf_dma_flush(devinfo->shared.ringupd, BRCMF_DMA_D2H_RINGUPD_BUF_LEN);
  17440. -
  17441. - addr = devinfo->shared.tcm_base_address +
  17442. - BRCMF_SHARED_DMA_RINGUPD_ADDR_OFFSET;
  17443. diff --git a/package/kernel/mac80211/patches/344-0005-brcmfmac-add-support-for-dma-indices-feature.patch b/package/kernel/mac80211/patches/344-0005-brcmfmac-add-support-for-dma-indices-feature.patch
  17444. deleted file mode 100644
  17445. index 2f50abd..0000000
  17446. --- a/package/kernel/mac80211/patches/344-0005-brcmfmac-add-support-for-dma-indices-feature.patch
  17447. +++ /dev/null
  17448. @@ -1,270 +0,0 @@
  17449. -From: Franky Lin <frankyl@broadcom.com>
  17450. -Date: Wed, 20 May 2015 14:09:51 +0200
  17451. -Subject: [PATCH] brcmfmac: add support for dma indices feature
  17452. -
  17453. -PCIe full dongle firmware can support a dma indices feature with which
  17454. -firmware can update/fetch the read/write indices of message buffer
  17455. -rings on both host to dongle and dongle to host directions. The support is
  17456. -announced by firmware through shared flags.
  17457. -
  17458. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  17459. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17460. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  17461. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17462. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17463. ----
  17464. -
  17465. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  17466. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  17467. -@@ -115,6 +115,8 @@ enum brcmf_pcie_state {
  17468. - #define BRCMF_PCIE_MIN_SHARED_VERSION 5
  17469. - #define BRCMF_PCIE_MAX_SHARED_VERSION 5
  17470. - #define BRCMF_PCIE_SHARED_VERSION_MASK 0x00FF
  17471. -+#define BRCMF_PCIE_SHARED_DMA_INDEX 0x10000
  17472. -+#define BRCMF_PCIE_SHARED_DMA_2B_IDX 0x100000
  17473. -
  17474. - #define BRCMF_PCIE_FLAGS_HTOD_SPLIT 0x4000
  17475. - #define BRCMF_PCIE_FLAGS_DTOH_SPLIT 0x8000
  17476. -@@ -146,6 +148,10 @@ enum brcmf_pcie_state {
  17477. - #define BRCMF_SHARED_RING_H2D_R_IDX_PTR_OFFSET 8
  17478. - #define BRCMF_SHARED_RING_D2H_W_IDX_PTR_OFFSET 12
  17479. - #define BRCMF_SHARED_RING_D2H_R_IDX_PTR_OFFSET 16
  17480. -+#define BRCMF_SHARED_RING_H2D_WP_HADDR_OFFSET 20
  17481. -+#define BRCMF_SHARED_RING_H2D_RP_HADDR_OFFSET 28
  17482. -+#define BRCMF_SHARED_RING_D2H_WP_HADDR_OFFSET 36
  17483. -+#define BRCMF_SHARED_RING_D2H_RP_HADDR_OFFSET 44
  17484. - #define BRCMF_SHARED_RING_TCM_MEMLOC_OFFSET 0
  17485. - #define BRCMF_SHARED_RING_MAX_SUB_QUEUES 52
  17486. -
  17487. -@@ -247,6 +253,13 @@ struct brcmf_pciedev_info {
  17488. - bool mbdata_completed;
  17489. - bool irq_allocated;
  17490. - bool wowl_enabled;
  17491. -+ u8 dma_idx_sz;
  17492. -+ void *idxbuf;
  17493. -+ u32 idxbuf_sz;
  17494. -+ dma_addr_t idxbuf_dmahandle;
  17495. -+ u16 (*read_ptr)(struct brcmf_pciedev_info *devinfo, u32 mem_offset);
  17496. -+ void (*write_ptr)(struct brcmf_pciedev_info *devinfo, u32 mem_offset,
  17497. -+ u16 value);
  17498. - };
  17499. -
  17500. - struct brcmf_pcie_ringbuf {
  17501. -@@ -323,6 +336,25 @@ brcmf_pcie_write_tcm16(struct brcmf_pcie
  17502. - }
  17503. -
  17504. -
  17505. -+static u16
  17506. -+brcmf_pcie_read_idx(struct brcmf_pciedev_info *devinfo, u32 mem_offset)
  17507. -+{
  17508. -+ u16 *address = devinfo->idxbuf + mem_offset;
  17509. -+
  17510. -+ return (*(address));
  17511. -+}
  17512. -+
  17513. -+
  17514. -+static void
  17515. -+brcmf_pcie_write_idx(struct brcmf_pciedev_info *devinfo, u32 mem_offset,
  17516. -+ u16 value)
  17517. -+{
  17518. -+ u16 *address = devinfo->idxbuf + mem_offset;
  17519. -+
  17520. -+ *(address) = value;
  17521. -+}
  17522. -+
  17523. -+
  17524. - static u32
  17525. - brcmf_pcie_read_tcm32(struct brcmf_pciedev_info *devinfo, u32 mem_offset)
  17526. - {
  17527. -@@ -868,7 +900,7 @@ static int brcmf_pcie_ring_mb_write_rptr
  17528. - brcmf_dbg(PCIE, "W r_ptr %d (%d), ring %d\n", commonring->r_ptr,
  17529. - commonring->w_ptr, ring->id);
  17530. -
  17531. -- brcmf_pcie_write_tcm16(devinfo, ring->r_idx_addr, commonring->r_ptr);
  17532. -+ devinfo->write_ptr(devinfo, ring->r_idx_addr, commonring->r_ptr);
  17533. -
  17534. - return 0;
  17535. - }
  17536. -@@ -886,7 +918,7 @@ static int brcmf_pcie_ring_mb_write_wptr
  17537. - brcmf_dbg(PCIE, "W w_ptr %d (%d), ring %d\n", commonring->w_ptr,
  17538. - commonring->r_ptr, ring->id);
  17539. -
  17540. -- brcmf_pcie_write_tcm16(devinfo, ring->w_idx_addr, commonring->w_ptr);
  17541. -+ devinfo->write_ptr(devinfo, ring->w_idx_addr, commonring->w_ptr);
  17542. -
  17543. - return 0;
  17544. - }
  17545. -@@ -915,7 +947,7 @@ static int brcmf_pcie_ring_mb_update_rpt
  17546. - if (devinfo->state != BRCMFMAC_PCIE_STATE_UP)
  17547. - return -EIO;
  17548. -
  17549. -- commonring->r_ptr = brcmf_pcie_read_tcm16(devinfo, ring->r_idx_addr);
  17550. -+ commonring->r_ptr = devinfo->read_ptr(devinfo, ring->r_idx_addr);
  17551. -
  17552. - brcmf_dbg(PCIE, "R r_ptr %d (%d), ring %d\n", commonring->r_ptr,
  17553. - commonring->w_ptr, ring->id);
  17554. -@@ -933,7 +965,7 @@ static int brcmf_pcie_ring_mb_update_wpt
  17555. - if (devinfo->state != BRCMFMAC_PCIE_STATE_UP)
  17556. - return -EIO;
  17557. -
  17558. -- commonring->w_ptr = brcmf_pcie_read_tcm16(devinfo, ring->w_idx_addr);
  17559. -+ commonring->w_ptr = devinfo->read_ptr(devinfo, ring->w_idx_addr);
  17560. -
  17561. - brcmf_dbg(PCIE, "R w_ptr %d (%d), ring %d\n", commonring->w_ptr,
  17562. - commonring->r_ptr, ring->id);
  17563. -@@ -1038,6 +1070,13 @@ static void brcmf_pcie_release_ringbuffe
  17564. - }
  17565. - kfree(devinfo->shared.flowrings);
  17566. - devinfo->shared.flowrings = NULL;
  17567. -+ if (devinfo->idxbuf) {
  17568. -+ dma_free_coherent(&devinfo->pdev->dev,
  17569. -+ devinfo->idxbuf_sz,
  17570. -+ devinfo->idxbuf,
  17571. -+ devinfo->idxbuf_dmahandle);
  17572. -+ devinfo->idxbuf = NULL;
  17573. -+ }
  17574. - }
  17575. -
  17576. -
  17577. -@@ -1053,19 +1092,72 @@ static int brcmf_pcie_init_ringbuffers(s
  17578. - u32 addr;
  17579. - u32 ring_mem_ptr;
  17580. - u32 i;
  17581. -+ u64 address;
  17582. -+ u32 bufsz;
  17583. - u16 max_sub_queues;
  17584. -+ u8 idx_offset;
  17585. -
  17586. - ring_addr = devinfo->shared.ring_info_addr;
  17587. - brcmf_dbg(PCIE, "Base ring addr = 0x%08x\n", ring_addr);
  17588. -+ addr = ring_addr + BRCMF_SHARED_RING_MAX_SUB_QUEUES;
  17589. -+ max_sub_queues = brcmf_pcie_read_tcm16(devinfo, addr);
  17590. -
  17591. -- addr = ring_addr + BRCMF_SHARED_RING_D2H_W_IDX_PTR_OFFSET;
  17592. -- d2h_w_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  17593. -- addr = ring_addr + BRCMF_SHARED_RING_D2H_R_IDX_PTR_OFFSET;
  17594. -- d2h_r_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  17595. -- addr = ring_addr + BRCMF_SHARED_RING_H2D_W_IDX_PTR_OFFSET;
  17596. -- h2d_w_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  17597. -- addr = ring_addr + BRCMF_SHARED_RING_H2D_R_IDX_PTR_OFFSET;
  17598. -- h2d_r_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  17599. -+ if (devinfo->dma_idx_sz != 0) {
  17600. -+ bufsz = (BRCMF_NROF_D2H_COMMON_MSGRINGS + max_sub_queues) *
  17601. -+ devinfo->dma_idx_sz * 2;
  17602. -+ devinfo->idxbuf = dma_alloc_coherent(&devinfo->pdev->dev, bufsz,
  17603. -+ &devinfo->idxbuf_dmahandle,
  17604. -+ GFP_KERNEL);
  17605. -+ if (!devinfo->idxbuf)
  17606. -+ devinfo->dma_idx_sz = 0;
  17607. -+ }
  17608. -+
  17609. -+ if (devinfo->dma_idx_sz == 0) {
  17610. -+ addr = ring_addr + BRCMF_SHARED_RING_D2H_W_IDX_PTR_OFFSET;
  17611. -+ d2h_w_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  17612. -+ addr = ring_addr + BRCMF_SHARED_RING_D2H_R_IDX_PTR_OFFSET;
  17613. -+ d2h_r_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  17614. -+ addr = ring_addr + BRCMF_SHARED_RING_H2D_W_IDX_PTR_OFFSET;
  17615. -+ h2d_w_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  17616. -+ addr = ring_addr + BRCMF_SHARED_RING_H2D_R_IDX_PTR_OFFSET;
  17617. -+ h2d_r_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  17618. -+ idx_offset = sizeof(u32);
  17619. -+ devinfo->write_ptr = brcmf_pcie_write_tcm16;
  17620. -+ devinfo->read_ptr = brcmf_pcie_read_tcm16;
  17621. -+ brcmf_dbg(PCIE, "Using TCM indices\n");
  17622. -+ } else {
  17623. -+ memset(devinfo->idxbuf, 0, bufsz);
  17624. -+ devinfo->idxbuf_sz = bufsz;
  17625. -+ idx_offset = devinfo->dma_idx_sz;
  17626. -+ devinfo->write_ptr = brcmf_pcie_write_idx;
  17627. -+ devinfo->read_ptr = brcmf_pcie_read_idx;
  17628. -+
  17629. -+ h2d_w_idx_ptr = 0;
  17630. -+ addr = ring_addr + BRCMF_SHARED_RING_H2D_WP_HADDR_OFFSET;
  17631. -+ address = (u64)devinfo->idxbuf_dmahandle;
  17632. -+ brcmf_pcie_write_tcm32(devinfo, addr, address & 0xffffffff);
  17633. -+ brcmf_pcie_write_tcm32(devinfo, addr + 4, address >> 32);
  17634. -+
  17635. -+ h2d_r_idx_ptr = h2d_w_idx_ptr + max_sub_queues * idx_offset;
  17636. -+ addr = ring_addr + BRCMF_SHARED_RING_H2D_RP_HADDR_OFFSET;
  17637. -+ address += max_sub_queues * idx_offset;
  17638. -+ brcmf_pcie_write_tcm32(devinfo, addr, address & 0xffffffff);
  17639. -+ brcmf_pcie_write_tcm32(devinfo, addr + 4, address >> 32);
  17640. -+
  17641. -+ d2h_w_idx_ptr = h2d_r_idx_ptr + max_sub_queues * idx_offset;
  17642. -+ addr = ring_addr + BRCMF_SHARED_RING_D2H_WP_HADDR_OFFSET;
  17643. -+ address += max_sub_queues * idx_offset;
  17644. -+ brcmf_pcie_write_tcm32(devinfo, addr, address & 0xffffffff);
  17645. -+ brcmf_pcie_write_tcm32(devinfo, addr + 4, address >> 32);
  17646. -+
  17647. -+ d2h_r_idx_ptr = d2h_w_idx_ptr +
  17648. -+ BRCMF_NROF_D2H_COMMON_MSGRINGS * idx_offset;
  17649. -+ addr = ring_addr + BRCMF_SHARED_RING_D2H_RP_HADDR_OFFSET;
  17650. -+ address += BRCMF_NROF_D2H_COMMON_MSGRINGS * idx_offset;
  17651. -+ brcmf_pcie_write_tcm32(devinfo, addr, address & 0xffffffff);
  17652. -+ brcmf_pcie_write_tcm32(devinfo, addr + 4, address >> 32);
  17653. -+ brcmf_dbg(PCIE, "Using host memory indices\n");
  17654. -+ }
  17655. -
  17656. - addr = ring_addr + BRCMF_SHARED_RING_TCM_MEMLOC_OFFSET;
  17657. - ring_mem_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  17658. -@@ -1079,8 +1171,8 @@ static int brcmf_pcie_init_ringbuffers(s
  17659. - ring->id = i;
  17660. - devinfo->shared.commonrings[i] = ring;
  17661. -
  17662. -- h2d_w_idx_ptr += sizeof(u32);
  17663. -- h2d_r_idx_ptr += sizeof(u32);
  17664. -+ h2d_w_idx_ptr += idx_offset;
  17665. -+ h2d_r_idx_ptr += idx_offset;
  17666. - ring_mem_ptr += BRCMF_RING_MEM_SZ;
  17667. - }
  17668. -
  17669. -@@ -1094,13 +1186,11 @@ static int brcmf_pcie_init_ringbuffers(s
  17670. - ring->id = i;
  17671. - devinfo->shared.commonrings[i] = ring;
  17672. -
  17673. -- d2h_w_idx_ptr += sizeof(u32);
  17674. -- d2h_r_idx_ptr += sizeof(u32);
  17675. -+ d2h_w_idx_ptr += idx_offset;
  17676. -+ d2h_r_idx_ptr += idx_offset;
  17677. - ring_mem_ptr += BRCMF_RING_MEM_SZ;
  17678. - }
  17679. -
  17680. -- addr = ring_addr + BRCMF_SHARED_RING_MAX_SUB_QUEUES;
  17681. -- max_sub_queues = brcmf_pcie_read_tcm16(devinfo, addr);
  17682. - devinfo->shared.nrof_flowrings =
  17683. - max_sub_queues - BRCMF_NROF_H2D_COMMON_MSGRINGS;
  17684. - rings = kcalloc(devinfo->shared.nrof_flowrings, sizeof(*ring),
  17685. -@@ -1124,15 +1214,15 @@ static int brcmf_pcie_init_ringbuffers(s
  17686. - ring);
  17687. - ring->w_idx_addr = h2d_w_idx_ptr;
  17688. - ring->r_idx_addr = h2d_r_idx_ptr;
  17689. -- h2d_w_idx_ptr += sizeof(u32);
  17690. -- h2d_r_idx_ptr += sizeof(u32);
  17691. -+ h2d_w_idx_ptr += idx_offset;
  17692. -+ h2d_r_idx_ptr += idx_offset;
  17693. - }
  17694. - devinfo->shared.flowrings = rings;
  17695. -
  17696. - return 0;
  17697. -
  17698. - fail:
  17699. -- brcmf_err("Allocating commonring buffers failed\n");
  17700. -+ brcmf_err("Allocating ring buffers failed\n");
  17701. - brcmf_pcie_release_ringbuffers(devinfo);
  17702. - return -ENOMEM;
  17703. - }
  17704. -@@ -1269,6 +1359,14 @@ brcmf_pcie_init_share_ram_info(struct br
  17705. - return -EINVAL;
  17706. - }
  17707. -
  17708. -+ /* check firmware support dma indicies */
  17709. -+ if (shared->flags & BRCMF_PCIE_SHARED_DMA_INDEX) {
  17710. -+ if (shared->flags & BRCMF_PCIE_SHARED_DMA_2B_IDX)
  17711. -+ devinfo->dma_idx_sz = sizeof(u16);
  17712. -+ else
  17713. -+ devinfo->dma_idx_sz = sizeof(u32);
  17714. -+ }
  17715. -+
  17716. - addr = sharedram_addr + BRCMF_SHARED_MAX_RXBUFPOST_OFFSET;
  17717. - shared->max_rxbufpost = brcmf_pcie_read_tcm16(devinfo, addr);
  17718. - if (shared->max_rxbufpost == 0)
  17719. diff --git a/package/kernel/mac80211/patches/345-brcmfmac-avoid-null-pointer-access-when-brcmf_msgbuf.patch b/package/kernel/mac80211/patches/345-brcmfmac-avoid-null-pointer-access-when-brcmf_msgbuf.patch
  17720. deleted file mode 100644
  17721. index 28408d2..0000000
  17722. --- a/package/kernel/mac80211/patches/345-brcmfmac-avoid-null-pointer-access-when-brcmf_msgbuf.patch
  17723. +++ /dev/null
  17724. @@ -1,102 +0,0 @@
  17725. -From: Arend van Spriel <arend@broadcom.com>
  17726. -Date: Tue, 26 May 2015 13:19:46 +0200
  17727. -Subject: [PATCH] brcmfmac: avoid null pointer access when
  17728. - brcmf_msgbuf_get_pktid() fails
  17729. -
  17730. -The function brcmf_msgbuf_get_pktid() may return a NULL pointer so
  17731. -the callers should check the return pointer before accessing it to
  17732. -avoid the crash below (see [1]):
  17733. -
  17734. -brcmfmac: brcmf_msgbuf_get_pktid: Invalid packet id 273 (not in use)
  17735. -BUG: unable to handle kernel NULL pointer dereference at 0000000000000080
  17736. -IP: [<ffffffff8145b225>] skb_pull+0x5/0x50
  17737. -PGD 0
  17738. -Oops: 0000 [#1] PREEMPT SMP
  17739. -Modules linked in: pci_stub vboxpci(O) vboxnetflt(O) vboxnetadp(O) vboxdrv(O)
  17740. - snd_hda_codec_hdmi bnep mousedev hid_generic ushwmon msr ext4 crc16 mbcache
  17741. - jbd2 sd_mod uas usb_storage ahci libahci libata scsi_mod xhci_pci xhci_hcd
  17742. - usbcore usb_common
  17743. -CPU: 0 PID: 1661 Comm: irq/61-brcmf_pc Tainted: G O 4.0.1-MacbookPro-ARCH #1
  17744. -Hardware name: Apple Inc. MacBookPro12,1/Mac-E43C1C25D4880AD6,
  17745. - BIOS MBP121.88Z.0167.B02.1503241251 03/24/2015
  17746. -task: ffff880264203cc0 ti: ffff88025ffe4000 task.ti: ffff88025ffe4000
  17747. -RIP: 0010:[<ffffffff8145b225>] [<ffffffff8145b225>] skb_pull+0x5/0x50
  17748. -RSP: 0018:ffff88025ffe7d40 EFLAGS: 00010202
  17749. -RAX: 0000000000000000 RBX: ffff88008a33c000 RCX: 0000000000000044
  17750. -RDX: 0000000000000000 RSI: 000000000000004a RDI: 0000000000000000
  17751. -RBP: ffff88025ffe7da8 R08: 0000000000000096 R09: 000000000000004a
  17752. -R10: 0000000000000000 R11: 000000000000048e R12: ffff88025ff14f00
  17753. -R13: 0000000000000000 R14: ffff880263b48200 R15: ffff88008a33c000
  17754. -FS: 0000000000000000(0000) GS:ffff88026ec00000(0000) knlGS:0000000000000000
  17755. -CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  17756. -CR2: 0000000000000080 CR3: 000000000180b000 CR4: 00000000003407f0
  17757. -Stack:
  17758. - ffffffffa06aed74 ffff88025ffe7dc8 ffff880263b48270 ffff880263b48278
  17759. - 05ea88020000004a 0002ffff81014635 000000001720b2f6 ffff88026ec116c0
  17760. - ffff880263b48200 0000000000010000 ffff880263b4ae00 ffff880264203cc0
  17761. -Call Trace:
  17762. - [<ffffffffa06aed74>] ? brcmf_msgbuf_process_rx+0x404/0x480 [brcmfmac]
  17763. - [<ffffffff810cea60>] ? irq_finalize_oneshot.part.30+0xf0/0xf0
  17764. - [<ffffffffa06afb55>] brcmf_proto_msgbuf_rx_trigger+0x35/0xf0 [brcmfmac]
  17765. - [<ffffffffa06baf2a>] brcmf_pcie_isr_thread_v2+0x8a/0x130 [brcmfmac]
  17766. - [<ffffffff810cea80>] irq_thread_fn+0x20/0x50
  17767. - [<ffffffff810ceddf>] irq_thread+0x13f/0x170
  17768. - [<ffffffff810cebf0>] ? wake_threads_waitq+0x30/0x30
  17769. - [<ffffffff810ceca0>] ? irq_thread_dtor+0xb0/0xb0
  17770. - [<ffffffff81092a08>] kthread+0xd8/0xf0
  17771. - [<ffffffff81092930>] ? kthread_create_on_node+0x1c0/0x1c0
  17772. - [<ffffffff8156d898>] ret_from_fork+0x58/0x90
  17773. - [<ffffffff81092930>] ? kthread_create_on_node+0x1c0/0x1c0
  17774. -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
  17775. - f7 88 50 01 c3 66 0f 1f 84 00 00 00 00 00 0f 1f
  17776. -RIP [<ffffffff8145b225>] skb_pull+0x5/0x50
  17777. - RSP <ffff88025ffe7d40>
  17778. -CR2: 0000000000000080
  17779. ----[ end trace b074c0f90e7c997d ]---
  17780. -
  17781. -[1] http://mid.gmane.org/20150430193259.GA5630@googlemail.com
  17782. -
  17783. -Cc: <stable@vger.kernel.org> # v3.18, v3.19, v4.0, v4.1
  17784. -Reported-by: Michael Hornung <mhornung.linux@gmail.com>
  17785. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  17786. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17787. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17788. ----
  17789. -
  17790. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  17791. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  17792. -@@ -500,11 +500,9 @@ static int brcmf_msgbuf_query_dcmd(struc
  17793. - msgbuf->rx_pktids,
  17794. - msgbuf->ioctl_resp_pktid);
  17795. - if (msgbuf->ioctl_resp_ret_len != 0) {
  17796. -- if (!skb) {
  17797. -- brcmf_err("Invalid packet id idx recv'd %d\n",
  17798. -- msgbuf->ioctl_resp_pktid);
  17799. -+ if (!skb)
  17800. - return -EBADF;
  17801. -- }
  17802. -+
  17803. - memcpy(buf, skb->data, (len < msgbuf->ioctl_resp_ret_len) ?
  17804. - len : msgbuf->ioctl_resp_ret_len);
  17805. - }
  17806. -@@ -866,10 +864,8 @@ brcmf_msgbuf_process_txstatus(struct brc
  17807. - flowid -= BRCMF_NROF_H2D_COMMON_MSGRINGS;
  17808. - skb = brcmf_msgbuf_get_pktid(msgbuf->drvr->bus_if->dev,
  17809. - msgbuf->tx_pktids, idx);
  17810. -- if (!skb) {
  17811. -- brcmf_err("Invalid packet id idx recv'd %d\n", idx);
  17812. -+ if (!skb)
  17813. - return;
  17814. -- }
  17815. -
  17816. - set_bit(flowid, msgbuf->txstatus_done_map);
  17817. - commonring = msgbuf->flowrings[flowid];
  17818. -@@ -1148,6 +1144,8 @@ brcmf_msgbuf_process_rx_complete(struct
  17819. -
  17820. - skb = brcmf_msgbuf_get_pktid(msgbuf->drvr->bus_if->dev,
  17821. - msgbuf->rx_pktids, idx);
  17822. -+ if (!skb)
  17823. -+ return;
  17824. -
  17825. - if (data_offset)
  17826. - skb_pull(skb, data_offset);
  17827. diff --git a/package/kernel/mac80211/patches/346-brcmfmac-fix-invalid-access-to-struct-acpi_device-fi.patch b/package/kernel/mac80211/patches/346-brcmfmac-fix-invalid-access-to-struct-acpi_device-fi.patch
  17828. deleted file mode 100644
  17829. index f023034..0000000
  17830. --- a/package/kernel/mac80211/patches/346-brcmfmac-fix-invalid-access-to-struct-acpi_device-fi.patch
  17831. +++ /dev/null
  17832. @@ -1,63 +0,0 @@
  17833. -From: Arend van Spriel <arend@broadcom.com>
  17834. -Date: Wed, 27 May 2015 19:31:41 +0200
  17835. -Subject: [PATCH] brcmfmac: fix invalid access to struct acpi_device fields
  17836. -
  17837. -The fields of struct acpi_device are only known when CONFIG_ACPI is
  17838. -defined. Fix this by using a helper function. This will resolve the
  17839. -issue found in linux-next:
  17840. -
  17841. - ../brcmfmac/bcmsdh.c: In function 'brcmf_ops_sdio_probe':
  17842. - ../brcmfmac/bcmsdh.c:1139:7: error: dereferencing pointer to incomplete type
  17843. - adev->flags.power_manageable = 0;
  17844. - ^
  17845. -
  17846. -Fixes: f0992ace680c ("brcmfmac: prohibit ACPI power management ...")
  17847. -Cc: Fu, Zhonghui <zhonghui.fu@linux.intel.com>
  17848. -Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
  17849. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17850. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17851. ----
  17852. -
  17853. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  17854. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  17855. -@@ -1117,6 +1117,18 @@ MODULE_DEVICE_TABLE(sdio, brcmf_sdmmc_id
  17856. - static struct brcmfmac_sdio_platform_data *brcmfmac_sdio_pdata;
  17857. -
  17858. -
  17859. -+static void brcmf_sdiod_acpi_set_power_manageable(struct device *dev,
  17860. -+ int val)
  17861. -+{
  17862. -+#if IS_ENABLED(CONFIG_ACPI)
  17863. -+ struct acpi_device *adev;
  17864. -+
  17865. -+ adev = ACPI_COMPANION(dev);
  17866. -+ if (adev)
  17867. -+ adev->flags.power_manageable = 0;
  17868. -+#endif
  17869. -+}
  17870. -+
  17871. - static int brcmf_ops_sdio_probe(struct sdio_func *func,
  17872. - const struct sdio_device_id *id)
  17873. - {
  17874. -@@ -1124,7 +1136,6 @@ static int brcmf_ops_sdio_probe(struct s
  17875. - struct brcmf_sdio_dev *sdiodev;
  17876. - struct brcmf_bus *bus_if;
  17877. - struct device *dev;
  17878. -- struct acpi_device *adev;
  17879. -
  17880. - brcmf_dbg(SDIO, "Enter\n");
  17881. - brcmf_dbg(SDIO, "Class=%x\n", func->class);
  17882. -@@ -1132,11 +1143,9 @@ static int brcmf_ops_sdio_probe(struct s
  17883. - brcmf_dbg(SDIO, "sdio device ID: 0x%04x\n", func->device);
  17884. - brcmf_dbg(SDIO, "Function#: %d\n", func->num);
  17885. -
  17886. -- /* prohibit ACPI power management for this device */
  17887. - dev = &func->dev;
  17888. -- adev = ACPI_COMPANION(dev);
  17889. -- if (adev)
  17890. -- adev->flags.power_manageable = 0;
  17891. -+ /* prohibit ACPI power management for this device */
  17892. -+ brcmf_sdiod_acpi_set_power_manageable(dev, 0);
  17893. -
  17894. - /* Consume func num 1 but dont do anything with it. */
  17895. - if (func->num == 1)
  17896. diff --git a/package/kernel/mac80211/patches/347-brcmfmac-simplify-check-stripping-v2-NVRAM.patch b/package/kernel/mac80211/patches/347-brcmfmac-simplify-check-stripping-v2-NVRAM.patch
  17897. deleted file mode 100644
  17898. index 2bfd44f..0000000
  17899. --- a/package/kernel/mac80211/patches/347-brcmfmac-simplify-check-stripping-v2-NVRAM.patch
  17900. +++ /dev/null
  17901. @@ -1,56 +0,0 @@
  17902. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17903. -Date: Wed, 20 May 2015 09:34:21 +0200
  17904. -Subject: [PATCH] brcmfmac: simplify check stripping v2 NVRAM
  17905. -MIME-Version: 1.0
  17906. -Content-Type: text/plain; charset=UTF-8
  17907. -Content-Transfer-Encoding: 8bit
  17908. -
  17909. -Comparing NVRAM entry with a full filtering string is simpler than
  17910. -comparing it with a short prefix and then checking random chars at magic
  17911. -offsets. The cost of snprintf relatively low, we execute it just once.
  17912. -Tested on BCM43602 with NVRAM hacked to use V2 format.
  17913. -
  17914. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  17915. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17916. ----
  17917. -
  17918. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17919. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17920. -@@ -25,7 +25,7 @@
  17921. -
  17922. - #define BRCMF_FW_MAX_NVRAM_SIZE 64000
  17923. - #define BRCMF_FW_NVRAM_DEVPATH_LEN 19 /* devpath0=pcie/1/4/ */
  17924. --#define BRCMF_FW_NVRAM_PCIEDEV_LEN 9 /* pcie/1/4/ */
  17925. -+#define BRCMF_FW_NVRAM_PCIEDEV_LEN 10 /* pcie/1/4/ + \0 */
  17926. -
  17927. - char brcmf_firmware_path[BRCMF_FW_PATH_LEN];
  17928. - module_param_string(firmware_path, brcmf_firmware_path,
  17929. -@@ -297,6 +297,8 @@ fail:
  17930. - static void brcmf_fw_strip_multi_v2(struct nvram_parser *nvp, u16 domain_nr,
  17931. - u16 bus_nr)
  17932. - {
  17933. -+ char prefix[BRCMF_FW_NVRAM_PCIEDEV_LEN];
  17934. -+ size_t len;
  17935. - u32 i, j;
  17936. - u8 *nvram;
  17937. -
  17938. -@@ -308,14 +310,13 @@ static void brcmf_fw_strip_multi_v2(stru
  17939. - * Valid entries are of type pcie/X/Y/ where X = domain_nr and
  17940. - * Y = bus_nr.
  17941. - */
  17942. -+ snprintf(prefix, sizeof(prefix), "pcie/%d/%d/", domain_nr, bus_nr);
  17943. -+ len = strlen(prefix);
  17944. - i = 0;
  17945. - j = 0;
  17946. -- while (i < nvp->nvram_len - BRCMF_FW_NVRAM_PCIEDEV_LEN) {
  17947. -- if ((strncmp(&nvp->nvram[i], "pcie/", 5) == 0) &&
  17948. -- (nvp->nvram[i + 6] == '/') && (nvp->nvram[i + 8] == '/') &&
  17949. -- ((nvp->nvram[i + 5] - '0') == domain_nr) &&
  17950. -- ((nvp->nvram[i + 7] - '0') == bus_nr)) {
  17951. -- i += BRCMF_FW_NVRAM_PCIEDEV_LEN;
  17952. -+ while (i < nvp->nvram_len - len) {
  17953. -+ if (strncmp(&nvp->nvram[i], prefix, len) == 0) {
  17954. -+ i += len;
  17955. - while (nvp->nvram[i] != 0) {
  17956. - nvram[j] = nvp->nvram[i];
  17957. - i++;
  17958. diff --git a/package/kernel/mac80211/patches/348-brcmfmac-simplify-check-finding-NVRAM-v1-device-path.patch b/package/kernel/mac80211/patches/348-brcmfmac-simplify-check-finding-NVRAM-v1-device-path.patch
  17959. deleted file mode 100644
  17960. index 0e65114..0000000
  17961. --- a/package/kernel/mac80211/patches/348-brcmfmac-simplify-check-finding-NVRAM-v1-device-path.patch
  17962. +++ /dev/null
  17963. @@ -1,57 +0,0 @@
  17964. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17965. -Date: Wed, 20 May 2015 11:01:08 +0200
  17966. -Subject: [PATCH] brcmfmac: simplify check finding NVRAM v1 device path
  17967. -MIME-Version: 1.0
  17968. -Content-Type: text/plain; charset=UTF-8
  17969. -Content-Transfer-Encoding: 8bit
  17970. -
  17971. -With a simple use of snprintf and small buffer we can compare NVRAM
  17972. -entry value with a full string. This way we avoid checking random chars
  17973. -at magic offsets.
  17974. -Tested on BCM43602 with NVRAM hacked to use v1 format.
  17975. -
  17976. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  17977. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17978. ----
  17979. -
  17980. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17981. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17982. -@@ -222,6 +222,10 @@ static int brcmf_init_nvram_parser(struc
  17983. - static void brcmf_fw_strip_multi_v1(struct nvram_parser *nvp, u16 domain_nr,
  17984. - u16 bus_nr)
  17985. - {
  17986. -+ /* Device path with a leading '=' key-value separator */
  17987. -+ char pcie_path[] = "=pcie/?/?";
  17988. -+ size_t pcie_len;
  17989. -+
  17990. - u32 i, j;
  17991. - bool found;
  17992. - u8 *nvram;
  17993. -@@ -238,6 +242,9 @@ static void brcmf_fw_strip_multi_v1(stru
  17994. - /* First search for the devpathX and see if it is the configuration
  17995. - * for domain_nr/bus_nr. Search complete nvp
  17996. - */
  17997. -+ snprintf(pcie_path, sizeof(pcie_path), "=pcie/%d/%d", domain_nr,
  17998. -+ bus_nr);
  17999. -+ pcie_len = strlen(pcie_path);
  18000. - found = false;
  18001. - i = 0;
  18002. - while (i < nvp->nvram_len - BRCMF_FW_NVRAM_DEVPATH_LEN) {
  18003. -@@ -245,13 +252,10 @@ static void brcmf_fw_strip_multi_v1(stru
  18004. - * Y = domain_nr, Z = bus_nr, X = virtual ID
  18005. - */
  18006. - if ((strncmp(&nvp->nvram[i], "devpath", 7) == 0) &&
  18007. -- (strncmp(&nvp->nvram[i + 8], "=pcie/", 6) == 0)) {
  18008. -- if (((nvp->nvram[i + 14] - '0') == domain_nr) &&
  18009. -- ((nvp->nvram[i + 16] - '0') == bus_nr)) {
  18010. -- id = nvp->nvram[i + 7] - '0';
  18011. -- found = true;
  18012. -- break;
  18013. -- }
  18014. -+ (strncmp(&nvp->nvram[i + 8], pcie_path, pcie_len) == 0)) {
  18015. -+ id = nvp->nvram[i + 7] - '0';
  18016. -+ found = true;
  18017. -+ break;
  18018. - }
  18019. - while (nvp->nvram[i] != 0)
  18020. - i++;
  18021. diff --git a/package/kernel/mac80211/patches/349-brcmfmac-treat-0-as-end-of-comment-when-parsing-NVRA.patch b/package/kernel/mac80211/patches/349-brcmfmac-treat-0-as-end-of-comment-when-parsing-NVRA.patch
  18022. deleted file mode 100644
  18023. index dc174e5..0000000
  18024. --- a/package/kernel/mac80211/patches/349-brcmfmac-treat-0-as-end-of-comment-when-parsing-NVRA.patch
  18025. +++ /dev/null
  18026. @@ -1,45 +0,0 @@
  18027. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  18028. -Date: Wed, 20 May 2015 13:59:54 +0200
  18029. -Subject: [PATCH] brcmfmac: treat \0 as end of comment when parsing NVRAM
  18030. -MIME-Version: 1.0
  18031. -Content-Type: text/plain; charset=UTF-8
  18032. -Content-Transfer-Encoding: 8bit
  18033. -
  18034. -This fixes brcmfmac dealing with NVRAM coming from platform e.g. from a
  18035. -flash MTD partition. In such cases entries are separated by \0 instead
  18036. -of \n which caused ignoring whole content after the first "comment".
  18037. -While platform NVRAM doesn't usually contain comments, we switch to
  18038. -COMMENT state after e.g. finding an unexpected char in key name.
  18039. -
  18040. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  18041. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18042. ----
  18043. -
  18044. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  18045. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  18046. -@@ -162,17 +162,20 @@ brcmf_nvram_handle_value(struct nvram_pa
  18047. - static enum nvram_parser_state
  18048. - brcmf_nvram_handle_comment(struct nvram_parser *nvp)
  18049. - {
  18050. -- char *eol, *sol;
  18051. -+ char *eoc, *sol;
  18052. -
  18053. - sol = (char *)&nvp->fwnv->data[nvp->pos];
  18054. -- eol = strchr(sol, '\n');
  18055. -- if (eol == NULL)
  18056. -- return END;
  18057. -+ eoc = strchr(sol, '\n');
  18058. -+ if (!eoc) {
  18059. -+ eoc = strchr(sol, '\0');
  18060. -+ if (!eoc)
  18061. -+ return END;
  18062. -+ }
  18063. -
  18064. - /* eat all moving to next line */
  18065. - nvp->line++;
  18066. - nvp->column = 1;
  18067. -- nvp->pos += (eol - sol) + 1;
  18068. -+ nvp->pos += (eoc - sol) + 1;
  18069. - return IDLE;
  18070. - }
  18071. -
  18072. diff --git a/package/kernel/mac80211/patches/350-brcmfmac-allow-NVRAM-values-to-contain-spaces.patch b/package/kernel/mac80211/patches/350-brcmfmac-allow-NVRAM-values-to-contain-spaces.patch
  18073. deleted file mode 100644
  18074. index 5700142..0000000
  18075. --- a/package/kernel/mac80211/patches/350-brcmfmac-allow-NVRAM-values-to-contain-spaces.patch
  18076. +++ /dev/null
  18077. @@ -1,50 +0,0 @@
  18078. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  18079. -Date: Sat, 23 May 2015 09:15:33 +0200
  18080. -Subject: [PATCH] brcmfmac: allow NVRAM values to contain spaces
  18081. -MIME-Version: 1.0
  18082. -Content-Type: text/plain; charset=UTF-8
  18083. -Content-Transfer-Encoding: 8bit
  18084. -
  18085. -Platform NVRAMs often contain values with spaces. Even if right now most
  18086. -firmware-supported entries are simple values, we shouldn't reject these
  18087. -with spaces. It was semi-confirmed by Broadcom in the early patch adding
  18088. -support for platform NVRAMs.
  18089. -
  18090. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  18091. -Acked-by: Arend van Spriel <arend@broadcom.com>
  18092. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18093. ----
  18094. -
  18095. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  18096. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  18097. -@@ -66,6 +66,12 @@ struct nvram_parser {
  18098. - bool multi_dev_v2;
  18099. - };
  18100. -
  18101. -+/**
  18102. -+ * is_nvram_char() - check if char is a valid one for NVRAM entry
  18103. -+ *
  18104. -+ * It accepts all printable ASCII chars except for '#' which opens a comment.
  18105. -+ * Please note that ' ' (space) while accepted is not a valid key name char.
  18106. -+ */
  18107. - static bool is_nvram_char(char c)
  18108. - {
  18109. - /* comment marker excluded */
  18110. -@@ -73,7 +79,7 @@ static bool is_nvram_char(char c)
  18111. - return false;
  18112. -
  18113. - /* key and value may have any other readable character */
  18114. -- return (c > 0x20 && c < 0x7f);
  18115. -+ return (c >= 0x20 && c < 0x7f);
  18116. - }
  18117. -
  18118. - static bool is_whitespace(char c)
  18119. -@@ -120,7 +126,7 @@ static enum nvram_parser_state brcmf_nvr
  18120. - nvp->multi_dev_v1 = true;
  18121. - if (strncmp(&nvp->fwnv->data[nvp->entry], "pcie/", 5) == 0)
  18122. - nvp->multi_dev_v2 = true;
  18123. -- } else if (!is_nvram_char(c)) {
  18124. -+ } else if (!is_nvram_char(c) || c == ' ') {
  18125. - brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n",
  18126. - nvp->line, nvp->column);
  18127. - return COMMENT;
  18128. diff --git a/package/kernel/mac80211/patches/351-ath9k-fix-DMA-stop-sequence-for-AR9003.patch b/package/kernel/mac80211/patches/351-ath9k-fix-DMA-stop-sequence-for-AR9003.patch
  18129. deleted file mode 100644
  18130. index 814b0d7..0000000
  18131. --- a/package/kernel/mac80211/patches/351-ath9k-fix-DMA-stop-sequence-for-AR9003.patch
  18132. +++ /dev/null
  18133. @@ -1,33 +0,0 @@
  18134. -From: Felix Fietkau <nbd@openwrt.org>
  18135. -Date: Tue, 2 Jun 2015 10:35:46 +0200
  18136. -Subject: [PATCH] ath9k: fix DMA stop sequence for AR9003+
  18137. -
  18138. -AR93xx and newer needs to stop rx before tx to avoid getting the DMA
  18139. -engine or MAC into a stuck state.
  18140. -This should reduce/fix the occurence of "Failed to stop Tx DMA" logspam.
  18141. -
  18142. -Cc: stable@vger.kernel.org
  18143. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  18144. ----
  18145. -
  18146. ---- a/drivers/net/wireless/ath/ath9k/main.c
  18147. -+++ b/drivers/net/wireless/ath/ath9k/main.c
  18148. -@@ -216,11 +216,13 @@ static bool ath_prepare_reset(struct ath
  18149. - ath_stop_ani(sc);
  18150. - ath9k_hw_disable_interrupts(ah);
  18151. -
  18152. -- if (!ath_drain_all_txq(sc))
  18153. -- ret = false;
  18154. --
  18155. -- if (!ath_stoprecv(sc))
  18156. -- ret = false;
  18157. -+ if (AR_SREV_9300_20_OR_LATER(ah)) {
  18158. -+ ret &= ath_stoprecv(sc);
  18159. -+ ret &= ath_drain_all_txq(sc);
  18160. -+ } else {
  18161. -+ ret &= ath_drain_all_txq(sc);
  18162. -+ ret &= ath_stoprecv(sc);
  18163. -+ }
  18164. -
  18165. - return ret;
  18166. - }
  18167. diff --git a/package/kernel/mac80211/patches/352-brcmfmac-support-NVRAMs-containing-pci-devpaths-inst.patch b/package/kernel/mac80211/patches/352-brcmfmac-support-NVRAMs-containing-pci-devpaths-inst.patch
  18168. deleted file mode 100644
  18169. index 7bbd57e..0000000
  18170. --- a/package/kernel/mac80211/patches/352-brcmfmac-support-NVRAMs-containing-pci-devpaths-inst.patch
  18171. +++ /dev/null
  18172. @@ -1,56 +0,0 @@
  18173. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  18174. -Date: Thu, 28 May 2015 14:19:21 +0200
  18175. -Subject: [PATCH] brcmfmac: support NVRAMs containing pci devpaths (instead of
  18176. - pcie)
  18177. -MIME-Version: 1.0
  18178. -Content-Type: text/plain; charset=UTF-8
  18179. -Content-Transfer-Encoding: 8bit
  18180. -
  18181. -Recently Broadcom added support for NVRAMs with entries for multiple
  18182. -PCIe devices. One of the supported formats is based on prefixes defined
  18183. -like: devpath0=pcie/1/4/ and entries like 0:foo=bar 0:baz=qux etc.
  18184. -
  18185. -Unfortunately there are also a bit older devices using different way of
  18186. -defining prefixes, e.g. SmartRG SR400ac (2 x BCM43602) with entries:
  18187. -devpath0=pci/1/1/
  18188. -devpath1=pci/2/1
  18189. -Broadcom stated this old format will never be used/supported by brcmfmac
  18190. -but given the simplicity of this patch I'll insist on supporting it.
  18191. -
  18192. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  18193. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18194. ----
  18195. -
  18196. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  18197. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  18198. -@@ -232,6 +232,8 @@ static void brcmf_fw_strip_multi_v1(stru
  18199. - u16 bus_nr)
  18200. - {
  18201. - /* Device path with a leading '=' key-value separator */
  18202. -+ char pci_path[] = "=pci/?/?";
  18203. -+ size_t pci_len;
  18204. - char pcie_path[] = "=pcie/?/?";
  18205. - size_t pcie_len;
  18206. -
  18207. -@@ -251,6 +253,9 @@ static void brcmf_fw_strip_multi_v1(stru
  18208. - /* First search for the devpathX and see if it is the configuration
  18209. - * for domain_nr/bus_nr. Search complete nvp
  18210. - */
  18211. -+ snprintf(pci_path, sizeof(pci_path), "=pci/%d/%d", domain_nr,
  18212. -+ bus_nr);
  18213. -+ pci_len = strlen(pci_path);
  18214. - snprintf(pcie_path, sizeof(pcie_path), "=pcie/%d/%d", domain_nr,
  18215. - bus_nr);
  18216. - pcie_len = strlen(pcie_path);
  18217. -@@ -260,8 +265,9 @@ static void brcmf_fw_strip_multi_v1(stru
  18218. - /* Format: devpathX=pcie/Y/Z/
  18219. - * Y = domain_nr, Z = bus_nr, X = virtual ID
  18220. - */
  18221. -- if ((strncmp(&nvp->nvram[i], "devpath", 7) == 0) &&
  18222. -- (strncmp(&nvp->nvram[i + 8], pcie_path, pcie_len) == 0)) {
  18223. -+ if (strncmp(&nvp->nvram[i], "devpath", 7) == 0 &&
  18224. -+ (!strncmp(&nvp->nvram[i + 8], pci_path, pci_len) ||
  18225. -+ !strncmp(&nvp->nvram[i + 8], pcie_path, pcie_len))) {
  18226. - id = nvp->nvram[i + 7] - '0';
  18227. - found = true;
  18228. - break;
  18229. diff --git a/package/kernel/mac80211/patches/353-brcmfmac-set-wiphy-perm_addr-to-hardware-MAC-address.patch b/package/kernel/mac80211/patches/353-brcmfmac-set-wiphy-perm_addr-to-hardware-MAC-address.patch
  18230. deleted file mode 100644
  18231. index 1eff6ed..0000000
  18232. --- a/package/kernel/mac80211/patches/353-brcmfmac-set-wiphy-perm_addr-to-hardware-MAC-address.patch
  18233. +++ /dev/null
  18234. @@ -1,23 +0,0 @@
  18235. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  18236. -Date: Sun, 31 May 2015 02:52:26 +0200
  18237. -Subject: [PATCH] brcmfmac: set wiphy perm_addr to hardware MAC address
  18238. -MIME-Version: 1.0
  18239. -Content-Type: text/plain; charset=UTF-8
  18240. -Content-Transfer-Encoding: 8bit
  18241. -
  18242. -This allows e.g. user space to use /sys/class/ieee80211/*/macaddress
  18243. -
  18244. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  18245. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18246. ----
  18247. -
  18248. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  18249. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  18250. -@@ -6070,6 +6070,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  18251. - brcmf_err("Could not allocate wiphy device\n");
  18252. - return NULL;
  18253. - }
  18254. -+ memcpy(wiphy->perm_addr, drvr->mac, ETH_ALEN);
  18255. - set_wiphy_dev(wiphy, busdev);
  18256. -
  18257. - cfg = wiphy_priv(wiphy);
  18258. diff --git a/package/kernel/mac80211/patches/354-brcmfmac-use-direct-data-pointer-in-NVRAM-parser-str.patch b/package/kernel/mac80211/patches/354-brcmfmac-use-direct-data-pointer-in-NVRAM-parser-str.patch
  18259. deleted file mode 100644
  18260. index c6e83dd..0000000
  18261. --- a/package/kernel/mac80211/patches/354-brcmfmac-use-direct-data-pointer-in-NVRAM-parser-str.patch
  18262. +++ /dev/null
  18263. @@ -1,144 +0,0 @@
  18264. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  18265. -Date: Thu, 4 Jun 2015 22:11:07 +0200
  18266. -Subject: [PATCH] brcmfmac: use direct data pointer in NVRAM parser struct
  18267. -MIME-Version: 1.0
  18268. -Content-Type: text/plain; charset=UTF-8
  18269. -Content-Transfer-Encoding: 8bit
  18270. -
  18271. -As we plan to add support for platform NVRAM we should store direct
  18272. -data pointer without the extra struct firmware layer. This will allow
  18273. -us to support other sources with the only requirement being u8 buffer.
  18274. -
  18275. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  18276. -Acked-by: Arend van Spriel <arend@broadcom.com>
  18277. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18278. ----
  18279. -
  18280. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  18281. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  18282. -@@ -43,7 +43,7 @@ enum nvram_parser_state {
  18283. - * struct nvram_parser - internal info for parser.
  18284. - *
  18285. - * @state: current parser state.
  18286. -- * @fwnv: input buffer being parsed.
  18287. -+ * @data: input buffer being parsed.
  18288. - * @nvram: output buffer with parse result.
  18289. - * @nvram_len: lenght of parse result.
  18290. - * @line: current line.
  18291. -@@ -55,7 +55,7 @@ enum nvram_parser_state {
  18292. - */
  18293. - struct nvram_parser {
  18294. - enum nvram_parser_state state;
  18295. -- const struct firmware *fwnv;
  18296. -+ const u8 *data;
  18297. - u8 *nvram;
  18298. - u32 nvram_len;
  18299. - u32 line;
  18300. -@@ -91,7 +91,7 @@ static enum nvram_parser_state brcmf_nvr
  18301. - {
  18302. - char c;
  18303. -
  18304. -- c = nvp->fwnv->data[nvp->pos];
  18305. -+ c = nvp->data[nvp->pos];
  18306. - if (c == '\n')
  18307. - return COMMENT;
  18308. - if (is_whitespace(c))
  18309. -@@ -115,16 +115,16 @@ static enum nvram_parser_state brcmf_nvr
  18310. - enum nvram_parser_state st = nvp->state;
  18311. - char c;
  18312. -
  18313. -- c = nvp->fwnv->data[nvp->pos];
  18314. -+ c = nvp->data[nvp->pos];
  18315. - if (c == '=') {
  18316. - /* ignore RAW1 by treating as comment */
  18317. -- if (strncmp(&nvp->fwnv->data[nvp->entry], "RAW1", 4) == 0)
  18318. -+ if (strncmp(&nvp->data[nvp->entry], "RAW1", 4) == 0)
  18319. - st = COMMENT;
  18320. - else
  18321. - st = VALUE;
  18322. -- if (strncmp(&nvp->fwnv->data[nvp->entry], "devpath", 7) == 0)
  18323. -+ if (strncmp(&nvp->data[nvp->entry], "devpath", 7) == 0)
  18324. - nvp->multi_dev_v1 = true;
  18325. -- if (strncmp(&nvp->fwnv->data[nvp->entry], "pcie/", 5) == 0)
  18326. -+ if (strncmp(&nvp->data[nvp->entry], "pcie/", 5) == 0)
  18327. - nvp->multi_dev_v2 = true;
  18328. - } else if (!is_nvram_char(c) || c == ' ') {
  18329. - brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n",
  18330. -@@ -145,11 +145,11 @@ brcmf_nvram_handle_value(struct nvram_pa
  18331. - char *ekv;
  18332. - u32 cplen;
  18333. -
  18334. -- c = nvp->fwnv->data[nvp->pos];
  18335. -+ c = nvp->data[nvp->pos];
  18336. - if (!is_nvram_char(c)) {
  18337. - /* key,value pair complete */
  18338. -- ekv = (u8 *)&nvp->fwnv->data[nvp->pos];
  18339. -- skv = (u8 *)&nvp->fwnv->data[nvp->entry];
  18340. -+ ekv = (u8 *)&nvp->data[nvp->pos];
  18341. -+ skv = (u8 *)&nvp->data[nvp->entry];
  18342. - cplen = ekv - skv;
  18343. - if (nvp->nvram_len + cplen + 1 >= BRCMF_FW_MAX_NVRAM_SIZE)
  18344. - return END;
  18345. -@@ -170,7 +170,7 @@ brcmf_nvram_handle_comment(struct nvram_
  18346. - {
  18347. - char *eoc, *sol;
  18348. -
  18349. -- sol = (char *)&nvp->fwnv->data[nvp->pos];
  18350. -+ sol = (char *)&nvp->data[nvp->pos];
  18351. - eoc = strchr(sol, '\n');
  18352. - if (!eoc) {
  18353. - eoc = strchr(sol, '\0');
  18354. -@@ -201,17 +201,17 @@ static enum nvram_parser_state
  18355. - };
  18356. -
  18357. - static int brcmf_init_nvram_parser(struct nvram_parser *nvp,
  18358. -- const struct firmware *nv)
  18359. -+ const u8 *data, size_t data_len)
  18360. - {
  18361. - size_t size;
  18362. -
  18363. - memset(nvp, 0, sizeof(*nvp));
  18364. -- nvp->fwnv = nv;
  18365. -+ nvp->data = data;
  18366. - /* Limit size to MAX_NVRAM_SIZE, some files contain lot of comment */
  18367. -- if (nv->size > BRCMF_FW_MAX_NVRAM_SIZE)
  18368. -+ if (data_len > BRCMF_FW_MAX_NVRAM_SIZE)
  18369. - size = BRCMF_FW_MAX_NVRAM_SIZE;
  18370. - else
  18371. -- size = nv->size;
  18372. -+ size = data_len;
  18373. - /* Alloc for extra 0 byte + roundup by 4 + length field */
  18374. - size += 1 + 3 + sizeof(u32);
  18375. - nvp->nvram = kzalloc(size, GFP_KERNEL);
  18376. -@@ -362,18 +362,18 @@ fail:
  18377. - * and converts newlines to NULs. Shortens buffer as needed and pads with NULs.
  18378. - * End of buffer is completed with token identifying length of buffer.
  18379. - */
  18380. --static void *brcmf_fw_nvram_strip(const struct firmware *nv, u32 *new_length,
  18381. -- u16 domain_nr, u16 bus_nr)
  18382. -+static void *brcmf_fw_nvram_strip(const u8 *data, size_t data_len,
  18383. -+ u32 *new_length, u16 domain_nr, u16 bus_nr)
  18384. - {
  18385. - struct nvram_parser nvp;
  18386. - u32 pad;
  18387. - u32 token;
  18388. - __le32 token_le;
  18389. -
  18390. -- if (brcmf_init_nvram_parser(&nvp, nv) < 0)
  18391. -+ if (brcmf_init_nvram_parser(&nvp, data, data_len) < 0)
  18392. - return NULL;
  18393. -
  18394. -- while (nvp.pos < nv->size) {
  18395. -+ while (nvp.pos < data_len) {
  18396. - nvp.state = nv_parser_states[nvp.state](&nvp);
  18397. - if (nvp.state == END)
  18398. - break;
  18399. -@@ -432,7 +432,7 @@ static void brcmf_fw_request_nvram_done(
  18400. - goto fail;
  18401. -
  18402. - if (fw) {
  18403. -- nvram = brcmf_fw_nvram_strip(fw, &nvram_length,
  18404. -+ nvram = brcmf_fw_nvram_strip(fw->data, fw->size, &nvram_length,
  18405. - fwctx->domain_nr, fwctx->bus_nr);
  18406. - release_firmware(fw);
  18407. - if (!nvram && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL))
  18408. diff --git a/package/kernel/mac80211/patches/355-b43-fix-support-for-14e4-4321-PCI-dev-with-BCM4321-c.patch b/package/kernel/mac80211/patches/355-b43-fix-support-for-14e4-4321-PCI-dev-with-BCM4321-c.patch
  18409. deleted file mode 100644
  18410. index 4ecef3b..0000000
  18411. --- a/package/kernel/mac80211/patches/355-b43-fix-support-for-14e4-4321-PCI-dev-with-BCM4321-c.patch
  18412. +++ /dev/null
  18413. @@ -1,32 +0,0 @@
  18414. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  18415. -Date: Sat, 6 Jun 2015 22:45:59 +0200
  18416. -Subject: [PATCH] b43: fix support for 14e4:4321 PCI dev with BCM4321 chipset
  18417. -MIME-Version: 1.0
  18418. -Content-Type: text/plain; charset=UTF-8
  18419. -Content-Transfer-Encoding: 8bit
  18420. -
  18421. -It seems Broadcom released two devices with conflicting device id. There
  18422. -are for sure 14e4:4321 PCI devices with BCM4321 (N-PHY) chipset, they
  18423. -can be found in routers, e.g. Netgear WNR834Bv2. However, according to
  18424. -Broadcom public sources 0x4321 is also used for 5 GHz BCM4306 (G-PHY).
  18425. -It's unsure if they meant PCI device id, or "virtual" id (from SPROM).
  18426. -To distinguish these devices lets check PHY type (G vs. N).
  18427. -
  18428. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  18429. -Cc: <stable@vger.kernel.org> # 3.16+
  18430. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18431. ----
  18432. -
  18433. ---- a/drivers/net/wireless/b43/main.c
  18434. -+++ b/drivers/net/wireless/b43/main.c
  18435. -@@ -5365,6 +5365,10 @@ static void b43_supported_bands(struct b
  18436. - *have_5ghz_phy = true;
  18437. - return;
  18438. - case 0x4321: /* BCM4306 */
  18439. -+ /* There are 14e4:4321 PCI devs with 2.4 GHz BCM4321 (N-PHY) */
  18440. -+ if (dev->phy.type != B43_PHYTYPE_G)
  18441. -+ break;
  18442. -+ /* fall through */
  18443. - case 0x4313: /* BCM4311 */
  18444. - case 0x431a: /* BCM4318 */
  18445. - case 0x432a: /* BCM4321 */
  18446. diff --git a/package/kernel/mac80211/patches/356-ath9k-force-rx_clear-when-disabling-rx.patch b/package/kernel/mac80211/patches/356-ath9k-force-rx_clear-when-disabling-rx.patch
  18447. deleted file mode 100644
  18448. index bddb15a..0000000
  18449. --- a/package/kernel/mac80211/patches/356-ath9k-force-rx_clear-when-disabling-rx.patch
  18450. +++ /dev/null
  18451. @@ -1,31 +0,0 @@
  18452. -From: Felix Fietkau <nbd@openwrt.org>
  18453. -Date: Sun, 7 Jun 2015 13:53:35 +0200
  18454. -Subject: [PATCH] ath9k: force rx_clear when disabling rx
  18455. -
  18456. -This makes stopping Rx more reliable and should reduce the frequency of
  18457. -Rx related DMA stop warnings
  18458. -
  18459. -Cc: stable@vger.kernel.org
  18460. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  18461. ----
  18462. -
  18463. ---- a/drivers/net/wireless/ath/ath9k/mac.c
  18464. -+++ b/drivers/net/wireless/ath/ath9k/mac.c
  18465. -@@ -677,13 +677,15 @@ void ath9k_hw_startpcureceive(struct ath
  18466. -
  18467. - ath9k_ani_reset(ah, is_scanning);
  18468. -
  18469. -- REG_CLR_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT));
  18470. -+ REG_CLR_BIT(ah, AR_DIAG_SW,
  18471. -+ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  18472. - }
  18473. - EXPORT_SYMBOL(ath9k_hw_startpcureceive);
  18474. -
  18475. - void ath9k_hw_abortpcurecv(struct ath_hw *ah)
  18476. - {
  18477. -- REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_ABORT | AR_DIAG_RX_DIS);
  18478. -+ REG_SET_BIT(ah, AR_DIAG_SW,
  18479. -+ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  18480. -
  18481. - ath9k_hw_disable_mib_counters(ah);
  18482. - }
  18483. diff --git a/package/kernel/mac80211/patches/357-0001-brcmfmac-Update-msgbuf-read-pointer-quicker.patch b/package/kernel/mac80211/patches/357-0001-brcmfmac-Update-msgbuf-read-pointer-quicker.patch
  18484. deleted file mode 100644
  18485. index 74df9f9..0000000
  18486. --- a/package/kernel/mac80211/patches/357-0001-brcmfmac-Update-msgbuf-read-pointer-quicker.patch
  18487. +++ /dev/null
  18488. @@ -1,109 +0,0 @@
  18489. -From: Hante Meuleman <meuleman@broadcom.com>
  18490. -Date: Mon, 8 Jun 2015 14:38:32 +0200
  18491. -Subject: [PATCH] brcmfmac: Update msgbuf read pointer quicker.
  18492. -
  18493. -On device to host data using msgbuf the read pointer gets updated
  18494. -once all data is processed. Updating this pointer more frequently
  18495. -allows the firmware to add more data quicker. This will result in
  18496. -slightly higher and more stable throughput on CPU bounded host
  18497. -processors.
  18498. -
  18499. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  18500. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  18501. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  18502. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  18503. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  18504. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18505. ----
  18506. -
  18507. ---- a/drivers/net/wireless/brcm80211/brcmfmac/commonring.c
  18508. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/commonring.c
  18509. -@@ -223,8 +223,6 @@ void brcmf_commonring_write_cancel(struc
  18510. - void *brcmf_commonring_get_read_ptr(struct brcmf_commonring *commonring,
  18511. - u16 *n_items)
  18512. - {
  18513. -- void *ret_addr;
  18514. --
  18515. - if (commonring->cr_update_wptr)
  18516. - commonring->cr_update_wptr(commonring->cr_ctx);
  18517. -
  18518. -@@ -235,19 +233,18 @@ void *brcmf_commonring_get_read_ptr(stru
  18519. - if (*n_items == 0)
  18520. - return NULL;
  18521. -
  18522. -- ret_addr = commonring->buf_addr +
  18523. -- (commonring->r_ptr * commonring->item_len);
  18524. --
  18525. -- commonring->r_ptr += *n_items;
  18526. -- if (commonring->r_ptr == commonring->depth)
  18527. -- commonring->r_ptr = 0;
  18528. --
  18529. -- return ret_addr;
  18530. -+ return commonring->buf_addr +
  18531. -+ (commonring->r_ptr * commonring->item_len);
  18532. - }
  18533. -
  18534. -
  18535. --int brcmf_commonring_read_complete(struct brcmf_commonring *commonring)
  18536. -+int brcmf_commonring_read_complete(struct brcmf_commonring *commonring,
  18537. -+ u16 n_items)
  18538. - {
  18539. -+ commonring->r_ptr += n_items;
  18540. -+ if (commonring->r_ptr == commonring->depth)
  18541. -+ commonring->r_ptr = 0;
  18542. -+
  18543. - if (commonring->cr_write_rptr)
  18544. - return commonring->cr_write_rptr(commonring->cr_ctx);
  18545. -
  18546. ---- a/drivers/net/wireless/brcm80211/brcmfmac/commonring.h
  18547. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/commonring.h
  18548. -@@ -62,7 +62,8 @@ void brcmf_commonring_write_cancel(struc
  18549. - u16 n_items);
  18550. - void *brcmf_commonring_get_read_ptr(struct brcmf_commonring *commonring,
  18551. - u16 *n_items);
  18552. --int brcmf_commonring_read_complete(struct brcmf_commonring *commonring);
  18553. -+int brcmf_commonring_read_complete(struct brcmf_commonring *commonring,
  18554. -+ u16 n_items);
  18555. -
  18556. - #define brcmf_commonring_n_items(commonring) (commonring->depth)
  18557. - #define brcmf_commonring_len_item(commonring) (commonring->item_len)
  18558. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  18559. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  18560. -@@ -75,6 +75,8 @@
  18561. -
  18562. - #define BRCMF_MSGBUF_DELAY_TXWORKER_THRS 96
  18563. - #define BRCMF_MSGBUF_TRICKLE_TXWORKER_THRS 32
  18564. -+#define BRCMF_MSGBUF_UPDATE_RX_PTR_THRS 48
  18565. -+
  18566. -
  18567. - struct msgbuf_common_hdr {
  18568. - u8 msgtype;
  18569. -@@ -1257,19 +1259,27 @@ static void brcmf_msgbuf_process_rx(stru
  18570. - {
  18571. - void *buf;
  18572. - u16 count;
  18573. -+ u16 processed;
  18574. -
  18575. - again:
  18576. - buf = brcmf_commonring_get_read_ptr(commonring, &count);
  18577. - if (buf == NULL)
  18578. - return;
  18579. -
  18580. -+ processed = 0;
  18581. - while (count) {
  18582. - brcmf_msgbuf_process_msgtype(msgbuf,
  18583. - buf + msgbuf->rx_dataoffset);
  18584. - buf += brcmf_commonring_len_item(commonring);
  18585. -+ processed++;
  18586. -+ if (processed == BRCMF_MSGBUF_UPDATE_RX_PTR_THRS) {
  18587. -+ brcmf_commonring_read_complete(commonring, processed);
  18588. -+ processed = 0;
  18589. -+ }
  18590. - count--;
  18591. - }
  18592. -- brcmf_commonring_read_complete(commonring);
  18593. -+ if (processed)
  18594. -+ brcmf_commonring_read_complete(commonring, processed);
  18595. -
  18596. - if (commonring->r_ptr == 0)
  18597. - goto again;
  18598. diff --git a/package/kernel/mac80211/patches/357-0002-brcmfmac-remove-chipinfo-debugfs-entry.patch b/package/kernel/mac80211/patches/357-0002-brcmfmac-remove-chipinfo-debugfs-entry.patch
  18599. deleted file mode 100644
  18600. index 9e5b486..0000000
  18601. --- a/package/kernel/mac80211/patches/357-0002-brcmfmac-remove-chipinfo-debugfs-entry.patch
  18602. +++ /dev/null
  18603. @@ -1,39 +0,0 @@
  18604. -From: Arend van Spriel <arend@broadcom.com>
  18605. -Date: Mon, 8 Jun 2015 14:38:33 +0200
  18606. -Subject: [PATCH] brcmfmac: remove chipinfo debugfs entry
  18607. -
  18608. -The information provided by chipinfo is also provided by the
  18609. -revinfo debugfs entry. Removing it from debugfs.
  18610. -
  18611. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  18612. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  18613. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  18614. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18615. ----
  18616. -
  18617. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  18618. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  18619. -@@ -41,15 +41,6 @@ void brcmf_debugfs_exit(void)
  18620. - root_folder = NULL;
  18621. - }
  18622. -
  18623. --static int brcmf_debugfs_chipinfo_read(struct seq_file *seq, void *data)
  18624. --{
  18625. -- struct brcmf_bus *bus = dev_get_drvdata(seq->private);
  18626. --
  18627. -- seq_printf(seq, "chip: %x(%u) rev %u\n",
  18628. -- bus->chip, bus->chip, bus->chiprev);
  18629. -- return 0;
  18630. --}
  18631. --
  18632. - int brcmf_debugfs_attach(struct brcmf_pub *drvr)
  18633. - {
  18634. - struct device *dev = drvr->bus_if->dev;
  18635. -@@ -58,7 +49,6 @@ int brcmf_debugfs_attach(struct brcmf_pu
  18636. - return -ENODEV;
  18637. -
  18638. - drvr->dbgfs_dir = debugfs_create_dir(dev_name(dev), root_folder);
  18639. -- brcmf_debugfs_add_entry(drvr, "chipinfo", brcmf_debugfs_chipinfo_read);
  18640. -
  18641. - return PTR_ERR_OR_ZERO(drvr->dbgfs_dir);
  18642. - }
  18643. diff --git a/package/kernel/mac80211/patches/357-0003-brcmfmac-remove-watchdog-reset-from-brcmf_pcie_busco.patch b/package/kernel/mac80211/patches/357-0003-brcmfmac-remove-watchdog-reset-from-brcmf_pcie_busco.patch
  18644. deleted file mode 100644
  18645. index c38b2cd..0000000
  18646. --- a/package/kernel/mac80211/patches/357-0003-brcmfmac-remove-watchdog-reset-from-brcmf_pcie_busco.patch
  18647. +++ /dev/null
  18648. @@ -1,53 +0,0 @@
  18649. -From: Arend van Spriel <arend@broadcom.com>
  18650. -Date: Mon, 8 Jun 2015 14:38:34 +0200
  18651. -Subject: [PATCH] brcmfmac: remove watchdog reset from
  18652. - brcmf_pcie_buscoreprep()
  18653. -
  18654. -The watchdog reset as done in brcmf_pcie_buscoreprep() is not
  18655. -sufficient. It needs to modify PCIe core registers as well
  18656. -which is properly done by brcmf_pcie_reset_device() after the
  18657. -chip recognition is done. So the faulty watchdog reset can be
  18658. -removed as it was causing driver reload to fail and hang the
  18659. -system requiring a power-cycle. Instead the call to to the
  18660. -brcmf_pcie_reset_device() function is done twice in the unload.
  18661. -
  18662. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  18663. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  18664. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  18665. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  18666. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  18667. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18668. ----
  18669. -
  18670. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  18671. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  18672. -@@ -1629,20 +1629,7 @@ static void brcmf_pcie_buscore_write32(v
  18673. -
  18674. - static int brcmf_pcie_buscoreprep(void *ctx)
  18675. - {
  18676. -- struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)ctx;
  18677. -- int err;
  18678. --
  18679. -- err = brcmf_pcie_get_resource(devinfo);
  18680. -- if (err == 0) {
  18681. -- /* Set CC watchdog to reset all the cores on the chip to bring
  18682. -- * back dongle to a sane state.
  18683. -- */
  18684. -- brcmf_pcie_buscore_write32(ctx, CORE_CC_REG(SI_ENUM_BASE,
  18685. -- watchdog), 4);
  18686. -- msleep(100);
  18687. -- }
  18688. --
  18689. -- return err;
  18690. -+ return brcmf_pcie_get_resource(ctx);
  18691. - }
  18692. -
  18693. -
  18694. -@@ -1824,6 +1811,7 @@ brcmf_pcie_remove(struct pci_dev *pdev)
  18695. - brcmf_pcie_intr_disable(devinfo);
  18696. -
  18697. - brcmf_detach(&pdev->dev);
  18698. -+ brcmf_pcie_reset_device(devinfo);
  18699. -
  18700. - kfree(bus->bus_priv.pcie);
  18701. - kfree(bus->msgbuf->flowrings);
  18702. diff --git a/package/kernel/mac80211/patches/357-0004-brcmfmac-use-debugfs_create_devm_seqfile-helper-func.patch b/package/kernel/mac80211/patches/357-0004-brcmfmac-use-debugfs_create_devm_seqfile-helper-func.patch
  18703. deleted file mode 100644
  18704. index 756fbb2..0000000
  18705. --- a/package/kernel/mac80211/patches/357-0004-brcmfmac-use-debugfs_create_devm_seqfile-helper-func.patch
  18706. +++ /dev/null
  18707. @@ -1,69 +0,0 @@
  18708. -From: Arend van Spriel <arend@broadcom.com>
  18709. -Date: Mon, 8 Jun 2015 14:38:35 +0200
  18710. -Subject: [PATCH] brcmfmac: use debugfs_create_devm_seqfile() helper
  18711. - function
  18712. -
  18713. -Some time ago the function debugfs_create_devm_seqfile() was
  18714. -introduced in debugfs. The caller simply needs to provide a
  18715. -device pointer and read function. The function brcmf_debugfs_add_entry()
  18716. -is now simply a wrapper only doing the work for CONFIG_BRCMDBG.
  18717. -
  18718. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  18719. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  18720. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  18721. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  18722. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  18723. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18724. ----
  18725. -
  18726. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  18727. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  18728. -@@ -64,44 +64,12 @@ struct dentry *brcmf_debugfs_get_devdir(
  18729. - return drvr->dbgfs_dir;
  18730. - }
  18731. -
  18732. --struct brcmf_debugfs_entry {
  18733. -- int (*read)(struct seq_file *seq, void *data);
  18734. -- struct brcmf_pub *drvr;
  18735. --};
  18736. --
  18737. --static int brcmf_debugfs_entry_open(struct inode *inode, struct file *f)
  18738. --{
  18739. -- struct brcmf_debugfs_entry *entry = inode->i_private;
  18740. --
  18741. -- return single_open(f, entry->read, entry->drvr->bus_if->dev);
  18742. --}
  18743. --
  18744. --static const struct file_operations brcmf_debugfs_def_ops = {
  18745. -- .owner = THIS_MODULE,
  18746. -- .open = brcmf_debugfs_entry_open,
  18747. -- .release = single_release,
  18748. -- .read = seq_read,
  18749. -- .llseek = seq_lseek
  18750. --};
  18751. --
  18752. - int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn,
  18753. - int (*read_fn)(struct seq_file *seq, void *data))
  18754. - {
  18755. -- struct dentry *dentry = drvr->dbgfs_dir;
  18756. -- struct brcmf_debugfs_entry *entry;
  18757. --
  18758. -- if (IS_ERR_OR_NULL(dentry))
  18759. -- return -ENOENT;
  18760. --
  18761. -- entry = devm_kzalloc(drvr->bus_if->dev, sizeof(*entry), GFP_KERNEL);
  18762. -- if (!entry)
  18763. -- return -ENOMEM;
  18764. --
  18765. -- entry->read = read_fn;
  18766. -- entry->drvr = drvr;
  18767. --
  18768. -- dentry = debugfs_create_file(fn, S_IRUGO, dentry, entry,
  18769. -- &brcmf_debugfs_def_ops);
  18770. -+ struct dentry *e;
  18771. -
  18772. -- return PTR_ERR_OR_ZERO(dentry);
  18773. -+ e = debugfs_create_devm_seqfile(drvr->bus_if->dev, fn,
  18774. -+ drvr->dbgfs_dir, read_fn);
  18775. -+ return PTR_ERR_OR_ZERO(e);
  18776. - }
  18777. diff --git a/package/kernel/mac80211/patches/358-ath9k_hw-fix-device-ID-check-for-AR956x.patch b/package/kernel/mac80211/patches/358-ath9k_hw-fix-device-ID-check-for-AR956x.patch
  18778. deleted file mode 100644
  18779. index 2674efb..0000000
  18780. --- a/package/kernel/mac80211/patches/358-ath9k_hw-fix-device-ID-check-for-AR956x.patch
  18781. +++ /dev/null
  18782. @@ -1,20 +0,0 @@
  18783. -From: Felix Fietkau <nbd@openwrt.org>
  18784. -Date: Sun, 21 Jun 2015 19:45:59 +0200
  18785. -Subject: [PATCH] ath9k_hw: fix device ID check for AR956x
  18786. -
  18787. -Because of the missing return, the macVersion value was being
  18788. -overwritten with an invalid register read
  18789. -
  18790. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  18791. ----
  18792. -
  18793. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  18794. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  18795. -@@ -278,6 +278,7 @@ static void ath9k_hw_read_revisions(stru
  18796. - return;
  18797. - case AR9300_DEVID_QCA956X:
  18798. - ah->hw_version.macVersion = AR_SREV_VERSION_9561;
  18799. -+ return;
  18800. - }
  18801. -
  18802. - val = REG_READ(ah, AR_SREV) & AR_SREV_ID;
  18803. diff --git a/package/kernel/mac80211/patches/359-0001-brcmfmac-Check-if-firmware-supports-p2p.patch b/package/kernel/mac80211/patches/359-0001-brcmfmac-Check-if-firmware-supports-p2p.patch
  18804. deleted file mode 100644
  18805. index ff24a4a..0000000
  18806. --- a/package/kernel/mac80211/patches/359-0001-brcmfmac-Check-if-firmware-supports-p2p.patch
  18807. +++ /dev/null
  18808. @@ -1,42 +0,0 @@
  18809. -From: Pontus Fuchs <pontusf@broadcom.com>
  18810. -Date: Thu, 11 Jun 2015 00:12:17 +0200
  18811. -Subject: [PATCH] brcmfmac: Check if firmware supports p2p
  18812. -
  18813. -Add a feature flag to reflect the firmware's p2p capability.
  18814. -
  18815. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  18816. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  18817. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  18818. -Signed-off-by: Pontus Fuchs <pontusf@broadcom.com>
  18819. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  18820. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18821. ----
  18822. -
  18823. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  18824. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  18825. -@@ -129,6 +129,7 @@ void brcmf_feat_attach(struct brcmf_pub
  18826. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_WOWL, "wowl");
  18827. - if (drvr->bus_if->chip != BRCM_CC_43362_CHIP_ID)
  18828. - brcmf_feat_iovar_int_set(ifp, BRCMF_FEAT_MBSS, "mbss", 0);
  18829. -+ brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_P2P, "p2p");
  18830. -
  18831. - /* set chip related quirks */
  18832. - switch (drvr->bus_if->chip) {
  18833. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  18834. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  18835. -@@ -23,12 +23,14 @@
  18836. - * MCHAN: multi-channel for concurrent P2P.
  18837. - * PNO: preferred network offload.
  18838. - * WOWL: Wake-On-WLAN.
  18839. -+ * P2P: peer-to-peer
  18840. - */
  18841. - #define BRCMF_FEAT_LIST \
  18842. - BRCMF_FEAT_DEF(MBSS) \
  18843. - BRCMF_FEAT_DEF(MCHAN) \
  18844. - BRCMF_FEAT_DEF(PNO) \
  18845. -- BRCMF_FEAT_DEF(WOWL)
  18846. -+ BRCMF_FEAT_DEF(WOWL) \
  18847. -+ BRCMF_FEAT_DEF(P2P)
  18848. - /*
  18849. - * Quirks:
  18850. - *
  18851. diff --git a/package/kernel/mac80211/patches/359-0002-brcmfmac-Build-wiphy-mode-and-interface-combinations.patch b/package/kernel/mac80211/patches/359-0002-brcmfmac-Build-wiphy-mode-and-interface-combinations.patch
  18852. deleted file mode 100644
  18853. index 3876ba0..0000000
  18854. --- a/package/kernel/mac80211/patches/359-0002-brcmfmac-Build-wiphy-mode-and-interface-combinations.patch
  18855. +++ /dev/null
  18856. @@ -1,198 +0,0 @@
  18857. -From: Pontus Fuchs <pontusf@broadcom.com>
  18858. -Date: Thu, 11 Jun 2015 00:12:18 +0200
  18859. -Subject: [PATCH] brcmfmac: Build wiphy mode and interface combinations
  18860. - dynamically
  18861. -
  18862. -Switch from using semi hard coded interface combinations. This makes
  18863. -it easier to announce what the firmware actually supports. This fixes
  18864. -the case where brcmfmac announces p2p but the firmware doesn't
  18865. -support it.
  18866. -
  18867. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  18868. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  18869. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  18870. -Signed-off-by: Pontus Fuchs <pontusf@broadcom.com>
  18871. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  18872. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18873. ----
  18874. -
  18875. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  18876. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  18877. -@@ -52,8 +52,6 @@
  18878. - #define BRCMF_PNO_SCAN_COMPLETE 1
  18879. - #define BRCMF_PNO_SCAN_INCOMPLETE 0
  18880. -
  18881. --#define BRCMF_IFACE_MAX_CNT 3
  18882. --
  18883. - #define WPA_OUI "\x00\x50\xF2" /* WPA OUI */
  18884. - #define WPA_OUI_TYPE 1
  18885. - #define RSN_OUI "\x00\x0F\xAC" /* RSN OUI */
  18886. -@@ -5639,53 +5637,6 @@ static int brcmf_setup_wiphybands(struct
  18887. - return 0;
  18888. - }
  18889. -
  18890. --static const struct ieee80211_iface_limit brcmf_iface_limits_mbss[] = {
  18891. -- {
  18892. -- .max = 1,
  18893. -- .types = BIT(NL80211_IFTYPE_STATION) |
  18894. -- BIT(NL80211_IFTYPE_ADHOC)
  18895. -- },
  18896. -- {
  18897. -- .max = 4,
  18898. -- .types = BIT(NL80211_IFTYPE_AP)
  18899. -- },
  18900. -- {
  18901. -- .max = 1,
  18902. -- .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  18903. -- BIT(NL80211_IFTYPE_P2P_GO)
  18904. -- },
  18905. -- {
  18906. -- .max = 1,
  18907. -- .types = BIT(NL80211_IFTYPE_P2P_DEVICE)
  18908. -- }
  18909. --};
  18910. --
  18911. --static const struct ieee80211_iface_limit brcmf_iface_limits_sbss[] = {
  18912. -- {
  18913. -- .max = 2,
  18914. -- .types = BIT(NL80211_IFTYPE_STATION) |
  18915. -- BIT(NL80211_IFTYPE_ADHOC) |
  18916. -- BIT(NL80211_IFTYPE_AP)
  18917. -- },
  18918. -- {
  18919. -- .max = 1,
  18920. -- .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  18921. -- BIT(NL80211_IFTYPE_P2P_GO)
  18922. -- },
  18923. -- {
  18924. -- .max = 1,
  18925. -- .types = BIT(NL80211_IFTYPE_P2P_DEVICE)
  18926. -- }
  18927. --};
  18928. --static struct ieee80211_iface_combination brcmf_iface_combos[] = {
  18929. -- {
  18930. -- .max_interfaces = BRCMF_IFACE_MAX_CNT,
  18931. -- .num_different_channels = 1,
  18932. -- .n_limits = ARRAY_SIZE(brcmf_iface_limits_sbss),
  18933. -- .limits = brcmf_iface_limits_sbss,
  18934. -- }
  18935. --};
  18936. --
  18937. - static const struct ieee80211_txrx_stypes
  18938. - brcmf_txrx_stypes[NUM_NL80211_IFTYPES] = {
  18939. - [NL80211_IFTYPE_STATION] = {
  18940. -@@ -5715,6 +5666,67 @@ brcmf_txrx_stypes[NUM_NL80211_IFTYPES] =
  18941. - }
  18942. - };
  18943. -
  18944. -+static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp)
  18945. -+{
  18946. -+ struct ieee80211_iface_combination *combo = NULL;
  18947. -+ struct ieee80211_iface_limit *limits = NULL;
  18948. -+ int i = 0, max_iface_cnt;
  18949. -+
  18950. -+ combo = kzalloc(sizeof(*combo), GFP_KERNEL);
  18951. -+ if (!combo)
  18952. -+ goto err;
  18953. -+
  18954. -+ limits = kzalloc(sizeof(*limits) * 4, GFP_KERNEL);
  18955. -+ if (!limits)
  18956. -+ goto err;
  18957. -+
  18958. -+ wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  18959. -+ BIT(NL80211_IFTYPE_ADHOC) |
  18960. -+ BIT(NL80211_IFTYPE_AP);
  18961. -+
  18962. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  18963. -+ combo->num_different_channels = 2;
  18964. -+ else
  18965. -+ combo->num_different_channels = 1;
  18966. -+
  18967. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) {
  18968. -+ limits[i].max = 1;
  18969. -+ limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  18970. -+ limits[i].max = 4;
  18971. -+ limits[i++].types = BIT(NL80211_IFTYPE_AP);
  18972. -+ max_iface_cnt = 5;
  18973. -+ } else {
  18974. -+ limits[i].max = 2;
  18975. -+ limits[i++].types = BIT(NL80211_IFTYPE_STATION) |
  18976. -+ BIT(NL80211_IFTYPE_AP);
  18977. -+ max_iface_cnt = 2;
  18978. -+ }
  18979. -+
  18980. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P)) {
  18981. -+ wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) |
  18982. -+ BIT(NL80211_IFTYPE_P2P_GO) |
  18983. -+ BIT(NL80211_IFTYPE_P2P_DEVICE);
  18984. -+ limits[i].max = 1;
  18985. -+ limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  18986. -+ BIT(NL80211_IFTYPE_P2P_GO);
  18987. -+ limits[i].max = 1;
  18988. -+ limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  18989. -+ max_iface_cnt += 2;
  18990. -+ }
  18991. -+ combo->max_interfaces = max_iface_cnt;
  18992. -+ combo->limits = limits;
  18993. -+ combo->n_limits = i;
  18994. -+
  18995. -+ wiphy->iface_combinations = combo;
  18996. -+ wiphy->n_iface_combinations = 1;
  18997. -+ return 0;
  18998. -+
  18999. -+err:
  19000. -+ kfree(limits);
  19001. -+ kfree(combo);
  19002. -+ return -ENOMEM;
  19003. -+}
  19004. -+
  19005. - static void brcmf_wiphy_pno_params(struct wiphy *wiphy)
  19006. - {
  19007. - /* scheduled scan settings */
  19008. -@@ -5745,7 +5757,6 @@ static void brcmf_wiphy_wowl_params(stru
  19009. - static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
  19010. - {
  19011. - struct ieee80211_supported_band *band;
  19012. -- struct ieee80211_iface_combination ifc_combo;
  19013. - __le32 bandlist[3];
  19014. - u32 n_bands;
  19015. - int err, i;
  19016. -@@ -5753,24 +5764,11 @@ static int brcmf_setup_wiphy(struct wiph
  19017. - wiphy->max_scan_ssids = WL_NUM_SCAN_MAX;
  19018. - wiphy->max_scan_ie_len = BRCMF_SCAN_IE_LEN_MAX;
  19019. - wiphy->max_num_pmkids = WL_NUM_PMKIDS_MAX;
  19020. -- wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  19021. -- BIT(NL80211_IFTYPE_ADHOC) |
  19022. -- BIT(NL80211_IFTYPE_AP) |
  19023. -- BIT(NL80211_IFTYPE_P2P_CLIENT) |
  19024. -- BIT(NL80211_IFTYPE_P2P_GO) |
  19025. -- BIT(NL80211_IFTYPE_P2P_DEVICE);
  19026. -- /* need VSDB firmware feature for concurrent channels */
  19027. -- ifc_combo = brcmf_iface_combos[0];
  19028. -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  19029. -- ifc_combo.num_different_channels = 2;
  19030. -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) {
  19031. -- ifc_combo.n_limits = ARRAY_SIZE(brcmf_iface_limits_mbss),
  19032. -- ifc_combo.limits = brcmf_iface_limits_mbss;
  19033. -- }
  19034. -- wiphy->iface_combinations = kmemdup(&ifc_combo,
  19035. -- sizeof(ifc_combo),
  19036. -- GFP_KERNEL);
  19037. -- wiphy->n_iface_combinations = ARRAY_SIZE(brcmf_iface_combos);
  19038. -+
  19039. -+ err = brcmf_setup_ifmodes(wiphy, ifp);
  19040. -+ if (err)
  19041. -+ return err;
  19042. -+
  19043. - wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
  19044. - wiphy->cipher_suites = __wl_cipher_suites;
  19045. - wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites);
  19046. -@@ -6035,6 +6033,8 @@ static void brcmf_free_wiphy(struct wiph
  19047. - if (!wiphy)
  19048. - return;
  19049. -
  19050. -+ if (wiphy->iface_combinations)
  19051. -+ kfree(wiphy->iface_combinations->limits);
  19052. - kfree(wiphy->iface_combinations);
  19053. - if (wiphy->bands[IEEE80211_BAND_2GHZ]) {
  19054. - kfree(wiphy->bands[IEEE80211_BAND_2GHZ]->channels);
  19055. diff --git a/package/kernel/mac80211/patches/359-0003-brcmfmac-rework-.get_station-callback.patch b/package/kernel/mac80211/patches/359-0003-brcmfmac-rework-.get_station-callback.patch
  19056. deleted file mode 100644
  19057. index 7bd0686..0000000
  19058. --- a/package/kernel/mac80211/patches/359-0003-brcmfmac-rework-.get_station-callback.patch
  19059. +++ /dev/null
  19060. @@ -1,326 +0,0 @@
  19061. -From: Arend van Spriel <arend@broadcom.com>
  19062. -Date: Thu, 11 Jun 2015 00:12:19 +0200
  19063. -Subject: [PATCH] brcmfmac: rework .get_station() callback
  19064. -
  19065. -The .get_station() cfg80211 callback is used in several scenarios. In
  19066. -managed mode it can obtain information about the access-point and its
  19067. -BSS parameters. In managed mode it can also obtain information about
  19068. -TDLS peers. In AP mode it can obtain information about connected
  19069. -clients.
  19070. -
  19071. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19072. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  19073. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  19074. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19075. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19076. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19077. ----
  19078. -
  19079. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19080. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19081. -@@ -2395,27 +2395,80 @@ brcmf_cfg80211_reconfigure_wep(struct br
  19082. - brcmf_err("set wsec error (%d)\n", err);
  19083. - }
  19084. -
  19085. -+static void brcmf_convert_sta_flags(u32 fw_sta_flags, struct station_info *si)
  19086. -+{
  19087. -+ struct nl80211_sta_flag_update *sfu;
  19088. -+
  19089. -+ brcmf_dbg(TRACE, "flags %08x\n", fw_sta_flags);
  19090. -+ si->filled |= BIT(NL80211_STA_INFO_STA_FLAGS);
  19091. -+ sfu = &si->sta_flags;
  19092. -+ sfu->mask = BIT(NL80211_STA_FLAG_WME) |
  19093. -+ BIT(NL80211_STA_FLAG_AUTHENTICATED) |
  19094. -+ BIT(NL80211_STA_FLAG_ASSOCIATED) |
  19095. -+ BIT(NL80211_STA_FLAG_AUTHORIZED);
  19096. -+ if (fw_sta_flags & BRCMF_STA_WME)
  19097. -+ sfu->set |= BIT(NL80211_STA_FLAG_WME);
  19098. -+ if (fw_sta_flags & BRCMF_STA_AUTHE)
  19099. -+ sfu->set |= BIT(NL80211_STA_FLAG_AUTHENTICATED);
  19100. -+ if (fw_sta_flags & BRCMF_STA_ASSOC)
  19101. -+ sfu->set |= BIT(NL80211_STA_FLAG_ASSOCIATED);
  19102. -+ if (fw_sta_flags & BRCMF_STA_AUTHO)
  19103. -+ sfu->set |= BIT(NL80211_STA_FLAG_AUTHORIZED);
  19104. -+}
  19105. -+
  19106. -+static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si)
  19107. -+{
  19108. -+ struct {
  19109. -+ __le32 len;
  19110. -+ struct brcmf_bss_info_le bss_le;
  19111. -+ } *buf;
  19112. -+ u16 capability;
  19113. -+ int err;
  19114. -+
  19115. -+ buf = kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL);
  19116. -+ if (!buf)
  19117. -+ return;
  19118. -+
  19119. -+ buf->len = cpu_to_le32(WL_BSS_INFO_MAX);
  19120. -+ err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, buf,
  19121. -+ WL_BSS_INFO_MAX);
  19122. -+ if (err) {
  19123. -+ brcmf_err("Failed to get bss info (%d)\n", err);
  19124. -+ return;
  19125. -+ }
  19126. -+ si->filled |= BIT(NL80211_STA_INFO_BSS_PARAM);
  19127. -+ si->bss_param.beacon_interval = le16_to_cpu(buf->bss_le.beacon_period);
  19128. -+ si->bss_param.dtim_period = buf->bss_le.dtim_period;
  19129. -+ capability = le16_to_cpu(buf->bss_le.capability);
  19130. -+ if (capability & IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT)
  19131. -+ si->bss_param.flags |= BSS_PARAM_FLAGS_CTS_PROT;
  19132. -+ if (capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
  19133. -+ si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE;
  19134. -+ if (capability & WLAN_CAPABILITY_SHORT_SLOT_TIME)
  19135. -+ si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME;
  19136. -+}
  19137. -+
  19138. - static s32
  19139. - brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
  19140. - const u8 *mac, struct station_info *sinfo)
  19141. - {
  19142. - struct brcmf_if *ifp = netdev_priv(ndev);
  19143. -- struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
  19144. -- struct brcmf_scb_val_le scb_val;
  19145. -- int rssi;
  19146. -- s32 rate;
  19147. - s32 err = 0;
  19148. -- u8 *bssid = profile->bssid;
  19149. - struct brcmf_sta_info_le sta_info_le;
  19150. -- u32 beacon_period;
  19151. -- u32 dtim_period;
  19152. -+ u32 sta_flags;
  19153. -+ u32 is_tdls_peer;
  19154. -
  19155. - brcmf_dbg(TRACE, "Enter, MAC %pM\n", mac);
  19156. - if (!check_vif_up(ifp->vif))
  19157. - return -EIO;
  19158. -
  19159. -- if (brcmf_is_apmode(ifp->vif)) {
  19160. -- memcpy(&sta_info_le, mac, ETH_ALEN);
  19161. -+ memset(&sta_info_le, 0, sizeof(sta_info_le));
  19162. -+ memcpy(&sta_info_le, mac, ETH_ALEN);
  19163. -+ err = brcmf_fil_iovar_data_get(ifp, "tdls_sta_info",
  19164. -+ &sta_info_le,
  19165. -+ sizeof(sta_info_le));
  19166. -+ is_tdls_peer = !err;
  19167. -+ if (err) {
  19168. - err = brcmf_fil_iovar_data_get(ifp, "sta_info",
  19169. - &sta_info_le,
  19170. - sizeof(sta_info_le));
  19171. -@@ -2423,73 +2476,48 @@ brcmf_cfg80211_get_station(struct wiphy
  19172. - brcmf_err("GET STA INFO failed, %d\n", err);
  19173. - goto done;
  19174. - }
  19175. -- sinfo->filled = BIT(NL80211_STA_INFO_INACTIVE_TIME);
  19176. -- sinfo->inactive_time = le32_to_cpu(sta_info_le.idle) * 1000;
  19177. -- if (le32_to_cpu(sta_info_le.flags) & BRCMF_STA_ASSOC) {
  19178. -- sinfo->filled |= BIT(NL80211_STA_INFO_CONNECTED_TIME);
  19179. -- sinfo->connected_time = le32_to_cpu(sta_info_le.in);
  19180. -- }
  19181. -- brcmf_dbg(TRACE, "STA idle time : %d ms, connected time :%d sec\n",
  19182. -- sinfo->inactive_time, sinfo->connected_time);
  19183. -- } else if (ifp->vif->wdev.iftype == NL80211_IFTYPE_STATION) {
  19184. -- if (memcmp(mac, bssid, ETH_ALEN)) {
  19185. -- brcmf_err("Wrong Mac address cfg_mac-%pM wl_bssid-%pM\n",
  19186. -- mac, bssid);
  19187. -- err = -ENOENT;
  19188. -- goto done;
  19189. -- }
  19190. -- /* Report the current tx rate */
  19191. -- err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_RATE, &rate);
  19192. -- if (err) {
  19193. -- brcmf_err("Could not get rate (%d)\n", err);
  19194. -- goto done;
  19195. -- } else {
  19196. -+ }
  19197. -+ brcmf_dbg(TRACE, "version %d\n", le16_to_cpu(sta_info_le.ver));
  19198. -+ sinfo->filled = BIT(NL80211_STA_INFO_INACTIVE_TIME);
  19199. -+ sinfo->inactive_time = le32_to_cpu(sta_info_le.idle) * 1000;
  19200. -+ sta_flags = le32_to_cpu(sta_info_le.flags);
  19201. -+ brcmf_convert_sta_flags(sta_flags, sinfo);
  19202. -+ sinfo->sta_flags.mask |= BIT(NL80211_STA_FLAG_TDLS_PEER);
  19203. -+ if (is_tdls_peer)
  19204. -+ sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER);
  19205. -+ else
  19206. -+ sinfo->sta_flags.set &= ~BIT(NL80211_STA_FLAG_TDLS_PEER);
  19207. -+ if (sta_flags & BRCMF_STA_ASSOC) {
  19208. -+ sinfo->filled |= BIT(NL80211_STA_INFO_CONNECTED_TIME);
  19209. -+ sinfo->connected_time = le32_to_cpu(sta_info_le.in);
  19210. -+ brcmf_fill_bss_param(ifp, sinfo);
  19211. -+ }
  19212. -+ if (sta_flags & BRCMF_STA_SCBSTATS) {
  19213. -+ sinfo->filled |= BIT(NL80211_STA_INFO_TX_FAILED);
  19214. -+ sinfo->tx_failed = le32_to_cpu(sta_info_le.tx_failures);
  19215. -+ sinfo->filled |= BIT(NL80211_STA_INFO_TX_PACKETS);
  19216. -+ sinfo->tx_packets = le32_to_cpu(sta_info_le.tx_pkts);
  19217. -+ sinfo->tx_packets += le32_to_cpu(sta_info_le.tx_mcast_pkts);
  19218. -+ sinfo->filled |= BIT(NL80211_STA_INFO_RX_PACKETS);
  19219. -+ sinfo->rx_packets = le32_to_cpu(sta_info_le.rx_ucast_pkts);
  19220. -+ sinfo->rx_packets += le32_to_cpu(sta_info_le.rx_mcast_pkts);
  19221. -+ if (sinfo->tx_packets) {
  19222. - sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
  19223. -- sinfo->txrate.legacy = rate * 5;
  19224. -- brcmf_dbg(CONN, "Rate %d Mbps\n", rate / 2);
  19225. -+ sinfo->txrate.legacy = le32_to_cpu(sta_info_le.tx_rate);
  19226. -+ sinfo->txrate.legacy /= 100;
  19227. - }
  19228. --
  19229. -- if (test_bit(BRCMF_VIF_STATUS_CONNECTED,
  19230. -- &ifp->vif->sme_state)) {
  19231. -- memset(&scb_val, 0, sizeof(scb_val));
  19232. -- err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI,
  19233. -- &scb_val, sizeof(scb_val));
  19234. -- if (err) {
  19235. -- brcmf_err("Could not get rssi (%d)\n", err);
  19236. -- goto done;
  19237. -- } else {
  19238. -- rssi = le32_to_cpu(scb_val.val);
  19239. -- sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
  19240. -- sinfo->signal = rssi;
  19241. -- brcmf_dbg(CONN, "RSSI %d dBm\n", rssi);
  19242. -- }
  19243. -- err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_BCNPRD,
  19244. -- &beacon_period);
  19245. -- if (err) {
  19246. -- brcmf_err("Could not get beacon period (%d)\n",
  19247. -- err);
  19248. -- goto done;
  19249. -- } else {
  19250. -- sinfo->bss_param.beacon_interval =
  19251. -- beacon_period;
  19252. -- brcmf_dbg(CONN, "Beacon peroid %d\n",
  19253. -- beacon_period);
  19254. -- }
  19255. -- err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_DTIMPRD,
  19256. -- &dtim_period);
  19257. -- if (err) {
  19258. -- brcmf_err("Could not get DTIM period (%d)\n",
  19259. -- err);
  19260. -- goto done;
  19261. -- } else {
  19262. -- sinfo->bss_param.dtim_period = dtim_period;
  19263. -- brcmf_dbg(CONN, "DTIM peroid %d\n",
  19264. -- dtim_period);
  19265. -- }
  19266. -- sinfo->filled |= BIT(NL80211_STA_INFO_BSS_PARAM);
  19267. -+ if (sinfo->rx_packets) {
  19268. -+ sinfo->filled |= BIT(NL80211_STA_INFO_RX_BITRATE);
  19269. -+ sinfo->rxrate.legacy = le32_to_cpu(sta_info_le.rx_rate);
  19270. -+ sinfo->rxrate.legacy /= 100;
  19271. -+ }
  19272. -+ if (le16_to_cpu(sta_info_le.ver) >= 4) {
  19273. -+ sinfo->filled |= BIT(NL80211_STA_INFO_TX_BYTES);
  19274. -+ sinfo->tx_bytes = le64_to_cpu(sta_info_le.tx_tot_bytes);
  19275. -+ sinfo->filled |= BIT(NL80211_STA_INFO_RX_BYTES);
  19276. -+ sinfo->rx_bytes = le64_to_cpu(sta_info_le.rx_tot_bytes);
  19277. - }
  19278. -- } else
  19279. -- err = -EPERM;
  19280. -+ }
  19281. - done:
  19282. - brcmf_dbg(TRACE, "Exit\n");
  19283. - return err;
  19284. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  19285. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  19286. -@@ -32,7 +32,11 @@
  19287. - #define BRCMF_BSS_INFO_VERSION 109 /* curr ver of brcmf_bss_info_le struct */
  19288. - #define BRCMF_BSS_RSSI_ON_CHANNEL 0x0002
  19289. -
  19290. --#define BRCMF_STA_ASSOC 0x10 /* Associated */
  19291. -+#define BRCMF_STA_WME 0x00000002 /* WMM association */
  19292. -+#define BRCMF_STA_AUTHE 0x00000008 /* Authenticated */
  19293. -+#define BRCMF_STA_ASSOC 0x00000010 /* Associated */
  19294. -+#define BRCMF_STA_AUTHO 0x00000020 /* Authorized */
  19295. -+#define BRCMF_STA_SCBSTATS 0x00004000 /* Per STA debug stats */
  19296. -
  19297. - /* size of brcmf_scan_params not including variable length array */
  19298. - #define BRCMF_SCAN_PARAMS_FIXED_SIZE 64
  19299. -@@ -113,6 +117,7 @@
  19300. - #define BRCMF_WOWL_MAXPATTERNSIZE 128
  19301. -
  19302. - #define BRCMF_COUNTRY_BUF_SZ 4
  19303. -+#define BRCMF_ANT_MAX 4
  19304. -
  19305. - /* join preference types for join_pref iovar */
  19306. - enum brcmf_join_pref_types {
  19307. -@@ -456,25 +461,61 @@ struct brcmf_channel_info_le {
  19308. - };
  19309. -
  19310. - struct brcmf_sta_info_le {
  19311. -- __le16 ver; /* version of this struct */
  19312. -- __le16 len; /* length in bytes of this structure */
  19313. -- __le16 cap; /* sta's advertised capabilities */
  19314. -- __le32 flags; /* flags defined below */
  19315. -- __le32 idle; /* time since data pkt rx'd from sta */
  19316. -- u8 ea[ETH_ALEN]; /* Station address */
  19317. -- __le32 count; /* # rates in this set */
  19318. -- u8 rates[BRCMF_MAXRATES_IN_SET]; /* rates in 500kbps units */
  19319. -+ __le16 ver; /* version of this struct */
  19320. -+ __le16 len; /* length in bytes of this structure */
  19321. -+ __le16 cap; /* sta's advertised capabilities */
  19322. -+ __le32 flags; /* flags defined below */
  19323. -+ __le32 idle; /* time since data pkt rx'd from sta */
  19324. -+ u8 ea[ETH_ALEN]; /* Station address */
  19325. -+ __le32 count; /* # rates in this set */
  19326. -+ u8 rates[BRCMF_MAXRATES_IN_SET]; /* rates in 500kbps units */
  19327. - /* w/hi bit set if basic */
  19328. -- __le32 in; /* seconds elapsed since associated */
  19329. -- __le32 listen_interval_inms; /* Min Listen interval in ms for STA */
  19330. -- __le32 tx_pkts; /* # of packets transmitted */
  19331. -- __le32 tx_failures; /* # of packets failed */
  19332. -- __le32 rx_ucast_pkts; /* # of unicast packets received */
  19333. -- __le32 rx_mcast_pkts; /* # of multicast packets received */
  19334. -- __le32 tx_rate; /* Rate of last successful tx frame */
  19335. -- __le32 rx_rate; /* Rate of last successful rx frame */
  19336. -- __le32 rx_decrypt_succeeds; /* # of packet decrypted successfully */
  19337. -- __le32 rx_decrypt_failures; /* # of packet decrypted failed */
  19338. -+ __le32 in; /* seconds elapsed since associated */
  19339. -+ __le32 listen_interval_inms; /* Min Listen interval in ms for STA */
  19340. -+ __le32 tx_pkts; /* # of packets transmitted */
  19341. -+ __le32 tx_failures; /* # of packets failed */
  19342. -+ __le32 rx_ucast_pkts; /* # of unicast packets received */
  19343. -+ __le32 rx_mcast_pkts; /* # of multicast packets received */
  19344. -+ __le32 tx_rate; /* Rate of last successful tx frame */
  19345. -+ __le32 rx_rate; /* Rate of last successful rx frame */
  19346. -+ __le32 rx_decrypt_succeeds; /* # of packet decrypted successfully */
  19347. -+ __le32 rx_decrypt_failures; /* # of packet decrypted failed */
  19348. -+ __le32 tx_tot_pkts; /* # of tx pkts (ucast + mcast) */
  19349. -+ __le32 rx_tot_pkts; /* # of data packets recvd (uni + mcast) */
  19350. -+ __le32 tx_mcast_pkts; /* # of mcast pkts txed */
  19351. -+ __le64 tx_tot_bytes; /* data bytes txed (ucast + mcast) */
  19352. -+ __le64 rx_tot_bytes; /* data bytes recvd (ucast + mcast) */
  19353. -+ __le64 tx_ucast_bytes; /* data bytes txed (ucast) */
  19354. -+ __le64 tx_mcast_bytes; /* # data bytes txed (mcast) */
  19355. -+ __le64 rx_ucast_bytes; /* data bytes recvd (ucast) */
  19356. -+ __le64 rx_mcast_bytes; /* data bytes recvd (mcast) */
  19357. -+ s8 rssi[BRCMF_ANT_MAX]; /* per antenna rssi */
  19358. -+ s8 nf[BRCMF_ANT_MAX]; /* per antenna noise floor */
  19359. -+ __le16 aid; /* association ID */
  19360. -+ __le16 ht_capabilities; /* advertised ht caps */
  19361. -+ __le16 vht_flags; /* converted vht flags */
  19362. -+ __le32 tx_pkts_retry_cnt; /* # of frames where a retry was
  19363. -+ * exhausted.
  19364. -+ */
  19365. -+ __le32 tx_pkts_retry_exhausted; /* # of user frames where a retry
  19366. -+ * was exhausted
  19367. -+ */
  19368. -+ s8 rx_lastpkt_rssi[BRCMF_ANT_MAX]; /* Per antenna RSSI of last
  19369. -+ * received data frame.
  19370. -+ */
  19371. -+ /* TX WLAN retry/failure statistics:
  19372. -+ * Separated for host requested frames and locally generated frames.
  19373. -+ * Include unicast frame only where the retries/failures can be counted.
  19374. -+ */
  19375. -+ __le32 tx_pkts_total; /* # user frames sent successfully */
  19376. -+ __le32 tx_pkts_retries; /* # user frames retries */
  19377. -+ __le32 tx_pkts_fw_total; /* # FW generated sent successfully */
  19378. -+ __le32 tx_pkts_fw_retries; /* # retries for FW generated frames */
  19379. -+ __le32 tx_pkts_fw_retry_exhausted; /* # FW generated where a retry
  19380. -+ * was exhausted
  19381. -+ */
  19382. -+ __le32 rx_pkts_retried; /* # rx with retry bit set */
  19383. -+ __le32 tx_rate_fallback; /* lowest fallback TX rate */
  19384. - };
  19385. -
  19386. - struct brcmf_chanspec_list {
  19387. diff --git a/package/kernel/mac80211/patches/359-0004-brcmfmac-have-sdio-return-EIO-when-device-communicat.patch b/package/kernel/mac80211/patches/359-0004-brcmfmac-have-sdio-return-EIO-when-device-communicat.patch
  19388. deleted file mode 100644
  19389. index 302bc3e..0000000
  19390. --- a/package/kernel/mac80211/patches/359-0004-brcmfmac-have-sdio-return-EIO-when-device-communicat.patch
  19391. +++ /dev/null
  19392. @@ -1,56 +0,0 @@
  19393. -From: Arend van Spriel <arend@broadcom.com>
  19394. -Date: Thu, 11 Jun 2015 00:12:20 +0200
  19395. -Subject: [PATCH] brcmfmac: have sdio return -EIO when device communication
  19396. - is not possible
  19397. -
  19398. -The bus interface functions txctl and rxctl may be used while the device
  19399. -can not be accessed, eg. upon driver .remove() callback. This patch will
  19400. -immediately return -EIO when this is the case which speeds up the module
  19401. -unload.
  19402. -
  19403. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19404. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  19405. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19406. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19407. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19408. ----
  19409. -
  19410. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  19411. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  19412. -@@ -988,6 +988,7 @@ static void brcmf_sdiod_freezer_detach(s
  19413. -
  19414. - static int brcmf_sdiod_remove(struct brcmf_sdio_dev *sdiodev)
  19415. - {
  19416. -+ sdiodev->state = BRCMF_SDIOD_DOWN;
  19417. - if (sdiodev->bus) {
  19418. - brcmf_sdio_remove(sdiodev->bus);
  19419. - sdiodev->bus = NULL;
  19420. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  19421. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  19422. -@@ -2820,6 +2820,8 @@ static int brcmf_sdio_bus_txdata(struct
  19423. - struct brcmf_sdio *bus = sdiodev->bus;
  19424. -
  19425. - brcmf_dbg(TRACE, "Enter: pkt: data %p len %d\n", pkt->data, pkt->len);
  19426. -+ if (sdiodev->state != BRCMF_SDIOD_DATA)
  19427. -+ return -EIO;
  19428. -
  19429. - /* Add space for the header */
  19430. - skb_push(pkt, bus->tx_hdrlen);
  19431. -@@ -2948,6 +2950,8 @@ brcmf_sdio_bus_txctl(struct device *dev,
  19432. - int ret;
  19433. -
  19434. - brcmf_dbg(TRACE, "Enter\n");
  19435. -+ if (sdiodev->state != BRCMF_SDIOD_DATA)
  19436. -+ return -EIO;
  19437. -
  19438. - /* Send from dpc */
  19439. - bus->ctrl_frame_buf = msg;
  19440. -@@ -3238,6 +3242,8 @@ brcmf_sdio_bus_rxctl(struct device *dev,
  19441. - struct brcmf_sdio *bus = sdiodev->bus;
  19442. -
  19443. - brcmf_dbg(TRACE, "Enter\n");
  19444. -+ if (sdiodev->state != BRCMF_SDIOD_DATA)
  19445. -+ return -EIO;
  19446. -
  19447. - /* Wait until control frame is available */
  19448. - timeleft = brcmf_sdio_dcmd_resp_wait(bus, &bus->rxlen, &pending);
  19449. diff --git a/package/kernel/mac80211/patches/359-0005-ath9k-make-DMA-stop-related-messages-debug-only.patch b/package/kernel/mac80211/patches/359-0005-ath9k-make-DMA-stop-related-messages-debug-only.patch
  19450. deleted file mode 100644
  19451. index 34af6d2..0000000
  19452. --- a/package/kernel/mac80211/patches/359-0005-ath9k-make-DMA-stop-related-messages-debug-only.patch
  19453. +++ /dev/null
  19454. @@ -1,74 +0,0 @@
  19455. -From: Felix Fietkau <nbd@openwrt.org>
  19456. -Date: Thu, 2 Jul 2015 13:35:05 +0200
  19457. -Subject: [PATCH] ath9k: make DMA stop related messages debug-only
  19458. -
  19459. -A long time ago, ath9k had issues during reset where the DMA engine
  19460. -would stay active and could potentially corrupt memory.
  19461. -To debug those issues, the driver would print warnings whenever they
  19462. -occur.
  19463. -
  19464. -Nowadays, these issues are gone and the primary cause of these messages
  19465. -is if the MAC is stuck during reset or busy processing a long
  19466. -transmission. This is fairly harmless, yet these messages continue to
  19467. -worry users.
  19468. -
  19469. -To reduce the number of bogus bug reports, turn these messages into
  19470. -debug messages and count their occurence in the "reset" debugfs file.
  19471. -
  19472. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  19473. ----
  19474. -
  19475. ---- a/drivers/net/wireless/ath/ath9k/debug.c
  19476. -+++ b/drivers/net/wireless/ath/ath9k/debug.c
  19477. -@@ -765,6 +765,8 @@ static int read_file_reset(struct seq_fi
  19478. - [RESET_TYPE_BEACON_STUCK] = "Stuck Beacon",
  19479. - [RESET_TYPE_MCI] = "MCI Reset",
  19480. - [RESET_TYPE_CALIBRATION] = "Calibration error",
  19481. -+ [RESET_TX_DMA_ERROR] = "Tx DMA stop error",
  19482. -+ [RESET_RX_DMA_ERROR] = "Rx DMA stop error",
  19483. - };
  19484. - int i;
  19485. -
  19486. ---- a/drivers/net/wireless/ath/ath9k/debug.h
  19487. -+++ b/drivers/net/wireless/ath/ath9k/debug.h
  19488. -@@ -50,6 +50,8 @@ enum ath_reset_type {
  19489. - RESET_TYPE_BEACON_STUCK,
  19490. - RESET_TYPE_MCI,
  19491. - RESET_TYPE_CALIBRATION,
  19492. -+ RESET_TX_DMA_ERROR,
  19493. -+ RESET_RX_DMA_ERROR,
  19494. - __RESET_TYPE_MAX
  19495. - };
  19496. -
  19497. ---- a/drivers/net/wireless/ath/ath9k/recv.c
  19498. -+++ b/drivers/net/wireless/ath/ath9k/recv.c
  19499. -@@ -496,10 +496,9 @@ bool ath_stoprecv(struct ath_softc *sc)
  19500. -
  19501. - if (!(ah->ah_flags & AH_UNPLUGGED) &&
  19502. - unlikely(!stopped)) {
  19503. -- ath_err(ath9k_hw_common(sc->sc_ah),
  19504. -- "Could not stop RX, we could be "
  19505. -- "confusing the DMA engine when we start RX up\n");
  19506. -- ATH_DBG_WARN_ON_ONCE(!stopped);
  19507. -+ ath_dbg(ath9k_hw_common(sc->sc_ah), RESET,
  19508. -+ "Failed to stop Rx DMA\n");
  19509. -+ RESET_STAT_INC(sc, RESET_RX_DMA_ERROR);
  19510. - }
  19511. - return stopped && !reset;
  19512. - }
  19513. ---- a/drivers/net/wireless/ath/ath9k/xmit.c
  19514. -+++ b/drivers/net/wireless/ath/ath9k/xmit.c
  19515. -@@ -1896,8 +1896,11 @@ bool ath_drain_all_txq(struct ath_softc
  19516. - npend |= BIT(i);
  19517. - }
  19518. -
  19519. -- if (npend)
  19520. -- ath_err(common, "Failed to stop TX DMA, queues=0x%03x!\n", npend);
  19521. -+ if (npend) {
  19522. -+ RESET_STAT_INC(sc, RESET_TX_DMA_ERROR);
  19523. -+ ath_dbg(common, RESET,
  19524. -+ "Failed to stop TX DMA, queues=0x%03x!\n", npend);
  19525. -+ }
  19526. -
  19527. - for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
  19528. - if (!ATH_TXQ_SETUP(sc, i))
  19529. diff --git a/package/kernel/mac80211/patches/359-0006-brcmfmac-free-ifp-for-non-netdev-interface-in-p2p-mo.patch b/package/kernel/mac80211/patches/359-0006-brcmfmac-free-ifp-for-non-netdev-interface-in-p2p-mo.patch
  19530. deleted file mode 100644
  19531. index 06f2dce..0000000
  19532. --- a/package/kernel/mac80211/patches/359-0006-brcmfmac-free-ifp-for-non-netdev-interface-in-p2p-mo.patch
  19533. +++ /dev/null
  19534. @@ -1,44 +0,0 @@
  19535. -From: Arend van Spriel <arend@broadcom.com>
  19536. -Date: Thu, 11 Jun 2015 00:12:21 +0200
  19537. -Subject: [PATCH] brcmfmac: free ifp for non-netdev interface in p2p module
  19538. -
  19539. -Making it more clear by freeing the ifp in same place where the
  19540. -vif object is freed.
  19541. -
  19542. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19543. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  19544. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19545. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19546. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19547. ----
  19548. -
  19549. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  19550. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  19551. -@@ -867,8 +867,6 @@ static void brcmf_del_if(struct brcmf_pu
  19552. - }
  19553. - /* unregister will take care of freeing it */
  19554. - unregister_netdev(ifp->ndev);
  19555. -- } else {
  19556. -- kfree(ifp);
  19557. - }
  19558. - }
  19559. -
  19560. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  19561. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  19562. -@@ -2238,6 +2238,7 @@ static void brcmf_p2p_delete_p2pdev(stru
  19563. - {
  19564. - cfg80211_unregister_wdev(&vif->wdev);
  19565. - p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  19566. -+ kfree(vif->ifp);
  19567. - brcmf_free_vif(vif);
  19568. - }
  19569. -
  19570. -@@ -2361,6 +2362,8 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  19571. - break;
  19572. -
  19573. - case NL80211_IFTYPE_P2P_DEVICE:
  19574. -+ brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  19575. -+ brcmf_p2p_deinit_discovery(p2p);
  19576. - brcmf_p2p_delete_p2pdev(p2p, vif);
  19577. - return 0;
  19578. - default:
  19579. diff --git a/package/kernel/mac80211/patches/359-0007-brcmfmac-move-p2p-attach-detach-functions.patch b/package/kernel/mac80211/patches/359-0007-brcmfmac-move-p2p-attach-detach-functions.patch
  19580. deleted file mode 100644
  19581. index 0a6e093..0000000
  19582. --- a/package/kernel/mac80211/patches/359-0007-brcmfmac-move-p2p-attach-detach-functions.patch
  19583. +++ /dev/null
  19584. @@ -1,225 +0,0 @@
  19585. -From: Arend van Spriel <arend@broadcom.com>
  19586. -Date: Thu, 11 Jun 2015 00:12:22 +0200
  19587. -Subject: [PATCH] brcmfmac: move p2p attach/detach functions
  19588. -
  19589. -Moving two functions in p2p.c as is so next change will be
  19590. -easier to review.
  19591. -
  19592. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19593. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  19594. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19595. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19596. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19597. ----
  19598. -
  19599. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  19600. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  19601. -@@ -1908,105 +1908,6 @@ s32 brcmf_p2p_notify_rx_mgmt_p2p_probere
  19602. -
  19603. -
  19604. - /**
  19605. -- * brcmf_p2p_attach() - attach for P2P.
  19606. -- *
  19607. -- * @cfg: driver private data for cfg80211 interface.
  19608. -- */
  19609. --s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg)
  19610. --{
  19611. -- struct brcmf_if *pri_ifp;
  19612. -- struct brcmf_if *p2p_ifp;
  19613. -- struct brcmf_cfg80211_vif *p2p_vif;
  19614. -- struct brcmf_p2p_info *p2p;
  19615. -- struct brcmf_pub *drvr;
  19616. -- s32 bssidx;
  19617. -- s32 err = 0;
  19618. --
  19619. -- p2p = &cfg->p2p;
  19620. -- p2p->cfg = cfg;
  19621. --
  19622. -- drvr = cfg->pub;
  19623. --
  19624. -- pri_ifp = drvr->iflist[0];
  19625. -- p2p_ifp = drvr->iflist[1];
  19626. --
  19627. -- p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif = pri_ifp->vif;
  19628. --
  19629. -- if (p2p_ifp) {
  19630. -- p2p_vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_P2P_DEVICE,
  19631. -- false);
  19632. -- if (IS_ERR(p2p_vif)) {
  19633. -- brcmf_err("could not create discovery vif\n");
  19634. -- err = -ENOMEM;
  19635. -- goto exit;
  19636. -- }
  19637. --
  19638. -- p2p_vif->ifp = p2p_ifp;
  19639. -- p2p_ifp->vif = p2p_vif;
  19640. -- p2p_vif->wdev.netdev = p2p_ifp->ndev;
  19641. -- p2p_ifp->ndev->ieee80211_ptr = &p2p_vif->wdev;
  19642. -- SET_NETDEV_DEV(p2p_ifp->ndev, wiphy_dev(cfg->wiphy));
  19643. --
  19644. -- p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = p2p_vif;
  19645. --
  19646. -- brcmf_p2p_generate_bss_mac(p2p, NULL);
  19647. -- memcpy(p2p_ifp->mac_addr, p2p->dev_addr, ETH_ALEN);
  19648. -- brcmf_p2p_set_firmware(pri_ifp, p2p->dev_addr);
  19649. --
  19650. -- /* Initialize P2P Discovery in the firmware */
  19651. -- err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1);
  19652. -- if (err < 0) {
  19653. -- brcmf_err("set p2p_disc error\n");
  19654. -- brcmf_free_vif(p2p_vif);
  19655. -- goto exit;
  19656. -- }
  19657. -- /* obtain bsscfg index for P2P discovery */
  19658. -- err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bssidx);
  19659. -- if (err < 0) {
  19660. -- brcmf_err("retrieving discover bsscfg index failed\n");
  19661. -- brcmf_free_vif(p2p_vif);
  19662. -- goto exit;
  19663. -- }
  19664. -- /* Verify that firmware uses same bssidx as driver !! */
  19665. -- if (p2p_ifp->bssidx != bssidx) {
  19666. -- brcmf_err("Incorrect bssidx=%d, compared to p2p_ifp->bssidx=%d\n",
  19667. -- bssidx, p2p_ifp->bssidx);
  19668. -- brcmf_free_vif(p2p_vif);
  19669. -- goto exit;
  19670. -- }
  19671. --
  19672. -- init_completion(&p2p->send_af_done);
  19673. -- INIT_WORK(&p2p->afx_hdl.afx_work, brcmf_p2p_afx_handler);
  19674. -- init_completion(&p2p->afx_hdl.act_frm_scan);
  19675. -- init_completion(&p2p->wait_next_af);
  19676. -- }
  19677. --exit:
  19678. -- return err;
  19679. --}
  19680. --
  19681. --
  19682. --/**
  19683. -- * brcmf_p2p_detach() - detach P2P.
  19684. -- *
  19685. -- * @p2p: P2P specific data.
  19686. -- */
  19687. --void brcmf_p2p_detach(struct brcmf_p2p_info *p2p)
  19688. --{
  19689. -- struct brcmf_cfg80211_vif *vif;
  19690. --
  19691. -- vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
  19692. -- if (vif != NULL) {
  19693. -- brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  19694. -- brcmf_p2p_deinit_discovery(p2p);
  19695. -- /* remove discovery interface */
  19696. -- brcmf_free_vif(vif);
  19697. -- p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  19698. -- }
  19699. -- /* just set it all to zero */
  19700. -- memset(p2p, 0, sizeof(*p2p));
  19701. --}
  19702. --
  19703. --/**
  19704. - * brcmf_p2p_get_current_chanspec() - Get current operation channel.
  19705. - *
  19706. - * @p2p: P2P specific data.
  19707. -@@ -2425,3 +2326,102 @@ void brcmf_p2p_stop_device(struct wiphy
  19708. - clear_bit(BRCMF_VIF_STATUS_READY, &vif->sme_state);
  19709. - mutex_unlock(&cfg->usr_sync);
  19710. - }
  19711. -+
  19712. -+/**
  19713. -+ * brcmf_p2p_attach() - attach for P2P.
  19714. -+ *
  19715. -+ * @cfg: driver private data for cfg80211 interface.
  19716. -+ */
  19717. -+s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg)
  19718. -+{
  19719. -+ struct brcmf_if *pri_ifp;
  19720. -+ struct brcmf_if *p2p_ifp;
  19721. -+ struct brcmf_cfg80211_vif *p2p_vif;
  19722. -+ struct brcmf_p2p_info *p2p;
  19723. -+ struct brcmf_pub *drvr;
  19724. -+ s32 bssidx;
  19725. -+ s32 err = 0;
  19726. -+
  19727. -+ p2p = &cfg->p2p;
  19728. -+ p2p->cfg = cfg;
  19729. -+
  19730. -+ drvr = cfg->pub;
  19731. -+
  19732. -+ pri_ifp = drvr->iflist[0];
  19733. -+ p2p_ifp = drvr->iflist[1];
  19734. -+
  19735. -+ p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif = pri_ifp->vif;
  19736. -+
  19737. -+ if (p2p_ifp) {
  19738. -+ p2p_vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_P2P_DEVICE,
  19739. -+ false);
  19740. -+ if (IS_ERR(p2p_vif)) {
  19741. -+ brcmf_err("could not create discovery vif\n");
  19742. -+ err = -ENOMEM;
  19743. -+ goto exit;
  19744. -+ }
  19745. -+
  19746. -+ p2p_vif->ifp = p2p_ifp;
  19747. -+ p2p_ifp->vif = p2p_vif;
  19748. -+ p2p_vif->wdev.netdev = p2p_ifp->ndev;
  19749. -+ p2p_ifp->ndev->ieee80211_ptr = &p2p_vif->wdev;
  19750. -+ SET_NETDEV_DEV(p2p_ifp->ndev, wiphy_dev(cfg->wiphy));
  19751. -+
  19752. -+ p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = p2p_vif;
  19753. -+
  19754. -+ brcmf_p2p_generate_bss_mac(p2p, NULL);
  19755. -+ memcpy(p2p_ifp->mac_addr, p2p->dev_addr, ETH_ALEN);
  19756. -+ brcmf_p2p_set_firmware(pri_ifp, p2p->dev_addr);
  19757. -+
  19758. -+ /* Initialize P2P Discovery in the firmware */
  19759. -+ err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1);
  19760. -+ if (err < 0) {
  19761. -+ brcmf_err("set p2p_disc error\n");
  19762. -+ brcmf_free_vif(p2p_vif);
  19763. -+ goto exit;
  19764. -+ }
  19765. -+ /* obtain bsscfg index for P2P discovery */
  19766. -+ err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bssidx);
  19767. -+ if (err < 0) {
  19768. -+ brcmf_err("retrieving discover bsscfg index failed\n");
  19769. -+ brcmf_free_vif(p2p_vif);
  19770. -+ goto exit;
  19771. -+ }
  19772. -+ /* Verify that firmware uses same bssidx as driver !! */
  19773. -+ if (p2p_ifp->bssidx != bssidx) {
  19774. -+ brcmf_err("Incorrect bssidx=%d, compared to p2p_ifp->bssidx=%d\n",
  19775. -+ bssidx, p2p_ifp->bssidx);
  19776. -+ brcmf_free_vif(p2p_vif);
  19777. -+ goto exit;
  19778. -+ }
  19779. -+
  19780. -+ init_completion(&p2p->send_af_done);
  19781. -+ INIT_WORK(&p2p->afx_hdl.afx_work, brcmf_p2p_afx_handler);
  19782. -+ init_completion(&p2p->afx_hdl.act_frm_scan);
  19783. -+ init_completion(&p2p->wait_next_af);
  19784. -+ }
  19785. -+exit:
  19786. -+ return err;
  19787. -+}
  19788. -+
  19789. -+/**
  19790. -+ * brcmf_p2p_detach() - detach P2P.
  19791. -+ *
  19792. -+ * @p2p: P2P specific data.
  19793. -+ */
  19794. -+void brcmf_p2p_detach(struct brcmf_p2p_info *p2p)
  19795. -+{
  19796. -+ struct brcmf_cfg80211_vif *vif;
  19797. -+
  19798. -+ vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
  19799. -+ if (vif != NULL) {
  19800. -+ brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  19801. -+ brcmf_p2p_deinit_discovery(p2p);
  19802. -+ /* remove discovery interface */
  19803. -+ brcmf_free_vif(vif);
  19804. -+ p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  19805. -+ }
  19806. -+ /* just set it all to zero */
  19807. -+ memset(p2p, 0, sizeof(*p2p));
  19808. -+}
  19809. -+
  19810. diff --git a/package/kernel/mac80211/patches/359-0008-brcmfmac-assure-p2pdev-is-unregistered-upon-driver-u.patch b/package/kernel/mac80211/patches/359-0008-brcmfmac-assure-p2pdev-is-unregistered-upon-driver-u.patch
  19811. deleted file mode 100644
  19812. index 72e8eed..0000000
  19813. --- a/package/kernel/mac80211/patches/359-0008-brcmfmac-assure-p2pdev-is-unregistered-upon-driver-u.patch
  19814. +++ /dev/null
  19815. @@ -1,63 +0,0 @@
  19816. -From: Arend van Spriel <arend@broadcom.com>
  19817. -Date: Thu, 11 Jun 2015 00:12:23 +0200
  19818. -Subject: [PATCH] brcmfmac: assure p2pdev is unregistered upon driver
  19819. - unload
  19820. -
  19821. -When unloading the driver with a p2pdev interface it resulted in
  19822. -a warning upon calling wiphy_unregister() and subsequently a crash
  19823. -in the driver. This patch assures the p2pdev is unregistered calling
  19824. -unregister_wdev() before doing the wiphy_unregister().
  19825. -
  19826. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19827. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  19828. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19829. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19830. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19831. ----
  19832. -
  19833. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19834. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19835. -@@ -6206,10 +6206,8 @@ void brcmf_cfg80211_detach(struct brcmf_
  19836. - if (!cfg)
  19837. - return;
  19838. -
  19839. -- WARN_ON(!list_empty(&cfg->vif_list));
  19840. -- wiphy_unregister(cfg->wiphy);
  19841. - brcmf_btcoex_detach(cfg);
  19842. -- brcmf_p2p_detach(&cfg->p2p);
  19843. -+ wiphy_unregister(cfg->wiphy);
  19844. - wl_deinit_priv(cfg);
  19845. - brcmf_free_wiphy(cfg->wiphy);
  19846. - }
  19847. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  19848. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  19849. -@@ -1098,6 +1098,7 @@ void brcmf_detach(struct device *dev)
  19850. -
  19851. - /* stop firmware event handling */
  19852. - brcmf_fweh_detach(drvr);
  19853. -+ brcmf_p2p_detach(&drvr->config->p2p);
  19854. -
  19855. - brcmf_bus_change_state(bus_if, BRCMF_BUS_DOWN);
  19856. -
  19857. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  19858. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  19859. -@@ -16,6 +16,7 @@
  19860. - #include <linux/slab.h>
  19861. - #include <linux/netdevice.h>
  19862. - #include <linux/etherdevice.h>
  19863. -+#include <linux/rtnetlink.h>
  19864. - #include <net/cfg80211.h>
  19865. -
  19866. - #include <brcmu_wifi.h>
  19867. -@@ -2418,8 +2419,9 @@ void brcmf_p2p_detach(struct brcmf_p2p_i
  19868. - brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  19869. - brcmf_p2p_deinit_discovery(p2p);
  19870. - /* remove discovery interface */
  19871. -- brcmf_free_vif(vif);
  19872. -- p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  19873. -+ rtnl_lock();
  19874. -+ brcmf_p2p_delete_p2pdev(p2p, vif);
  19875. -+ rtnl_unlock();
  19876. - }
  19877. - /* just set it all to zero */
  19878. - memset(p2p, 0, sizeof(*p2p));
  19879. diff --git a/package/kernel/mac80211/patches/360-0001-brcmfmac-fix-double-free-of-p2pdev-interface.patch b/package/kernel/mac80211/patches/360-0001-brcmfmac-fix-double-free-of-p2pdev-interface.patch
  19880. deleted file mode 100644
  19881. index 179c77e..0000000
  19882. --- a/package/kernel/mac80211/patches/360-0001-brcmfmac-fix-double-free-of-p2pdev-interface.patch
  19883. +++ /dev/null
  19884. @@ -1,27 +0,0 @@
  19885. -From: Arend van Spriel <arend@broadcom.com>
  19886. -Date: Mon, 15 Jun 2015 22:48:38 +0200
  19887. -Subject: [PATCH] brcmfmac: fix double free of p2pdev interface
  19888. -
  19889. -When freeing the driver ifp pointer it should also be removed from
  19890. -the driver interface list, which is what brcmf_remove_interface()
  19891. -does. Otherwise, the ifp pointer will be freed twice triggering
  19892. -a kernel oops.
  19893. -
  19894. -Fixes: f37d69a4babc ("brcmfmac: free ifp for non-netdev interface in p2p module")
  19895. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19896. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19897. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19898. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19899. ----
  19900. -
  19901. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  19902. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  19903. -@@ -2140,7 +2140,7 @@ static void brcmf_p2p_delete_p2pdev(stru
  19904. - {
  19905. - cfg80211_unregister_wdev(&vif->wdev);
  19906. - p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  19907. -- kfree(vif->ifp);
  19908. -+ brcmf_remove_interface(vif->ifp->drvr, vif->ifp->bssidx);
  19909. - brcmf_free_vif(vif);
  19910. - }
  19911. -
  19912. diff --git a/package/kernel/mac80211/patches/360-0002-brcmfmac-make-brcmf_p2p_detach-call-conditional.patch b/package/kernel/mac80211/patches/360-0002-brcmfmac-make-brcmf_p2p_detach-call-conditional.patch
  19913. deleted file mode 100644
  19914. index e4f88b5..0000000
  19915. --- a/package/kernel/mac80211/patches/360-0002-brcmfmac-make-brcmf_p2p_detach-call-conditional.patch
  19916. +++ /dev/null
  19917. @@ -1,29 +0,0 @@
  19918. -From: Arend van Spriel <arend@broadcom.com>
  19919. -Date: Mon, 15 Jun 2015 22:48:39 +0200
  19920. -Subject: [PATCH] brcmfmac: make brcmf_p2p_detach() call conditional
  19921. -
  19922. -During verification of error handling in brcmf_cfg80211_attach() a
  19923. -null pointer dereference occurred upon calling brcmf_p2p_detach()
  19924. -from brcmf_detach(). This should only be called when the
  19925. -brcmf_cfg80211_attach() has succeeded.
  19926. -
  19927. -Fixes: f7a40873d2fa ("brcmfmac: assure p2pdev is unregistered upon driver unload")
  19928. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19929. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  19930. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19931. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19932. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19933. ----
  19934. -
  19935. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  19936. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  19937. -@@ -1098,7 +1098,8 @@ void brcmf_detach(struct device *dev)
  19938. -
  19939. - /* stop firmware event handling */
  19940. - brcmf_fweh_detach(drvr);
  19941. -- brcmf_p2p_detach(&drvr->config->p2p);
  19942. -+ if (drvr->config)
  19943. -+ brcmf_p2p_detach(&drvr->config->p2p);
  19944. -
  19945. - brcmf_bus_change_state(bus_if, BRCMF_BUS_DOWN);
  19946. -
  19947. diff --git a/package/kernel/mac80211/patches/361-brcmfmac-set-wiphy-s-addresses-to-provide-valid-MACs.patch b/package/kernel/mac80211/patches/361-brcmfmac-set-wiphy-s-addresses-to-provide-valid-MACs.patch
  19948. deleted file mode 100644
  19949. index 0a81237..0000000
  19950. --- a/package/kernel/mac80211/patches/361-brcmfmac-set-wiphy-s-addresses-to-provide-valid-MACs.patch
  19951. +++ /dev/null
  19952. @@ -1,67 +0,0 @@
  19953. -From: Rafa? Mi?ecki <zajec5@gmail.com>
  19954. -Date: Thu, 9 Jul 2015 17:07:08 +0200
  19955. -Subject: [PATCH] brcmfmac: set wiphy's addresses to provide valid MACs
  19956. -
  19957. -Broadcom's firmware requires every BSS to use MAC address with unique
  19958. -last few bits. The amount of bits may depend on a particular firmware,
  19959. -it was verified to be 2 for BCM43602 one.
  19960. -If this condition won't be fulfilled firmware will reject such MAC:
  19961. -brcmfmac: _brcmf_set_mac_address: Setting cur_etheraddr failed, -52
  19962. -
  19963. -We don't want to simply set addr_mask as it would also disallow using
  19964. -locally administrated bit. Instead let's build a list of addresses
  19965. -manually enabling 0x2 bit for extra interfaces.
  19966. -
  19967. -Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
  19968. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19969. ----
  19970. -
  19971. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19972. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19973. -@@ -5784,6 +5784,7 @@ static void brcmf_wiphy_wowl_params(stru
  19974. -
  19975. - static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
  19976. - {
  19977. -+ struct brcmf_pub *drvr = ifp->drvr;
  19978. - struct ieee80211_supported_band *band;
  19979. - __le32 bandlist[3];
  19980. - u32 n_bands;
  19981. -@@ -5797,6 +5798,19 @@ static int brcmf_setup_wiphy(struct wiph
  19982. - if (err)
  19983. - return err;
  19984. -
  19985. -+ for (i = 0; i < wiphy->iface_combinations->max_interfaces &&
  19986. -+ i < ARRAY_SIZE(drvr->addresses); i++) {
  19987. -+ u8 *addr = drvr->addresses[i].addr;
  19988. -+
  19989. -+ memcpy(addr, drvr->mac, ETH_ALEN);
  19990. -+ if (i) {
  19991. -+ addr[0] |= BIT(1);
  19992. -+ addr[ETH_ALEN - 1] ^= i;
  19993. -+ }
  19994. -+ }
  19995. -+ wiphy->addresses = drvr->addresses;
  19996. -+ wiphy->n_addresses = i;
  19997. -+
  19998. - wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
  19999. - wiphy->cipher_suites = __wl_cipher_suites;
  20000. - wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites);
  20001. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20002. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20003. -@@ -21,6 +21,7 @@
  20004. - #ifndef BRCMFMAC_CORE_H
  20005. - #define BRCMFMAC_CORE_H
  20006. -
  20007. -+#include <net/cfg80211.h>
  20008. - #include "fweh.h"
  20009. -
  20010. - #define TOE_TX_CSUM_OL 0x00000001
  20011. -@@ -118,6 +119,8 @@ struct brcmf_pub {
  20012. - /* Multicast data packets sent to dongle */
  20013. - unsigned long tx_multicast;
  20014. -
  20015. -+ struct mac_address addresses[BRCMF_MAX_IFS];
  20016. -+
  20017. - struct brcmf_if *iflist[BRCMF_MAX_IFS];
  20018. -
  20019. - struct mutex proto_block;
  20020. diff --git a/package/kernel/mac80211/patches/362-brcmfmac-dhd_sdio.c-use-existing-atomic_or-primitive.patch b/package/kernel/mac80211/patches/362-brcmfmac-dhd_sdio.c-use-existing-atomic_or-primitive.patch
  20021. deleted file mode 100644
  20022. index e44f121..0000000
  20023. --- a/package/kernel/mac80211/patches/362-brcmfmac-dhd_sdio.c-use-existing-atomic_or-primitive.patch
  20024. +++ /dev/null
  20025. @@ -1,45 +0,0 @@
  20026. -From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
  20027. -Date: Thu, 9 Jul 2015 13:43:18 +0530
  20028. -Subject: [PATCH] brcmfmac: dhd_sdio.c: use existing atomic_or primitive
  20029. -
  20030. -There's already a generic implementation so use that instead.
  20031. -
  20032. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  20033. ----
  20034. -
  20035. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  20036. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  20037. -@@ -2564,15 +2564,6 @@ static inline void brcmf_sdio_clrintr(st
  20038. - }
  20039. - }
  20040. -
  20041. --static void atomic_orr(int val, atomic_t *v)
  20042. --{
  20043. -- int old_val;
  20044. --
  20045. -- old_val = atomic_read(v);
  20046. -- while (atomic_cmpxchg(v, old_val, val | old_val) != old_val)
  20047. -- old_val = atomic_read(v);
  20048. --}
  20049. --
  20050. - static int brcmf_sdio_intr_rstatus(struct brcmf_sdio *bus)
  20051. - {
  20052. - struct brcmf_core *buscore;
  20053. -@@ -2595,7 +2586,7 @@ static int brcmf_sdio_intr_rstatus(struc
  20054. - if (val) {
  20055. - brcmf_sdiod_regwl(bus->sdiodev, addr, val, &ret);
  20056. - bus->sdcnt.f1regdata++;
  20057. -- atomic_orr(val, &bus->intstatus);
  20058. -+ atomic_or(val, &bus->intstatus);
  20059. - }
  20060. -
  20061. - return ret;
  20062. -@@ -2712,7 +2703,7 @@ static void brcmf_sdio_dpc(struct brcmf_
  20063. -
  20064. - /* Keep still-pending events for next scheduling */
  20065. - if (intstatus)
  20066. -- atomic_orr(intstatus, &bus->intstatus);
  20067. -+ atomic_or(intstatus, &bus->intstatus);
  20068. -
  20069. - brcmf_sdio_clrintr(bus);
  20070. -
  20071. diff --git a/package/kernel/mac80211/patches/363-0001-brcmfmac-check-all-combinations-when-setting-wiphy-s.patch b/package/kernel/mac80211/patches/363-0001-brcmfmac-check-all-combinations-when-setting-wiphy-s.patch
  20072. deleted file mode 100644
  20073. index 76ca143..0000000
  20074. --- a/package/kernel/mac80211/patches/363-0001-brcmfmac-check-all-combinations-when-setting-wiphy-s.patch
  20075. +++ /dev/null
  20076. @@ -1,46 +0,0 @@
  20077. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  20078. -Date: Thu, 20 Aug 2015 00:16:42 +0200
  20079. -Subject: [PATCH] brcmfmac: check all combinations when setting wiphy's
  20080. - addresses
  20081. -MIME-Version: 1.0
  20082. -Content-Type: text/plain; charset=UTF-8
  20083. -Content-Transfer-Encoding: 8bit
  20084. -
  20085. -Broadcom is working on better reflection of interface combinations. With
  20086. -upcoming patches we may have 1st combination supporting less interfaces
  20087. -than others.
  20088. -To don't run out of addresses check all combinations to find the one
  20089. -with the greatest max_interfaces value.
  20090. -
  20091. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  20092. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  20093. ----
  20094. -
  20095. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  20096. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  20097. -@@ -5785,7 +5785,9 @@ static void brcmf_wiphy_wowl_params(stru
  20098. - static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
  20099. - {
  20100. - struct brcmf_pub *drvr = ifp->drvr;
  20101. -+ const struct ieee80211_iface_combination *combo;
  20102. - struct ieee80211_supported_band *band;
  20103. -+ u16 max_interfaces = 0;
  20104. - __le32 bandlist[3];
  20105. - u32 n_bands;
  20106. - int err, i;
  20107. -@@ -5798,8 +5800,13 @@ static int brcmf_setup_wiphy(struct wiph
  20108. - if (err)
  20109. - return err;
  20110. -
  20111. -- for (i = 0; i < wiphy->iface_combinations->max_interfaces &&
  20112. -- i < ARRAY_SIZE(drvr->addresses); i++) {
  20113. -+ for (i = 0, combo = wiphy->iface_combinations;
  20114. -+ i < wiphy->n_iface_combinations; i++, combo++) {
  20115. -+ max_interfaces = max(max_interfaces, combo->max_interfaces);
  20116. -+ }
  20117. -+
  20118. -+ for (i = 0; i < max_interfaces && i < ARRAY_SIZE(drvr->addresses);
  20119. -+ i++) {
  20120. - u8 *addr = drvr->addresses[i].addr;
  20121. -
  20122. - memcpy(addr, drvr->mac, ETH_ALEN);
  20123. diff --git a/package/kernel/mac80211/patches/363-0002-brcmfmac-correct-interface-combination-info.patch b/package/kernel/mac80211/patches/363-0002-brcmfmac-correct-interface-combination-info.patch
  20124. deleted file mode 100644
  20125. index c4a0720..0000000
  20126. --- a/package/kernel/mac80211/patches/363-0002-brcmfmac-correct-interface-combination-info.patch
  20127. +++ /dev/null
  20128. @@ -1,204 +0,0 @@
  20129. -From: Arend van Spriel <arend@broadcom.com>
  20130. -Date: Thu, 20 Aug 2015 22:06:03 +0200
  20131. -Subject: [PATCH] brcmfmac: correct interface combination info
  20132. -
  20133. -The interface combination provided by brcmfmac did not truly reflect
  20134. -the combinations supported by driver and/or firmware.
  20135. -
  20136. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20137. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20138. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20139. -Reviewed-by: Pontus Fuchs <pontusf@broadcom.com>
  20140. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20141. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  20142. ----
  20143. -
  20144. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  20145. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  20146. -@@ -5694,63 +5694,132 @@ brcmf_txrx_stypes[NUM_NL80211_IFTYPES] =
  20147. - }
  20148. - };
  20149. -
  20150. -+/**
  20151. -+ * brcmf_setup_ifmodes() - determine interface modes and combinations.
  20152. -+ *
  20153. -+ * @wiphy: wiphy object.
  20154. -+ * @ifp: interface object needed for feat module api.
  20155. -+ *
  20156. -+ * The interface modes and combinations are determined dynamically here
  20157. -+ * based on firmware functionality.
  20158. -+ *
  20159. -+ * no p2p and no mbss:
  20160. -+ *
  20161. -+ * #STA <= 1, #AP <= 1, channels = 1, 2 total
  20162. -+ *
  20163. -+ * no p2p and mbss:
  20164. -+ *
  20165. -+ * #STA <= 1, #AP <= 1, channels = 1, 2 total
  20166. -+ * #AP <= 4, matching BI, channels = 1, 4 total
  20167. -+ *
  20168. -+ * p2p, no mchan, and mbss:
  20169. -+ *
  20170. -+ * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 1, 3 total
  20171. -+ * #STA <= 1, #P2P-DEV <= 1, #AP <= 1, #P2P-CL <= 1, channels = 1, 4 total
  20172. -+ * #AP <= 4, matching BI, channels = 1, 4 total
  20173. -+ *
  20174. -+ * p2p, mchan, and mbss:
  20175. -+ *
  20176. -+ * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 2, 3 total
  20177. -+ * #STA <= 1, #P2P-DEV <= 1, #AP <= 1, #P2P-CL <= 1, channels = 1, 4 total
  20178. -+ * #AP <= 4, matching BI, channels = 1, 4 total
  20179. -+ */
  20180. - static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp)
  20181. - {
  20182. - struct ieee80211_iface_combination *combo = NULL;
  20183. -- struct ieee80211_iface_limit *limits = NULL;
  20184. -- int i = 0, max_iface_cnt;
  20185. -+ struct ieee80211_iface_limit *c0_limits = NULL;
  20186. -+ struct ieee80211_iface_limit *p2p_limits = NULL;
  20187. -+ struct ieee80211_iface_limit *mbss_limits = NULL;
  20188. -+ bool mbss, p2p;
  20189. -+ int i, c, n_combos;
  20190. -
  20191. -- combo = kzalloc(sizeof(*combo), GFP_KERNEL);
  20192. -+ mbss = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS);
  20193. -+ p2p = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P);
  20194. -+
  20195. -+ n_combos = 1 + !!p2p + !!mbss;
  20196. -+ combo = kcalloc(n_combos, sizeof(*combo), GFP_KERNEL);
  20197. - if (!combo)
  20198. - goto err;
  20199. -
  20200. -- limits = kzalloc(sizeof(*limits) * 4, GFP_KERNEL);
  20201. -- if (!limits)
  20202. -+ c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
  20203. -+ if (!c0_limits)
  20204. - goto err;
  20205. -
  20206. -+ if (p2p) {
  20207. -+ p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
  20208. -+ if (!p2p_limits)
  20209. -+ goto err;
  20210. -+ }
  20211. -+
  20212. -+ if (mbss) {
  20213. -+ mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
  20214. -+ if (!mbss_limits)
  20215. -+ goto err;
  20216. -+ }
  20217. -+
  20218. - wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  20219. - BIT(NL80211_IFTYPE_ADHOC) |
  20220. - BIT(NL80211_IFTYPE_AP);
  20221. -
  20222. -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  20223. -- combo->num_different_channels = 2;
  20224. -- else
  20225. -- combo->num_different_channels = 1;
  20226. --
  20227. -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) {
  20228. -- limits[i].max = 1;
  20229. -- limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  20230. -- limits[i].max = 4;
  20231. -- limits[i++].types = BIT(NL80211_IFTYPE_AP);
  20232. -- max_iface_cnt = 5;
  20233. -- } else {
  20234. -- limits[i].max = 2;
  20235. -- limits[i++].types = BIT(NL80211_IFTYPE_STATION) |
  20236. -- BIT(NL80211_IFTYPE_AP);
  20237. -- max_iface_cnt = 2;
  20238. -- }
  20239. --
  20240. -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P)) {
  20241. -+ c = 0;
  20242. -+ i = 0;
  20243. -+ combo[c].num_different_channels = 1;
  20244. -+ c0_limits[i].max = 1;
  20245. -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  20246. -+ if (p2p) {
  20247. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  20248. -+ combo[c].num_different_channels = 2;
  20249. - wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) |
  20250. - BIT(NL80211_IFTYPE_P2P_GO) |
  20251. - BIT(NL80211_IFTYPE_P2P_DEVICE);
  20252. -- limits[i].max = 1;
  20253. -- limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  20254. -- BIT(NL80211_IFTYPE_P2P_GO);
  20255. -- limits[i].max = 1;
  20256. -- limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  20257. -- max_iface_cnt += 2;
  20258. -- }
  20259. -- combo->max_interfaces = max_iface_cnt;
  20260. -- combo->limits = limits;
  20261. -- combo->n_limits = i;
  20262. -+ c0_limits[i].max = 1;
  20263. -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  20264. -+ c0_limits[i].max = 1;
  20265. -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  20266. -+ BIT(NL80211_IFTYPE_P2P_GO);
  20267. -+ } else {
  20268. -+ c0_limits[i].max = 1;
  20269. -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  20270. -+ }
  20271. -+ combo[c].max_interfaces = i;
  20272. -+ combo[c].n_limits = i;
  20273. -+ combo[c].limits = c0_limits;
  20274. -+
  20275. -+ if (p2p) {
  20276. -+ c++;
  20277. -+ i = 0;
  20278. -+ combo[c].num_different_channels = 1;
  20279. -+ p2p_limits[i].max = 1;
  20280. -+ p2p_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  20281. -+ p2p_limits[i].max = 1;
  20282. -+ p2p_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  20283. -+ p2p_limits[i].max = 1;
  20284. -+ p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT);
  20285. -+ p2p_limits[i].max = 1;
  20286. -+ p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  20287. -+ combo[c].max_interfaces = i;
  20288. -+ combo[c].n_limits = i;
  20289. -+ combo[c].limits = p2p_limits;
  20290. -+ }
  20291. -
  20292. -+ if (mbss) {
  20293. -+ c++;
  20294. -+ combo[c].beacon_int_infra_match = true;
  20295. -+ combo[c].num_different_channels = 1;
  20296. -+ mbss_limits[0].max = 4;
  20297. -+ mbss_limits[0].types = BIT(NL80211_IFTYPE_AP);
  20298. -+ combo[c].max_interfaces = 4;
  20299. -+ combo[c].n_limits = 1;
  20300. -+ combo[c].limits = mbss_limits;
  20301. -+ }
  20302. -+ wiphy->n_iface_combinations = n_combos;
  20303. - wiphy->iface_combinations = combo;
  20304. -- wiphy->n_iface_combinations = 1;
  20305. - return 0;
  20306. -
  20307. - err:
  20308. -- kfree(limits);
  20309. -+ kfree(c0_limits);
  20310. -+ kfree(p2p_limits);
  20311. -+ kfree(mbss_limits);
  20312. - kfree(combo);
  20313. - return -ENOMEM;
  20314. - }
  20315. -@@ -6079,11 +6148,15 @@ static void brcmf_cfg80211_reg_notifier(
  20316. -
  20317. - static void brcmf_free_wiphy(struct wiphy *wiphy)
  20318. - {
  20319. -+ int i;
  20320. -+
  20321. - if (!wiphy)
  20322. - return;
  20323. -
  20324. -- if (wiphy->iface_combinations)
  20325. -- kfree(wiphy->iface_combinations->limits);
  20326. -+ if (wiphy->iface_combinations) {
  20327. -+ for (i = 0; i < wiphy->n_iface_combinations; i++)
  20328. -+ kfree(wiphy->iface_combinations[i].limits);
  20329. -+ }
  20330. - kfree(wiphy->iface_combinations);
  20331. - if (wiphy->bands[IEEE80211_BAND_2GHZ]) {
  20332. - kfree(wiphy->bands[IEEE80211_BAND_2GHZ]->channels);
  20333. diff --git a/package/kernel/mac80211/patches/363-0003-brcmfmac-add-debugfs-entry-for-msgbuf-statistics.patch b/package/kernel/mac80211/patches/363-0003-brcmfmac-add-debugfs-entry-for-msgbuf-statistics.patch
  20334. deleted file mode 100644
  20335. index 9768ef2..0000000
  20336. --- a/package/kernel/mac80211/patches/363-0003-brcmfmac-add-debugfs-entry-for-msgbuf-statistics.patch
  20337. +++ /dev/null
  20338. @@ -1,87 +0,0 @@
  20339. -From: Franky Lin <frankyl@broadcom.com>
  20340. -Date: Thu, 20 Aug 2015 22:06:04 +0200
  20341. -Subject: [PATCH] brcmfmac: add debugfs entry for msgbuf statistics
  20342. -
  20343. -Expose ring buffer read/write pointers and other useful statistics
  20344. -through debugfs.
  20345. -
  20346. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  20347. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20348. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20349. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  20350. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20351. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  20352. ----
  20353. -
  20354. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  20355. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  20356. -@@ -1360,6 +1360,60 @@ void brcmf_msgbuf_delete_flowring(struct
  20357. - }
  20358. - }
  20359. -
  20360. -+#ifdef DEBUG
  20361. -+static int brcmf_msgbuf_stats_read(struct seq_file *seq, void *data)
  20362. -+{
  20363. -+ struct brcmf_bus *bus_if = dev_get_drvdata(seq->private);
  20364. -+ struct brcmf_pub *drvr = bus_if->drvr;
  20365. -+ struct brcmf_msgbuf *msgbuf = (struct brcmf_msgbuf *)drvr->proto->pd;
  20366. -+ struct brcmf_commonring *commonring;
  20367. -+ u16 i;
  20368. -+ struct brcmf_flowring_ring *ring;
  20369. -+ struct brcmf_flowring_hash *hash;
  20370. -+
  20371. -+ commonring = msgbuf->commonrings[BRCMF_H2D_MSGRING_CONTROL_SUBMIT];
  20372. -+ seq_printf(seq, "h2d_ctl_submit: rp %4u, wp %4u, depth %4u\n",
  20373. -+ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  20374. -+ commonring = msgbuf->commonrings[BRCMF_H2D_MSGRING_RXPOST_SUBMIT];
  20375. -+ seq_printf(seq, "h2d_rx_submit: rp %4u, wp %4u, depth %4u\n",
  20376. -+ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  20377. -+ commonring = msgbuf->commonrings[BRCMF_D2H_MSGRING_CONTROL_COMPLETE];
  20378. -+ seq_printf(seq, "d2h_ctl_cmplt: rp %4u, wp %4u, depth %4u\n",
  20379. -+ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  20380. -+ commonring = msgbuf->commonrings[BRCMF_D2H_MSGRING_TX_COMPLETE];
  20381. -+ seq_printf(seq, "d2h_tx_cmplt: rp %4u, wp %4u, depth %4u\n",
  20382. -+ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  20383. -+ commonring = msgbuf->commonrings[BRCMF_D2H_MSGRING_RX_COMPLETE];
  20384. -+ seq_printf(seq, "d2h_rx_cmplt: rp %4u, wp %4u, depth %4u\n",
  20385. -+ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  20386. -+
  20387. -+ seq_printf(seq, "\nh2d_flowrings: depth %u\n",
  20388. -+ BRCMF_H2D_TXFLOWRING_MAX_ITEM);
  20389. -+ seq_puts(seq, "Active flowrings:\n");
  20390. -+ hash = msgbuf->flow->hash;
  20391. -+ for (i = 0; i < msgbuf->flow->nrofrings; i++) {
  20392. -+ if (!msgbuf->flow->rings[i])
  20393. -+ continue;
  20394. -+ ring = msgbuf->flow->rings[i];
  20395. -+ if (ring->status != RING_OPEN)
  20396. -+ continue;
  20397. -+ commonring = msgbuf->flowrings[i];
  20398. -+ hash = &msgbuf->flow->hash[ring->hash_id];
  20399. -+ seq_printf(seq, "id %3u: rp %4u, wp %4u, qlen %4u, blocked %u\n"
  20400. -+ " ifidx %u, fifo %u, da %pM\n",
  20401. -+ i, commonring->r_ptr, commonring->w_ptr,
  20402. -+ skb_queue_len(&ring->skblist), ring->blocked,
  20403. -+ hash->ifidx, hash->fifo, hash->mac);
  20404. -+ }
  20405. -+
  20406. -+ return 0;
  20407. -+}
  20408. -+#else
  20409. -+static int brcmf_msgbuf_stats_read(struct seq_file *seq, void *data)
  20410. -+{
  20411. -+ return 0;
  20412. -+}
  20413. -+#endif
  20414. -
  20415. - int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr)
  20416. - {
  20417. -@@ -1460,6 +1514,8 @@ int brcmf_proto_msgbuf_attach(struct brc
  20418. - spin_lock_init(&msgbuf->flowring_work_lock);
  20419. - INIT_LIST_HEAD(&msgbuf->work_queue);
  20420. -
  20421. -+ brcmf_debugfs_add_entry(drvr, "msgbuf_stats", brcmf_msgbuf_stats_read);
  20422. -+
  20423. - return 0;
  20424. -
  20425. - fail:
  20426. diff --git a/package/kernel/mac80211/patches/363-0004-brcmfmac-make-use-of-cfg80211_check_combinations.patch b/package/kernel/mac80211/patches/363-0004-brcmfmac-make-use-of-cfg80211_check_combinations.patch
  20427. deleted file mode 100644
  20428. index 2b84cf9..0000000
  20429. --- a/package/kernel/mac80211/patches/363-0004-brcmfmac-make-use-of-cfg80211_check_combinations.patch
  20430. +++ /dev/null
  20431. @@ -1,83 +0,0 @@
  20432. -From: Arend van Spriel <arend@broadcom.com>
  20433. -Date: Thu, 20 Aug 2015 22:06:05 +0200
  20434. -Subject: [PATCH] brcmfmac: make use of cfg80211_check_combinations()
  20435. -
  20436. -Use cfg80211_check_combinations() so we can bail out early when an
  20437. -interface add or change results in an invalid combination.
  20438. -
  20439. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20440. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20441. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20442. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20443. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  20444. ----
  20445. -
  20446. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  20447. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  20448. -@@ -469,6 +469,36 @@ brcmf_find_wpsie(const u8 *parse, u32 le
  20449. - return NULL;
  20450. - }
  20451. -
  20452. -+static int brcmf_vif_change_validate(struct brcmf_cfg80211_info *cfg,
  20453. -+ struct brcmf_cfg80211_vif *vif,
  20454. -+ enum nl80211_iftype new_type)
  20455. -+{
  20456. -+ int iftype_num[NUM_NL80211_IFTYPES];
  20457. -+ struct brcmf_cfg80211_vif *pos;
  20458. -+
  20459. -+ memset(&iftype_num[0], 0, sizeof(iftype_num));
  20460. -+ list_for_each_entry(pos, &cfg->vif_list, list)
  20461. -+ if (pos == vif)
  20462. -+ iftype_num[new_type]++;
  20463. -+ else
  20464. -+ iftype_num[pos->wdev.iftype]++;
  20465. -+
  20466. -+ return cfg80211_check_combinations(cfg->wiphy, 1, 0, iftype_num);
  20467. -+}
  20468. -+
  20469. -+static int brcmf_vif_add_validate(struct brcmf_cfg80211_info *cfg,
  20470. -+ enum nl80211_iftype new_type)
  20471. -+{
  20472. -+ int iftype_num[NUM_NL80211_IFTYPES];
  20473. -+ struct brcmf_cfg80211_vif *pos;
  20474. -+
  20475. -+ memset(&iftype_num[0], 0, sizeof(iftype_num));
  20476. -+ list_for_each_entry(pos, &cfg->vif_list, list)
  20477. -+ iftype_num[pos->wdev.iftype]++;
  20478. -+
  20479. -+ iftype_num[new_type]++;
  20480. -+ return cfg80211_check_combinations(cfg->wiphy, 1, 0, iftype_num);
  20481. -+}
  20482. -
  20483. - static void convert_key_from_CPU(struct brcmf_wsec_key *key,
  20484. - struct brcmf_wsec_key_le *key_le)
  20485. -@@ -662,8 +692,14 @@ static struct wireless_dev *brcmf_cfg802
  20486. - struct vif_params *params)
  20487. - {
  20488. - struct wireless_dev *wdev;
  20489. -+ int err;
  20490. -
  20491. - brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
  20492. -+ err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
  20493. -+ if (err) {
  20494. -+ brcmf_err("iface validation failed: err=%d\n", err);
  20495. -+ return ERR_PTR(err);
  20496. -+ }
  20497. - switch (type) {
  20498. - case NL80211_IFTYPE_ADHOC:
  20499. - case NL80211_IFTYPE_STATION:
  20500. -@@ -822,8 +858,12 @@ brcmf_cfg80211_change_iface(struct wiphy
  20501. - s32 ap = 0;
  20502. - s32 err = 0;
  20503. -
  20504. -- brcmf_dbg(TRACE, "Enter, ndev=%p, type=%d\n", ndev, type);
  20505. --
  20506. -+ brcmf_dbg(TRACE, "Enter, idx=%d, type=%d\n", ifp->bssidx, type);
  20507. -+ err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type);
  20508. -+ if (err) {
  20509. -+ brcmf_err("iface validation failed: err=%d\n", err);
  20510. -+ return err;
  20511. -+ }
  20512. - switch (type) {
  20513. - case NL80211_IFTYPE_MONITOR:
  20514. - case NL80211_IFTYPE_WDS:
  20515. diff --git a/package/kernel/mac80211/patches/363-0005-brcmfmac-block-the-correct-flowring-when-backup-queu.patch b/package/kernel/mac80211/patches/363-0005-brcmfmac-block-the-correct-flowring-when-backup-queu.patch
  20516. deleted file mode 100644
  20517. index 2d5f7b9..0000000
  20518. --- a/package/kernel/mac80211/patches/363-0005-brcmfmac-block-the-correct-flowring-when-backup-queu.patch
  20519. +++ /dev/null
  20520. @@ -1,48 +0,0 @@
  20521. -From: Franky Lin <frankyl@broadcom.com>
  20522. -Date: Thu, 20 Aug 2015 22:06:06 +0200
  20523. -Subject: [PATCH] brcmfmac: block the correct flowring when backup queue
  20524. - overflow
  20525. -
  20526. -brcmf_flowring_block blocks the last active flowring under the same
  20527. -interface instead of the one provided by caller. This could lead to a
  20528. -dead lock of netif stop if there are more than one flowring under the
  20529. -interface and the traffic is high enough so brcmf_flowring_enqueue can
  20530. -not unblock the ring right away.
  20531. -
  20532. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20533. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20534. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  20535. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20536. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  20537. ----
  20538. -
  20539. ---- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  20540. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  20541. -@@ -194,11 +194,15 @@ static void brcmf_flowring_block(struct
  20542. - spin_lock_irqsave(&flow->block_lock, flags);
  20543. -
  20544. - ring = flow->rings[flowid];
  20545. -+ if (ring->blocked == blocked) {
  20546. -+ spin_unlock_irqrestore(&flow->block_lock, flags);
  20547. -+ return;
  20548. -+ }
  20549. - ifidx = brcmf_flowring_ifidx_get(flow, flowid);
  20550. -
  20551. - currently_blocked = false;
  20552. - for (i = 0; i < flow->nrofrings; i++) {
  20553. -- if (flow->rings[i]) {
  20554. -+ if ((flow->rings[i]) && (i != flowid)) {
  20555. - ring = flow->rings[i];
  20556. - if ((ring->status == RING_OPEN) &&
  20557. - (brcmf_flowring_ifidx_get(flow, i) == ifidx)) {
  20558. -@@ -209,8 +213,8 @@ static void brcmf_flowring_block(struct
  20559. - }
  20560. - }
  20561. - }
  20562. -- ring->blocked = blocked;
  20563. -- if (currently_blocked == blocked) {
  20564. -+ flow->rings[flowid]->blocked = blocked;
  20565. -+ if (currently_blocked) {
  20566. - spin_unlock_irqrestore(&flow->block_lock, flags);
  20567. - return;
  20568. - }
  20569. diff --git a/package/kernel/mac80211/patches/363-0006-brcmfmac-bump-highest-event-number-for-4339-firmware.patch b/package/kernel/mac80211/patches/363-0006-brcmfmac-bump-highest-event-number-for-4339-firmware.patch
  20570. deleted file mode 100644
  20571. index 7378401..0000000
  20572. --- a/package/kernel/mac80211/patches/363-0006-brcmfmac-bump-highest-event-number-for-4339-firmware.patch
  20573. +++ /dev/null
  20574. @@ -1,52 +0,0 @@
  20575. -From: Arend van Spriel <arend@broadcom.com>
  20576. -Date: Thu, 20 Aug 2015 22:06:07 +0200
  20577. -Subject: [PATCH] brcmfmac: bump highest event number for 4339 firmware
  20578. -
  20579. -The event mask length is determined by the highest event number
  20580. -that is specified in the driver. When this length is shorter than
  20581. -firmware expects setting event mask will fail and device becomes
  20582. -pretty useless. This issue was reported with bcm4339 firmware that
  20583. -was recently released.
  20584. -
  20585. -Reported-by: Pontus Fuchs <pontusf@broadcom.com>
  20586. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20587. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20588. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20589. -Reviewed-by: Pontus Fuchs <pontusf@broadcom.com>
  20590. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20591. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  20592. ----
  20593. -
  20594. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  20595. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  20596. -@@ -85,7 +85,6 @@ struct brcmf_event;
  20597. - BRCMF_ENUM_DEF(IF, 54) \
  20598. - BRCMF_ENUM_DEF(P2P_DISC_LISTEN_COMPLETE, 55) \
  20599. - BRCMF_ENUM_DEF(RSSI, 56) \
  20600. -- BRCMF_ENUM_DEF(PFN_SCAN_COMPLETE, 57) \
  20601. - BRCMF_ENUM_DEF(EXTLOG_MSG, 58) \
  20602. - BRCMF_ENUM_DEF(ACTION_FRAME, 59) \
  20603. - BRCMF_ENUM_DEF(ACTION_FRAME_COMPLETE, 60) \
  20604. -@@ -103,8 +102,7 @@ struct brcmf_event;
  20605. - BRCMF_ENUM_DEF(FIFO_CREDIT_MAP, 74) \
  20606. - BRCMF_ENUM_DEF(ACTION_FRAME_RX, 75) \
  20607. - BRCMF_ENUM_DEF(TDLS_PEER_EVENT, 92) \
  20608. -- BRCMF_ENUM_DEF(BCMC_CREDIT_SUPPORT, 127) \
  20609. -- BRCMF_ENUM_DEF(PSTA_PRIMARY_INTF_IND, 128)
  20610. -+ BRCMF_ENUM_DEF(BCMC_CREDIT_SUPPORT, 127)
  20611. -
  20612. - #define BRCMF_ENUM_DEF(id, val) \
  20613. - BRCMF_E_##id = (val),
  20614. -@@ -112,7 +110,11 @@ struct brcmf_event;
  20615. - /* firmware event codes sent by the dongle */
  20616. - enum brcmf_fweh_event_code {
  20617. - BRCMF_FWEH_EVENT_ENUM_DEFLIST
  20618. -- BRCMF_E_LAST
  20619. -+ /* this determines event mask length which must match
  20620. -+ * minimum length check in device firmware so it is
  20621. -+ * hard-coded here.
  20622. -+ */
  20623. -+ BRCMF_E_LAST = 139
  20624. - };
  20625. - #undef BRCMF_ENUM_DEF
  20626. -
  20627. diff --git a/package/kernel/mac80211/patches/365-0001-brcmfmac-consolidate-ifp-lookup-in-driver-core.patch b/package/kernel/mac80211/patches/365-0001-brcmfmac-consolidate-ifp-lookup-in-driver-core.patch
  20628. deleted file mode 100644
  20629. index 97444b3..0000000
  20630. --- a/package/kernel/mac80211/patches/365-0001-brcmfmac-consolidate-ifp-lookup-in-driver-core.patch
  20631. +++ /dev/null
  20632. @@ -1,138 +0,0 @@
  20633. -From: Arend van Spriel <arend@broadcom.com>
  20634. -Date: Wed, 26 Aug 2015 22:14:53 +0200
  20635. -Subject: [PATCH] brcmfmac: consolidate ifp lookup in driver core
  20636. -
  20637. -In rx path the firmware provide an interface index which is used to
  20638. -map to a struct brcmf_if instance. However, this involves some trick
  20639. -that is done in two places. This is changed by having driver core
  20640. -providing brcmf_get_ifp() function.
  20641. -
  20642. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20643. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20644. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20645. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20646. ----
  20647. -
  20648. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  20649. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  20650. -@@ -276,6 +276,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  20651. - struct sk_buff *pktbuf)
  20652. - {
  20653. - struct brcmf_proto_bcdc_header *h;
  20654. -+ struct brcmf_if *ifp;
  20655. -
  20656. - brcmf_dbg(BCDC, "Enter\n");
  20657. -
  20658. -@@ -289,30 +290,21 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  20659. - trace_brcmf_bcdchdr(pktbuf->data);
  20660. - h = (struct brcmf_proto_bcdc_header *)(pktbuf->data);
  20661. -
  20662. -- *ifidx = BCDC_GET_IF_IDX(h);
  20663. -- if (*ifidx >= BRCMF_MAX_IFS) {
  20664. -- brcmf_err("rx data ifnum out of range (%d)\n", *ifidx);
  20665. -+ ifp = brcmf_get_ifp(drvr, BCDC_GET_IF_IDX(h));
  20666. -+ if (IS_ERR_OR_NULL(ifp)) {
  20667. -+ brcmf_dbg(INFO, "no matching ifp found\n");
  20668. - return -EBADE;
  20669. - }
  20670. -- /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  20671. -- * events this is easy because it contains the bssidx which maps
  20672. -- * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  20673. -- * bssidx 1 is used for p2p0 and no data can be received or
  20674. -- * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  20675. -- */
  20676. -- if (*ifidx)
  20677. -- (*ifidx)++;
  20678. --
  20679. - if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) !=
  20680. - BCDC_PROTO_VER) {
  20681. - brcmf_err("%s: non-BCDC packet received, flags 0x%x\n",
  20682. -- brcmf_ifname(drvr, *ifidx), h->flags);
  20683. -+ brcmf_ifname(drvr, ifp->ifidx), h->flags);
  20684. - return -EBADE;
  20685. - }
  20686. -
  20687. - if (h->flags & BCDC_FLAG_SUM_GOOD) {
  20688. - brcmf_dbg(BCDC, "%s: BDC rcv, good checksum, flags 0x%x\n",
  20689. -- brcmf_ifname(drvr, *ifidx), h->flags);
  20690. -+ brcmf_ifname(drvr, ifp->ifidx), h->flags);
  20691. - pktbuf->ip_summed = CHECKSUM_UNNECESSARY;
  20692. - }
  20693. -
  20694. -@@ -320,12 +312,15 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  20695. -
  20696. - skb_pull(pktbuf, BCDC_HEADER_LEN);
  20697. - if (do_fws)
  20698. -- brcmf_fws_hdrpull(drvr, *ifidx, h->data_offset << 2, pktbuf);
  20699. -+ brcmf_fws_hdrpull(drvr, ifp->ifidx, h->data_offset << 2,
  20700. -+ pktbuf);
  20701. - else
  20702. - skb_pull(pktbuf, h->data_offset << 2);
  20703. -
  20704. - if (pktbuf->len == 0)
  20705. - return -ENODATA;
  20706. -+
  20707. -+ *ifidx = ifp->ifidx;
  20708. - return 0;
  20709. - }
  20710. -
  20711. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20712. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20713. -@@ -83,6 +83,25 @@ char *brcmf_ifname(struct brcmf_pub *drv
  20714. - return "<if_none>";
  20715. - }
  20716. -
  20717. -+struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx)
  20718. -+{
  20719. -+ if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  20720. -+ brcmf_err("ifidx %d out of range\n", ifidx);
  20721. -+ return ERR_PTR(-ERANGE);
  20722. -+ }
  20723. -+
  20724. -+ /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  20725. -+ * events this is easy because it contains the bssidx which maps
  20726. -+ * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  20727. -+ * bssidx 1 is used for p2p0 and no data can be received or
  20728. -+ * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  20729. -+ */
  20730. -+ if (ifidx)
  20731. -+ ifidx++;
  20732. -+
  20733. -+ return drvr->iflist[ifidx];
  20734. -+}
  20735. -+
  20736. - static void _brcmf_set_multicast_list(struct work_struct *work)
  20737. - {
  20738. - struct brcmf_if *ifp;
  20739. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20740. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20741. -@@ -202,7 +202,7 @@ int brcmf_netdev_wait_pend8021x(struct b
  20742. -
  20743. - /* Return pointer to interface name */
  20744. - char *brcmf_ifname(struct brcmf_pub *drvr, int idx);
  20745. --
  20746. -+struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  20747. - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  20748. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  20749. - char *name, u8 *mac_addr);
  20750. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  20751. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  20752. -@@ -1081,16 +1081,8 @@ brcmf_msgbuf_rx_skb(struct brcmf_msgbuf
  20753. - {
  20754. - struct brcmf_if *ifp;
  20755. -
  20756. -- /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  20757. -- * events this is easy because it contains the bssidx which maps
  20758. -- * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  20759. -- * bssidx 1 is used for p2p0 and no data can be received or
  20760. -- * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  20761. -- */
  20762. -- if (ifidx)
  20763. -- (ifidx)++;
  20764. -- ifp = msgbuf->drvr->iflist[ifidx];
  20765. -- if (!ifp || !ifp->ndev) {
  20766. -+ ifp = brcmf_get_ifp(msgbuf->drvr, ifidx);
  20767. -+ if (IS_ERR_OR_NULL(ifp) || !ifp->ndev) {
  20768. - brcmf_err("Received pkt for invalid ifidx %d\n", ifidx);
  20769. - brcmu_pkt_buf_free_skb(skb);
  20770. - return;
  20771. diff --git a/package/kernel/mac80211/patches/365-0002-brcmfmac-make-brcmf_proto_hdrpull-return-struct-brcm.patch b/package/kernel/mac80211/patches/365-0002-brcmfmac-make-brcmf_proto_hdrpull-return-struct-brcm.patch
  20772. deleted file mode 100644
  20773. index 632714c..0000000
  20774. --- a/package/kernel/mac80211/patches/365-0002-brcmfmac-make-brcmf_proto_hdrpull-return-struct-brcm.patch
  20775. +++ /dev/null
  20776. @@ -1,222 +0,0 @@
  20777. -From: Arend van Spriel <arend@broadcom.com>
  20778. -Date: Wed, 26 Aug 2015 22:14:54 +0200
  20779. -Subject: [PATCH] brcmfmac: make brcmf_proto_hdrpull() return struct
  20780. - brcmf_if instance
  20781. -
  20782. -Avoid spreading the ifidx in the driver, but have it return the
  20783. -struct brcmf_if instance.
  20784. -
  20785. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20786. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20787. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20788. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20789. ----
  20790. -
  20791. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  20792. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  20793. -@@ -272,11 +272,11 @@ brcmf_proto_bcdc_hdrpush(struct brcmf_pu
  20794. - }
  20795. -
  20796. - static int
  20797. --brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool do_fws, u8 *ifidx,
  20798. -- struct sk_buff *pktbuf)
  20799. -+brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool do_fws,
  20800. -+ struct sk_buff *pktbuf, struct brcmf_if **ifp)
  20801. - {
  20802. - struct brcmf_proto_bcdc_header *h;
  20803. -- struct brcmf_if *ifp;
  20804. -+ struct brcmf_if *tmp_if;
  20805. -
  20806. - brcmf_dbg(BCDC, "Enter\n");
  20807. -
  20808. -@@ -290,21 +290,21 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  20809. - trace_brcmf_bcdchdr(pktbuf->data);
  20810. - h = (struct brcmf_proto_bcdc_header *)(pktbuf->data);
  20811. -
  20812. -- ifp = brcmf_get_ifp(drvr, BCDC_GET_IF_IDX(h));
  20813. -- if (IS_ERR_OR_NULL(ifp)) {
  20814. -+ tmp_if = brcmf_get_ifp(drvr, BCDC_GET_IF_IDX(h));
  20815. -+ if (!tmp_if) {
  20816. - brcmf_dbg(INFO, "no matching ifp found\n");
  20817. - return -EBADE;
  20818. - }
  20819. - if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) !=
  20820. - BCDC_PROTO_VER) {
  20821. - brcmf_err("%s: non-BCDC packet received, flags 0x%x\n",
  20822. -- brcmf_ifname(drvr, ifp->ifidx), h->flags);
  20823. -+ brcmf_ifname(drvr, tmp_if->ifidx), h->flags);
  20824. - return -EBADE;
  20825. - }
  20826. -
  20827. - if (h->flags & BCDC_FLAG_SUM_GOOD) {
  20828. - brcmf_dbg(BCDC, "%s: BDC rcv, good checksum, flags 0x%x\n",
  20829. -- brcmf_ifname(drvr, ifp->ifidx), h->flags);
  20830. -+ brcmf_ifname(drvr, tmp_if->ifidx), h->flags);
  20831. - pktbuf->ip_summed = CHECKSUM_UNNECESSARY;
  20832. - }
  20833. -
  20834. -@@ -312,7 +312,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  20835. -
  20836. - skb_pull(pktbuf, BCDC_HEADER_LEN);
  20837. - if (do_fws)
  20838. -- brcmf_fws_hdrpull(drvr, ifp->ifidx, h->data_offset << 2,
  20839. -+ brcmf_fws_hdrpull(drvr, tmp_if->ifidx, h->data_offset << 2,
  20840. - pktbuf);
  20841. - else
  20842. - skb_pull(pktbuf, h->data_offset << 2);
  20843. -@@ -320,7 +320,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  20844. - if (pktbuf->len == 0)
  20845. - return -ENODATA;
  20846. -
  20847. -- *ifidx = ifp->ifidx;
  20848. -+ *ifp = tmp_if;
  20849. - return 0;
  20850. - }
  20851. -
  20852. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20853. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20854. -@@ -87,7 +87,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
  20855. - {
  20856. - if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  20857. - brcmf_err("ifidx %d out of range\n", ifidx);
  20858. -- return ERR_PTR(-ERANGE);
  20859. -+ return NULL;
  20860. - }
  20861. -
  20862. - /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  20863. -@@ -539,17 +539,15 @@ void brcmf_rx_frame(struct device *dev,
  20864. - struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  20865. - struct brcmf_pub *drvr = bus_if->drvr;
  20866. - struct brcmf_skb_reorder_data *rd;
  20867. -- u8 ifidx;
  20868. - int ret;
  20869. -
  20870. - brcmf_dbg(DATA, "Enter: %s: rxp=%p\n", dev_name(dev), skb);
  20871. -
  20872. - /* process and remove protocol-specific header */
  20873. -- ret = brcmf_proto_hdrpull(drvr, true, &ifidx, skb);
  20874. -- ifp = drvr->iflist[ifidx];
  20875. -+ ret = brcmf_proto_hdrpull(drvr, true, skb, &ifp);
  20876. -
  20877. - if (ret || !ifp || !ifp->ndev) {
  20878. -- if ((ret != -ENODATA) && ifp)
  20879. -+ if (ret != -ENODATA && ifp)
  20880. - ifp->stats.rx_errors++;
  20881. - brcmu_pkt_buf_free_skb(skb);
  20882. - return;
  20883. -@@ -592,17 +590,17 @@ void brcmf_txcomplete(struct device *dev
  20884. - {
  20885. - struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  20886. - struct brcmf_pub *drvr = bus_if->drvr;
  20887. -- u8 ifidx;
  20888. -+ struct brcmf_if *ifp;
  20889. -
  20890. - /* await txstatus signal for firmware if active */
  20891. - if (brcmf_fws_fc_active(drvr->fws)) {
  20892. - if (!success)
  20893. - brcmf_fws_bustxfail(drvr->fws, txp);
  20894. - } else {
  20895. -- if (brcmf_proto_hdrpull(drvr, false, &ifidx, txp))
  20896. -+ if (brcmf_proto_hdrpull(drvr, false, txp, &ifp))
  20897. - brcmu_pkt_buf_free_skb(txp);
  20898. - else
  20899. -- brcmf_txfinalize(drvr, txp, ifidx, success);
  20900. -+ brcmf_txfinalize(drvr, txp, ifp->ifidx, success);
  20901. - }
  20902. - }
  20903. -
  20904. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  20905. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  20906. -@@ -1448,7 +1448,7 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  20907. - struct sk_buff *skb;
  20908. - struct brcmf_skbuff_cb *skcb;
  20909. - struct brcmf_fws_mac_descriptor *entry = NULL;
  20910. -- u8 ifidx;
  20911. -+ struct brcmf_if *ifp;
  20912. -
  20913. - brcmf_dbg(DATA, "flags %d\n", flags);
  20914. -
  20915. -@@ -1497,15 +1497,16 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  20916. - }
  20917. - brcmf_fws_macdesc_return_req_credit(skb);
  20918. -
  20919. -- if (brcmf_proto_hdrpull(fws->drvr, false, &ifidx, skb)) {
  20920. -+ ret = brcmf_proto_hdrpull(fws->drvr, false, skb, &ifp);
  20921. -+ if (ret) {
  20922. - brcmu_pkt_buf_free_skb(skb);
  20923. - return -EINVAL;
  20924. - }
  20925. - if (!remove_from_hanger)
  20926. -- ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifidx,
  20927. -+ ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
  20928. - genbit, seq);
  20929. - if (remove_from_hanger || ret)
  20930. -- brcmf_txfinalize(fws->drvr, skb, ifidx, true);
  20931. -+ brcmf_txfinalize(fws->drvr, skb, ifp->ifidx, true);
  20932. -
  20933. - return 0;
  20934. - }
  20935. -@@ -1848,7 +1849,7 @@ static int brcmf_fws_commit_skb(struct b
  20936. - entry->transit_count--;
  20937. - if (entry->suppressed)
  20938. - entry->suppr_transit_count--;
  20939. -- brcmf_proto_hdrpull(fws->drvr, false, &ifidx, skb);
  20940. -+ (void)brcmf_proto_hdrpull(fws->drvr, false, skb, NULL);
  20941. - goto rollback;
  20942. - }
  20943. -
  20944. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  20945. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  20946. -@@ -522,7 +522,7 @@ static int brcmf_msgbuf_set_dcmd(struct
  20947. -
  20948. -
  20949. - static int brcmf_msgbuf_hdrpull(struct brcmf_pub *drvr, bool do_fws,
  20950. -- u8 *ifidx, struct sk_buff *skb)
  20951. -+ struct sk_buff *skb, struct brcmf_if **ifp)
  20952. - {
  20953. - return -ENODEV;
  20954. - }
  20955. -@@ -1082,7 +1082,7 @@ brcmf_msgbuf_rx_skb(struct brcmf_msgbuf
  20956. - struct brcmf_if *ifp;
  20957. -
  20958. - ifp = brcmf_get_ifp(msgbuf->drvr, ifidx);
  20959. -- if (IS_ERR_OR_NULL(ifp) || !ifp->ndev) {
  20960. -+ if (!ifp || !ifp->ndev) {
  20961. - brcmf_err("Received pkt for invalid ifidx %d\n", ifidx);
  20962. - brcmu_pkt_buf_free_skb(skb);
  20963. - return;
  20964. ---- a/drivers/net/wireless/brcm80211/brcmfmac/proto.h
  20965. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/proto.h
  20966. -@@ -24,8 +24,8 @@ enum proto_addr_mode {
  20967. -
  20968. -
  20969. - struct brcmf_proto {
  20970. -- int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws, u8 *ifidx,
  20971. -- struct sk_buff *skb);
  20972. -+ int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws,
  20973. -+ struct sk_buff *skb, struct brcmf_if **ifp);
  20974. - int (*query_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd,
  20975. - void *buf, uint len);
  20976. - int (*set_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd, void *buf,
  20977. -@@ -46,9 +46,19 @@ int brcmf_proto_attach(struct brcmf_pub
  20978. - void brcmf_proto_detach(struct brcmf_pub *drvr);
  20979. -
  20980. - static inline int brcmf_proto_hdrpull(struct brcmf_pub *drvr, bool do_fws,
  20981. -- u8 *ifidx, struct sk_buff *skb)
  20982. -+ struct sk_buff *skb,
  20983. -+ struct brcmf_if **ifp)
  20984. - {
  20985. -- return drvr->proto->hdrpull(drvr, do_fws, ifidx, skb);
  20986. -+ struct brcmf_if *tmp = NULL;
  20987. -+
  20988. -+ /* assure protocol is always called with
  20989. -+ * non-null initialized pointer.
  20990. -+ */
  20991. -+ if (ifp)
  20992. -+ *ifp = NULL;
  20993. -+ else
  20994. -+ ifp = &tmp;
  20995. -+ return drvr->proto->hdrpull(drvr, do_fws, skb, ifp);
  20996. - }
  20997. - static inline int brcmf_proto_query_dcmd(struct brcmf_pub *drvr, int ifidx,
  20998. - uint cmd, void *buf, uint len)
  20999. diff --git a/package/kernel/mac80211/patches/365-0003-brcmfmac-change-parameters-for-brcmf_remove_interfac.patch b/package/kernel/mac80211/patches/365-0003-brcmfmac-change-parameters-for-brcmf_remove_interfac.patch
  21000. deleted file mode 100644
  21001. index 2d15a77..0000000
  21002. --- a/package/kernel/mac80211/patches/365-0003-brcmfmac-change-parameters-for-brcmf_remove_interfac.patch
  21003. +++ /dev/null
  21004. @@ -1,87 +0,0 @@
  21005. -From: Arend van Spriel <arend@broadcom.com>
  21006. -Date: Wed, 26 Aug 2015 22:14:55 +0200
  21007. -Subject: [PATCH] brcmfmac: change parameters for
  21008. - brcmf_remove_interface()
  21009. -
  21010. -Just pass the interface to be removed, ie. the struct brcmf_if instance.
  21011. -
  21012. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  21013. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  21014. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  21015. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  21016. ----
  21017. -
  21018. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  21019. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  21020. -@@ -4982,7 +4982,7 @@ brcmf_notify_connect_status_ap(struct br
  21021. - brcmf_dbg(CONN, "AP mode link down\n");
  21022. - complete(&cfg->vif_disabled);
  21023. - if (ifp->vif->mbss)
  21024. -- brcmf_remove_interface(ifp->drvr, ifp->bssidx);
  21025. -+ brcmf_remove_interface(ifp);
  21026. - return 0;
  21027. - }
  21028. -
  21029. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  21030. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  21031. -@@ -887,12 +887,13 @@ static void brcmf_del_if(struct brcmf_pu
  21032. - }
  21033. - }
  21034. -
  21035. --void brcmf_remove_interface(struct brcmf_pub *drvr, u32 bssidx)
  21036. -+void brcmf_remove_interface(struct brcmf_if *ifp)
  21037. - {
  21038. -- if (drvr->iflist[bssidx]) {
  21039. -- brcmf_fws_del_interface(drvr->iflist[bssidx]);
  21040. -- brcmf_del_if(drvr, bssidx);
  21041. -- }
  21042. -+ if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bssidx] != ifp))
  21043. -+ return;
  21044. -+
  21045. -+ brcmf_fws_del_interface(ifp);
  21046. -+ brcmf_del_if(ifp->drvr, ifp->bssidx);
  21047. - }
  21048. -
  21049. - int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr)
  21050. -@@ -1122,7 +1123,7 @@ void brcmf_detach(struct device *dev)
  21051. -
  21052. - /* make sure primary interface removed last */
  21053. - for (i = BRCMF_MAX_IFS-1; i > -1; i--)
  21054. -- brcmf_remove_interface(drvr, i);
  21055. -+ brcmf_remove_interface(drvr->iflist[i]);
  21056. -
  21057. - brcmf_cfg80211_detach(drvr->config);
  21058. -
  21059. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  21060. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  21061. -@@ -206,7 +206,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
  21062. - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  21063. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  21064. - char *name, u8 *mac_addr);
  21065. --void brcmf_remove_interface(struct brcmf_pub *drvr, u32 bssidx);
  21066. -+void brcmf_remove_interface(struct brcmf_if *ifp);
  21067. - int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  21068. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  21069. - enum brcmf_netif_stop_reason reason, bool state);
  21070. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  21071. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  21072. -@@ -222,7 +222,7 @@ static void brcmf_fweh_handle_if_event(s
  21073. - err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
  21074. -
  21075. - if (ifp && ifevent->action == BRCMF_E_IF_DEL)
  21076. -- brcmf_remove_interface(drvr, ifevent->bssidx);
  21077. -+ brcmf_remove_interface(ifp);
  21078. - }
  21079. -
  21080. - /**
  21081. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  21082. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  21083. -@@ -2140,7 +2140,7 @@ static void brcmf_p2p_delete_p2pdev(stru
  21084. - {
  21085. - cfg80211_unregister_wdev(&vif->wdev);
  21086. - p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  21087. -- brcmf_remove_interface(vif->ifp->drvr, vif->ifp->bssidx);
  21088. -+ brcmf_remove_interface(vif->ifp);
  21089. - brcmf_free_vif(vif);
  21090. - }
  21091. -
  21092. diff --git a/package/kernel/mac80211/patches/365-0004-brcmfmac-only-call-brcmf_cfg80211_detach-when-attach.patch b/package/kernel/mac80211/patches/365-0004-brcmfmac-only-call-brcmf_cfg80211_detach-when-attach.patch
  21093. deleted file mode 100644
  21094. index 2b61f4e..0000000
  21095. --- a/package/kernel/mac80211/patches/365-0004-brcmfmac-only-call-brcmf_cfg80211_detach-when-attach.patch
  21096. +++ /dev/null
  21097. @@ -1,92 +0,0 @@
  21098. -From: Arend van Spriel <arend@broadcom.com>
  21099. -Date: Wed, 26 Aug 2015 22:14:56 +0200
  21100. -Subject: [PATCH] brcmfmac: only call brcmf_cfg80211_detach() when attach
  21101. - was successful
  21102. -
  21103. -In brcmf_bus_start() the function brcmf_cfg80211_attach() is called which
  21104. -may fail. If this happens we should not call brcmf_cfg80211_detach() in
  21105. -the failure path as it will result in NULL pointer dereference:
  21106. -
  21107. - brcmf_fweh_activate_events: Set event_msgs error (-5)
  21108. - brcmf_bus_start: failed: -5
  21109. - brcmf_sdio_firmware_callback: dongle is not responding
  21110. - BUG: unable to handle kernel NULL pointer dereference at 0000000000000068
  21111. - IP: [<ffffffff811e8f08>] kernfs_find_ns+0x18/0xd0
  21112. - PGD 0
  21113. - Oops: 0000 [#1] SMP
  21114. - Modules linked in: brcmfmac(O) brcmutil(O) cfg80211 auth_rpcgss
  21115. - CPU: 1 PID: 45 Comm: kworker/1:1 Tainted: G O
  21116. - Hardware name: Dell Inc. Latitude E6410/07XJP9, BIOS A07 02/15/2011
  21117. - Workqueue: events request_firmware_work_func
  21118. - task: ffff880036c09ac0 ti: ffff880036dd4000 task.ti: ffff880036dd4000
  21119. - RIP: 0010:[<ffffffff811e8f08>] [<ffffffff811e8f08>] kernfs_find_ns+0x18/0xd0
  21120. - RSP: 0018:ffff880036dd7a28 EFLAGS: 00010246
  21121. - RAX: ffff880036c09ac0 RBX: 0000000000000000 RCX: 000000007fffffff
  21122. - RDX: 0000000000000000 RSI: ffffffff816578b9 RDI: 0000000000000000
  21123. - RBP: ffff880036dd7a48 R08: 0000000000000000 R09: ffff880036c0b340
  21124. - R10: 00000000000002ec R11: ffff880036dd7b08 R12: ffffffff816578b9
  21125. - R13: 0000000000000000 R14: ffffffff816578b9 R15: ffff8800c6c87000
  21126. - FS: 0000000000000000(0000) GS:ffff88012bc40000(0000) knlGS:0000000000000000
  21127. - CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
  21128. - CR2: 0000000000000068 CR3: 0000000001a0b000 CR4: 00000000000006e0
  21129. - Stack:
  21130. - 0000000000000000 ffffffff816578b9 0000000000000000 ffff8800c0d003c8
  21131. - ffff880036dd7a78 ffffffff811e8ff5 0000000ffffffff1 ffffffff81a9b060
  21132. - ffff8800c789f880 ffff8800c0d00000 ffff880036dd7a98 ffffffff811ebe0d
  21133. - Call Trace:
  21134. - [<ffffffff811e8ff5>] kernfs_find_and_get_ns+0x35/0x60
  21135. - [<ffffffff811ebe0d>] sysfs_unmerge_group+0x1d/0x60
  21136. - [<ffffffff81404ef2>] dpm_sysfs_remove+0x22/0x60
  21137. - [<ffffffff813f9db9>] device_del+0x49/0x240
  21138. - [<ffffffff815da768>] rfkill_unregister+0x58/0xc0
  21139. - [<ffffffffa06bd91b>] wiphy_unregister+0xab/0x2f0 [cfg80211]
  21140. - [<ffffffffa0742fe3>] brcmf_cfg80211_detach+0x23/0x50 [brcmfmac]
  21141. - [<ffffffffa074d986>] brcmf_detach+0x86/0xe0 [brcmfmac]
  21142. - [<ffffffffa0757de8>] brcmf_sdio_remove+0x48/0x120 [brcmfmac]
  21143. - [<ffffffffa0758ed9>] brcmf_sdiod_remove+0x29/0xd0 [brcmfmac]
  21144. - [<ffffffffa0759031>] brcmf_ops_sdio_remove+0xb1/0x110 [brcmfmac]
  21145. - [<ffffffffa001c267>] sdio_bus_remove+0x37/0x100 [mmc_core]
  21146. - [<ffffffff813fe026>] __device_release_driver+0x96/0x130
  21147. - [<ffffffff813fe0e3>] device_release_driver+0x23/0x30
  21148. - [<ffffffffa0754bc8>] brcmf_sdio_firmware_callback+0x2a8/0x5d0 [brcmfmac]
  21149. - [<ffffffffa074deaf>] brcmf_fw_request_nvram_done+0x15f/0x5e0 [brcmfmac]
  21150. - [<ffffffff8140142f>] ? devres_add+0x3f/0x50
  21151. - [<ffffffff810642b5>] ? usermodehelper_read_unlock+0x15/0x20
  21152. - [<ffffffff81400000>] ? platform_match+0x70/0xa0
  21153. - [<ffffffff8140f400>] request_firmware_work_func+0x30/0x60
  21154. - [<ffffffff8106828c>] process_one_work+0x14c/0x3d0
  21155. - [<ffffffff8106862a>] worker_thread+0x11a/0x450
  21156. - [<ffffffff81068510>] ? process_one_work+0x3d0/0x3d0
  21157. - [<ffffffff8106d692>] kthread+0xd2/0xf0
  21158. - [<ffffffff8106d5c0>] ? kthread_create_on_node+0x180/0x180
  21159. - [<ffffffff815ed35f>] ret_from_fork+0x3f/0x70
  21160. - [<ffffffff8106d5c0>] ? kthread_create_on_node+0x180/0x180
  21161. - Code: e9 40 fe ff ff 48 89 d8 eb 87 66 0f 1f 84 00 00 00 00 00 66 66 66 66
  21162. - 90 55 48 89 e5 41 56 49 89 f6 41 55 49 89 d5 31 d2 41 54 53 <0f> b7
  21163. - 47 68 48 8b 5f 48 66 c1 e8 05 83 e0 01 4d 85 ed 0f b6 c8
  21164. - RIP [<ffffffff811e8f08>] kernfs_find_ns+0x18/0xd0
  21165. - RSP <ffff880036dd7a28>
  21166. - CR2: 0000000000000068
  21167. - ---[ end trace 87d6ec0d3fe46740 ]---
  21168. -
  21169. -Reported-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  21170. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  21171. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  21172. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  21173. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  21174. ----
  21175. -
  21176. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  21177. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  21178. -@@ -1049,7 +1049,10 @@ int brcmf_bus_start(struct device *dev)
  21179. - fail:
  21180. - if (ret < 0) {
  21181. - brcmf_err("failed: %d\n", ret);
  21182. -- brcmf_cfg80211_detach(drvr->config);
  21183. -+ if (drvr->config) {
  21184. -+ brcmf_cfg80211_detach(drvr->config);
  21185. -+ drvr->config = NULL;
  21186. -+ }
  21187. - if (drvr->fws) {
  21188. - brcmf_fws_del_interface(ifp);
  21189. - brcmf_fws_deinit(drvr);
  21190. diff --git a/package/kernel/mac80211/patches/365-0005-brcmfmac-correct-detection-of-p2pdev-interface-event.patch b/package/kernel/mac80211/patches/365-0005-brcmfmac-correct-detection-of-p2pdev-interface-event.patch
  21191. deleted file mode 100644
  21192. index 868b0a8..0000000
  21193. --- a/package/kernel/mac80211/patches/365-0005-brcmfmac-correct-detection-of-p2pdev-interface-event.patch
  21194. +++ /dev/null
  21195. @@ -1,105 +0,0 @@
  21196. -From: Arend van Spriel <arend@broadcom.com>
  21197. -Date: Wed, 26 Aug 2015 22:14:57 +0200
  21198. -Subject: [PATCH] brcmfmac: correct detection of p2pdev interface event
  21199. -
  21200. -The p2pdev interface is setup in firmware resulting in a interface
  21201. -event. This event has role and no-if flag. When role is p2p client
  21202. -and no-if flag is set it indicates that this is the p2pdev interface.
  21203. -This info is used in handling the event and adding interface in the
  21204. -driver.
  21205. -
  21206. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  21207. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  21208. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  21209. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  21210. ----
  21211. -
  21212. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  21213. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  21214. -@@ -795,7 +795,7 @@ fail:
  21215. - }
  21216. -
  21217. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  21218. -- char *name, u8 *mac_addr)
  21219. -+ bool is_p2pdev, char *name, u8 *mac_addr)
  21220. - {
  21221. - struct brcmf_if *ifp;
  21222. - struct net_device *ndev;
  21223. -@@ -821,7 +821,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  21224. - }
  21225. - }
  21226. -
  21227. -- if (!brcmf_p2p_enable && bssidx == 1) {
  21228. -+ if (!brcmf_p2p_enable && is_p2pdev) {
  21229. - /* this is P2P_DEVICE interface */
  21230. - brcmf_dbg(INFO, "allocate non-netdev interface\n");
  21231. - ifp = kzalloc(sizeof(*ifp), GFP_KERNEL);
  21232. -@@ -999,12 +999,12 @@ int brcmf_bus_start(struct device *dev)
  21233. - brcmf_dbg(TRACE, "\n");
  21234. -
  21235. - /* add primary networking interface */
  21236. -- ifp = brcmf_add_if(drvr, 0, 0, "wlan%d", NULL);
  21237. -+ ifp = brcmf_add_if(drvr, 0, 0, false, "wlan%d", NULL);
  21238. - if (IS_ERR(ifp))
  21239. - return PTR_ERR(ifp);
  21240. -
  21241. - if (brcmf_p2p_enable)
  21242. -- p2p_ifp = brcmf_add_if(drvr, 1, 0, "p2p%d", NULL);
  21243. -+ p2p_ifp = brcmf_add_if(drvr, 1, 0, false, "p2p%d", NULL);
  21244. - else
  21245. - p2p_ifp = NULL;
  21246. - if (IS_ERR(p2p_ifp))
  21247. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  21248. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  21249. -@@ -205,7 +205,7 @@ char *brcmf_ifname(struct brcmf_pub *drv
  21250. - struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  21251. - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  21252. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  21253. -- char *name, u8 *mac_addr);
  21254. -+ bool is_p2pdev, char *name, u8 *mac_addr);
  21255. - void brcmf_remove_interface(struct brcmf_if *ifp);
  21256. - int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  21257. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  21258. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  21259. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  21260. -@@ -179,6 +179,7 @@ static void brcmf_fweh_handle_if_event(s
  21261. - {
  21262. - struct brcmf_if_event *ifevent = data;
  21263. - struct brcmf_if *ifp;
  21264. -+ bool is_p2pdev;
  21265. - int err = 0;
  21266. -
  21267. - brcmf_dbg(EVENT, "action: %u idx: %u bsscfg: %u flags: %u role: %u\n",
  21268. -@@ -186,18 +187,16 @@ static void brcmf_fweh_handle_if_event(s
  21269. - ifevent->flags, ifevent->role);
  21270. -
  21271. - /* The P2P Device interface event must not be ignored
  21272. -- * contrary to what firmware tells us. The only way to
  21273. -- * distinguish the P2P Device is by looking at the ifidx
  21274. -- * and bssidx received.
  21275. -+ * contrary to what firmware tells us.
  21276. - */
  21277. -- if (!(ifevent->ifidx == 0 && ifevent->bssidx == 1) &&
  21278. -- (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) {
  21279. -+ is_p2pdev = (ifevent->flags & BRCMF_E_IF_FLAG_NOIF) &&
  21280. -+ ifevent->role == BRCMF_E_IF_ROLE_P2P_CLIENT;
  21281. -+ if (!is_p2pdev && (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) {
  21282. - brcmf_dbg(EVENT, "event can be ignored\n");
  21283. - return;
  21284. - }
  21285. - if (ifevent->ifidx >= BRCMF_MAX_IFS) {
  21286. -- brcmf_err("invalid interface index: %u\n",
  21287. -- ifevent->ifidx);
  21288. -+ brcmf_err("invalid interface index: %u\n", ifevent->ifidx);
  21289. - return;
  21290. - }
  21291. -
  21292. -@@ -207,7 +206,7 @@ static void brcmf_fweh_handle_if_event(s
  21293. - brcmf_dbg(EVENT, "adding %s (%pM)\n", emsg->ifname,
  21294. - emsg->addr);
  21295. - ifp = brcmf_add_if(drvr, ifevent->bssidx, ifevent->ifidx,
  21296. -- emsg->ifname, emsg->addr);
  21297. -+ is_p2pdev, emsg->ifname, emsg->addr);
  21298. - if (IS_ERR(ifp))
  21299. - return;
  21300. - brcmf_fws_add_interface(ifp);
  21301. diff --git a/package/kernel/mac80211/patches/365-0006-brcmfmac-use-brcmf_get_ifp-to-map-ifidx-to-struct-br.patch b/package/kernel/mac80211/patches/365-0006-brcmfmac-use-brcmf_get_ifp-to-map-ifidx-to-struct-br.patch
  21302. deleted file mode 100644
  21303. index aebbfa6..0000000
  21304. --- a/package/kernel/mac80211/patches/365-0006-brcmfmac-use-brcmf_get_ifp-to-map-ifidx-to-struct-br.patch
  21305. +++ /dev/null
  21306. @@ -1,126 +0,0 @@
  21307. -From: Arend van Spriel <arend@broadcom.com>
  21308. -Date: Wed, 26 Aug 2015 22:14:58 +0200
  21309. -Subject: [PATCH] brcmfmac: use brcmf_get_ifp() to map ifidx to struct
  21310. - brcmf_if instance
  21311. -
  21312. -The knowledge on how to map the interface index to a struct brcmf_if
  21313. -instance is in brcmf_get_ifp() so use that function when only the
  21314. -interface index is known instead of accessing brcmf_pub::iflist
  21315. -directly.
  21316. -
  21317. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  21318. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  21319. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  21320. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  21321. ----
  21322. -
  21323. ---- a/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c
  21324. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c
  21325. -@@ -149,7 +149,7 @@ static s32 brcmf_btcoex_params_read(stru
  21326. - static void brcmf_btcoex_boost_wifi(struct brcmf_btcoex_info *btci,
  21327. - bool trump_sco)
  21328. - {
  21329. -- struct brcmf_if *ifp = btci->cfg->pub->iflist[0];
  21330. -+ struct brcmf_if *ifp = brcmf_get_ifp(btci->cfg->pub, 0);
  21331. -
  21332. - if (trump_sco && !btci->saved_regs_part2) {
  21333. - /* this should reduce eSCO agressive
  21334. -@@ -468,7 +468,7 @@ int brcmf_btcoex_set_mode(struct brcmf_c
  21335. - {
  21336. - struct brcmf_cfg80211_info *cfg = wiphy_priv(vif->wdev.wiphy);
  21337. - struct brcmf_btcoex_info *btci = cfg->btcoex;
  21338. -- struct brcmf_if *ifp = cfg->pub->iflist[0];
  21339. -+ struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
  21340. -
  21341. - switch (mode) {
  21342. - case BRCMF_BTCOEX_DISABLED:
  21343. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  21344. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  21345. -@@ -6212,7 +6212,7 @@ static void brcmf_free_wiphy(struct wiph
  21346. - struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
  21347. - struct device *busdev)
  21348. - {
  21349. -- struct net_device *ndev = drvr->iflist[0]->ndev;
  21350. -+ struct net_device *ndev = brcmf_get_ifp(drvr, 0)->ndev;
  21351. - struct brcmf_cfg80211_info *cfg;
  21352. - struct wiphy *wiphy;
  21353. - struct brcmf_cfg80211_vif *vif;
  21354. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  21355. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  21356. -@@ -121,7 +121,7 @@ static void brcmf_feat_iovar_int_set(str
  21357. -
  21358. - void brcmf_feat_attach(struct brcmf_pub *drvr)
  21359. - {
  21360. -- struct brcmf_if *ifp = drvr->iflist[0];
  21361. -+ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
  21362. -
  21363. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_MCHAN, "mchan");
  21364. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_PNO, "pfn");
  21365. ---- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  21366. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  21367. -@@ -221,7 +221,7 @@ static void brcmf_flowring_block(struct
  21368. -
  21369. - bus_if = dev_get_drvdata(flow->dev);
  21370. - drvr = bus_if->drvr;
  21371. -- ifp = drvr->iflist[ifidx];
  21372. -+ ifp = brcmf_get_ifp(drvr, ifidx);
  21373. - brcmf_txflowblock_if(ifp, BRCMF_NETIF_STOP_REASON_FLOW, blocked);
  21374. -
  21375. - spin_unlock_irqrestore(&flow->block_lock, flags);
  21376. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  21377. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  21378. -@@ -334,7 +334,7 @@ void brcmf_fweh_attach(struct brcmf_pub
  21379. - void brcmf_fweh_detach(struct brcmf_pub *drvr)
  21380. - {
  21381. - struct brcmf_fweh_info *fweh = &drvr->fweh;
  21382. -- struct brcmf_if *ifp = drvr->iflist[0];
  21383. -+ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
  21384. - s8 eventmask[BRCMF_EVENTING_MASK_LEN];
  21385. -
  21386. - if (ifp) {
  21387. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  21388. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  21389. -@@ -972,7 +972,7 @@ static void
  21390. - brcmf_fws_flow_control_check(struct brcmf_fws_info *fws, struct pktq *pq,
  21391. - u8 if_id)
  21392. - {
  21393. -- struct brcmf_if *ifp = fws->drvr->iflist[!if_id ? 0 : if_id + 1];
  21394. -+ struct brcmf_if *ifp = brcmf_get_ifp(fws->drvr, if_id);
  21395. -
  21396. - if (WARN_ON(!ifp))
  21397. - return;
  21398. -@@ -2118,6 +2118,7 @@ static int brcmf_debugfs_fws_stats_read(
  21399. - int brcmf_fws_init(struct brcmf_pub *drvr)
  21400. - {
  21401. - struct brcmf_fws_info *fws;
  21402. -+ struct brcmf_if *ifp;
  21403. - u32 tlv = BRCMF_FWS_FLAGS_RSSI_SIGNALS;
  21404. - int rc;
  21405. - u32 mode;
  21406. -@@ -2177,21 +2178,22 @@ int brcmf_fws_init(struct brcmf_pub *drv
  21407. - * continue. Set mode back to none indicating not enabled.
  21408. - */
  21409. - fws->fw_signals = true;
  21410. -- if (brcmf_fil_iovar_int_set(drvr->iflist[0], "tlv", tlv)) {
  21411. -+ ifp = brcmf_get_ifp(drvr, 0);
  21412. -+ if (brcmf_fil_iovar_int_set(ifp, "tlv", tlv)) {
  21413. - brcmf_err("failed to set bdcv2 tlv signaling\n");
  21414. - fws->fcmode = BRCMF_FWS_FCMODE_NONE;
  21415. - fws->fw_signals = false;
  21416. - }
  21417. -
  21418. -- if (brcmf_fil_iovar_int_set(drvr->iflist[0], "ampdu_hostreorder", 1))
  21419. -+ if (brcmf_fil_iovar_int_set(ifp, "ampdu_hostreorder", 1))
  21420. - brcmf_dbg(INFO, "enabling AMPDU host-reorder failed\n");
  21421. -
  21422. - /* Enable seq number reuse, if supported */
  21423. -- if (brcmf_fil_iovar_int_get(drvr->iflist[0], "wlfc_mode", &mode) == 0) {
  21424. -+ if (brcmf_fil_iovar_int_get(ifp, "wlfc_mode", &mode) == 0) {
  21425. - if (BRCMF_FWS_MODE_GET_REUSESEQ(mode)) {
  21426. - mode = 0;
  21427. - BRCMF_FWS_MODE_SET_REUSESEQ(mode, 1);
  21428. -- if (brcmf_fil_iovar_int_set(drvr->iflist[0],
  21429. -+ if (brcmf_fil_iovar_int_set(ifp,
  21430. - "wlfc_mode", mode) == 0) {
  21431. - BRCMF_FWS_MODE_SET_REUSESEQ(fws->mode, 1);
  21432. - }
  21433. diff --git a/package/kernel/mac80211/patches/365-0007-brcmfmac-pass-struct-brcmf_if-instance-in-brcmf_txfi.patch b/package/kernel/mac80211/patches/365-0007-brcmfmac-pass-struct-brcmf_if-instance-in-brcmf_txfi.patch
  21434. deleted file mode 100644
  21435. index 23a7b6f..0000000
  21436. --- a/package/kernel/mac80211/patches/365-0007-brcmfmac-pass-struct-brcmf_if-instance-in-brcmf_txfi.patch
  21437. +++ /dev/null
  21438. @@ -1,122 +0,0 @@
  21439. -From: Arend van Spriel <arend@broadcom.com>
  21440. -Date: Wed, 26 Aug 2015 22:14:59 +0200
  21441. -Subject: [PATCH] brcmfmac: pass struct brcmf_if instance in
  21442. - brcmf_txfinalize()
  21443. -
  21444. -Most call sites of brcmf_txfinalize already have struct brcmf_if
  21445. -instance so pass that to brcmf_txfinalize() as the function
  21446. -needs it anyway.
  21447. -
  21448. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  21449. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  21450. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  21451. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  21452. ----
  21453. -
  21454. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  21455. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  21456. -@@ -560,17 +560,11 @@ void brcmf_rx_frame(struct device *dev,
  21457. - brcmf_netif_rx(ifp, skb);
  21458. - }
  21459. -
  21460. --void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, u8 ifidx,
  21461. -- bool success)
  21462. -+void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success)
  21463. - {
  21464. -- struct brcmf_if *ifp;
  21465. - struct ethhdr *eh;
  21466. - u16 type;
  21467. -
  21468. -- ifp = drvr->iflist[ifidx];
  21469. -- if (!ifp)
  21470. -- goto done;
  21471. --
  21472. - eh = (struct ethhdr *)(txp->data);
  21473. - type = ntohs(eh->h_proto);
  21474. -
  21475. -@@ -582,7 +576,7 @@ void brcmf_txfinalize(struct brcmf_pub *
  21476. -
  21477. - if (!success)
  21478. - ifp->stats.tx_errors++;
  21479. --done:
  21480. -+
  21481. - brcmu_pkt_buf_free_skb(txp);
  21482. - }
  21483. -
  21484. -@@ -600,7 +594,7 @@ void brcmf_txcomplete(struct device *dev
  21485. - if (brcmf_proto_hdrpull(drvr, false, txp, &ifp))
  21486. - brcmu_pkt_buf_free_skb(txp);
  21487. - else
  21488. -- brcmf_txfinalize(drvr, txp, ifp->ifidx, success);
  21489. -+ brcmf_txfinalize(ifp, txp, success);
  21490. - }
  21491. - }
  21492. -
  21493. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  21494. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  21495. -@@ -210,8 +210,7 @@ void brcmf_remove_interface(struct brcmf
  21496. - int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  21497. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  21498. - enum brcmf_netif_stop_reason reason, bool state);
  21499. --void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, u8 ifidx,
  21500. -- bool success);
  21501. -+void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  21502. - void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);
  21503. -
  21504. - /* Sets dongle media info (drv_version, mac address). */
  21505. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  21506. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  21507. -@@ -1506,7 +1506,7 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  21508. - ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
  21509. - genbit, seq);
  21510. - if (remove_from_hanger || ret)
  21511. -- brcmf_txfinalize(fws->drvr, skb, ifp->ifidx, true);
  21512. -+ brcmf_txfinalize(ifp, skb, true);
  21513. -
  21514. - return 0;
  21515. - }
  21516. -@@ -1905,7 +1905,7 @@ int brcmf_fws_process_skb(struct brcmf_i
  21517. - if (fws->avoid_queueing) {
  21518. - rc = brcmf_proto_txdata(drvr, ifp->ifidx, 0, skb);
  21519. - if (rc < 0)
  21520. -- brcmf_txfinalize(drvr, skb, ifp->ifidx, false);
  21521. -+ brcmf_txfinalize(ifp, skb, false);
  21522. - return rc;
  21523. - }
  21524. -
  21525. -@@ -1929,7 +1929,7 @@ int brcmf_fws_process_skb(struct brcmf_i
  21526. - brcmf_fws_schedule_deq(fws);
  21527. - } else {
  21528. - brcmf_err("drop skb: no hanger slot\n");
  21529. -- brcmf_txfinalize(drvr, skb, ifp->ifidx, false);
  21530. -+ brcmf_txfinalize(ifp, skb, false);
  21531. - rc = -ENOMEM;
  21532. - }
  21533. - brcmf_fws_unlock(fws);
  21534. -@@ -2009,8 +2009,9 @@ static void brcmf_fws_dequeue_worker(str
  21535. - ret = brcmf_proto_txdata(drvr, ifidx, 0, skb);
  21536. - brcmf_fws_lock(fws);
  21537. - if (ret < 0)
  21538. -- brcmf_txfinalize(drvr, skb, ifidx,
  21539. -- false);
  21540. -+ brcmf_txfinalize(brcmf_get_ifp(drvr,
  21541. -+ ifidx),
  21542. -+ skb, false);
  21543. - if (fws->bus_flow_blocked)
  21544. - break;
  21545. - }
  21546. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  21547. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  21548. -@@ -873,7 +873,11 @@ brcmf_msgbuf_process_txstatus(struct brc
  21549. - commonring = msgbuf->flowrings[flowid];
  21550. - atomic_dec(&commonring->outstanding_tx);
  21551. -
  21552. -- brcmf_txfinalize(msgbuf->drvr, skb, tx_status->msg.ifidx, true);
  21553. -+ /* Hante: i believe this was a bug as tx_status->msg.ifidx was used
  21554. -+ * in brcmf_txfinalize as index in drvr->iflist. Can you confirm/deny?
  21555. -+ */
  21556. -+ brcmf_txfinalize(brcmf_get_ifp(msgbuf->drvr, tx_status->msg.ifidx),
  21557. -+ skb, true);
  21558. - }
  21559. -
  21560. -
  21561. diff --git a/package/kernel/mac80211/patches/365-0008-brcmfmac-add-mapping-for-interface-index-to-bsscfg-i.patch b/package/kernel/mac80211/patches/365-0008-brcmfmac-add-mapping-for-interface-index-to-bsscfg-i.patch
  21562. deleted file mode 100644
  21563. index 8ddc0a6..0000000
  21564. --- a/package/kernel/mac80211/patches/365-0008-brcmfmac-add-mapping-for-interface-index-to-bsscfg-i.patch
  21565. +++ /dev/null
  21566. @@ -1,92 +0,0 @@
  21567. -From: Arend van Spriel <arend@broadcom.com>
  21568. -Date: Wed, 26 Aug 2015 22:15:00 +0200
  21569. -Subject: [PATCH] brcmfmac: add mapping for interface index to bsscfg
  21570. - index
  21571. -
  21572. -Because the P2P Device interface in firmware uses the same interface
  21573. -index as the primary interface we use the bsscfg index as index in the
  21574. -struct brcmf_pub::iflist. However, in the data path we get the interface
  21575. -index and not the bsscfg index. So we need a mapping of interface index
  21576. -to bsscfg index, which can be determined upon handle adding the interface.
  21577. -
  21578. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  21579. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  21580. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  21581. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  21582. ----
  21583. -
  21584. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  21585. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  21586. -@@ -85,21 +85,20 @@ char *brcmf_ifname(struct brcmf_pub *drv
  21587. -
  21588. - struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx)
  21589. - {
  21590. -+ struct brcmf_if *ifp;
  21591. -+ s32 bssidx;
  21592. -+
  21593. - if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  21594. - brcmf_err("ifidx %d out of range\n", ifidx);
  21595. - return NULL;
  21596. - }
  21597. -
  21598. -- /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  21599. -- * events this is easy because it contains the bssidx which maps
  21600. -- * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  21601. -- * bssidx 1 is used for p2p0 and no data can be received or
  21602. -- * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  21603. -- */
  21604. -- if (ifidx)
  21605. -- ifidx++;
  21606. -+ ifp = NULL;
  21607. -+ bssidx = drvr->if2bss[ifidx];
  21608. -+ if (bssidx >= 0)
  21609. -+ ifp = drvr->iflist[bssidx];
  21610. -
  21611. -- return drvr->iflist[ifidx];
  21612. -+ return ifp;
  21613. - }
  21614. -
  21615. - static void _brcmf_set_multicast_list(struct work_struct *work)
  21616. -@@ -831,6 +830,8 @@ struct brcmf_if *brcmf_add_if(struct brc
  21617. -
  21618. - ifp = netdev_priv(ndev);
  21619. - ifp->ndev = ndev;
  21620. -+ /* store mapping ifidx to bssidx */
  21621. -+ drvr->if2bss[ifidx] = bssidx;
  21622. - }
  21623. -
  21624. - ifp->drvr = drvr;
  21625. -@@ -855,6 +856,7 @@ static void brcmf_del_if(struct brcmf_pu
  21626. - struct brcmf_if *ifp;
  21627. -
  21628. - ifp = drvr->iflist[bssidx];
  21629. -+ drvr->if2bss[ifp->ifidx] = -1;
  21630. - drvr->iflist[bssidx] = NULL;
  21631. - if (!ifp) {
  21632. - brcmf_err("Null interface, idx=%d\n", bssidx);
  21633. -@@ -862,6 +864,7 @@ static void brcmf_del_if(struct brcmf_pu
  21634. - }
  21635. - brcmf_dbg(TRACE, "Enter, idx=%d, ifidx=%d\n", bssidx, ifp->ifidx);
  21636. - if (ifp->ndev) {
  21637. -+ drvr->if2bss[ifp->ifidx] = -1;
  21638. - if (bssidx == 0) {
  21639. - if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) {
  21640. - rtnl_lock();
  21641. -@@ -926,6 +929,7 @@ int brcmf_attach(struct device *dev)
  21642. - if (!drvr)
  21643. - return -ENOMEM;
  21644. -
  21645. -+ memset(drvr->if2bss, 0xFF, sizeof(drvr->if2bss));
  21646. - mutex_init(&drvr->proto_block);
  21647. -
  21648. - /* Link to bus module */
  21649. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  21650. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  21651. -@@ -122,6 +122,7 @@ struct brcmf_pub {
  21652. - struct mac_address addresses[BRCMF_MAX_IFS];
  21653. -
  21654. - struct brcmf_if *iflist[BRCMF_MAX_IFS];
  21655. -+ s32 if2bss[BRCMF_MAX_IFS];
  21656. -
  21657. - struct mutex proto_block;
  21658. - unsigned char proto_buf[BRCMF_DCMD_MAXLEN];
  21659. diff --git a/package/kernel/mac80211/patches/365-0009-brcmfmac-add-dedicated-debug-level-for-firmware-cons.patch b/package/kernel/mac80211/patches/365-0009-brcmfmac-add-dedicated-debug-level-for-firmware-cons.patch
  21660. deleted file mode 100644
  21661. index a0a798b..0000000
  21662. --- a/package/kernel/mac80211/patches/365-0009-brcmfmac-add-dedicated-debug-level-for-firmware-cons.patch
  21663. +++ /dev/null
  21664. @@ -1,103 +0,0 @@
  21665. -From: Arend van Spriel <arend@broadcom.com>
  21666. -Date: Wed, 26 Aug 2015 22:15:01 +0200
  21667. -Subject: [PATCH] brcmfmac: add dedicated debug level for firmware
  21668. - console logging
  21669. -
  21670. -Both PCIe and SDIO devices have the possibility to log the firmware
  21671. -console output in kernel log. For PCIe it is logged when PCIE debug
  21672. -level is enabled. For SDIO it is logged when user specifies a non-zero
  21673. -console interval through debugfs. This patch tries to make it a
  21674. -bit more consistent. The firmware console output is only logged when
  21675. -FWCON debug level is enabled.
  21676. -
  21677. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  21678. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  21679. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  21680. -Reviewed-by: Pontus Fuchs <pontusf@broadcom.com>
  21681. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  21682. ----
  21683. -
  21684. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  21685. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  21686. -@@ -37,6 +37,7 @@
  21687. - #define BRCMF_SDIO_VAL 0x00020000
  21688. - #define BRCMF_MSGBUF_VAL 0x00040000
  21689. - #define BRCMF_PCIE_VAL 0x00080000
  21690. -+#define BRCMF_FWCON_VAL 0x00100000
  21691. -
  21692. - /* set default print format */
  21693. - #undef pr_fmt
  21694. -@@ -78,6 +79,7 @@ do { \
  21695. - #define BRCMF_GLOM_ON() (brcmf_msg_level & BRCMF_GLOM_VAL)
  21696. - #define BRCMF_EVENT_ON() (brcmf_msg_level & BRCMF_EVENT_VAL)
  21697. - #define BRCMF_FIL_ON() (brcmf_msg_level & BRCMF_FIL_VAL)
  21698. -+#define BRCMF_FWCON_ON() (brcmf_msg_level & BRCMF_FWCON_VAL)
  21699. -
  21700. - #else /* defined(DEBUG) || defined(CPTCFG_BRCM_TRACING) */
  21701. -
  21702. -@@ -90,6 +92,7 @@ do { \
  21703. - #define BRCMF_GLOM_ON() 0
  21704. - #define BRCMF_EVENT_ON() 0
  21705. - #define BRCMF_FIL_ON() 0
  21706. -+#define BRCMF_FWCON_ON() 0
  21707. -
  21708. - #endif /* defined(DEBUG) || defined(CPTCFG_BRCM_TRACING) */
  21709. -
  21710. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  21711. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  21712. -@@ -644,7 +644,7 @@ static void brcmf_pcie_bus_console_init(
  21713. - addr = console->base_addr + BRCMF_CONSOLE_BUFSIZE_OFFSET;
  21714. - console->bufsize = brcmf_pcie_read_tcm32(devinfo, addr);
  21715. -
  21716. -- brcmf_dbg(PCIE, "Console: base %x, buf %x, size %d\n",
  21717. -+ brcmf_dbg(FWCON, "Console: base %x, buf %x, size %d\n",
  21718. - console->base_addr, console->buf_addr, console->bufsize);
  21719. - }
  21720. -
  21721. -@@ -656,6 +656,9 @@ static void brcmf_pcie_bus_console_read(
  21722. - u8 ch;
  21723. - u32 newidx;
  21724. -
  21725. -+ if (!BRCMF_FWCON_ON())
  21726. -+ return;
  21727. -+
  21728. - console = &devinfo->shared.console;
  21729. - addr = console->base_addr + BRCMF_CONSOLE_WRITEIDX_OFFSET;
  21730. - newidx = brcmf_pcie_read_tcm32(devinfo, addr);
  21731. -@@ -677,7 +680,7 @@ static void brcmf_pcie_bus_console_read(
  21732. - }
  21733. - if (ch == '\n') {
  21734. - console->log_str[console->log_idx] = 0;
  21735. -- brcmf_dbg(PCIE, "CONSOLE: %s", console->log_str);
  21736. -+ pr_debug("CONSOLE: %s", console->log_str);
  21737. - console->log_idx = 0;
  21738. - }
  21739. - }
  21740. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  21741. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  21742. -@@ -123,6 +123,7 @@ struct rte_console {
  21743. -
  21744. - #define BRCMF_FIRSTREAD (1 << 6)
  21745. -
  21746. -+#define BRCMF_CONSOLE 10 /* watchdog interval to poll console */
  21747. -
  21748. - /* SBSDIO_DEVICE_CTL */
  21749. -
  21750. -@@ -3204,6 +3205,8 @@ static void brcmf_sdio_debugfs_create(st
  21751. - if (IS_ERR_OR_NULL(dentry))
  21752. - return;
  21753. -
  21754. -+ bus->console_interval = BRCMF_CONSOLE;
  21755. -+
  21756. - brcmf_debugfs_add_entry(drvr, "forensics", brcmf_sdio_forensic_read);
  21757. - brcmf_debugfs_add_entry(drvr, "counters",
  21758. - brcmf_debugfs_sdio_count_read);
  21759. -@@ -3613,7 +3616,7 @@ static void brcmf_sdio_bus_watchdog(stru
  21760. - }
  21761. - #ifdef DEBUG
  21762. - /* Poll for console output periodically */
  21763. -- if (bus->sdiodev->state == BRCMF_SDIOD_DATA &&
  21764. -+ if (bus->sdiodev->state == BRCMF_SDIOD_DATA && BRCMF_FWCON_ON() &&
  21765. - bus->console_interval != 0) {
  21766. - bus->console.count += BRCMF_WD_POLL_MS;
  21767. - if (bus->console.count >= bus->console_interval) {
  21768. diff --git a/package/kernel/mac80211/patches/365-0010-brcmfmac-remove-ifidx-parameter-from-brcmf_fws_txsta.patch b/package/kernel/mac80211/patches/365-0010-brcmfmac-remove-ifidx-parameter-from-brcmf_fws_txsta.patch
  21769. deleted file mode 100644
  21770. index 53e7ede..0000000
  21771. --- a/package/kernel/mac80211/patches/365-0010-brcmfmac-remove-ifidx-parameter-from-brcmf_fws_txsta.patch
  21772. +++ /dev/null
  21773. @@ -1,34 +0,0 @@
  21774. -From: Arend van Spriel <arend@broadcom.com>
  21775. -Date: Wed, 26 Aug 2015 22:15:02 +0200
  21776. -Subject: [PATCH] brcmfmac: remove ifidx parameter from
  21777. - brcmf_fws_txstatus_suppressed()
  21778. -
  21779. -The brcmf_fws_txstatus_suppressed() function prototype specifies an
  21780. -ifidx parameter which is not used within the function implementation.
  21781. -
  21782. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  21783. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  21784. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  21785. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  21786. ----
  21787. -
  21788. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  21789. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  21790. -@@ -1398,7 +1398,7 @@ done:
  21791. - }
  21792. -
  21793. - static int brcmf_fws_txstatus_suppressed(struct brcmf_fws_info *fws, int fifo,
  21794. -- struct sk_buff *skb, u8 ifidx,
  21795. -+ struct sk_buff *skb,
  21796. - u32 genbit, u16 seq)
  21797. - {
  21798. - struct brcmf_fws_mac_descriptor *entry = brcmf_skbcb(skb)->mac;
  21799. -@@ -1503,7 +1503,7 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  21800. - return -EINVAL;
  21801. - }
  21802. - if (!remove_from_hanger)
  21803. -- ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
  21804. -+ ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb,
  21805. - genbit, seq);
  21806. - if (remove_from_hanger || ret)
  21807. - brcmf_txfinalize(ifp, skb, true);
  21808. diff --git a/package/kernel/mac80211/patches/365-0011-brcmfmac-change-prototype-for-brcmf_fws_hdrpull.patch b/package/kernel/mac80211/patches/365-0011-brcmfmac-change-prototype-for-brcmf_fws_hdrpull.patch
  21809. deleted file mode 100644
  21810. index bb05235..0000000
  21811. --- a/package/kernel/mac80211/patches/365-0011-brcmfmac-change-prototype-for-brcmf_fws_hdrpull.patch
  21812. +++ /dev/null
  21813. @@ -1,97 +0,0 @@
  21814. -From: Arend van Spriel <arend@broadcom.com>
  21815. -Date: Wed, 26 Aug 2015 22:15:03 +0200
  21816. -Subject: [PATCH] brcmfmac: change prototype for brcmf_fws_hdrpull()
  21817. -
  21818. -Instead of passing ifidx and drvr just pass struct brcmf_if pointer
  21819. -which holds both parameters.
  21820. -
  21821. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  21822. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  21823. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  21824. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  21825. ----
  21826. -
  21827. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  21828. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  21829. -@@ -312,8 +312,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  21830. -
  21831. - skb_pull(pktbuf, BCDC_HEADER_LEN);
  21832. - if (do_fws)
  21833. -- brcmf_fws_hdrpull(drvr, tmp_if->ifidx, h->data_offset << 2,
  21834. -- pktbuf);
  21835. -+ brcmf_fws_hdrpull(tmp_if, h->data_offset << 2, pktbuf);
  21836. - else
  21837. - skb_pull(pktbuf, h->data_offset << 2);
  21838. -
  21839. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  21840. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  21841. -@@ -1616,11 +1616,10 @@ static int brcmf_fws_notify_bcmc_credit_
  21842. - return 0;
  21843. - }
  21844. -
  21845. --int brcmf_fws_hdrpull(struct brcmf_pub *drvr, int ifidx, s16 signal_len,
  21846. -- struct sk_buff *skb)
  21847. -+void brcmf_fws_hdrpull(struct brcmf_if *ifp, s16 siglen, struct sk_buff *skb)
  21848. - {
  21849. - struct brcmf_skb_reorder_data *rd;
  21850. -- struct brcmf_fws_info *fws = drvr->fws;
  21851. -+ struct brcmf_fws_info *fws = ifp->drvr->fws;
  21852. - u8 *signal_data;
  21853. - s16 data_len;
  21854. - u8 type;
  21855. -@@ -1630,20 +1629,20 @@ int brcmf_fws_hdrpull(struct brcmf_pub *
  21856. - s32 err;
  21857. -
  21858. - brcmf_dbg(HDRS, "enter: ifidx %d, skblen %u, sig %d\n",
  21859. -- ifidx, skb->len, signal_len);
  21860. -+ ifp->ifidx, skb->len, siglen);
  21861. -
  21862. -- WARN_ON(signal_len > skb->len);
  21863. -+ WARN_ON(siglen > skb->len);
  21864. -
  21865. -- if (!signal_len)
  21866. -- return 0;
  21867. -+ if (!siglen)
  21868. -+ return;
  21869. - /* if flow control disabled, skip to packet data and leave */
  21870. - if ((!fws) || (!fws->fw_signals)) {
  21871. -- skb_pull(skb, signal_len);
  21872. -- return 0;
  21873. -+ skb_pull(skb, siglen);
  21874. -+ return;
  21875. - }
  21876. -
  21877. - fws->stats.header_pulls++;
  21878. -- data_len = signal_len;
  21879. -+ data_len = siglen;
  21880. - signal_data = skb->data;
  21881. -
  21882. - status = BRCMF_FWS_RET_OK_NOSCHEDULE;
  21883. -@@ -1731,14 +1730,12 @@ int brcmf_fws_hdrpull(struct brcmf_pub *
  21884. - /* signalling processing result does
  21885. - * not affect the actual ethernet packet.
  21886. - */
  21887. -- skb_pull(skb, signal_len);
  21888. -+ skb_pull(skb, siglen);
  21889. -
  21890. - /* this may be a signal-only packet
  21891. - */
  21892. - if (skb->len == 0)
  21893. - fws->stats.header_only_pkt++;
  21894. --
  21895. -- return 0;
  21896. - }
  21897. -
  21898. - static u8 brcmf_fws_precommit_skb(struct brcmf_fws_info *fws, int fifo,
  21899. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.h
  21900. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.h
  21901. -@@ -21,8 +21,7 @@
  21902. - int brcmf_fws_init(struct brcmf_pub *drvr);
  21903. - void brcmf_fws_deinit(struct brcmf_pub *drvr);
  21904. - bool brcmf_fws_fc_active(struct brcmf_fws_info *fws);
  21905. --int brcmf_fws_hdrpull(struct brcmf_pub *drvr, int ifidx, s16 signal_len,
  21906. -- struct sk_buff *skb);
  21907. -+void brcmf_fws_hdrpull(struct brcmf_if *ifp, s16 siglen, struct sk_buff *skb);
  21908. - int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb);
  21909. -
  21910. - void brcmf_fws_reset_interface(struct brcmf_if *ifp);
  21911. diff --git a/package/kernel/mac80211/patches/365-0012-brcmfmac-introduce-brcmf_net_detach-function.patch b/package/kernel/mac80211/patches/365-0012-brcmfmac-introduce-brcmf_net_detach-function.patch
  21912. deleted file mode 100644
  21913. index ba92c67..0000000
  21914. --- a/package/kernel/mac80211/patches/365-0012-brcmfmac-introduce-brcmf_net_detach-function.patch
  21915. +++ /dev/null
  21916. @@ -1,99 +0,0 @@
  21917. -From: Arend van Spriel <arend@broadcom.com>
  21918. -Date: Wed, 26 Aug 2015 22:15:04 +0200
  21919. -Subject: [PATCH] brcmfmac: introduce brcmf_net_detach() function
  21920. -
  21921. -In case of error during brcmf_bus_start() the network interfaces were
  21922. -freed using free_netdev(). However, the interfaces may have additional
  21923. -memory allocated which is not freed. The netdev has destructor set to
  21924. -brcmf_cfg80211_free_netdev() which frees the additional memory if
  21925. -allocated and call free_netdev(). The brcmf_net_detach() either calls
  21926. -brcmf_cfg80211_free_netdev() directly or uses unregister_netdev() when
  21927. -struct net_device::reg_state indicates the netdev was registered.
  21928. -
  21929. -Reported-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  21930. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  21931. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  21932. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  21933. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  21934. ----
  21935. -
  21936. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  21937. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  21938. -@@ -4746,7 +4746,8 @@ void brcmf_cfg80211_free_netdev(struct n
  21939. - ifp = netdev_priv(ndev);
  21940. - vif = ifp->vif;
  21941. -
  21942. -- brcmf_free_vif(vif);
  21943. -+ if (vif)
  21944. -+ brcmf_free_vif(vif);
  21945. - free_netdev(ndev);
  21946. - }
  21947. -
  21948. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  21949. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  21950. -@@ -718,8 +718,6 @@ int brcmf_net_attach(struct brcmf_if *if
  21951. - }
  21952. -
  21953. - brcmf_dbg(INFO, "%s: Broadcom Dongle Host Driver\n", ndev->name);
  21954. --
  21955. -- ndev->destructor = brcmf_cfg80211_free_netdev;
  21956. - return 0;
  21957. -
  21958. - fail:
  21959. -@@ -729,6 +727,14 @@ fail:
  21960. - return -EBADE;
  21961. - }
  21962. -
  21963. -+static void brcmf_net_detach(struct net_device *ndev)
  21964. -+{
  21965. -+ if (ndev->reg_state == NETREG_REGISTERED)
  21966. -+ unregister_netdev(ndev);
  21967. -+ else
  21968. -+ brcmf_cfg80211_free_netdev(ndev);
  21969. -+}
  21970. -+
  21971. - static int brcmf_net_p2p_open(struct net_device *ndev)
  21972. - {
  21973. - brcmf_dbg(TRACE, "Enter\n");
  21974. -@@ -805,8 +811,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  21975. - ifp->ndev->name);
  21976. - if (ifidx) {
  21977. - netif_stop_queue(ifp->ndev);
  21978. -- unregister_netdev(ifp->ndev);
  21979. -- free_netdev(ifp->ndev);
  21980. -+ brcmf_net_detach(ifp->ndev);
  21981. - drvr->iflist[bssidx] = NULL;
  21982. - } else {
  21983. - brcmf_err("ignore IF event\n");
  21984. -@@ -828,6 +833,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  21985. - if (!ndev)
  21986. - return ERR_PTR(-ENOMEM);
  21987. -
  21988. -+ ndev->destructor = brcmf_cfg80211_free_netdev;
  21989. - ifp = netdev_priv(ndev);
  21990. - ifp->ndev = ndev;
  21991. - /* store mapping ifidx to bssidx */
  21992. -@@ -879,8 +885,7 @@ static void brcmf_del_if(struct brcmf_pu
  21993. - cancel_work_sync(&ifp->setmacaddr_work);
  21994. - cancel_work_sync(&ifp->multicast_work);
  21995. - }
  21996. -- /* unregister will take care of freeing it */
  21997. -- unregister_netdev(ifp->ndev);
  21998. -+ brcmf_net_detach(ifp->ndev);
  21999. - }
  22000. - }
  22001. -
  22002. -@@ -1056,11 +1061,11 @@ fail:
  22003. - brcmf_fws_deinit(drvr);
  22004. - }
  22005. - if (drvr->iflist[0]) {
  22006. -- free_netdev(ifp->ndev);
  22007. -+ brcmf_net_detach(ifp->ndev);
  22008. - drvr->iflist[0] = NULL;
  22009. - }
  22010. - if (p2p_ifp) {
  22011. -- free_netdev(p2p_ifp->ndev);
  22012. -+ brcmf_net_detach(p2p_ifp->ndev);
  22013. - drvr->iflist[1] = NULL;
  22014. - }
  22015. - return ret;
  22016. diff --git a/package/kernel/mac80211/patches/366-brcmfmac-Reset-PCIE-devices-after-recognition.patch b/package/kernel/mac80211/patches/366-brcmfmac-Reset-PCIE-devices-after-recognition.patch
  22017. deleted file mode 100644
  22018. index 5a7e447..0000000
  22019. --- a/package/kernel/mac80211/patches/366-brcmfmac-Reset-PCIE-devices-after-recognition.patch
  22020. +++ /dev/null
  22021. @@ -1,193 +0,0 @@
  22022. -From: Hante Meuleman <meuleman@broadcom.com>
  22023. -Date: Thu, 27 Aug 2015 16:14:06 +0200
  22024. -Subject: [PATCH] brcmfmac: Reset PCIE devices after recognition.
  22025. -
  22026. -When PCIE type devices are being FW reloaded without being properly
  22027. -reset then the device ends up in a locked state, requiring the
  22028. -device to be completely powered down. This patch adds a reset
  22029. -through watchdog at the moment the device (cores) has been
  22030. -recognized. This will solve warm reboot issues.
  22031. -
  22032. -Cc: Rafal Milecki <zajec5@gmail.com>
  22033. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  22034. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  22035. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  22036. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  22037. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  22038. ----
  22039. -
  22040. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  22041. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  22042. -@@ -101,6 +101,9 @@
  22043. - /* ARM Cortex M3 core, ID 0x82a */
  22044. - #define BCM4329_CORE_ARM_BASE 0x18002000
  22045. -
  22046. -+/* Max possibly supported memory size (limited by IO mapped memory) */
  22047. -+#define BRCMF_CHIP_MAX_MEMSIZE (4 * 1024 * 1024)
  22048. -+
  22049. - #define CORE_SB(base, field) \
  22050. - (base + SBCONFIGOFF + offsetof(struct sbconfig, field))
  22051. - #define SBCOREREV(sbidh) \
  22052. -@@ -687,6 +690,12 @@ static int brcmf_chip_get_raminfo(struct
  22053. - brcmf_err("RAM size is undetermined\n");
  22054. - return -ENOMEM;
  22055. - }
  22056. -+
  22057. -+ if (ci->pub.ramsize > BRCMF_CHIP_MAX_MEMSIZE) {
  22058. -+ brcmf_err("RAM size is incorrect\n");
  22059. -+ return -ENOMEM;
  22060. -+ }
  22061. -+
  22062. - return 0;
  22063. - }
  22064. -
  22065. -@@ -899,6 +908,15 @@ static int brcmf_chip_recognition(struct
  22066. -
  22067. - /* assure chip is passive for core access */
  22068. - brcmf_chip_set_passive(&ci->pub);
  22069. -+
  22070. -+ /* Call bus specific reset function now. Cores have been determined
  22071. -+ * but further access may require a chip specific reset at this point.
  22072. -+ */
  22073. -+ if (ci->ops->reset) {
  22074. -+ ci->ops->reset(ci->ctx, &ci->pub);
  22075. -+ brcmf_chip_set_passive(&ci->pub);
  22076. -+ }
  22077. -+
  22078. - return brcmf_chip_get_raminfo(ci);
  22079. - }
  22080. -
  22081. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  22082. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  22083. -@@ -73,6 +73,7 @@ struct brcmf_buscore_ops {
  22084. - u32 (*read32)(void *ctx, u32 addr);
  22085. - void (*write32)(void *ctx, u32 addr, u32 value);
  22086. - int (*prepare)(void *ctx);
  22087. -+ int (*reset)(void *ctx, struct brcmf_chip *chip);
  22088. - int (*setup)(void *ctx, struct brcmf_chip *chip);
  22089. - void (*activate)(void *ctx, struct brcmf_chip *chip, u32 rstvec);
  22090. - };
  22091. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  22092. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  22093. -@@ -74,6 +74,8 @@ enum brcmf_pcie_state {
  22094. - #define BRCMF_PCIE_REG_INTMASK 0x94
  22095. - #define BRCMF_PCIE_REG_SBMBX 0x98
  22096. -
  22097. -+#define BRCMF_PCIE_REG_LINK_STATUS_CTRL 0xBC
  22098. -+
  22099. - #define BRCMF_PCIE_PCIE2REG_INTMASK 0x24
  22100. - #define BRCMF_PCIE_PCIE2REG_MAILBOXINT 0x48
  22101. - #define BRCMF_PCIE_PCIE2REG_MAILBOXMASK 0x4C
  22102. -@@ -466,6 +468,7 @@ brcmf_pcie_select_core(struct brcmf_pcie
  22103. -
  22104. - static void brcmf_pcie_reset_device(struct brcmf_pciedev_info *devinfo)
  22105. - {
  22106. -+ struct brcmf_core *core;
  22107. - u16 cfg_offset[] = { BRCMF_PCIE_CFGREG_STATUS_CMD,
  22108. - BRCMF_PCIE_CFGREG_PM_CSR,
  22109. - BRCMF_PCIE_CFGREG_MSI_CAP,
  22110. -@@ -484,32 +487,38 @@ static void brcmf_pcie_reset_device(stru
  22111. - if (!devinfo->ci)
  22112. - return;
  22113. -
  22114. -+ /* Disable ASPM */
  22115. - brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  22116. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  22117. -- BRCMF_PCIE_CFGREG_LINK_STATUS_CTRL);
  22118. -- lsc = brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA);
  22119. -+ pci_read_config_dword(devinfo->pdev, BRCMF_PCIE_REG_LINK_STATUS_CTRL,
  22120. -+ &lsc);
  22121. - val = lsc & (~BRCMF_PCIE_LINK_STATUS_CTRL_ASPM_ENAB);
  22122. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA, val);
  22123. -+ pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_LINK_STATUS_CTRL,
  22124. -+ val);
  22125. -
  22126. -+ /* Watchdog reset */
  22127. - brcmf_pcie_select_core(devinfo, BCMA_CORE_CHIPCOMMON);
  22128. - WRITECC32(devinfo, watchdog, 4);
  22129. - msleep(100);
  22130. -
  22131. -+ /* Restore ASPM */
  22132. - brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  22133. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  22134. -- BRCMF_PCIE_CFGREG_LINK_STATUS_CTRL);
  22135. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA, lsc);
  22136. -+ pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_LINK_STATUS_CTRL,
  22137. -+ lsc);
  22138. -
  22139. -- brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  22140. -- for (i = 0; i < ARRAY_SIZE(cfg_offset); i++) {
  22141. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  22142. -- cfg_offset[i]);
  22143. -- val = brcmf_pcie_read_reg32(devinfo,
  22144. -- BRCMF_PCIE_PCIE2REG_CONFIGDATA);
  22145. -- brcmf_dbg(PCIE, "config offset 0x%04x, value 0x%04x\n",
  22146. -- cfg_offset[i], val);
  22147. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA,
  22148. -- val);
  22149. -+ core = brcmf_chip_get_core(devinfo->ci, BCMA_CORE_PCIE2);
  22150. -+ if (core->rev <= 13) {
  22151. -+ for (i = 0; i < ARRAY_SIZE(cfg_offset); i++) {
  22152. -+ brcmf_pcie_write_reg32(devinfo,
  22153. -+ BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  22154. -+ cfg_offset[i]);
  22155. -+ val = brcmf_pcie_read_reg32(devinfo,
  22156. -+ BRCMF_PCIE_PCIE2REG_CONFIGDATA);
  22157. -+ brcmf_dbg(PCIE, "config offset 0x%04x, value 0x%04x\n",
  22158. -+ cfg_offset[i], val);
  22159. -+ brcmf_pcie_write_reg32(devinfo,
  22160. -+ BRCMF_PCIE_PCIE2REG_CONFIGDATA,
  22161. -+ val);
  22162. -+ }
  22163. - }
  22164. - }
  22165. -
  22166. -@@ -519,8 +528,6 @@ static void brcmf_pcie_attach(struct brc
  22167. - u32 config;
  22168. -
  22169. - brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  22170. -- if (brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_INTMASK) != 0)
  22171. -- brcmf_pcie_reset_device(devinfo);
  22172. - /* BAR1 window may not be sized properly */
  22173. - brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  22174. - brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR, 0x4e0);
  22175. -@@ -1636,6 +1643,23 @@ static int brcmf_pcie_buscoreprep(void *
  22176. - }
  22177. -
  22178. -
  22179. -+static int brcmf_pcie_buscore_reset(void *ctx, struct brcmf_chip *chip)
  22180. -+{
  22181. -+ struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)ctx;
  22182. -+ u32 val;
  22183. -+
  22184. -+ devinfo->ci = chip;
  22185. -+ brcmf_pcie_reset_device(devinfo);
  22186. -+
  22187. -+ val = brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT);
  22188. -+ if (val != 0xffffffff)
  22189. -+ brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT,
  22190. -+ val);
  22191. -+
  22192. -+ return 0;
  22193. -+}
  22194. -+
  22195. -+
  22196. - static void brcmf_pcie_buscore_activate(void *ctx, struct brcmf_chip *chip,
  22197. - u32 rstvec)
  22198. - {
  22199. -@@ -1647,6 +1671,7 @@ static void brcmf_pcie_buscore_activate(
  22200. -
  22201. - static const struct brcmf_buscore_ops brcmf_pcie_buscore_ops = {
  22202. - .prepare = brcmf_pcie_buscoreprep,
  22203. -+ .reset = brcmf_pcie_buscore_reset,
  22204. - .activate = brcmf_pcie_buscore_activate,
  22205. - .read32 = brcmf_pcie_buscore_read32,
  22206. - .write32 = brcmf_pcie_buscore_write32,
  22207. -@@ -1814,7 +1839,6 @@ brcmf_pcie_remove(struct pci_dev *pdev)
  22208. - brcmf_pcie_intr_disable(devinfo);
  22209. -
  22210. - brcmf_detach(&pdev->dev);
  22211. -- brcmf_pcie_reset_device(devinfo);
  22212. -
  22213. - kfree(bus->bus_priv.pcie);
  22214. - kfree(bus->msgbuf->flowrings);
  22215. diff --git a/package/kernel/mac80211/patches/367-ath10k-fix-DMA-related-firmware-crashes-on-multiple-.patch b/package/kernel/mac80211/patches/367-ath10k-fix-DMA-related-firmware-crashes-on-multiple-.patch
  22216. deleted file mode 100644
  22217. index f7b3e40..0000000
  22218. --- a/package/kernel/mac80211/patches/367-ath10k-fix-DMA-related-firmware-crashes-on-multiple-.patch
  22219. +++ /dev/null
  22220. @@ -1,24 +0,0 @@
  22221. -From: Felix Fietkau <nbd@openwrt.org>
  22222. -Date: Sun, 13 Sep 2015 22:26:10 +0200
  22223. -Subject: [PATCH] ath10k: fix DMA related firmware crashes on multiple devices
  22224. -
  22225. -Some platforms really don't like DMA bursts of 256 bytes, and this
  22226. -causes the firmware to crash when sending beacons.
  22227. -Also, changing this based on the firmware version does not seem to make
  22228. -much sense, so use 128 bytes for all versions.
  22229. -
  22230. -Cc: stable@vger.kernel.org
  22231. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  22232. ----
  22233. -
  22234. ---- a/drivers/net/wireless/ath/ath10k/hw.h
  22235. -+++ b/drivers/net/wireless/ath/ath10k/hw.h
  22236. -@@ -253,7 +253,7 @@ struct ath10k_pktlog_hdr {
  22237. - #define TARGET_10X_MAX_FRAG_ENTRIES 0
  22238. -
  22239. - /* 10.2 parameters */
  22240. --#define TARGET_10_2_DMA_BURST_SIZE 1
  22241. -+#define TARGET_10_2_DMA_BURST_SIZE 0
  22242. -
  22243. - /* Target specific defines for WMI-TLV firmware */
  22244. - #define TARGET_TLV_NUM_VDEVS 3
  22245. diff --git a/package/kernel/mac80211/patches/368-ath9k-declare-required-extra-tx-headroom.patch b/package/kernel/mac80211/patches/368-ath9k-declare-required-extra-tx-headroom.patch
  22246. deleted file mode 100644
  22247. index c420d20..0000000
  22248. --- a/package/kernel/mac80211/patches/368-ath9k-declare-required-extra-tx-headroom.patch
  22249. +++ /dev/null
  22250. @@ -1,22 +0,0 @@
  22251. -From: Felix Fietkau <nbd@openwrt.org>
  22252. -Date: Thu, 24 Sep 2015 16:57:37 +0200
  22253. -Subject: [PATCH] ath9k: declare required extra tx headroom
  22254. -
  22255. -ath9k inserts padding between the 802.11 header and the data area (to
  22256. -align it). Since it didn't declare this extra required headroom, this
  22257. -led to some nasty issues like randomly dropped packets in some setups.
  22258. -
  22259. -Cc: stable@vger.kernel.org
  22260. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  22261. ----
  22262. -
  22263. ---- a/drivers/net/wireless/ath/ath9k/init.c
  22264. -+++ b/drivers/net/wireless/ath/ath9k/init.c
  22265. -@@ -867,6 +867,7 @@ static void ath9k_set_hw_capab(struct at
  22266. - hw->max_rate_tries = 10;
  22267. - hw->sta_data_size = sizeof(struct ath_node);
  22268. - hw->vif_data_size = sizeof(struct ath_vif);
  22269. -+ hw->extra_tx_headroom = 4;
  22270. -
  22271. - hw->wiphy->available_antennas_rx = BIT(ah->caps.max_rxchains) - 1;
  22272. - hw->wiphy->available_antennas_tx = BIT(ah->caps.max_txchains) - 1;
  22273. diff --git a/package/kernel/mac80211/patches/369-mac80211-initialize-tid-field-in-struct-ieee80211_tx.patch b/package/kernel/mac80211/patches/369-mac80211-initialize-tid-field-in-struct-ieee80211_tx.patch
  22274. deleted file mode 100644
  22275. index 1478efa..0000000
  22276. --- a/package/kernel/mac80211/patches/369-mac80211-initialize-tid-field-in-struct-ieee80211_tx.patch
  22277. +++ /dev/null
  22278. @@ -1,21 +0,0 @@
  22279. -From: Felix Fietkau <nbd@openwrt.org>
  22280. -Date: Mon, 5 Oct 2015 17:41:25 +0200
  22281. -Subject: [PATCH] mac80211: initialize tid field in struct ieee80211_txq
  22282. -
  22283. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  22284. ----
  22285. -
  22286. ---- a/net/mac80211/util.c
  22287. -+++ b/net/mac80211/util.c
  22288. -@@ -3323,9 +3323,11 @@ void ieee80211_init_tx_queue(struct ieee
  22289. - if (sta) {
  22290. - txqi->txq.sta = &sta->sta;
  22291. - sta->sta.txq[tid] = &txqi->txq;
  22292. -+ txqi->txq.tid = tid;
  22293. - txqi->txq.ac = ieee802_1d_to_ac[tid & 7];
  22294. - } else {
  22295. - sdata->vif.txq = &txqi->txq;
  22296. -+ txqi->txq.tid = 0;
  22297. - txqi->txq.ac = IEEE80211_AC_BE;
  22298. - }
  22299. - }
  22300. diff --git a/package/kernel/mac80211/patches/370-0001-brcmfmac-Fix-exception-handling.patch b/package/kernel/mac80211/patches/370-0001-brcmfmac-Fix-exception-handling.patch
  22301. deleted file mode 100644
  22302. index bcd1031..0000000
  22303. --- a/package/kernel/mac80211/patches/370-0001-brcmfmac-Fix-exception-handling.patch
  22304. +++ /dev/null
  22305. @@ -1,24 +0,0 @@
  22306. -From: Hante Meuleman <meuleman@broadcom.com>
  22307. -Date: Fri, 18 Sep 2015 22:08:04 +0200
  22308. -Subject: [PATCH] brcmfmac: Fix exception handling.
  22309. -
  22310. -In some exception situations the ifp->vif was not properly assigned
  22311. -which could result in crash.
  22312. -
  22313. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  22314. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  22315. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  22316. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  22317. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  22318. ----
  22319. -
  22320. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  22321. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  22322. -@@ -6331,6 +6331,7 @@ wiphy_unreg_out:
  22323. - priv_out:
  22324. - wl_deinit_priv(cfg);
  22325. - brcmf_free_vif(vif);
  22326. -+ ifp->vif = NULL;
  22327. - wiphy_out:
  22328. - brcmf_free_wiphy(wiphy);
  22329. - return NULL;
  22330. diff --git a/package/kernel/mac80211/patches/370-0002-brcmfmac-Add-support-for-the-BCM4350-PCIE-device.patch b/package/kernel/mac80211/patches/370-0002-brcmfmac-Add-support-for-the-BCM4350-PCIE-device.patch
  22331. deleted file mode 100644
  22332. index f4ab77b..0000000
  22333. --- a/package/kernel/mac80211/patches/370-0002-brcmfmac-Add-support-for-the-BCM4350-PCIE-device.patch
  22334. +++ /dev/null
  22335. @@ -1,81 +0,0 @@
  22336. -From: Hante Meuleman <meuleman@broadcom.com>
  22337. -Date: Fri, 18 Sep 2015 22:08:05 +0200
  22338. -Subject: [PATCH] brcmfmac: Add support for the BCM4350 PCIE device.
  22339. -
  22340. -This patch adds support fo the BRCM4350 2x2 11ac PCIE device.
  22341. -
  22342. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  22343. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  22344. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  22345. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  22346. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  22347. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  22348. ----
  22349. -
  22350. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  22351. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  22352. -@@ -647,6 +647,7 @@ static u32 brcmf_chip_tcm_rambase(struct
  22353. - return 0x198000;
  22354. - case BRCM_CC_4335_CHIP_ID:
  22355. - case BRCM_CC_4339_CHIP_ID:
  22356. -+ case BRCM_CC_4350_CHIP_ID:
  22357. - case BRCM_CC_4354_CHIP_ID:
  22358. - case BRCM_CC_4356_CHIP_ID:
  22359. - case BRCM_CC_43567_CHIP_ID:
  22360. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  22361. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  22362. -@@ -47,6 +47,8 @@ enum brcmf_pcie_state {
  22363. -
  22364. - #define BRCMF_PCIE_43602_FW_NAME "brcm/brcmfmac43602-pcie.bin"
  22365. - #define BRCMF_PCIE_43602_NVRAM_NAME "brcm/brcmfmac43602-pcie.txt"
  22366. -+#define BRCMF_PCIE_4350_FW_NAME "brcm/brcmfmac4350-pcie.bin"
  22367. -+#define BRCMF_PCIE_4350_NVRAM_NAME "brcm/brcmfmac4350-pcie.txt"
  22368. - #define BRCMF_PCIE_4356_FW_NAME "brcm/brcmfmac4356-pcie.bin"
  22369. - #define BRCMF_PCIE_4356_NVRAM_NAME "brcm/brcmfmac4356-pcie.txt"
  22370. - #define BRCMF_PCIE_43570_FW_NAME "brcm/brcmfmac43570-pcie.bin"
  22371. -@@ -194,6 +196,8 @@ enum brcmf_pcie_state {
  22372. -
  22373. - MODULE_FIRMWARE(BRCMF_PCIE_43602_FW_NAME);
  22374. - MODULE_FIRMWARE(BRCMF_PCIE_43602_NVRAM_NAME);
  22375. -+MODULE_FIRMWARE(BRCMF_PCIE_4350_FW_NAME);
  22376. -+MODULE_FIRMWARE(BRCMF_PCIE_4350_NVRAM_NAME);
  22377. - MODULE_FIRMWARE(BRCMF_PCIE_4356_FW_NAME);
  22378. - MODULE_FIRMWARE(BRCMF_PCIE_4356_NVRAM_NAME);
  22379. - MODULE_FIRMWARE(BRCMF_PCIE_43570_FW_NAME);
  22380. -@@ -1418,6 +1422,10 @@ static int brcmf_pcie_get_fwnames(struct
  22381. - fw_name = BRCMF_PCIE_43602_FW_NAME;
  22382. - nvram_name = BRCMF_PCIE_43602_NVRAM_NAME;
  22383. - break;
  22384. -+ case BRCM_CC_4350_CHIP_ID:
  22385. -+ fw_name = BRCMF_PCIE_4350_FW_NAME;
  22386. -+ nvram_name = BRCMF_PCIE_4350_NVRAM_NAME;
  22387. -+ break;
  22388. - case BRCM_CC_4356_CHIP_ID:
  22389. - fw_name = BRCMF_PCIE_4356_FW_NAME;
  22390. - nvram_name = BRCMF_PCIE_4356_NVRAM_NAME;
  22391. -@@ -1956,6 +1964,7 @@ cleanup:
  22392. - PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 }
  22393. -
  22394. - static struct pci_device_id brcmf_pcie_devid_table[] = {
  22395. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4350_DEVICE_ID),
  22396. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4356_DEVICE_ID),
  22397. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43567_DEVICE_ID),
  22398. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43570_DEVICE_ID),
  22399. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  22400. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  22401. -@@ -39,6 +39,7 @@
  22402. - #define BRCM_CC_4339_CHIP_ID 0x4339
  22403. - #define BRCM_CC_43430_CHIP_ID 43430
  22404. - #define BRCM_CC_4345_CHIP_ID 0x4345
  22405. -+#define BRCM_CC_4350_CHIP_ID 0x4350
  22406. - #define BRCM_CC_4354_CHIP_ID 0x4354
  22407. - #define BRCM_CC_4356_CHIP_ID 0x4356
  22408. - #define BRCM_CC_43566_CHIP_ID 43566
  22409. -@@ -56,6 +57,7 @@
  22410. - #define BRCM_USB_BCMFW_DEVICE_ID 0x0bdc
  22411. -
  22412. - /* PCIE Device IDs */
  22413. -+#define BRCM_PCIE_4350_DEVICE_ID 0x43a3
  22414. - #define BRCM_PCIE_4354_DEVICE_ID 0x43df
  22415. - #define BRCM_PCIE_4356_DEVICE_ID 0x43ec
  22416. - #define BRCM_PCIE_43567_DEVICE_ID 0x43d3
  22417. diff --git a/package/kernel/mac80211/patches/370-0003-brcmfmac-Fix-set-and-get-tx-power-functions.patch b/package/kernel/mac80211/patches/370-0003-brcmfmac-Fix-set-and-get-tx-power-functions.patch
  22418. deleted file mode 100644
  22419. index 62fdd8d..0000000
  22420. --- a/package/kernel/mac80211/patches/370-0003-brcmfmac-Fix-set-and-get-tx-power-functions.patch
  22421. +++ /dev/null
  22422. @@ -1,218 +0,0 @@
  22423. -From: Hante Meuleman <meuleman@broadcom.com>
  22424. -Date: Fri, 18 Sep 2015 22:08:06 +0200
  22425. -Subject: [PATCH] brcmfmac: Fix set and get tx-power functions.
  22426. -
  22427. -Implementation of tx-power (get and set) related functions are
  22428. -still assuming mW interface. This is wrong as functions use dbm
  22429. -(or mbm) nowadays. As a result a tx power configuration could
  22430. -result in wrong power configuration.
  22431. -
  22432. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  22433. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  22434. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  22435. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  22436. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  22437. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  22438. ----
  22439. -
  22440. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  22441. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  22442. -@@ -236,89 +236,6 @@ static int brcmf_roamoff;
  22443. - module_param_named(roamoff, brcmf_roamoff, int, S_IRUSR);
  22444. - MODULE_PARM_DESC(roamoff, "do not use internal roaming engine");
  22445. -
  22446. --/* Quarter dBm units to mW
  22447. -- * Table starts at QDBM_OFFSET, so the first entry is mW for qdBm=153
  22448. -- * Table is offset so the last entry is largest mW value that fits in
  22449. -- * a u16.
  22450. -- */
  22451. --
  22452. --#define QDBM_OFFSET 153 /* Offset for first entry */
  22453. --#define QDBM_TABLE_LEN 40 /* Table size */
  22454. --
  22455. --/* Smallest mW value that will round up to the first table entry, QDBM_OFFSET.
  22456. -- * Value is ( mW(QDBM_OFFSET - 1) + mW(QDBM_OFFSET) ) / 2
  22457. -- */
  22458. --#define QDBM_TABLE_LOW_BOUND 6493 /* Low bound */
  22459. --
  22460. --/* Largest mW value that will round down to the last table entry,
  22461. -- * QDBM_OFFSET + QDBM_TABLE_LEN-1.
  22462. -- * Value is ( mW(QDBM_OFFSET + QDBM_TABLE_LEN - 1) +
  22463. -- * mW(QDBM_OFFSET + QDBM_TABLE_LEN) ) / 2.
  22464. -- */
  22465. --#define QDBM_TABLE_HIGH_BOUND 64938 /* High bound */
  22466. --
  22467. --static const u16 nqdBm_to_mW_map[QDBM_TABLE_LEN] = {
  22468. --/* qdBm: +0 +1 +2 +3 +4 +5 +6 +7 */
  22469. --/* 153: */ 6683, 7079, 7499, 7943, 8414, 8913, 9441, 10000,
  22470. --/* 161: */ 10593, 11220, 11885, 12589, 13335, 14125, 14962, 15849,
  22471. --/* 169: */ 16788, 17783, 18836, 19953, 21135, 22387, 23714, 25119,
  22472. --/* 177: */ 26607, 28184, 29854, 31623, 33497, 35481, 37584, 39811,
  22473. --/* 185: */ 42170, 44668, 47315, 50119, 53088, 56234, 59566, 63096
  22474. --};
  22475. --
  22476. --static u16 brcmf_qdbm_to_mw(u8 qdbm)
  22477. --{
  22478. -- uint factor = 1;
  22479. -- int idx = qdbm - QDBM_OFFSET;
  22480. --
  22481. -- if (idx >= QDBM_TABLE_LEN)
  22482. -- /* clamp to max u16 mW value */
  22483. -- return 0xFFFF;
  22484. --
  22485. -- /* scale the qdBm index up to the range of the table 0-40
  22486. -- * where an offset of 40 qdBm equals a factor of 10 mW.
  22487. -- */
  22488. -- while (idx < 0) {
  22489. -- idx += 40;
  22490. -- factor *= 10;
  22491. -- }
  22492. --
  22493. -- /* return the mW value scaled down to the correct factor of 10,
  22494. -- * adding in factor/2 to get proper rounding.
  22495. -- */
  22496. -- return (nqdBm_to_mW_map[idx] + factor / 2) / factor;
  22497. --}
  22498. --
  22499. --static u8 brcmf_mw_to_qdbm(u16 mw)
  22500. --{
  22501. -- u8 qdbm;
  22502. -- int offset;
  22503. -- uint mw_uint = mw;
  22504. -- uint boundary;
  22505. --
  22506. -- /* handle boundary case */
  22507. -- if (mw_uint <= 1)
  22508. -- return 0;
  22509. --
  22510. -- offset = QDBM_OFFSET;
  22511. --
  22512. -- /* move mw into the range of the table */
  22513. -- while (mw_uint < QDBM_TABLE_LOW_BOUND) {
  22514. -- mw_uint *= 10;
  22515. -- offset -= 40;
  22516. -- }
  22517. --
  22518. -- for (qdbm = 0; qdbm < QDBM_TABLE_LEN - 1; qdbm++) {
  22519. -- boundary = nqdBm_to_mW_map[qdbm] + (nqdBm_to_mW_map[qdbm + 1] -
  22520. -- nqdBm_to_mW_map[qdbm]) / 2;
  22521. -- if (mw_uint < boundary)
  22522. -- break;
  22523. -- }
  22524. --
  22525. -- qdbm += (u8) offset;
  22526. --
  22527. -- return qdbm;
  22528. --}
  22529. -
  22530. - static u16 chandef_to_chanspec(struct brcmu_d11inf *d11inf,
  22531. - struct cfg80211_chan_def *ch)
  22532. -@@ -2016,16 +1933,14 @@ static s32
  22533. - brcmf_cfg80211_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
  22534. - enum nl80211_tx_power_setting type, s32 mbm)
  22535. - {
  22536. --
  22537. - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  22538. - struct net_device *ndev = cfg_to_ndev(cfg);
  22539. - struct brcmf_if *ifp = netdev_priv(ndev);
  22540. -- u16 txpwrmw;
  22541. -- s32 err = 0;
  22542. -- s32 disable = 0;
  22543. -- s32 dbm = MBM_TO_DBM(mbm);
  22544. -+ s32 err;
  22545. -+ s32 disable;
  22546. -+ u32 qdbm = 127;
  22547. -
  22548. -- brcmf_dbg(TRACE, "Enter\n");
  22549. -+ brcmf_dbg(TRACE, "Enter %d %d\n", type, mbm);
  22550. - if (!check_vif_up(ifp->vif))
  22551. - return -EIO;
  22552. -
  22553. -@@ -2034,12 +1949,20 @@ brcmf_cfg80211_set_tx_power(struct wiphy
  22554. - break;
  22555. - case NL80211_TX_POWER_LIMITED:
  22556. - case NL80211_TX_POWER_FIXED:
  22557. -- if (dbm < 0) {
  22558. -+ if (mbm < 0) {
  22559. - brcmf_err("TX_POWER_FIXED - dbm is negative\n");
  22560. - err = -EINVAL;
  22561. - goto done;
  22562. - }
  22563. -+ qdbm = MBM_TO_DBM(4 * mbm);
  22564. -+ if (qdbm > 127)
  22565. -+ qdbm = 127;
  22566. -+ qdbm |= WL_TXPWR_OVERRIDE;
  22567. - break;
  22568. -+ default:
  22569. -+ brcmf_err("Unsupported type %d\n", type);
  22570. -+ err = -EINVAL;
  22571. -+ goto done;
  22572. - }
  22573. - /* Make sure radio is off or on as far as software is concerned */
  22574. - disable = WL_RADIO_SW_DISABLE << 16;
  22575. -@@ -2047,52 +1970,44 @@ brcmf_cfg80211_set_tx_power(struct wiphy
  22576. - if (err)
  22577. - brcmf_err("WLC_SET_RADIO error (%d)\n", err);
  22578. -
  22579. -- if (dbm > 0xffff)
  22580. -- txpwrmw = 0xffff;
  22581. -- else
  22582. -- txpwrmw = (u16) dbm;
  22583. -- err = brcmf_fil_iovar_int_set(ifp, "qtxpower",
  22584. -- (s32)brcmf_mw_to_qdbm(txpwrmw));
  22585. -+ err = brcmf_fil_iovar_int_set(ifp, "qtxpower", qdbm);
  22586. - if (err)
  22587. - brcmf_err("qtxpower error (%d)\n", err);
  22588. -- cfg->conf->tx_power = dbm;
  22589. -
  22590. - done:
  22591. -- brcmf_dbg(TRACE, "Exit\n");
  22592. -+ brcmf_dbg(TRACE, "Exit %d (qdbm)\n", qdbm & ~WL_TXPWR_OVERRIDE);
  22593. - return err;
  22594. - }
  22595. -
  22596. --static s32 brcmf_cfg80211_get_tx_power(struct wiphy *wiphy,
  22597. -- struct wireless_dev *wdev,
  22598. -- s32 *dbm)
  22599. -+static s32
  22600. -+brcmf_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
  22601. -+ s32 *dbm)
  22602. - {
  22603. - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  22604. -- struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg));
  22605. -- s32 txpwrdbm;
  22606. -- u8 result;
  22607. -- s32 err = 0;
  22608. -+ struct net_device *ndev = cfg_to_ndev(cfg);
  22609. -+ struct brcmf_if *ifp = netdev_priv(ndev);
  22610. -+ s32 qdbm = 0;
  22611. -+ s32 err;
  22612. -
  22613. - brcmf_dbg(TRACE, "Enter\n");
  22614. - if (!check_vif_up(ifp->vif))
  22615. - return -EIO;
  22616. -
  22617. -- err = brcmf_fil_iovar_int_get(ifp, "qtxpower", &txpwrdbm);
  22618. -+ err = brcmf_fil_iovar_int_get(ifp, "qtxpower", &qdbm);
  22619. - if (err) {
  22620. - brcmf_err("error (%d)\n", err);
  22621. - goto done;
  22622. - }
  22623. --
  22624. -- result = (u8) (txpwrdbm & ~WL_TXPWR_OVERRIDE);
  22625. -- *dbm = (s32) brcmf_qdbm_to_mw(result);
  22626. -+ *dbm = (qdbm & ~WL_TXPWR_OVERRIDE) / 4;
  22627. -
  22628. - done:
  22629. -- brcmf_dbg(TRACE, "Exit\n");
  22630. -+ brcmf_dbg(TRACE, "Exit (0x%x %d)\n", qdbm, *dbm);
  22631. - return err;
  22632. - }
  22633. -
  22634. - static s32
  22635. - brcmf_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *ndev,
  22636. -- u8 key_idx, bool unicast, bool multicast)
  22637. -+ u8 key_idx, bool unicast, bool multicast)
  22638. - {
  22639. - struct brcmf_if *ifp = netdev_priv(ndev);
  22640. - u32 index;
  22641. diff --git a/package/kernel/mac80211/patches/370-0004-brcmfmac-Only-assign-primary-netdev-to-if2bss-array.patch b/package/kernel/mac80211/patches/370-0004-brcmfmac-Only-assign-primary-netdev-to-if2bss-array.patch
  22642. deleted file mode 100644
  22643. index c51365f..0000000
  22644. --- a/package/kernel/mac80211/patches/370-0004-brcmfmac-Only-assign-primary-netdev-to-if2bss-array.patch
  22645. +++ /dev/null
  22646. @@ -1,73 +0,0 @@
  22647. -From: Hante Meuleman <meuleman@broadcom.com>
  22648. -Date: Fri, 18 Sep 2015 22:08:07 +0200
  22649. -Subject: [PATCH] brcmfmac: Only assign primary netdev to if2bss array.
  22650. -
  22651. -The if2bss allows for translation of ifidx to bssidx which has a 1:n
  22652. -relation. Therefor only the first (primary) netdev should be
  22653. -assigned in this array. This fixes the p2pon=1 module param usage.
  22654. -
  22655. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  22656. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  22657. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  22658. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  22659. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  22660. ----
  22661. -
  22662. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  22663. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  22664. -@@ -53,6 +53,8 @@ MODULE_LICENSE("Dual BSD/GPL");
  22665. - #define BRCMF_RXREORDER_EXPIDX_VALID 0x08
  22666. - #define BRCMF_RXREORDER_NEW_HOLE 0x10
  22667. -
  22668. -+#define BRCMF_BSSIDX_INVALID -1
  22669. -+
  22670. - /* Error bits */
  22671. - int brcmf_msg_level;
  22672. - module_param_named(debug, brcmf_msg_level, int, S_IRUSR | S_IWUSR);
  22673. -@@ -837,7 +839,8 @@ struct brcmf_if *brcmf_add_if(struct brc
  22674. - ifp = netdev_priv(ndev);
  22675. - ifp->ndev = ndev;
  22676. - /* store mapping ifidx to bssidx */
  22677. -- drvr->if2bss[ifidx] = bssidx;
  22678. -+ if (drvr->if2bss[ifidx] == BRCMF_BSSIDX_INVALID)
  22679. -+ drvr->if2bss[ifidx] = bssidx;
  22680. - }
  22681. -
  22682. - ifp->drvr = drvr;
  22683. -@@ -862,15 +865,15 @@ static void brcmf_del_if(struct brcmf_pu
  22684. - struct brcmf_if *ifp;
  22685. -
  22686. - ifp = drvr->iflist[bssidx];
  22687. -- drvr->if2bss[ifp->ifidx] = -1;
  22688. - drvr->iflist[bssidx] = NULL;
  22689. - if (!ifp) {
  22690. - brcmf_err("Null interface, idx=%d\n", bssidx);
  22691. - return;
  22692. - }
  22693. - brcmf_dbg(TRACE, "Enter, idx=%d, ifidx=%d\n", bssidx, ifp->ifidx);
  22694. -+ if (drvr->if2bss[ifp->ifidx] == bssidx)
  22695. -+ drvr->if2bss[ifp->ifidx] = BRCMF_BSSIDX_INVALID;
  22696. - if (ifp->ndev) {
  22697. -- drvr->if2bss[ifp->ifidx] = -1;
  22698. - if (bssidx == 0) {
  22699. - if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) {
  22700. - rtnl_lock();
  22701. -@@ -926,6 +929,7 @@ int brcmf_attach(struct device *dev)
  22702. - {
  22703. - struct brcmf_pub *drvr = NULL;
  22704. - int ret = 0;
  22705. -+ int i;
  22706. -
  22707. - brcmf_dbg(TRACE, "Enter\n");
  22708. -
  22709. -@@ -934,7 +938,9 @@ int brcmf_attach(struct device *dev)
  22710. - if (!drvr)
  22711. - return -ENOMEM;
  22712. -
  22713. -- memset(drvr->if2bss, 0xFF, sizeof(drvr->if2bss));
  22714. -+ for (i = 0; i < ARRAY_SIZE(drvr->if2bss); i++)
  22715. -+ drvr->if2bss[i] = BRCMF_BSSIDX_INVALID;
  22716. -+
  22717. - mutex_init(&drvr->proto_block);
  22718. -
  22719. - /* Link to bus module */
  22720. diff --git a/package/kernel/mac80211/patches/370-0005-brcmfmac-Inform-p2p-module-about-p2pon-through-API.patch b/package/kernel/mac80211/patches/370-0005-brcmfmac-Inform-p2p-module-about-p2pon-through-API.patch
  22721. deleted file mode 100644
  22722. index 3c1058d..0000000
  22723. --- a/package/kernel/mac80211/patches/370-0005-brcmfmac-Inform-p2p-module-about-p2pon-through-API.patch
  22724. +++ /dev/null
  22725. @@ -1,113 +0,0 @@
  22726. -From: Hante Meuleman <meuleman@broadcom.com>
  22727. -Date: Fri, 18 Sep 2015 22:08:08 +0200
  22728. -Subject: [PATCH] brcmfmac: Inform p2p module about p2pon through API
  22729. -
  22730. -When the p2pon module param is used then p2p attach will initialize
  22731. -p2p device iface in the firmware, but it is doing that by checking
  22732. -data. It is cleaner to pass the p2pon information to p2p by API.
  22733. -This information is also needed for other patch.
  22734. -
  22735. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  22736. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  22737. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  22738. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  22739. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  22740. ----
  22741. -
  22742. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  22743. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  22744. -@@ -6126,7 +6126,8 @@ static void brcmf_free_wiphy(struct wiph
  22745. - }
  22746. -
  22747. - struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
  22748. -- struct device *busdev)
  22749. -+ struct device *busdev,
  22750. -+ bool p2pdev_forced)
  22751. - {
  22752. - struct net_device *ndev = brcmf_get_ifp(drvr, 0)->ndev;
  22753. - struct brcmf_cfg80211_info *cfg;
  22754. -@@ -6218,7 +6219,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  22755. - *cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
  22756. - }
  22757. -
  22758. -- err = brcmf_p2p_attach(cfg);
  22759. -+ err = brcmf_p2p_attach(cfg, p2pdev_forced);
  22760. - if (err) {
  22761. - brcmf_err("P2P initilisation failed (%d)\n", err);
  22762. - goto wiphy_unreg_out;
  22763. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  22764. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  22765. -@@ -469,7 +469,8 @@ brcmf_cfg80211_connect_info *cfg_to_conn
  22766. - }
  22767. -
  22768. - struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
  22769. -- struct device *busdev);
  22770. -+ struct device *busdev,
  22771. -+ bool p2pdev_forced);
  22772. - void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg);
  22773. - s32 brcmf_cfg80211_up(struct net_device *ndev);
  22774. - s32 brcmf_cfg80211_down(struct net_device *ndev);
  22775. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  22776. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  22777. -@@ -1044,7 +1044,8 @@ int brcmf_bus_start(struct device *dev)
  22778. -
  22779. - brcmf_fws_add_interface(ifp);
  22780. -
  22781. -- drvr->config = brcmf_cfg80211_attach(drvr, bus_if->dev);
  22782. -+ drvr->config = brcmf_cfg80211_attach(drvr, bus_if->dev,
  22783. -+ brcmf_p2p_enable);
  22784. - if (drvr->config == NULL) {
  22785. - ret = -ENOMEM;
  22786. - goto fail;
  22787. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  22788. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  22789. -@@ -2333,7 +2333,7 @@ void brcmf_p2p_stop_device(struct wiphy
  22790. - *
  22791. - * @cfg: driver private data for cfg80211 interface.
  22792. - */
  22793. --s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg)
  22794. -+s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced)
  22795. - {
  22796. - struct brcmf_if *pri_ifp;
  22797. - struct brcmf_if *p2p_ifp;
  22798. -@@ -2348,11 +2348,15 @@ s32 brcmf_p2p_attach(struct brcmf_cfg802
  22799. -
  22800. - drvr = cfg->pub;
  22801. -
  22802. -- pri_ifp = drvr->iflist[0];
  22803. -- p2p_ifp = drvr->iflist[1];
  22804. --
  22805. -+ pri_ifp = brcmf_get_ifp(drvr, 0);
  22806. - p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif = pri_ifp->vif;
  22807. -
  22808. -+ if (p2pdev_forced) {
  22809. -+ p2p_ifp = drvr->iflist[1];
  22810. -+ } else {
  22811. -+ p2p_ifp = NULL;
  22812. -+ p2p->p2pdev_dynamically = true;
  22813. -+ }
  22814. - if (p2p_ifp) {
  22815. - p2p_vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_P2P_DEVICE,
  22816. - false);
  22817. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.h
  22818. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.h
  22819. -@@ -124,6 +124,7 @@ struct afx_hdl {
  22820. - * @wait_next_af: thread synchronizing struct.
  22821. - * @gon_req_action: about to send go negotiation requets frame.
  22822. - * @block_gon_req_tx: drop tx go negotiation requets frame.
  22823. -+ * @p2pdev_dynamically: is p2p device if created by module param or supplicant.
  22824. - */
  22825. - struct brcmf_p2p_info {
  22826. - struct brcmf_cfg80211_info *cfg;
  22827. -@@ -144,9 +145,10 @@ struct brcmf_p2p_info {
  22828. - struct completion wait_next_af;
  22829. - bool gon_req_action;
  22830. - bool block_gon_req_tx;
  22831. -+ bool p2pdev_dynamically;
  22832. - };
  22833. -
  22834. --s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg);
  22835. -+s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced);
  22836. - void brcmf_p2p_detach(struct brcmf_p2p_info *p2p);
  22837. - struct wireless_dev *brcmf_p2p_add_vif(struct wiphy *wiphy, const char *name,
  22838. - enum nl80211_iftype type, u32 *flags,
  22839. diff --git a/package/kernel/mac80211/patches/370-0006-brcmfmac-Fix-bug-in-flowring-management.patch b/package/kernel/mac80211/patches/370-0006-brcmfmac-Fix-bug-in-flowring-management.patch
  22840. deleted file mode 100644
  22841. index 66b2117..0000000
  22842. --- a/package/kernel/mac80211/patches/370-0006-brcmfmac-Fix-bug-in-flowring-management.patch
  22843. +++ /dev/null
  22844. @@ -1,26 +0,0 @@
  22845. -From: Hante Meuleman <meuleman@broadcom.com>
  22846. -Date: Fri, 18 Sep 2015 22:08:09 +0200
  22847. -Subject: [PATCH] brcmfmac: Fix bug in flowring management.
  22848. -
  22849. -The hash index stored in the flowrings is of type u16 but gets
  22850. -stored in u8. This can result in incorrect indexing and possibly
  22851. -result in crashes. This patch fixes the type.
  22852. -
  22853. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  22854. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  22855. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  22856. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  22857. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  22858. ----
  22859. -
  22860. ---- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.h
  22861. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.h
  22862. -@@ -34,7 +34,7 @@ enum ring_status {
  22863. - };
  22864. -
  22865. - struct brcmf_flowring_ring {
  22866. -- u8 hash_id;
  22867. -+ u16 hash_id;
  22868. - bool blocked;
  22869. - enum ring_status status;
  22870. - struct sk_buff_head skblist;
  22871. diff --git a/package/kernel/mac80211/patches/370-0007-brcmfmac-Make-p2pon-module-param-always-available.patch b/package/kernel/mac80211/patches/370-0007-brcmfmac-Make-p2pon-module-param-always-available.patch
  22872. deleted file mode 100644
  22873. index c143c3b..0000000
  22874. --- a/package/kernel/mac80211/patches/370-0007-brcmfmac-Make-p2pon-module-param-always-available.patch
  22875. +++ /dev/null
  22876. @@ -1,29 +0,0 @@
  22877. -From: Hante Meuleman <meuleman@broadcom.com>
  22878. -Date: Fri, 18 Sep 2015 22:08:10 +0200
  22879. -Subject: [PATCH] brcmfmac: Make p2pon module param always available.
  22880. -
  22881. -p2pon module param is currently under define BRCMDBG. Though it is
  22882. -a needed option for older versions of the wpa_supplicant which do not
  22883. -support the P2P_DEVICE interface.
  22884. -
  22885. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  22886. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  22887. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  22888. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  22889. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  22890. ----
  22891. -
  22892. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  22893. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  22894. -@@ -62,10 +62,8 @@ MODULE_PARM_DESC(debug, "level of debug
  22895. -
  22896. - /* P2P0 enable */
  22897. - static int brcmf_p2p_enable;
  22898. --#ifdef CPTCFG_BRCMDBG
  22899. - module_param_named(p2pon, brcmf_p2p_enable, int, 0);
  22900. --MODULE_PARM_DESC(p2pon, "enable p2p management functionality");
  22901. --#endif
  22902. -+MODULE_PARM_DESC(p2pon, "enable legacy p2p management functionality");
  22903. -
  22904. - char *brcmf_ifname(struct brcmf_pub *drvr, int ifidx)
  22905. - {
  22906. diff --git a/package/kernel/mac80211/patches/370-0008-brcmfmac-Workaround-in-change-vif-for-wpa_supplicant.patch b/package/kernel/mac80211/patches/370-0008-brcmfmac-Workaround-in-change-vif-for-wpa_supplicant.patch
  22907. deleted file mode 100644
  22908. index 15ac2d9..0000000
  22909. --- a/package/kernel/mac80211/patches/370-0008-brcmfmac-Workaround-in-change-vif-for-wpa_supplicant.patch
  22910. +++ /dev/null
  22911. @@ -1,76 +0,0 @@
  22912. -From: Hante Meuleman <meuleman@broadcom.com>
  22913. -Date: Fri, 18 Sep 2015 22:08:11 +0200
  22914. -Subject: [PATCH] brcmfmac: Workaround in change vif for wpa_supplicant
  22915. - support.
  22916. -
  22917. -Different wpa_supplicants have different behavior and expectations
  22918. -regarding the change_virtual_intf behavior. This patch implements
  22919. -a workaround for the different versions and possible brcmfmac
  22920. -configuration.
  22921. -
  22922. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  22923. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  22924. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  22925. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  22926. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  22927. ----
  22928. -
  22929. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  22930. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  22931. -@@ -776,6 +776,37 @@ brcmf_cfg80211_change_iface(struct wiphy
  22932. - s32 err = 0;
  22933. -
  22934. - brcmf_dbg(TRACE, "Enter, idx=%d, type=%d\n", ifp->bssidx, type);
  22935. -+
  22936. -+ /* WAR: There are a number of p2p interface related problems which
  22937. -+ * need to be handled initially (before doing the validate).
  22938. -+ * wpa_supplicant tends to do iface changes on p2p device/client/go
  22939. -+ * which are not always possible/allowed. However we need to return
  22940. -+ * OK otherwise the wpa_supplicant wont start. The situation differs
  22941. -+ * on configuration and setup (p2pon=1 module param). The first check
  22942. -+ * is to see if the request is a change to station for p2p iface.
  22943. -+ */
  22944. -+ if ((type == NL80211_IFTYPE_STATION) &&
  22945. -+ ((vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT) ||
  22946. -+ (vif->wdev.iftype == NL80211_IFTYPE_P2P_GO) ||
  22947. -+ (vif->wdev.iftype == NL80211_IFTYPE_P2P_DEVICE))) {
  22948. -+ brcmf_dbg(TRACE, "Ignoring cmd for p2p if\n");
  22949. -+ /* Now depending on whether module param p2pon=1 was used the
  22950. -+ * response needs to be either 0 or EOPNOTSUPP. The reason is
  22951. -+ * that if p2pon=1 is used, but a newer supplicant is used then
  22952. -+ * we should return an error, as this combination wont work.
  22953. -+ * In other situations 0 is returned and supplicant will start
  22954. -+ * normally. It will give a trace in cfg80211, but it is the
  22955. -+ * only way to get it working. Unfortunately this will result
  22956. -+ * in situation where we wont support new supplicant in
  22957. -+ * combination with module param p2pon=1, but that is the way
  22958. -+ * it is. If the user tries this then unloading of driver might
  22959. -+ * fail/lock.
  22960. -+ */
  22961. -+ if (cfg->p2p.p2pdev_dynamically)
  22962. -+ return -EOPNOTSUPP;
  22963. -+ else
  22964. -+ return 0;
  22965. -+ }
  22966. - err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type);
  22967. - if (err) {
  22968. - brcmf_err("iface validation failed: err=%d\n", err);
  22969. -@@ -791,18 +822,6 @@ brcmf_cfg80211_change_iface(struct wiphy
  22970. - infra = 0;
  22971. - break;
  22972. - case NL80211_IFTYPE_STATION:
  22973. -- /* Ignore change for p2p IF. Unclear why supplicant does this */
  22974. -- if ((vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT) ||
  22975. -- (vif->wdev.iftype == NL80211_IFTYPE_P2P_GO)) {
  22976. -- brcmf_dbg(TRACE, "Ignoring cmd for p2p if\n");
  22977. -- /* WAR: It is unexpected to get a change of VIF for P2P
  22978. -- * IF, but it happens. The request can not be handled
  22979. -- * but returning EPERM causes a crash. Returning 0
  22980. -- * without setting ieee80211_ptr->iftype causes trace
  22981. -- * (WARN_ON) but it works with wpa_supplicant
  22982. -- */
  22983. -- return 0;
  22984. -- }
  22985. - infra = 1;
  22986. - break;
  22987. - case NL80211_IFTYPE_AP:
  22988. diff --git a/package/kernel/mac80211/patches/370-0009-brcmfmac-Deleting-of-p2p-device-is-leaking-memory.patch b/package/kernel/mac80211/patches/370-0009-brcmfmac-Deleting-of-p2p-device-is-leaking-memory.patch
  22989. deleted file mode 100644
  22990. index 1988b5c..0000000
  22991. --- a/package/kernel/mac80211/patches/370-0009-brcmfmac-Deleting-of-p2p-device-is-leaking-memory.patch
  22992. +++ /dev/null
  22993. @@ -1,124 +0,0 @@
  22994. -From: Hante Meuleman <meuleman@broadcom.com>
  22995. -Date: Fri, 18 Sep 2015 22:08:12 +0200
  22996. -Subject: [PATCH] brcmfmac: Deleting of p2p device is leaking memory.
  22997. -
  22998. -When a p2p device gets deleted, the memory for the vif is not being
  22999. -released. This is solved by reorganizing the cleanup path and
  23000. -properly freeing the memory.
  23001. -
  23002. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  23003. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  23004. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  23005. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  23006. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  23007. ----
  23008. -
  23009. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  23010. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  23011. -@@ -887,6 +887,16 @@ static void brcmf_del_if(struct brcmf_pu
  23012. - cancel_work_sync(&ifp->multicast_work);
  23013. - }
  23014. - brcmf_net_detach(ifp->ndev);
  23015. -+ } else {
  23016. -+ /* Only p2p device interfaces which get dynamically created
  23017. -+ * end up here. In this case the p2p module should be informed
  23018. -+ * about the removal of the interface within the firmware. If
  23019. -+ * not then p2p commands towards the firmware will cause some
  23020. -+ * serious troublesome side effects. The p2p module will clean
  23021. -+ * up the ifp if needed.
  23022. -+ */
  23023. -+ brcmf_p2p_ifp_removed(ifp);
  23024. -+ kfree(ifp);
  23025. - }
  23026. - }
  23027. -
  23028. -@@ -894,7 +904,8 @@ void brcmf_remove_interface(struct brcmf
  23029. - {
  23030. - if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bssidx] != ifp))
  23031. - return;
  23032. --
  23033. -+ brcmf_dbg(TRACE, "Enter, bssidx=%d, ifidx=%d\n", ifp->bssidx,
  23034. -+ ifp->ifidx);
  23035. - brcmf_fws_del_interface(ifp);
  23036. - brcmf_del_if(ifp->drvr, ifp->bssidx);
  23037. - }
  23038. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  23039. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  23040. -@@ -2131,20 +2131,6 @@ fail:
  23041. - }
  23042. -
  23043. - /**
  23044. -- * brcmf_p2p_delete_p2pdev() - delete P2P_DEVICE virtual interface.
  23045. -- *
  23046. -- * @vif: virtual interface object to delete.
  23047. -- */
  23048. --static void brcmf_p2p_delete_p2pdev(struct brcmf_p2p_info *p2p,
  23049. -- struct brcmf_cfg80211_vif *vif)
  23050. --{
  23051. -- cfg80211_unregister_wdev(&vif->wdev);
  23052. -- p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  23053. -- brcmf_remove_interface(vif->ifp);
  23054. -- brcmf_free_vif(vif);
  23055. --}
  23056. --
  23057. --/**
  23058. - * brcmf_p2p_add_vif() - create a new P2P virtual interface.
  23059. - *
  23060. - * @wiphy: wiphy device of new interface.
  23061. -@@ -2264,9 +2250,11 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  23062. - break;
  23063. -
  23064. - case NL80211_IFTYPE_P2P_DEVICE:
  23065. -+ if (!p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif)
  23066. -+ return 0;
  23067. - brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  23068. - brcmf_p2p_deinit_discovery(p2p);
  23069. -- brcmf_p2p_delete_p2pdev(p2p, vif);
  23070. -+ brcmf_remove_interface(vif->ifp);
  23071. - return 0;
  23072. - default:
  23073. - return -ENOTSUPP;
  23074. -@@ -2298,6 +2286,21 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  23075. - return err;
  23076. - }
  23077. -
  23078. -+void brcmf_p2p_ifp_removed(struct brcmf_if *ifp)
  23079. -+{
  23080. -+ struct brcmf_cfg80211_info *cfg;
  23081. -+ struct brcmf_cfg80211_vif *vif;
  23082. -+
  23083. -+ brcmf_dbg(INFO, "P2P: device interface removed\n");
  23084. -+ vif = ifp->vif;
  23085. -+ cfg = wdev_to_cfg(&vif->wdev);
  23086. -+ cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  23087. -+ rtnl_lock();
  23088. -+ cfg80211_unregister_wdev(&vif->wdev);
  23089. -+ rtnl_unlock();
  23090. -+ brcmf_free_vif(vif);
  23091. -+}
  23092. -+
  23093. - int brcmf_p2p_start_device(struct wiphy *wiphy, struct wireless_dev *wdev)
  23094. - {
  23095. - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  23096. -@@ -2422,10 +2425,7 @@ void brcmf_p2p_detach(struct brcmf_p2p_i
  23097. - if (vif != NULL) {
  23098. - brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  23099. - brcmf_p2p_deinit_discovery(p2p);
  23100. -- /* remove discovery interface */
  23101. -- rtnl_lock();
  23102. -- brcmf_p2p_delete_p2pdev(p2p, vif);
  23103. -- rtnl_unlock();
  23104. -+ brcmf_remove_interface(vif->ifp);
  23105. - }
  23106. - /* just set it all to zero */
  23107. - memset(p2p, 0, sizeof(*p2p));
  23108. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.h
  23109. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.h
  23110. -@@ -156,6 +156,7 @@ struct wireless_dev *brcmf_p2p_add_vif(s
  23111. - int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev);
  23112. - int brcmf_p2p_ifchange(struct brcmf_cfg80211_info *cfg,
  23113. - enum brcmf_fil_p2p_if_types if_type);
  23114. -+void brcmf_p2p_ifp_removed(struct brcmf_if *ifp);
  23115. - int brcmf_p2p_start_device(struct wiphy *wiphy, struct wireless_dev *wdev);
  23116. - void brcmf_p2p_stop_device(struct wiphy *wiphy, struct wireless_dev *wdev);
  23117. - int brcmf_p2p_scan_prep(struct wiphy *wiphy,
  23118. diff --git a/package/kernel/mac80211/patches/370-0010-brcmfmac-Only-handle-p2p_stop_device-if-vif-is-valid.patch b/package/kernel/mac80211/patches/370-0010-brcmfmac-Only-handle-p2p_stop_device-if-vif-is-valid.patch
  23119. deleted file mode 100644
  23120. index 5225c9e..0000000
  23121. --- a/package/kernel/mac80211/patches/370-0010-brcmfmac-Only-handle-p2p_stop_device-if-vif-is-valid.patch
  23122. +++ /dev/null
  23123. @@ -1,40 +0,0 @@
  23124. -From: Hante Meuleman <meuleman@broadcom.com>
  23125. -Date: Fri, 18 Sep 2015 22:08:13 +0200
  23126. -Subject: [PATCH] brcmfmac: Only handle p2p_stop_device if vif is valid
  23127. -
  23128. -In some situations it is possible that vif has been removed while
  23129. -cfg80211 invokes the p2p_stop_device handler. This will result in
  23130. -crash.
  23131. -
  23132. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  23133. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  23134. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  23135. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  23136. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  23137. ----
  23138. -
  23139. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  23140. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  23141. -@@ -2324,11 +2324,17 @@ void brcmf_p2p_stop_device(struct wiphy
  23142. - struct brcmf_cfg80211_vif *vif;
  23143. -
  23144. - vif = container_of(wdev, struct brcmf_cfg80211_vif, wdev);
  23145. -- mutex_lock(&cfg->usr_sync);
  23146. -- (void)brcmf_p2p_deinit_discovery(p2p);
  23147. -- brcmf_abort_scanning(cfg);
  23148. -- clear_bit(BRCMF_VIF_STATUS_READY, &vif->sme_state);
  23149. -- mutex_unlock(&cfg->usr_sync);
  23150. -+ /* This call can be result of the unregister_wdev call. In that case
  23151. -+ * we dont want to do anything anymore. Just return. The config vif
  23152. -+ * will have been cleared at this point.
  23153. -+ */
  23154. -+ if (p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif == vif) {
  23155. -+ mutex_lock(&cfg->usr_sync);
  23156. -+ (void)brcmf_p2p_deinit_discovery(p2p);
  23157. -+ brcmf_abort_scanning(cfg);
  23158. -+ clear_bit(BRCMF_VIF_STATUS_READY, &vif->sme_state);
  23159. -+ mutex_unlock(&cfg->usr_sync);
  23160. -+ }
  23161. - }
  23162. -
  23163. - /**
  23164. diff --git a/package/kernel/mac80211/patches/370-0011-brcmfmac-Fix-p2p-bug-for-older-firmwares.patch b/package/kernel/mac80211/patches/370-0011-brcmfmac-Fix-p2p-bug-for-older-firmwares.patch
  23165. deleted file mode 100644
  23166. index e2f24e8..0000000
  23167. --- a/package/kernel/mac80211/patches/370-0011-brcmfmac-Fix-p2p-bug-for-older-firmwares.patch
  23168. +++ /dev/null
  23169. @@ -1,35 +0,0 @@
  23170. -From: Hante Meuleman <meuleman@broadcom.com>
  23171. -Date: Fri, 18 Sep 2015 22:08:14 +0200
  23172. -Subject: [PATCH] brcmfmac: Fix p2p bug for older firmwares.
  23173. -
  23174. -Some devices with older firmwares are reporting new p2p device
  23175. -interface with the wrong type. Accept this type to get p2p
  23176. -working for these devices.
  23177. -
  23178. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  23179. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  23180. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  23181. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  23182. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  23183. ----
  23184. -
  23185. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  23186. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  23187. -@@ -186,11 +186,13 @@ static void brcmf_fweh_handle_if_event(s
  23188. - ifevent->action, ifevent->ifidx, ifevent->bssidx,
  23189. - ifevent->flags, ifevent->role);
  23190. -
  23191. -- /* The P2P Device interface event must not be ignored
  23192. -- * contrary to what firmware tells us.
  23193. -+ /* The P2P Device interface event must not be ignored contrary to what
  23194. -+ * firmware tells us. Older firmware uses p2p noif, with sta role.
  23195. -+ * This should be accepted.
  23196. - */
  23197. -- is_p2pdev = (ifevent->flags & BRCMF_E_IF_FLAG_NOIF) &&
  23198. -- ifevent->role == BRCMF_E_IF_ROLE_P2P_CLIENT;
  23199. -+ is_p2pdev = ((ifevent->flags & BRCMF_E_IF_FLAG_NOIF) &&
  23200. -+ (ifevent->role == BRCMF_E_IF_ROLE_P2P_CLIENT ||
  23201. -+ ifevent->role == BRCMF_E_IF_ROLE_STA));
  23202. - if (!is_p2pdev && (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) {
  23203. - brcmf_dbg(EVENT, "event can be ignored\n");
  23204. - return;
  23205. diff --git a/package/kernel/mac80211/patches/370-0012-brcmfmac-Add-module-parameter-to-disable-features.patch b/package/kernel/mac80211/patches/370-0012-brcmfmac-Add-module-parameter-to-disable-features.patch
  23206. deleted file mode 100644
  23207. index 52c787f..0000000
  23208. --- a/package/kernel/mac80211/patches/370-0012-brcmfmac-Add-module-parameter-to-disable-features.patch
  23209. +++ /dev/null
  23210. @@ -1,54 +0,0 @@
  23211. -From: Hante Meuleman <meuleman@broadcom.com>
  23212. -Date: Fri, 18 Sep 2015 22:08:15 +0200
  23213. -Subject: [PATCH] brcmfmac: Add module parameter to disable features.
  23214. -
  23215. -For debugging purpose it is very handy to be able to disable
  23216. -features. It has happened a few times that new features turned
  23217. -out not always being properly detected for all devices/firmwares.
  23218. -Making it possible to disable the feature with a module parameter
  23219. -will make testing/debugging easier.
  23220. -
  23221. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  23222. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  23223. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  23224. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  23225. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  23226. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  23227. ----
  23228. -
  23229. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  23230. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  23231. -@@ -15,6 +15,7 @@
  23232. - */
  23233. -
  23234. - #include <linux/netdevice.h>
  23235. -+#include <linux/module.h>
  23236. -
  23237. - #include <brcm_hw_ids.h>
  23238. - #include "core.h"
  23239. -@@ -23,6 +24,12 @@
  23240. - #include "fwil.h"
  23241. - #include "feature.h"
  23242. -
  23243. -+
  23244. -+/* Module param feature_disable (global for all devices) */
  23245. -+static int brcmf_feature_disable;
  23246. -+module_param_named(feature_disable, brcmf_feature_disable, int, 0);
  23247. -+MODULE_PARM_DESC(feature_disable, "Disable features");
  23248. -+
  23249. - /*
  23250. - * expand feature list to array of feature strings.
  23251. - */
  23252. -@@ -131,6 +138,12 @@ void brcmf_feat_attach(struct brcmf_pub
  23253. - brcmf_feat_iovar_int_set(ifp, BRCMF_FEAT_MBSS, "mbss", 0);
  23254. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_P2P, "p2p");
  23255. -
  23256. -+ if (brcmf_feature_disable) {
  23257. -+ brcmf_dbg(INFO, "Features: 0x%02x, disable: 0x%02x\n",
  23258. -+ ifp->drvr->feat_flags, brcmf_feature_disable);
  23259. -+ ifp->drvr->feat_flags &= ~brcmf_feature_disable;
  23260. -+ }
  23261. -+
  23262. - /* set chip related quirks */
  23263. - switch (drvr->bus_if->chip) {
  23264. - case BRCM_CC_43236_CHIP_ID:
  23265. diff --git a/package/kernel/mac80211/patches/370-0013-brcmfmac-Fix-race-condition-bug-when-deleting-p2p-in.patch b/package/kernel/mac80211/patches/370-0013-brcmfmac-Fix-race-condition-bug-when-deleting-p2p-in.patch
  23266. deleted file mode 100644
  23267. index 58a638a..0000000
  23268. --- a/package/kernel/mac80211/patches/370-0013-brcmfmac-Fix-race-condition-bug-when-deleting-p2p-in.patch
  23269. +++ /dev/null
  23270. @@ -1,80 +0,0 @@
  23271. -From: Hante Meuleman <meuleman@broadcom.com>
  23272. -Date: Fri, 18 Sep 2015 22:08:16 +0200
  23273. -Subject: [PATCH] brcmfmac: Fix race condition bug when deleting p2p interface.
  23274. -
  23275. -When p2p device interface gets deleted by deinitialising discovery
  23276. -it will result in an event which removes the interface, but that is
  23277. -also done by delete p2p interface code. This results in race
  23278. -condition which sometimes results in lockup/crash. With this patch
  23279. -the delete device interface will wait for the event (with timeout)
  23280. -removing the possible race condition. Also on the stop device call
  23281. -from cfg80211 the deinitialisation of the discovery device should
  23282. -be avoided as it can result in a similar situation.
  23283. -
  23284. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  23285. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  23286. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  23287. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  23288. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  23289. ----
  23290. -
  23291. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  23292. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  23293. -@@ -2238,6 +2238,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  23294. - brcmf_dbg(TRACE, "delete P2P vif\n");
  23295. - vif = container_of(wdev, struct brcmf_cfg80211_vif, wdev);
  23296. -
  23297. -+ brcmf_cfg80211_arm_vif_event(cfg, vif);
  23298. - switch (vif->wdev.iftype) {
  23299. - case NL80211_IFTYPE_P2P_CLIENT:
  23300. - if (test_bit(BRCMF_VIF_STATUS_DISCONNECTING, &vif->sme_state))
  23301. -@@ -2254,8 +2255,6 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  23302. - return 0;
  23303. - brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  23304. - brcmf_p2p_deinit_discovery(p2p);
  23305. -- brcmf_remove_interface(vif->ifp);
  23306. -- return 0;
  23307. - default:
  23308. - return -ENOTSUPP;
  23309. - }
  23310. -@@ -2267,10 +2266,11 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  23311. - wait_for_completion_timeout(&cfg->vif_disabled,
  23312. - msecs_to_jiffies(500));
  23313. -
  23314. -- brcmf_vif_clear_mgmt_ies(vif);
  23315. --
  23316. -- brcmf_cfg80211_arm_vif_event(cfg, vif);
  23317. -- err = brcmf_p2p_release_p2p_if(vif);
  23318. -+ err = 0;
  23319. -+ if (vif->wdev.iftype != NL80211_IFTYPE_P2P_DEVICE) {
  23320. -+ brcmf_vif_clear_mgmt_ies(vif);
  23321. -+ err = brcmf_p2p_release_p2p_if(vif);
  23322. -+ }
  23323. - if (!err) {
  23324. - /* wait for firmware event */
  23325. - err = brcmf_cfg80211_wait_vif_event_timeout(cfg, BRCMF_E_IF_DEL,
  23326. -@@ -2280,8 +2280,12 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  23327. - else
  23328. - err = 0;
  23329. - }
  23330. -+ if (err)
  23331. -+ brcmf_remove_interface(vif->ifp);
  23332. -+
  23333. - brcmf_cfg80211_arm_vif_event(cfg, NULL);
  23334. -- p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif = NULL;
  23335. -+ if (vif->wdev.iftype != NL80211_IFTYPE_P2P_DEVICE)
  23336. -+ p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif = NULL;
  23337. -
  23338. - return err;
  23339. - }
  23340. -@@ -2330,7 +2334,9 @@ void brcmf_p2p_stop_device(struct wiphy
  23341. - */
  23342. - if (p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif == vif) {
  23343. - mutex_lock(&cfg->usr_sync);
  23344. -- (void)brcmf_p2p_deinit_discovery(p2p);
  23345. -+ /* Set the discovery state to SCAN */
  23346. -+ (void)brcmf_p2p_set_discover_state(vif->ifp,
  23347. -+ WL_P2P_DISC_ST_SCAN, 0, 0);
  23348. - brcmf_abort_scanning(cfg);
  23349. - clear_bit(BRCMF_VIF_STATUS_READY, &vif->sme_state);
  23350. - mutex_unlock(&cfg->usr_sync);
  23351. diff --git a/package/kernel/mac80211/patches/370-0014-brcmfmac-Add-support-for-the-BCM4365-and-BCM4366-PCI.patch b/package/kernel/mac80211/patches/370-0014-brcmfmac-Add-support-for-the-BCM4365-and-BCM4366-PCI.patch
  23352. deleted file mode 100644
  23353. index d0bbf2a..0000000
  23354. --- a/package/kernel/mac80211/patches/370-0014-brcmfmac-Add-support-for-the-BCM4365-and-BCM4366-PCI.patch
  23355. +++ /dev/null
  23356. @@ -1,277 +0,0 @@
  23357. -From: Hante Meuleman <meuleman@broadcom.com>
  23358. -Date: Fri, 18 Sep 2015 22:08:17 +0200
  23359. -Subject: [PATCH] brcmfmac: Add support for the BCM4365 and BCM4366 PCIE
  23360. - devices.
  23361. -
  23362. -This patch adds support for the BCM4365 and BCM4366 11ac Wave2
  23363. -PCIE devices.
  23364. -
  23365. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  23366. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  23367. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  23368. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  23369. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  23370. ----
  23371. -
  23372. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  23373. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  23374. -@@ -208,6 +208,7 @@ struct sbsocramregs {
  23375. - };
  23376. -
  23377. - #define SOCRAMREGOFFS(_f) offsetof(struct sbsocramregs, _f)
  23378. -+#define SYSMEMREGOFFS(_f) offsetof(struct sbsocramregs, _f)
  23379. -
  23380. - #define ARMCR4_CAP (0x04)
  23381. - #define ARMCR4_BANKIDX (0x40)
  23382. -@@ -516,6 +517,9 @@ static int brcmf_chip_cores_check(struct
  23383. - case BCMA_CORE_ARM_CR4:
  23384. - cpu_found = true;
  23385. - break;
  23386. -+ case BCMA_CORE_ARM_CA7:
  23387. -+ cpu_found = true;
  23388. -+ break;
  23389. - default:
  23390. - break;
  23391. - }
  23392. -@@ -614,6 +618,29 @@ static void brcmf_chip_socram_ramsize(st
  23393. - }
  23394. - }
  23395. -
  23396. -+/** Return the SYS MEM size */
  23397. -+static u32 brcmf_chip_sysmem_ramsize(struct brcmf_core_priv *sysmem)
  23398. -+{
  23399. -+ u32 memsize = 0;
  23400. -+ u32 coreinfo;
  23401. -+ u32 idx;
  23402. -+ u32 nb;
  23403. -+ u32 banksize;
  23404. -+
  23405. -+ if (!brcmf_chip_iscoreup(&sysmem->pub))
  23406. -+ brcmf_chip_resetcore(&sysmem->pub, 0, 0, 0);
  23407. -+
  23408. -+ coreinfo = brcmf_chip_core_read32(sysmem, SYSMEMREGOFFS(coreinfo));
  23409. -+ nb = (coreinfo & SRCI_SRNB_MASK) >> SRCI_SRNB_SHIFT;
  23410. -+
  23411. -+ for (idx = 0; idx < nb; idx++) {
  23412. -+ brcmf_chip_socram_banksize(sysmem, idx, &banksize);
  23413. -+ memsize += banksize;
  23414. -+ }
  23415. -+
  23416. -+ return memsize;
  23417. -+}
  23418. -+
  23419. - /** Return the TCM-RAM size of the ARMCR4 core. */
  23420. - static u32 brcmf_chip_tcm_ramsize(struct brcmf_core_priv *cr4)
  23421. - {
  23422. -@@ -656,6 +683,9 @@ static u32 brcmf_chip_tcm_rambase(struct
  23423. - case BRCM_CC_4358_CHIP_ID:
  23424. - case BRCM_CC_43602_CHIP_ID:
  23425. - return 0x180000;
  23426. -+ case BRCM_CC_4365_CHIP_ID:
  23427. -+ case BRCM_CC_4366_CHIP_ID:
  23428. -+ return 0x200000;
  23429. - default:
  23430. - brcmf_err("unknown chip: %s\n", ci->pub.name);
  23431. - break;
  23432. -@@ -678,10 +708,28 @@ static int brcmf_chip_get_raminfo(struct
  23433. - return -EINVAL;
  23434. - }
  23435. - } else {
  23436. -- mem = brcmf_chip_get_core(&ci->pub, BCMA_CORE_INTERNAL_MEM);
  23437. -- mem_core = container_of(mem, struct brcmf_core_priv, pub);
  23438. -- brcmf_chip_socram_ramsize(mem_core, &ci->pub.ramsize,
  23439. -- &ci->pub.srsize);
  23440. -+ mem = brcmf_chip_get_core(&ci->pub, BCMA_CORE_SYS_MEM);
  23441. -+ if (mem) {
  23442. -+ mem_core = container_of(mem, struct brcmf_core_priv,
  23443. -+ pub);
  23444. -+ ci->pub.ramsize = brcmf_chip_sysmem_ramsize(mem_core);
  23445. -+ ci->pub.rambase = brcmf_chip_tcm_rambase(ci);
  23446. -+ if (!ci->pub.rambase) {
  23447. -+ brcmf_err("RAM base not provided with ARM CA7 core\n");
  23448. -+ return -EINVAL;
  23449. -+ }
  23450. -+ } else {
  23451. -+ mem = brcmf_chip_get_core(&ci->pub,
  23452. -+ BCMA_CORE_INTERNAL_MEM);
  23453. -+ if (!mem) {
  23454. -+ brcmf_err("No memory cores found\n");
  23455. -+ return -ENOMEM;
  23456. -+ }
  23457. -+ mem_core = container_of(mem, struct brcmf_core_priv,
  23458. -+ pub);
  23459. -+ brcmf_chip_socram_ramsize(mem_core, &ci->pub.ramsize,
  23460. -+ &ci->pub.srsize);
  23461. -+ }
  23462. - }
  23463. - brcmf_dbg(INFO, "RAM: base=0x%x size=%d (0x%x) sr=%d (0x%x)\n",
  23464. - ci->pub.rambase, ci->pub.ramsize, ci->pub.ramsize,
  23465. -@@ -924,7 +972,7 @@ static int brcmf_chip_recognition(struct
  23466. - static void brcmf_chip_disable_arm(struct brcmf_chip_priv *chip, u16 id)
  23467. - {
  23468. - struct brcmf_core *core;
  23469. -- struct brcmf_core_priv *cr4;
  23470. -+ struct brcmf_core_priv *cpu;
  23471. - u32 val;
  23472. -
  23473. -
  23474. -@@ -937,10 +985,11 @@ static void brcmf_chip_disable_arm(struc
  23475. - brcmf_chip_coredisable(core, 0, 0);
  23476. - break;
  23477. - case BCMA_CORE_ARM_CR4:
  23478. -- cr4 = container_of(core, struct brcmf_core_priv, pub);
  23479. -+ case BCMA_CORE_ARM_CA7:
  23480. -+ cpu = container_of(core, struct brcmf_core_priv, pub);
  23481. -
  23482. - /* clear all IOCTL bits except HALT bit */
  23483. -- val = chip->ops->read32(chip->ctx, cr4->wrapbase + BCMA_IOCTL);
  23484. -+ val = chip->ops->read32(chip->ctx, cpu->wrapbase + BCMA_IOCTL);
  23485. - val &= ARMCR4_BCMA_IOCTL_CPUHALT;
  23486. - brcmf_chip_resetcore(core, val, ARMCR4_BCMA_IOCTL_CPUHALT,
  23487. - ARMCR4_BCMA_IOCTL_CPUHALT);
  23488. -@@ -1162,6 +1211,33 @@ static bool brcmf_chip_cr4_set_active(st
  23489. - return true;
  23490. - }
  23491. -
  23492. -+static inline void
  23493. -+brcmf_chip_ca7_set_passive(struct brcmf_chip_priv *chip)
  23494. -+{
  23495. -+ struct brcmf_core *core;
  23496. -+
  23497. -+ brcmf_chip_disable_arm(chip, BCMA_CORE_ARM_CA7);
  23498. -+
  23499. -+ core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_80211);
  23500. -+ brcmf_chip_resetcore(core, D11_BCMA_IOCTL_PHYRESET |
  23501. -+ D11_BCMA_IOCTL_PHYCLOCKEN,
  23502. -+ D11_BCMA_IOCTL_PHYCLOCKEN,
  23503. -+ D11_BCMA_IOCTL_PHYCLOCKEN);
  23504. -+}
  23505. -+
  23506. -+static bool brcmf_chip_ca7_set_active(struct brcmf_chip_priv *chip, u32 rstvec)
  23507. -+{
  23508. -+ struct brcmf_core *core;
  23509. -+
  23510. -+ chip->ops->activate(chip->ctx, &chip->pub, rstvec);
  23511. -+
  23512. -+ /* restore ARM */
  23513. -+ core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_ARM_CA7);
  23514. -+ brcmf_chip_resetcore(core, ARMCR4_BCMA_IOCTL_CPUHALT, 0, 0);
  23515. -+
  23516. -+ return true;
  23517. -+}
  23518. -+
  23519. - void brcmf_chip_set_passive(struct brcmf_chip *pub)
  23520. - {
  23521. - struct brcmf_chip_priv *chip;
  23522. -@@ -1175,8 +1251,16 @@ void brcmf_chip_set_passive(struct brcmf
  23523. - brcmf_chip_cr4_set_passive(chip);
  23524. - return;
  23525. - }
  23526. --
  23527. -- brcmf_chip_cm3_set_passive(chip);
  23528. -+ arm = brcmf_chip_get_core(pub, BCMA_CORE_ARM_CA7);
  23529. -+ if (arm) {
  23530. -+ brcmf_chip_ca7_set_passive(chip);
  23531. -+ return;
  23532. -+ }
  23533. -+ arm = brcmf_chip_get_core(pub, BCMA_CORE_ARM_CM3);
  23534. -+ if (arm) {
  23535. -+ brcmf_chip_cm3_set_passive(chip);
  23536. -+ return;
  23537. -+ }
  23538. - }
  23539. -
  23540. - bool brcmf_chip_set_active(struct brcmf_chip *pub, u32 rstvec)
  23541. -@@ -1190,8 +1274,14 @@ bool brcmf_chip_set_active(struct brcmf_
  23542. - arm = brcmf_chip_get_core(pub, BCMA_CORE_ARM_CR4);
  23543. - if (arm)
  23544. - return brcmf_chip_cr4_set_active(chip, rstvec);
  23545. -+ arm = brcmf_chip_get_core(pub, BCMA_CORE_ARM_CA7);
  23546. -+ if (arm)
  23547. -+ return brcmf_chip_ca7_set_active(chip, rstvec);
  23548. -+ arm = brcmf_chip_get_core(pub, BCMA_CORE_ARM_CM3);
  23549. -+ if (arm)
  23550. -+ return brcmf_chip_cm3_set_active(chip);
  23551. -
  23552. -- return brcmf_chip_cm3_set_active(chip);
  23553. -+ return false;
  23554. - }
  23555. -
  23556. - bool brcmf_chip_sr_capable(struct brcmf_chip *pub)
  23557. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  23558. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  23559. -@@ -55,6 +55,10 @@ enum brcmf_pcie_state {
  23560. - #define BRCMF_PCIE_43570_NVRAM_NAME "brcm/brcmfmac43570-pcie.txt"
  23561. - #define BRCMF_PCIE_4358_FW_NAME "brcm/brcmfmac4358-pcie.bin"
  23562. - #define BRCMF_PCIE_4358_NVRAM_NAME "brcm/brcmfmac4358-pcie.txt"
  23563. -+#define BRCMF_PCIE_4365_FW_NAME "brcm/brcmfmac4365b-pcie.bin"
  23564. -+#define BRCMF_PCIE_4365_NVRAM_NAME "brcm/brcmfmac4365b-pcie.txt"
  23565. -+#define BRCMF_PCIE_4366_FW_NAME "brcm/brcmfmac4366b-pcie.bin"
  23566. -+#define BRCMF_PCIE_4366_NVRAM_NAME "brcm/brcmfmac4366b-pcie.txt"
  23567. -
  23568. - #define BRCMF_PCIE_FW_UP_TIMEOUT 2000 /* msec */
  23569. -
  23570. -@@ -204,6 +208,10 @@ MODULE_FIRMWARE(BRCMF_PCIE_43570_FW_NAME
  23571. - MODULE_FIRMWARE(BRCMF_PCIE_43570_NVRAM_NAME);
  23572. - MODULE_FIRMWARE(BRCMF_PCIE_4358_FW_NAME);
  23573. - MODULE_FIRMWARE(BRCMF_PCIE_4358_NVRAM_NAME);
  23574. -+MODULE_FIRMWARE(BRCMF_PCIE_4365_FW_NAME);
  23575. -+MODULE_FIRMWARE(BRCMF_PCIE_4365_NVRAM_NAME);
  23576. -+MODULE_FIRMWARE(BRCMF_PCIE_4366_FW_NAME);
  23577. -+MODULE_FIRMWARE(BRCMF_PCIE_4366_NVRAM_NAME);
  23578. -
  23579. -
  23580. - struct brcmf_pcie_console {
  23581. -@@ -1440,6 +1448,14 @@ static int brcmf_pcie_get_fwnames(struct
  23582. - fw_name = BRCMF_PCIE_4358_FW_NAME;
  23583. - nvram_name = BRCMF_PCIE_4358_NVRAM_NAME;
  23584. - break;
  23585. -+ case BRCM_CC_4365_CHIP_ID:
  23586. -+ fw_name = BRCMF_PCIE_4365_FW_NAME;
  23587. -+ nvram_name = BRCMF_PCIE_4365_NVRAM_NAME;
  23588. -+ break;
  23589. -+ case BRCM_CC_4366_CHIP_ID:
  23590. -+ fw_name = BRCMF_PCIE_4366_FW_NAME;
  23591. -+ nvram_name = BRCMF_PCIE_4366_NVRAM_NAME;
  23592. -+ break;
  23593. - default:
  23594. - brcmf_err("Unsupported chip 0x%04x\n", devinfo->ci->chip);
  23595. - return -ENODEV;
  23596. -@@ -1973,6 +1989,12 @@ static struct pci_device_id brcmf_pcie_d
  23597. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_2G_DEVICE_ID),
  23598. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_5G_DEVICE_ID),
  23599. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_RAW_DEVICE_ID),
  23600. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_DEVICE_ID),
  23601. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_2G_DEVICE_ID),
  23602. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_5G_DEVICE_ID),
  23603. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_DEVICE_ID),
  23604. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_2G_DEVICE_ID),
  23605. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_5G_DEVICE_ID),
  23606. - { /* end: all zeroes */ }
  23607. - };
  23608. -
  23609. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  23610. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  23611. -@@ -48,6 +48,8 @@
  23612. - #define BRCM_CC_43570_CHIP_ID 43570
  23613. - #define BRCM_CC_4358_CHIP_ID 0x4358
  23614. - #define BRCM_CC_43602_CHIP_ID 43602
  23615. -+#define BRCM_CC_4365_CHIP_ID 0x4365
  23616. -+#define BRCM_CC_4366_CHIP_ID 0x4366
  23617. -
  23618. - /* USB Device IDs */
  23619. - #define BRCM_USB_43143_DEVICE_ID 0xbd1e
  23620. -@@ -67,6 +69,13 @@
  23621. - #define BRCM_PCIE_43602_2G_DEVICE_ID 0x43bb
  23622. - #define BRCM_PCIE_43602_5G_DEVICE_ID 0x43bc
  23623. - #define BRCM_PCIE_43602_RAW_DEVICE_ID 43602
  23624. -+#define BRCM_PCIE_4365_DEVICE_ID 0x43ca
  23625. -+#define BRCM_PCIE_4365_2G_DEVICE_ID 0x43cb
  23626. -+#define BRCM_PCIE_4365_5G_DEVICE_ID 0x43cc
  23627. -+#define BRCM_PCIE_4366_DEVICE_ID 0x43c3
  23628. -+#define BRCM_PCIE_4366_2G_DEVICE_ID 0x43c4
  23629. -+#define BRCM_PCIE_4366_5G_DEVICE_ID 0x43c5
  23630. -+
  23631. -
  23632. - /* brcmsmac IDs */
  23633. - #define BCM4313_D11N2G_ID 0x4727 /* 4313 802.11n 2.4G device */
  23634. diff --git a/package/kernel/mac80211/patches/370-0015-brcmfmac-Fix-TDLS-setup-by-properly-handling-p2p-noi.patch b/package/kernel/mac80211/patches/370-0015-brcmfmac-Fix-TDLS-setup-by-properly-handling-p2p-noi.patch
  23635. deleted file mode 100644
  23636. index d33c803..0000000
  23637. --- a/package/kernel/mac80211/patches/370-0015-brcmfmac-Fix-TDLS-setup-by-properly-handling-p2p-noi.patch
  23638. +++ /dev/null
  23639. @@ -1,120 +0,0 @@
  23640. -From: Hante Meuleman <meuleman@broadcom.com>
  23641. -Date: Fri, 18 Sep 2015 22:08:18 +0200
  23642. -Subject: [PATCH] brcmfmac: Fix TDLS setup by properly handling p2p noif.
  23643. -
  23644. -There is a workaround needed for p2p device setup which breaks tdls
  23645. -functionality. This patch fixes that by properly signalling fweh that
  23646. -p2p device setup is ongoing.
  23647. -
  23648. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  23649. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  23650. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  23651. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  23652. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  23653. ----
  23654. -
  23655. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  23656. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  23657. -@@ -188,11 +188,13 @@ static void brcmf_fweh_handle_if_event(s
  23658. -
  23659. - /* The P2P Device interface event must not be ignored contrary to what
  23660. - * firmware tells us. Older firmware uses p2p noif, with sta role.
  23661. -- * This should be accepted.
  23662. -+ * This should be accepted when p2pdev_setup is ongoing. TDLS setup will
  23663. -+ * use the same ifevent and should be ignored.
  23664. - */
  23665. - is_p2pdev = ((ifevent->flags & BRCMF_E_IF_FLAG_NOIF) &&
  23666. - (ifevent->role == BRCMF_E_IF_ROLE_P2P_CLIENT ||
  23667. -- ifevent->role == BRCMF_E_IF_ROLE_STA));
  23668. -+ ((ifevent->role == BRCMF_E_IF_ROLE_STA) &&
  23669. -+ (drvr->fweh.p2pdev_setup_ongoing))));
  23670. - if (!is_p2pdev && (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) {
  23671. - brcmf_dbg(EVENT, "event can be ignored\n");
  23672. - return;
  23673. -@@ -316,6 +318,17 @@ event_free:
  23674. - }
  23675. -
  23676. - /**
  23677. -+ * brcmf_fweh_p2pdev_setup() - P2P device setup ongoing (or not).
  23678. -+ *
  23679. -+ * @ifp: ifp on which setup is taking place or finished.
  23680. -+ * @ongoing: p2p device setup in progress (or not).
  23681. -+ */
  23682. -+void brcmf_fweh_p2pdev_setup(struct brcmf_if *ifp, bool ongoing)
  23683. -+{
  23684. -+ ifp->drvr->fweh.p2pdev_setup_ongoing = ongoing;
  23685. -+}
  23686. -+
  23687. -+/**
  23688. - * brcmf_fweh_attach() - initialize firmware event handling.
  23689. - *
  23690. - * @drvr: driver information object.
  23691. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  23692. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  23693. -@@ -230,12 +230,14 @@ typedef int (*brcmf_fweh_handler_t)(stru
  23694. - /**
  23695. - * struct brcmf_fweh_info - firmware event handling information.
  23696. - *
  23697. -+ * @p2pdev_setup_ongoing: P2P device creation in progress.
  23698. - * @event_work: event worker.
  23699. - * @evt_q_lock: lock for event queue protection.
  23700. - * @event_q: event queue.
  23701. - * @evt_handler: registered event handlers.
  23702. - */
  23703. - struct brcmf_fweh_info {
  23704. -+ bool p2pdev_setup_ongoing;
  23705. - struct work_struct event_work;
  23706. - spinlock_t evt_q_lock;
  23707. - struct list_head event_q;
  23708. -@@ -255,6 +257,7 @@ void brcmf_fweh_unregister(struct brcmf_
  23709. - int brcmf_fweh_activate_events(struct brcmf_if *ifp);
  23710. - void brcmf_fweh_process_event(struct brcmf_pub *drvr,
  23711. - struct brcmf_event *event_packet);
  23712. -+void brcmf_fweh_p2pdev_setup(struct brcmf_if *ifp, bool ongoing);
  23713. -
  23714. - static inline void brcmf_fweh_process_skb(struct brcmf_pub *drvr,
  23715. - struct sk_buff *skb)
  23716. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  23717. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  23718. -@@ -2084,11 +2084,13 @@ static struct wireless_dev *brcmf_p2p_cr
  23719. - brcmf_p2p_set_firmware(pri_ifp, p2p->dev_addr);
  23720. -
  23721. - brcmf_cfg80211_arm_vif_event(p2p->cfg, p2p_vif);
  23722. -+ brcmf_fweh_p2pdev_setup(pri_ifp, true);
  23723. -
  23724. - /* Initialize P2P Discovery in the firmware */
  23725. - err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1);
  23726. - if (err < 0) {
  23727. - brcmf_err("set p2p_disc error\n");
  23728. -+ brcmf_fweh_p2pdev_setup(pri_ifp, false);
  23729. - brcmf_cfg80211_arm_vif_event(p2p->cfg, NULL);
  23730. - goto fail;
  23731. - }
  23732. -@@ -2097,6 +2099,7 @@ static struct wireless_dev *brcmf_p2p_cr
  23733. - err = brcmf_cfg80211_wait_vif_event_timeout(p2p->cfg, BRCMF_E_IF_ADD,
  23734. - msecs_to_jiffies(1500));
  23735. - brcmf_cfg80211_arm_vif_event(p2p->cfg, NULL);
  23736. -+ brcmf_fweh_p2pdev_setup(pri_ifp, false);
  23737. - if (!err) {
  23738. - brcmf_err("timeout occurred\n");
  23739. - err = -EIO;
  23740. -@@ -2393,6 +2396,8 @@ s32 brcmf_p2p_attach(struct brcmf_cfg802
  23741. - memcpy(p2p_ifp->mac_addr, p2p->dev_addr, ETH_ALEN);
  23742. - brcmf_p2p_set_firmware(pri_ifp, p2p->dev_addr);
  23743. -
  23744. -+ brcmf_fweh_p2pdev_setup(pri_ifp, true);
  23745. -+
  23746. - /* Initialize P2P Discovery in the firmware */
  23747. - err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1);
  23748. - if (err < 0) {
  23749. -@@ -2419,8 +2424,9 @@ s32 brcmf_p2p_attach(struct brcmf_cfg802
  23750. - INIT_WORK(&p2p->afx_hdl.afx_work, brcmf_p2p_afx_handler);
  23751. - init_completion(&p2p->afx_hdl.act_frm_scan);
  23752. - init_completion(&p2p->wait_next_af);
  23753. -- }
  23754. - exit:
  23755. -+ brcmf_fweh_p2pdev_setup(pri_ifp, false);
  23756. -+ }
  23757. - return err;
  23758. - }
  23759. -
  23760. diff --git a/package/kernel/mac80211/patches/370-0016-brcmfmac-Accept-events-when-TDLS-is-used-in-combinat.patch b/package/kernel/mac80211/patches/370-0016-brcmfmac-Accept-events-when-TDLS-is-used-in-combinat.patch
  23761. deleted file mode 100644
  23762. index b880078..0000000
  23763. --- a/package/kernel/mac80211/patches/370-0016-brcmfmac-Accept-events-when-TDLS-is-used-in-combinat.patch
  23764. +++ /dev/null
  23765. @@ -1,29 +0,0 @@
  23766. -From: Hante Meuleman <meuleman@broadcom.com>
  23767. -Date: Fri, 18 Sep 2015 22:08:19 +0200
  23768. -Subject: [PATCH] brcmfmac: Accept events when TDLS is used in combination with
  23769. - p2p.
  23770. -
  23771. -TDLS events are mapped back to primary interface but when p2p is in
  23772. -use then this fails because the check was incorrect by checking
  23773. -bsscfg number. Which can be different when a p2p device has been
  23774. -created.
  23775. -
  23776. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  23777. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  23778. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  23779. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  23780. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  23781. ----
  23782. -
  23783. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  23784. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  23785. -@@ -300,8 +300,7 @@ static void brcmf_fweh_event_worker(stru
  23786. - goto event_free;
  23787. - }
  23788. -
  23789. -- if ((event->code == BRCMF_E_TDLS_PEER_EVENT) &&
  23790. -- (emsg.bsscfgidx == 1))
  23791. -+ if (event->code == BRCMF_E_TDLS_PEER_EVENT)
  23792. - ifp = drvr->iflist[0];
  23793. - else
  23794. - ifp = drvr->iflist[emsg.bsscfgidx];
  23795. diff --git a/package/kernel/mac80211/patches/371-brcmfmac-include-linux-atomic.h.patch b/package/kernel/mac80211/patches/371-brcmfmac-include-linux-atomic.h.patch
  23796. deleted file mode 100644
  23797. index 9311a9d..0000000
  23798. --- a/package/kernel/mac80211/patches/371-brcmfmac-include-linux-atomic.h.patch
  23799. +++ /dev/null
  23800. @@ -1,23 +0,0 @@
  23801. -From: Hauke Mehrtens <hauke@hauke-m.de>
  23802. -Date: Sat, 19 Sep 2015 12:47:20 +0200
  23803. -Subject: [PATCH] brcmfmac: include linux/atomic.h
  23804. -
  23805. -brcmfmac uses atomic_or() and other atomic_* functions, but does not
  23806. -include linux/atomic.h. This file gets included by some other header
  23807. -file so this normally does not cause problems.
  23808. -
  23809. -Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  23810. -Acked-by: Arend van Spriel <arend@broadcom.com>
  23811. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  23812. ----
  23813. -
  23814. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  23815. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  23816. -@@ -15,6 +15,7 @@
  23817. - */
  23818. -
  23819. - #include <linux/types.h>
  23820. -+#include <linux/atomic.h>
  23821. - #include <linux/kernel.h>
  23822. - #include <linux/kthread.h>
  23823. - #include <linux/printk.h>
  23824. diff --git a/package/kernel/mac80211/patches/372-0001-brcmfmac-expose-device-memory-to-devcoredump-subsyst.patch b/package/kernel/mac80211/patches/372-0001-brcmfmac-expose-device-memory-to-devcoredump-subsyst.patch
  23825. deleted file mode 100644
  23826. index cf3f278..0000000
  23827. --- a/package/kernel/mac80211/patches/372-0001-brcmfmac-expose-device-memory-to-devcoredump-subsyst.patch
  23828. +++ /dev/null
  23829. @@ -1,347 +0,0 @@
  23830. -From: Arend van Spriel <arend@broadcom.com>
  23831. -Date: Thu, 8 Oct 2015 20:33:11 +0200
  23832. -Subject: [PATCH] brcmfmac: expose device memory to devcoredump subsystem
  23833. -
  23834. -Upon PSM watchdog event received from firmware the driver will obtain
  23835. -a memory snapshot of the device and expose it to user-space through
  23836. -the devcoredump framework. This will trigger a uevent.
  23837. -
  23838. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  23839. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  23840. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  23841. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  23842. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  23843. ----
  23844. -
  23845. ---- a/drivers/net/wireless/brcm80211/Kconfig
  23846. -+++ b/drivers/net/wireless/brcm80211/Kconfig
  23847. -@@ -85,5 +85,6 @@ config BRCM_TRACING
  23848. - config BRCMDBG
  23849. - bool "Broadcom driver debug functions"
  23850. - depends on BRCMSMAC || BRCMFMAC
  23851. -+ select WANT_DEV_COREDUMP
  23852. - ---help---
  23853. - Selecting this enables additional code for debug purposes.
  23854. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bus.h
  23855. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bus.h
  23856. -@@ -65,6 +65,8 @@ struct brcmf_bus_dcmd {
  23857. - * @rxctl: receive a control response message from dongle.
  23858. - * @gettxq: obtain a reference of bus transmit queue (optional).
  23859. - * @wowl_config: specify if dongle is configured for wowl when going to suspend
  23860. -+ * @get_ramsize: obtain size of device memory.
  23861. -+ * @get_memdump: obtain device memory dump in provided buffer.
  23862. - *
  23863. - * This structure provides an abstract interface towards the
  23864. - * bus specific driver. For control messages to common driver
  23865. -@@ -79,6 +81,8 @@ struct brcmf_bus_ops {
  23866. - int (*rxctl)(struct device *dev, unsigned char *msg, uint len);
  23867. - struct pktq * (*gettxq)(struct device *dev);
  23868. - void (*wowl_config)(struct device *dev, bool enabled);
  23869. -+ size_t (*get_ramsize)(struct device *dev);
  23870. -+ int (*get_memdump)(struct device *dev, void *data, size_t len);
  23871. - };
  23872. -
  23873. -
  23874. -@@ -185,6 +189,23 @@ void brcmf_bus_wowl_config(struct brcmf_
  23875. - bus->ops->wowl_config(bus->dev, enabled);
  23876. - }
  23877. -
  23878. -+static inline size_t brcmf_bus_get_ramsize(struct brcmf_bus *bus)
  23879. -+{
  23880. -+ if (!bus->ops->get_ramsize)
  23881. -+ return 0;
  23882. -+
  23883. -+ return bus->ops->get_ramsize(bus->dev);
  23884. -+}
  23885. -+
  23886. -+static inline
  23887. -+int brcmf_bus_get_memdump(struct brcmf_bus *bus, void *data, size_t len)
  23888. -+{
  23889. -+ if (!bus->ops->get_memdump)
  23890. -+ return -EOPNOTSUPP;
  23891. -+
  23892. -+ return bus->ops->get_memdump(bus->dev, data, len);
  23893. -+}
  23894. -+
  23895. - /*
  23896. - * interface functions from common layer
  23897. - */
  23898. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  23899. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  23900. -@@ -957,8 +957,8 @@ int brcmf_attach(struct device *dev)
  23901. - drvr->bus_if = dev_get_drvdata(dev);
  23902. - drvr->bus_if->drvr = drvr;
  23903. -
  23904. -- /* create device debugfs folder */
  23905. -- brcmf_debugfs_attach(drvr);
  23906. -+ /* attach debug facilities */
  23907. -+ brcmf_debug_attach(drvr);
  23908. -
  23909. - /* Attach and link in the protocol */
  23910. - ret = brcmf_proto_attach(drvr);
  23911. -@@ -1155,7 +1155,7 @@ void brcmf_detach(struct device *dev)
  23912. -
  23913. - brcmf_proto_detach(drvr);
  23914. -
  23915. -- brcmf_debugfs_detach(drvr);
  23916. -+ brcmf_debug_detach(drvr);
  23917. - bus_if->drvr = NULL;
  23918. - kfree(drvr);
  23919. - }
  23920. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  23921. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  23922. -@@ -16,15 +16,45 @@
  23923. - #include <linux/debugfs.h>
  23924. - #include <linux/netdevice.h>
  23925. - #include <linux/module.h>
  23926. -+#include <linux/devcoredump.h>
  23927. -
  23928. - #include <brcmu_wifi.h>
  23929. - #include <brcmu_utils.h>
  23930. - #include "core.h"
  23931. - #include "bus.h"
  23932. -+#include "fweh.h"
  23933. - #include "debug.h"
  23934. -
  23935. - static struct dentry *root_folder;
  23936. -
  23937. -+static int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data,
  23938. -+ size_t len)
  23939. -+{
  23940. -+ void *dump;
  23941. -+ size_t ramsize;
  23942. -+
  23943. -+ ramsize = brcmf_bus_get_ramsize(bus);
  23944. -+ if (ramsize) {
  23945. -+ dump = vzalloc(len + ramsize);
  23946. -+ if (!dump)
  23947. -+ return -ENOMEM;
  23948. -+ memcpy(dump, data, len);
  23949. -+ brcmf_bus_get_memdump(bus, dump + len, ramsize);
  23950. -+ dev_coredumpv(bus->dev, dump, len + ramsize, GFP_KERNEL);
  23951. -+ }
  23952. -+ return 0;
  23953. -+}
  23954. -+
  23955. -+static int brcmf_debug_psm_watchdog_notify(struct brcmf_if *ifp,
  23956. -+ const struct brcmf_event_msg *evtmsg,
  23957. -+ void *data)
  23958. -+{
  23959. -+ brcmf_dbg(TRACE, "enter: idx=%d\n", ifp->bssidx);
  23960. -+
  23961. -+ return brcmf_debug_create_memdump(ifp->drvr->bus_if, data,
  23962. -+ evtmsg->datalen);
  23963. -+}
  23964. -+
  23965. - void brcmf_debugfs_init(void)
  23966. - {
  23967. - root_folder = debugfs_create_dir(KBUILD_MODNAME, NULL);
  23968. -@@ -41,7 +71,7 @@ void brcmf_debugfs_exit(void)
  23969. - root_folder = NULL;
  23970. - }
  23971. -
  23972. --int brcmf_debugfs_attach(struct brcmf_pub *drvr)
  23973. -+int brcmf_debug_attach(struct brcmf_pub *drvr)
  23974. - {
  23975. - struct device *dev = drvr->bus_if->dev;
  23976. -
  23977. -@@ -49,12 +79,18 @@ int brcmf_debugfs_attach(struct brcmf_pu
  23978. - return -ENODEV;
  23979. -
  23980. - drvr->dbgfs_dir = debugfs_create_dir(dev_name(dev), root_folder);
  23981. -+ if (IS_ERR(drvr->dbgfs_dir))
  23982. -+ return PTR_ERR(drvr->dbgfs_dir);
  23983. -
  23984. -- return PTR_ERR_OR_ZERO(drvr->dbgfs_dir);
  23985. -+
  23986. -+ return brcmf_fweh_register(drvr, BRCMF_E_PSM_WATCHDOG,
  23987. -+ brcmf_debug_psm_watchdog_notify);
  23988. - }
  23989. -
  23990. --void brcmf_debugfs_detach(struct brcmf_pub *drvr)
  23991. -+void brcmf_debug_detach(struct brcmf_pub *drvr)
  23992. - {
  23993. -+ brcmf_fweh_unregister(drvr, BRCMF_E_PSM_WATCHDOG);
  23994. -+
  23995. - if (!IS_ERR_OR_NULL(drvr->dbgfs_dir))
  23996. - debugfs_remove_recursive(drvr->dbgfs_dir);
  23997. - }
  23998. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  23999. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  24000. -@@ -109,8 +109,8 @@ struct brcmf_pub;
  24001. - #ifdef DEBUG
  24002. - void brcmf_debugfs_init(void);
  24003. - void brcmf_debugfs_exit(void);
  24004. --int brcmf_debugfs_attach(struct brcmf_pub *drvr);
  24005. --void brcmf_debugfs_detach(struct brcmf_pub *drvr);
  24006. -+int brcmf_debug_attach(struct brcmf_pub *drvr);
  24007. -+void brcmf_debug_detach(struct brcmf_pub *drvr);
  24008. - struct dentry *brcmf_debugfs_get_devdir(struct brcmf_pub *drvr);
  24009. - int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn,
  24010. - int (*read_fn)(struct seq_file *seq, void *data));
  24011. -@@ -121,11 +121,11 @@ static inline void brcmf_debugfs_init(vo
  24012. - static inline void brcmf_debugfs_exit(void)
  24013. - {
  24014. - }
  24015. --static inline int brcmf_debugfs_attach(struct brcmf_pub *drvr)
  24016. -+static inline int brcmf_debug_attach(struct brcmf_pub *drvr)
  24017. - {
  24018. - return 0;
  24019. - }
  24020. --static inline void brcmf_debugfs_detach(struct brcmf_pub *drvr)
  24021. -+static inline void brcmf_debug_detach(struct brcmf_pub *drvr)
  24022. - {
  24023. - }
  24024. - static inline
  24025. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  24026. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  24027. -@@ -448,6 +448,47 @@ brcmf_pcie_copy_mem_todev(struct brcmf_p
  24028. - }
  24029. -
  24030. -
  24031. -+static void
  24032. -+brcmf_pcie_copy_dev_tomem(struct brcmf_pciedev_info *devinfo, u32 mem_offset,
  24033. -+ void *dstaddr, u32 len)
  24034. -+{
  24035. -+ void __iomem *address = devinfo->tcm + mem_offset;
  24036. -+ __le32 *dst32;
  24037. -+ __le16 *dst16;
  24038. -+ u8 *dst8;
  24039. -+
  24040. -+ if (((ulong)address & 4) || ((ulong)dstaddr & 4) || (len & 4)) {
  24041. -+ if (((ulong)address & 2) || ((ulong)dstaddr & 2) || (len & 2)) {
  24042. -+ dst8 = (u8 *)dstaddr;
  24043. -+ while (len) {
  24044. -+ *dst8 = ioread8(address);
  24045. -+ address++;
  24046. -+ dst8++;
  24047. -+ len--;
  24048. -+ }
  24049. -+ } else {
  24050. -+ len = len / 2;
  24051. -+ dst16 = (__le16 *)dstaddr;
  24052. -+ while (len) {
  24053. -+ *dst16 = cpu_to_le16(ioread16(address));
  24054. -+ address += 2;
  24055. -+ dst16++;
  24056. -+ len--;
  24057. -+ }
  24058. -+ }
  24059. -+ } else {
  24060. -+ len = len / 4;
  24061. -+ dst32 = (__le32 *)dstaddr;
  24062. -+ while (len) {
  24063. -+ *dst32 = cpu_to_le32(ioread32(address));
  24064. -+ address += 4;
  24065. -+ dst32++;
  24066. -+ len--;
  24067. -+ }
  24068. -+ }
  24069. -+}
  24070. -+
  24071. -+
  24072. - #define WRITECC32(devinfo, reg, value) brcmf_pcie_write_reg32(devinfo, \
  24073. - CHIPCREGOFFS(reg), value)
  24074. -
  24075. -@@ -1352,12 +1393,36 @@ static void brcmf_pcie_wowl_config(struc
  24076. - }
  24077. -
  24078. -
  24079. -+static size_t brcmf_pcie_get_ramsize(struct device *dev)
  24080. -+{
  24081. -+ struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  24082. -+ struct brcmf_pciedev *buspub = bus_if->bus_priv.pcie;
  24083. -+ struct brcmf_pciedev_info *devinfo = buspub->devinfo;
  24084. -+
  24085. -+ return devinfo->ci->ramsize - devinfo->ci->srsize;
  24086. -+}
  24087. -+
  24088. -+
  24089. -+static int brcmf_pcie_get_memdump(struct device *dev, void *data, size_t len)
  24090. -+{
  24091. -+ struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  24092. -+ struct brcmf_pciedev *buspub = bus_if->bus_priv.pcie;
  24093. -+ struct brcmf_pciedev_info *devinfo = buspub->devinfo;
  24094. -+
  24095. -+ brcmf_dbg(PCIE, "dump at 0x%08X: len=%zu\n", devinfo->ci->rambase, len);
  24096. -+ brcmf_pcie_copy_dev_tomem(devinfo, devinfo->ci->rambase, data, len);
  24097. -+ return 0;
  24098. -+}
  24099. -+
  24100. -+
  24101. - static struct brcmf_bus_ops brcmf_pcie_bus_ops = {
  24102. - .txdata = brcmf_pcie_tx,
  24103. - .stop = brcmf_pcie_down,
  24104. - .txctl = brcmf_pcie_tx_ctlpkt,
  24105. - .rxctl = brcmf_pcie_rx_ctlpkt,
  24106. - .wowl_config = brcmf_pcie_wowl_config,
  24107. -+ .get_ramsize = brcmf_pcie_get_ramsize,
  24108. -+ .get_memdump = brcmf_pcie_get_memdump,
  24109. - };
  24110. -
  24111. -
  24112. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  24113. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  24114. -@@ -3539,6 +3539,51 @@ done:
  24115. - return err;
  24116. - }
  24117. -
  24118. -+static size_t brcmf_sdio_bus_get_ramsize(struct device *dev)
  24119. -+{
  24120. -+ struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  24121. -+ struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
  24122. -+ struct brcmf_sdio *bus = sdiodev->bus;
  24123. -+
  24124. -+ return bus->ci->ramsize - bus->ci->srsize;
  24125. -+}
  24126. -+
  24127. -+static int brcmf_sdio_bus_get_memdump(struct device *dev, void *data,
  24128. -+ size_t mem_size)
  24129. -+{
  24130. -+ struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  24131. -+ struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
  24132. -+ struct brcmf_sdio *bus = sdiodev->bus;
  24133. -+ int err;
  24134. -+ int address;
  24135. -+ int offset;
  24136. -+ int len;
  24137. -+
  24138. -+ brcmf_dbg(INFO, "dump at 0x%08x: size=%zu\n", bus->ci->rambase,
  24139. -+ mem_size);
  24140. -+
  24141. -+ address = bus->ci->rambase;
  24142. -+ offset = err = 0;
  24143. -+ sdio_claim_host(sdiodev->func[1]);
  24144. -+ while (offset < mem_size) {
  24145. -+ len = ((offset + MEMBLOCK) < mem_size) ? MEMBLOCK :
  24146. -+ mem_size - offset;
  24147. -+ err = brcmf_sdiod_ramrw(sdiodev, false, address, data, len);
  24148. -+ if (err) {
  24149. -+ brcmf_err("error %d on reading %d membytes at 0x%08x\n",
  24150. -+ err, len, address);
  24151. -+ goto done;
  24152. -+ }
  24153. -+ data += len;
  24154. -+ offset += len;
  24155. -+ address += len;
  24156. -+ }
  24157. -+
  24158. -+done:
  24159. -+ sdio_release_host(sdiodev->func[1]);
  24160. -+ return err;
  24161. -+}
  24162. -+
  24163. - void brcmf_sdio_trigger_dpc(struct brcmf_sdio *bus)
  24164. - {
  24165. - if (!bus->dpc_triggered) {
  24166. -@@ -3987,7 +4032,9 @@ static struct brcmf_bus_ops brcmf_sdio_b
  24167. - .txctl = brcmf_sdio_bus_txctl,
  24168. - .rxctl = brcmf_sdio_bus_rxctl,
  24169. - .gettxq = brcmf_sdio_bus_gettxq,
  24170. -- .wowl_config = brcmf_sdio_wowl_config
  24171. -+ .wowl_config = brcmf_sdio_wowl_config,
  24172. -+ .get_ramsize = brcmf_sdio_bus_get_ramsize,
  24173. -+ .get_memdump = brcmf_sdio_bus_get_memdump,
  24174. - };
  24175. -
  24176. - static void brcmf_sdio_firmware_callback(struct device *dev,
  24177. diff --git a/package/kernel/mac80211/patches/372-0002-brcmfmac-Fix-race-condition-between-USB-probe-load-a.patch b/package/kernel/mac80211/patches/372-0002-brcmfmac-Fix-race-condition-between-USB-probe-load-a.patch
  24178. deleted file mode 100644
  24179. index 5b82bca..0000000
  24180. --- a/package/kernel/mac80211/patches/372-0002-brcmfmac-Fix-race-condition-between-USB-probe-load-a.patch
  24181. +++ /dev/null
  24182. @@ -1,108 +0,0 @@
  24183. -From: Hante Meuleman <meuleman@broadcom.com>
  24184. -Date: Thu, 8 Oct 2015 20:33:12 +0200
  24185. -Subject: [PATCH] brcmfmac: Fix race condition between USB probe/load and
  24186. - disconnect.
  24187. -
  24188. -When a USB device gets disconnected due to for example removal
  24189. -then it is possible that it is still in the loading phase due to
  24190. -the asynchronous load routines. These routines can then possible
  24191. -access memory which has been freed. Fix this by mutex locking the
  24192. -device init phase.
  24193. -
  24194. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  24195. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  24196. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  24197. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  24198. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  24199. ----
  24200. -
  24201. ---- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  24202. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  24203. -@@ -144,6 +144,7 @@ struct brcmf_usbdev_info {
  24204. -
  24205. - struct usb_device *usbdev;
  24206. - struct device *dev;
  24207. -+ struct mutex dev_init_lock;
  24208. -
  24209. - int ctl_in_pipe, ctl_out_pipe;
  24210. - struct urb *ctl_urb; /* URB for control endpoint */
  24211. -@@ -1204,6 +1205,8 @@ static void brcmf_usb_probe_phase2(struc
  24212. - int ret;
  24213. -
  24214. - brcmf_dbg(USB, "Start fw downloading\n");
  24215. -+
  24216. -+ devinfo = bus->bus_priv.usb->devinfo;
  24217. - ret = check_file(fw->data);
  24218. - if (ret < 0) {
  24219. - brcmf_err("invalid firmware\n");
  24220. -@@ -1211,7 +1214,6 @@ static void brcmf_usb_probe_phase2(struc
  24221. - goto error;
  24222. - }
  24223. -
  24224. -- devinfo = bus->bus_priv.usb->devinfo;
  24225. - devinfo->image = fw->data;
  24226. - devinfo->image_len = fw->size;
  24227. -
  24228. -@@ -1224,9 +1226,11 @@ static void brcmf_usb_probe_phase2(struc
  24229. - if (ret)
  24230. - goto error;
  24231. -
  24232. -+ mutex_unlock(&devinfo->dev_init_lock);
  24233. - return;
  24234. - error:
  24235. - brcmf_dbg(TRACE, "failed: dev=%s, err=%d\n", dev_name(dev), ret);
  24236. -+ mutex_unlock(&devinfo->dev_init_lock);
  24237. - device_release_driver(dev);
  24238. - }
  24239. -
  24240. -@@ -1264,6 +1268,7 @@ static int brcmf_usb_probe_cb(struct brc
  24241. - if (ret)
  24242. - goto fail;
  24243. - /* we are done */
  24244. -+ mutex_unlock(&devinfo->dev_init_lock);
  24245. - return 0;
  24246. - }
  24247. - bus->chip = bus_pub->devid;
  24248. -@@ -1317,6 +1322,12 @@ brcmf_usb_probe(struct usb_interface *in
  24249. -
  24250. - devinfo->usbdev = usb;
  24251. - devinfo->dev = &usb->dev;
  24252. -+ /* Take an init lock, to protect for disconnect while still loading.
  24253. -+ * Necessary because of the asynchronous firmware load construction
  24254. -+ */
  24255. -+ mutex_init(&devinfo->dev_init_lock);
  24256. -+ mutex_lock(&devinfo->dev_init_lock);
  24257. -+
  24258. - usb_set_intfdata(intf, devinfo);
  24259. -
  24260. - /* Check that the device supports only one configuration */
  24261. -@@ -1391,6 +1402,7 @@ brcmf_usb_probe(struct usb_interface *in
  24262. - return 0;
  24263. -
  24264. - fail:
  24265. -+ mutex_unlock(&devinfo->dev_init_lock);
  24266. - kfree(devinfo);
  24267. - usb_set_intfdata(intf, NULL);
  24268. - return ret;
  24269. -@@ -1403,8 +1415,19 @@ brcmf_usb_disconnect(struct usb_interfac
  24270. -
  24271. - brcmf_dbg(USB, "Enter\n");
  24272. - devinfo = (struct brcmf_usbdev_info *)usb_get_intfdata(intf);
  24273. -- brcmf_usb_disconnect_cb(devinfo);
  24274. -- kfree(devinfo);
  24275. -+
  24276. -+ if (devinfo) {
  24277. -+ mutex_lock(&devinfo->dev_init_lock);
  24278. -+ /* Make sure that devinfo still exists. Firmware probe routines
  24279. -+ * may have released the device and cleared the intfdata.
  24280. -+ */
  24281. -+ if (!usb_get_intfdata(intf))
  24282. -+ goto done;
  24283. -+
  24284. -+ brcmf_usb_disconnect_cb(devinfo);
  24285. -+ kfree(devinfo);
  24286. -+ }
  24287. -+done:
  24288. - brcmf_dbg(USB, "Exit\n");
  24289. - }
  24290. -
  24291. diff --git a/package/kernel/mac80211/patches/372-0003-brcmfmac-rename-firmware_path-to-alternative_fw_path.patch b/package/kernel/mac80211/patches/372-0003-brcmfmac-rename-firmware_path-to-alternative_fw_path.patch
  24292. deleted file mode 100644
  24293. index f877c23..0000000
  24294. --- a/package/kernel/mac80211/patches/372-0003-brcmfmac-rename-firmware_path-to-alternative_fw_path.patch
  24295. +++ /dev/null
  24296. @@ -1,28 +0,0 @@
  24297. -From: Franky Lin <frankyl@broadcom.com>
  24298. -Date: Thu, 8 Oct 2015 20:33:13 +0200
  24299. -Subject: [PATCH] brcmfmac: rename firmware_path to alternative_fw_path
  24300. -
  24301. -In brcmfmac the module parameter "firmware_path" is used as an
  24302. -alternative relative path under the search path used by firmware_class
  24303. -or ueventhelper. Rename the parameter to alternative_fw_path to avoid
  24304. -confusion.
  24305. -
  24306. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  24307. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  24308. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  24309. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  24310. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  24311. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  24312. ----
  24313. -
  24314. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  24315. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  24316. -@@ -28,7 +28,7 @@
  24317. - #define BRCMF_FW_NVRAM_PCIEDEV_LEN 10 /* pcie/1/4/ + \0 */
  24318. -
  24319. - char brcmf_firmware_path[BRCMF_FW_PATH_LEN];
  24320. --module_param_string(firmware_path, brcmf_firmware_path,
  24321. -+module_param_string(alternative_fw_path, brcmf_firmware_path,
  24322. - BRCMF_FW_PATH_LEN, 0440);
  24323. -
  24324. - enum nvram_parser_state {
  24325. diff --git a/package/kernel/mac80211/patches/372-0004-brcmfmac-remove-conversational-comment.patch b/package/kernel/mac80211/patches/372-0004-brcmfmac-remove-conversational-comment.patch
  24326. deleted file mode 100644
  24327. index 0bfd9ef..0000000
  24328. --- a/package/kernel/mac80211/patches/372-0004-brcmfmac-remove-conversational-comment.patch
  24329. +++ /dev/null
  24330. @@ -1,25 +0,0 @@
  24331. -From: Arend van Spriel <arend@broadcom.com>
  24332. -Date: Thu, 8 Oct 2015 20:33:14 +0200
  24333. -Subject: [PATCH] brcmfmac: remove conversational comment
  24334. -
  24335. -Removing a comment that was only useful during the review of
  24336. -the change that introduced it and which should never have been
  24337. -submitted.
  24338. -
  24339. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  24340. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  24341. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  24342. ----
  24343. -
  24344. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  24345. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  24346. -@@ -873,9 +873,6 @@ brcmf_msgbuf_process_txstatus(struct brc
  24347. - commonring = msgbuf->flowrings[flowid];
  24348. - atomic_dec(&commonring->outstanding_tx);
  24349. -
  24350. -- /* Hante: i believe this was a bug as tx_status->msg.ifidx was used
  24351. -- * in brcmf_txfinalize as index in drvr->iflist. Can you confirm/deny?
  24352. -- */
  24353. - brcmf_txfinalize(brcmf_get_ifp(msgbuf->drvr, tx_status->msg.ifidx),
  24354. - skb, true);
  24355. - }
  24356. diff --git a/package/kernel/mac80211/patches/372-0005-brcmfmac-Rework-p2p-attach-use-single-method-for-p2p.patch b/package/kernel/mac80211/patches/372-0005-brcmfmac-Rework-p2p-attach-use-single-method-for-p2p.patch
  24357. deleted file mode 100644
  24358. index 3ffada8..0000000
  24359. --- a/package/kernel/mac80211/patches/372-0005-brcmfmac-Rework-p2p-attach-use-single-method-for-p2p.patch
  24360. +++ /dev/null
  24361. @@ -1,226 +0,0 @@
  24362. -From: Hante Meuleman <meuleman@broadcom.com>
  24363. -Date: Thu, 8 Oct 2015 20:33:15 +0200
  24364. -Subject: [PATCH] brcmfmac: Rework p2p attach, use single method for p2p dev
  24365. - creation.
  24366. -
  24367. -When module param p2pon is used a p2p device is created at init.
  24368. -This patch reworks how this is done by using the same method as
  24369. -for a dynamically (by user space) created p2p device.
  24370. -
  24371. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  24372. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  24373. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  24374. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  24375. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  24376. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  24377. ----
  24378. -
  24379. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  24380. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  24381. -@@ -6237,6 +6237,17 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  24382. - else
  24383. - *cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
  24384. - }
  24385. -+ /* p2p might require that "if-events" get processed by fweh. So
  24386. -+ * activate the already registered event handlers now and activate
  24387. -+ * the rest when initialization has completed. drvr->config needs to
  24388. -+ * be assigned before activating events.
  24389. -+ */
  24390. -+ drvr->config = cfg;
  24391. -+ err = brcmf_fweh_activate_events(ifp);
  24392. -+ if (err) {
  24393. -+ brcmf_err("FWEH activation failed (%d)\n", err);
  24394. -+ goto wiphy_unreg_out;
  24395. -+ }
  24396. -
  24397. - err = brcmf_p2p_attach(cfg, p2pdev_forced);
  24398. - if (err) {
  24399. -@@ -6259,6 +6270,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  24400. - brcmf_notify_tdls_peer_event);
  24401. - }
  24402. -
  24403. -+ /* (re-) activate FWEH event handling */
  24404. -+ err = brcmf_fweh_activate_events(ifp);
  24405. -+ if (err) {
  24406. -+ brcmf_err("FWEH activation failed (%d)\n", err);
  24407. -+ goto wiphy_unreg_out;
  24408. -+ }
  24409. -+
  24410. - return cfg;
  24411. -
  24412. - wiphy_unreg_out:
  24413. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  24414. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  24415. -@@ -828,8 +828,8 @@ struct brcmf_if *brcmf_add_if(struct brc
  24416. - } else {
  24417. - brcmf_dbg(INFO, "allocate netdev interface\n");
  24418. - /* Allocate netdev, including space for private structure */
  24419. -- ndev = alloc_netdev(sizeof(*ifp), name, NET_NAME_UNKNOWN,
  24420. -- ether_setup);
  24421. -+ ndev = alloc_netdev(sizeof(*ifp), is_p2pdev ? "p2p%d" : name,
  24422. -+ NET_NAME_UNKNOWN, ether_setup);
  24423. - if (!ndev)
  24424. - return ERR_PTR(-ENOMEM);
  24425. -
  24426. -@@ -1021,12 +1021,7 @@ int brcmf_bus_start(struct device *dev)
  24427. - if (IS_ERR(ifp))
  24428. - return PTR_ERR(ifp);
  24429. -
  24430. -- if (brcmf_p2p_enable)
  24431. -- p2p_ifp = brcmf_add_if(drvr, 1, 0, false, "p2p%d", NULL);
  24432. -- else
  24433. -- p2p_ifp = NULL;
  24434. -- if (IS_ERR(p2p_ifp))
  24435. -- p2p_ifp = NULL;
  24436. -+ p2p_ifp = NULL;
  24437. -
  24438. - /* signal bus ready */
  24439. - brcmf_bus_change_state(bus_if, BRCMF_BUS_UP);
  24440. -@@ -1060,11 +1055,13 @@ int brcmf_bus_start(struct device *dev)
  24441. - goto fail;
  24442. - }
  24443. -
  24444. -- ret = brcmf_fweh_activate_events(ifp);
  24445. -- if (ret < 0)
  24446. -- goto fail;
  24447. --
  24448. - ret = brcmf_net_attach(ifp, false);
  24449. -+
  24450. -+ if ((!ret) && (brcmf_p2p_enable)) {
  24451. -+ p2p_ifp = drvr->iflist[1];
  24452. -+ if (p2p_ifp)
  24453. -+ ret = brcmf_net_p2p_attach(p2p_ifp);
  24454. -+ }
  24455. - fail:
  24456. - if (ret < 0) {
  24457. - brcmf_err("failed: %d\n", ret);
  24458. -@@ -1076,20 +1073,12 @@ fail:
  24459. - brcmf_fws_del_interface(ifp);
  24460. - brcmf_fws_deinit(drvr);
  24461. - }
  24462. -- if (drvr->iflist[0]) {
  24463. -+ if (ifp)
  24464. - brcmf_net_detach(ifp->ndev);
  24465. -- drvr->iflist[0] = NULL;
  24466. -- }
  24467. -- if (p2p_ifp) {
  24468. -+ if (p2p_ifp)
  24469. - brcmf_net_detach(p2p_ifp->ndev);
  24470. -- drvr->iflist[1] = NULL;
  24471. -- }
  24472. - return ret;
  24473. - }
  24474. -- if ((brcmf_p2p_enable) && (p2p_ifp))
  24475. -- if (brcmf_net_p2p_attach(p2p_ifp) < 0)
  24476. -- brcmf_p2p_enable = 0;
  24477. --
  24478. - return 0;
  24479. - }
  24480. -
  24481. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  24482. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  24483. -@@ -213,7 +213,8 @@ static void brcmf_fweh_handle_if_event(s
  24484. - is_p2pdev, emsg->ifname, emsg->addr);
  24485. - if (IS_ERR(ifp))
  24486. - return;
  24487. -- brcmf_fws_add_interface(ifp);
  24488. -+ if (!is_p2pdev)
  24489. -+ brcmf_fws_add_interface(ifp);
  24490. - if (!drvr->fweh.evt_handler[BRCMF_E_IF])
  24491. - if (brcmf_net_attach(ifp, false) < 0)
  24492. - return;
  24493. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  24494. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  24495. -@@ -2350,83 +2350,30 @@ void brcmf_p2p_stop_device(struct wiphy
  24496. - * brcmf_p2p_attach() - attach for P2P.
  24497. - *
  24498. - * @cfg: driver private data for cfg80211 interface.
  24499. -+ * @p2pdev_forced: create p2p device interface at attach.
  24500. - */
  24501. - s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced)
  24502. - {
  24503. -- struct brcmf_if *pri_ifp;
  24504. -- struct brcmf_if *p2p_ifp;
  24505. -- struct brcmf_cfg80211_vif *p2p_vif;
  24506. - struct brcmf_p2p_info *p2p;
  24507. -- struct brcmf_pub *drvr;
  24508. -- s32 bssidx;
  24509. -+ struct brcmf_if *pri_ifp;
  24510. - s32 err = 0;
  24511. -+ void *err_ptr;
  24512. -
  24513. - p2p = &cfg->p2p;
  24514. - p2p->cfg = cfg;
  24515. -
  24516. -- drvr = cfg->pub;
  24517. --
  24518. -- pri_ifp = brcmf_get_ifp(drvr, 0);
  24519. -+ pri_ifp = brcmf_get_ifp(cfg->pub, 0);
  24520. - p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif = pri_ifp->vif;
  24521. -
  24522. - if (p2pdev_forced) {
  24523. -- p2p_ifp = drvr->iflist[1];
  24524. -+ err_ptr = brcmf_p2p_create_p2pdev(p2p, NULL, NULL);
  24525. -+ if (IS_ERR(err_ptr)) {
  24526. -+ brcmf_err("P2P device creation failed.\n");
  24527. -+ err = PTR_ERR(err_ptr);
  24528. -+ }
  24529. - } else {
  24530. -- p2p_ifp = NULL;
  24531. - p2p->p2pdev_dynamically = true;
  24532. - }
  24533. -- if (p2p_ifp) {
  24534. -- p2p_vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_P2P_DEVICE,
  24535. -- false);
  24536. -- if (IS_ERR(p2p_vif)) {
  24537. -- brcmf_err("could not create discovery vif\n");
  24538. -- err = -ENOMEM;
  24539. -- goto exit;
  24540. -- }
  24541. --
  24542. -- p2p_vif->ifp = p2p_ifp;
  24543. -- p2p_ifp->vif = p2p_vif;
  24544. -- p2p_vif->wdev.netdev = p2p_ifp->ndev;
  24545. -- p2p_ifp->ndev->ieee80211_ptr = &p2p_vif->wdev;
  24546. -- SET_NETDEV_DEV(p2p_ifp->ndev, wiphy_dev(cfg->wiphy));
  24547. --
  24548. -- p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = p2p_vif;
  24549. --
  24550. -- brcmf_p2p_generate_bss_mac(p2p, NULL);
  24551. -- memcpy(p2p_ifp->mac_addr, p2p->dev_addr, ETH_ALEN);
  24552. -- brcmf_p2p_set_firmware(pri_ifp, p2p->dev_addr);
  24553. --
  24554. -- brcmf_fweh_p2pdev_setup(pri_ifp, true);
  24555. --
  24556. -- /* Initialize P2P Discovery in the firmware */
  24557. -- err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1);
  24558. -- if (err < 0) {
  24559. -- brcmf_err("set p2p_disc error\n");
  24560. -- brcmf_free_vif(p2p_vif);
  24561. -- goto exit;
  24562. -- }
  24563. -- /* obtain bsscfg index for P2P discovery */
  24564. -- err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bssidx);
  24565. -- if (err < 0) {
  24566. -- brcmf_err("retrieving discover bsscfg index failed\n");
  24567. -- brcmf_free_vif(p2p_vif);
  24568. -- goto exit;
  24569. -- }
  24570. -- /* Verify that firmware uses same bssidx as driver !! */
  24571. -- if (p2p_ifp->bssidx != bssidx) {
  24572. -- brcmf_err("Incorrect bssidx=%d, compared to p2p_ifp->bssidx=%d\n",
  24573. -- bssidx, p2p_ifp->bssidx);
  24574. -- brcmf_free_vif(p2p_vif);
  24575. -- goto exit;
  24576. -- }
  24577. --
  24578. -- init_completion(&p2p->send_af_done);
  24579. -- INIT_WORK(&p2p->afx_hdl.afx_work, brcmf_p2p_afx_handler);
  24580. -- init_completion(&p2p->afx_hdl.act_frm_scan);
  24581. -- init_completion(&p2p->wait_next_af);
  24582. --exit:
  24583. -- brcmf_fweh_p2pdev_setup(pri_ifp, false);
  24584. -- }
  24585. - return err;
  24586. - }
  24587. -
  24588. diff --git a/package/kernel/mac80211/patches/372-0006-brcmfmac-Fix-station-info-rate-information.patch b/package/kernel/mac80211/patches/372-0006-brcmfmac-Fix-station-info-rate-information.patch
  24589. deleted file mode 100644
  24590. index 0abcf1e..0000000
  24591. --- a/package/kernel/mac80211/patches/372-0006-brcmfmac-Fix-station-info-rate-information.patch
  24592. +++ /dev/null
  24593. @@ -1,36 +0,0 @@
  24594. -From: Hante Meuleman <meuleman@broadcom.com>
  24595. -Date: Thu, 8 Oct 2015 20:33:16 +0200
  24596. -Subject: [PATCH] brcmfmac: Fix station info rate information.
  24597. -
  24598. -Txrate and rxrate in get_station got assigned first with value
  24599. -in kbps and then divided by 100 to get it in 100kbps unit. The
  24600. -problem with that is that type of rate is u16 which resulted
  24601. -in incorrect values for high data rate values.
  24602. -
  24603. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  24604. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  24605. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  24606. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  24607. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  24608. ----
  24609. -
  24610. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  24611. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  24612. -@@ -2477,13 +2477,13 @@ brcmf_cfg80211_get_station(struct wiphy
  24613. - sinfo->rx_packets += le32_to_cpu(sta_info_le.rx_mcast_pkts);
  24614. - if (sinfo->tx_packets) {
  24615. - sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
  24616. -- sinfo->txrate.legacy = le32_to_cpu(sta_info_le.tx_rate);
  24617. -- sinfo->txrate.legacy /= 100;
  24618. -+ sinfo->txrate.legacy =
  24619. -+ le32_to_cpu(sta_info_le.tx_rate) / 100;
  24620. - }
  24621. - if (sinfo->rx_packets) {
  24622. - sinfo->filled |= BIT(NL80211_STA_INFO_RX_BITRATE);
  24623. -- sinfo->rxrate.legacy = le32_to_cpu(sta_info_le.rx_rate);
  24624. -- sinfo->rxrate.legacy /= 100;
  24625. -+ sinfo->rxrate.legacy =
  24626. -+ le32_to_cpu(sta_info_le.rx_rate) / 100;
  24627. - }
  24628. - if (le16_to_cpu(sta_info_le.ver) >= 4) {
  24629. - sinfo->filled |= BIT(NL80211_STA_INFO_TX_BYTES);
  24630. diff --git a/package/kernel/mac80211/patches/372-0007-brcmfmac-Add-RSSI-information-to-get_station.patch b/package/kernel/mac80211/patches/372-0007-brcmfmac-Add-RSSI-information-to-get_station.patch
  24631. deleted file mode 100644
  24632. index bb03d67..0000000
  24633. --- a/package/kernel/mac80211/patches/372-0007-brcmfmac-Add-RSSI-information-to-get_station.patch
  24634. +++ /dev/null
  24635. @@ -1,50 +0,0 @@
  24636. -From: Hante Meuleman <meuleman@broadcom.com>
  24637. -Date: Thu, 8 Oct 2015 20:33:17 +0200
  24638. -Subject: [PATCH] brcmfmac: Add RSSI information to get_station.
  24639. -
  24640. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  24641. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  24642. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  24643. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  24644. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  24645. ----
  24646. -
  24647. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  24648. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  24649. -@@ -2431,6 +2431,9 @@ brcmf_cfg80211_get_station(struct wiphy
  24650. - struct brcmf_sta_info_le sta_info_le;
  24651. - u32 sta_flags;
  24652. - u32 is_tdls_peer;
  24653. -+ s32 total_rssi;
  24654. -+ s32 count_rssi;
  24655. -+ u32 i;
  24656. -
  24657. - brcmf_dbg(TRACE, "Enter, MAC %pM\n", mac);
  24658. - if (!check_vif_up(ifp->vif))
  24659. -@@ -2491,6 +2494,26 @@ brcmf_cfg80211_get_station(struct wiphy
  24660. - sinfo->filled |= BIT(NL80211_STA_INFO_RX_BYTES);
  24661. - sinfo->rx_bytes = le64_to_cpu(sta_info_le.rx_tot_bytes);
  24662. - }
  24663. -+ total_rssi = 0;
  24664. -+ count_rssi = 0;
  24665. -+ for (i = 0; i < BRCMF_ANT_MAX; i++) {
  24666. -+ if (sta_info_le.rssi[i]) {
  24667. -+ sinfo->chain_signal_avg[count_rssi] =
  24668. -+ sta_info_le.rssi[i];
  24669. -+ sinfo->chain_signal[count_rssi] =
  24670. -+ sta_info_le.rssi[i];
  24671. -+ total_rssi += sta_info_le.rssi[i];
  24672. -+ count_rssi++;
  24673. -+ }
  24674. -+ }
  24675. -+ if (count_rssi) {
  24676. -+ sinfo->filled |= BIT(NL80211_STA_INFO_CHAIN_SIGNAL);
  24677. -+ sinfo->chains = count_rssi;
  24678. -+
  24679. -+ sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
  24680. -+ total_rssi /= count_rssi;
  24681. -+ sinfo->signal = total_rssi;
  24682. -+ }
  24683. - }
  24684. - done:
  24685. - brcmf_dbg(TRACE, "Exit\n");
  24686. diff --git a/package/kernel/mac80211/patches/372-0008-brcmfmac-Add-dump_station-support-to-cfg80221-ops.patch b/package/kernel/mac80211/patches/372-0008-brcmfmac-Add-dump_station-support-to-cfg80221-ops.patch
  24687. deleted file mode 100644
  24688. index a6bafd2..0000000
  24689. --- a/package/kernel/mac80211/patches/372-0008-brcmfmac-Add-dump_station-support-to-cfg80221-ops.patch
  24690. +++ /dev/null
  24691. @@ -1,107 +0,0 @@
  24692. -From: Hante Meuleman <meuleman@broadcom.com>
  24693. -Date: Thu, 8 Oct 2015 20:33:18 +0200
  24694. -Subject: [PATCH] brcmfmac: Add dump_station support to cfg80221 ops.
  24695. -
  24696. -With this feature it becomes possible to request a station
  24697. -assoc list.
  24698. -
  24699. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  24700. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  24701. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  24702. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  24703. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  24704. ----
  24705. -
  24706. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  24707. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  24708. -@@ -2520,6 +2520,35 @@ done:
  24709. - return err;
  24710. - }
  24711. -
  24712. -+static int
  24713. -+brcmf_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *ndev,
  24714. -+ int idx, u8 *mac, struct station_info *sinfo)
  24715. -+{
  24716. -+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  24717. -+ struct brcmf_if *ifp = netdev_priv(ndev);
  24718. -+ s32 err;
  24719. -+
  24720. -+ brcmf_dbg(TRACE, "Enter, idx %d\n", idx);
  24721. -+
  24722. -+ if (idx == 0) {
  24723. -+ cfg->assoclist.count = cpu_to_le32(BRCMF_MAX_ASSOCLIST);
  24724. -+ err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_ASSOCLIST,
  24725. -+ &cfg->assoclist,
  24726. -+ sizeof(cfg->assoclist));
  24727. -+ if (err) {
  24728. -+ brcmf_err("BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n",
  24729. -+ err);
  24730. -+ cfg->assoclist.count = 0;
  24731. -+ return -EOPNOTSUPP;
  24732. -+ }
  24733. -+ }
  24734. -+ if (idx < le32_to_cpu(cfg->assoclist.count)) {
  24735. -+ memcpy(mac, cfg->assoclist.mac[idx], ETH_ALEN);
  24736. -+ return brcmf_cfg80211_get_station(wiphy, ndev, mac, sinfo);
  24737. -+ }
  24738. -+ return -ENOENT;
  24739. -+}
  24740. -+
  24741. - static s32
  24742. - brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev,
  24743. - bool enabled, s32 timeout)
  24744. -@@ -4619,6 +4648,7 @@ static struct cfg80211_ops wl_cfg80211_o
  24745. - .join_ibss = brcmf_cfg80211_join_ibss,
  24746. - .leave_ibss = brcmf_cfg80211_leave_ibss,
  24747. - .get_station = brcmf_cfg80211_get_station,
  24748. -+ .dump_station = brcmf_cfg80211_dump_station,
  24749. - .set_tx_power = brcmf_cfg80211_set_tx_power,
  24750. - .get_tx_power = brcmf_cfg80211_get_tx_power,
  24751. - .add_key = brcmf_cfg80211_add_key,
  24752. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  24753. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  24754. -@@ -407,6 +407,7 @@ struct brcmf_cfg80211_info {
  24755. - struct brcmu_d11inf d11inf;
  24756. - bool wowl_enabled;
  24757. - u32 pre_wowl_pmmode;
  24758. -+ struct brcmf_assoclist_le assoclist;
  24759. - };
  24760. -
  24761. - /**
  24762. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwil.h
  24763. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil.h
  24764. -@@ -72,6 +72,7 @@
  24765. - #define BRCMF_C_GET_BSS_INFO 136
  24766. - #define BRCMF_C_GET_BANDLIST 140
  24767. - #define BRCMF_C_SET_SCB_TIMEOUT 158
  24768. -+#define BRCMF_C_GET_ASSOCLIST 159
  24769. - #define BRCMF_C_GET_PHYLIST 180
  24770. - #define BRCMF_C_SET_SCAN_CHANNEL_TIME 185
  24771. - #define BRCMF_C_SET_SCAN_UNASSOC_TIME 187
  24772. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  24773. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  24774. -@@ -119,6 +119,8 @@
  24775. - #define BRCMF_COUNTRY_BUF_SZ 4
  24776. - #define BRCMF_ANT_MAX 4
  24777. -
  24778. -+#define BRCMF_MAX_ASSOCLIST 128
  24779. -+
  24780. - /* join preference types for join_pref iovar */
  24781. - enum brcmf_join_pref_types {
  24782. - BRCMF_JOIN_PREF_RSSI = 1,
  24783. -@@ -621,4 +623,15 @@ struct brcmf_rev_info_le {
  24784. - __le32 nvramrev;
  24785. - };
  24786. -
  24787. -+/**
  24788. -+ * struct brcmf_assoclist_le - request assoc list.
  24789. -+ *
  24790. -+ * @count: indicates number of stations.
  24791. -+ * @mac: MAC addresses of stations.
  24792. -+ */
  24793. -+struct brcmf_assoclist_le {
  24794. -+ __le32 count;
  24795. -+ u8 mac[BRCMF_MAX_ASSOCLIST][ETH_ALEN];
  24796. -+};
  24797. -+
  24798. - #endif /* FWIL_TYPES_H_ */
  24799. diff --git a/package/kernel/mac80211/patches/372-0009-brcmfmac-Move-brcmf_c_preinit_dcmds-prototype-to-cor.patch b/package/kernel/mac80211/patches/372-0009-brcmfmac-Move-brcmf_c_preinit_dcmds-prototype-to-cor.patch
  24800. deleted file mode 100644
  24801. index dc54904..0000000
  24802. --- a/package/kernel/mac80211/patches/372-0009-brcmfmac-Move-brcmf_c_preinit_dcmds-prototype-to-cor.patch
  24803. +++ /dev/null
  24804. @@ -1,42 +0,0 @@
  24805. -From: Hante Meuleman <meuleman@broadcom.com>
  24806. -Date: Thu, 8 Oct 2015 20:33:19 +0200
  24807. -Subject: [PATCH] brcmfmac: Move brcmf_c_preinit_dcmds prototype to correct
  24808. - file.
  24809. -
  24810. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  24811. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  24812. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  24813. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  24814. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  24815. ----
  24816. -
  24817. ---- a/drivers/net/wireless/brcm80211/brcmfmac/common.h
  24818. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/common.h
  24819. -@@ -17,4 +17,7 @@
  24820. -
  24821. - extern const u8 ALLFFMAC[ETH_ALEN];
  24822. -
  24823. -+/* Sets dongle media info (drv_version, mac address). */
  24824. -+int brcmf_c_preinit_dcmds(struct brcmf_if *ifp);
  24825. -+
  24826. - #endif /* BRCMFMAC_COMMON_H */
  24827. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  24828. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  24829. -@@ -33,6 +33,7 @@
  24830. - #include "feature.h"
  24831. - #include "proto.h"
  24832. - #include "pcie.h"
  24833. -+#include "common.h"
  24834. -
  24835. - MODULE_AUTHOR("Broadcom Corporation");
  24836. - MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver.");
  24837. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  24838. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  24839. -@@ -214,7 +214,4 @@ void brcmf_txflowblock_if(struct brcmf_i
  24840. - void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  24841. - void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);
  24842. -
  24843. --/* Sets dongle media info (drv_version, mac address). */
  24844. --int brcmf_c_preinit_dcmds(struct brcmf_if *ifp);
  24845. --
  24846. - #endif /* BRCMFMAC_CORE_H */
  24847. diff --git a/package/kernel/mac80211/patches/372-0010-brcmfmac-Remove-unused-state-AP-creating.patch b/package/kernel/mac80211/patches/372-0010-brcmfmac-Remove-unused-state-AP-creating.patch
  24848. deleted file mode 100644
  24849. index c6a7363..0000000
  24850. --- a/package/kernel/mac80211/patches/372-0010-brcmfmac-Remove-unused-state-AP-creating.patch
  24851. +++ /dev/null
  24852. @@ -1,55 +0,0 @@
  24853. -From: Hante Meuleman <meuleman@broadcom.com>
  24854. -Date: Thu, 8 Oct 2015 20:33:20 +0200
  24855. -Subject: [PATCH] brcmfmac: Remove unused state AP creating.
  24856. -
  24857. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  24858. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  24859. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  24860. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  24861. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  24862. ----
  24863. -
  24864. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  24865. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  24866. -@@ -839,7 +839,6 @@ brcmf_cfg80211_change_iface(struct wiphy
  24867. - err = brcmf_p2p_ifchange(cfg, BRCMF_FIL_P2P_IF_GO);
  24868. - }
  24869. - if (!err) {
  24870. -- set_bit(BRCMF_VIF_STATUS_AP_CREATING, &vif->sme_state);
  24871. - brcmf_dbg(INFO, "IF Type = AP\n");
  24872. - }
  24873. - } else {
  24874. -@@ -4250,7 +4249,6 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  24875. -
  24876. - brcmf_dbg(TRACE, "GO mode configuration complete\n");
  24877. - }
  24878. -- clear_bit(BRCMF_VIF_STATUS_AP_CREATING, &ifp->vif->sme_state);
  24879. - set_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state);
  24880. -
  24881. - exit:
  24882. -@@ -4315,7 +4313,6 @@ static int brcmf_cfg80211_stop_ap(struct
  24883. - }
  24884. - brcmf_set_mpc(ifp, 1);
  24885. - brcmf_configure_arp_offload(ifp, true);
  24886. -- set_bit(BRCMF_VIF_STATUS_AP_CREATING, &ifp->vif->sme_state);
  24887. - clear_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state);
  24888. -
  24889. - return err;
  24890. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  24891. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  24892. -@@ -143,7 +143,6 @@ struct brcmf_cfg80211_profile {
  24893. - * @BRCMF_VIF_STATUS_CONNECTING: connect/join in progress.
  24894. - * @BRCMF_VIF_STATUS_CONNECTED: connected/joined succesfully.
  24895. - * @BRCMF_VIF_STATUS_DISCONNECTING: disconnect/disable in progress.
  24896. -- * @BRCMF_VIF_STATUS_AP_CREATING: interface configured for AP operation.
  24897. - * @BRCMF_VIF_STATUS_AP_CREATED: AP operation started.
  24898. - */
  24899. - enum brcmf_vif_status {
  24900. -@@ -151,7 +150,6 @@ enum brcmf_vif_status {
  24901. - BRCMF_VIF_STATUS_CONNECTING,
  24902. - BRCMF_VIF_STATUS_CONNECTED,
  24903. - BRCMF_VIF_STATUS_DISCONNECTING,
  24904. -- BRCMF_VIF_STATUS_AP_CREATING,
  24905. - BRCMF_VIF_STATUS_AP_CREATED
  24906. - };
  24907. -
  24908. diff --git a/package/kernel/mac80211/patches/372-0011-brcmfmac-Properly-set-carrier-state-of-netdev.patch b/package/kernel/mac80211/patches/372-0011-brcmfmac-Properly-set-carrier-state-of-netdev.patch
  24909. deleted file mode 100644
  24910. index c0948de..0000000
  24911. --- a/package/kernel/mac80211/patches/372-0011-brcmfmac-Properly-set-carrier-state-of-netdev.patch
  24912. +++ /dev/null
  24913. @@ -1,122 +0,0 @@
  24914. -From: Hante Meuleman <meuleman@broadcom.com>
  24915. -Date: Thu, 8 Oct 2015 20:33:21 +0200
  24916. -Subject: [PATCH] brcmfmac: Properly set carrier state of netdev.
  24917. -
  24918. -Use the netif_carrier api to correctly set carrier state on the
  24919. -different modes.
  24920. -
  24921. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  24922. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  24923. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  24924. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  24925. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  24926. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  24927. ----
  24928. -
  24929. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  24930. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  24931. -@@ -4250,6 +4250,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  24932. - brcmf_dbg(TRACE, "GO mode configuration complete\n");
  24933. - }
  24934. - set_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state);
  24935. -+ brcmf_net_setcarrier(ifp, true);
  24936. -
  24937. - exit:
  24938. - if ((err) && (!mbss)) {
  24939. -@@ -4314,6 +4315,7 @@ static int brcmf_cfg80211_stop_ap(struct
  24940. - brcmf_set_mpc(ifp, 1);
  24941. - brcmf_configure_arp_offload(ifp, true);
  24942. - clear_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state);
  24943. -+ brcmf_net_setcarrier(ifp, false);
  24944. -
  24945. - return err;
  24946. - }
  24947. -@@ -5023,6 +5025,7 @@ brcmf_notify_connect_status(struct brcmf
  24948. - &ifp->vif->sme_state);
  24949. - } else
  24950. - brcmf_bss_connect_done(cfg, ndev, e, true);
  24951. -+ brcmf_net_setcarrier(ifp, true);
  24952. - } else if (brcmf_is_linkdown(e)) {
  24953. - brcmf_dbg(CONN, "Linkdown\n");
  24954. - if (!brcmf_is_ibssmode(ifp->vif)) {
  24955. -@@ -5032,6 +5035,7 @@ brcmf_notify_connect_status(struct brcmf
  24956. - brcmf_init_prof(ndev_to_prof(ndev));
  24957. - if (ndev != cfg_to_ndev(cfg))
  24958. - complete(&cfg->vif_disabled);
  24959. -+ brcmf_net_setcarrier(ifp, false);
  24960. - } else if (brcmf_is_nonetwork(cfg, e)) {
  24961. - if (brcmf_is_ibssmode(ifp->vif))
  24962. - clear_bit(BRCMF_VIF_STATUS_CONNECTING,
  24963. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  24964. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  24965. -@@ -635,8 +635,7 @@ static int brcmf_netdev_stop(struct net_
  24966. -
  24967. - brcmf_cfg80211_down(ndev);
  24968. -
  24969. -- /* Set state and stop OS transmissions */
  24970. -- netif_stop_queue(ndev);
  24971. -+ brcmf_net_setcarrier(ifp, false);
  24972. -
  24973. - return 0;
  24974. - }
  24975. -@@ -670,8 +669,8 @@ static int brcmf_netdev_open(struct net_
  24976. - return -EIO;
  24977. - }
  24978. -
  24979. -- /* Allow transmit calls */
  24980. -- netif_start_queue(ndev);
  24981. -+ /* Clear, carrier, set when connected or AP mode. */
  24982. -+ netif_carrier_off(ndev);
  24983. - return 0;
  24984. - }
  24985. -
  24986. -@@ -736,6 +735,24 @@ static void brcmf_net_detach(struct net_
  24987. - brcmf_cfg80211_free_netdev(ndev);
  24988. - }
  24989. -
  24990. -+void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on)
  24991. -+{
  24992. -+ struct net_device *ndev;
  24993. -+
  24994. -+ brcmf_dbg(TRACE, "Enter, idx=%d carrier=%d\n", ifp->bssidx, on);
  24995. -+
  24996. -+ ndev = ifp->ndev;
  24997. -+ brcmf_txflowblock_if(ifp, BRCMF_NETIF_STOP_REASON_DISCONNECTED, !on);
  24998. -+ if (on) {
  24999. -+ if (!netif_carrier_ok(ndev))
  25000. -+ netif_carrier_on(ndev);
  25001. -+
  25002. -+ } else {
  25003. -+ if (netif_carrier_ok(ndev))
  25004. -+ netif_carrier_off(ndev);
  25005. -+ }
  25006. -+}
  25007. -+
  25008. - static int brcmf_net_p2p_open(struct net_device *ndev)
  25009. - {
  25010. - brcmf_dbg(TRACE, "Enter\n");
  25011. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  25012. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  25013. -@@ -154,10 +154,13 @@ struct brcmf_fws_mac_descriptor;
  25014. - * netif stopped due to firmware signalling flow control.
  25015. - * @BRCMF_NETIF_STOP_REASON_FLOW:
  25016. - * netif stopped due to flowring full.
  25017. -+ * @BRCMF_NETIF_STOP_REASON_DISCONNECTED:
  25018. -+ * netif stopped due to not being connected (STA mode).
  25019. - */
  25020. - enum brcmf_netif_stop_reason {
  25021. -- BRCMF_NETIF_STOP_REASON_FWS_FC = 1,
  25022. -- BRCMF_NETIF_STOP_REASON_FLOW = 2
  25023. -+ BRCMF_NETIF_STOP_REASON_FWS_FC = BIT(0),
  25024. -+ BRCMF_NETIF_STOP_REASON_FLOW = BIT(1),
  25025. -+ BRCMF_NETIF_STOP_REASON_DISCONNECTED = BIT(2)
  25026. - };
  25027. -
  25028. - /**
  25029. -@@ -213,5 +216,6 @@ void brcmf_txflowblock_if(struct brcmf_i
  25030. - enum brcmf_netif_stop_reason reason, bool state);
  25031. - void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  25032. - void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);
  25033. -+void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on);
  25034. -
  25035. - #endif /* BRCMFMAC_CORE_H */
  25036. diff --git a/package/kernel/mac80211/patches/373-brcm80211-Add-support-for-brcm4371.patch b/package/kernel/mac80211/patches/373-brcm80211-Add-support-for-brcm4371.patch
  25037. deleted file mode 100644
  25038. index ea6fad1..0000000
  25039. --- a/package/kernel/mac80211/patches/373-brcm80211-Add-support-for-brcm4371.patch
  25040. +++ /dev/null
  25041. @@ -1,78 +0,0 @@
  25042. -From: Eric Caruso <ejcaruso@google.com>
  25043. -Date: Wed, 14 Oct 2015 12:34:11 -0700
  25044. -Subject: [PATCH] brcm80211: Add support for brcm4371
  25045. -
  25046. -This is a new Broadcom chip and we should be able to recognize it.
  25047. -
  25048. -Signed-off-by: Eric Caruso <ejcaruso@google.com>
  25049. -Acked-by: Arend van Spriel <arend@broadcom.com>
  25050. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  25051. ----
  25052. -
  25053. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  25054. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  25055. -@@ -682,6 +682,7 @@ static u32 brcmf_chip_tcm_rambase(struct
  25056. - case BRCM_CC_43570_CHIP_ID:
  25057. - case BRCM_CC_4358_CHIP_ID:
  25058. - case BRCM_CC_43602_CHIP_ID:
  25059. -+ case BRCM_CC_4371_CHIP_ID:
  25060. - return 0x180000;
  25061. - case BRCM_CC_4365_CHIP_ID:
  25062. - case BRCM_CC_4366_CHIP_ID:
  25063. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  25064. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  25065. -@@ -59,6 +59,8 @@ enum brcmf_pcie_state {
  25066. - #define BRCMF_PCIE_4365_NVRAM_NAME "brcm/brcmfmac4365b-pcie.txt"
  25067. - #define BRCMF_PCIE_4366_FW_NAME "brcm/brcmfmac4366b-pcie.bin"
  25068. - #define BRCMF_PCIE_4366_NVRAM_NAME "brcm/brcmfmac4366b-pcie.txt"
  25069. -+#define BRCMF_PCIE_4371_FW_NAME "brcm/brcmfmac4371-pcie.bin"
  25070. -+#define BRCMF_PCIE_4371_NVRAM_NAME "brcm/brcmfmac4371-pcie.txt"
  25071. -
  25072. - #define BRCMF_PCIE_FW_UP_TIMEOUT 2000 /* msec */
  25073. -
  25074. -@@ -212,6 +214,8 @@ MODULE_FIRMWARE(BRCMF_PCIE_4365_FW_NAME)
  25075. - MODULE_FIRMWARE(BRCMF_PCIE_4365_NVRAM_NAME);
  25076. - MODULE_FIRMWARE(BRCMF_PCIE_4366_FW_NAME);
  25077. - MODULE_FIRMWARE(BRCMF_PCIE_4366_NVRAM_NAME);
  25078. -+MODULE_FIRMWARE(BRCMF_PCIE_4371_FW_NAME);
  25079. -+MODULE_FIRMWARE(BRCMF_PCIE_4371_NVRAM_NAME);
  25080. -
  25081. -
  25082. - struct brcmf_pcie_console {
  25083. -@@ -1521,6 +1525,10 @@ static int brcmf_pcie_get_fwnames(struct
  25084. - fw_name = BRCMF_PCIE_4366_FW_NAME;
  25085. - nvram_name = BRCMF_PCIE_4366_NVRAM_NAME;
  25086. - break;
  25087. -+ case BRCM_CC_4371_CHIP_ID:
  25088. -+ fw_name = BRCMF_PCIE_4371_FW_NAME;
  25089. -+ nvram_name = BRCMF_PCIE_4371_NVRAM_NAME;
  25090. -+ break;
  25091. - default:
  25092. - brcmf_err("Unsupported chip 0x%04x\n", devinfo->ci->chip);
  25093. - return -ENODEV;
  25094. -@@ -2060,6 +2068,7 @@ static struct pci_device_id brcmf_pcie_d
  25095. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_DEVICE_ID),
  25096. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_2G_DEVICE_ID),
  25097. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_5G_DEVICE_ID),
  25098. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4371_DEVICE_ID),
  25099. - { /* end: all zeroes */ }
  25100. - };
  25101. -
  25102. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  25103. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  25104. -@@ -50,6 +50,7 @@
  25105. - #define BRCM_CC_43602_CHIP_ID 43602
  25106. - #define BRCM_CC_4365_CHIP_ID 0x4365
  25107. - #define BRCM_CC_4366_CHIP_ID 0x4366
  25108. -+#define BRCM_CC_4371_CHIP_ID 0x4371
  25109. -
  25110. - /* USB Device IDs */
  25111. - #define BRCM_USB_43143_DEVICE_ID 0xbd1e
  25112. -@@ -75,6 +76,7 @@
  25113. - #define BRCM_PCIE_4366_DEVICE_ID 0x43c3
  25114. - #define BRCM_PCIE_4366_2G_DEVICE_ID 0x43c4
  25115. - #define BRCM_PCIE_4366_5G_DEVICE_ID 0x43c5
  25116. -+#define BRCM_PCIE_4371_DEVICE_ID 0x440d
  25117. -
  25118. -
  25119. - /* brcmsmac IDs */
  25120. diff --git a/package/kernel/mac80211/patches/374-0001-brcmfmac-Add-support-for-the-BCM4359-11ac-RSDB-PCIE-.patch b/package/kernel/mac80211/patches/374-0001-brcmfmac-Add-support-for-the-BCM4359-11ac-RSDB-PCIE-.patch
  25121. deleted file mode 100644
  25122. index 221bae6..0000000
  25123. --- a/package/kernel/mac80211/patches/374-0001-brcmfmac-Add-support-for-the-BCM4359-11ac-RSDB-PCIE-.patch
  25124. +++ /dev/null
  25125. @@ -1,78 +0,0 @@
  25126. -From: Hante Meuleman <meuleman@broadcom.com>
  25127. -Date: Thu, 29 Oct 2015 20:33:11 +0100
  25128. -Subject: [PATCH] brcmfmac: Add support for the BCM4359 11ac RSDB PCIE device.
  25129. -
  25130. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  25131. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  25132. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  25133. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  25134. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  25135. ----
  25136. -
  25137. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  25138. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  25139. -@@ -681,6 +681,7 @@ static u32 brcmf_chip_tcm_rambase(struct
  25140. - case BRCM_CC_43569_CHIP_ID:
  25141. - case BRCM_CC_43570_CHIP_ID:
  25142. - case BRCM_CC_4358_CHIP_ID:
  25143. -+ case BRCM_CC_4359_CHIP_ID:
  25144. - case BRCM_CC_43602_CHIP_ID:
  25145. - case BRCM_CC_4371_CHIP_ID:
  25146. - return 0x180000;
  25147. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  25148. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  25149. -@@ -55,6 +55,8 @@ enum brcmf_pcie_state {
  25150. - #define BRCMF_PCIE_43570_NVRAM_NAME "brcm/brcmfmac43570-pcie.txt"
  25151. - #define BRCMF_PCIE_4358_FW_NAME "brcm/brcmfmac4358-pcie.bin"
  25152. - #define BRCMF_PCIE_4358_NVRAM_NAME "brcm/brcmfmac4358-pcie.txt"
  25153. -+#define BRCMF_PCIE_4359_FW_NAME "brcm/brcmfmac4359-pcie.bin"
  25154. -+#define BRCMF_PCIE_4359_NVRAM_NAME "brcm/brcmfmac4359-pcie.txt"
  25155. - #define BRCMF_PCIE_4365_FW_NAME "brcm/brcmfmac4365b-pcie.bin"
  25156. - #define BRCMF_PCIE_4365_NVRAM_NAME "brcm/brcmfmac4365b-pcie.txt"
  25157. - #define BRCMF_PCIE_4366_FW_NAME "brcm/brcmfmac4366b-pcie.bin"
  25158. -@@ -210,6 +212,8 @@ MODULE_FIRMWARE(BRCMF_PCIE_43570_FW_NAME
  25159. - MODULE_FIRMWARE(BRCMF_PCIE_43570_NVRAM_NAME);
  25160. - MODULE_FIRMWARE(BRCMF_PCIE_4358_FW_NAME);
  25161. - MODULE_FIRMWARE(BRCMF_PCIE_4358_NVRAM_NAME);
  25162. -+MODULE_FIRMWARE(BRCMF_PCIE_4359_FW_NAME);
  25163. -+MODULE_FIRMWARE(BRCMF_PCIE_4359_NVRAM_NAME);
  25164. - MODULE_FIRMWARE(BRCMF_PCIE_4365_FW_NAME);
  25165. - MODULE_FIRMWARE(BRCMF_PCIE_4365_NVRAM_NAME);
  25166. - MODULE_FIRMWARE(BRCMF_PCIE_4366_FW_NAME);
  25167. -@@ -1517,6 +1521,10 @@ static int brcmf_pcie_get_fwnames(struct
  25168. - fw_name = BRCMF_PCIE_4358_FW_NAME;
  25169. - nvram_name = BRCMF_PCIE_4358_NVRAM_NAME;
  25170. - break;
  25171. -+ case BRCM_CC_4359_CHIP_ID:
  25172. -+ fw_name = BRCMF_PCIE_4359_FW_NAME;
  25173. -+ nvram_name = BRCMF_PCIE_4359_NVRAM_NAME;
  25174. -+ break;
  25175. - case BRCM_CC_4365_CHIP_ID:
  25176. - fw_name = BRCMF_PCIE_4365_FW_NAME;
  25177. - nvram_name = BRCMF_PCIE_4365_NVRAM_NAME;
  25178. -@@ -2058,6 +2066,7 @@ static struct pci_device_id brcmf_pcie_d
  25179. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43567_DEVICE_ID),
  25180. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43570_DEVICE_ID),
  25181. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4358_DEVICE_ID),
  25182. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4359_DEVICE_ID),
  25183. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_DEVICE_ID),
  25184. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_2G_DEVICE_ID),
  25185. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_5G_DEVICE_ID),
  25186. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  25187. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  25188. -@@ -47,6 +47,7 @@
  25189. - #define BRCM_CC_43569_CHIP_ID 43569
  25190. - #define BRCM_CC_43570_CHIP_ID 43570
  25191. - #define BRCM_CC_4358_CHIP_ID 0x4358
  25192. -+#define BRCM_CC_4359_CHIP_ID 0x4359
  25193. - #define BRCM_CC_43602_CHIP_ID 43602
  25194. - #define BRCM_CC_4365_CHIP_ID 0x4365
  25195. - #define BRCM_CC_4366_CHIP_ID 0x4366
  25196. -@@ -66,6 +67,7 @@
  25197. - #define BRCM_PCIE_43567_DEVICE_ID 0x43d3
  25198. - #define BRCM_PCIE_43570_DEVICE_ID 0x43d9
  25199. - #define BRCM_PCIE_4358_DEVICE_ID 0x43e9
  25200. -+#define BRCM_PCIE_4359_DEVICE_ID 0x43ef
  25201. - #define BRCM_PCIE_43602_DEVICE_ID 0x43ba
  25202. - #define BRCM_PCIE_43602_2G_DEVICE_ID 0x43bb
  25203. - #define BRCM_PCIE_43602_5G_DEVICE_ID 0x43bc
  25204. diff --git a/package/kernel/mac80211/patches/374-0002-brcmfmac-Simplify-and-fix-usage-of-brcmf_ifname.patch b/package/kernel/mac80211/patches/374-0002-brcmfmac-Simplify-and-fix-usage-of-brcmf_ifname.patch
  25205. deleted file mode 100644
  25206. index 331896b..0000000
  25207. --- a/package/kernel/mac80211/patches/374-0002-brcmfmac-Simplify-and-fix-usage-of-brcmf_ifname.patch
  25208. +++ /dev/null
  25209. @@ -1,110 +0,0 @@
  25210. -From: Hante Meuleman <meuleman@broadcom.com>
  25211. -Date: Thu, 29 Oct 2015 20:33:12 +0100
  25212. -Subject: [PATCH] brcmfmac: Simplify and fix usage of brcmf_ifname.
  25213. -
  25214. -brcmf_ifname is a debug function to return a name related to an ifp,
  25215. -but is using a rather complex implementation. It was also used
  25216. -wrongly from bcdc as it did not use the bsscfgidx as it was supposed
  25217. -to, but bssidx. This patch fixes that bug and simplifies
  25218. -brcmf_ifname.
  25219. -
  25220. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  25221. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  25222. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  25223. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  25224. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  25225. ----
  25226. -
  25227. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  25228. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  25229. -@@ -187,7 +187,8 @@ retry:
  25230. - goto retry;
  25231. - if (id != bcdc->reqid) {
  25232. - brcmf_err("%s: unexpected request id %d (expected %d)\n",
  25233. -- brcmf_ifname(drvr, ifidx), id, bcdc->reqid);
  25234. -+ brcmf_ifname(brcmf_get_ifp(drvr, ifidx)), id,
  25235. -+ bcdc->reqid);
  25236. - ret = -EINVAL;
  25237. - goto done;
  25238. - }
  25239. -@@ -234,7 +235,8 @@ brcmf_proto_bcdc_set_dcmd(struct brcmf_p
  25240. -
  25241. - if (id != bcdc->reqid) {
  25242. - brcmf_err("%s: unexpected request id %d (expected %d)\n",
  25243. -- brcmf_ifname(drvr, ifidx), id, bcdc->reqid);
  25244. -+ brcmf_ifname(brcmf_get_ifp(drvr, ifidx)), id,
  25245. -+ bcdc->reqid);
  25246. - ret = -EINVAL;
  25247. - goto done;
  25248. - }
  25249. -@@ -298,13 +300,13 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  25250. - if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) !=
  25251. - BCDC_PROTO_VER) {
  25252. - brcmf_err("%s: non-BCDC packet received, flags 0x%x\n",
  25253. -- brcmf_ifname(drvr, tmp_if->ifidx), h->flags);
  25254. -+ brcmf_ifname(tmp_if), h->flags);
  25255. - return -EBADE;
  25256. - }
  25257. -
  25258. - if (h->flags & BCDC_FLAG_SUM_GOOD) {
  25259. - brcmf_dbg(BCDC, "%s: BDC rcv, good checksum, flags 0x%x\n",
  25260. -- brcmf_ifname(drvr, tmp_if->ifidx), h->flags);
  25261. -+ brcmf_ifname(tmp_if), h->flags);
  25262. - pktbuf->ip_summed = CHECKSUM_UNNECESSARY;
  25263. - }
  25264. -
  25265. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  25266. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  25267. -@@ -66,20 +66,13 @@ static int brcmf_p2p_enable;
  25268. - module_param_named(p2pon, brcmf_p2p_enable, int, 0);
  25269. - MODULE_PARM_DESC(p2pon, "enable legacy p2p management functionality");
  25270. -
  25271. --char *brcmf_ifname(struct brcmf_pub *drvr, int ifidx)
  25272. -+char *brcmf_ifname(struct brcmf_if *ifp)
  25273. - {
  25274. -- if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  25275. -- brcmf_err("ifidx %d out of range\n", ifidx);
  25276. -- return "<if_bad>";
  25277. -- }
  25278. --
  25279. -- if (drvr->iflist[ifidx] == NULL) {
  25280. -- brcmf_err("null i/f %d\n", ifidx);
  25281. -+ if (!ifp)
  25282. - return "<if_null>";
  25283. -- }
  25284. -
  25285. -- if (drvr->iflist[ifidx]->ndev)
  25286. -- return drvr->iflist[ifidx]->ndev->name;
  25287. -+ if (ifp->ndev)
  25288. -+ return ifp->ndev->name;
  25289. -
  25290. - return "<if_none>";
  25291. - }
  25292. -@@ -237,14 +230,14 @@ static netdev_tx_t brcmf_netdev_start_xm
  25293. - struct sk_buff *skb2;
  25294. -
  25295. - brcmf_dbg(INFO, "%s: insufficient headroom\n",
  25296. -- brcmf_ifname(drvr, ifp->bssidx));
  25297. -+ brcmf_ifname(ifp));
  25298. - drvr->bus_if->tx_realloc++;
  25299. - skb2 = skb_realloc_headroom(skb, drvr->hdrlen);
  25300. - dev_kfree_skb(skb);
  25301. - skb = skb2;
  25302. - if (skb == NULL) {
  25303. - brcmf_err("%s: skb_realloc_headroom failed\n",
  25304. -- brcmf_ifname(drvr, ifp->bssidx));
  25305. -+ brcmf_ifname(ifp));
  25306. - ret = -ENOMEM;
  25307. - goto done;
  25308. - }
  25309. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  25310. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  25311. -@@ -205,7 +205,7 @@ struct brcmf_skb_reorder_data {
  25312. - int brcmf_netdev_wait_pend8021x(struct brcmf_if *ifp);
  25313. -
  25314. - /* Return pointer to interface name */
  25315. --char *brcmf_ifname(struct brcmf_pub *drvr, int idx);
  25316. -+char *brcmf_ifname(struct brcmf_if *ifp);
  25317. - struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  25318. - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  25319. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  25320. diff --git a/package/kernel/mac80211/patches/374-0003-brcmfmac-Remove-unnecessary-check-from-start_xmit.patch b/package/kernel/mac80211/patches/374-0003-brcmfmac-Remove-unnecessary-check-from-start_xmit.patch
  25321. deleted file mode 100644
  25322. index 4d60521..0000000
  25323. --- a/package/kernel/mac80211/patches/374-0003-brcmfmac-Remove-unnecessary-check-from-start_xmit.patch
  25324. +++ /dev/null
  25325. @@ -1,32 +0,0 @@
  25326. -From: Hante Meuleman <meuleman@broadcom.com>
  25327. -Date: Thu, 29 Oct 2015 20:33:13 +0100
  25328. -Subject: [PATCH] brcmfmac: Remove unnecessary check from start_xmit.
  25329. -
  25330. -The brcmf_netdev_start_xmit checks if the ndev is still valid by
  25331. -checking if it still exists in database. This check is not needed
  25332. -and therefor removed.
  25333. -
  25334. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  25335. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  25336. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  25337. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  25338. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  25339. ----
  25340. -
  25341. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  25342. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  25343. -@@ -217,14 +217,6 @@ static netdev_tx_t brcmf_netdev_start_xm
  25344. - goto done;
  25345. - }
  25346. -
  25347. -- if (!drvr->iflist[ifp->bssidx]) {
  25348. -- brcmf_err("bad ifidx %d\n", ifp->bssidx);
  25349. -- netif_stop_queue(ndev);
  25350. -- dev_kfree_skb(skb);
  25351. -- ret = -ENODEV;
  25352. -- goto done;
  25353. -- }
  25354. --
  25355. - /* Make sure there's enough room for any header */
  25356. - if (skb_headroom(skb) < drvr->hdrlen) {
  25357. - struct sk_buff *skb2;
  25358. diff --git a/package/kernel/mac80211/patches/374-0004-brcmfmac-Remove-unncessary-variable-irq_requested.patch b/package/kernel/mac80211/patches/374-0004-brcmfmac-Remove-unncessary-variable-irq_requested.patch
  25359. deleted file mode 100644
  25360. index 5030297..0000000
  25361. --- a/package/kernel/mac80211/patches/374-0004-brcmfmac-Remove-unncessary-variable-irq_requested.patch
  25362. +++ /dev/null
  25363. @@ -1,49 +0,0 @@
  25364. -From: Hante Meuleman <meuleman@broadcom.com>
  25365. -Date: Thu, 29 Oct 2015 20:33:14 +0100
  25366. -Subject: [PATCH] brcmfmac: Remove unncessary variable irq_requested.
  25367. -
  25368. -The variable irq_requested is unneeded as the functionality
  25369. -it is providing, is also provided by the variable irq_allocated.
  25370. -
  25371. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  25372. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  25373. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  25374. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  25375. ----
  25376. -
  25377. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  25378. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  25379. -@@ -257,7 +257,6 @@ struct brcmf_pcie_core_info {
  25380. - struct brcmf_pciedev_info {
  25381. - enum brcmf_pcie_state state;
  25382. - bool in_irq;
  25383. -- bool irq_requested;
  25384. - struct pci_dev *pdev;
  25385. - char fw_name[BRCMF_FW_PATH_LEN + BRCMF_FW_NAME_LEN];
  25386. - char nvram_name[BRCMF_FW_PATH_LEN + BRCMF_FW_NAME_LEN];
  25387. -@@ -889,7 +888,6 @@ static int brcmf_pcie_request_irq(struct
  25388. -
  25389. - brcmf_dbg(PCIE, "Enter\n");
  25390. - /* is it a v1 or v2 implementation */
  25391. -- devinfo->irq_requested = false;
  25392. - pci_enable_msi(pdev);
  25393. - if (devinfo->generic_corerev == BRCMF_PCIE_GENREV1) {
  25394. - if (request_threaded_irq(pdev->irq,
  25395. -@@ -912,7 +910,6 @@ static int brcmf_pcie_request_irq(struct
  25396. - return -EIO;
  25397. - }
  25398. - }
  25399. -- devinfo->irq_requested = true;
  25400. - devinfo->irq_allocated = true;
  25401. - return 0;
  25402. - }
  25403. -@@ -930,9 +927,6 @@ static void brcmf_pcie_release_irq(struc
  25404. - pdev = devinfo->pdev;
  25405. -
  25406. - brcmf_pcie_intr_disable(devinfo);
  25407. -- if (!devinfo->irq_requested)
  25408. -- return;
  25409. -- devinfo->irq_requested = false;
  25410. - free_irq(pdev->irq, devinfo);
  25411. - pci_disable_msi(pdev);
  25412. -
  25413. diff --git a/package/kernel/mac80211/patches/374-0005-brcmfmac-Disable-runtime-pm-for-USB.patch b/package/kernel/mac80211/patches/374-0005-brcmfmac-Disable-runtime-pm-for-USB.patch
  25414. deleted file mode 100644
  25415. index f2afb90..0000000
  25416. --- a/package/kernel/mac80211/patches/374-0005-brcmfmac-Disable-runtime-pm-for-USB.patch
  25417. +++ /dev/null
  25418. @@ -1,26 +0,0 @@
  25419. -From: Hante Meuleman <meuleman@broadcom.com>
  25420. -Date: Thu, 29 Oct 2015 20:33:15 +0100
  25421. -Subject: [PATCH] brcmfmac: Disable runtime pm for USB.
  25422. -
  25423. -Currently runtime pm is enabled for USB, but it is not properly
  25424. -supported by driver. This patch disables the runtime PM support
  25425. -completely for USB, as it currently can result in problems on
  25426. -some systems.
  25427. -
  25428. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  25429. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  25430. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  25431. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  25432. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  25433. ----
  25434. -
  25435. ---- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  25436. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  25437. -@@ -1504,7 +1504,6 @@ static struct usb_driver brcmf_usbdrvr =
  25438. - .suspend = brcmf_usb_suspend,
  25439. - .resume = brcmf_usb_resume,
  25440. - .reset_resume = brcmf_usb_reset_resume,
  25441. -- .supports_autosuspend = 1,
  25442. - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
  25443. - .disable_hub_initiated_lpm = 1,
  25444. - #endif
  25445. diff --git a/package/kernel/mac80211/patches/374-0006-brcmfmac-Add-RSDB-support.patch b/package/kernel/mac80211/patches/374-0006-brcmfmac-Add-RSDB-support.patch
  25446. deleted file mode 100644
  25447. index 78a95c5..0000000
  25448. --- a/package/kernel/mac80211/patches/374-0006-brcmfmac-Add-RSDB-support.patch
  25449. +++ /dev/null
  25450. @@ -1,65 +0,0 @@
  25451. -From: Hante Meuleman <meuleman@broadcom.com>
  25452. -Date: Thu, 29 Oct 2015 20:33:16 +0100
  25453. -Subject: [PATCH] brcmfmac: Add RSDB support.
  25454. -
  25455. -Broadcom devices with a single 802.11 core can work on two band
  25456. -concurrently using VSDB feature, ie. Virtual Simultaneous Dual-Band.
  25457. -For devices that are fitted with two 802.11 cores and RF paths the
  25458. -driver should support a firmware feature called RSDB, which stands
  25459. -for Real Simultaneous Dual-Band. RSDB works almost autonomously in
  25460. -firmware except for AP config. When the device supports RSDB then
  25461. -the interface should not be brought down when configuring it,
  25462. -otherwise the link (if configured) on the other interface will be
  25463. -lost.
  25464. -
  25465. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  25466. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  25467. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  25468. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  25469. -[kvalo@codeaurora.org: changed the commit log based on discussion]
  25470. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  25471. ----
  25472. -
  25473. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  25474. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  25475. -@@ -4182,7 +4182,9 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  25476. - }
  25477. - }
  25478. -
  25479. -- if (dev_role == NL80211_IFTYPE_AP) {
  25480. -+ if ((dev_role == NL80211_IFTYPE_AP) &&
  25481. -+ ((ifp->ifidx == 0) ||
  25482. -+ !brcmf_feat_is_enabled(ifp, BRCMF_FEAT_RSDB))) {
  25483. - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
  25484. - if (err < 0) {
  25485. - brcmf_err("BRCMF_C_DOWN error %d\n", err);
  25486. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  25487. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  25488. -@@ -137,6 +137,7 @@ void brcmf_feat_attach(struct brcmf_pub
  25489. - if (drvr->bus_if->chip != BRCM_CC_43362_CHIP_ID)
  25490. - brcmf_feat_iovar_int_set(ifp, BRCMF_FEAT_MBSS, "mbss", 0);
  25491. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_P2P, "p2p");
  25492. -+ brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_RSDB, "rsdb_mode");
  25493. -
  25494. - if (brcmf_feature_disable) {
  25495. - brcmf_dbg(INFO, "Features: 0x%02x, disable: 0x%02x\n",
  25496. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  25497. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  25498. -@@ -24,13 +24,16 @@
  25499. - * PNO: preferred network offload.
  25500. - * WOWL: Wake-On-WLAN.
  25501. - * P2P: peer-to-peer
  25502. -+ * RSDB: Real Simultaneous Dual Band
  25503. - */
  25504. - #define BRCMF_FEAT_LIST \
  25505. - BRCMF_FEAT_DEF(MBSS) \
  25506. - BRCMF_FEAT_DEF(MCHAN) \
  25507. - BRCMF_FEAT_DEF(PNO) \
  25508. - BRCMF_FEAT_DEF(WOWL) \
  25509. -- BRCMF_FEAT_DEF(P2P)
  25510. -+ BRCMF_FEAT_DEF(P2P) \
  25511. -+ BRCMF_FEAT_DEF(RSDB)
  25512. -+
  25513. - /*
  25514. - * Quirks:
  25515. - *
  25516. diff --git a/package/kernel/mac80211/patches/374-0007-brcmfmac-Use-consistent-naming-for-bsscfgidx.patch b/package/kernel/mac80211/patches/374-0007-brcmfmac-Use-consistent-naming-for-bsscfgidx.patch
  25517. deleted file mode 100644
  25518. index d1e7264..0000000
  25519. --- a/package/kernel/mac80211/patches/374-0007-brcmfmac-Use-consistent-naming-for-bsscfgidx.patch
  25520. +++ /dev/null
  25521. @@ -1,533 +0,0 @@
  25522. -From: Hante Meuleman <meuleman@broadcom.com>
  25523. -Date: Thu, 29 Oct 2015 20:33:17 +0100
  25524. -Subject: [PATCH] brcmfmac: Use consistent naming for bsscfgidx.
  25525. -
  25526. -The variable bsscfgidx is used in different places with different
  25527. -names, e.g. bsscfg, bssidx, bsscfg_idx. This patch cleans this up
  25528. -by using bsscfgidx everywhere.
  25529. -
  25530. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  25531. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  25532. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  25533. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  25534. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  25535. ----
  25536. -
  25537. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  25538. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  25539. -@@ -775,7 +775,8 @@ brcmf_cfg80211_change_iface(struct wiphy
  25540. - s32 ap = 0;
  25541. - s32 err = 0;
  25542. -
  25543. -- brcmf_dbg(TRACE, "Enter, idx=%d, type=%d\n", ifp->bssidx, type);
  25544. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, type=%d\n", ifp->bsscfgidx,
  25545. -+ type);
  25546. -
  25547. - /* WAR: There are a number of p2p interface related problems which
  25548. - * need to be handled initially (before doing the validate).
  25549. -@@ -2920,7 +2921,7 @@ brcmf_cfg80211_escan_handler(struct brcm
  25550. - status = e->status;
  25551. -
  25552. - if (!test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) {
  25553. -- brcmf_err("scan not ready, bssidx=%d\n", ifp->bssidx);
  25554. -+ brcmf_err("scan not ready, bsscfgidx=%d\n", ifp->bsscfgidx);
  25555. - return -EPERM;
  25556. - }
  25557. -
  25558. -@@ -3876,7 +3877,8 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
  25559. - ifp = vif->ifp;
  25560. - saved_ie = &vif->saved_ie;
  25561. -
  25562. -- brcmf_dbg(TRACE, "bssidx %d, pktflag : 0x%02X\n", ifp->bssidx, pktflag);
  25563. -+ brcmf_dbg(TRACE, "bsscfgidx %d, pktflag : 0x%02X\n", ifp->bsscfgidx,
  25564. -+ pktflag);
  25565. - iovar_ie_buf = kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL);
  25566. - if (!iovar_ie_buf)
  25567. - return -ENOMEM;
  25568. -@@ -4240,7 +4242,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  25569. - brcmf_err("setting ssid failed %d\n", err);
  25570. - goto exit;
  25571. - }
  25572. -- bss_enable.bsscfg_idx = cpu_to_le32(ifp->bssidx);
  25573. -+ bss_enable.bsscfgidx = cpu_to_le32(ifp->bsscfgidx);
  25574. - bss_enable.enable = cpu_to_le32(1);
  25575. - err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
  25576. - sizeof(bss_enable));
  25577. -@@ -4307,7 +4309,7 @@ static int brcmf_cfg80211_stop_ap(struct
  25578. - if (err < 0)
  25579. - brcmf_err("BRCMF_C_UP error %d\n", err);
  25580. - } else {
  25581. -- bss_enable.bsscfg_idx = cpu_to_le32(ifp->bssidx);
  25582. -+ bss_enable.bsscfgidx = cpu_to_le32(ifp->bsscfgidx);
  25583. - bss_enable.enable = cpu_to_le32(0);
  25584. - err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
  25585. - sizeof(bss_enable));
  25586. -@@ -5093,9 +5095,9 @@ static s32 brcmf_notify_vif_event(struct
  25587. - struct brcmf_cfg80211_vif_event *event = &cfg->vif_event;
  25588. - struct brcmf_cfg80211_vif *vif;
  25589. -
  25590. -- brcmf_dbg(TRACE, "Enter: action %u flags %u ifidx %u bsscfg %u\n",
  25591. -+ brcmf_dbg(TRACE, "Enter: action %u flags %u ifidx %u bsscfgidx %u\n",
  25592. - ifevent->action, ifevent->flags, ifevent->ifidx,
  25593. -- ifevent->bssidx);
  25594. -+ ifevent->bsscfgidx);
  25595. -
  25596. - mutex_lock(&event->vif_event_lock);
  25597. - event->action = ifevent->action;
  25598. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  25599. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  25600. -@@ -80,7 +80,7 @@ char *brcmf_ifname(struct brcmf_if *ifp)
  25601. - struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx)
  25602. - {
  25603. - struct brcmf_if *ifp;
  25604. -- s32 bssidx;
  25605. -+ s32 bsscfgidx;
  25606. -
  25607. - if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  25608. - brcmf_err("ifidx %d out of range\n", ifidx);
  25609. -@@ -88,9 +88,9 @@ struct brcmf_if *brcmf_get_ifp(struct br
  25610. - }
  25611. -
  25612. - ifp = NULL;
  25613. -- bssidx = drvr->if2bss[ifidx];
  25614. -- if (bssidx >= 0)
  25615. -- ifp = drvr->iflist[bssidx];
  25616. -+ bsscfgidx = drvr->if2bss[ifidx];
  25617. -+ if (bsscfgidx >= 0)
  25618. -+ ifp = drvr->iflist[bsscfgidx];
  25619. -
  25620. - return ifp;
  25621. - }
  25622. -@@ -108,7 +108,7 @@ static void _brcmf_set_multicast_list(st
  25623. -
  25624. - ifp = container_of(work, struct brcmf_if, multicast_work);
  25625. -
  25626. -- brcmf_dbg(TRACE, "Enter, idx=%d\n", ifp->bssidx);
  25627. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
  25628. -
  25629. - ndev = ifp->ndev;
  25630. -
  25631. -@@ -168,7 +168,7 @@ _brcmf_set_mac_address(struct work_struc
  25632. -
  25633. - ifp = container_of(work, struct brcmf_if, setmacaddr_work);
  25634. -
  25635. -- brcmf_dbg(TRACE, "Enter, idx=%d\n", ifp->bssidx);
  25636. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
  25637. -
  25638. - err = brcmf_fil_iovar_data_set(ifp, "cur_etheraddr", ifp->mac_addr,
  25639. - ETH_ALEN);
  25640. -@@ -206,7 +206,7 @@ static netdev_tx_t brcmf_netdev_start_xm
  25641. - struct brcmf_pub *drvr = ifp->drvr;
  25642. - struct ethhdr *eh = (struct ethhdr *)(skb->data);
  25643. -
  25644. -- brcmf_dbg(DATA, "Enter, idx=%d\n", ifp->bssidx);
  25645. -+ brcmf_dbg(DATA, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
  25646. -
  25647. - /* Can the device send data? */
  25648. - if (drvr->bus_if->state != BRCMF_BUS_UP) {
  25649. -@@ -267,8 +267,8 @@ void brcmf_txflowblock_if(struct brcmf_i
  25650. - if (!ifp || !ifp->ndev)
  25651. - return;
  25652. -
  25653. -- brcmf_dbg(TRACE, "enter: idx=%d stop=0x%X reason=%d state=%d\n",
  25654. -- ifp->bssidx, ifp->netif_stop, reason, state);
  25655. -+ brcmf_dbg(TRACE, "enter: bsscfgidx=%d stop=0x%X reason=%d state=%d\n",
  25656. -+ ifp->bsscfgidx, ifp->netif_stop, reason, state);
  25657. -
  25658. - spin_lock_irqsave(&ifp->netif_stop_lock, flags);
  25659. - if (state) {
  25660. -@@ -587,7 +587,7 @@ static struct net_device_stats *brcmf_ne
  25661. - {
  25662. - struct brcmf_if *ifp = netdev_priv(ndev);
  25663. -
  25664. -- brcmf_dbg(TRACE, "Enter, idx=%d\n", ifp->bssidx);
  25665. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
  25666. -
  25667. - return &ifp->stats;
  25668. - }
  25669. -@@ -616,7 +616,7 @@ static int brcmf_netdev_stop(struct net_
  25670. - {
  25671. - struct brcmf_if *ifp = netdev_priv(ndev);
  25672. -
  25673. -- brcmf_dbg(TRACE, "Enter, idx=%d\n", ifp->bssidx);
  25674. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
  25675. -
  25676. - brcmf_cfg80211_down(ndev);
  25677. -
  25678. -@@ -632,7 +632,7 @@ static int brcmf_netdev_open(struct net_
  25679. - struct brcmf_bus *bus_if = drvr->bus_if;
  25680. - u32 toe_ol;
  25681. -
  25682. -- brcmf_dbg(TRACE, "Enter, idx=%d\n", ifp->bssidx);
  25683. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
  25684. -
  25685. - /* If bus is not ready, can't continue */
  25686. - if (bus_if->state != BRCMF_BUS_UP) {
  25687. -@@ -674,7 +674,7 @@ int brcmf_net_attach(struct brcmf_if *if
  25688. - struct net_device *ndev;
  25689. - s32 err;
  25690. -
  25691. -- brcmf_dbg(TRACE, "Enter, idx=%d mac=%pM\n", ifp->bssidx,
  25692. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d mac=%pM\n", ifp->bsscfgidx,
  25693. - ifp->mac_addr);
  25694. - ndev = ifp->ndev;
  25695. -
  25696. -@@ -706,7 +706,7 @@ int brcmf_net_attach(struct brcmf_if *if
  25697. - return 0;
  25698. -
  25699. - fail:
  25700. -- drvr->iflist[ifp->bssidx] = NULL;
  25701. -+ drvr->iflist[ifp->bsscfgidx] = NULL;
  25702. - ndev->netdev_ops = NULL;
  25703. - free_netdev(ndev);
  25704. - return -EBADE;
  25705. -@@ -724,7 +724,8 @@ void brcmf_net_setcarrier(struct brcmf_i
  25706. - {
  25707. - struct net_device *ndev;
  25708. -
  25709. -- brcmf_dbg(TRACE, "Enter, idx=%d carrier=%d\n", ifp->bssidx, on);
  25710. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d carrier=%d\n", ifp->bsscfgidx,
  25711. -+ on);
  25712. -
  25713. - ndev = ifp->ndev;
  25714. - brcmf_txflowblock_if(ifp, BRCMF_NETIF_STOP_REASON_DISCONNECTED, !on);
  25715. -@@ -771,7 +772,7 @@ static int brcmf_net_p2p_attach(struct b
  25716. - {
  25717. - struct net_device *ndev;
  25718. -
  25719. -- brcmf_dbg(TRACE, "Enter, idx=%d mac=%pM\n", ifp->bssidx,
  25720. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d mac=%pM\n", ifp->bsscfgidx,
  25721. - ifp->mac_addr);
  25722. - ndev = ifp->ndev;
  25723. -
  25724. -@@ -790,21 +791,21 @@ static int brcmf_net_p2p_attach(struct b
  25725. - return 0;
  25726. -
  25727. - fail:
  25728. -- ifp->drvr->iflist[ifp->bssidx] = NULL;
  25729. -+ ifp->drvr->iflist[ifp->bsscfgidx] = NULL;
  25730. - ndev->netdev_ops = NULL;
  25731. - free_netdev(ndev);
  25732. - return -EBADE;
  25733. - }
  25734. -
  25735. --struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  25736. -+struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  25737. - bool is_p2pdev, char *name, u8 *mac_addr)
  25738. - {
  25739. - struct brcmf_if *ifp;
  25740. - struct net_device *ndev;
  25741. -
  25742. -- brcmf_dbg(TRACE, "Enter, idx=%d, ifidx=%d\n", bssidx, ifidx);
  25743. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", bsscfgidx, ifidx);
  25744. -
  25745. -- ifp = drvr->iflist[bssidx];
  25746. -+ ifp = drvr->iflist[bsscfgidx];
  25747. - /*
  25748. - * Delete the existing interface before overwriting it
  25749. - * in case we missed the BRCMF_E_IF_DEL event.
  25750. -@@ -815,7 +816,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  25751. - if (ifidx) {
  25752. - netif_stop_queue(ifp->ndev);
  25753. - brcmf_net_detach(ifp->ndev);
  25754. -- drvr->iflist[bssidx] = NULL;
  25755. -+ drvr->iflist[bsscfgidx] = NULL;
  25756. - } else {
  25757. - brcmf_err("ignore IF event\n");
  25758. - return ERR_PTR(-EINVAL);
  25759. -@@ -839,15 +840,15 @@ struct brcmf_if *brcmf_add_if(struct brc
  25760. - ndev->destructor = brcmf_cfg80211_free_netdev;
  25761. - ifp = netdev_priv(ndev);
  25762. - ifp->ndev = ndev;
  25763. -- /* store mapping ifidx to bssidx */
  25764. -+ /* store mapping ifidx to bsscfgidx */
  25765. - if (drvr->if2bss[ifidx] == BRCMF_BSSIDX_INVALID)
  25766. -- drvr->if2bss[ifidx] = bssidx;
  25767. -+ drvr->if2bss[ifidx] = bsscfgidx;
  25768. - }
  25769. -
  25770. - ifp->drvr = drvr;
  25771. -- drvr->iflist[bssidx] = ifp;
  25772. -+ drvr->iflist[bsscfgidx] = ifp;
  25773. - ifp->ifidx = ifidx;
  25774. -- ifp->bssidx = bssidx;
  25775. -+ ifp->bsscfgidx = bsscfgidx;
  25776. -
  25777. - init_waitqueue_head(&ifp->pend_8021x_wait);
  25778. - spin_lock_init(&ifp->netif_stop_lock);
  25779. -@@ -861,21 +862,22 @@ struct brcmf_if *brcmf_add_if(struct brc
  25780. - return ifp;
  25781. - }
  25782. -
  25783. --static void brcmf_del_if(struct brcmf_pub *drvr, s32 bssidx)
  25784. -+static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx)
  25785. - {
  25786. - struct brcmf_if *ifp;
  25787. -
  25788. -- ifp = drvr->iflist[bssidx];
  25789. -- drvr->iflist[bssidx] = NULL;
  25790. -+ ifp = drvr->iflist[bsscfgidx];
  25791. -+ drvr->iflist[bsscfgidx] = NULL;
  25792. - if (!ifp) {
  25793. -- brcmf_err("Null interface, idx=%d\n", bssidx);
  25794. -+ brcmf_err("Null interface, bsscfgidx=%d\n", bsscfgidx);
  25795. - return;
  25796. - }
  25797. -- brcmf_dbg(TRACE, "Enter, idx=%d, ifidx=%d\n", bssidx, ifp->ifidx);
  25798. -- if (drvr->if2bss[ifp->ifidx] == bssidx)
  25799. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", bsscfgidx,
  25800. -+ ifp->ifidx);
  25801. -+ if (drvr->if2bss[ifp->ifidx] == bsscfgidx)
  25802. - drvr->if2bss[ifp->ifidx] = BRCMF_BSSIDX_INVALID;
  25803. - if (ifp->ndev) {
  25804. -- if (bssidx == 0) {
  25805. -+ if (bsscfgidx == 0) {
  25806. - if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) {
  25807. - rtnl_lock();
  25808. - brcmf_netdev_stop(ifp->ndev);
  25809. -@@ -905,12 +907,12 @@ static void brcmf_del_if(struct brcmf_pu
  25810. -
  25811. - void brcmf_remove_interface(struct brcmf_if *ifp)
  25812. - {
  25813. -- if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bssidx] != ifp))
  25814. -+ if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bsscfgidx] != ifp))
  25815. - return;
  25816. -- brcmf_dbg(TRACE, "Enter, bssidx=%d, ifidx=%d\n", ifp->bssidx,
  25817. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", ifp->bsscfgidx,
  25818. - ifp->ifidx);
  25819. - brcmf_fws_del_interface(ifp);
  25820. -- brcmf_del_if(ifp->drvr, ifp->bssidx);
  25821. -+ brcmf_del_if(ifp->drvr, ifp->bsscfgidx);
  25822. - }
  25823. -
  25824. - int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr)
  25825. -@@ -925,10 +927,10 @@ int brcmf_get_next_free_bsscfgidx(struct
  25826. - highest = 2;
  25827. - for (ifidx = 0; ifidx < BRCMF_MAX_IFS; ifidx++) {
  25828. - if (drvr->iflist[ifidx]) {
  25829. -- if (drvr->iflist[ifidx]->bssidx == bsscfgidx)
  25830. -+ if (drvr->iflist[ifidx]->bsscfgidx == bsscfgidx)
  25831. - bsscfgidx = highest + 1;
  25832. -- else if (drvr->iflist[ifidx]->bssidx > highest)
  25833. -- highest = drvr->iflist[ifidx]->bssidx;
  25834. -+ else if (drvr->iflist[ifidx]->bsscfgidx > highest)
  25835. -+ highest = drvr->iflist[ifidx]->bsscfgidx;
  25836. - } else {
  25837. - available = true;
  25838. - }
  25839. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  25840. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  25841. -@@ -174,7 +174,7 @@ enum brcmf_netif_stop_reason {
  25842. - * @multicast_work: worker object for multicast provisioning.
  25843. - * @fws_desc: interface specific firmware-signalling descriptor.
  25844. - * @ifidx: interface index in device firmware.
  25845. -- * @bssidx: index of bss associated with this interface.
  25846. -+ * @bsscfgidx: index of bss associated with this interface.
  25847. - * @mac_addr: assigned mac address.
  25848. - * @netif_stop: bitmap indicates reason why netif queues are stopped.
  25849. - * @netif_stop_lock: spinlock for update netif_stop from multiple sources.
  25850. -@@ -190,7 +190,7 @@ struct brcmf_if {
  25851. - struct work_struct multicast_work;
  25852. - struct brcmf_fws_mac_descriptor *fws_desc;
  25853. - int ifidx;
  25854. -- s32 bssidx;
  25855. -+ s32 bsscfgidx;
  25856. - u8 mac_addr[ETH_ALEN];
  25857. - u8 netif_stop;
  25858. - spinlock_t netif_stop_lock;
  25859. -@@ -208,7 +208,7 @@ int brcmf_netdev_wait_pend8021x(struct b
  25860. - char *brcmf_ifname(struct brcmf_if *ifp);
  25861. - struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  25862. - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  25863. --struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  25864. -+struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  25865. - bool is_p2pdev, char *name, u8 *mac_addr);
  25866. - void brcmf_remove_interface(struct brcmf_if *ifp);
  25867. - int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  25868. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  25869. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  25870. -@@ -49,7 +49,7 @@ static int brcmf_debug_psm_watchdog_noti
  25871. - const struct brcmf_event_msg *evtmsg,
  25872. - void *data)
  25873. - {
  25874. -- brcmf_dbg(TRACE, "enter: idx=%d\n", ifp->bssidx);
  25875. -+ brcmf_dbg(TRACE, "enter: bsscfgidx=%d\n", ifp->bsscfgidx);
  25876. -
  25877. - return brcmf_debug_create_memdump(ifp->drvr->bus_if, data,
  25878. - evtmsg->datalen);
  25879. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  25880. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  25881. -@@ -182,8 +182,8 @@ static void brcmf_fweh_handle_if_event(s
  25882. - bool is_p2pdev;
  25883. - int err = 0;
  25884. -
  25885. -- brcmf_dbg(EVENT, "action: %u idx: %u bsscfg: %u flags: %u role: %u\n",
  25886. -- ifevent->action, ifevent->ifidx, ifevent->bssidx,
  25887. -+ brcmf_dbg(EVENT, "action: %u ifidx: %u bsscfgidx: %u flags: %u role: %u\n",
  25888. -+ ifevent->action, ifevent->ifidx, ifevent->bsscfgidx,
  25889. - ifevent->flags, ifevent->role);
  25890. -
  25891. - /* The P2P Device interface event must not be ignored contrary to what
  25892. -@@ -204,12 +204,12 @@ static void brcmf_fweh_handle_if_event(s
  25893. - return;
  25894. - }
  25895. -
  25896. -- ifp = drvr->iflist[ifevent->bssidx];
  25897. -+ ifp = drvr->iflist[ifevent->bsscfgidx];
  25898. -
  25899. - if (ifevent->action == BRCMF_E_IF_ADD) {
  25900. - brcmf_dbg(EVENT, "adding %s (%pM)\n", emsg->ifname,
  25901. - emsg->addr);
  25902. -- ifp = brcmf_add_if(drvr, ifevent->bssidx, ifevent->ifidx,
  25903. -+ ifp = brcmf_add_if(drvr, ifevent->bsscfgidx, ifevent->ifidx,
  25904. - is_p2pdev, emsg->ifname, emsg->addr);
  25905. - if (IS_ERR(ifp))
  25906. - return;
  25907. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  25908. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  25909. -@@ -219,7 +219,7 @@ struct brcmf_if_event {
  25910. - u8 ifidx;
  25911. - u8 action;
  25912. - u8 flags;
  25913. -- u8 bssidx;
  25914. -+ u8 bsscfgidx;
  25915. - u8 role;
  25916. - };
  25917. -
  25918. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwil.c
  25919. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil.c
  25920. -@@ -293,22 +293,22 @@ brcmf_fil_iovar_int_get(struct brcmf_if
  25921. - }
  25922. -
  25923. - static u32
  25924. --brcmf_create_bsscfg(s32 bssidx, char *name, char *data, u32 datalen, char *buf,
  25925. -- u32 buflen)
  25926. -+brcmf_create_bsscfg(s32 bsscfgidx, char *name, char *data, u32 datalen,
  25927. -+ char *buf, u32 buflen)
  25928. - {
  25929. - const s8 *prefix = "bsscfg:";
  25930. - s8 *p;
  25931. - u32 prefixlen;
  25932. - u32 namelen;
  25933. - u32 iolen;
  25934. -- __le32 bssidx_le;
  25935. -+ __le32 bsscfgidx_le;
  25936. -
  25937. -- if (bssidx == 0)
  25938. -+ if (bsscfgidx == 0)
  25939. - return brcmf_create_iovar(name, data, datalen, buf, buflen);
  25940. -
  25941. - prefixlen = strlen(prefix);
  25942. - namelen = strlen(name) + 1; /* lengh of iovar name + null */
  25943. -- iolen = prefixlen + namelen + sizeof(bssidx_le) + datalen;
  25944. -+ iolen = prefixlen + namelen + sizeof(bsscfgidx_le) + datalen;
  25945. -
  25946. - if (buflen < iolen) {
  25947. - brcmf_err("buffer is too short\n");
  25948. -@@ -326,9 +326,9 @@ brcmf_create_bsscfg(s32 bssidx, char *na
  25949. - p += namelen;
  25950. -
  25951. - /* bss config index as first data */
  25952. -- bssidx_le = cpu_to_le32(bssidx);
  25953. -- memcpy(p, &bssidx_le, sizeof(bssidx_le));
  25954. -- p += sizeof(bssidx_le);
  25955. -+ bsscfgidx_le = cpu_to_le32(bsscfgidx);
  25956. -+ memcpy(p, &bsscfgidx_le, sizeof(bsscfgidx_le));
  25957. -+ p += sizeof(bsscfgidx_le);
  25958. -
  25959. - /* parameter buffer follows */
  25960. - if (datalen)
  25961. -@@ -347,12 +347,12 @@ brcmf_fil_bsscfg_data_set(struct brcmf_i
  25962. -
  25963. - mutex_lock(&drvr->proto_block);
  25964. -
  25965. -- brcmf_dbg(FIL, "ifidx=%d, bssidx=%d, name=%s, len=%d\n", ifp->ifidx,
  25966. -- ifp->bssidx, name, len);
  25967. -+ brcmf_dbg(FIL, "ifidx=%d, bsscfgidx=%d, name=%s, len=%d\n", ifp->ifidx,
  25968. -+ ifp->bsscfgidx, name, len);
  25969. - brcmf_dbg_hex_dump(BRCMF_FIL_ON(), data,
  25970. - min_t(uint, len, MAX_HEX_DUMP_LEN), "data\n");
  25971. -
  25972. -- buflen = brcmf_create_bsscfg(ifp->bssidx, name, data, len,
  25973. -+ buflen = brcmf_create_bsscfg(ifp->bsscfgidx, name, data, len,
  25974. - drvr->proto_buf, sizeof(drvr->proto_buf));
  25975. - if (buflen) {
  25976. - err = brcmf_fil_cmd_data(ifp, BRCMF_C_SET_VAR, drvr->proto_buf,
  25977. -@@ -376,7 +376,7 @@ brcmf_fil_bsscfg_data_get(struct brcmf_i
  25978. -
  25979. - mutex_lock(&drvr->proto_block);
  25980. -
  25981. -- buflen = brcmf_create_bsscfg(ifp->bssidx, name, data, len,
  25982. -+ buflen = brcmf_create_bsscfg(ifp->bsscfgidx, name, data, len,
  25983. - drvr->proto_buf, sizeof(drvr->proto_buf));
  25984. - if (buflen) {
  25985. - err = brcmf_fil_cmd_data(ifp, BRCMF_C_GET_VAR, drvr->proto_buf,
  25986. -@@ -387,8 +387,8 @@ brcmf_fil_bsscfg_data_get(struct brcmf_i
  25987. - err = -EPERM;
  25988. - brcmf_err("Creating bsscfg failed\n");
  25989. - }
  25990. -- brcmf_dbg(FIL, "ifidx=%d, bssidx=%d, name=%s, len=%d\n", ifp->ifidx,
  25991. -- ifp->bssidx, name, len);
  25992. -+ brcmf_dbg(FIL, "ifidx=%d, bsscfgidx=%d, name=%s, len=%d\n", ifp->ifidx,
  25993. -+ ifp->bsscfgidx, name, len);
  25994. - brcmf_dbg_hex_dump(BRCMF_FIL_ON(), data,
  25995. - min_t(uint, len, MAX_HEX_DUMP_LEN), "data\n");
  25996. -
  25997. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  25998. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  25999. -@@ -170,7 +170,7 @@ struct brcmf_fil_af_params_le {
  26000. - };
  26001. -
  26002. - struct brcmf_fil_bss_enable_le {
  26003. -- __le32 bsscfg_idx;
  26004. -+ __le32 bsscfgidx;
  26005. - __le32 enable;
  26006. - };
  26007. -
  26008. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  26009. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  26010. -@@ -719,7 +719,7 @@ static void brcmf_fws_macdesc_init(struc
  26011. - desc->state = BRCMF_FWS_STATE_OPEN;
  26012. - desc->requested_credit = 0;
  26013. - desc->requested_packet = 0;
  26014. -- /* depending on use may need ifp->bssidx instead */
  26015. -+ /* depending on use may need ifp->bsscfgidx instead */
  26016. - desc->interface_id = ifidx;
  26017. - desc->ac_bitmap = 0xff; /* update this when handling APSD */
  26018. - if (addr)
  26019. -@@ -1938,7 +1938,7 @@ void brcmf_fws_reset_interface(struct br
  26020. - {
  26021. - struct brcmf_fws_mac_descriptor *entry = ifp->fws_desc;
  26022. -
  26023. -- brcmf_dbg(TRACE, "enter: idx=%d\n", ifp->bssidx);
  26024. -+ brcmf_dbg(TRACE, "enter: bsscfgidx=%d\n", ifp->bsscfgidx);
  26025. - if (!entry)
  26026. - return;
  26027. -
  26028. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  26029. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  26030. -@@ -2067,7 +2067,7 @@ static struct wireless_dev *brcmf_p2p_cr
  26031. - struct brcmf_if *p2p_ifp;
  26032. - struct brcmf_if *pri_ifp;
  26033. - int err;
  26034. -- u32 bssidx;
  26035. -+ u32 bsscfgidx;
  26036. -
  26037. - if (p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif)
  26038. - return ERR_PTR(-ENOSPC);
  26039. -@@ -2113,13 +2113,13 @@ static struct wireless_dev *brcmf_p2p_cr
  26040. - memcpy(&p2p_vif->wdev.address, p2p->dev_addr, sizeof(p2p->dev_addr));
  26041. -
  26042. - /* verify bsscfg index for P2P discovery */
  26043. -- err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bssidx);
  26044. -+ err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bsscfgidx);
  26045. - if (err < 0) {
  26046. - brcmf_err("retrieving discover bsscfg index failed\n");
  26047. - goto fail;
  26048. - }
  26049. -
  26050. -- WARN_ON(p2p_ifp->bssidx != bssidx);
  26051. -+ WARN_ON(p2p_ifp->bsscfgidx != bsscfgidx);
  26052. -
  26053. - init_completion(&p2p->send_af_done);
  26054. - INIT_WORK(&p2p->afx_hdl.afx_work, brcmf_p2p_afx_handler);
  26055. diff --git a/package/kernel/mac80211/patches/374-0008-brcmfmac-Use-new-methods-for-pcie-Power-Management.patch b/package/kernel/mac80211/patches/374-0008-brcmfmac-Use-new-methods-for-pcie-Power-Management.patch
  26056. deleted file mode 100644
  26057. index fb2b85e..0000000
  26058. --- a/package/kernel/mac80211/patches/374-0008-brcmfmac-Use-new-methods-for-pcie-Power-Management.patch
  26059. +++ /dev/null
  26060. @@ -1,163 +0,0 @@
  26061. -From: Hante Meuleman <meuleman@broadcom.com>
  26062. -Date: Thu, 29 Oct 2015 20:33:18 +0100
  26063. -Subject: [PATCH] brcmfmac: Use new methods for pcie Power Management.
  26064. -
  26065. -Currently the legacy methods suspend and resume are used for pcie
  26066. -devices. This is not the preferable method and is also causing
  26067. -issues with some setups when doing hibernate. Changing this to
  26068. -use the new PM methods.
  26069. -
  26070. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  26071. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  26072. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  26073. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  26074. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  26075. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  26076. ----
  26077. -
  26078. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  26079. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  26080. -@@ -1388,10 +1388,6 @@ static void brcmf_pcie_wowl_config(struc
  26081. -
  26082. - brcmf_dbg(PCIE, "Configuring WOWL, enabled=%d\n", enabled);
  26083. - devinfo->wowl_enabled = enabled;
  26084. -- if (enabled)
  26085. -- device_set_wakeup_enable(&devinfo->pdev->dev, true);
  26086. -- else
  26087. -- device_set_wakeup_enable(&devinfo->pdev->dev, false);
  26088. - }
  26089. -
  26090. -
  26091. -@@ -1961,15 +1957,14 @@ brcmf_pcie_remove(struct pci_dev *pdev)
  26092. - #ifdef CONFIG_PM
  26093. -
  26094. -
  26095. --static int brcmf_pcie_suspend(struct pci_dev *pdev, pm_message_t state)
  26096. -+static int brcmf_pcie_pm_enter_D3(struct device *dev)
  26097. - {
  26098. - struct brcmf_pciedev_info *devinfo;
  26099. - struct brcmf_bus *bus;
  26100. -- int err;
  26101. -
  26102. -- brcmf_dbg(PCIE, "Enter, state=%d, pdev=%p\n", state.event, pdev);
  26103. -+ brcmf_err("Enter\n");
  26104. -
  26105. -- bus = dev_get_drvdata(&pdev->dev);
  26106. -+ bus = dev_get_drvdata(dev);
  26107. - devinfo = bus->bus_priv.pcie->devinfo;
  26108. -
  26109. - brcmf_bus_change_state(bus, BRCMF_BUS_DOWN);
  26110. -@@ -1984,62 +1979,45 @@ static int brcmf_pcie_suspend(struct pci
  26111. - brcmf_err("Timeout on response for entering D3 substate\n");
  26112. - return -EIO;
  26113. - }
  26114. -- brcmf_pcie_send_mb_data(devinfo, BRCMF_H2D_HOST_D0_INFORM_IN_USE);
  26115. -
  26116. -- err = pci_save_state(pdev);
  26117. -- if (err)
  26118. -- brcmf_err("pci_save_state failed, err=%d\n", err);
  26119. -- if ((err) || (!devinfo->wowl_enabled)) {
  26120. -- brcmf_chip_detach(devinfo->ci);
  26121. -- devinfo->ci = NULL;
  26122. -- brcmf_pcie_remove(pdev);
  26123. -- return 0;
  26124. -- }
  26125. -+ devinfo->state = BRCMFMAC_PCIE_STATE_DOWN;
  26126. -
  26127. -- return pci_prepare_to_sleep(pdev);
  26128. -+ return 0;
  26129. - }
  26130. -
  26131. --static int brcmf_pcie_resume(struct pci_dev *pdev)
  26132. -+
  26133. -+static int brcmf_pcie_pm_leave_D3(struct device *dev)
  26134. - {
  26135. - struct brcmf_pciedev_info *devinfo;
  26136. - struct brcmf_bus *bus;
  26137. -+ struct pci_dev *pdev;
  26138. - int err;
  26139. -
  26140. -- bus = dev_get_drvdata(&pdev->dev);
  26141. -- brcmf_dbg(PCIE, "Enter, pdev=%p, bus=%p\n", pdev, bus);
  26142. -+ brcmf_err("Enter\n");
  26143. -
  26144. -- err = pci_set_power_state(pdev, PCI_D0);
  26145. -- if (err) {
  26146. -- brcmf_err("pci_set_power_state failed, err=%d\n", err);
  26147. -- goto cleanup;
  26148. -- }
  26149. -- pci_restore_state(pdev);
  26150. -- pci_enable_wake(pdev, PCI_D3hot, false);
  26151. -- pci_enable_wake(pdev, PCI_D3cold, false);
  26152. -+ bus = dev_get_drvdata(dev);
  26153. -+ devinfo = bus->bus_priv.pcie->devinfo;
  26154. -+ brcmf_dbg(PCIE, "Enter, dev=%p, bus=%p\n", dev, bus);
  26155. -
  26156. - /* Check if device is still up and running, if so we are ready */
  26157. -- if (bus) {
  26158. -- devinfo = bus->bus_priv.pcie->devinfo;
  26159. -- if (brcmf_pcie_read_reg32(devinfo,
  26160. -- BRCMF_PCIE_PCIE2REG_INTMASK) != 0) {
  26161. -- if (brcmf_pcie_send_mb_data(devinfo,
  26162. -- BRCMF_H2D_HOST_D0_INFORM))
  26163. -- goto cleanup;
  26164. -- brcmf_dbg(PCIE, "Hot resume, continue....\n");
  26165. -- brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  26166. -- brcmf_bus_change_state(bus, BRCMF_BUS_UP);
  26167. -- brcmf_pcie_intr_enable(devinfo);
  26168. -- return 0;
  26169. -- }
  26170. -+ if (brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_INTMASK) != 0) {
  26171. -+ brcmf_dbg(PCIE, "Try to wakeup device....\n");
  26172. -+ if (brcmf_pcie_send_mb_data(devinfo, BRCMF_H2D_HOST_D0_INFORM))
  26173. -+ goto cleanup;
  26174. -+ brcmf_dbg(PCIE, "Hot resume, continue....\n");
  26175. -+ devinfo->state = BRCMFMAC_PCIE_STATE_UP;
  26176. -+ brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  26177. -+ brcmf_bus_change_state(bus, BRCMF_BUS_UP);
  26178. -+ brcmf_pcie_intr_enable(devinfo);
  26179. -+ return 0;
  26180. - }
  26181. -
  26182. - cleanup:
  26183. -- if (bus) {
  26184. -- devinfo = bus->bus_priv.pcie->devinfo;
  26185. -- brcmf_chip_detach(devinfo->ci);
  26186. -- devinfo->ci = NULL;
  26187. -- brcmf_pcie_remove(pdev);
  26188. -- }
  26189. -+ brcmf_chip_detach(devinfo->ci);
  26190. -+ devinfo->ci = NULL;
  26191. -+ pdev = devinfo->pdev;
  26192. -+ brcmf_pcie_remove(pdev);
  26193. -+
  26194. - err = brcmf_pcie_probe(pdev, NULL);
  26195. - if (err)
  26196. - brcmf_err("probe after resume failed, err=%d\n", err);
  26197. -@@ -2048,6 +2026,14 @@ cleanup:
  26198. - }
  26199. -
  26200. -
  26201. -+static const struct dev_pm_ops brcmf_pciedrvr_pm = {
  26202. -+ .suspend = brcmf_pcie_pm_enter_D3,
  26203. -+ .resume = brcmf_pcie_pm_leave_D3,
  26204. -+ .freeze = brcmf_pcie_pm_enter_D3,
  26205. -+ .restore = brcmf_pcie_pm_leave_D3,
  26206. -+};
  26207. -+
  26208. -+
  26209. - #endif /* CONFIG_PM */
  26210. -
  26211. -
  26212. -@@ -2086,9 +2072,8 @@ static struct pci_driver brcmf_pciedrvr
  26213. - .probe = brcmf_pcie_probe,
  26214. - .remove = brcmf_pcie_remove,
  26215. - #ifdef CONFIG_PM
  26216. -- .suspend = brcmf_pcie_suspend,
  26217. -- .resume = brcmf_pcie_resume
  26218. --#endif /* CONFIG_PM */
  26219. -+ .driver.pm = &brcmf_pciedrvr_pm,
  26220. -+#endif
  26221. - };
  26222. -
  26223. -
  26224. diff --git a/package/kernel/mac80211/patches/374-0009-brcmfmac-Add-wowl-wake-indication-report.patch b/package/kernel/mac80211/patches/374-0009-brcmfmac-Add-wowl-wake-indication-report.patch
  26225. deleted file mode 100644
  26226. index 4324cc7..0000000
  26227. --- a/package/kernel/mac80211/patches/374-0009-brcmfmac-Add-wowl-wake-indication-report.patch
  26228. +++ /dev/null
  26229. @@ -1,129 +0,0 @@
  26230. -From: Hante Meuleman <meuleman@broadcom.com>
  26231. -Date: Thu, 29 Oct 2015 20:33:19 +0100
  26232. -Subject: [PATCH] brcmfmac: Add wowl wake indication report.
  26233. -
  26234. -On wakeup of the system (resume) a wowl wakeup indication report
  26235. -can be sent to cfg80211. This patch adds support for this. The
  26236. -report specifies if the device was responsible for the wakeup
  26237. -and if so, will specify the exact reason.
  26238. -
  26239. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  26240. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  26241. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  26242. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  26243. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  26244. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  26245. ----
  26246. -
  26247. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  26248. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  26249. -@@ -3061,6 +3061,67 @@ static s32 brcmf_config_wowl_pattern(str
  26250. - return ret;
  26251. - }
  26252. -
  26253. -+#ifdef CPTCFG_PM
  26254. -+
  26255. -+static void brcmf_report_wowl_wakeind(struct wiphy *wiphy, struct brcmf_if *ifp)
  26256. -+{
  26257. -+ struct brcmf_wowl_wakeind_le wake_ind_le;
  26258. -+ struct cfg80211_wowlan_wakeup wakeup_data;
  26259. -+ struct cfg80211_wowlan_wakeup *wakeup;
  26260. -+ u32 wakeind;
  26261. -+ s32 err;
  26262. -+
  26263. -+ err = brcmf_fil_iovar_data_get(ifp, "wowl_wakeind", &wake_ind_le,
  26264. -+ sizeof(wake_ind_le));
  26265. -+ if (!err) {
  26266. -+ brcmf_err("Get wowl_wakeind failed, err = %d\n", err);
  26267. -+ return;
  26268. -+ }
  26269. -+
  26270. -+ wakeind = le32_to_cpu(wake_ind_le.ucode_wakeind);
  26271. -+ if (wakeind & (BRCMF_WOWL_MAGIC | BRCMF_WOWL_DIS | BRCMF_WOWL_BCN |
  26272. -+ BRCMF_WOWL_RETR | BRCMF_WOWL_NET)) {
  26273. -+ wakeup = &wakeup_data;
  26274. -+ memset(&wakeup_data, 0, sizeof(wakeup_data));
  26275. -+ wakeup_data.pattern_idx = -1;
  26276. -+
  26277. -+ if (wakeind & BRCMF_WOWL_MAGIC) {
  26278. -+ brcmf_dbg(INFO, "WOWL Wake indicator: BRCMF_WOWL_MAGIC\n");
  26279. -+ wakeup_data.magic_pkt = true;
  26280. -+ }
  26281. -+ if (wakeind & BRCMF_WOWL_DIS) {
  26282. -+ brcmf_dbg(INFO, "WOWL Wake indicator: BRCMF_WOWL_DIS\n");
  26283. -+ wakeup_data.disconnect = true;
  26284. -+ }
  26285. -+ if (wakeind & BRCMF_WOWL_BCN) {
  26286. -+ brcmf_dbg(INFO, "WOWL Wake indicator: BRCMF_WOWL_BCN\n");
  26287. -+ wakeup_data.disconnect = true;
  26288. -+ }
  26289. -+ if (wakeind & BRCMF_WOWL_RETR) {
  26290. -+ brcmf_dbg(INFO, "WOWL Wake indicator: BRCMF_WOWL_RETR\n");
  26291. -+ wakeup_data.disconnect = true;
  26292. -+ }
  26293. -+ if (wakeind & BRCMF_WOWL_NET) {
  26294. -+ brcmf_dbg(INFO, "WOWL Wake indicator: BRCMF_WOWL_NET\n");
  26295. -+ /* For now always map to pattern 0, no API to get
  26296. -+ * correct information available at the moment.
  26297. -+ */
  26298. -+ wakeup_data.pattern_idx = 0;
  26299. -+ }
  26300. -+ } else {
  26301. -+ wakeup = NULL;
  26302. -+ }
  26303. -+ cfg80211_report_wowlan_wakeup(&ifp->vif->wdev, wakeup, GFP_KERNEL);
  26304. -+}
  26305. -+
  26306. -+#else
  26307. -+
  26308. -+static void brcmf_report_wowl_wakeind(struct wiphy *wiphy, struct brcmf_if *ifp)
  26309. -+{
  26310. -+}
  26311. -+
  26312. -+#endif /* CPTCFG_PM */
  26313. -+
  26314. - static s32 brcmf_cfg80211_resume(struct wiphy *wiphy)
  26315. - {
  26316. - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  26317. -@@ -3070,11 +3131,12 @@ static s32 brcmf_cfg80211_resume(struct
  26318. - brcmf_dbg(TRACE, "Enter\n");
  26319. -
  26320. - if (cfg->wowl_enabled) {
  26321. -+ brcmf_report_wowl_wakeind(wiphy, ifp);
  26322. -+ brcmf_fil_iovar_int_set(ifp, "wowl_clear", 0);
  26323. -+ brcmf_config_wowl_pattern(ifp, "clr", NULL, 0, NULL, 0);
  26324. - brcmf_configure_arp_offload(ifp, true);
  26325. - brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM,
  26326. - cfg->pre_wowl_pmmode);
  26327. -- brcmf_fil_iovar_int_set(ifp, "wowl_clear", 0);
  26328. -- brcmf_config_wowl_pattern(ifp, "clr", NULL, 0, NULL, 0);
  26329. - cfg->wowl_enabled = false;
  26330. - }
  26331. - return 0;
  26332. -@@ -3108,6 +3170,7 @@ static void brcmf_configure_wowl(struct
  26333. - wowl->patterns[i].pkt_offset);
  26334. - }
  26335. - }
  26336. -+ brcmf_fil_iovar_data_set(ifp, "wowl_wakeind", "clear", strlen("clear"));
  26337. - brcmf_fil_iovar_int_set(ifp, "wowl", wowl_config);
  26338. - brcmf_fil_iovar_int_set(ifp, "wowl_activate", 1);
  26339. - brcmf_bus_wowl_config(cfg->pub->bus_if, true);
  26340. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  26341. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  26342. -@@ -634,4 +634,16 @@ struct brcmf_assoclist_le {
  26343. - u8 mac[BRCMF_MAX_ASSOCLIST][ETH_ALEN];
  26344. - };
  26345. -
  26346. -+/**
  26347. -+ * struct brcmf_wowl_wakeind_le - Wakeup indicators
  26348. -+ * Note: note both fields contain same information.
  26349. -+ *
  26350. -+ * @pci_wakeind: Whether PCI PMECSR PMEStatus bit was set.
  26351. -+ * @ucode_wakeind: What wakeup-event indication was set by ucode
  26352. -+ */
  26353. -+struct brcmf_wowl_wakeind_le {
  26354. -+ __le32 pci_wakeind;
  26355. -+ __le32 ucode_wakeind;
  26356. -+};
  26357. -+
  26358. - #endif /* FWIL_TYPES_H_ */
  26359. diff --git a/package/kernel/mac80211/patches/375-brcmfmac-constify-brcmf_bus_ops-structures.patch b/package/kernel/mac80211/patches/375-brcmfmac-constify-brcmf_bus_ops-structures.patch
  26360. deleted file mode 100644
  26361. index a0cc231..0000000
  26362. --- a/package/kernel/mac80211/patches/375-brcmfmac-constify-brcmf_bus_ops-structures.patch
  26363. +++ /dev/null
  26364. @@ -1,57 +0,0 @@
  26365. -From: Julia Lawall <Julia.Lawall@lip6.fr>
  26366. -Date: Sat, 14 Nov 2015 17:22:07 +0100
  26367. -Subject: [PATCH] brcmfmac: constify brcmf_bus_ops structures
  26368. -
  26369. -The brcmf_bus_ops structures are never modified, so declare them as const.
  26370. -
  26371. -Done with the help of Coccinelle.
  26372. -
  26373. -Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
  26374. -Acked-by: Arend van Spriel <arend@broadcom.com>
  26375. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  26376. ----
  26377. -
  26378. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bus.h
  26379. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bus.h
  26380. -@@ -137,7 +137,7 @@ struct brcmf_bus {
  26381. - bool always_use_fws_queue;
  26382. - bool wowl_supported;
  26383. -
  26384. -- struct brcmf_bus_ops *ops;
  26385. -+ const struct brcmf_bus_ops *ops;
  26386. - struct brcmf_bus_msgbuf *msgbuf;
  26387. - };
  26388. -
  26389. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  26390. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  26391. -@@ -1413,7 +1413,7 @@ static int brcmf_pcie_get_memdump(struct
  26392. - }
  26393. -
  26394. -
  26395. --static struct brcmf_bus_ops brcmf_pcie_bus_ops = {
  26396. -+static const struct brcmf_bus_ops brcmf_pcie_bus_ops = {
  26397. - .txdata = brcmf_pcie_tx,
  26398. - .stop = brcmf_pcie_down,
  26399. - .txctl = brcmf_pcie_tx_ctlpkt,
  26400. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  26401. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  26402. -@@ -4025,7 +4025,7 @@ brcmf_sdio_watchdog(unsigned long data)
  26403. - }
  26404. - }
  26405. -
  26406. --static struct brcmf_bus_ops brcmf_sdio_bus_ops = {
  26407. -+static const struct brcmf_bus_ops brcmf_sdio_bus_ops = {
  26408. - .stop = brcmf_sdio_bus_stop,
  26409. - .preinit = brcmf_sdio_bus_preinit,
  26410. - .txdata = brcmf_sdio_bus_txdata,
  26411. ---- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  26412. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  26413. -@@ -1163,7 +1163,7 @@ static void brcmf_usb_wowl_config(struct
  26414. - device_set_wakeup_enable(devinfo->dev, false);
  26415. - }
  26416. -
  26417. --static struct brcmf_bus_ops brcmf_usb_bus_ops = {
  26418. -+static const struct brcmf_bus_ops brcmf_usb_bus_ops = {
  26419. - .txdata = brcmf_usb_tx,
  26420. - .stop = brcmf_usb_down,
  26421. - .txctl = brcmf_usb_tx_ctlpkt,
  26422. diff --git a/package/kernel/mac80211/patches/376-0001-brcmfmac-Cleanup-ssid-storage.patch b/package/kernel/mac80211/patches/376-0001-brcmfmac-Cleanup-ssid-storage.patch
  26423. deleted file mode 100644
  26424. index 83f1ebe..0000000
  26425. --- a/package/kernel/mac80211/patches/376-0001-brcmfmac-Cleanup-ssid-storage.patch
  26426. +++ /dev/null
  26427. @@ -1,251 +0,0 @@
  26428. -From: Hante Meuleman <meuleman@broadcom.com>
  26429. -Date: Wed, 25 Nov 2015 11:32:37 +0100
  26430. -Subject: [PATCH] brcmfmac: Cleanup ssid storage.
  26431. -
  26432. -SSIDs used for connect and p2p got stored, but never used.
  26433. -
  26434. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  26435. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  26436. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  26437. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  26438. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  26439. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  26440. ----
  26441. -
  26442. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  26443. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  26444. -@@ -959,7 +959,7 @@ brcmf_run_escan(struct brcmf_cfg80211_in
  26445. - params_size += sizeof(u32) * ((request->n_channels + 1) / 2);
  26446. -
  26447. - /* Allocate space for populating ssids in struct */
  26448. -- params_size += sizeof(struct brcmf_ssid) * request->n_ssids;
  26449. -+ params_size += sizeof(struct brcmf_ssid_le) * request->n_ssids;
  26450. - }
  26451. -
  26452. - params = kzalloc(params_size, GFP_KERNEL);
  26453. -@@ -1291,6 +1291,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
  26454. - s32 wsec = 0;
  26455. - s32 bcnprd;
  26456. - u16 chanspec;
  26457. -+ u32 ssid_len;
  26458. -
  26459. - brcmf_dbg(TRACE, "Enter\n");
  26460. - if (!check_vif_up(ifp->vif))
  26461. -@@ -1368,17 +1369,15 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
  26462. - memset(&join_params, 0, sizeof(struct brcmf_join_params));
  26463. -
  26464. - /* SSID */
  26465. -- profile->ssid.SSID_len = min_t(u32, params->ssid_len, 32);
  26466. -- memcpy(profile->ssid.SSID, params->ssid, profile->ssid.SSID_len);
  26467. -- memcpy(join_params.ssid_le.SSID, params->ssid, profile->ssid.SSID_len);
  26468. -- join_params.ssid_le.SSID_len = cpu_to_le32(profile->ssid.SSID_len);
  26469. -+ ssid_len = min_t(u32, params->ssid_len, IEEE80211_MAX_SSID_LEN);
  26470. -+ memcpy(join_params.ssid_le.SSID, params->ssid, ssid_len);
  26471. -+ join_params.ssid_le.SSID_len = cpu_to_le32(ssid_len);
  26472. - join_params_size = sizeof(join_params.ssid_le);
  26473. -
  26474. - /* BSSID */
  26475. - if (params->bssid) {
  26476. - memcpy(join_params.params_le.bssid, params->bssid, ETH_ALEN);
  26477. -- join_params_size = sizeof(join_params.ssid_le) +
  26478. -- BRCMF_ASSOC_PARAMS_FIXED_SIZE;
  26479. -+ join_params_size += BRCMF_ASSOC_PARAMS_FIXED_SIZE;
  26480. - memcpy(profile->bssid, params->bssid, ETH_ALEN);
  26481. - } else {
  26482. - eth_broadcast_addr(join_params.params_le.bssid);
  26483. -@@ -1728,7 +1727,6 @@ brcmf_cfg80211_connect(struct wiphy *wip
  26484. - {
  26485. - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  26486. - struct brcmf_if *ifp = netdev_priv(ndev);
  26487. -- struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
  26488. - struct ieee80211_channel *chan = sme->channel;
  26489. - struct brcmf_join_params join_params;
  26490. - size_t join_params_size;
  26491. -@@ -1739,6 +1737,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
  26492. - struct brcmf_ext_join_params_le *ext_join_params;
  26493. - u16 chanspec;
  26494. - s32 err = 0;
  26495. -+ u32 ssid_len;
  26496. -
  26497. - brcmf_dbg(TRACE, "Enter\n");
  26498. - if (!check_vif_up(ifp->vif))
  26499. -@@ -1824,15 +1823,6 @@ brcmf_cfg80211_connect(struct wiphy *wip
  26500. - goto done;
  26501. - }
  26502. -
  26503. -- profile->ssid.SSID_len = min_t(u32, (u32)sizeof(profile->ssid.SSID),
  26504. -- (u32)sme->ssid_len);
  26505. -- memcpy(&profile->ssid.SSID, sme->ssid, profile->ssid.SSID_len);
  26506. -- if (profile->ssid.SSID_len < IEEE80211_MAX_SSID_LEN) {
  26507. -- profile->ssid.SSID[profile->ssid.SSID_len] = 0;
  26508. -- brcmf_dbg(CONN, "SSID \"%s\", len (%d)\n", profile->ssid.SSID,
  26509. -- profile->ssid.SSID_len);
  26510. -- }
  26511. --
  26512. - /* Join with specific BSSID and cached SSID
  26513. - * If SSID is zero join based on BSSID only
  26514. - */
  26515. -@@ -1845,9 +1835,12 @@ brcmf_cfg80211_connect(struct wiphy *wip
  26516. - err = -ENOMEM;
  26517. - goto done;
  26518. - }
  26519. -- ext_join_params->ssid_le.SSID_len = cpu_to_le32(profile->ssid.SSID_len);
  26520. -- memcpy(&ext_join_params->ssid_le.SSID, sme->ssid,
  26521. -- profile->ssid.SSID_len);
  26522. -+ ssid_len = min_t(u32, sme->ssid_len, IEEE80211_MAX_SSID_LEN);
  26523. -+ ext_join_params->ssid_le.SSID_len = cpu_to_le32(ssid_len);
  26524. -+ memcpy(&ext_join_params->ssid_le.SSID, sme->ssid, ssid_len);
  26525. -+ if (ssid_len < IEEE80211_MAX_SSID_LEN)
  26526. -+ brcmf_dbg(CONN, "SSID \"%s\", len (%d)\n",
  26527. -+ ext_join_params->ssid_le.SSID, ssid_len);
  26528. -
  26529. - /* Set up join scan parameters */
  26530. - ext_join_params->scan_le.scan_type = -1;
  26531. -@@ -1895,8 +1888,8 @@ brcmf_cfg80211_connect(struct wiphy *wip
  26532. - memset(&join_params, 0, sizeof(join_params));
  26533. - join_params_size = sizeof(join_params.ssid_le);
  26534. -
  26535. -- memcpy(&join_params.ssid_le.SSID, sme->ssid, profile->ssid.SSID_len);
  26536. -- join_params.ssid_le.SSID_len = cpu_to_le32(profile->ssid.SSID_len);
  26537. -+ memcpy(&join_params.ssid_le.SSID, sme->ssid, ssid_len);
  26538. -+ join_params.ssid_le.SSID_len = cpu_to_le32(ssid_len);
  26539. -
  26540. - if (sme->bssid)
  26541. - memcpy(join_params.params_le.bssid, sme->bssid, ETH_ALEN);
  26542. -@@ -2775,9 +2768,7 @@ CleanUp:
  26543. - static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg,
  26544. - struct brcmf_if *ifp)
  26545. - {
  26546. -- struct brcmf_cfg80211_profile *profile = ndev_to_prof(ifp->ndev);
  26547. - struct brcmf_bss_info_le *bi;
  26548. -- struct brcmf_ssid *ssid;
  26549. - const struct brcmf_tlv *tim;
  26550. - u16 beacon_interval;
  26551. - u8 dtim_period;
  26552. -@@ -2789,8 +2780,6 @@ static s32 brcmf_update_bss_info(struct
  26553. - if (brcmf_is_ibssmode(ifp->vif))
  26554. - return err;
  26555. -
  26556. -- ssid = &profile->ssid;
  26557. --
  26558. - *(__le32 *)cfg->extra_buf = cpu_to_le32(WL_EXTRA_BUF_MAX);
  26559. - err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO,
  26560. - cfg->extra_buf, WL_EXTRA_BUF_MAX);
  26561. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  26562. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  26563. -@@ -124,13 +124,11 @@ struct brcmf_cfg80211_security {
  26564. - /**
  26565. - * struct brcmf_cfg80211_profile - profile information.
  26566. - *
  26567. -- * @ssid: ssid of associated/associating ap.
  26568. - * @bssid: bssid of joined/joining ibss.
  26569. - * @sec: security information.
  26570. - * @key: key information
  26571. - */
  26572. - struct brcmf_cfg80211_profile {
  26573. -- struct brcmf_ssid ssid;
  26574. - u8 bssid[ETH_ALEN];
  26575. - struct brcmf_cfg80211_security sec;
  26576. - struct brcmf_wsec_key key[BRCMF_MAX_DEFAULT_KEYS];
  26577. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  26578. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  26579. -@@ -282,14 +282,9 @@ struct brcm_rateset_le {
  26580. - u8 rates[BRCMF_MAXRATES_IN_SET];
  26581. - };
  26582. -
  26583. --struct brcmf_ssid {
  26584. -- u32 SSID_len;
  26585. -- unsigned char SSID[32];
  26586. --};
  26587. --
  26588. - struct brcmf_ssid_le {
  26589. - __le32 SSID_len;
  26590. -- unsigned char SSID[32];
  26591. -+ unsigned char SSID[IEEE80211_MAX_SSID_LEN];
  26592. - };
  26593. -
  26594. - struct brcmf_scan_params_le {
  26595. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  26596. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  26597. -@@ -642,7 +642,6 @@ static s32 brcmf_p2p_escan(struct brcmf_
  26598. - struct brcmf_cfg80211_vif *vif;
  26599. - struct brcmf_p2p_scan_le *p2p_params;
  26600. - struct brcmf_scan_params_le *sparams;
  26601. -- struct brcmf_ssid ssid;
  26602. -
  26603. - memsize += num_chans * sizeof(__le16);
  26604. - memblk = kzalloc(memsize, GFP_KERNEL);
  26605. -@@ -655,16 +654,16 @@ static s32 brcmf_p2p_escan(struct brcmf_
  26606. - ret = -EINVAL;
  26607. - goto exit;
  26608. - }
  26609. -+ p2p_params = (struct brcmf_p2p_scan_le *)memblk;
  26610. -+ sparams = &p2p_params->eparams.params_le;
  26611. -
  26612. - switch (search_state) {
  26613. - case WL_P2P_DISC_ST_SEARCH:
  26614. - /*
  26615. - * If we in SEARCH STATE, we don't need to set SSID explictly
  26616. -- * because dongle use P2P WILDCARD internally by default
  26617. -+ * because dongle use P2P WILDCARD internally by default, use
  26618. -+ * null ssid, which it is already due to kzalloc.
  26619. - */
  26620. -- /* use null ssid */
  26621. -- ssid.SSID_len = 0;
  26622. -- memset(ssid.SSID, 0, sizeof(ssid.SSID));
  26623. - break;
  26624. - case WL_P2P_DISC_ST_SCAN:
  26625. - /*
  26626. -@@ -673,8 +672,10 @@ static s32 brcmf_p2p_escan(struct brcmf_
  26627. - * P2P WILDCARD because we just do broadcast scan unless
  26628. - * setting SSID.
  26629. - */
  26630. -- ssid.SSID_len = BRCMF_P2P_WILDCARD_SSID_LEN;
  26631. -- memcpy(ssid.SSID, BRCMF_P2P_WILDCARD_SSID, ssid.SSID_len);
  26632. -+ sparams->ssid_le.SSID_len =
  26633. -+ cpu_to_le32(BRCMF_P2P_WILDCARD_SSID_LEN);
  26634. -+ memcpy(sparams->ssid_le.SSID, BRCMF_P2P_WILDCARD_SSID,
  26635. -+ BRCMF_P2P_WILDCARD_SSID_LEN);
  26636. - break;
  26637. - default:
  26638. - brcmf_err(" invalid search state %d\n", search_state);
  26639. -@@ -687,11 +688,9 @@ static s32 brcmf_p2p_escan(struct brcmf_
  26640. - /*
  26641. - * set p2p scan parameters.
  26642. - */
  26643. -- p2p_params = (struct brcmf_p2p_scan_le *)memblk;
  26644. - p2p_params->type = 'E';
  26645. -
  26646. - /* determine the scan engine parameters */
  26647. -- sparams = &p2p_params->eparams.params_le;
  26648. - sparams->bss_type = DOT11_BSSTYPE_ANY;
  26649. - if (p2p->cfg->active_scan)
  26650. - sparams->scan_type = 0;
  26651. -@@ -699,9 +698,6 @@ static s32 brcmf_p2p_escan(struct brcmf_
  26652. - sparams->scan_type = 1;
  26653. -
  26654. - eth_broadcast_addr(sparams->bssid);
  26655. -- if (ssid.SSID_len)
  26656. -- memcpy(sparams->ssid_le.SSID, ssid.SSID, ssid.SSID_len);
  26657. -- sparams->ssid_le.SSID_len = cpu_to_le32(ssid.SSID_len);
  26658. - sparams->home_time = cpu_to_le32(P2PAPI_SCAN_HOME_TIME_MS);
  26659. -
  26660. - /*
  26661. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.h
  26662. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.h
  26663. -@@ -112,7 +112,6 @@ struct afx_hdl {
  26664. - * @int_addr: P2P interface address.
  26665. - * @bss_idx: informate for P2P bss types.
  26666. - * @listen_timer: timer for @WL_P2P_DISC_ST_LISTEN discover state.
  26667. -- * @ssid: ssid for P2P GO.
  26668. - * @listen_channel: channel for @WL_P2P_DISC_ST_LISTEN discover state.
  26669. - * @remain_on_channel: contains copy of struct used by cfg80211.
  26670. - * @remain_on_channel_cookie: cookie counter for remain on channel cmd
  26671. -@@ -133,7 +132,6 @@ struct brcmf_p2p_info {
  26672. - u8 int_addr[ETH_ALEN];
  26673. - struct p2p_bss bss_idx[P2PAPI_BSSCFG_MAX];
  26674. - struct timer_list listen_timer;
  26675. -- struct brcmf_ssid ssid;
  26676. - u8 listen_channel;
  26677. - struct ieee80211_channel remain_on_channel;
  26678. - u32 remain_on_channel_cookie;
  26679. diff --git a/package/kernel/mac80211/patches/376-0002-brcmfmac-Return-actual-error-by-fwil.patch b/package/kernel/mac80211/patches/376-0002-brcmfmac-Return-actual-error-by-fwil.patch
  26680. deleted file mode 100644
  26681. index 8672c18..0000000
  26682. --- a/package/kernel/mac80211/patches/376-0002-brcmfmac-Return-actual-error-by-fwil.patch
  26683. +++ /dev/null
  26684. @@ -1,31 +0,0 @@
  26685. -From: Hante Meuleman <meuleman@broadcom.com>
  26686. -Date: Wed, 25 Nov 2015 11:32:38 +0100
  26687. -Subject: [PATCH] brcmfmac: Return actual error by fwil.
  26688. -
  26689. -FWIL is always mapping back errors to EBADE. This is not very
  26690. -conventient when trying to understand problems by reading logs.
  26691. -Some callers print the error code, but that is quite useless
  26692. -when the exact error code is not returned. It also makes it
  26693. -impossible to differentiate based on error code. This patch
  26694. -changes the return of EBADE into the actual error code.
  26695. -
  26696. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  26697. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  26698. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  26699. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  26700. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  26701. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  26702. ----
  26703. -
  26704. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwil.c
  26705. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil.c
  26706. -@@ -126,7 +126,8 @@ brcmf_fil_cmd_data(struct brcmf_if *ifp,
  26707. -
  26708. - brcmf_dbg(FIL, "Failed: %s (%d)\n",
  26709. - brcmf_fil_get_errstr((u32)(-err)), err);
  26710. -- return -EBADE;
  26711. -+
  26712. -+ return err;
  26713. - }
  26714. -
  26715. - s32
  26716. diff --git a/package/kernel/mac80211/patches/376-0003-brcmfmac-Change-error-print-on-wlan0-existence.patch b/package/kernel/mac80211/patches/376-0003-brcmfmac-Change-error-print-on-wlan0-existence.patch
  26717. deleted file mode 100644
  26718. index 1cfab21..0000000
  26719. --- a/package/kernel/mac80211/patches/376-0003-brcmfmac-Change-error-print-on-wlan0-existence.patch
  26720. +++ /dev/null
  26721. @@ -1,41 +0,0 @@
  26722. -From: Hante Meuleman <meuleman@broadcom.com>
  26723. -Date: Wed, 25 Nov 2015 11:32:39 +0100
  26724. -Subject: [PATCH] brcmfmac: Change error print on wlan0 existence.
  26725. -
  26726. -During initialization of the device, but also on some other
  26727. -moments the driver prints an error that the netdev already exists.
  26728. -This is a result of the way the driver is initializing the
  26729. -firmware and not really an error. The code is not treating it as
  26730. -an error either. This error print has resulted in many questions
  26731. -by users and is confusing and incorrect. This patch changes the
  26732. -error log into a debug info log.
  26733. -
  26734. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  26735. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  26736. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  26737. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  26738. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  26739. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  26740. ----
  26741. -
  26742. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  26743. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  26744. -@@ -811,14 +811,15 @@ struct brcmf_if *brcmf_add_if(struct brc
  26745. - * in case we missed the BRCMF_E_IF_DEL event.
  26746. - */
  26747. - if (ifp) {
  26748. -- brcmf_err("ERROR: netdev:%s already exists\n",
  26749. -- ifp->ndev->name);
  26750. - if (ifidx) {
  26751. -+ brcmf_err("ERROR: netdev:%s already exists\n",
  26752. -+ ifp->ndev->name);
  26753. - netif_stop_queue(ifp->ndev);
  26754. - brcmf_net_detach(ifp->ndev);
  26755. - drvr->iflist[bsscfgidx] = NULL;
  26756. - } else {
  26757. -- brcmf_err("ignore IF event\n");
  26758. -+ brcmf_dbg(INFO, "netdev:%s ignore IF event\n",
  26759. -+ ifp->ndev->name);
  26760. - return ERR_PTR(-EINVAL);
  26761. - }
  26762. - }
  26763. diff --git a/package/kernel/mac80211/patches/376-0004-brcmfmac-no-retries-on-rxglom-superframe-errors.patch b/package/kernel/mac80211/patches/376-0004-brcmfmac-no-retries-on-rxglom-superframe-errors.patch
  26764. deleted file mode 100644
  26765. index dfc3a98..0000000
  26766. --- a/package/kernel/mac80211/patches/376-0004-brcmfmac-no-retries-on-rxglom-superframe-errors.patch
  26767. +++ /dev/null
  26768. @@ -1,76 +0,0 @@
  26769. -From: Franky Lin <frankyl@broadcom.com>
  26770. -Date: Wed, 25 Nov 2015 11:32:40 +0100
  26771. -Subject: [PATCH] brcmfmac: no retries on rxglom superframe errors
  26772. -
  26773. -Aborting the current read attempt on the superframe also removes the
  26774. -packet from the pipeline. Retries should not be attempted on the next
  26775. -packet since it would not be a superframe(either a superframe descriptor
  26776. -or other data packet) and should not be handled by brcmf_sdio_rxglom
  26777. -
  26778. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  26779. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  26780. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  26781. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  26782. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  26783. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  26784. ----
  26785. -
  26786. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  26787. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  26788. -@@ -460,7 +460,6 @@ struct brcmf_sdio {
  26789. -
  26790. - struct sk_buff *glomd; /* Packet containing glomming descriptor */
  26791. - struct sk_buff_head glom; /* Packet list for glommed superframe */
  26792. -- uint glomerr; /* Glom packet read errors */
  26793. -
  26794. - u8 *rxbuf; /* Buffer for receiving control packets */
  26795. - uint rxblen; /* Allocated length of rxbuf */
  26796. -@@ -1654,20 +1653,15 @@ static u8 brcmf_sdio_rxglom(struct brcmf
  26797. - sdio_release_host(bus->sdiodev->func[1]);
  26798. - bus->sdcnt.f2rxdata++;
  26799. -
  26800. -- /* On failure, kill the superframe, allow a couple retries */
  26801. -+ /* On failure, kill the superframe */
  26802. - if (errcode < 0) {
  26803. - brcmf_err("glom read of %d bytes failed: %d\n",
  26804. - dlen, errcode);
  26805. -
  26806. - sdio_claim_host(bus->sdiodev->func[1]);
  26807. -- if (bus->glomerr++ < 3) {
  26808. -- brcmf_sdio_rxfail(bus, true, true);
  26809. -- } else {
  26810. -- bus->glomerr = 0;
  26811. -- brcmf_sdio_rxfail(bus, true, false);
  26812. -- bus->sdcnt.rxglomfail++;
  26813. -- brcmf_sdio_free_glom(bus);
  26814. -- }
  26815. -+ brcmf_sdio_rxfail(bus, true, false);
  26816. -+ bus->sdcnt.rxglomfail++;
  26817. -+ brcmf_sdio_free_glom(bus);
  26818. - sdio_release_host(bus->sdiodev->func[1]);
  26819. - return 0;
  26820. - }
  26821. -@@ -1708,19 +1702,11 @@ static u8 brcmf_sdio_rxglom(struct brcmf
  26822. - }
  26823. -
  26824. - if (errcode) {
  26825. -- /* Terminate frame on error, request
  26826. -- a couple retries */
  26827. -+ /* Terminate frame on error */
  26828. - sdio_claim_host(bus->sdiodev->func[1]);
  26829. -- if (bus->glomerr++ < 3) {
  26830. -- /* Restore superframe header space */
  26831. -- skb_push(pfirst, sfdoff);
  26832. -- brcmf_sdio_rxfail(bus, true, true);
  26833. -- } else {
  26834. -- bus->glomerr = 0;
  26835. -- brcmf_sdio_rxfail(bus, true, false);
  26836. -- bus->sdcnt.rxglomfail++;
  26837. -- brcmf_sdio_free_glom(bus);
  26838. -- }
  26839. -+ brcmf_sdio_rxfail(bus, true, false);
  26840. -+ bus->sdcnt.rxglomfail++;
  26841. -+ brcmf_sdio_free_glom(bus);
  26842. - sdio_release_host(bus->sdiodev->func[1]);
  26843. - bus->cur_read.len = 0;
  26844. - return 0;
  26845. diff --git a/package/kernel/mac80211/patches/376-0005-brcmfmac-Remove-redundant-parameter-action-from-scan.patch b/package/kernel/mac80211/patches/376-0005-brcmfmac-Remove-redundant-parameter-action-from-scan.patch
  26846. deleted file mode 100644
  26847. index ede1f47..0000000
  26848. --- a/package/kernel/mac80211/patches/376-0005-brcmfmac-Remove-redundant-parameter-action-from-scan.patch
  26849. +++ /dev/null
  26850. @@ -1,108 +0,0 @@
  26851. -From: Hante Meuleman <meuleman@broadcom.com>
  26852. -Date: Wed, 25 Nov 2015 11:32:41 +0100
  26853. -Subject: [PATCH] brcmfmac: Remove redundant parameter action from scan.
  26854. -
  26855. -ESCAN is always performed using action start scan. No need to
  26856. -pass this parameter on to different functions.
  26857. -
  26858. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  26859. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  26860. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  26861. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  26862. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  26863. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  26864. ----
  26865. -
  26866. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  26867. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  26868. -@@ -945,7 +945,7 @@ static void brcmf_escan_prep(struct brcm
  26869. -
  26870. - static s32
  26871. - brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
  26872. -- struct cfg80211_scan_request *request, u16 action)
  26873. -+ struct cfg80211_scan_request *request)
  26874. - {
  26875. - s32 params_size = BRCMF_SCAN_PARAMS_FIXED_SIZE +
  26876. - offsetof(struct brcmf_escan_params_le, params_le);
  26877. -@@ -970,7 +970,7 @@ brcmf_run_escan(struct brcmf_cfg80211_in
  26878. - BUG_ON(params_size + sizeof("escan") >= BRCMF_DCMD_MEDLEN);
  26879. - brcmf_escan_prep(cfg, &params->params_le, request);
  26880. - params->version = cpu_to_le32(BRCMF_ESCAN_REQ_VERSION);
  26881. -- params->action = cpu_to_le16(action);
  26882. -+ params->action = cpu_to_le16(WL_ESCAN_ACTION_START);
  26883. - params->sync_id = cpu_to_le16(0x1234);
  26884. -
  26885. - err = brcmf_fil_iovar_data_set(ifp, "escan", params, params_size);
  26886. -@@ -1012,7 +1012,7 @@ brcmf_do_escan(struct brcmf_cfg80211_inf
  26887. - results->count = 0;
  26888. - results->buflen = WL_ESCAN_RESULTS_FIXED_SIZE;
  26889. -
  26890. -- err = escan->run(cfg, ifp, request, WL_ESCAN_ACTION_START);
  26891. -+ err = escan->run(cfg, ifp, request);
  26892. - if (err)
  26893. - brcmf_scan_config_mpc(ifp, 1);
  26894. - return err;
  26895. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  26896. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  26897. -@@ -231,7 +231,7 @@ struct escan_info {
  26898. - struct wiphy *wiphy;
  26899. - struct brcmf_if *ifp;
  26900. - s32 (*run)(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
  26901. -- struct cfg80211_scan_request *request, u16 action);
  26902. -+ struct cfg80211_scan_request *request);
  26903. - };
  26904. -
  26905. - /**
  26906. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  26907. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  26908. -@@ -625,11 +625,10 @@ exit:
  26909. - * @num_chans: number of channels to scan.
  26910. - * @chanspecs: channel parameters for @num_chans channels.
  26911. - * @search_state: P2P discover state to use.
  26912. -- * @action: scan action to pass to firmware.
  26913. - * @bss_type: type of P2P bss.
  26914. - */
  26915. - static s32 brcmf_p2p_escan(struct brcmf_p2p_info *p2p, u32 num_chans,
  26916. -- u16 chanspecs[], s32 search_state, u16 action,
  26917. -+ u16 chanspecs[], s32 search_state,
  26918. - enum p2p_bss_type bss_type)
  26919. - {
  26920. - s32 ret = 0;
  26921. -@@ -738,7 +737,7 @@ static s32 brcmf_p2p_escan(struct brcmf_
  26922. -
  26923. - /* set the escan specific parameters */
  26924. - p2p_params->eparams.version = cpu_to_le32(BRCMF_ESCAN_REQ_VERSION);
  26925. -- p2p_params->eparams.action = cpu_to_le16(action);
  26926. -+ p2p_params->eparams.action = cpu_to_le16(WL_ESCAN_ACTION_START);
  26927. - p2p_params->eparams.sync_id = cpu_to_le16(0x1234);
  26928. - /* perform p2p scan on primary device */
  26929. - ret = brcmf_fil_bsscfg_data_set(vif->ifp, "p2p_scan", memblk, memsize);
  26930. -@@ -762,8 +761,7 @@ exit:
  26931. - */
  26932. - static s32 brcmf_p2p_run_escan(struct brcmf_cfg80211_info *cfg,
  26933. - struct brcmf_if *ifp,
  26934. -- struct cfg80211_scan_request *request,
  26935. -- u16 action)
  26936. -+ struct cfg80211_scan_request *request)
  26937. - {
  26938. - struct brcmf_p2p_info *p2p = &cfg->p2p;
  26939. - s32 err = 0;
  26940. -@@ -823,7 +821,7 @@ static s32 brcmf_p2p_run_escan(struct br
  26941. - num_nodfs++;
  26942. - }
  26943. - err = brcmf_p2p_escan(p2p, num_nodfs, chanspecs, search_state,
  26944. -- action, P2PAPI_BSSCFG_DEVICE);
  26945. -+ P2PAPI_BSSCFG_DEVICE);
  26946. - kfree(chanspecs);
  26947. - }
  26948. - exit:
  26949. -@@ -1092,8 +1090,7 @@ static s32 brcmf_p2p_act_frm_search(stru
  26950. - default_chan_list[2] = ch.chspec;
  26951. - }
  26952. - err = brcmf_p2p_escan(p2p, channel_cnt, default_chan_list,
  26953. -- WL_P2P_DISC_ST_SEARCH, WL_ESCAN_ACTION_START,
  26954. -- P2PAPI_BSSCFG_DEVICE);
  26955. -+ WL_P2P_DISC_ST_SEARCH, P2PAPI_BSSCFG_DEVICE);
  26956. - kfree(default_chan_list);
  26957. - exit:
  26958. - return err;
  26959. diff --git a/package/kernel/mac80211/patches/376-0006-brcmfmac-Cleanup-roaming-configuration.patch b/package/kernel/mac80211/patches/376-0006-brcmfmac-Cleanup-roaming-configuration.patch
  26960. deleted file mode 100644
  26961. index 41b8770..0000000
  26962. --- a/package/kernel/mac80211/patches/376-0006-brcmfmac-Cleanup-roaming-configuration.patch
  26963. +++ /dev/null
  26964. @@ -1,180 +0,0 @@
  26965. -From: Hante Meuleman <meuleman@broadcom.com>
  26966. -Date: Wed, 25 Nov 2015 11:32:42 +0100
  26967. -Subject: [PATCH] brcmfmac: Cleanup roaming configuration.
  26968. -
  26969. -Put all roaming configuration related code in one place and
  26970. -configure timeout based upon roaming setting.
  26971. -
  26972. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  26973. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  26974. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  26975. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  26976. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  26977. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  26978. ----
  26979. -
  26980. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  26981. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  26982. -@@ -4755,7 +4755,6 @@ struct brcmf_cfg80211_vif *brcmf_alloc_v
  26983. - vif->wdev.iftype = type;
  26984. -
  26985. - vif->pm_block = pm_block;
  26986. -- vif->roam_off = -1;
  26987. -
  26988. - brcmf_init_prof(&vif->profile);
  26989. -
  26990. -@@ -5305,35 +5304,33 @@ static void init_vif_event(struct brcmf_
  26991. - mutex_init(&event->vif_event_lock);
  26992. - }
  26993. -
  26994. --static s32
  26995. --brcmf_dongle_roam(struct brcmf_if *ifp, u32 bcn_timeout)
  26996. -+static s32 brcmf_dongle_roam(struct brcmf_if *ifp)
  26997. - {
  26998. -- s32 err = 0;
  26999. -+ s32 err;
  27000. -+ u32 bcn_timeout;
  27001. - __le32 roamtrigger[2];
  27002. - __le32 roam_delta[2];
  27003. -
  27004. -- /*
  27005. -- * Setup timeout if Beacons are lost and roam is
  27006. -- * off to report link down
  27007. -- */
  27008. -- if (brcmf_roamoff) {
  27009. -- err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout", bcn_timeout);
  27010. -- if (err) {
  27011. -- brcmf_err("bcn_timeout error (%d)\n", err);
  27012. -- goto dongle_rom_out;
  27013. -- }
  27014. -+ /* Configure beacon timeout value based upon roaming setting */
  27015. -+ if (brcmf_roamoff)
  27016. -+ bcn_timeout = BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_OFF;
  27017. -+ else
  27018. -+ bcn_timeout = BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON;
  27019. -+ err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout", bcn_timeout);
  27020. -+ if (err) {
  27021. -+ brcmf_err("bcn_timeout error (%d)\n", err);
  27022. -+ goto roam_setup_done;
  27023. - }
  27024. -
  27025. -- /*
  27026. -- * Enable/Disable built-in roaming to allow supplicant
  27027. -- * to take care of roaming
  27028. -+ /* Enable/Disable built-in roaming to allow supplicant to take care of
  27029. -+ * roaming.
  27030. - */
  27031. - brcmf_dbg(INFO, "Internal Roaming = %s\n",
  27032. - brcmf_roamoff ? "Off" : "On");
  27033. - err = brcmf_fil_iovar_int_set(ifp, "roam_off", !!(brcmf_roamoff));
  27034. - if (err) {
  27035. - brcmf_err("roam_off error (%d)\n", err);
  27036. -- goto dongle_rom_out;
  27037. -+ goto roam_setup_done;
  27038. - }
  27039. -
  27040. - roamtrigger[0] = cpu_to_le32(WL_ROAM_TRIGGER_LEVEL);
  27041. -@@ -5342,7 +5339,7 @@ brcmf_dongle_roam(struct brcmf_if *ifp,
  27042. - (void *)roamtrigger, sizeof(roamtrigger));
  27043. - if (err) {
  27044. - brcmf_err("WLC_SET_ROAM_TRIGGER error (%d)\n", err);
  27045. -- goto dongle_rom_out;
  27046. -+ goto roam_setup_done;
  27047. - }
  27048. -
  27049. - roam_delta[0] = cpu_to_le32(WL_ROAM_DELTA);
  27050. -@@ -5351,10 +5348,10 @@ brcmf_dongle_roam(struct brcmf_if *ifp,
  27051. - (void *)roam_delta, sizeof(roam_delta));
  27052. - if (err) {
  27053. - brcmf_err("WLC_SET_ROAM_DELTA error (%d)\n", err);
  27054. -- goto dongle_rom_out;
  27055. -+ goto roam_setup_done;
  27056. - }
  27057. -
  27058. --dongle_rom_out:
  27059. -+roam_setup_done:
  27060. - return err;
  27061. - }
  27062. -
  27063. -@@ -6069,7 +6066,7 @@ static s32 brcmf_config_dongle(struct br
  27064. - brcmf_dbg(INFO, "power save set to %s\n",
  27065. - (power_mode ? "enabled" : "disabled"));
  27066. -
  27067. -- err = brcmf_dongle_roam(ifp, WL_BEACON_TIMEOUT);
  27068. -+ err = brcmf_dongle_roam(ifp);
  27069. - if (err)
  27070. - goto default_conf_out;
  27071. - err = brcmf_cfg80211_change_iface(wdev->wiphy, ndev, wdev->iftype,
  27072. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  27073. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  27074. -@@ -28,7 +28,6 @@
  27075. - #define WL_EXTRA_BUF_MAX 2048
  27076. - #define WL_ROAM_TRIGGER_LEVEL -75
  27077. - #define WL_ROAM_DELTA 20
  27078. --#define WL_BEACON_TIMEOUT 3
  27079. -
  27080. - #define WL_SCAN_CHANNEL_TIME 40
  27081. - #define WL_SCAN_UNASSOC_TIME 40
  27082. -@@ -77,6 +76,9 @@
  27083. -
  27084. - #define BRCMF_MAX_DEFAULT_KEYS 4
  27085. -
  27086. -+/* beacon loss timeout defaults */
  27087. -+#define BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON 2
  27088. -+#define BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_OFF 4
  27089. -
  27090. - /**
  27091. - * enum brcmf_scan_status - scan engine status
  27092. -@@ -178,7 +180,6 @@ struct vif_saved_ie {
  27093. - * @ifp: lower layer interface pointer
  27094. - * @wdev: wireless device.
  27095. - * @profile: profile information.
  27096. -- * @roam_off: roaming state.
  27097. - * @sme_state: SME state using enum brcmf_vif_status bits.
  27098. - * @pm_block: power-management blocked.
  27099. - * @list: linked list.
  27100. -@@ -189,7 +190,6 @@ struct brcmf_cfg80211_vif {
  27101. - struct brcmf_if *ifp;
  27102. - struct wireless_dev wdev;
  27103. - struct brcmf_cfg80211_profile profile;
  27104. -- s32 roam_off;
  27105. - unsigned long sme_state;
  27106. - bool pm_block;
  27107. - struct vif_saved_ie saved_ie;
  27108. ---- a/drivers/net/wireless/brcm80211/brcmfmac/common.c
  27109. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/common.c
  27110. -@@ -29,7 +29,6 @@
  27111. -
  27112. - const u8 ALLFFMAC[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
  27113. -
  27114. --#define BRCMF_DEFAULT_BCN_TIMEOUT 3
  27115. - #define BRCMF_DEFAULT_SCAN_CHANNEL_TIME 40
  27116. - #define BRCMF_DEFAULT_SCAN_UNASSOC_TIME 40
  27117. -
  27118. -@@ -107,26 +106,6 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
  27119. - goto done;
  27120. - }
  27121. -
  27122. -- /*
  27123. -- * Setup timeout if Beacons are lost and roam is off to report
  27124. -- * link down
  27125. -- */
  27126. -- err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout",
  27127. -- BRCMF_DEFAULT_BCN_TIMEOUT);
  27128. -- if (err) {
  27129. -- brcmf_err("bcn_timeout error (%d)\n", err);
  27130. -- goto done;
  27131. -- }
  27132. --
  27133. -- /* Enable/Disable build-in roaming to allowed ext supplicant to take
  27134. -- * of romaing
  27135. -- */
  27136. -- err = brcmf_fil_iovar_int_set(ifp, "roam_off", 1);
  27137. -- if (err) {
  27138. -- brcmf_err("roam_off error (%d)\n", err);
  27139. -- goto done;
  27140. -- }
  27141. --
  27142. - /* Setup join_pref to select target by RSSI(with boost on 5GHz) */
  27143. - join_pref_params[0].type = BRCMF_JOIN_PREF_RSSI_DELTA;
  27144. - join_pref_params[0].len = 2;
  27145. diff --git a/package/kernel/mac80211/patches/376-0007-brcmfmac-Add-beamforming-support.patch b/package/kernel/mac80211/patches/376-0007-brcmfmac-Add-beamforming-support.patch
  27146. deleted file mode 100644
  27147. index 395166b..0000000
  27148. --- a/package/kernel/mac80211/patches/376-0007-brcmfmac-Add-beamforming-support.patch
  27149. +++ /dev/null
  27150. @@ -1,115 +0,0 @@
  27151. -From: Hante Meuleman <meuleman@broadcom.com>
  27152. -Date: Wed, 25 Nov 2015 11:32:43 +0100
  27153. -Subject: [PATCH] brcmfmac: Add beamforming support.
  27154. -
  27155. -Some devices support beamforming. This patch enables tx beamforming
  27156. -if supported and reports beamforming capabilities per channel if
  27157. -supported.
  27158. -
  27159. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  27160. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  27161. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  27162. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  27163. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  27164. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  27165. ----
  27166. -
  27167. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  27168. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  27169. -@@ -5671,7 +5671,8 @@ static __le16 brcmf_get_mcs_map(u32 ncha
  27170. - }
  27171. -
  27172. - static void brcmf_update_vht_cap(struct ieee80211_supported_band *band,
  27173. -- u32 bw_cap[2], u32 nchain)
  27174. -+ u32 bw_cap[2], u32 nchain, u32 txstreams,
  27175. -+ u32 txbf_bfe_cap, u32 txbf_bfr_cap)
  27176. - {
  27177. - __le16 mcs_map;
  27178. -
  27179. -@@ -5690,6 +5691,25 @@ static void brcmf_update_vht_cap(struct
  27180. - mcs_map = brcmf_get_mcs_map(nchain, IEEE80211_VHT_MCS_SUPPORT_0_9);
  27181. - band->vht_cap.vht_mcs.rx_mcs_map = mcs_map;
  27182. - band->vht_cap.vht_mcs.tx_mcs_map = mcs_map;
  27183. -+
  27184. -+ /* Beamforming support information */
  27185. -+ if (txbf_bfe_cap & BRCMF_TXBF_SU_BFE_CAP)
  27186. -+ band->vht_cap.cap |= IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE;
  27187. -+ if (txbf_bfe_cap & BRCMF_TXBF_MU_BFE_CAP)
  27188. -+ band->vht_cap.cap |= IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE;
  27189. -+ if (txbf_bfr_cap & BRCMF_TXBF_SU_BFR_CAP)
  27190. -+ band->vht_cap.cap |= IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE;
  27191. -+ if (txbf_bfr_cap & BRCMF_TXBF_MU_BFR_CAP)
  27192. -+ band->vht_cap.cap |= IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE;
  27193. -+
  27194. -+ if ((txbf_bfe_cap || txbf_bfr_cap) && (txstreams > 1)) {
  27195. -+ band->vht_cap.cap |=
  27196. -+ (2 << IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT);
  27197. -+ band->vht_cap.cap |= ((txstreams - 1) <<
  27198. -+ IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT);
  27199. -+ band->vht_cap.cap |=
  27200. -+ IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB;
  27201. -+ }
  27202. - }
  27203. -
  27204. - static int brcmf_setup_wiphybands(struct wiphy *wiphy)
  27205. -@@ -5704,6 +5724,9 @@ static int brcmf_setup_wiphybands(struct
  27206. - int err;
  27207. - s32 i;
  27208. - struct ieee80211_supported_band *band;
  27209. -+ u32 txstreams = 0;
  27210. -+ u32 txbf_bfe_cap = 0;
  27211. -+ u32 txbf_bfr_cap = 0;
  27212. -
  27213. - (void)brcmf_fil_iovar_int_get(ifp, "vhtmode", &vhtmode);
  27214. - err = brcmf_fil_iovar_int_get(ifp, "nmode", &nmode);
  27215. -@@ -5732,6 +5755,14 @@ static int brcmf_setup_wiphybands(struct
  27216. - return err;
  27217. - }
  27218. -
  27219. -+ if (vhtmode) {
  27220. -+ (void)brcmf_fil_iovar_int_get(ifp, "txstreams", &txstreams);
  27221. -+ (void)brcmf_fil_iovar_int_get(ifp, "txbf_bfe_cap",
  27222. -+ &txbf_bfe_cap);
  27223. -+ (void)brcmf_fil_iovar_int_get(ifp, "txbf_bfr_cap",
  27224. -+ &txbf_bfr_cap);
  27225. -+ }
  27226. -+
  27227. - wiphy = cfg_to_wiphy(cfg);
  27228. - for (i = 0; i < ARRAY_SIZE(wiphy->bands); i++) {
  27229. - band = wiphy->bands[i];
  27230. -@@ -5741,7 +5772,8 @@ static int brcmf_setup_wiphybands(struct
  27231. - if (nmode)
  27232. - brcmf_update_ht_cap(band, bw_cap, nchain);
  27233. - if (vhtmode)
  27234. -- brcmf_update_vht_cap(band, bw_cap, nchain);
  27235. -+ brcmf_update_vht_cap(band, bw_cap, nchain, txstreams,
  27236. -+ txbf_bfe_cap, txbf_bfr_cap);
  27237. - }
  27238. -
  27239. - return 0;
  27240. ---- a/drivers/net/wireless/brcm80211/brcmfmac/common.c
  27241. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/common.c
  27242. -@@ -153,6 +153,9 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
  27243. - goto done;
  27244. - }
  27245. -
  27246. -+ /* Enable tx beamforming, errors can be ignored (not supported) */
  27247. -+ (void)brcmf_fil_iovar_int_set(ifp, "txbf", 1);
  27248. -+
  27249. - /* do bus specific preinit here */
  27250. - err = brcmf_bus_preinit(ifp->drvr->bus_if);
  27251. - done:
  27252. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  27253. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  27254. -@@ -121,6 +121,11 @@
  27255. -
  27256. - #define BRCMF_MAX_ASSOCLIST 128
  27257. -
  27258. -+#define BRCMF_TXBF_SU_BFE_CAP BIT(0)
  27259. -+#define BRCMF_TXBF_MU_BFE_CAP BIT(1)
  27260. -+#define BRCMF_TXBF_SU_BFR_CAP BIT(0)
  27261. -+#define BRCMF_TXBF_MU_BFR_CAP BIT(1)
  27262. -+
  27263. - /* join preference types for join_pref iovar */
  27264. - enum brcmf_join_pref_types {
  27265. - BRCMF_JOIN_PREF_RSSI = 1,
  27266. diff --git a/package/kernel/mac80211/patches/376-0008-brcmfmac-assure-net_ratelimit-is-declared-before-use.patch b/package/kernel/mac80211/patches/376-0008-brcmfmac-assure-net_ratelimit-is-declared-before-use.patch
  27267. deleted file mode 100644
  27268. index d471eb5..0000000
  27269. --- a/package/kernel/mac80211/patches/376-0008-brcmfmac-assure-net_ratelimit-is-declared-before-use.patch
  27270. +++ /dev/null
  27271. @@ -1,25 +0,0 @@
  27272. -From: Arend van Spriel <arend@broadcom.com>
  27273. -Date: Wed, 25 Nov 2015 11:32:45 +0100
  27274. -Subject: [PATCH] brcmfmac: assure net_ratelimit() is declared before use
  27275. -
  27276. -Under some kernel configuration we get build issue with implicit
  27277. -declaration of net_ratelimit() function. Fix this by explicitly
  27278. -including the file providing the prototype.
  27279. -
  27280. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  27281. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  27282. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  27283. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  27284. ----
  27285. -
  27286. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  27287. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  27288. -@@ -17,6 +17,8 @@
  27289. - #ifndef BRCMFMAC_DEBUG_H
  27290. - #define BRCMFMAC_DEBUG_H
  27291. -
  27292. -+#include <linux/net.h> /* net_ratelimit() */
  27293. -+
  27294. - /* message levels */
  27295. - #define BRCMF_TRACE_VAL 0x00000002
  27296. - #define BRCMF_INFO_VAL 0x00000004
  27297. diff --git a/package/kernel/mac80211/patches/376-0009-brcmfmac-Unify-methods-to-define-and-map-firmware-fi.patch b/package/kernel/mac80211/patches/376-0009-brcmfmac-Unify-methods-to-define-and-map-firmware-fi.patch
  27298. deleted file mode 100644
  27299. index 0ec9d10..0000000
  27300. --- a/package/kernel/mac80211/patches/376-0009-brcmfmac-Unify-methods-to-define-and-map-firmware-fi.patch
  27301. +++ /dev/null
  27302. @@ -1,664 +0,0 @@
  27303. -From: Hante Meuleman <meuleman@broadcom.com>
  27304. -Date: Wed, 25 Nov 2015 11:32:46 +0100
  27305. -Subject: [PATCH] brcmfmac: Unify methods to define and map firmware files.
  27306. -
  27307. -All bus drivers (sdio, usb and pcie) require firmware files which
  27308. -needs to be downloaded to the device, The definitions and mapping
  27309. -of device id and revision to firmware and nvram file is done by
  27310. -each bus driver. This patch creates common functions and defines
  27311. -to simplify and unify the definition of these firmware and nvram
  27312. -files and mapping.
  27313. -
  27314. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  27315. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  27316. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  27317. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  27318. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  27319. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  27320. ----
  27321. -
  27322. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  27323. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  27324. -@@ -27,9 +27,9 @@
  27325. - #define BRCMF_FW_NVRAM_DEVPATH_LEN 19 /* devpath0=pcie/1/4/ */
  27326. - #define BRCMF_FW_NVRAM_PCIEDEV_LEN 10 /* pcie/1/4/ + \0 */
  27327. -
  27328. --char brcmf_firmware_path[BRCMF_FW_PATH_LEN];
  27329. -+static char brcmf_firmware_path[BRCMF_FW_NAME_LEN];
  27330. - module_param_string(alternative_fw_path, brcmf_firmware_path,
  27331. -- BRCMF_FW_PATH_LEN, 0440);
  27332. -+ BRCMF_FW_NAME_LEN, 0440);
  27333. -
  27334. - enum nvram_parser_state {
  27335. - IDLE,
  27336. -@@ -531,3 +531,43 @@ int brcmf_fw_get_firmwares(struct device
  27337. - 0);
  27338. - }
  27339. -
  27340. -+int brcmf_fw_map_chip_to_name(u32 chip, u32 chiprev,
  27341. -+ struct brcmf_firmware_mapping mapping_table[],
  27342. -+ u32 table_size, char fw_name[BRCMF_FW_NAME_LEN],
  27343. -+ char nvram_name[BRCMF_FW_NAME_LEN])
  27344. -+{
  27345. -+ u32 i;
  27346. -+ char end;
  27347. -+
  27348. -+ for (i = 0; i < table_size; i++) {
  27349. -+ if (mapping_table[i].chipid == chip &&
  27350. -+ mapping_table[i].revmask & BIT(chiprev))
  27351. -+ break;
  27352. -+ }
  27353. -+
  27354. -+ if (i == table_size) {
  27355. -+ brcmf_err("Unknown chipid %d [%d]\n", chip, chiprev);
  27356. -+ return -ENODEV;
  27357. -+ }
  27358. -+
  27359. -+ /* check if firmware path is provided by module parameter */
  27360. -+ if (brcmf_firmware_path[0] != '\0') {
  27361. -+ strlcpy(fw_name, brcmf_firmware_path, BRCMF_FW_NAME_LEN);
  27362. -+ if ((nvram_name) && (mapping_table[i].nvram))
  27363. -+ strlcpy(nvram_name, brcmf_firmware_path,
  27364. -+ BRCMF_FW_NAME_LEN);
  27365. -+
  27366. -+ end = brcmf_firmware_path[strlen(brcmf_firmware_path) - 1];
  27367. -+ if (end != '/') {
  27368. -+ strlcat(fw_name, "/", BRCMF_FW_NAME_LEN);
  27369. -+ if ((nvram_name) && (mapping_table[i].nvram))
  27370. -+ strlcat(nvram_name, "/", BRCMF_FW_NAME_LEN);
  27371. -+ }
  27372. -+ }
  27373. -+ strlcat(fw_name, mapping_table[i].fw, BRCMF_FW_NAME_LEN);
  27374. -+ if ((nvram_name) && (mapping_table[i].nvram))
  27375. -+ strlcat(nvram_name, mapping_table[i].nvram, BRCMF_FW_NAME_LEN);
  27376. -+
  27377. -+ return 0;
  27378. -+}
  27379. -+
  27380. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.h
  27381. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.h
  27382. -@@ -21,11 +21,51 @@
  27383. - #define BRCMF_FW_REQ_FLAGS 0x00F0
  27384. - #define BRCMF_FW_REQ_NV_OPTIONAL 0x0010
  27385. -
  27386. --#define BRCMF_FW_PATH_LEN 256
  27387. --#define BRCMF_FW_NAME_LEN 32
  27388. -+#define BRCMF_FW_NAME_LEN 320
  27389. -
  27390. --extern char brcmf_firmware_path[];
  27391. -+#define BRCMF_FW_DEFAULT_PATH "brcm/"
  27392. -
  27393. -+/**
  27394. -+ * struct brcmf_firmware_mapping - Used to map chipid/revmask to firmware
  27395. -+ * filename and nvram filename. Each bus type implementation should create
  27396. -+ * a table of firmware mappings (using the macros defined below).
  27397. -+ *
  27398. -+ * @chipid: ID of chip.
  27399. -+ * @revmask: bitmask of revisions, e.g. 0x10 means rev 4 only, 0xf means rev 0-3
  27400. -+ * @fw: name of the firmware file.
  27401. -+ * @nvram: name of nvram file.
  27402. -+ */
  27403. -+struct brcmf_firmware_mapping {
  27404. -+ u32 chipid;
  27405. -+ u32 revmask;
  27406. -+ const char *fw;
  27407. -+ const char *nvram;
  27408. -+};
  27409. -+
  27410. -+#define BRCMF_FW_NVRAM_DEF(fw_nvram_name, fw, nvram) \
  27411. -+static const char BRCM_ ## fw_nvram_name ## _FIRMWARE_NAME[] = \
  27412. -+ BRCMF_FW_DEFAULT_PATH fw; \
  27413. -+static const char BRCM_ ## fw_nvram_name ## _NVRAM_NAME[] = \
  27414. -+ BRCMF_FW_DEFAULT_PATH nvram; \
  27415. -+MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH fw); \
  27416. -+MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH nvram)
  27417. -+
  27418. -+#define BRCMF_FW_DEF(fw_name, fw) \
  27419. -+static const char BRCM_ ## fw_name ## _FIRMWARE_NAME[] = \
  27420. -+ BRCMF_FW_DEFAULT_PATH fw; \
  27421. -+MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH fw) \
  27422. -+
  27423. -+#define BRCMF_FW_NVRAM_ENTRY(chipid, mask, name) \
  27424. -+ { chipid, mask, \
  27425. -+ BRCM_ ## name ## _FIRMWARE_NAME, BRCM_ ## name ## _NVRAM_NAME }
  27426. -+
  27427. -+#define BRCMF_FW_ENTRY(chipid, mask, name) \
  27428. -+ { chipid, mask, BRCM_ ## name ## _FIRMWARE_NAME, NULL }
  27429. -+
  27430. -+int brcmf_fw_map_chip_to_name(u32 chip, u32 chiprev,
  27431. -+ struct brcmf_firmware_mapping mapping_table[],
  27432. -+ u32 table_size, char fw_name[BRCMF_FW_NAME_LEN],
  27433. -+ char nvram_name[BRCMF_FW_NAME_LEN]);
  27434. - void brcmf_fw_nvram_free(void *nvram);
  27435. - /*
  27436. - * Request firmware(s) asynchronously. When the asynchronous request
  27437. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  27438. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  27439. -@@ -44,25 +44,29 @@ enum brcmf_pcie_state {
  27440. - BRCMFMAC_PCIE_STATE_UP
  27441. - };
  27442. -
  27443. --
  27444. --#define BRCMF_PCIE_43602_FW_NAME "brcm/brcmfmac43602-pcie.bin"
  27445. --#define BRCMF_PCIE_43602_NVRAM_NAME "brcm/brcmfmac43602-pcie.txt"
  27446. --#define BRCMF_PCIE_4350_FW_NAME "brcm/brcmfmac4350-pcie.bin"
  27447. --#define BRCMF_PCIE_4350_NVRAM_NAME "brcm/brcmfmac4350-pcie.txt"
  27448. --#define BRCMF_PCIE_4356_FW_NAME "brcm/brcmfmac4356-pcie.bin"
  27449. --#define BRCMF_PCIE_4356_NVRAM_NAME "brcm/brcmfmac4356-pcie.txt"
  27450. --#define BRCMF_PCIE_43570_FW_NAME "brcm/brcmfmac43570-pcie.bin"
  27451. --#define BRCMF_PCIE_43570_NVRAM_NAME "brcm/brcmfmac43570-pcie.txt"
  27452. --#define BRCMF_PCIE_4358_FW_NAME "brcm/brcmfmac4358-pcie.bin"
  27453. --#define BRCMF_PCIE_4358_NVRAM_NAME "brcm/brcmfmac4358-pcie.txt"
  27454. --#define BRCMF_PCIE_4359_FW_NAME "brcm/brcmfmac4359-pcie.bin"
  27455. --#define BRCMF_PCIE_4359_NVRAM_NAME "brcm/brcmfmac4359-pcie.txt"
  27456. --#define BRCMF_PCIE_4365_FW_NAME "brcm/brcmfmac4365b-pcie.bin"
  27457. --#define BRCMF_PCIE_4365_NVRAM_NAME "brcm/brcmfmac4365b-pcie.txt"
  27458. --#define BRCMF_PCIE_4366_FW_NAME "brcm/brcmfmac4366b-pcie.bin"
  27459. --#define BRCMF_PCIE_4366_NVRAM_NAME "brcm/brcmfmac4366b-pcie.txt"
  27460. --#define BRCMF_PCIE_4371_FW_NAME "brcm/brcmfmac4371-pcie.bin"
  27461. --#define BRCMF_PCIE_4371_NVRAM_NAME "brcm/brcmfmac4371-pcie.txt"
  27462. -+BRCMF_FW_NVRAM_DEF(43602, "brcmfmac43602-pcie.bin", "brcmfmac43602-pcie.txt");
  27463. -+BRCMF_FW_NVRAM_DEF(4350, "brcmfmac4350-pcie.bin", "brcmfmac4350-pcie.txt");
  27464. -+BRCMF_FW_NVRAM_DEF(4356, "brcmfmac4356-pcie.bin", "brcmfmac4356-pcie.txt");
  27465. -+BRCMF_FW_NVRAM_DEF(43570, "brcmfmac43570-pcie.bin", "brcmfmac43570-pcie.txt");
  27466. -+BRCMF_FW_NVRAM_DEF(4358, "brcmfmac4358-pcie.bin", "brcmfmac4358-pcie.txt");
  27467. -+BRCMF_FW_NVRAM_DEF(4359, "brcmfmac4359-pcie.bin", "brcmfmac4359-pcie.txt");
  27468. -+BRCMF_FW_NVRAM_DEF(4365B, "brcmfmac4365b-pcie.bin", "brcmfmac4365b-pcie.txt");
  27469. -+BRCMF_FW_NVRAM_DEF(4366B, "brcmfmac4366b-pcie.bin", "brcmfmac4366b-pcie.txt");
  27470. -+BRCMF_FW_NVRAM_DEF(4371, "brcmfmac4371-pcie.bin", "brcmfmac4371-pcie.txt");
  27471. -+
  27472. -+static struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = {
  27473. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43602_CHIP_ID, 0xFFFFFFFF, 43602),
  27474. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4350_CHIP_ID, 0xFFFFFFFF, 4350),
  27475. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4356_CHIP_ID, 0xFFFFFFFF, 4356),
  27476. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43567_CHIP_ID, 0xFFFFFFFF, 43570),
  27477. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43569_CHIP_ID, 0xFFFFFFFF, 43570),
  27478. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43570_CHIP_ID, 0xFFFFFFFF, 43570),
  27479. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4358_CHIP_ID, 0xFFFFFFFF, 4358),
  27480. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4359_CHIP_ID, 0xFFFFFFFF, 4359),
  27481. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4365_CHIP_ID, 0xFFFFFFFF, 4365B),
  27482. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0xFFFFFFFF, 4366B),
  27483. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4371_CHIP_ID, 0xFFFFFFFF, 4371),
  27484. -+};
  27485. -
  27486. - #define BRCMF_PCIE_FW_UP_TIMEOUT 2000 /* msec */
  27487. -
  27488. -@@ -202,26 +206,6 @@ enum brcmf_pcie_state {
  27489. - #define BRCMF_PCIE_LINK_STATUS_CTRL_ASPM_ENAB 3
  27490. -
  27491. -
  27492. --MODULE_FIRMWARE(BRCMF_PCIE_43602_FW_NAME);
  27493. --MODULE_FIRMWARE(BRCMF_PCIE_43602_NVRAM_NAME);
  27494. --MODULE_FIRMWARE(BRCMF_PCIE_4350_FW_NAME);
  27495. --MODULE_FIRMWARE(BRCMF_PCIE_4350_NVRAM_NAME);
  27496. --MODULE_FIRMWARE(BRCMF_PCIE_4356_FW_NAME);
  27497. --MODULE_FIRMWARE(BRCMF_PCIE_4356_NVRAM_NAME);
  27498. --MODULE_FIRMWARE(BRCMF_PCIE_43570_FW_NAME);
  27499. --MODULE_FIRMWARE(BRCMF_PCIE_43570_NVRAM_NAME);
  27500. --MODULE_FIRMWARE(BRCMF_PCIE_4358_FW_NAME);
  27501. --MODULE_FIRMWARE(BRCMF_PCIE_4358_NVRAM_NAME);
  27502. --MODULE_FIRMWARE(BRCMF_PCIE_4359_FW_NAME);
  27503. --MODULE_FIRMWARE(BRCMF_PCIE_4359_NVRAM_NAME);
  27504. --MODULE_FIRMWARE(BRCMF_PCIE_4365_FW_NAME);
  27505. --MODULE_FIRMWARE(BRCMF_PCIE_4365_NVRAM_NAME);
  27506. --MODULE_FIRMWARE(BRCMF_PCIE_4366_FW_NAME);
  27507. --MODULE_FIRMWARE(BRCMF_PCIE_4366_NVRAM_NAME);
  27508. --MODULE_FIRMWARE(BRCMF_PCIE_4371_FW_NAME);
  27509. --MODULE_FIRMWARE(BRCMF_PCIE_4371_NVRAM_NAME);
  27510. --
  27511. --
  27512. - struct brcmf_pcie_console {
  27513. - u32 base_addr;
  27514. - u32 buf_addr;
  27515. -@@ -258,8 +242,8 @@ struct brcmf_pciedev_info {
  27516. - enum brcmf_pcie_state state;
  27517. - bool in_irq;
  27518. - struct pci_dev *pdev;
  27519. -- char fw_name[BRCMF_FW_PATH_LEN + BRCMF_FW_NAME_LEN];
  27520. -- char nvram_name[BRCMF_FW_PATH_LEN + BRCMF_FW_NAME_LEN];
  27521. -+ char fw_name[BRCMF_FW_NAME_LEN];
  27522. -+ char nvram_name[BRCMF_FW_NAME_LEN];
  27523. - void __iomem *regs;
  27524. - void __iomem *tcm;
  27525. - u32 tcm_size;
  27526. -@@ -1478,84 +1462,6 @@ brcmf_pcie_init_share_ram_info(struct br
  27527. - }
  27528. -
  27529. -
  27530. --static int brcmf_pcie_get_fwnames(struct brcmf_pciedev_info *devinfo)
  27531. --{
  27532. -- char *fw_name;
  27533. -- char *nvram_name;
  27534. -- uint fw_len, nv_len;
  27535. -- char end;
  27536. --
  27537. -- brcmf_dbg(PCIE, "Enter, chip 0x%04x chiprev %d\n", devinfo->ci->chip,
  27538. -- devinfo->ci->chiprev);
  27539. --
  27540. -- switch (devinfo->ci->chip) {
  27541. -- case BRCM_CC_43602_CHIP_ID:
  27542. -- fw_name = BRCMF_PCIE_43602_FW_NAME;
  27543. -- nvram_name = BRCMF_PCIE_43602_NVRAM_NAME;
  27544. -- break;
  27545. -- case BRCM_CC_4350_CHIP_ID:
  27546. -- fw_name = BRCMF_PCIE_4350_FW_NAME;
  27547. -- nvram_name = BRCMF_PCIE_4350_NVRAM_NAME;
  27548. -- break;
  27549. -- case BRCM_CC_4356_CHIP_ID:
  27550. -- fw_name = BRCMF_PCIE_4356_FW_NAME;
  27551. -- nvram_name = BRCMF_PCIE_4356_NVRAM_NAME;
  27552. -- break;
  27553. -- case BRCM_CC_43567_CHIP_ID:
  27554. -- case BRCM_CC_43569_CHIP_ID:
  27555. -- case BRCM_CC_43570_CHIP_ID:
  27556. -- fw_name = BRCMF_PCIE_43570_FW_NAME;
  27557. -- nvram_name = BRCMF_PCIE_43570_NVRAM_NAME;
  27558. -- break;
  27559. -- case BRCM_CC_4358_CHIP_ID:
  27560. -- fw_name = BRCMF_PCIE_4358_FW_NAME;
  27561. -- nvram_name = BRCMF_PCIE_4358_NVRAM_NAME;
  27562. -- break;
  27563. -- case BRCM_CC_4359_CHIP_ID:
  27564. -- fw_name = BRCMF_PCIE_4359_FW_NAME;
  27565. -- nvram_name = BRCMF_PCIE_4359_NVRAM_NAME;
  27566. -- break;
  27567. -- case BRCM_CC_4365_CHIP_ID:
  27568. -- fw_name = BRCMF_PCIE_4365_FW_NAME;
  27569. -- nvram_name = BRCMF_PCIE_4365_NVRAM_NAME;
  27570. -- break;
  27571. -- case BRCM_CC_4366_CHIP_ID:
  27572. -- fw_name = BRCMF_PCIE_4366_FW_NAME;
  27573. -- nvram_name = BRCMF_PCIE_4366_NVRAM_NAME;
  27574. -- break;
  27575. -- case BRCM_CC_4371_CHIP_ID:
  27576. -- fw_name = BRCMF_PCIE_4371_FW_NAME;
  27577. -- nvram_name = BRCMF_PCIE_4371_NVRAM_NAME;
  27578. -- break;
  27579. -- default:
  27580. -- brcmf_err("Unsupported chip 0x%04x\n", devinfo->ci->chip);
  27581. -- return -ENODEV;
  27582. -- }
  27583. --
  27584. -- fw_len = sizeof(devinfo->fw_name) - 1;
  27585. -- nv_len = sizeof(devinfo->nvram_name) - 1;
  27586. -- /* check if firmware path is provided by module parameter */
  27587. -- if (brcmf_firmware_path[0] != '\0') {
  27588. -- strncpy(devinfo->fw_name, brcmf_firmware_path, fw_len);
  27589. -- strncpy(devinfo->nvram_name, brcmf_firmware_path, nv_len);
  27590. -- fw_len -= strlen(devinfo->fw_name);
  27591. -- nv_len -= strlen(devinfo->nvram_name);
  27592. --
  27593. -- end = brcmf_firmware_path[strlen(brcmf_firmware_path) - 1];
  27594. -- if (end != '/') {
  27595. -- strncat(devinfo->fw_name, "/", fw_len);
  27596. -- strncat(devinfo->nvram_name, "/", nv_len);
  27597. -- fw_len--;
  27598. -- nv_len--;
  27599. -- }
  27600. -- }
  27601. -- strncat(devinfo->fw_name, fw_name, fw_len);
  27602. -- strncat(devinfo->nvram_name, nvram_name, nv_len);
  27603. --
  27604. -- return 0;
  27605. --}
  27606. --
  27607. --
  27608. - static int brcmf_pcie_download_fw_nvram(struct brcmf_pciedev_info *devinfo,
  27609. - const struct firmware *fw, void *nvram,
  27610. - u32 nvram_len)
  27611. -@@ -1891,7 +1797,10 @@ brcmf_pcie_probe(struct pci_dev *pdev, c
  27612. - bus->wowl_supported = pci_pme_capable(pdev, PCI_D3hot);
  27613. - dev_set_drvdata(&pdev->dev, bus);
  27614. -
  27615. -- ret = brcmf_pcie_get_fwnames(devinfo);
  27616. -+ ret = brcmf_fw_map_chip_to_name(devinfo->ci->chip, devinfo->ci->chiprev,
  27617. -+ brcmf_pcie_fwnames,
  27618. -+ ARRAY_SIZE(brcmf_pcie_fwnames),
  27619. -+ devinfo->fw_name, devinfo->nvram_name);
  27620. - if (ret)
  27621. - goto fail_bus;
  27622. -
  27623. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  27624. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  27625. -@@ -596,136 +596,41 @@ static const struct sdiod_drive_str sdio
  27626. - {4, 0x1}
  27627. - };
  27628. -
  27629. --#define BCM43143_FIRMWARE_NAME "brcm/brcmfmac43143-sdio.bin"
  27630. --#define BCM43143_NVRAM_NAME "brcm/brcmfmac43143-sdio.txt"
  27631. --#define BCM43241B0_FIRMWARE_NAME "brcm/brcmfmac43241b0-sdio.bin"
  27632. --#define BCM43241B0_NVRAM_NAME "brcm/brcmfmac43241b0-sdio.txt"
  27633. --#define BCM43241B4_FIRMWARE_NAME "brcm/brcmfmac43241b4-sdio.bin"
  27634. --#define BCM43241B4_NVRAM_NAME "brcm/brcmfmac43241b4-sdio.txt"
  27635. --#define BCM43241B5_FIRMWARE_NAME "brcm/brcmfmac43241b5-sdio.bin"
  27636. --#define BCM43241B5_NVRAM_NAME "brcm/brcmfmac43241b5-sdio.txt"
  27637. --#define BCM4329_FIRMWARE_NAME "brcm/brcmfmac4329-sdio.bin"
  27638. --#define BCM4329_NVRAM_NAME "brcm/brcmfmac4329-sdio.txt"
  27639. --#define BCM4330_FIRMWARE_NAME "brcm/brcmfmac4330-sdio.bin"
  27640. --#define BCM4330_NVRAM_NAME "brcm/brcmfmac4330-sdio.txt"
  27641. --#define BCM4334_FIRMWARE_NAME "brcm/brcmfmac4334-sdio.bin"
  27642. --#define BCM4334_NVRAM_NAME "brcm/brcmfmac4334-sdio.txt"
  27643. --#define BCM43340_FIRMWARE_NAME "brcm/brcmfmac43340-sdio.bin"
  27644. --#define BCM43340_NVRAM_NAME "brcm/brcmfmac43340-sdio.txt"
  27645. --#define BCM4335_FIRMWARE_NAME "brcm/brcmfmac4335-sdio.bin"
  27646. --#define BCM4335_NVRAM_NAME "brcm/brcmfmac4335-sdio.txt"
  27647. --#define BCM43362_FIRMWARE_NAME "brcm/brcmfmac43362-sdio.bin"
  27648. --#define BCM43362_NVRAM_NAME "brcm/brcmfmac43362-sdio.txt"
  27649. --#define BCM4339_FIRMWARE_NAME "brcm/brcmfmac4339-sdio.bin"
  27650. --#define BCM4339_NVRAM_NAME "brcm/brcmfmac4339-sdio.txt"
  27651. --#define BCM43430_FIRMWARE_NAME "brcm/brcmfmac43430-sdio.bin"
  27652. --#define BCM43430_NVRAM_NAME "brcm/brcmfmac43430-sdio.txt"
  27653. --#define BCM43455_FIRMWARE_NAME "brcm/brcmfmac43455-sdio.bin"
  27654. --#define BCM43455_NVRAM_NAME "brcm/brcmfmac43455-sdio.txt"
  27655. --#define BCM4354_FIRMWARE_NAME "brcm/brcmfmac4354-sdio.bin"
  27656. --#define BCM4354_NVRAM_NAME "brcm/brcmfmac4354-sdio.txt"
  27657. --
  27658. --MODULE_FIRMWARE(BCM43143_FIRMWARE_NAME);
  27659. --MODULE_FIRMWARE(BCM43143_NVRAM_NAME);
  27660. --MODULE_FIRMWARE(BCM43241B0_FIRMWARE_NAME);
  27661. --MODULE_FIRMWARE(BCM43241B0_NVRAM_NAME);
  27662. --MODULE_FIRMWARE(BCM43241B4_FIRMWARE_NAME);
  27663. --MODULE_FIRMWARE(BCM43241B4_NVRAM_NAME);
  27664. --MODULE_FIRMWARE(BCM43241B5_FIRMWARE_NAME);
  27665. --MODULE_FIRMWARE(BCM43241B5_NVRAM_NAME);
  27666. --MODULE_FIRMWARE(BCM4329_FIRMWARE_NAME);
  27667. --MODULE_FIRMWARE(BCM4329_NVRAM_NAME);
  27668. --MODULE_FIRMWARE(BCM4330_FIRMWARE_NAME);
  27669. --MODULE_FIRMWARE(BCM4330_NVRAM_NAME);
  27670. --MODULE_FIRMWARE(BCM4334_FIRMWARE_NAME);
  27671. --MODULE_FIRMWARE(BCM4334_NVRAM_NAME);
  27672. --MODULE_FIRMWARE(BCM43340_FIRMWARE_NAME);
  27673. --MODULE_FIRMWARE(BCM43340_NVRAM_NAME);
  27674. --MODULE_FIRMWARE(BCM4335_FIRMWARE_NAME);
  27675. --MODULE_FIRMWARE(BCM4335_NVRAM_NAME);
  27676. --MODULE_FIRMWARE(BCM43362_FIRMWARE_NAME);
  27677. --MODULE_FIRMWARE(BCM43362_NVRAM_NAME);
  27678. --MODULE_FIRMWARE(BCM4339_FIRMWARE_NAME);
  27679. --MODULE_FIRMWARE(BCM4339_NVRAM_NAME);
  27680. --MODULE_FIRMWARE(BCM43430_FIRMWARE_NAME);
  27681. --MODULE_FIRMWARE(BCM43430_NVRAM_NAME);
  27682. --MODULE_FIRMWARE(BCM43455_FIRMWARE_NAME);
  27683. --MODULE_FIRMWARE(BCM43455_NVRAM_NAME);
  27684. --MODULE_FIRMWARE(BCM4354_FIRMWARE_NAME);
  27685. --MODULE_FIRMWARE(BCM4354_NVRAM_NAME);
  27686. --
  27687. --struct brcmf_firmware_names {
  27688. -- u32 chipid;
  27689. -- u32 revmsk;
  27690. -- const char *bin;
  27691. -- const char *nv;
  27692. -+BRCMF_FW_NVRAM_DEF(43143, "brcmfmac43143-sdio.bin", "brcmfmac43143-sdio.txt");
  27693. -+BRCMF_FW_NVRAM_DEF(43241B0, "brcmfmac43241b0-sdio.bin",
  27694. -+ "brcmfmac43241b0-sdio.txt");
  27695. -+BRCMF_FW_NVRAM_DEF(43241B4, "brcmfmac43241b4-sdio.bin",
  27696. -+ "brcmfmac43241b4-sdio.txt");
  27697. -+BRCMF_FW_NVRAM_DEF(43241B5, "brcmfmac43241b5-sdio.bin",
  27698. -+ "brcmfmac43241b5-sdio.txt");
  27699. -+BRCMF_FW_NVRAM_DEF(4329, "brcmfmac4329-sdio.bin", "brcmfmac4329-sdio.txt");
  27700. -+BRCMF_FW_NVRAM_DEF(4330, "brcmfmac4330-sdio.bin", "brcmfmac4330-sdio.txt");
  27701. -+BRCMF_FW_NVRAM_DEF(4334, "brcmfmac4334-sdio.bin", "brcmfmac4334-sdio.txt");
  27702. -+BRCMF_FW_NVRAM_DEF(43340, "brcmfmac43340-sdio.bin", "brcmfmac43340-sdio.txt");
  27703. -+BRCMF_FW_NVRAM_DEF(4335, "brcmfmac4335-sdio.bin", "brcmfmac4335-sdio.txt");
  27704. -+BRCMF_FW_NVRAM_DEF(43362, "brcmfmac43362-sdio.bin", "brcmfmac43362-sdio.txt");
  27705. -+BRCMF_FW_NVRAM_DEF(4339, "brcmfmac4339-sdio.bin", "brcmfmac4339-sdio.txt");
  27706. -+BRCMF_FW_NVRAM_DEF(43430, "brcmfmac43430-sdio.bin", "brcmfmac43430-sdio.txt");
  27707. -+BRCMF_FW_NVRAM_DEF(43455, "brcmfmac43455-sdio.bin", "brcmfmac43455-sdio.txt");
  27708. -+BRCMF_FW_NVRAM_DEF(4354, "brcmfmac4354-sdio.bin", "brcmfmac4354-sdio.txt");
  27709. -+
  27710. -+static struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = {
  27711. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143),
  27712. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43241_CHIP_ID, 0x0000001F, 43241B0),
  27713. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43241_CHIP_ID, 0x00000020, 43241B4),
  27714. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43241_CHIP_ID, 0xFFFFFFC0, 43241B5),
  27715. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4329_CHIP_ID, 0xFFFFFFFF, 4329),
  27716. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4330_CHIP_ID, 0xFFFFFFFF, 4330),
  27717. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, 4334),
  27718. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43340_CHIP_ID, 0xFFFFFFFF, 43340),
  27719. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, 4335),
  27720. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, 43362),
  27721. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, 4339),
  27722. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43430_CHIP_ID, 0xFFFFFFFF, 43430),
  27723. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4345_CHIP_ID, 0xFFFFFFC0, 43455),
  27724. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, 4354)
  27725. - };
  27726. -
  27727. --enum brcmf_firmware_type {
  27728. -- BRCMF_FIRMWARE_BIN,
  27729. -- BRCMF_FIRMWARE_NVRAM
  27730. --};
  27731. --
  27732. --#define BRCMF_FIRMWARE_NVRAM(name) \
  27733. -- name ## _FIRMWARE_NAME, name ## _NVRAM_NAME
  27734. --
  27735. --static const struct brcmf_firmware_names brcmf_fwname_data[] = {
  27736. -- { BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM43143) },
  27737. -- { BRCM_CC_43241_CHIP_ID, 0x0000001F, BRCMF_FIRMWARE_NVRAM(BCM43241B0) },
  27738. -- { BRCM_CC_43241_CHIP_ID, 0x00000020, BRCMF_FIRMWARE_NVRAM(BCM43241B4) },
  27739. -- { BRCM_CC_43241_CHIP_ID, 0xFFFFFFC0, BRCMF_FIRMWARE_NVRAM(BCM43241B5) },
  27740. -- { BRCM_CC_4329_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4329) },
  27741. -- { BRCM_CC_4330_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4330) },
  27742. -- { BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4334) },
  27743. -- { BRCM_CC_43340_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM43340) },
  27744. -- { BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4335) },
  27745. -- { BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, BRCMF_FIRMWARE_NVRAM(BCM43362) },
  27746. -- { BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4339) },
  27747. -- { BRCM_CC_43430_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM43430) },
  27748. -- { BRCM_CC_4345_CHIP_ID, 0xFFFFFFC0, BRCMF_FIRMWARE_NVRAM(BCM43455) },
  27749. -- { BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4354) }
  27750. --};
  27751. --
  27752. --static int brcmf_sdio_get_fwnames(struct brcmf_chip *ci,
  27753. -- struct brcmf_sdio_dev *sdiodev)
  27754. --{
  27755. -- int i;
  27756. -- char end;
  27757. --
  27758. -- for (i = 0; i < ARRAY_SIZE(brcmf_fwname_data); i++) {
  27759. -- if (brcmf_fwname_data[i].chipid == ci->chip &&
  27760. -- brcmf_fwname_data[i].revmsk & BIT(ci->chiprev))
  27761. -- break;
  27762. -- }
  27763. --
  27764. -- if (i == ARRAY_SIZE(brcmf_fwname_data)) {
  27765. -- brcmf_err("Unknown chipid %d [%d]\n", ci->chip, ci->chiprev);
  27766. -- return -ENODEV;
  27767. -- }
  27768. --
  27769. -- /* check if firmware path is provided by module parameter */
  27770. -- if (brcmf_firmware_path[0] != '\0') {
  27771. -- strlcpy(sdiodev->fw_name, brcmf_firmware_path,
  27772. -- sizeof(sdiodev->fw_name));
  27773. -- strlcpy(sdiodev->nvram_name, brcmf_firmware_path,
  27774. -- sizeof(sdiodev->nvram_name));
  27775. --
  27776. -- end = brcmf_firmware_path[strlen(brcmf_firmware_path) - 1];
  27777. -- if (end != '/') {
  27778. -- strlcat(sdiodev->fw_name, "/",
  27779. -- sizeof(sdiodev->fw_name));
  27780. -- strlcat(sdiodev->nvram_name, "/",
  27781. -- sizeof(sdiodev->nvram_name));
  27782. -- }
  27783. -- }
  27784. -- strlcat(sdiodev->fw_name, brcmf_fwname_data[i].bin,
  27785. -- sizeof(sdiodev->fw_name));
  27786. -- strlcat(sdiodev->nvram_name, brcmf_fwname_data[i].nv,
  27787. -- sizeof(sdiodev->nvram_name));
  27788. --
  27789. -- return 0;
  27790. --}
  27791. --
  27792. - static void pkt_align(struct sk_buff *p, int len, int align)
  27793. - {
  27794. - uint datalign;
  27795. -@@ -4252,7 +4157,10 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
  27796. - brcmf_sdio_debugfs_create(bus);
  27797. - brcmf_dbg(INFO, "completed!!\n");
  27798. -
  27799. -- ret = brcmf_sdio_get_fwnames(bus->ci, sdiodev);
  27800. -+ ret = brcmf_fw_map_chip_to_name(bus->ci->chip, bus->ci->chiprev,
  27801. -+ brcmf_sdio_fwnames,
  27802. -+ ARRAY_SIZE(brcmf_sdio_fwnames),
  27803. -+ sdiodev->fw_name, sdiodev->nvram_name);
  27804. - if (ret)
  27805. - goto fail;
  27806. -
  27807. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.h
  27808. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.h
  27809. -@@ -195,8 +195,8 @@ struct brcmf_sdio_dev {
  27810. - uint max_segment_size;
  27811. - uint txglomsz;
  27812. - struct sg_table sgtable;
  27813. -- char fw_name[BRCMF_FW_PATH_LEN + BRCMF_FW_NAME_LEN];
  27814. -- char nvram_name[BRCMF_FW_PATH_LEN + BRCMF_FW_NAME_LEN];
  27815. -+ char fw_name[BRCMF_FW_NAME_LEN];
  27816. -+ char nvram_name[BRCMF_FW_NAME_LEN];
  27817. - bool wowl_enabled;
  27818. - enum brcmf_sdiod_state state;
  27819. - struct brcmf_sdiod_freezer *freezer;
  27820. ---- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  27821. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  27822. -@@ -43,10 +43,20 @@
  27823. - #define BRCMF_USB_CBCTL_READ 1
  27824. - #define BRCMF_USB_MAX_PKT_SIZE 1600
  27825. -
  27826. --#define BRCMF_USB_43143_FW_NAME "brcm/brcmfmac43143.bin"
  27827. --#define BRCMF_USB_43236_FW_NAME "brcm/brcmfmac43236b.bin"
  27828. --#define BRCMF_USB_43242_FW_NAME "brcm/brcmfmac43242a.bin"
  27829. --#define BRCMF_USB_43569_FW_NAME "brcm/brcmfmac43569.bin"
  27830. -+BRCMF_FW_DEF(43143, "brcmfmac43143.bin");
  27831. -+BRCMF_FW_DEF(43236B, "brcmfmac43236b.bin");
  27832. -+BRCMF_FW_DEF(43242A, "brcmfmac43242a.bin");
  27833. -+BRCMF_FW_DEF(43569, "brcmfmac43569.bin");
  27834. -+
  27835. -+static struct brcmf_firmware_mapping brcmf_usb_fwnames[] = {
  27836. -+ BRCMF_FW_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143),
  27837. -+ BRCMF_FW_ENTRY(BRCM_CC_43235_CHIP_ID, 0x00000008, 43236B),
  27838. -+ BRCMF_FW_ENTRY(BRCM_CC_43236_CHIP_ID, 0x00000008, 43236B),
  27839. -+ BRCMF_FW_ENTRY(BRCM_CC_43238_CHIP_ID, 0x00000008, 43236B),
  27840. -+ BRCMF_FW_ENTRY(BRCM_CC_43242_CHIP_ID, 0xFFFFFFFF, 43242A),
  27841. -+ BRCMF_FW_ENTRY(BRCM_CC_43566_CHIP_ID, 0xFFFFFFFF, 43569),
  27842. -+ BRCMF_FW_ENTRY(BRCM_CC_43569_CHIP_ID, 0xFFFFFFFF, 43569)
  27843. -+};
  27844. -
  27845. - #define TRX_MAGIC 0x30524448 /* "HDR0" */
  27846. - #define TRX_MAX_OFFSET 3 /* Max number of file offsets */
  27847. -@@ -139,6 +149,7 @@ struct brcmf_usbdev_info {
  27848. - struct brcmf_usbreq *tx_reqs;
  27849. - struct brcmf_usbreq *rx_reqs;
  27850. -
  27851. -+ char fw_name[BRCMF_FW_NAME_LEN];
  27852. - const u8 *image; /* buffer for combine fw and nvram */
  27853. - int image_len;
  27854. -
  27855. -@@ -983,45 +994,15 @@ static int brcmf_usb_dlrun(struct brcmf_
  27856. - return 0;
  27857. - }
  27858. -
  27859. --static bool brcmf_usb_chip_support(int chipid, int chiprev)
  27860. --{
  27861. -- switch(chipid) {
  27862. -- case BRCM_CC_43143_CHIP_ID:
  27863. -- return true;
  27864. -- case BRCM_CC_43235_CHIP_ID:
  27865. -- case BRCM_CC_43236_CHIP_ID:
  27866. -- case BRCM_CC_43238_CHIP_ID:
  27867. -- return (chiprev == 3);
  27868. -- case BRCM_CC_43242_CHIP_ID:
  27869. -- return true;
  27870. -- case BRCM_CC_43566_CHIP_ID:
  27871. -- case BRCM_CC_43569_CHIP_ID:
  27872. -- return true;
  27873. -- default:
  27874. -- break;
  27875. -- }
  27876. -- return false;
  27877. --}
  27878. --
  27879. - static int
  27880. - brcmf_usb_fw_download(struct brcmf_usbdev_info *devinfo)
  27881. - {
  27882. -- int devid, chiprev;
  27883. - int err;
  27884. -
  27885. - brcmf_dbg(USB, "Enter\n");
  27886. - if (devinfo == NULL)
  27887. - return -ENODEV;
  27888. -
  27889. -- devid = devinfo->bus_pub.devid;
  27890. -- chiprev = devinfo->bus_pub.chiprev;
  27891. --
  27892. -- if (!brcmf_usb_chip_support(devid, chiprev)) {
  27893. -- brcmf_err("unsupported chip %d rev %d\n",
  27894. -- devid, chiprev);
  27895. -- return -EINVAL;
  27896. -- }
  27897. --
  27898. - if (!devinfo->image) {
  27899. - brcmf_err("No firmware!\n");
  27900. - return -ENOENT;
  27901. -@@ -1071,25 +1052,6 @@ static int check_file(const u8 *headers)
  27902. - return -1;
  27903. - }
  27904. -
  27905. --static const char *brcmf_usb_get_fwname(struct brcmf_usbdev_info *devinfo)
  27906. --{
  27907. -- switch (devinfo->bus_pub.devid) {
  27908. -- case BRCM_CC_43143_CHIP_ID:
  27909. -- return BRCMF_USB_43143_FW_NAME;
  27910. -- case BRCM_CC_43235_CHIP_ID:
  27911. -- case BRCM_CC_43236_CHIP_ID:
  27912. -- case BRCM_CC_43238_CHIP_ID:
  27913. -- return BRCMF_USB_43236_FW_NAME;
  27914. -- case BRCM_CC_43242_CHIP_ID:
  27915. -- return BRCMF_USB_43242_FW_NAME;
  27916. -- case BRCM_CC_43566_CHIP_ID:
  27917. -- case BRCM_CC_43569_CHIP_ID:
  27918. -- return BRCMF_USB_43569_FW_NAME;
  27919. -- default:
  27920. -- return NULL;
  27921. -- }
  27922. --}
  27923. --
  27924. -
  27925. - static
  27926. - struct brcmf_usbdev *brcmf_usb_attach(struct brcmf_usbdev_info *devinfo,
  27927. -@@ -1274,9 +1236,16 @@ static int brcmf_usb_probe_cb(struct brc
  27928. - bus->chip = bus_pub->devid;
  27929. - bus->chiprev = bus_pub->chiprev;
  27930. -
  27931. -+ ret = brcmf_fw_map_chip_to_name(bus_pub->devid, bus_pub->chiprev,
  27932. -+ brcmf_usb_fwnames,
  27933. -+ ARRAY_SIZE(brcmf_usb_fwnames),
  27934. -+ devinfo->fw_name, NULL);
  27935. -+ if (ret)
  27936. -+ goto fail;
  27937. -+
  27938. - /* request firmware here */
  27939. -- ret = brcmf_fw_get_firmwares(dev, 0, brcmf_usb_get_fwname(devinfo),
  27940. -- NULL, brcmf_usb_probe_phase2);
  27941. -+ ret = brcmf_fw_get_firmwares(dev, 0, devinfo->fw_name, NULL,
  27942. -+ brcmf_usb_probe_phase2);
  27943. - if (ret) {
  27944. - brcmf_err("firmware request failed: %d\n", ret);
  27945. - goto fail;
  27946. -@@ -1472,8 +1441,7 @@ static int brcmf_usb_reset_resume(struct
  27947. -
  27948. - brcmf_dbg(USB, "Enter\n");
  27949. -
  27950. -- return brcmf_fw_get_firmwares(&usb->dev, 0,
  27951. -- brcmf_usb_get_fwname(devinfo), NULL,
  27952. -+ return brcmf_fw_get_firmwares(&usb->dev, 0, devinfo->fw_name, NULL,
  27953. - brcmf_usb_probe_phase2);
  27954. - }
  27955. -
  27956. -@@ -1491,10 +1459,6 @@ static struct usb_device_id brcmf_usb_de
  27957. - };
  27958. -
  27959. - MODULE_DEVICE_TABLE(usb, brcmf_usb_devid_table);
  27960. --MODULE_FIRMWARE(BRCMF_USB_43143_FW_NAME);
  27961. --MODULE_FIRMWARE(BRCMF_USB_43236_FW_NAME);
  27962. --MODULE_FIRMWARE(BRCMF_USB_43242_FW_NAME);
  27963. --MODULE_FIRMWARE(BRCMF_USB_43569_FW_NAME);
  27964. -
  27965. - static struct usb_driver brcmf_usbdrvr = {
  27966. - .name = KBUILD_MODNAME,
  27967. diff --git a/package/kernel/mac80211/patches/376-0010-brcmfmac-Fix-double-free-on-exception-at-module-load.patch b/package/kernel/mac80211/patches/376-0010-brcmfmac-Fix-double-free-on-exception-at-module-load.patch
  27968. deleted file mode 100644
  27969. index 2174d09..0000000
  27970. --- a/package/kernel/mac80211/patches/376-0010-brcmfmac-Fix-double-free-on-exception-at-module-load.patch
  27971. +++ /dev/null
  27972. @@ -1,22 +0,0 @@
  27973. -From: Hante Meuleman <meuleman@broadcom.com>
  27974. -Date: Wed, 25 Nov 2015 11:32:47 +0100
  27975. -Subject: [PATCH] brcmfmac: Fix double free on exception at module load.
  27976. -
  27977. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  27978. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  27979. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  27980. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  27981. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  27982. ----
  27983. -
  27984. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  27985. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  27986. -@@ -1083,6 +1083,8 @@ fail:
  27987. - brcmf_net_detach(ifp->ndev);
  27988. - if (p2p_ifp)
  27989. - brcmf_net_detach(p2p_ifp->ndev);
  27990. -+ drvr->iflist[0] = NULL;
  27991. -+ drvr->iflist[1] = NULL;
  27992. - return ret;
  27993. - }
  27994. - return 0;
  27995. diff --git a/package/kernel/mac80211/patches/377-brcmfmac-only-lock-and-unlock-fws-if-fws-is-not-null.patch b/package/kernel/mac80211/patches/377-brcmfmac-only-lock-and-unlock-fws-if-fws-is-not-null.patch
  27996. deleted file mode 100644
  27997. index 8ec1441..0000000
  27998. --- a/package/kernel/mac80211/patches/377-brcmfmac-only-lock-and-unlock-fws-if-fws-is-not-null.patch
  27999. +++ /dev/null
  28000. @@ -1,30 +0,0 @@
  28001. -From: Colin Ian King <colin.king@canonical.com>
  28002. -Date: Wed, 2 Dec 2015 11:45:10 +0000
  28003. -Subject: [PATCH] brcmfmac: only lock and unlock fws if fws is not null
  28004. -
  28005. -There is a null ptr check for fws to set bcmc_credit_check, however,
  28006. -there a lock and unlock on fws should only performed if fwts is
  28007. -also not null to also avoid a potential null pointer deference.
  28008. -
  28009. -Signed-off-by: Colin Ian King <colin.king@canonical.com>
  28010. -Acked-by: Arend van Spriel <arend@broadcom.com>
  28011. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  28012. ----
  28013. -
  28014. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  28015. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  28016. -@@ -1609,10 +1609,11 @@ static int brcmf_fws_notify_bcmc_credit_
  28017. - {
  28018. - struct brcmf_fws_info *fws = ifp->drvr->fws;
  28019. -
  28020. -- brcmf_fws_lock(fws);
  28021. -- if (fws)
  28022. -+ if (fws) {
  28023. -+ brcmf_fws_lock(fws);
  28024. - fws->bcmc_credit_check = true;
  28025. -- brcmf_fws_unlock(fws);
  28026. -+ brcmf_fws_unlock(fws);
  28027. -+ }
  28028. - return 0;
  28029. - }
  28030. -
  28031. diff --git a/package/kernel/mac80211/patches/400-ath_move_debug_code.patch b/package/kernel/mac80211/patches/400-ath_move_debug_code.patch
  28032. index 298f722..72e9a41 100644
  28033. --- a/package/kernel/mac80211/patches/400-ath_move_debug_code.patch
  28034. +++ b/package/kernel/mac80211/patches/400-ath_move_debug_code.patch
  28035. @@ -14,7 +14,7 @@
  28036. ccflags-y += -D__CHECK_ENDIAN__
  28037. --- a/drivers/net/wireless/ath/ath.h
  28038. +++ b/drivers/net/wireless/ath/ath.h
  28039. -@@ -316,13 +316,6 @@ void _ath_dbg(struct ath_common *common,
  28040. +@@ -318,13 +318,6 @@ void _ath_dbg(struct ath_common *common,
  28041. #endif /* CPTCFG_ATH_DEBUG */
  28042. /** Returns string describing opmode, or NULL if unknown mode. */
  28043. diff --git a/package/kernel/mac80211/patches/402-ath_regd_optional.patch b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  28044. index 2dac505..7351353 100644
  28045. --- a/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  28046. +++ b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  28047. @@ -47,9 +47,9 @@
  28048. --- a/drivers/net/wireless/ath/Kconfig
  28049. +++ b/drivers/net/wireless/ath/Kconfig
  28050. -@@ -22,6 +22,9 @@ menuconfig ATH_CARDS
  28051. +@@ -23,6 +23,9 @@ config WLAN_VENDOR_ATH
  28052. - if ATH_CARDS
  28053. + if WLAN_VENDOR_ATH
  28054. +config ATH_USER_REGD
  28055. + bool "Do not enforce EEPROM regulatory restrictions"
  28056. @@ -59,9 +59,9 @@
  28057. ---help---
  28058. --- a/.local-symbols
  28059. +++ b/.local-symbols
  28060. -@@ -89,6 +89,7 @@ RTL8187_LEDS=
  28061. +@@ -125,6 +125,7 @@ ADM8211=
  28062. ATH_COMMON=
  28063. - ATH_CARDS=
  28064. + WLAN_VENDOR_ATH=
  28065. ATH_DEBUG=
  28066. +ATH_USER_REGD=
  28067. ATH_TRACEPOINTS=
  28068. diff --git a/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch b/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch
  28069. index 1476953..1ef5545 100644
  28070. --- a/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch
  28071. +++ b/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch
  28072. @@ -1,6 +1,6 @@
  28073. --- a/net/wireless/reg.c
  28074. +++ b/net/wireless/reg.c
  28075. -@@ -2368,6 +2368,8 @@ void regulatory_hint_country_ie(struct w
  28076. +@@ -2411,6 +2411,8 @@ void regulatory_hint_country_ie(struct w
  28077. enum environment_cap env = ENVIRON_ANY;
  28078. struct regulatory_request *request = NULL, *lr;
  28079. @@ -9,11 +9,11 @@
  28080. /* IE len must be evenly divisible by 2 */
  28081. if (country_ie_len & 0x01)
  28082. return;
  28083. -@@ -2571,6 +2573,7 @@ static void restore_regulatory_settings(
  28084. +@@ -2617,6 +2619,7 @@ static void restore_regulatory_settings(
  28085. void regulatory_hint_disconnect(void)
  28086. {
  28087. + return;
  28088. - REG_DBG_PRINT("All devices are disconnected, going to restore regulatory settings\n");
  28089. + pr_debug("All devices are disconnected, going to restore regulatory settings\n");
  28090. restore_regulatory_settings(false);
  28091. }
  28092. 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
  28093. index 93760f9..1a62484 100644
  28094. --- a/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
  28095. +++ b/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
  28096. @@ -1,6 +1,6 @@
  28097. --- a/drivers/net/wireless/ath/ath9k/init.c
  28098. +++ b/drivers/net/wireless/ath/ath9k/init.c
  28099. -@@ -715,6 +715,7 @@ static const struct ieee80211_iface_limi
  28100. +@@ -722,6 +722,7 @@ static const struct ieee80211_iface_limi
  28101. BIT(NL80211_IFTYPE_AP) },
  28102. { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  28103. BIT(NL80211_IFTYPE_P2P_GO) },
  28104. diff --git a/package/kernel/mac80211/patches/440-ath5k_channel_bw_debugfs.patch b/package/kernel/mac80211/patches/440-ath5k_channel_bw_debugfs.patch
  28105. index aa521d2..924b62e 100644
  28106. --- a/package/kernel/mac80211/patches/440-ath5k_channel_bw_debugfs.patch
  28107. +++ b/package/kernel/mac80211/patches/440-ath5k_channel_bw_debugfs.patch
  28108. @@ -121,7 +121,7 @@ drivers/net/wireless/ath/ath5k/debug.c | 86 ++++++++++++++++++++++++++++++++
  28109. debugfs_create_file("antenna", S_IWUSR | S_IRUSR, phydir, ah,
  28110. --- a/drivers/net/wireless/ath/ath5k/ath5k.h
  28111. +++ b/drivers/net/wireless/ath/ath5k/ath5k.h
  28112. -@@ -1371,6 +1371,7 @@ struct ath5k_hw {
  28113. +@@ -1372,6 +1372,7 @@ struct ath5k_hw {
  28114. u8 ah_coverage_class;
  28115. bool ah_ack_bitrate_high;
  28116. u8 ah_bwmode;
  28117. diff --git a/package/kernel/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch b/package/kernel/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch
  28118. index ed2cfee..d2a3b96 100644
  28119. --- a/package/kernel/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch
  28120. +++ b/package/kernel/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch
  28121. @@ -1,6 +1,6 @@
  28122. --- a/drivers/net/wireless/ath/ath9k/hw.c
  28123. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  28124. -@@ -389,13 +389,8 @@ static void ath9k_hw_init_config(struct
  28125. +@@ -390,13 +390,8 @@ static void ath9k_hw_init_config(struct
  28126. ah->config.rx_intr_mitigation = true;
  28127. @@ -14,5 +14,5 @@
  28128. + ah->config.rimt_last = 250;
  28129. + ah->config.rimt_first = 500;
  28130. - /*
  28131. - * We need this for PCI devices only (Cardbus, PCI, miniPCI)
  28132. + if (AR_SREV_9462(ah) || AR_SREV_9565(ah))
  28133. + ah->config.pll_pwrsave = 7;
  28134. diff --git a/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch b/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  28135. index d4104f0..6766111 100644
  28136. --- a/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  28137. +++ b/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  28138. @@ -1,6 +1,6 @@
  28139. --- a/drivers/net/wireless/ath/ath9k/ath9k.h
  28140. +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  28141. -@@ -87,7 +87,7 @@ int ath_descdma_setup(struct ath_softc *
  28142. +@@ -88,7 +88,7 @@ int ath_descdma_setup(struct ath_softc *
  28143. (_l) &= ((_sz) - 1); \
  28144. } while (0)
  28145. diff --git a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  28146. index 40b5c81..c84d1bc 100644
  28147. --- a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  28148. +++ b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  28149. @@ -1,6 +1,6 @@
  28150. --- a/drivers/net/wireless/ath/ath9k/hw.c
  28151. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  28152. -@@ -647,6 +647,7 @@ int ath9k_hw_init(struct ath_hw *ah)
  28153. +@@ -651,6 +651,7 @@ int ath9k_hw_init(struct ath_hw *ah)
  28154. /* These are all the AR5008/AR9001/AR9002/AR9003 hardware family of chipsets */
  28155. switch (ah->hw_version.devid) {
  28156. diff --git a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  28157. index 0c50a0b..e151a12 100644
  28158. --- a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  28159. +++ b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  28160. @@ -1,6 +1,6 @@
  28161. --- a/include/net/cfg80211.h
  28162. +++ b/include/net/cfg80211.h
  28163. -@@ -2320,6 +2320,7 @@ struct cfg80211_qos_map {
  28164. +@@ -2363,6 +2363,7 @@ struct cfg80211_qos_map {
  28165. * (as advertised by the nl80211 feature flag.)
  28166. * @get_tx_power: store the current TX power into the dbm variable;
  28167. * return 0 if successful
  28168. @@ -8,7 +8,7 @@
  28169. *
  28170. * @set_wds_peer: set the WDS peer for a WDS interface
  28171. *
  28172. -@@ -2576,6 +2577,7 @@ struct cfg80211_ops {
  28173. +@@ -2624,6 +2625,7 @@ struct cfg80211_ops {
  28174. enum nl80211_tx_power_setting type, int mbm);
  28175. int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
  28176. int *dbm);
  28177. @@ -18,7 +18,7 @@
  28178. const u8 *addr);
  28179. --- a/include/net/mac80211.h
  28180. +++ b/include/net/mac80211.h
  28181. -@@ -1171,6 +1171,7 @@ enum ieee80211_smps_mode {
  28182. +@@ -1286,6 +1286,7 @@ enum ieee80211_smps_mode {
  28183. *
  28184. * @power_level: requested transmit power (in dBm), backward compatibility
  28185. * value only that is set to the minimum of all interfaces
  28186. @@ -26,19 +26,19 @@
  28187. *
  28188. * @chandef: the channel definition to tune to
  28189. * @radar_enabled: whether radar detection is enabled
  28190. -@@ -1192,6 +1193,7 @@ struct ieee80211_conf {
  28191. +@@ -1306,6 +1307,7 @@ enum ieee80211_smps_mode {
  28192. + struct ieee80211_conf {
  28193. u32 flags;
  28194. int power_level, dynamic_ps_timeout;
  28195. - int max_sleep_period;
  28196. + int max_antenna_gain;
  28197. u16 listen_interval;
  28198. u8 ps_dtim_period;
  28199. --- a/include/uapi/linux/nl80211.h
  28200. +++ b/include/uapi/linux/nl80211.h
  28201. -@@ -1760,6 +1760,9 @@ enum nl80211_commands {
  28202. - * @NL80211_ATTR_REG_INDOOR: flag attribute, if set indicates that the device
  28203. - * is operating in an indoor environment.
  28204. +@@ -1790,6 +1790,9 @@ enum nl80211_commands {
  28205. + * between scans. The scan plans are executed sequentially.
  28206. + * Each scan plan is a nested attribute of &enum nl80211_sched_scan_plan.
  28207. *
  28208. + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
  28209. + * transmit power to stay within regulatory limits. u32, dBi.
  28210. @@ -46,9 +46,9 @@
  28211. * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  28212. * @NL80211_ATTR_MAX: highest attribute number currently defined
  28213. * @__NL80211_ATTR_AFTER_LAST: internal use
  28214. -@@ -2129,6 +2132,8 @@ enum nl80211_attrs {
  28215. -
  28216. - NL80211_ATTR_REG_INDOOR,
  28217. +@@ -2164,6 +2167,8 @@ enum nl80211_attrs {
  28218. + NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS,
  28219. + NL80211_ATTR_SCHED_SCAN_PLANS,
  28220. + NL80211_ATTR_WIPHY_ANTENNA_GAIN,
  28221. +
  28222. @@ -57,7 +57,7 @@
  28223. __NL80211_ATTR_AFTER_LAST,
  28224. --- a/net/mac80211/cfg.c
  28225. +++ b/net/mac80211/cfg.c
  28226. -@@ -2208,6 +2208,19 @@ static int ieee80211_get_tx_power(struct
  28227. +@@ -2229,6 +2229,19 @@ static int ieee80211_get_tx_power(struct
  28228. return 0;
  28229. }
  28230. @@ -77,7 +77,7 @@
  28231. static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev,
  28232. const u8 *addr)
  28233. {
  28234. -@@ -3771,6 +3784,7 @@ const struct cfg80211_ops mac80211_confi
  28235. +@@ -3403,6 +3416,7 @@ const struct cfg80211_ops mac80211_confi
  28236. .set_wiphy_params = ieee80211_set_wiphy_params,
  28237. .set_tx_power = ieee80211_set_tx_power,
  28238. .get_tx_power = ieee80211_get_tx_power,
  28239. @@ -87,7 +87,7 @@
  28240. CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd)
  28241. --- a/net/mac80211/ieee80211_i.h
  28242. +++ b/net/mac80211/ieee80211_i.h
  28243. -@@ -1333,6 +1333,7 @@ struct ieee80211_local {
  28244. +@@ -1318,6 +1318,7 @@ struct ieee80211_local {
  28245. int dynamic_ps_forced_timeout;
  28246. int user_power_level; /* in dBm, for all interfaces */
  28247. @@ -97,7 +97,7 @@
  28248. --- a/net/mac80211/main.c
  28249. +++ b/net/mac80211/main.c
  28250. -@@ -98,7 +98,7 @@ static u32 ieee80211_hw_conf_chan(struct
  28251. +@@ -93,7 +93,7 @@ static u32 ieee80211_hw_conf_chan(struct
  28252. struct ieee80211_sub_if_data *sdata;
  28253. struct cfg80211_chan_def chandef = {};
  28254. u32 changed = 0;
  28255. @@ -106,7 +106,7 @@
  28256. u32 offchannel_flag;
  28257. offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
  28258. -@@ -155,6 +155,12 @@ static u32 ieee80211_hw_conf_chan(struct
  28259. +@@ -150,6 +150,12 @@ static u32 ieee80211_hw_conf_chan(struct
  28260. }
  28261. rcu_read_unlock();
  28262. @@ -119,7 +119,7 @@
  28263. if (local->hw.conf.power_level != power) {
  28264. changed |= IEEE80211_CONF_CHANGE_POWER;
  28265. local->hw.conf.power_level = power;
  28266. -@@ -578,6 +584,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
  28267. +@@ -586,6 +592,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
  28268. IEEE80211_RADIOTAP_MCS_HAVE_BW;
  28269. local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI |
  28270. IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH;
  28271. @@ -129,7 +129,7 @@
  28272. local->user_power_level = IEEE80211_UNSET_POWER_LEVEL;
  28273. --- a/net/wireless/nl80211.c
  28274. +++ b/net/wireless/nl80211.c
  28275. -@@ -400,6 +400,7 @@ static const struct nla_policy nl80211_p
  28276. +@@ -403,6 +403,7 @@ static const struct nla_policy nl80211_p
  28277. [NL80211_ATTR_NETNS_FD] = { .type = NLA_U32 },
  28278. [NL80211_ATTR_SCHED_SCAN_DELAY] = { .type = NLA_U32 },
  28279. [NL80211_ATTR_REG_INDOOR] = { .type = NLA_FLAG },
  28280. @@ -137,7 +137,7 @@
  28281. };
  28282. /* policy for the key attributes */
  28283. -@@ -2206,6 +2207,20 @@ static int nl80211_set_wiphy(struct sk_b
  28284. +@@ -2220,6 +2221,20 @@ static int nl80211_set_wiphy(struct sk_b
  28285. if (result)
  28286. return result;
  28287. }
  28288. diff --git a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  28289. index 7512811..5a5e464 100644
  28290. --- a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  28291. +++ b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  28292. @@ -24,7 +24,7 @@
  28293. struct ath_softc {
  28294. struct ieee80211_hw *hw;
  28295. struct device *dev;
  28296. -@@ -1004,9 +1014,8 @@ struct ath_softc {
  28297. +@@ -1005,9 +1015,8 @@ struct ath_softc {
  28298. spinlock_t chan_lock;
  28299. #ifdef CPTCFG_MAC80211_LEDS
  28300. @@ -54,7 +54,8 @@
  28301. + (brightness != LED_OFF) ^ led->gpio->active_low);
  28302. + ath9k_ps_restore(sc);
  28303. +}
  28304. -+
  28305. +
  28306. +- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val);
  28307. +static int ath_add_led(struct ath_softc *sc, struct ath_led *led)
  28308. +{
  28309. + const struct gpio_led *gpio = led->gpio;
  28310. @@ -63,8 +64,7 @@
  28311. + led->cdev.name = gpio->name;
  28312. + led->cdev.default_trigger = gpio->default_trigger;
  28313. + led->cdev.brightness_set = ath_led_brightness;
  28314. -
  28315. -- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val);
  28316. ++
  28317. + ret = led_classdev_register(wiphy_dev(sc->hw->wiphy), &led->cdev);
  28318. + if (ret < 0)
  28319. + return ret;
  28320. @@ -159,7 +159,7 @@
  28321. + trigger = ieee80211_get_radio_led_name(sc->hw);
  28322. - sc->led_registered = true;
  28323. -+ ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, 1);
  28324. ++ ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, !sc->sc_ah->config.led_active_high);
  28325. }
  28326. void ath_fill_led_pin(struct ath_softc *sc)
  28327. diff --git a/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch b/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
  28328. index dc33cd0..7c10ea6 100644
  28329. --- a/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
  28330. +++ b/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
  28331. @@ -59,7 +59,7 @@
  28332. @@ -120,6 +141,12 @@ void ath_init_leds(struct ath_softc *sc)
  28333. trigger = ieee80211_get_radio_led_name(sc->hw);
  28334. - ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, 1);
  28335. + ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, !sc->sc_ah->config.led_active_high);
  28336. +
  28337. + if (!pdata)
  28338. + return;
  28339. diff --git a/package/kernel/mac80211/patches/532-ath9k_get_led_polarity_from_platform_data.patch b/package/kernel/mac80211/patches/532-ath9k_get_led_polarity_from_platform_data.patch
  28340. new file mode 100644
  28341. index 0000000..6d62a2b
  28342. --- /dev/null
  28343. +++ b/package/kernel/mac80211/patches/532-ath9k_get_led_polarity_from_platform_data.patch
  28344. @@ -0,0 +1,20 @@
  28345. +--- a/include/linux/ath9k_platform.h
  28346. ++++ b/include/linux/ath9k_platform.h
  28347. +@@ -36,6 +36,7 @@ struct ath9k_platform_data {
  28348. + bool tx_gain_buffalo;
  28349. + bool disable_2ghz;
  28350. + bool disable_5ghz;
  28351. ++ bool led_active_high;
  28352. +
  28353. + int (*get_mac_revision)(void);
  28354. + int (*external_reset)(void);
  28355. +--- a/drivers/net/wireless/ath/ath9k/init.c
  28356. ++++ b/drivers/net/wireless/ath/ath9k/init.c
  28357. +@@ -577,6 +577,7 @@ static int ath9k_init_softc(u16 devid, s
  28358. + ah->external_reset = pdata->external_reset;
  28359. + ah->disable_2ghz = pdata->disable_2ghz;
  28360. + ah->disable_5ghz = pdata->disable_5ghz;
  28361. ++ ah->config.led_active_high = pdata->led_active_high;
  28362. + if (!pdata->endian_check)
  28363. + ah->ah_flags |= AH_NO_EEP_SWAP;
  28364. + }
  28365. diff --git a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  28366. index 08c5a0f..e83c6bf 100644
  28367. --- a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  28368. +++ b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  28369. @@ -62,7 +62,7 @@
  28370. debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy,
  28371. --- a/drivers/net/wireless/ath/ath9k/hw.h
  28372. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  28373. -@@ -513,6 +513,12 @@ enum {
  28374. +@@ -519,6 +519,12 @@ enum {
  28375. ATH9K_RESET_COLD,
  28376. };
  28377. @@ -75,7 +75,7 @@
  28378. struct ath9k_hw_version {
  28379. u32 magic;
  28380. u16 devid;
  28381. -@@ -794,6 +800,8 @@ struct ath_hw {
  28382. +@@ -804,6 +810,8 @@ struct ath_hw {
  28383. u32 rfkill_polarity;
  28384. u32 ah_flags;
  28385. @@ -84,7 +84,7 @@
  28386. bool reset_power_on;
  28387. bool htc_reset_init;
  28388. -@@ -1055,6 +1063,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
  28389. +@@ -1066,6 +1074,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
  28390. bool ath9k_hw_check_alive(struct ath_hw *ah);
  28391. bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode);
  28392. @@ -94,7 +94,7 @@
  28393. struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah,
  28394. --- a/drivers/net/wireless/ath/ath9k/hw.c
  28395. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  28396. -@@ -1804,6 +1804,20 @@ u32 ath9k_hw_get_tsf_offset(struct times
  28397. +@@ -1819,6 +1819,20 @@ u32 ath9k_hw_get_tsf_offset(struct times
  28398. }
  28399. EXPORT_SYMBOL(ath9k_hw_get_tsf_offset);
  28400. @@ -115,7 +115,7 @@
  28401. int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
  28402. struct ath9k_hw_cal_data *caldata, bool fastcc)
  28403. {
  28404. -@@ -2012,6 +2026,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  28405. +@@ -2027,6 +2041,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  28406. ar9003_hw_disable_phy_restart(ah);
  28407. ath9k_hw_apply_gpio_override(ah);
  28408. diff --git a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  28409. index 8c9b34c..d7bb5a1 100644
  28410. --- a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  28411. +++ b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  28412. @@ -1,6 +1,6 @@
  28413. --- a/drivers/net/wireless/ath/ath9k/hw.h
  28414. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  28415. -@@ -710,6 +710,7 @@ struct ath_spec_scan {
  28416. +@@ -720,6 +720,7 @@ struct ath_spec_scan {
  28417. * @config_pci_powersave:
  28418. * @calibrate: periodic calibration for NF, ANI, IQ, ADC gain, ADC-DC
  28419. *
  28420. @@ -8,7 +8,7 @@
  28421. * @spectral_scan_config: set parameters for spectral scan and enable/disable it
  28422. * @spectral_scan_trigger: trigger a spectral scan run
  28423. * @spectral_scan_wait: wait for a spectral scan run to finish
  28424. -@@ -732,6 +733,7 @@ struct ath_hw_ops {
  28425. +@@ -742,6 +743,7 @@ struct ath_hw_ops {
  28426. struct ath_hw_antcomb_conf *antconf);
  28427. void (*antdiv_comb_conf_set)(struct ath_hw *ah,
  28428. struct ath_hw_antcomb_conf *antconf);
  28429. @@ -18,7 +18,7 @@
  28430. void (*spectral_scan_trigger)(struct ath_hw *ah);
  28431. --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  28432. +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  28433. -@@ -1999,6 +1999,26 @@ void ar9003_hw_init_rate_txpower(struct
  28434. +@@ -1998,6 +1998,26 @@ void ar9003_hw_init_rate_txpower(struct
  28435. }
  28436. }
  28437. @@ -45,7 +45,7 @@
  28438. void ar9003_hw_attach_phy_ops(struct ath_hw *ah)
  28439. {
  28440. struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
  28441. -@@ -2035,6 +2055,7 @@ void ar9003_hw_attach_phy_ops(struct ath
  28442. +@@ -2034,6 +2054,7 @@ void ar9003_hw_attach_phy_ops(struct ath
  28443. priv_ops->set_radar_params = ar9003_hw_set_radar_params;
  28444. priv_ops->fast_chan_change = ar9003_hw_fast_chan_change;
  28445. @@ -55,7 +55,7 @@
  28446. ops->spectral_scan_config = ar9003_hw_spectral_scan_config;
  28447. --- a/drivers/net/wireless/ath/ath9k/init.c
  28448. +++ b/drivers/net/wireless/ath/ath9k/init.c
  28449. -@@ -703,7 +703,8 @@ static void ath9k_init_txpower_limits(st
  28450. +@@ -711,7 +711,8 @@ static void ath9k_init_txpower_limits(st
  28451. if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
  28452. ath9k_init_band_txpower(sc, IEEE80211_BAND_5GHZ);
  28453. @@ -65,7 +65,7 @@
  28454. }
  28455. static const struct ieee80211_iface_limit if_limits[] = {
  28456. -@@ -896,6 +897,18 @@ static void ath9k_set_hw_capab(struct at
  28457. +@@ -897,6 +898,18 @@ static void ath9k_set_hw_capab(struct at
  28458. SET_IEEE80211_PERM_ADDR(hw, common->macaddr);
  28459. }
  28460. @@ -84,7 +84,7 @@
  28461. int ath9k_init_device(u16 devid, struct ath_softc *sc,
  28462. const struct ath_bus_ops *bus_ops)
  28463. {
  28464. -@@ -941,6 +954,8 @@ int ath9k_init_device(u16 devid, struct
  28465. +@@ -942,6 +955,8 @@ int ath9k_init_device(u16 devid, struct
  28466. ARRAY_SIZE(ath9k_tpt_blink));
  28467. #endif
  28468. @@ -110,7 +110,7 @@
  28469. static inline void ath9k_hw_set_bt_ant_diversity(struct ath_hw *ah, bool enable)
  28470. --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  28471. +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  28472. -@@ -1316,9 +1316,30 @@ void ar5008_hw_init_rate_txpower(struct
  28473. +@@ -1327,9 +1327,30 @@ void ar5008_hw_init_rate_txpower(struct
  28474. }
  28475. }
  28476. @@ -141,7 +141,7 @@
  28477. static const u32 ar5416_cca_regs[6] = {
  28478. AR_PHY_CCA,
  28479. AR_PHY_CH1_CCA,
  28480. -@@ -1333,6 +1354,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
  28481. +@@ -1344,6 +1365,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
  28482. if (ret)
  28483. return ret;
  28484. 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
  28485. index 240b898..8768c5d 100644
  28486. --- a/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch
  28487. +++ b/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch
  28488. @@ -1,6 +1,6 @@
  28489. --- a/drivers/net/wireless/ath/ath9k/hw.c
  28490. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  28491. -@@ -245,6 +245,19 @@ void ath9k_hw_get_channel_centers(struct
  28492. +@@ -246,6 +246,19 @@ void ath9k_hw_get_channel_centers(struct
  28493. centers->synth_center + (extoff * HT40_CHANNEL_CENTER_SHIFT);
  28494. }
  28495. @@ -20,7 +20,7 @@
  28496. /******************/
  28497. /* Chip Revisions */
  28498. /******************/
  28499. -@@ -1382,6 +1395,9 @@ static bool ath9k_hw_set_reset(struct at
  28500. +@@ -1397,6 +1410,9 @@ static bool ath9k_hw_set_reset(struct at
  28501. if (AR_SREV_9100(ah))
  28502. udelay(50);
  28503. @@ -30,7 +30,7 @@
  28504. return true;
  28505. }
  28506. -@@ -1481,6 +1497,9 @@ static bool ath9k_hw_chip_reset(struct a
  28507. +@@ -1496,6 +1512,9 @@ static bool ath9k_hw_chip_reset(struct a
  28508. ar9003_hw_internal_regulator_apply(ah);
  28509. ath9k_hw_init_pll(ah, chan);
  28510. @@ -40,7 +40,7 @@
  28511. return true;
  28512. }
  28513. -@@ -1782,8 +1801,14 @@ static int ath9k_hw_do_fastcc(struct ath
  28514. +@@ -1797,8 +1816,14 @@ static int ath9k_hw_do_fastcc(struct ath
  28515. if (AR_SREV_9271(ah))
  28516. ar9002_hw_load_ani_reg(ah, chan);
  28517. @@ -55,7 +55,7 @@
  28518. return -EINVAL;
  28519. }
  28520. -@@ -2037,6 +2062,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  28521. +@@ -2052,6 +2077,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  28522. ath9k_hw_set_radar_params(ah);
  28523. }
  28524. diff --git a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  28525. index 9610372..3d24ccd 100644
  28526. --- a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  28527. +++ b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  28528. @@ -1,6 +1,6 @@
  28529. --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  28530. +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  28531. -@@ -945,55 +945,6 @@ static bool ar5008_hw_ani_control_new(st
  28532. +@@ -956,55 +956,6 @@ static bool ar5008_hw_ani_control_new(st
  28533. * on == 0 means more noise imm
  28534. */
  28535. u32 on = param ? 1 : 0;
  28536. @@ -79,7 +79,7 @@
  28537. static const u8 ofdm2pwr[] = {
  28538. ALL_TARGET_LEGACY_6_24,
  28539. ALL_TARGET_LEGACY_6_24,
  28540. -@@ -1090,11 +1076,6 @@ static bool ar9003_hw_ani_control(struct
  28541. +@@ -1089,11 +1075,6 @@ static bool ar9003_hw_ani_control(struct
  28542. struct ath_common *common = ath9k_hw_common(ah);
  28543. struct ath9k_channel *chan = ah->curchan;
  28544. struct ar5416AniState *aniState = &ah->ani;
  28545. @@ -91,7 +91,7 @@
  28546. s32 value, value2;
  28547. switch (cmd & ah->ani_function) {
  28548. -@@ -1108,61 +1089,6 @@ static bool ar9003_hw_ani_control(struct
  28549. +@@ -1107,61 +1088,6 @@ static bool ar9003_hw_ani_control(struct
  28550. */
  28551. u32 on = param ? 1 : 0;
  28552. 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
  28553. index c0dc4fe..bd81555 100644
  28554. --- a/package/kernel/mac80211/patches/600-0001-rt2x00-rt2800lib-move-rt2800_drv_data-declaration-in.patch
  28555. +++ b/package/kernel/mac80211/patches/600-0001-rt2x00-rt2800lib-move-rt2800_drv_data-declaration-in.patch
  28556. @@ -16,36 +16,18 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28557. ---
  28558. Changes since v1: ---
  28559. ---
  28560. - drivers/net/wireless/rt2x00/rt2800.h | 13 -------------
  28561. - drivers/net/wireless/rt2x00/rt2800lib.h | 11 +++++++++++
  28562. + drivers/net/wireless/ralink/rt2x00/rt2800.h | 13 -------------
  28563. + drivers/net/wireless/ralink/rt2x00/rt2800lib.h | 11 +++++++++++
  28564. 2 files changed, 11 insertions(+), 13 deletions(-)
  28565. ---- a/drivers/net/wireless/rt2x00/rt2800.h
  28566. -+++ b/drivers/net/wireless/rt2x00/rt2800.h
  28567. -@@ -2960,17 +2960,4 @@ enum rt2800_eeprom_word {
  28568. - */
  28569. - #define BCN_TBTT_OFFSET 64
  28570. -
  28571. --/*
  28572. -- * RT2800 driver data structure
  28573. -- */
  28574. --struct rt2800_drv_data {
  28575. -- u8 calibration_bw20;
  28576. -- u8 calibration_bw40;
  28577. -- u8 bbp25;
  28578. -- u8 bbp26;
  28579. -- u8 txmixer_gain_24g;
  28580. -- u8 txmixer_gain_5g;
  28581. -- unsigned int tbtt_tick;
  28582. --};
  28583. --
  28584. - #endif /* RT2800_H */
  28585. ---- a/drivers/net/wireless/rt2x00/rt2800lib.h
  28586. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.h
  28587. -@@ -20,6 +20,17 @@
  28588. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
  28589. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
  28590. +@@ -20,6 +20,20 @@
  28591. #ifndef RT2800LIB_H
  28592. #define RT2800LIB_H
  28593. ++#include "rt2800.h"
  28594. ++
  28595. +/* RT2800 driver data structure */
  28596. +struct rt2800_drv_data {
  28597. + u8 calibration_bw20;
  28598. @@ -55,8 +37,30 @@ Changes since v1: ---
  28599. + u8 txmixer_gain_24g;
  28600. + u8 txmixer_gain_5g;
  28601. + unsigned int tbtt_tick;
  28602. ++ DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  28603. +};
  28604. +
  28605. struct rt2800_ops {
  28606. void (*register_read)(struct rt2x00_dev *rt2x00dev,
  28607. const unsigned int offset, u32 *value);
  28608. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
  28609. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
  28610. +@@ -2969,18 +2969,4 @@ enum rt2800_eeprom_word {
  28611. + #define WCID_END 222
  28612. + #define STA_IDS_SIZE (WCID_END - WCID_START + 2)
  28613. +
  28614. +-/*
  28615. +- * RT2800 driver data structure
  28616. +- */
  28617. +-struct rt2800_drv_data {
  28618. +- u8 calibration_bw20;
  28619. +- u8 calibration_bw40;
  28620. +- u8 bbp25;
  28621. +- u8 bbp26;
  28622. +- u8 txmixer_gain_24g;
  28623. +- u8 txmixer_gain_5g;
  28624. +- unsigned int tbtt_tick;
  28625. +- DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  28626. +-};
  28627. +-
  28628. + #endif /* RT2800_H */
  28629. 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
  28630. index 6bad6ac..8245909 100644
  28631. --- a/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch
  28632. +++ b/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch
  28633. @@ -18,13 +18,13 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28634. Changes since v1:
  28635. - don't enable the new flag for RT3071 and RT5592
  28636. ---
  28637. - drivers/net/wireless/rt2x00/rt2800lib.c | 4 ++++
  28638. - drivers/net/wireless/rt2x00/rt2800lib.h | 13 +++++++++++++
  28639. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 4 ++++
  28640. + drivers/net/wireless/ralink/rt2x00/rt2800lib.h | 13 +++++++++++++
  28641. 2 files changed, 17 insertions(+)
  28642. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28643. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28644. -@@ -7747,6 +7747,7 @@ static int rt2800_probe_rt(struct rt2x00
  28645. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  28646. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  28647. +@@ -7722,6 +7722,7 @@ static int rt2800_probe_rt(struct rt2x00
  28648. int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
  28649. {
  28650. @@ -32,7 +32,7 @@ Changes since v1:
  28651. int retval;
  28652. u32 reg;
  28653. -@@ -7754,6 +7755,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  28654. +@@ -7729,6 +7730,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  28655. if (retval)
  28656. return retval;
  28657. @@ -42,11 +42,11 @@ Changes since v1:
  28658. /*
  28659. * Allocate eeprom data.
  28660. */
  28661. ---- a/drivers/net/wireless/rt2x00/rt2800lib.h
  28662. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.h
  28663. -@@ -20,6 +20,10 @@
  28664. - #ifndef RT2800LIB_H
  28665. - #define RT2800LIB_H
  28666. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
  28667. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
  28668. +@@ -22,6 +22,10 @@
  28669. +
  28670. + #include "rt2800.h"
  28671. +enum rt2800_flag {
  28672. + RT2800_HAS_HIGH_SHARED_MEM,
  28673. @@ -55,16 +55,16 @@ Changes since v1:
  28674. /* RT2800 driver data structure */
  28675. struct rt2800_drv_data {
  28676. u8 calibration_bw20;
  28677. -@@ -29,6 +33,8 @@ struct rt2800_drv_data {
  28678. - u8 txmixer_gain_24g;
  28679. +@@ -32,6 +36,8 @@ struct rt2800_drv_data {
  28680. u8 txmixer_gain_5g;
  28681. unsigned int tbtt_tick;
  28682. + DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  28683. +
  28684. + unsigned long rt2800_flags;
  28685. };
  28686. struct rt2800_ops {
  28687. -@@ -61,6 +67,13 @@ struct rt2800_ops {
  28688. +@@ -64,6 +70,13 @@ struct rt2800_ops {
  28689. __le32 *(*drv_get_txwi)(struct queue_entry *entry);
  28690. };
  28691. 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
  28692. index 9f8dfcc..7abfcd1 100644
  28693. --- a/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch
  28694. +++ b/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch
  28695. @@ -17,17 +17,17 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28696. ---
  28697. Changes since v1: ---
  28698. ---
  28699. - drivers/net/wireless/rt2x00/rt2800lib.c | 55 +++++++++++++++++++++++++++++-
  28700. - drivers/net/wireless/rt2x00/rt2800lib.h | 32 +++++++++++++++++
  28701. - drivers/net/wireless/rt2x00/rt2800mmio.c | 26 ++++++++++++++
  28702. - drivers/net/wireless/rt2x00/rt2800mmio.h | 4 +++
  28703. - drivers/net/wireless/rt2x00/rt2800pci.c | 14 ++++++++
  28704. - drivers/net/wireless/rt2x00/rt2800soc.c | 3 ++
  28705. - drivers/net/wireless/rt2x00/rt2800usb.c | 31 +++++++++++++++++
  28706. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 55 +++++++++++++++++++++++++++++-
  28707. + drivers/net/wireless/ralink/rt2x00/rt2800lib.h | 32 +++++++++++++++++
  28708. + drivers/net/wireless/ralink/rt2x00/rt2800mmio.c | 26 ++++++++++++++
  28709. + drivers/net/wireless/ralink/rt2x00/rt2800mmio.h | 4 +++
  28710. + drivers/net/wireless/ralink/rt2x00/rt2800pci.c | 14 ++++++++
  28711. + drivers/net/wireless/ralink/rt2x00/rt2800soc.c | 3 ++
  28712. + drivers/net/wireless/ralink/rt2x00/rt2800usb.c | 31 +++++++++++++++++
  28713. 7 files changed, 164 insertions(+), 1 deletion(-)
  28714. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28715. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28716. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  28717. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  28718. @@ -451,11 +451,13 @@ void rt2800_mcu_request(struct rt2x00_de
  28719. rt2x00_set_field32(&reg, H2M_MAILBOX_CSR_CMD_TOKEN, token);
  28720. rt2x00_set_field32(&reg, H2M_MAILBOX_CSR_ARG0, arg0);
  28721. @@ -175,7 +175,7 @@ Changes since v1: ---
  28722. /*
  28723. * Update WCID information
  28724. -@@ -1437,8 +1467,11 @@ int rt2800_config_pairwise_key(struct rt
  28725. +@@ -1405,8 +1435,11 @@ int rt2800_config_pairwise_key(struct rt
  28726. sizeof(key_entry.rx_mic));
  28727. offset = PAIRWISE_KEY_ENTRY(key->hw_key_idx);
  28728. @@ -187,7 +187,7 @@ Changes since v1: ---
  28729. }
  28730. /*
  28731. -@@ -4908,14 +4941,19 @@ static int rt2800_init_registers(struct
  28732. +@@ -4885,14 +4918,19 @@ static int rt2800_init_registers(struct
  28733. /*
  28734. * ASIC will keep garbage value after boot, clear encryption keys.
  28735. */
  28736. @@ -207,7 +207,7 @@ Changes since v1: ---
  28737. }
  28738. /*
  28739. -@@ -5041,8 +5079,10 @@ static int rt2800_wait_bbp_ready(struct
  28740. +@@ -5018,8 +5056,10 @@ static int rt2800_wait_bbp_ready(struct
  28741. * BBP was enabled after firmware was loaded,
  28742. * but we need to reactivate it now.
  28743. */
  28744. @@ -218,7 +218,7 @@ Changes since v1: ---
  28745. msleep(1);
  28746. for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
  28747. -@@ -6738,11 +6778,19 @@ int rt2800_enable_radio(struct rt2x00_de
  28748. +@@ -6715,11 +6755,19 @@ int rt2800_enable_radio(struct rt2x00_de
  28749. /*
  28750. * Send signal during boot time to initialize firmware.
  28751. */
  28752. @@ -239,7 +239,7 @@ Changes since v1: ---
  28753. msleep(1);
  28754. /*
  28755. -@@ -7751,6 +7799,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  28756. +@@ -7726,6 +7774,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  28757. int retval;
  28758. u32 reg;
  28759. @@ -248,22 +248,22 @@ Changes since v1: ---
  28760. retval = rt2800_probe_rt(rt2x00dev);
  28761. if (retval)
  28762. return retval;
  28763. -@@ -7830,8 +7880,11 @@ void rt2800_get_tkip_seq(struct ieee8021
  28764. - u32 offset;
  28765. +@@ -7809,8 +7859,11 @@ void rt2800_get_key_seq(struct ieee80211
  28766. + return;
  28767. - offset = MAC_IVEIV_ENTRY(hw_key_idx);
  28768. + offset = MAC_IVEIV_ENTRY(key->hw_key_idx);
  28769. +
  28770. + rt2800_shared_mem_lock(rt2x00dev);
  28771. rt2800_register_multiread(rt2x00dev, offset,
  28772. &iveiv_entry, sizeof(iveiv_entry));
  28773. + rt2800_shared_mem_unlock(rt2x00dev);
  28774. - memcpy(iv16, &iveiv_entry.iv[0], sizeof(*iv16));
  28775. - memcpy(iv32, &iveiv_entry.iv[4], sizeof(*iv32));
  28776. ---- a/drivers/net/wireless/rt2x00/rt2800lib.h
  28777. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.h
  28778. -@@ -35,6 +35,11 @@ struct rt2800_drv_data {
  28779. - unsigned int tbtt_tick;
  28780. + memcpy(&seq->tkip.iv16, &iveiv_entry.iv[0], 2);
  28781. + memcpy(&seq->tkip.iv32, &iveiv_entry.iv[4], 4);
  28782. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
  28783. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
  28784. +@@ -38,6 +38,11 @@ struct rt2800_drv_data {
  28785. + DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  28786. unsigned long rt2800_flags;
  28787. +
  28788. @@ -274,7 +274,7 @@ Changes since v1: ---
  28789. };
  28790. struct rt2800_ops {
  28791. -@@ -65,6 +70,10 @@ struct rt2800_ops {
  28792. +@@ -68,6 +73,10 @@ struct rt2800_ops {
  28793. const u8 *data, const size_t len);
  28794. int (*drv_init_registers)(struct rt2x00_dev *rt2x00dev);
  28795. __le32 *(*drv_get_txwi)(struct queue_entry *entry);
  28796. @@ -285,7 +285,7 @@ Changes since v1: ---
  28797. };
  28798. static inline bool rt2800_has_high_shared_mem(struct rt2x00_dev *rt2x00dev)
  28799. -@@ -74,6 +83,29 @@ static inline bool rt2800_has_high_share
  28800. +@@ -77,6 +86,29 @@ static inline bool rt2800_has_high_share
  28801. return test_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  28802. }
  28803. @@ -315,8 +315,8 @@ Changes since v1: ---
  28804. static inline void rt2800_register_read(struct rt2x00_dev *rt2x00dev,
  28805. const unsigned int offset,
  28806. u32 *value)
  28807. ---- a/drivers/net/wireless/rt2x00/rt2800mmio.c
  28808. -+++ b/drivers/net/wireless/rt2x00/rt2800mmio.c
  28809. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
  28810. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
  28811. @@ -820,8 +820,10 @@ int rt2800mmio_init_registers(struct rt2
  28812. rt2x00_set_field32(&reg, WPDMA_RST_IDX_DRX_IDX0, 1);
  28813. rt2x00mmio_register_write(rt2x00dev, WPDMA_RST_IDX, reg);
  28814. @@ -359,8 +359,8 @@ Changes since v1: ---
  28815. MODULE_AUTHOR(DRV_PROJECT);
  28816. MODULE_VERSION(DRV_VERSION);
  28817. MODULE_DESCRIPTION("rt2800 MMIO library");
  28818. ---- a/drivers/net/wireless/rt2x00/rt2800mmio.h
  28819. -+++ b/drivers/net/wireless/rt2x00/rt2800mmio.h
  28820. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.h
  28821. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.h
  28822. @@ -160,4 +160,8 @@ int rt2800mmio_init_registers(struct rt2
  28823. /* Device state switch handlers. */
  28824. int rt2800mmio_enable_radio(struct rt2x00_dev *rt2x00dev);
  28825. @@ -370,8 +370,8 @@ Changes since v1: ---
  28826. +void rt2800mmio_shmem_unlock(struct rt2x00_dev *rt2x00dev);
  28827. +
  28828. #endif /* RT2800MMIO_H */
  28829. ---- a/drivers/net/wireless/rt2x00/rt2800pci.c
  28830. -+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
  28831. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800pci.c
  28832. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800pci.c
  28833. @@ -69,7 +69,9 @@ static void rt2800pci_mcu_status(struct
  28834. return;
  28835. @@ -444,8 +444,8 @@ Changes since v1: ---
  28836. };
  28837. static const struct rt2x00lib_ops rt2800pci_rt2x00_ops = {
  28838. ---- a/drivers/net/wireless/rt2x00/rt2800soc.c
  28839. -+++ b/drivers/net/wireless/rt2x00/rt2800soc.c
  28840. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
  28841. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
  28842. @@ -176,6 +176,9 @@ static const struct rt2800_ops rt2800soc
  28843. .drv_write_firmware = rt2800soc_write_firmware,
  28844. .drv_init_registers = rt2800mmio_init_registers,
  28845. @@ -456,8 +456,8 @@ Changes since v1: ---
  28846. };
  28847. static const struct rt2x00lib_ops rt2800soc_rt2x00_ops = {
  28848. ---- a/drivers/net/wireless/rt2x00/rt2800usb.c
  28849. -+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
  28850. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
  28851. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
  28852. @@ -51,6 +51,27 @@ static bool rt2800usb_hwcrypt_disabled(s
  28853. return modparam_nohwcrypt;
  28854. }
  28855. @@ -486,7 +486,7 @@ Changes since v1: ---
  28856. /*
  28857. * Queue handlers.
  28858. */
  28859. -@@ -294,8 +315,10 @@ static int rt2800usb_write_firmware(stru
  28860. +@@ -299,8 +320,10 @@ static int rt2800usb_write_firmware(stru
  28861. data + offset, length);
  28862. }
  28863. @@ -497,7 +497,7 @@ Changes since v1: ---
  28864. /*
  28865. * Send firmware request to device to load firmware,
  28866. -@@ -310,7 +333,10 @@ static int rt2800usb_write_firmware(stru
  28867. +@@ -315,7 +338,10 @@ static int rt2800usb_write_firmware(stru
  28868. }
  28869. msleep(10);
  28870. @@ -508,7 +508,7 @@ Changes since v1: ---
  28871. return 0;
  28872. }
  28873. -@@ -328,8 +354,10 @@ static int rt2800usb_init_registers(stru
  28874. +@@ -333,8 +359,10 @@ static int rt2800usb_init_registers(stru
  28875. if (rt2800_wait_csr_ready(rt2x00dev))
  28876. return -EBUSY;
  28877. @@ -519,7 +519,7 @@ Changes since v1: ---
  28878. reg = 0;
  28879. rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_CSR, 1);
  28880. -@@ -859,6 +887,9 @@ static const struct rt2800_ops rt2800usb
  28881. +@@ -863,6 +891,9 @@ static const struct rt2800_ops rt2800usb
  28882. .drv_write_firmware = rt2800usb_write_firmware,
  28883. .drv_init_registers = rt2800usb_init_registers,
  28884. .drv_get_txwi = rt2800usb_get_txwi,
  28885. diff --git a/package/kernel/mac80211/patches/600-0004-rt2x00-rt2800lib-fix-beacon-generation-on-RT3593.patch b/package/kernel/mac80211/patches/600-0004-rt2x00-rt2800lib-fix-beacon-generation-on-RT3593.patch
  28886. index b8c1914..985a3b9 100644
  28887. --- a/package/kernel/mac80211/patches/600-0004-rt2x00-rt2800lib-fix-beacon-generation-on-RT3593.patch
  28888. +++ b/package/kernel/mac80211/patches/600-0004-rt2x00-rt2800lib-fix-beacon-generation-on-RT3593.patch
  28889. @@ -23,12 +23,12 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28890. ---
  28891. Changes since v1: ---
  28892. ---
  28893. - drivers/net/wireless/rt2x00/rt2800.h | 3 +++
  28894. - drivers/net/wireless/rt2x00/rt2800lib.c | 44 +++++++++++++++++++++++++++++++
  28895. + drivers/net/wireless/ralink/rt2x00/rt2800.h | 3 +++
  28896. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 44 +++++++++++++++++++++++++++++++
  28897. 2 files changed, 47 insertions(+)
  28898. ---- a/drivers/net/wireless/rt2x00/rt2800.h
  28899. -+++ b/drivers/net/wireless/rt2x00/rt2800.h
  28900. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
  28901. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
  28902. @@ -574,6 +574,7 @@
  28903. #define PBF_SYS_CTRL 0x0400
  28904. #define PBF_SYS_CTRL_READY FIELD32(0x00000080)
  28905. @@ -46,8 +46,8 @@ Changes since v1: ---
  28906. #define BEACON_BASE_TO_OFFSET(_base) (((_base) - 0x4000) / 64)
  28907. /*
  28908. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28909. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28910. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  28911. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  28912. @@ -82,6 +82,39 @@ static inline bool rt2800_is_305x_soc(st
  28913. return false;
  28914. }
  28915. 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
  28916. index e7eb630..02b2acf 100644
  28917. --- a/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch
  28918. +++ b/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch
  28919. @@ -18,13 +18,13 @@ new field with the actually used value.
  28920. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28921. ---
  28922. - drivers/net/wireless/rt2x00/rt2800lib.c | 5 ++++-
  28923. - drivers/net/wireless/rt2x00/rt2800lib.h | 1 +
  28924. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 5 ++++-
  28925. + drivers/net/wireless/ralink/rt2x00/rt2800lib.h | 1 +
  28926. 2 files changed, 5 insertions(+), 1 deletion(-)
  28927. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28928. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28929. -@@ -4638,6 +4638,7 @@ EXPORT_SYMBOL_GPL(rt2800_link_tuner);
  28930. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  28931. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  28932. +@@ -4615,6 +4615,7 @@ EXPORT_SYMBOL_GPL(rt2800_link_tuner);
  28933. */
  28934. static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
  28935. {
  28936. @@ -32,7 +32,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28937. u32 reg;
  28938. u16 eeprom;
  28939. unsigned int i;
  28940. -@@ -5003,7 +5004,7 @@ static int rt2800_init_registers(struct
  28941. +@@ -4980,7 +4981,7 @@ static int rt2800_init_registers(struct
  28942. /*
  28943. * Clear all beacons
  28944. */
  28945. @@ -41,7 +41,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28946. rt2800_clear_beacon_register(rt2x00dev, i);
  28947. if (rt2x00_is_usb(rt2x00dev)) {
  28948. -@@ -7852,6 +7853,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  28949. +@@ -7827,6 +7828,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  28950. if (rt2x00_rt(rt2x00dev, RT3593))
  28951. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  28952. @@ -50,13 +50,13 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28953. /*
  28954. * Allocate eeprom data.
  28955. */
  28956. ---- a/drivers/net/wireless/rt2x00/rt2800lib.h
  28957. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.h
  28958. -@@ -33,6 +33,7 @@ struct rt2800_drv_data {
  28959. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
  28960. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
  28961. +@@ -35,6 +35,7 @@ struct rt2800_drv_data {
  28962. u8 txmixer_gain_24g;
  28963. u8 txmixer_gain_5g;
  28964. unsigned int tbtt_tick;
  28965. + unsigned int hw_beacon_count;
  28966. + DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  28967. unsigned long rt2800_flags;
  28968. -
  28969. 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
  28970. index b79b4be..4e735d3 100644
  28971. --- a/package/kernel/mac80211/patches/600-0006-rt2x00-rt2800lib-init-additional-beacon-offset-regis.patch
  28972. +++ b/package/kernel/mac80211/patches/600-0006-rt2x00-rt2800lib-init-additional-beacon-offset-regis.patch
  28973. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: init additional beacon offset registers
  28974. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28975. ---
  28976. - drivers/net/wireless/rt2x00/rt2800.h | 14 ++++++++++++++
  28977. - drivers/net/wireless/rt2x00/rt2800lib.c | 24 ++++++++++++++++++++++++
  28978. + drivers/net/wireless/ralink/rt2x00/rt2800.h | 14 ++++++++++++++
  28979. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 24 ++++++++++++++++++++++++
  28980. 2 files changed, 38 insertions(+)
  28981. ---- a/drivers/net/wireless/rt2x00/rt2800.h
  28982. -+++ b/drivers/net/wireless/rt2x00/rt2800.h
  28983. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
  28984. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
  28985. @@ -629,6 +629,20 @@
  28986. */
  28987. #define PBF_DBG 0x043c
  28988. @@ -32,9 +32,9 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28989. /*
  28990. * RF registers
  28991. */
  28992. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28993. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28994. -@@ -4650,6 +4650,30 @@ static int rt2800_init_registers(struct
  28995. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  28996. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  28997. +@@ -4627,6 +4627,30 @@ static int rt2800_init_registers(struct
  28998. if (ret)
  28999. return ret;
  29000. 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
  29001. index 180c5e3..e909272 100644
  29002. --- a/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch
  29003. +++ b/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch
  29004. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: fix max supported beacon count for RT3593
  29005. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29006. ---
  29007. - drivers/net/wireless/rt2x00/rt2800lib.c | 5 ++++-
  29008. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 5 ++++-
  29009. 1 file changed, 4 insertions(+), 1 deletion(-)
  29010. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29011. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29012. -@@ -7877,7 +7877,10 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  29013. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29014. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29015. +@@ -7852,7 +7852,10 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  29016. if (rt2x00_rt(rt2x00dev, RT3593))
  29017. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  29018. diff --git a/package/kernel/mac80211/patches/600-0008-rt2x00-allow-to-build-rt2800soc-module-for-RT3883.patch b/package/kernel/mac80211/patches/600-0008-rt2x00-allow-to-build-rt2800soc-module-for-RT3883.patch
  29019. index 8a10c6e..565e39d 100644
  29020. --- a/package/kernel/mac80211/patches/600-0008-rt2x00-allow-to-build-rt2800soc-module-for-RT3883.patch
  29021. +++ b/package/kernel/mac80211/patches/600-0008-rt2x00-allow-to-build-rt2800soc-module-for-RT3883.patch
  29022. @@ -5,11 +5,11 @@ Subject: [PATCH] rt2x00: allow to build rt2800soc module for RT3883
  29023. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29024. ---
  29025. - drivers/net/wireless/rt2x00/Kconfig | 2 +-
  29026. + drivers/net/wireless/ralink/rt2x00/Kconfig | 2 +-
  29027. 1 file changed, 1 insertion(+), 1 deletion(-)
  29028. ---- a/drivers/net/wireless/rt2x00/Kconfig
  29029. -+++ b/drivers/net/wireless/rt2x00/Kconfig
  29030. +--- a/drivers/net/wireless/ralink/rt2x00/Kconfig
  29031. ++++ b/drivers/net/wireless/ralink/rt2x00/Kconfig
  29032. @@ -210,7 +210,7 @@ endif
  29033. config RT2800SOC
  29034. tristate "Ralink WiSoC support"
  29035. 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
  29036. index 31aa34a..7fe38e0 100644
  29037. --- a/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch
  29038. +++ b/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch
  29039. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: enable support for RT3883
  29040. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29041. ---
  29042. - drivers/net/wireless/rt2x00/rt2800lib.c | 1 +
  29043. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 1 +
  29044. 1 file changed, 1 insertion(+)
  29045. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29046. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29047. -@@ -7847,6 +7847,7 @@ static int rt2800_probe_rt(struct rt2x00
  29048. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29049. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29050. +@@ -7822,6 +7822,7 @@ static int rt2800_probe_rt(struct rt2x00
  29051. case RT3390:
  29052. case RT3572:
  29053. case RT3593:
  29054. 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
  29055. index a90c590..253a0c0 100644
  29056. --- a/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
  29057. +++ b/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
  29058. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: add rf_vals for RF3853
  29059. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29060. ---
  29061. - drivers/net/wireless/rt2x00/rt2800.h | 4 +-
  29062. - drivers/net/wireless/rt2x00/rt2800lib.c | 65 +++++++++++++++++++++++++++++++
  29063. + drivers/net/wireless/ralink/rt2x00/rt2800.h | 4 +-
  29064. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 65 +++++++++++++++++++++++++++++++
  29065. 2 files changed, 68 insertions(+), 1 deletion(-)
  29066. ---- a/drivers/net/wireless/rt2x00/rt2800.h
  29067. -+++ b/drivers/net/wireless/rt2x00/rt2800.h
  29068. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
  29069. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
  29070. @@ -48,7 +48,8 @@
  29071. * RF2853 2.4G/5G 3T3R
  29072. * RF3320 2.4G 1T1R(RT3350/RT3370/RT3390)
  29073. @@ -29,9 +29,9 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29074. #define RF5360 0x5360
  29075. #define RF5362 0x5362
  29076. #define RF5370 0x5370
  29077. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29078. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29079. -@@ -7465,6 +7465,66 @@ static const struct rf_channel rf_vals_3
  29080. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29081. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29082. +@@ -7442,6 +7442,66 @@ static const struct rf_channel rf_vals_3
  29083. {173, 0x61, 0, 9},
  29084. };
  29085. @@ -98,7 +98,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29086. static const struct rf_channel rf_vals_5592_xtal20[] = {
  29087. /* Channel, N, K, mod, R */
  29088. {1, 482, 4, 10, 3},
  29089. -@@ -7694,6 +7754,11 @@ static int rt2800_probe_hw_mode(struct r
  29090. +@@ -7669,6 +7729,11 @@ static int rt2800_probe_hw_mode(struct r
  29091. spec->channels = rf_vals_3x;
  29092. break;
  29093. 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
  29094. index ab2673b..f15c22b 100644
  29095. --- a/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
  29096. +++ b/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
  29097. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: enable VCO calibration for RF3853
  29098. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29099. ---
  29100. - drivers/net/wireless/rt2x00/rt2800lib.c | 2 ++
  29101. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 2 ++
  29102. 1 file changed, 2 insertions(+)
  29103. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29104. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29105. -@@ -4402,6 +4402,7 @@ void rt2800_vco_calibration(struct rt2x0
  29106. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29107. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29108. +@@ -4379,6 +4379,7 @@ void rt2800_vco_calibration(struct rt2x0
  29109. case RF3053:
  29110. case RF3070:
  29111. case RF3290:
  29112. @@ -18,7 +18,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29113. case RF5360:
  29114. case RF5362:
  29115. case RF5370:
  29116. -@@ -7873,6 +7874,7 @@ static int rt2800_probe_hw_mode(struct r
  29117. +@@ -7848,6 +7849,7 @@ static int rt2800_probe_hw_mode(struct r
  29118. case RF3053:
  29119. case RF3070:
  29120. case RF3290:
  29121. 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
  29122. index 05ed444..c120f2c 100644
  29123. --- a/package/kernel/mac80211/patches/600-0012-rt2x00-rt2800lib-add-channel-configuration-function-.patch
  29124. +++ b/package/kernel/mac80211/patches/600-0012-rt2x00-rt2800lib-add-channel-configuration-function-.patch
  29125. @@ -6,12 +6,12 @@ Subject: [PATCH] rt2x00: rt2800lib: add channel configuration function for
  29126. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29127. ---
  29128. - drivers/net/wireless/rt2x00/rt2800lib.c | 208 +++++++++++++++++++++++++++++++
  29129. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 208 +++++++++++++++++++++++++++++++
  29130. 1 file changed, 208 insertions(+)
  29131. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29132. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29133. -@@ -2649,6 +2649,211 @@ static void rt2800_config_channel_rf3053
  29134. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29135. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29136. +@@ -2626,6 +2626,211 @@ static void rt2800_config_channel_rf3053
  29137. }
  29138. }
  29139. @@ -223,7 +223,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29140. #define POWER_BOUND 0x27
  29141. #define POWER_BOUND_5G 0x2b
  29142. -@@ -3261,6 +3466,9 @@ static void rt2800_config_channel(struct
  29143. +@@ -3238,6 +3443,9 @@ static void rt2800_config_channel(struct
  29144. case RF3322:
  29145. rt2800_config_channel_rf3322(rt2x00dev, conf, rf, info);
  29146. break;
  29147. 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
  29148. index 3b50775..f006304 100644
  29149. --- a/package/kernel/mac80211/patches/600-0013-rt2x00-rt2800lib-enable-RF3853-support.patch
  29150. +++ b/package/kernel/mac80211/patches/600-0013-rt2x00-rt2800lib-enable-RF3853-support.patch
  29151. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: enable RF3853 support
  29152. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29153. ---
  29154. - drivers/net/wireless/rt2x00/rt2800lib.c | 1 +
  29155. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 1 +
  29156. 1 file changed, 1 insertion(+)
  29157. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29158. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29159. -@@ -7430,6 +7430,7 @@ static int rt2800_init_eeprom(struct rt2
  29160. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29161. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29162. +@@ -7407,6 +7407,7 @@ static int rt2800_init_eeprom(struct rt2
  29163. case RF3290:
  29164. case RF3320:
  29165. case RF3322:
  29166. 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
  29167. index 4dfb068..a56bfa8 100644
  29168. --- a/package/kernel/mac80211/patches/600-0014-rt2x00-rt2800lib-add-MAC-register-initialization-for.patch
  29169. +++ b/package/kernel/mac80211/patches/600-0014-rt2x00-rt2800lib-add-MAC-register-initialization-for.patch
  29170. @@ -6,12 +6,12 @@ Subject: [PATCH] rt2x00: rt2800lib: add MAC register initialization for
  29171. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29172. ---
  29173. - drivers/net/wireless/rt2x00/rt2800.h | 14 ++++++++++++++
  29174. - drivers/net/wireless/rt2x00/rt2800lib.c | 19 ++++++++++++++++---
  29175. + drivers/net/wireless/ralink/rt2x00/rt2800.h | 14 ++++++++++++++
  29176. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 19 ++++++++++++++++---
  29177. 2 files changed, 30 insertions(+), 3 deletions(-)
  29178. ---- a/drivers/net/wireless/rt2x00/rt2800.h
  29179. -+++ b/drivers/net/wireless/rt2x00/rt2800.h
  29180. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
  29181. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
  29182. @@ -1588,6 +1588,20 @@
  29183. #define TX_PWR_CFG_9_STBC7_CH2 FIELD32(0x00000f00)
  29184. @@ -33,9 +33,9 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29185. * RX_FILTER_CFG: RX configuration register.
  29186. */
  29187. #define RX_FILTER_CFG 0x1400
  29188. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29189. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29190. -@@ -5005,6 +5005,12 @@ static int rt2800_init_registers(struct
  29191. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29192. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29193. +@@ -4982,6 +4982,12 @@ static int rt2800_init_registers(struct
  29194. rt2800_register_write(rt2x00dev, TX_SW_CFG2,
  29195. 0x00000000);
  29196. }
  29197. @@ -48,7 +48,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29198. } else if (rt2x00_rt(rt2x00dev, RT5390) ||
  29199. rt2x00_rt(rt2x00dev, RT5392) ||
  29200. rt2x00_rt(rt2x00dev, RT5592)) {
  29201. -@@ -5035,9 +5041,11 @@ static int rt2800_init_registers(struct
  29202. +@@ -5012,9 +5018,11 @@ static int rt2800_init_registers(struct
  29203. rt2800_register_read(rt2x00dev, MAX_LEN_CFG, &reg);
  29204. rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_MPDU, AGGREGATION_SIZE);
  29205. @@ -63,7 +63,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29206. rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 2);
  29207. else
  29208. rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 1);
  29209. -@@ -5190,6 +5198,11 @@ static int rt2800_init_registers(struct
  29210. +@@ -5167,6 +5175,11 @@ static int rt2800_init_registers(struct
  29211. reg = rt2x00_rt(rt2x00dev, RT5592) ? 0x00000082 : 0x00000002;
  29212. rt2800_register_write(rt2x00dev, TXOP_HLDR_ET, reg);
  29213. diff --git a/package/kernel/mac80211/patches/600-0015-rt2x00-rt2800soc-fix-rt2800soc_disable_radio-for-RT3.patch b/package/kernel/mac80211/patches/600-0015-rt2x00-rt2800soc-fix-rt2800soc_disable_radio-for-RT3.patch
  29214. index 837c025..d68ad50 100644
  29215. --- a/package/kernel/mac80211/patches/600-0015-rt2x00-rt2800soc-fix-rt2800soc_disable_radio-for-RT3.patch
  29216. +++ b/package/kernel/mac80211/patches/600-0015-rt2x00-rt2800soc-fix-rt2800soc_disable_radio-for-RT3.patch
  29217. @@ -5,11 +5,11 @@ Subject: [PATCH] rt2x00: rt2800soc: fix rt2800soc_disable_radio for RT3883
  29218. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29219. ---
  29220. - drivers/net/wireless/rt2x00/rt2800soc.c | 9 ++++++++-
  29221. + drivers/net/wireless/ralink/rt2x00/rt2800soc.c | 9 ++++++++-
  29222. 1 file changed, 8 insertions(+), 1 deletion(-)
  29223. ---- a/drivers/net/wireless/rt2x00/rt2800soc.c
  29224. -+++ b/drivers/net/wireless/rt2x00/rt2800soc.c
  29225. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
  29226. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
  29227. @@ -51,9 +51,16 @@ static bool rt2800soc_hwcrypt_disabled(s
  29228. static void rt2800soc_disable_radio(struct rt2x00_dev *rt2x00dev)
  29229. 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
  29230. index 6663b78..9532632 100644
  29231. --- a/package/kernel/mac80211/patches/600-0016-rt2x00-rt2800lib-add-BBP-register-initialization-for.patch
  29232. +++ b/package/kernel/mac80211/patches/600-0016-rt2x00-rt2800lib-add-BBP-register-initialization-for.patch
  29233. @@ -6,12 +6,12 @@ Subject: [PATCH] rt2x00: rt2800lib: add BBP register initialization for
  29234. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29235. ---
  29236. - drivers/net/wireless/rt2x00/rt2800lib.c | 44 +++++++++++++++++++++++++++++++
  29237. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 44 +++++++++++++++++++++++++++++++
  29238. 1 file changed, 44 insertions(+)
  29239. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29240. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29241. -@@ -5808,6 +5808,47 @@ static void rt2800_init_bbp_3593(struct
  29242. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29243. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29244. +@@ -5785,6 +5785,47 @@ static void rt2800_init_bbp_3593(struct
  29245. rt2800_bbp_write(rt2x00dev, 103, 0xc0);
  29246. }
  29247. @@ -59,7 +59,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29248. static void rt2800_init_bbp_53xx(struct rt2x00_dev *rt2x00dev)
  29249. {
  29250. int ant, div_mode;
  29251. -@@ -6026,6 +6067,9 @@ static void rt2800_init_bbp(struct rt2x0
  29252. +@@ -6003,6 +6044,9 @@ static void rt2800_init_bbp(struct rt2x0
  29253. case RT3593:
  29254. rt2800_init_bbp_3593(rt2x00dev);
  29255. return;
  29256. 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
  29257. index 6e66f14..936fa35 100644
  29258. --- a/package/kernel/mac80211/patches/600-0017-rt2x00-rt2800lib-add-RFCSR-initialization-for-RT3883.patch
  29259. +++ b/package/kernel/mac80211/patches/600-0017-rt2x00-rt2800lib-add-RFCSR-initialization-for-RT3883.patch
  29260. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: add RFCSR initialization for RT3883
  29261. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29262. ---
  29263. - drivers/net/wireless/rt2x00/rt2800.h | 1 +
  29264. - drivers/net/wireless/rt2x00/rt2800lib.c | 141 +++++++++++++++++++++++++++++++
  29265. + drivers/net/wireless/ralink/rt2x00/rt2800.h | 1 +
  29266. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 141 +++++++++++++++++++++++++++++++
  29267. 2 files changed, 142 insertions(+)
  29268. ---- a/drivers/net/wireless/rt2x00/rt2800.h
  29269. -+++ b/drivers/net/wireless/rt2x00/rt2800.h
  29270. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
  29271. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
  29272. @@ -2171,6 +2171,7 @@ struct mac_iveiv_entry {
  29273. /*
  29274. * RFCSR 2:
  29275. @@ -19,9 +19,9 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29276. #define RFCSR2_RESCAL_EN FIELD8(0x80)
  29277. /*
  29278. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29279. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29280. -@@ -6843,6 +6843,144 @@ static void rt2800_init_rfcsr_3593(struc
  29281. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29282. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29283. +@@ -6820,6 +6820,144 @@ static void rt2800_init_rfcsr_3593(struc
  29284. /* TODO: enable stream mode support */
  29285. }
  29286. @@ -166,7 +166,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29287. static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
  29288. {
  29289. rt2800_rf_init_calibration(rt2x00dev, 2);
  29290. -@@ -7074,6 +7212,9 @@ static void rt2800_init_rfcsr(struct rt2
  29291. +@@ -7051,6 +7189,9 @@ static void rt2800_init_rfcsr(struct rt2
  29292. case RT3390:
  29293. rt2800_init_rfcsr_3390(rt2x00dev);
  29294. break;
  29295. diff --git a/package/kernel/mac80211/patches/600-0018-rt2x00-rt2800lib-use-the-extended-EEPROM-map-for-RT3.patch b/package/kernel/mac80211/patches/600-0018-rt2x00-rt2800lib-use-the-extended-EEPROM-map-for-RT3.patch
  29296. index 57af961..ae899f7 100644
  29297. --- a/package/kernel/mac80211/patches/600-0018-rt2x00-rt2800lib-use-the-extended-EEPROM-map-for-RT3.patch
  29298. +++ b/package/kernel/mac80211/patches/600-0018-rt2x00-rt2800lib-use-the-extended-EEPROM-map-for-RT3.patch
  29299. @@ -5,11 +5,11 @@ Subject: [PATCH] rt2x00: rt2800lib: use the extended EEPROM map for RT3883
  29300. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29301. ---
  29302. - drivers/net/wireless/rt2x00/rt2800lib.c | 3 ++-
  29303. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ++-
  29304. 1 file changed, 2 insertions(+), 1 deletion(-)
  29305. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29306. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29307. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29308. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29309. @@ -342,7 +342,8 @@ static unsigned int rt2800_eeprom_word_i
  29310. wiphy_name(rt2x00dev->hw->wiphy), word))
  29311. return 0;
  29312. 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
  29313. index 9390f7e..bcaf676 100644
  29314. --- a/package/kernel/mac80211/patches/600-0019-rt2x00-rt2800lib-force-rf-type-to-RF3853-on-RT3883.patch
  29315. +++ b/package/kernel/mac80211/patches/600-0019-rt2x00-rt2800lib-force-rf-type-to-RF3853-on-RT3883.patch
  29316. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: force rf type to RF3853 on RT3883
  29317. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29318. ---
  29319. - drivers/net/wireless/rt2x00/rt2800lib.c | 2 ++
  29320. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 2 ++
  29321. 1 file changed, 2 insertions(+)
  29322. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29323. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29324. -@@ -7611,6 +7611,8 @@ static int rt2800_init_eeprom(struct rt2
  29325. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29326. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29327. +@@ -7588,6 +7588,8 @@ static int rt2800_init_eeprom(struct rt2
  29328. rt2x00_rt(rt2x00dev, RT5390) ||
  29329. rt2x00_rt(rt2x00dev, RT5392))
  29330. rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &rf);
  29331. 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
  29332. index 1cba4f6..3169c10 100644
  29333. --- a/package/kernel/mac80211/patches/600-0020-rt2x00-rt2800lib-add-channel-configuration-code-for-.patch
  29334. +++ b/package/kernel/mac80211/patches/600-0020-rt2x00-rt2800lib-add-channel-configuration-code-for-.patch
  29335. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: add channel configuration code for RT3883
  29336. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29337. ---
  29338. - drivers/net/wireless/rt2x00/rt2800lib.c | 72 +++++++++++++++++++++++++++++--
  29339. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 72 +++++++++++++++++++++++++++++--
  29340. 1 file changed, 69 insertions(+), 3 deletions(-)
  29341. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29342. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29343. -@@ -3429,6 +3429,36 @@ static char rt2800_txpower_to_dev(struct
  29344. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29345. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29346. +@@ -3406,6 +3406,36 @@ static char rt2800_txpower_to_dev(struct
  29347. return clamp_t(char, txpower, MIN_A_TXPOWER, MAX_A_TXPOWER);
  29348. }
  29349. @@ -47,7 +47,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29350. static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
  29351. struct ieee80211_conf *conf,
  29352. struct rf_channel *rf,
  29353. -@@ -3447,6 +3477,12 @@ static void rt2800_config_channel(struct
  29354. +@@ -3424,6 +3454,12 @@ static void rt2800_config_channel(struct
  29355. rt2800_txpower_to_dev(rt2x00dev, rf->channel,
  29356. info->default_power3);
  29357. @@ -60,7 +60,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29358. switch (rt2x00dev->chip.rf) {
  29359. case RF2020:
  29360. case RF3020:
  29361. -@@ -3530,6 +3566,15 @@ static void rt2800_config_channel(struct
  29362. +@@ -3507,6 +3543,15 @@ static void rt2800_config_channel(struct
  29363. rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain);
  29364. rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain);
  29365. rt2800_bbp_write(rt2x00dev, 77, 0x98);
  29366. @@ -76,7 +76,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29367. } else {
  29368. rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain);
  29369. rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain);
  29370. -@@ -3542,6 +3587,7 @@ static void rt2800_config_channel(struct
  29371. +@@ -3519,6 +3564,7 @@ static void rt2800_config_channel(struct
  29372. !rt2x00_rt(rt2x00dev, RT5392)) {
  29373. if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
  29374. rt2800_bbp_write(rt2x00dev, 82, 0x62);
  29375. @@ -84,7 +84,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29376. rt2800_bbp_write(rt2x00dev, 75, 0x46);
  29377. } else {
  29378. if (rt2x00_rt(rt2x00dev, RT3593))
  29379. -@@ -3550,19 +3596,22 @@ static void rt2800_config_channel(struct
  29380. +@@ -3527,19 +3573,22 @@ static void rt2800_config_channel(struct
  29381. rt2800_bbp_write(rt2x00dev, 82, 0x84);
  29382. rt2800_bbp_write(rt2x00dev, 75, 0x50);
  29383. }
  29384. @@ -110,7 +110,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29385. rt2800_bbp_write(rt2x00dev, 83, 0x9a);
  29386. if (rt2x00_has_cap_external_lna_a(rt2x00dev))
  29387. -@@ -3684,6 +3733,23 @@ static void rt2800_config_channel(struct
  29388. +@@ -3661,6 +3710,23 @@ static void rt2800_config_channel(struct
  29389. rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg);
  29390. 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
  29391. index 1773128..fa646d2 100644
  29392. --- a/package/kernel/mac80211/patches/600-0021-rt2x00-rt2800lib-fix-txpower_to_dev-function-for-RT3.patch
  29393. +++ b/package/kernel/mac80211/patches/600-0021-rt2x00-rt2800lib-fix-txpower_to_dev-function-for-RT3.patch
  29394. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: fix txpower_to_dev function for RT3883
  29395. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29396. ---
  29397. - drivers/net/wireless/rt2x00/rt2800lib.c | 6 ++++--
  29398. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 6 ++++--
  29399. 1 file changed, 4 insertions(+), 2 deletions(-)
  29400. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29401. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29402. -@@ -3416,13 +3416,15 @@ static char rt2800_txpower_to_dev(struct
  29403. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29404. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29405. +@@ -3393,13 +3393,15 @@ static char rt2800_txpower_to_dev(struct
  29406. unsigned int channel,
  29407. char txpower)
  29408. {
  29409. 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
  29410. index 36f0a4c..c068769 100644
  29411. --- a/package/kernel/mac80211/patches/600-0022-rt2x00-rt2800lib-use-correct-txpower-calculation-fun.patch
  29412. +++ b/package/kernel/mac80211/patches/600-0022-rt2x00-rt2800lib-use-correct-txpower-calculation-fun.patch
  29413. @@ -6,12 +6,12 @@ Subject: [PATCH] rt2x00: rt2800lib: use correct txpower calculation function
  29414. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29415. ---
  29416. - drivers/net/wireless/rt2x00/rt2800lib.c | 3 ++-
  29417. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ++-
  29418. 1 file changed, 2 insertions(+), 1 deletion(-)
  29419. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29420. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29421. -@@ -4635,7 +4635,8 @@ static void rt2800_config_txpower(struct
  29422. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29423. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29424. +@@ -4612,7 +4612,8 @@ static void rt2800_config_txpower(struct
  29425. struct ieee80211_channel *chan,
  29426. int power_level)
  29427. {
  29428. 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
  29429. index 8119f97..74d80de 100644
  29430. --- a/package/kernel/mac80211/patches/600-0023-rt2x00-rt2800lib-hardcode-txmixer-gain-values-to-zer.patch
  29431. +++ b/package/kernel/mac80211/patches/600-0023-rt2x00-rt2800lib-hardcode-txmixer-gain-values-to-zer.patch
  29432. @@ -6,12 +6,12 @@ Subject: [PATCH] rt2x00: rt2800lib: hardcode txmixer gain values to zero for
  29433. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29434. ---
  29435. - drivers/net/wireless/rt2x00/rt2800lib.c | 6 ++++--
  29436. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 6 ++++--
  29437. 1 file changed, 4 insertions(+), 2 deletions(-)
  29438. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29439. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29440. -@@ -7493,7 +7493,8 @@ static u8 rt2800_get_txmixer_gain_24g(st
  29441. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29442. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29443. +@@ -7470,7 +7470,8 @@ static u8 rt2800_get_txmixer_gain_24g(st
  29444. {
  29445. u16 word;
  29446. @@ -21,7 +21,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29447. return 0;
  29448. rt2800_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_BG, &word);
  29449. -@@ -7507,7 +7508,8 @@ static u8 rt2800_get_txmixer_gain_5g(str
  29450. +@@ -7484,7 +7485,8 @@ static u8 rt2800_get_txmixer_gain_5g(str
  29451. {
  29452. u16 word;
  29453. diff --git a/package/kernel/mac80211/patches/600-0024-rt2x00-rt2800lib-use-correct-RT-XWI-size-for-RT3883.patch b/package/kernel/mac80211/patches/600-0024-rt2x00-rt2800lib-use-correct-RT-XWI-size-for-RT3883.patch
  29454. index 53435aa..1259286 100644
  29455. --- a/package/kernel/mac80211/patches/600-0024-rt2x00-rt2800lib-use-correct-RT-XWI-size-for-RT3883.patch
  29456. +++ b/package/kernel/mac80211/patches/600-0024-rt2x00-rt2800lib-use-correct-RT-XWI-size-for-RT3883.patch
  29457. @@ -5,11 +5,11 @@ Subject: [PATCH] rt2x00: rt2800lib: use correct [RT]XWI size for RT3883
  29458. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29459. ---
  29460. - drivers/net/wireless/rt2x00/rt2800lib.c | 1 +
  29461. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 1 +
  29462. 1 file changed, 1 insertion(+)
  29463. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29464. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29465. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29466. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29467. @@ -558,6 +558,7 @@ void rt2800_get_txwi_rxwi_size(struct rt
  29468. {
  29469. switch (rt2x00dev->chip.rt) {
  29470. diff --git a/package/kernel/mac80211/patches/600-0025-rt2x00-rt2800lib-use-correct-beacon-base-for-RT3883.patch b/package/kernel/mac80211/patches/600-0025-rt2x00-rt2800lib-use-correct-beacon-base-for-RT3883.patch
  29471. index 08f3f88..0dcc027 100644
  29472. --- a/package/kernel/mac80211/patches/600-0025-rt2x00-rt2800lib-use-correct-beacon-base-for-RT3883.patch
  29473. +++ b/package/kernel/mac80211/patches/600-0025-rt2x00-rt2800lib-use-correct-beacon-base-for-RT3883.patch
  29474. @@ -5,11 +5,11 @@ Subject: [PATCH] rt2x00: rt2800lib: use correct beacon base for RT3883
  29475. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29476. ---
  29477. - drivers/net/wireless/rt2x00/rt2800lib.c | 3 ++-
  29478. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ++-
  29479. 1 file changed, 2 insertions(+), 1 deletion(-)
  29480. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29481. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29482. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29483. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29484. @@ -983,7 +983,8 @@ EXPORT_SYMBOL_GPL(rt2800_txdone_entry);
  29485. static unsigned int rt2800_hw_beacon_base(struct rt2x00_dev *rt2x00dev,
  29486. unsigned int index)
  29487. 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
  29488. index dfbdee7..6ce224a 100644
  29489. --- a/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch
  29490. +++ b/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch
  29491. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: use correct beacon count for RT3883
  29492. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29493. ---
  29494. - drivers/net/wireless/rt2x00/rt2800lib.c | 3 ++-
  29495. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ++-
  29496. 1 file changed, 2 insertions(+), 1 deletion(-)
  29497. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29498. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29499. -@@ -8428,7 +8428,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  29500. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29501. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29502. +@@ -8403,7 +8403,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  29503. if (rt2x00_rt(rt2x00dev, RT3593))
  29504. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  29505. 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
  29506. index 22f7110..3936368 100644
  29507. --- a/package/kernel/mac80211/patches/600-0027-rt2x00-rt2800lib-fix-antenna-configuration-for-RT388.patch
  29508. +++ b/package/kernel/mac80211/patches/600-0027-rt2x00-rt2800lib-fix-antenna-configuration-for-RT388.patch
  29509. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: fix antenna configuration for RT3883
  29510. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29511. ---
  29512. - drivers/net/wireless/rt2x00/rt2800lib.c | 3 ++-
  29513. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ++-
  29514. 1 file changed, 2 insertions(+), 1 deletion(-)
  29515. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29516. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29517. -@@ -1961,7 +1961,8 @@ void rt2800_config_ant(struct rt2x00_dev
  29518. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29519. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29520. +@@ -1938,7 +1938,8 @@ void rt2800_config_ant(struct rt2x00_dev
  29521. rt2800_bbp_write(rt2x00dev, 3, r3);
  29522. rt2800_bbp_write(rt2x00dev, 1, r1);
  29523. 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
  29524. index 9945f38..f028587 100644
  29525. --- a/package/kernel/mac80211/patches/600-0028-rt2x00-rt2800lib-fix-LNA-gain-configuration-for-RT38.patch
  29526. +++ b/package/kernel/mac80211/patches/600-0028-rt2x00-rt2800lib-fix-LNA-gain-configuration-for-RT38.patch
  29527. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: fix LNA gain configuration for RT3883
  29528. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29529. ---
  29530. - drivers/net/wireless/rt2x00/rt2800lib.c | 6 ++++--
  29531. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 6 ++++--
  29532. 1 file changed, 4 insertions(+), 2 deletions(-)
  29533. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29534. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29535. -@@ -1984,7 +1984,8 @@ static void rt2800_config_lna_gain(struc
  29536. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29537. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29538. +@@ -1961,7 +1961,8 @@ static void rt2800_config_lna_gain(struc
  29539. rt2800_eeprom_read(rt2x00dev, EEPROM_LNA, &eeprom);
  29540. lna_gain = rt2x00_get_field16(eeprom, EEPROM_LNA_A0);
  29541. } else if (libconf->rf.channel <= 128) {
  29542. @@ -20,7 +20,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29543. rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2, &eeprom);
  29544. lna_gain = rt2x00_get_field16(eeprom,
  29545. EEPROM_EXT_LNA2_A1);
  29546. -@@ -1994,7 +1995,8 @@ static void rt2800_config_lna_gain(struc
  29547. +@@ -1971,7 +1972,8 @@ static void rt2800_config_lna_gain(struc
  29548. EEPROM_RSSI_BG2_LNA_A1);
  29549. }
  29550. } else {
  29551. 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
  29552. index beadea8..ab8c625 100644
  29553. --- a/package/kernel/mac80211/patches/600-0029-rt2x00-rt2800lib-fix-VGC-setup-for-RT3883.patch
  29554. +++ b/package/kernel/mac80211/patches/600-0029-rt2x00-rt2800lib-fix-VGC-setup-for-RT3883.patch
  29555. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: fix VGC setup for RT3883
  29556. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29557. ---
  29558. - drivers/net/wireless/rt2x00/rt2800lib.c | 11 +++++++++--
  29559. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 11 +++++++++--
  29560. 1 file changed, 9 insertions(+), 2 deletions(-)
  29561. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29562. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29563. -@@ -4835,7 +4835,8 @@ static u8 rt2800_get_default_vgc(struct
  29564. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29565. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29566. +@@ -4812,7 +4812,8 @@ static u8 rt2800_get_default_vgc(struct
  29567. else
  29568. vgc = 0x2e + rt2x00dev->lna_gain;
  29569. } else { /* 5GHZ band */
  29570. @@ -20,7 +20,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29571. vgc = 0x20 + (rt2x00dev->lna_gain * 5) / 3;
  29572. else if (rt2x00_rt(rt2x00dev, RT5592))
  29573. vgc = 0x24 + (2 * rt2x00dev->lna_gain);
  29574. -@@ -4855,7 +4856,8 @@ static inline void rt2800_set_vgc(struct
  29575. +@@ -4832,7 +4833,8 @@ static inline void rt2800_set_vgc(struct
  29576. {
  29577. if (qual->vgc_level != vgc_level) {
  29578. if (rt2x00_rt(rt2x00dev, RT3572) ||
  29579. @@ -30,7 +30,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29580. rt2800_bbp_write_with_rx_chain(rt2x00dev, 66,
  29581. vgc_level);
  29582. } else if (rt2x00_rt(rt2x00dev, RT5592)) {
  29583. -@@ -4902,6 +4904,11 @@ void rt2800_link_tuner(struct rt2x00_dev
  29584. +@@ -4879,6 +4881,11 @@ void rt2800_link_tuner(struct rt2x00_dev
  29585. }
  29586. break;
  29587. 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
  29588. index a6c0f58..49830a1 100644
  29589. --- a/package/kernel/mac80211/patches/600-0030-rt2x00-rt2800lib-fix-EEPROM-LNA-validation-for-RT388.patch
  29590. +++ b/package/kernel/mac80211/patches/600-0030-rt2x00-rt2800lib-fix-EEPROM-LNA-validation-for-RT388.patch
  29591. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: fix EEPROM LNA validation for RT3883
  29592. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29593. ---
  29594. - drivers/net/wireless/rt2x00/rt2800lib.c | 9 ++++++---
  29595. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 9 ++++++---
  29596. 1 file changed, 6 insertions(+), 3 deletions(-)
  29597. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29598. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29599. -@@ -7630,7 +7630,8 @@ static int rt2800_validate_eeprom(struct
  29600. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29601. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29602. +@@ -7607,7 +7607,8 @@ static int rt2800_validate_eeprom(struct
  29603. rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2, &word);
  29604. if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG2_OFFSET2)) > 10)
  29605. rt2x00_set_field16(&word, EEPROM_RSSI_BG2_OFFSET2, 0);
  29606. @@ -20,7 +20,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29607. if (rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0x00 ||
  29608. rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0xff)
  29609. rt2x00_set_field16(&word, EEPROM_RSSI_BG2_LNA_A1,
  29610. -@@ -7650,7 +7651,8 @@ static int rt2800_validate_eeprom(struct
  29611. +@@ -7627,7 +7628,8 @@ static int rt2800_validate_eeprom(struct
  29612. rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_A2, &word);
  29613. if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A2_OFFSET2)) > 10)
  29614. rt2x00_set_field16(&word, EEPROM_RSSI_A2_OFFSET2, 0);
  29615. @@ -30,7 +30,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29616. if (rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0x00 ||
  29617. rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0xff)
  29618. rt2x00_set_field16(&word, EEPROM_RSSI_A2_LNA_A2,
  29619. -@@ -7658,7 +7660,8 @@ static int rt2800_validate_eeprom(struct
  29620. +@@ -7635,7 +7637,8 @@ static int rt2800_validate_eeprom(struct
  29621. }
  29622. rt2800_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word);
  29623. 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
  29624. index 910f9ec..6e22847 100644
  29625. --- a/package/kernel/mac80211/patches/600-0031-rt2x00-rt2800lib-fix-txpower-compensation-for-RT3883.patch
  29626. +++ b/package/kernel/mac80211/patches/600-0031-rt2x00-rt2800lib-fix-txpower-compensation-for-RT3883.patch
  29627. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: fix txpower compensation for RT3883
  29628. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29629. ---
  29630. - drivers/net/wireless/rt2x00/rt2800lib.c | 3 +++
  29631. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 +++
  29632. 1 file changed, 3 insertions(+)
  29633. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29634. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29635. -@@ -4005,6 +4005,9 @@ static u8 rt2800_compensate_txpower(stru
  29636. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29637. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29638. +@@ -3982,6 +3982,9 @@ static u8 rt2800_compensate_txpower(stru
  29639. if (rt2x00_rt(rt2x00dev, RT3593))
  29640. return min_t(u8, txpower, 0xc);
  29641. 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
  29642. index bcdfc67..25753af 100644
  29643. --- a/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch
  29644. +++ b/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch
  29645. @@ -6,12 +6,12 @@ Subject: [PATCH] rt2x00: rt2800lib: enable RT2800_HAS_HIGH_SHARED_MEM for
  29646. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29647. ---
  29648. - drivers/net/wireless/rt2x00/rt2800lib.c | 3 ++-
  29649. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ++-
  29650. 1 file changed, 2 insertions(+), 1 deletion(-)
  29651. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29652. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29653. -@@ -8441,7 +8441,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  29654. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29655. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29656. +@@ -8416,7 +8416,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  29657. if (retval)
  29658. return retval;
  29659. diff --git a/package/kernel/mac80211/patches/600-0033-rt2x00-rt2800lib-use-high-memory-for-beacons-on-RT38.patch b/package/kernel/mac80211/patches/600-0033-rt2x00-rt2800lib-use-high-memory-for-beacons-on-RT38.patch
  29660. index dc06e6a..4f2e754 100644
  29661. --- a/package/kernel/mac80211/patches/600-0033-rt2x00-rt2800lib-use-high-memory-for-beacons-on-RT38.patch
  29662. +++ b/package/kernel/mac80211/patches/600-0033-rt2x00-rt2800lib-use-high-memory-for-beacons-on-RT38.patch
  29663. @@ -5,11 +5,11 @@ Subject: [PATCH] rt2x00: rt2800lib: use high memory for beacons on RT3883
  29664. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29665. ---
  29666. - drivers/net/wireless/rt2x00/rt2800lib.c | 3 ++-
  29667. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ++-
  29668. 1 file changed, 2 insertions(+), 1 deletion(-)
  29669. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29670. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29671. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29672. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29673. @@ -97,7 +97,8 @@ static inline void rt2800_shared_mem_sel
  29674. static inline bool rt2800_beacon_uses_high_mem(struct rt2x00_dev *rt2x00dev)
  29675. diff --git a/package/kernel/mac80211/patches/600-0034-rt2x00-rt2800mmio-add-a-workaround-for-spurious-TX_F.patch b/package/kernel/mac80211/patches/600-0034-rt2x00-rt2800mmio-add-a-workaround-for-spurious-TX_F.patch
  29676. index 212eb4e..a497b5e 100644
  29677. --- a/package/kernel/mac80211/patches/600-0034-rt2x00-rt2800mmio-add-a-workaround-for-spurious-TX_F.patch
  29678. +++ b/package/kernel/mac80211/patches/600-0034-rt2x00-rt2800mmio-add-a-workaround-for-spurious-TX_F.patch
  29679. @@ -6,12 +6,12 @@ Subject: [PATCH] rt2x00: rt2800mmio: add a workaround for spurious
  29680. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29681. ---
  29682. - drivers/net/wireless/rt2x00/rt2800mmio.c | 72 +++++++++++++++++++++++++-----
  29683. - drivers/net/wireless/rt2x00/rt2x00.h | 5 +++
  29684. + drivers/net/wireless/ralink/rt2x00/rt2800mmio.c | 72 +++++++++++++++++++++++++-----
  29685. + drivers/net/wireless/ralink/rt2x00/rt2x00.h | 5 +++
  29686. 2 files changed, 65 insertions(+), 12 deletions(-)
  29687. ---- a/drivers/net/wireless/rt2x00/rt2800mmio.c
  29688. -+++ b/drivers/net/wireless/rt2x00/rt2800mmio.c
  29689. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
  29690. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
  29691. @@ -415,9 +415,9 @@ void rt2800mmio_autowake_tasklet(unsigne
  29692. }
  29693. EXPORT_SYMBOL_GPL(rt2800mmio_autowake_tasklet);
  29694. @@ -120,9 +120,9 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29695. /*
  29696. * Never disable the TX_FIFO_STATUS interrupt.
  29697. */
  29698. ---- a/drivers/net/wireless/rt2x00/rt2x00.h
  29699. -+++ b/drivers/net/wireless/rt2x00/rt2x00.h
  29700. -@@ -987,6 +987,11 @@ struct rt2x00_dev {
  29701. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  29702. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  29703. +@@ -991,6 +991,11 @@ struct rt2x00_dev {
  29704. int rf_channel;
  29705. /*
  29706. diff --git a/package/kernel/mac80211/patches/601-rt2x00-set_pci_mwi.patch b/package/kernel/mac80211/patches/601-rt2x00-set_pci_mwi.patch
  29707. index 08c8fa6..a407161 100644
  29708. --- a/package/kernel/mac80211/patches/601-rt2x00-set_pci_mwi.patch
  29709. +++ b/package/kernel/mac80211/patches/601-rt2x00-set_pci_mwi.patch
  29710. @@ -1,5 +1,5 @@
  29711. ---- a/drivers/net/wireless/rt2x00/rt2x00pci.c
  29712. -+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
  29713. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00pci.c
  29714. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00pci.c
  29715. @@ -94,8 +94,10 @@ int rt2x00pci_probe(struct pci_dev *pci_
  29716. pci_set_master(pci_dev);
  29717. diff --git a/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00_platform_h.patch b/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00_platform_h.patch
  29718. index 8c71075..7a183a4 100644
  29719. --- a/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00_platform_h.patch
  29720. +++ b/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00_platform_h.patch
  29721. @@ -20,8 +20,8 @@
  29722. +};
  29723. +
  29724. +#endif /* _RT2X00_PLATFORM_H */
  29725. ---- a/drivers/net/wireless/rt2x00/rt2x00.h
  29726. -+++ b/drivers/net/wireless/rt2x00/rt2x00.h
  29727. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  29728. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  29729. @@ -38,6 +38,7 @@
  29730. #include <linux/kfifo.h>
  29731. #include <linux/hrtimer.h>
  29732. diff --git a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  29733. index 8f650a2..bc056cd 100644
  29734. --- a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  29735. +++ b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  29736. @@ -1,15 +1,15 @@
  29737. --- a/.local-symbols
  29738. +++ b/.local-symbols
  29739. -@@ -263,6 +263,7 @@ RT2X00_LIB_FIRMWARE=
  29740. +@@ -329,6 +329,7 @@ RT2X00_LIB_FIRMWARE=
  29741. RT2X00_LIB_CRYPTO=
  29742. RT2X00_LIB_LEDS=
  29743. RT2X00_LIB_DEBUGFS=
  29744. +RT2X00_LIB_EEPROM=
  29745. RT2X00_DEBUG=
  29746. - RTL_CARDS=
  29747. - RTL8192CE=
  29748. ---- a/drivers/net/wireless/rt2x00/Kconfig
  29749. -+++ b/drivers/net/wireless/rt2x00/Kconfig
  29750. + WLAN_VENDOR_REALTEK=
  29751. + RTL8180=
  29752. +--- a/drivers/net/wireless/ralink/rt2x00/Kconfig
  29753. ++++ b/drivers/net/wireless/ralink/rt2x00/Kconfig
  29754. @@ -69,6 +69,7 @@ config RT2800PCI
  29755. select RT2X00_LIB_MMIO
  29756. select RT2X00_LIB_PCI
  29757. @@ -26,7 +26,7 @@
  29758. select RT2800_LIB
  29759. select RT2800_LIB_MMIO
  29760. ---help---
  29761. -@@ -266,6 +268,9 @@ config RT2X00_LIB_FIRMWARE
  29762. +@@ -265,6 +267,9 @@ config RT2X00_LIB_FIRMWARE
  29763. config RT2X00_LIB_CRYPTO
  29764. bool
  29765. @@ -36,8 +36,8 @@
  29766. config RT2X00_LIB_LEDS
  29767. bool
  29768. default y if (RT2X00_LIB=y && LEDS_CLASS=y) || (RT2X00_LIB=m && LEDS_CLASS!=n)
  29769. ---- a/drivers/net/wireless/rt2x00/Makefile
  29770. -+++ b/drivers/net/wireless/rt2x00/Makefile
  29771. +--- a/drivers/net/wireless/ralink/rt2x00/Makefile
  29772. ++++ b/drivers/net/wireless/ralink/rt2x00/Makefile
  29773. @@ -7,6 +7,7 @@ rt2x00lib-$(CPTCFG_RT2X00_LIB_DEBUGFS) +
  29774. rt2x00lib-$(CPTCFG_RT2X00_LIB_CRYPTO) += rt2x00crypto.o
  29775. rt2x00lib-$(CPTCFG_RT2X00_LIB_FIRMWARE) += rt2x00firmware.o
  29776. @@ -46,9 +46,9 @@
  29777. obj-$(CPTCFG_RT2X00_LIB) += rt2x00lib.o
  29778. obj-$(CPTCFG_RT2X00_LIB_MMIO) += rt2x00mmio.o
  29779. ---- a/drivers/net/wireless/rt2x00/rt2800lib.h
  29780. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.h
  29781. -@@ -43,6 +43,8 @@ struct rt2800_drv_data {
  29782. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
  29783. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
  29784. +@@ -46,6 +46,8 @@ struct rt2800_drv_data {
  29785. } shmem_lock;
  29786. };
  29787. @@ -57,7 +57,7 @@
  29788. struct rt2800_ops {
  29789. void (*register_read)(struct rt2x00_dev *rt2x00dev,
  29790. const unsigned int offset, u32 *value);
  29791. -@@ -176,6 +178,15 @@ static inline int rt2800_read_eeprom(str
  29792. +@@ -179,6 +181,15 @@ static inline int rt2800_read_eeprom(str
  29793. {
  29794. const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
  29795. @@ -73,8 +73,8 @@
  29796. return rt2800ops->read_eeprom(rt2x00dev);
  29797. }
  29798. ---- a/drivers/net/wireless/rt2x00/rt2800soc.c
  29799. -+++ b/drivers/net/wireless/rt2x00/rt2800soc.c
  29800. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
  29801. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
  29802. @@ -102,19 +102,6 @@ static int rt2800soc_set_device_state(st
  29803. return retval;
  29804. }
  29805. @@ -103,9 +103,9 @@
  29806. .hwcrypt_disabled = rt2800soc_hwcrypt_disabled,
  29807. .drv_write_firmware = rt2800soc_write_firmware,
  29808. .drv_init_registers = rt2800mmio_init_registers,
  29809. ---- a/drivers/net/wireless/rt2x00/rt2x00.h
  29810. -+++ b/drivers/net/wireless/rt2x00/rt2x00.h
  29811. -@@ -695,6 +695,7 @@ enum rt2x00_capability_flags {
  29812. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  29813. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  29814. +@@ -697,6 +697,7 @@ enum rt2x00_capability_flags {
  29815. REQUIRE_HT_TX_DESC,
  29816. REQUIRE_PS_AUTOWAKE,
  29817. REQUIRE_DELAYED_RFKILL,
  29818. @@ -113,7 +113,7 @@
  29819. /*
  29820. * Capabilities
  29821. -@@ -964,6 +965,11 @@ struct rt2x00_dev {
  29822. +@@ -968,6 +969,11 @@ struct rt2x00_dev {
  29823. const struct firmware *fw;
  29824. /*
  29825. @@ -125,9 +125,9 @@
  29826. * FIFO for storing tx status reports between isr and tasklet.
  29827. */
  29828. DECLARE_KFIFO_PTR(txstatus_fifo, u32);
  29829. ---- a/drivers/net/wireless/rt2x00/rt2x00dev.c
  29830. -+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
  29831. -@@ -1334,6 +1334,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de
  29832. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  29833. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  29834. +@@ -1335,6 +1335,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de
  29835. INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup);
  29836. INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep);
  29837. @@ -138,7 +138,7 @@
  29838. /*
  29839. * Let the driver probe the device to detect the capabilities.
  29840. */
  29841. -@@ -1474,6 +1478,11 @@ void rt2x00lib_remove_dev(struct rt2x00_
  29842. +@@ -1475,6 +1479,11 @@ void rt2x00lib_remove_dev(struct rt2x00_
  29843. * Free the driver data.
  29844. */
  29845. kfree(rt2x00dev->drv_data);
  29846. @@ -151,7 +151,7 @@
  29847. EXPORT_SYMBOL_GPL(rt2x00lib_remove_dev);
  29848. --- /dev/null
  29849. -+++ b/drivers/net/wireless/rt2x00/rt2x00eeprom.c
  29850. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c
  29851. @@ -0,0 +1,111 @@
  29852. +/*
  29853. + Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
  29854. @@ -264,8 +264,8 @@
  29855. + release_firmware(rt2x00dev->eeprom_file);
  29856. + rt2x00dev->eeprom_file = NULL;
  29857. +}
  29858. ---- a/drivers/net/wireless/rt2x00/rt2x00lib.h
  29859. -+++ b/drivers/net/wireless/rt2x00/rt2x00lib.h
  29860. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00lib.h
  29861. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00lib.h
  29862. @@ -320,6 +320,22 @@ static inline void rt2x00lib_free_firmwa
  29863. #endif /* CPTCFG_RT2X00_LIB_FIRMWARE */
  29864. @@ -289,8 +289,8 @@
  29865. * Debugfs handlers.
  29866. */
  29867. #ifdef CPTCFG_RT2X00_LIB_DEBUGFS
  29868. ---- a/drivers/net/wireless/rt2x00/rt2x00soc.c
  29869. -+++ b/drivers/net/wireless/rt2x00/rt2x00soc.c
  29870. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00soc.c
  29871. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00soc.c
  29872. @@ -92,6 +92,7 @@ int rt2x00soc_probe(struct platform_devi
  29873. rt2x00dev->hw = hw;
  29874. rt2x00dev->irq = platform_get_irq(pdev, 0);
  29875. diff --git a/package/kernel/mac80211/patches/604-rt2x00-of_load_eeprom_filename.patch b/package/kernel/mac80211/patches/604-rt2x00-of_load_eeprom_filename.patch
  29876. index 4bc6f37..9dffef1 100644
  29877. --- a/package/kernel/mac80211/patches/604-rt2x00-of_load_eeprom_filename.patch
  29878. +++ b/package/kernel/mac80211/patches/604-rt2x00-of_load_eeprom_filename.patch
  29879. @@ -1,5 +1,5 @@
  29880. ---- a/drivers/net/wireless/rt2x00/rt2x00eeprom.c
  29881. -+++ b/drivers/net/wireless/rt2x00/rt2x00eeprom.c
  29882. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c
  29883. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c
  29884. @@ -26,6 +26,7 @@
  29885. #include <linux/kernel.h>
  29886. diff --git a/package/kernel/mac80211/patches/605-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch b/package/kernel/mac80211/patches/605-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch
  29887. index 75f0415..5dceff8 100644
  29888. --- a/package/kernel/mac80211/patches/605-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch
  29889. +++ b/package/kernel/mac80211/patches/605-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch
  29890. @@ -6,12 +6,12 @@ Subject: [PATCH] rt2x00: load eeprom on SoC from a mtd device defines inside
  29891. Signed-off-by: John Crispin <blogic@openwrt.org>
  29892. ---
  29893. - drivers/net/wireless/rt2x00/Kconfig | 1 +
  29894. - drivers/net/wireless/rt2x00/rt2800pci.c | 44 ++++++++++++++++++++++++++-----
  29895. + drivers/net/wireless/ralink/rt2x00/Kconfig | 1 +
  29896. + drivers/net/wireless/ralink/rt2x00/rt2800pci.c | 44 ++++++++++++++++++++++++++-----
  29897. 2 files changed, 39 insertions(+), 6 deletions(-)
  29898. ---- a/drivers/net/wireless/rt2x00/Kconfig
  29899. -+++ b/drivers/net/wireless/rt2x00/Kconfig
  29900. +--- a/drivers/net/wireless/ralink/rt2x00/Kconfig
  29901. ++++ b/drivers/net/wireless/ralink/rt2x00/Kconfig
  29902. @@ -219,6 +219,7 @@ config RT2800SOC
  29903. select RT2X00_LIB_EEPROM
  29904. select RT2800_LIB
  29905. @@ -20,8 +20,8 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  29906. ---help---
  29907. This adds support for Ralink WiSoC devices.
  29908. Supported chips: RT2880, RT3050, RT3052, RT3350, RT3352.
  29909. ---- a/drivers/net/wireless/rt2x00/rt2x00eeprom.c
  29910. -+++ b/drivers/net/wireless/rt2x00/rt2x00eeprom.c
  29911. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c
  29912. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c
  29913. @@ -26,11 +26,66 @@
  29914. #include <linux/kernel.h>
  29915. @@ -79,7 +79,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  29916. + if (!ret) {
  29917. + rt2x00dev->eeprom_file = &mtd_fw;
  29918. + mtd_fw.size = len;
  29919. -+ mtd_fw.data = rt2x00dev->eeprom;
  29920. ++ mtd_fw.data = (const u8 *) rt2x00dev->eeprom;
  29921. + }
  29922. +#endif
  29923. +
  29924. diff --git a/package/kernel/mac80211/patches/607-rt2x00-allow_disabling_bands_through_platform_data.patch b/package/kernel/mac80211/patches/607-rt2x00-allow_disabling_bands_through_platform_data.patch
  29925. index 70f7b78..d923e05 100644
  29926. --- a/package/kernel/mac80211/patches/607-rt2x00-allow_disabling_bands_through_platform_data.patch
  29927. +++ b/package/kernel/mac80211/patches/607-rt2x00-allow_disabling_bands_through_platform_data.patch
  29928. @@ -10,8 +10,8 @@
  29929. };
  29930. #endif /* _RT2X00_PLATFORM_H */
  29931. ---- a/drivers/net/wireless/rt2x00/rt2x00dev.c
  29932. -+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
  29933. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  29934. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  29935. @@ -940,6 +940,22 @@ static int rt2x00lib_probe_hw_modes(stru
  29936. unsigned int num_rates;
  29937. unsigned int i;
  29938. @@ -35,9 +35,9 @@
  29939. num_rates = 0;
  29940. if (spec->supported_rates & SUPPORT_RATE_CCK)
  29941. num_rates += 4;
  29942. ---- a/drivers/net/wireless/rt2x00/rt2x00.h
  29943. -+++ b/drivers/net/wireless/rt2x00/rt2x00.h
  29944. -@@ -403,6 +403,7 @@ struct hw_mode_spec {
  29945. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  29946. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  29947. +@@ -405,6 +405,7 @@ struct hw_mode_spec {
  29948. unsigned int supported_bands;
  29949. #define SUPPORT_BAND_2GHZ 0x00000001
  29950. #define SUPPORT_BAND_5GHZ 0x00000002
  29951. 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
  29952. index a35bd55..a645ba1 100644
  29953. --- a/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch
  29954. +++ b/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch
  29955. @@ -8,8 +8,8 @@
  29956. int disable_2ghz;
  29957. int disable_5ghz;
  29958. ---- a/drivers/net/wireless/rt2x00/rt2x00dev.c
  29959. -+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
  29960. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  29961. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  29962. @@ -931,6 +931,18 @@ static void rt2x00lib_rate(struct ieee80
  29963. entry->flags |= IEEE80211_RATE_SHORT_PREAMBLE;
  29964. }
  29965. @@ -29,9 +29,9 @@
  29966. static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev,
  29967. struct hw_mode_spec *spec)
  29968. {
  29969. ---- a/drivers/net/wireless/rt2x00/rt2x00.h
  29970. -+++ b/drivers/net/wireless/rt2x00/rt2x00.h
  29971. -@@ -1410,6 +1410,7 @@ static inline void rt2x00debug_dump_fram
  29972. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  29973. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  29974. +@@ -1414,6 +1414,7 @@ static inline void rt2x00debug_dump_fram
  29975. */
  29976. u32 rt2x00lib_get_bssidx(struct rt2x00_dev *rt2x00dev,
  29977. struct ieee80211_vif *vif);
  29978. @@ -39,8 +39,8 @@
  29979. /*
  29980. * Interrupt context handlers.
  29981. ---- a/drivers/net/wireless/rt2x00/rt61pci.c
  29982. -+++ b/drivers/net/wireless/rt2x00/rt61pci.c
  29983. +--- a/drivers/net/wireless/ralink/rt2x00/rt61pci.c
  29984. ++++ b/drivers/net/wireless/ralink/rt2x00/rt61pci.c
  29985. @@ -2392,6 +2392,7 @@ static int rt61pci_validate_eeprom(struc
  29986. u32 reg;
  29987. u16 word;
  29988. diff --git a/package/kernel/mac80211/patches/609-rt2x00-allow_disabling_bands_through_dts.patch b/package/kernel/mac80211/patches/609-rt2x00-allow_disabling_bands_through_dts.patch
  29989. index 63a8641..3fdaae7 100644
  29990. --- a/package/kernel/mac80211/patches/609-rt2x00-allow_disabling_bands_through_dts.patch
  29991. +++ b/package/kernel/mac80211/patches/609-rt2x00-allow_disabling_bands_through_dts.patch
  29992. @@ -1,5 +1,5 @@
  29993. ---- a/drivers/net/wireless/rt2x00/rt2x00dev.c
  29994. -+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
  29995. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  29996. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  29997. @@ -26,6 +26,7 @@
  29998. #include <linux/module.h>
  29999. #include <linux/slab.h>
  30000. 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
  30001. index 067d2ea..c69d330 100644
  30002. --- a/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
  30003. +++ b/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
  30004. @@ -1,6 +1,6 @@
  30005. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  30006. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  30007. -@@ -3552,11 +3552,18 @@ static void rt2800_config_channel(struct
  30008. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30009. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30010. +@@ -3529,11 +3529,18 @@ static void rt2800_config_channel(struct
  30011. /*
  30012. * Change BBP settings
  30013. */
  30014. @@ -19,7 +19,7 @@
  30015. } else if (rt2x00_rt(rt2x00dev, RT3593)) {
  30016. if (rf->channel > 14) {
  30017. /* Disable CCK Packet detection on 5GHz */
  30018. -@@ -6618,6 +6625,12 @@ static void rt2800_init_rfcsr_3290(struc
  30019. +@@ -6595,6 +6602,12 @@ static void rt2800_init_rfcsr_3290(struc
  30020. static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev)
  30021. {
  30022. @@ -32,7 +32,7 @@
  30023. rt2800_rf_init_calibration(rt2x00dev, 30);
  30024. rt2800_rfcsr_write(rt2x00dev, 0, 0xf0);
  30025. -@@ -6653,15 +6666,30 @@ static void rt2800_init_rfcsr_3352(struc
  30026. +@@ -6630,15 +6643,30 @@ static void rt2800_init_rfcsr_3352(struc
  30027. rt2800_rfcsr_write(rt2x00dev, 31, 0x80);
  30028. rt2800_rfcsr_write(rt2x00dev, 32, 0x80);
  30029. rt2800_rfcsr_write(rt2x00dev, 33, 0x00);
  30030. @@ -66,7 +66,7 @@
  30031. rt2800_rfcsr_write(rt2x00dev, 43, 0xdb);
  30032. rt2800_rfcsr_write(rt2x00dev, 44, 0xdb);
  30033. rt2800_rfcsr_write(rt2x00dev, 45, 0xdb);
  30034. -@@ -6669,15 +6697,20 @@ static void rt2800_init_rfcsr_3352(struc
  30035. +@@ -6646,15 +6674,20 @@ static void rt2800_init_rfcsr_3352(struc
  30036. rt2800_rfcsr_write(rt2x00dev, 47, 0x0d);
  30037. rt2800_rfcsr_write(rt2x00dev, 48, 0x14);
  30038. rt2800_rfcsr_write(rt2x00dev, 49, 0x00);
  30039. @@ -96,7 +96,7 @@
  30040. rt2800_rfcsr_write(rt2x00dev, 59, 0x00);
  30041. rt2800_rfcsr_write(rt2x00dev, 60, 0x00);
  30042. rt2800_rfcsr_write(rt2x00dev, 61, 0x00);
  30043. -@@ -7698,6 +7731,7 @@ static int rt2800_init_eeprom(struct rt2
  30044. +@@ -7675,6 +7708,7 @@ static int rt2800_init_eeprom(struct rt2
  30045. * RT53xx: defined in "EEPROM_CHIP_ID" field
  30046. */
  30047. if (rt2x00_rt(rt2x00dev, RT3290) ||
  30048. @@ -104,7 +104,7 @@
  30049. rt2x00_rt(rt2x00dev, RT5390) ||
  30050. rt2x00_rt(rt2x00dev, RT5392))
  30051. rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &rf);
  30052. -@@ -7793,7 +7827,8 @@ static int rt2800_init_eeprom(struct rt2
  30053. +@@ -7770,7 +7804,8 @@ static int rt2800_init_eeprom(struct rt2
  30054. /*
  30055. * Detect if this device has Bluetooth co-existence.
  30056. */
  30057. @@ -114,7 +114,7 @@
  30058. __set_bit(CAPABILITY_BT_COEXIST, &rt2x00dev->cap_flags);
  30059. /*
  30060. -@@ -7822,6 +7857,22 @@ static int rt2800_init_eeprom(struct rt2
  30061. +@@ -7799,6 +7834,22 @@ static int rt2800_init_eeprom(struct rt2
  30062. EIRP_MAX_TX_POWER_LIMIT)
  30063. __set_bit(CAPABILITY_POWER_LIMIT, &rt2x00dev->cap_flags);
  30064. @@ -137,8 +137,8 @@
  30065. return 0;
  30066. }
  30067. ---- a/drivers/net/wireless/rt2x00/rt2800.h
  30068. -+++ b/drivers/net/wireless/rt2x00/rt2800.h
  30069. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
  30070. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
  30071. @@ -2335,6 +2335,12 @@ struct mac_iveiv_entry {
  30072. #define RFCSR36_RF_BS FIELD8(0x80)
  30073. @@ -198,9 +198,9 @@
  30074. /*
  30075. * EEPROM frequency
  30076. ---- a/drivers/net/wireless/rt2x00/rt2x00.h
  30077. -+++ b/drivers/net/wireless/rt2x00/rt2x00.h
  30078. -@@ -715,6 +715,8 @@ enum rt2x00_capability_flags {
  30079. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  30080. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  30081. +@@ -717,6 +717,8 @@ enum rt2x00_capability_flags {
  30082. CAPABILITY_DOUBLE_ANTENNA,
  30083. CAPABILITY_BT_COEXIST,
  30084. CAPABILITY_VCO_RECALIBRATION,
  30085. 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
  30086. index 1dcca36..b44fe90 100644
  30087. --- a/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
  30088. +++ b/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
  30089. @@ -1,6 +1,6 @@
  30090. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  30091. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  30092. -@@ -8209,6 +8209,27 @@ static const struct rf_channel rf_vals_5
  30093. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30094. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30095. +@@ -8186,6 +8186,27 @@ static const struct rf_channel rf_vals_5
  30096. {196, 83, 0, 12, 1},
  30097. };
  30098. @@ -28,7 +28,7 @@
  30099. static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
  30100. {
  30101. struct hw_mode_spec *spec = &rt2x00dev->spec;
  30102. -@@ -8297,7 +8318,10 @@ static int rt2800_probe_hw_mode(struct r
  30103. +@@ -8272,7 +8293,10 @@ static int rt2800_probe_hw_mode(struct r
  30104. case RF5390:
  30105. case RF5392:
  30106. spec->num_channels = 14;
  30107. @@ -40,7 +40,7 @@
  30108. break;
  30109. case RF3052:
  30110. -@@ -8481,6 +8505,19 @@ static int rt2800_probe_rt(struct rt2x00
  30111. +@@ -8456,6 +8480,19 @@ static int rt2800_probe_rt(struct rt2x00
  30112. return 0;
  30113. }
  30114. @@ -60,7 +60,7 @@
  30115. int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
  30116. {
  30117. struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
  30118. -@@ -8523,6 +8560,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  30119. +@@ -8498,6 +8535,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  30120. rt2800_register_write(rt2x00dev, GPIO_CTRL, reg);
  30121. /*
  30122. @@ -76,9 +76,9 @@
  30123. * Initialize hw specifications.
  30124. */
  30125. retval = rt2800_probe_hw_mode(rt2x00dev);
  30126. ---- a/drivers/net/wireless/rt2x00/rt2x00.h
  30127. -+++ b/drivers/net/wireless/rt2x00/rt2x00.h
  30128. -@@ -398,6 +398,7 @@ static inline struct rt2x00_intf* vif_to
  30129. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  30130. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  30131. +@@ -400,6 +400,7 @@ static inline struct rt2x00_intf* vif_to
  30132. * @channels: Device/chipset specific channel values (See &struct rf_channel).
  30133. * @channels_info: Additional information for channels (See &struct channel_info).
  30134. * @ht: Driver HT Capabilities (See &ieee80211_sta_ht_cap).
  30135. @@ -86,7 +86,7 @@
  30136. */
  30137. struct hw_mode_spec {
  30138. unsigned int supported_bands;
  30139. -@@ -414,6 +415,7 @@ struct hw_mode_spec {
  30140. +@@ -416,6 +417,7 @@ struct hw_mode_spec {
  30141. const struct channel_info *channels_info;
  30142. struct ieee80211_sta_ht_cap ht;
  30143. diff --git a/package/kernel/mac80211/patches/612-rt2x00-make-wmac-loadable-via-OF-on-rt288x-305x-SoC.patch b/package/kernel/mac80211/patches/612-rt2x00-make-wmac-loadable-via-OF-on-rt288x-305x-SoC.patch
  30144. index 1970efc..e4b028b 100644
  30145. --- a/package/kernel/mac80211/patches/612-rt2x00-make-wmac-loadable-via-OF-on-rt288x-305x-SoC.patch
  30146. +++ b/package/kernel/mac80211/patches/612-rt2x00-make-wmac-loadable-via-OF-on-rt288x-305x-SoC.patch
  30147. @@ -8,11 +8,11 @@ devicetree.
  30148. Signed-off-by: John Crispin <blogic@openwrt.org>
  30149. ---
  30150. - drivers/net/wireless/rt2x00/rt2800pci.c | 7 +++++++
  30151. + drivers/net/wireless/ralink/rt2x00/rt2800pci.c | 7 +++++++
  30152. 1 file changed, 7 insertions(+)
  30153. ---- a/drivers/net/wireless/rt2x00/rt2800soc.c
  30154. -+++ b/drivers/net/wireless/rt2x00/rt2800soc.c
  30155. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
  30156. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
  30157. @@ -237,10 +237,17 @@ static int rt2800soc_probe(struct platfo
  30158. return rt2x00soc_probe(pdev, &rt2800soc_ops);
  30159. }
  30160. diff --git a/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch b/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  30161. index c779a17..8e3bd2a 100644
  30162. --- a/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  30163. +++ b/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  30164. @@ -1,5 +1,5 @@
  30165. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  30166. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  30167. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30168. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30169. @@ -36,6 +36,7 @@
  30170. #include <linux/kernel.h>
  30171. #include <linux/module.h>
  30172. @@ -8,7 +8,7 @@
  30173. #include "rt2x00.h"
  30174. #include "rt2800lib.h"
  30175. -@@ -8507,13 +8508,14 @@ static int rt2800_probe_rt(struct rt2x00
  30176. +@@ -8482,13 +8483,14 @@ static int rt2800_probe_rt(struct rt2x00
  30177. int rt2800_probe_clk(struct rt2x00_dev *rt2x00dev)
  30178. {
  30179. diff --git a/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch b/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  30180. index 840b3bc..faa5879 100644
  30181. --- a/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  30182. +++ b/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  30183. @@ -1,5 +1,5 @@
  30184. ---- a/drivers/net/wireless/rt2x00/rt2800.h
  30185. -+++ b/drivers/net/wireless/rt2x00/rt2800.h
  30186. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
  30187. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
  30188. @@ -74,6 +74,7 @@
  30189. #define RF3070 0x3070
  30190. #define RF3290 0x3290
  30191. @@ -8,9 +8,9 @@
  30192. #define RF5360 0x5360
  30193. #define RF5362 0x5362
  30194. #define RF5370 0x5370
  30195. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  30196. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  30197. -@@ -3038,6 +3038,13 @@ static void rt2800_config_channel_rf53xx
  30198. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30199. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30200. +@@ -3015,6 +3015,13 @@ static void rt2800_config_channel_rf53xx
  30201. rt2800_rfcsr_write(rt2x00dev, 59,
  30202. r59_non_bt[idx]);
  30203. @@ -24,7 +24,7 @@
  30204. }
  30205. }
  30206. }
  30207. -@@ -3516,6 +3523,7 @@ static void rt2800_config_channel(struct
  30208. +@@ -3493,6 +3500,7 @@ static void rt2800_config_channel(struct
  30209. rt2800_config_channel_rf3853(rt2x00dev, conf, rf, info);
  30210. break;
  30211. case RF3070:
  30212. @@ -32,7 +32,7 @@
  30213. case RF5360:
  30214. case RF5362:
  30215. case RF5370:
  30216. -@@ -3534,6 +3542,7 @@ static void rt2800_config_channel(struct
  30217. +@@ -3511,6 +3519,7 @@ static void rt2800_config_channel(struct
  30218. if (rt2x00_rf(rt2x00dev, RF3070) ||
  30219. rt2x00_rf(rt2x00dev, RF3290) ||
  30220. rt2x00_rf(rt2x00dev, RF3322) ||
  30221. @@ -40,7 +40,7 @@
  30222. rt2x00_rf(rt2x00dev, RF5360) ||
  30223. rt2x00_rf(rt2x00dev, RF5362) ||
  30224. rt2x00_rf(rt2x00dev, RF5370) ||
  30225. -@@ -3812,7 +3821,8 @@ static void rt2800_config_channel(struct
  30226. +@@ -3789,7 +3798,8 @@ static void rt2800_config_channel(struct
  30227. /*
  30228. * Clear update flag
  30229. */
  30230. @@ -50,7 +50,7 @@
  30231. rt2800_bbp_read(rt2x00dev, 49, &bbp);
  30232. rt2x00_set_field8(&bbp, BBP49_UPDATE_FLAG, 0);
  30233. rt2800_bbp_write(rt2x00dev, 49, bbp);
  30234. -@@ -4698,6 +4708,7 @@ void rt2800_vco_calibration(struct rt2x0
  30235. +@@ -4675,6 +4685,7 @@ void rt2800_vco_calibration(struct rt2x0
  30236. case RF3070:
  30237. case RF3290:
  30238. case RF3853:
  30239. @@ -58,7 +58,7 @@
  30240. case RF5360:
  30241. case RF5362:
  30242. case RF5370:
  30243. -@@ -5111,6 +5122,8 @@ static int rt2800_init_registers(struct
  30244. +@@ -5088,6 +5099,8 @@ static int rt2800_init_registers(struct
  30245. rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
  30246. rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);
  30247. rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000);
  30248. @@ -67,7 +67,7 @@
  30249. } else {
  30250. rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000000);
  30251. rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);
  30252. -@@ -5766,9 +5779,13 @@ static void rt2800_init_bbp_3352(struct
  30253. +@@ -5743,9 +5756,13 @@ static void rt2800_init_bbp_3352(struct
  30254. rt2800_bbp_write(rt2x00dev, 82, 0x62);
  30255. @@ -84,7 +84,7 @@
  30256. rt2800_bbp_write(rt2x00dev, 86, 0x38);
  30257. -@@ -5782,9 +5799,13 @@ static void rt2800_init_bbp_3352(struct
  30258. +@@ -5759,9 +5776,13 @@ static void rt2800_init_bbp_3352(struct
  30259. rt2800_bbp_write(rt2x00dev, 104, 0x92);
  30260. @@ -101,7 +101,7 @@
  30261. rt2800_bbp_write(rt2x00dev, 120, 0x50);
  30262. -@@ -5809,6 +5830,13 @@ static void rt2800_init_bbp_3352(struct
  30263. +@@ -5786,6 +5807,13 @@ static void rt2800_init_bbp_3352(struct
  30264. rt2800_bbp_write(rt2x00dev, 143, 0xa2);
  30265. rt2800_bbp_write(rt2x00dev, 148, 0xc8);
  30266. @@ -115,7 +115,7 @@
  30267. }
  30268. static void rt2800_init_bbp_3390(struct rt2x00_dev *rt2x00dev)
  30269. -@@ -6150,6 +6178,7 @@ static void rt2800_init_bbp(struct rt2x0
  30270. +@@ -6127,6 +6155,7 @@ static void rt2800_init_bbp(struct rt2x0
  30271. rt2800_init_bbp_3290(rt2x00dev);
  30272. break;
  30273. case RT3352:
  30274. @@ -123,7 +123,7 @@
  30275. rt2800_init_bbp_3352(rt2x00dev);
  30276. break;
  30277. case RT3390:
  30278. -@@ -7101,6 +7130,76 @@ static void rt2800_init_rfcsr_3883(struc
  30279. +@@ -7078,6 +7107,76 @@ static void rt2800_init_rfcsr_3883(struc
  30280. rt2800_rfcsr_write(rt2x00dev, 20, rfcsr);
  30281. }
  30282. @@ -200,7 +200,7 @@
  30283. static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
  30284. {
  30285. rt2800_rf_init_calibration(rt2x00dev, 2);
  30286. -@@ -7341,6 +7440,9 @@ static void rt2800_init_rfcsr(struct rt2
  30287. +@@ -7318,6 +7417,9 @@ static void rt2800_init_rfcsr(struct rt2
  30288. case RT3593:
  30289. rt2800_init_rfcsr_3593(rt2x00dev);
  30290. break;
  30291. @@ -210,7 +210,7 @@
  30292. case RT5390:
  30293. rt2800_init_rfcsr_5390(rt2x00dev);
  30294. break;
  30295. -@@ -7600,6 +7702,12 @@ static int rt2800_validate_eeprom(struct
  30296. +@@ -7577,6 +7679,12 @@ static int rt2800_validate_eeprom(struct
  30297. rt2x00_set_field16(&word, EEPROM_NIC_CONF0_RF_TYPE, RF2820);
  30298. rt2800_eeprom_write(rt2x00dev, EEPROM_NIC_CONF0, word);
  30299. rt2x00_eeprom_dbg(rt2x00dev, "Antenna: 0x%04x\n", word);
  30300. @@ -223,7 +223,7 @@
  30301. } else if (rt2x00_rt(rt2x00dev, RT2860) ||
  30302. rt2x00_rt(rt2x00dev, RT2872)) {
  30303. /*
  30304. -@@ -7738,6 +7846,8 @@ static int rt2800_init_eeprom(struct rt2
  30305. +@@ -7715,6 +7823,8 @@ static int rt2800_init_eeprom(struct rt2
  30306. rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &rf);
  30307. else if (rt2x00_rt(rt2x00dev, RT3883))
  30308. rf = RF3853;
  30309. @@ -232,7 +232,7 @@
  30310. else
  30311. rf = rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RF_TYPE);
  30312. -@@ -7757,6 +7867,7 @@ static int rt2800_init_eeprom(struct rt2
  30313. +@@ -7734,6 +7844,7 @@ static int rt2800_init_eeprom(struct rt2
  30314. case RF3320:
  30315. case RF3322:
  30316. case RF3853:
  30317. @@ -240,7 +240,7 @@
  30318. case RF5360:
  30319. case RF5362:
  30320. case RF5370:
  30321. -@@ -8312,6 +8423,7 @@ static int rt2800_probe_hw_mode(struct r
  30322. +@@ -8287,6 +8398,7 @@ static int rt2800_probe_hw_mode(struct r
  30323. case RF3290:
  30324. case RF3320:
  30325. case RF3322:
  30326. @@ -248,7 +248,7 @@
  30327. case RF5360:
  30328. case RF5362:
  30329. case RF5370:
  30330. -@@ -8451,6 +8563,7 @@ static int rt2800_probe_hw_mode(struct r
  30331. +@@ -8426,6 +8538,7 @@ static int rt2800_probe_hw_mode(struct r
  30332. case RF3070:
  30333. case RF3290:
  30334. case RF3853:
  30335. @@ -256,7 +256,7 @@
  30336. case RF5360:
  30337. case RF5362:
  30338. case RF5370:
  30339. -@@ -8491,6 +8604,7 @@ static int rt2800_probe_rt(struct rt2x00
  30340. +@@ -8466,6 +8579,7 @@ static int rt2800_probe_rt(struct rt2x00
  30341. case RT3572:
  30342. case RT3593:
  30343. case RT3883:
  30344. @@ -264,8 +264,8 @@
  30345. case RT5390:
  30346. case RT5392:
  30347. case RT5592:
  30348. ---- a/drivers/net/wireless/rt2x00/rt2x00.h
  30349. -+++ b/drivers/net/wireless/rt2x00/rt2x00.h
  30350. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  30351. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  30352. @@ -169,6 +169,7 @@ struct rt2x00_chip {
  30353. #define RT3572 0x3572
  30354. #define RT3593 0x3593
  30355. 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
  30356. index 13f2048..6094a61 100644
  30357. --- a/package/kernel/mac80211/patches/619-rt2x00-change-led-polarity-from-OF.patch
  30358. +++ b/package/kernel/mac80211/patches/619-rt2x00-change-led-polarity-from-OF.patch
  30359. @@ -1,5 +1,5 @@
  30360. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  30361. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  30362. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30363. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30364. @@ -37,6 +37,7 @@
  30365. #include <linux/module.h>
  30366. #include <linux/slab.h>
  30367. @@ -8,7 +8,7 @@
  30368. #include "rt2x00.h"
  30369. #include "rt2800lib.h"
  30370. -@@ -7957,6 +7958,17 @@ static int rt2800_init_eeprom(struct rt2
  30371. +@@ -7934,6 +7935,17 @@ static int rt2800_init_eeprom(struct rt2
  30372. rt2800_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC);
  30373. rt2800_init_led(rt2x00dev, &rt2x00dev->led_qual, LED_TYPE_QUALITY);
  30374. @@ -26,8 +26,8 @@
  30375. rt2x00dev->led_mcu_reg = eeprom;
  30376. #endif /* CPTCFG_RT2X00_LIB_LEDS */
  30377. ---- a/drivers/net/wireless/rt2x00/rt2x00leds.c
  30378. -+++ b/drivers/net/wireless/rt2x00/rt2x00leds.c
  30379. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00leds.c
  30380. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00leds.c
  30381. @@ -109,6 +109,9 @@ static int rt2x00leds_register_led(struc
  30382. led->led_dev.name = name;
  30383. led->led_dev.brightness = LED_OFF;
  30384. diff --git a/package/kernel/mac80211/patches/620-rt2x00-add-AP+STA-support.patch b/package/kernel/mac80211/patches/620-rt2x00-add-AP+STA-support.patch
  30385. index 2dbfd10..55452b9 100644
  30386. --- a/package/kernel/mac80211/patches/620-rt2x00-add-AP+STA-support.patch
  30387. +++ b/package/kernel/mac80211/patches/620-rt2x00-add-AP+STA-support.patch
  30388. @@ -1,6 +1,6 @@
  30389. ---- a/drivers/net/wireless/rt2x00/rt2x00dev.c
  30390. -+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
  30391. -@@ -1283,7 +1283,7 @@ static inline void rt2x00lib_set_if_comb
  30392. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  30393. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  30394. +@@ -1284,7 +1284,7 @@ static inline void rt2x00lib_set_if_comb
  30395. */
  30396. if_limit = &rt2x00dev->if_limits_ap;
  30397. if_limit->max = rt2x00dev->ops->max_ap_intf;
  30398. diff --git a/package/kernel/mac80211/patches/620-rt2x00-rt3352-rf-id.patch b/package/kernel/mac80211/patches/620-rt2x00-rt3352-rf-id.patch
  30399. index aaa8367..8ddf425 100644
  30400. --- a/package/kernel/mac80211/patches/620-rt2x00-rt3352-rf-id.patch
  30401. +++ b/package/kernel/mac80211/patches/620-rt2x00-rt3352-rf-id.patch
  30402. @@ -1,6 +1,6 @@
  30403. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  30404. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  30405. -@@ -7841,10 +7841,11 @@ static int rt2800_init_eeprom(struct rt2
  30406. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30407. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30408. +@@ -7818,10 +7818,11 @@ static int rt2800_init_eeprom(struct rt2
  30409. * RT53xx: defined in "EEPROM_CHIP_ID" field
  30410. */
  30411. if (rt2x00_rt(rt2x00dev, RT3290) ||
  30412. diff --git a/package/kernel/mac80211/patches/621-rt2x00-ht20_40_fix.patch b/package/kernel/mac80211/patches/621-rt2x00-ht20_40_fix.patch
  30413. index bb2fc1c..e3e4c98 100644
  30414. --- a/package/kernel/mac80211/patches/621-rt2x00-ht20_40_fix.patch
  30415. +++ b/package/kernel/mac80211/patches/621-rt2x00-ht20_40_fix.patch
  30416. @@ -1,5 +1,5 @@
  30417. ---- a/drivers/net/wireless/rt2x00/rt2800.h
  30418. -+++ b/drivers/net/wireless/rt2x00/rt2800.h
  30419. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
  30420. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
  30421. @@ -2321,6 +2321,8 @@ struct mac_iveiv_entry {
  30422. #define RFCSR30_RX_H20M FIELD8(0x04)
  30423. #define RFCSR30_RX_VCM FIELD8(0x18)
  30424. @@ -9,9 +9,9 @@
  30425. /*
  30426. * RFCSR 31:
  30427. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  30428. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  30429. -@@ -3551,8 +3551,13 @@ static void rt2800_config_channel(struct
  30430. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30431. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30432. +@@ -3528,8 +3528,13 @@ static void rt2800_config_channel(struct
  30433. rt2x00_rf(rt2x00dev, RF5390) ||
  30434. rt2x00_rf(rt2x00dev, RF5392)) {
  30435. rt2800_rfcsr_read(rt2x00dev, 30, &rfcsr);
  30436. diff --git a/package/kernel/mac80211/patches/622-rt2x00-fix-beacon-bit-balance.patch b/package/kernel/mac80211/patches/622-rt2x00-fix-beacon-bit-balance.patch
  30437. new file mode 100644
  30438. index 0000000..3cf6268
  30439. --- /dev/null
  30440. +++ b/package/kernel/mac80211/patches/622-rt2x00-fix-beacon-bit-balance.patch
  30441. @@ -0,0 +1,47 @@
  30442. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
  30443. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
  30444. +@@ -627,12 +627,8 @@ void rt2x00mac_bss_info_changed(struct i
  30445. + } else if (bss_conf->enable_beacon && !intf->enable_beacon) {
  30446. + rt2x00dev->intf_beaconing++;
  30447. + intf->enable_beacon = true;
  30448. +- /*
  30449. +- * Upload beacon to the H/W. This is only required on
  30450. +- * USB devices. PCI devices fetch beacons periodically.
  30451. +- */
  30452. +- if (rt2x00_is_usb(rt2x00dev))
  30453. +- rt2x00queue_update_beacon(rt2x00dev, vif);
  30454. ++
  30455. ++ rt2x00queue_update_beacon(rt2x00dev, vif);
  30456. +
  30457. + if (rt2x00dev->intf_beaconing == 1) {
  30458. + /*
  30459. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  30460. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  30461. +@@ -144,7 +144,8 @@ static void rt2x00lib_intf_scheduled_ite
  30462. +
  30463. + if (test_and_clear_bit(DELAYED_UPDATE_BEACON, &intf->delayed_flags)) {
  30464. + mutex_lock(&intf->beacon_skb_mutex);
  30465. +- rt2x00queue_update_beacon(rt2x00dev, vif);
  30466. ++ if (intf->enable_beacon)
  30467. ++ rt2x00queue_update_beacon(rt2x00dev, vif);
  30468. + mutex_unlock(&intf->beacon_skb_mutex);
  30469. + }
  30470. + }
  30471. +@@ -207,6 +208,7 @@ static void rt2x00lib_beaconupdate_iter(
  30472. + struct ieee80211_vif *vif)
  30473. + {
  30474. + struct rt2x00_dev *rt2x00dev = data;
  30475. ++ struct rt2x00_intf *intf = vif_to_intf(vif);
  30476. +
  30477. + if (vif->type != NL80211_IFTYPE_AP &&
  30478. + vif->type != NL80211_IFTYPE_ADHOC &&
  30479. +@@ -220,7 +222,8 @@ static void rt2x00lib_beaconupdate_iter(
  30480. + * never be called for USB devices.
  30481. + */
  30482. + WARN_ON(rt2x00_is_usb(rt2x00dev));
  30483. +- rt2x00queue_update_beacon(rt2x00dev, vif);
  30484. ++ if (intf->enable_beacon)
  30485. ++ rt2x00queue_update_beacon(rt2x00dev, vif);
  30486. + }
  30487. +
  30488. + void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev)
  30489. diff --git a/package/kernel/mac80211/patches/700-mwl8k-missing-pci-id-for-WNR854T.patch b/package/kernel/mac80211/patches/700-mwl8k-missing-pci-id-for-WNR854T.patch
  30490. index f2a7663..a901a44 100644
  30491. --- a/package/kernel/mac80211/patches/700-mwl8k-missing-pci-id-for-WNR854T.patch
  30492. +++ b/package/kernel/mac80211/patches/700-mwl8k-missing-pci-id-for-WNR854T.patch
  30493. @@ -1,6 +1,6 @@
  30494. ---- a/drivers/net/wireless/mwl8k.c
  30495. -+++ b/drivers/net/wireless/mwl8k.c
  30496. -@@ -5678,6 +5678,7 @@ MODULE_FIRMWARE("mwl8k/fmimage_8366.fw")
  30497. +--- a/drivers/net/wireless/marvell/mwl8k.c
  30498. ++++ b/drivers/net/wireless/marvell/mwl8k.c
  30499. +@@ -5681,6 +5681,7 @@ MODULE_FIRMWARE("mwl8k/fmimage_8366.fw")
  30500. MODULE_FIRMWARE(MWL8K_8366_AP_FW(MWL8K_8366_AP_FW_API));
  30501. static const struct pci_device_id mwl8k_pci_id_table[] = {
  30502. diff --git a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  30503. index 9e29034..fd885cc 100644
  30504. --- a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  30505. +++ b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  30506. @@ -1,5 +1,5 @@
  30507. ---- a/drivers/net/wireless/libertas/cfg.c
  30508. -+++ b/drivers/net/wireless/libertas/cfg.c
  30509. +--- a/drivers/net/wireless/marvell/libertas/cfg.c
  30510. ++++ b/drivers/net/wireless/marvell/libertas/cfg.c
  30511. @@ -2084,6 +2084,8 @@ struct wireless_dev *lbs_cfg_alloc(struc
  30512. goto err_wiphy_new;
  30513. }
  30514. @@ -9,8 +9,8 @@
  30515. lbs_deb_leave(LBS_DEB_CFG80211);
  30516. return wdev;
  30517. ---- a/drivers/net/wireless/libertas/main.c
  30518. -+++ b/drivers/net/wireless/libertas/main.c
  30519. +--- a/drivers/net/wireless/marvell/libertas/main.c
  30520. ++++ b/drivers/net/wireless/marvell/libertas/main.c
  30521. @@ -987,6 +987,7 @@ struct lbs_private *lbs_add_card(void *c
  30522. goto err_adapter;
  30523. }
  30524. diff --git a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  30525. index 252fa81..b67a95f 100644
  30526. --- a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  30527. +++ b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  30528. @@ -1,5 +1,5 @@
  30529. ---- a/drivers/net/wireless/libertas/cfg.c
  30530. -+++ b/drivers/net/wireless/libertas/cfg.c
  30531. +--- a/drivers/net/wireless/marvell/libertas/cfg.c
  30532. ++++ b/drivers/net/wireless/marvell/libertas/cfg.c
  30533. @@ -2174,6 +2174,8 @@ int lbs_cfg_register(struct lbs_private
  30534. wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  30535. wdev->wiphy->reg_notifier = lbs_reg_notifier;
  30536. diff --git a/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch b/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch
  30537. new file mode 100644
  30538. index 0000000..74cd448
  30539. --- /dev/null
  30540. +++ b/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch
  30541. @@ -0,0 +1,17 @@
  30542. +--- a/drivers/net/wireless/broadcom/b43/main.c
  30543. ++++ b/drivers/net/wireless/broadcom/b43/main.c
  30544. +@@ -1215,10 +1215,10 @@ void b43_wireless_core_phy_pll_reset(str
  30545. + case B43_BUS_BCMA:
  30546. + bcma_cc = &dev->dev->bdev->bus->drv_cc;
  30547. +
  30548. +- bcma_cc_write32(bcma_cc, BCMA_CC_CHIPCTL_ADDR, 0);
  30549. +- bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4);
  30550. +- bcma_cc_set32(bcma_cc, BCMA_CC_CHIPCTL_DATA, 0x4);
  30551. +- bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4);
  30552. ++ bcma_cc_write32(bcma_cc, BCMA_CC_PMU_CHIPCTL_ADDR, 0);
  30553. ++ bcma_cc_mask32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, ~0x4);
  30554. ++ bcma_cc_set32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, 0x4);
  30555. ++ bcma_cc_mask32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, ~0x4);
  30556. + break;
  30557. + #endif
  30558. + #ifdef CPTCFG_B43_SSB
  30559. diff --git a/package/kernel/mac80211/patches/805-b43-gpio-mask-module-option.patch b/package/kernel/mac80211/patches/805-b43-gpio-mask-module-option.patch
  30560. index 95867ef..fd9e6fd 100644
  30561. --- a/package/kernel/mac80211/patches/805-b43-gpio-mask-module-option.patch
  30562. +++ b/package/kernel/mac80211/patches/805-b43-gpio-mask-module-option.patch
  30563. @@ -1,5 +1,5 @@
  30564. ---- a/drivers/net/wireless/b43/b43.h
  30565. -+++ b/drivers/net/wireless/b43/b43.h
  30566. +--- a/drivers/net/wireless/broadcom/b43/b43.h
  30567. ++++ b/drivers/net/wireless/broadcom/b43/b43.h
  30568. @@ -839,6 +839,7 @@ struct b43_wldev {
  30569. bool qos_enabled; /* TRUE, if QoS is used. */
  30570. bool hwcrypto_enabled; /* TRUE, if HW crypto acceleration is enabled. */
  30571. @@ -8,9 +8,9 @@
  30572. /* PHY/Radio device. */
  30573. struct b43_phy phy;
  30574. ---- a/drivers/net/wireless/b43/main.c
  30575. -+++ b/drivers/net/wireless/b43/main.c
  30576. -@@ -76,6 +76,11 @@ MODULE_FIRMWARE("b43/ucode16_mimo.fw");
  30577. +--- a/drivers/net/wireless/broadcom/b43/main.c
  30578. ++++ b/drivers/net/wireless/broadcom/b43/main.c
  30579. +@@ -75,6 +75,11 @@ MODULE_FIRMWARE("b43/ucode16_mimo.fw");
  30580. MODULE_FIRMWARE("b43/ucode5.fw");
  30581. MODULE_FIRMWARE("b43/ucode9.fw");
  30582. diff --git a/package/kernel/mac80211/patches/810-b43_no_pio.patch b/package/kernel/mac80211/patches/810-b43_no_pio.patch
  30583. index 0979100..79428c2 100644
  30584. --- a/package/kernel/mac80211/patches/810-b43_no_pio.patch
  30585. +++ b/package/kernel/mac80211/patches/810-b43_no_pio.patch
  30586. @@ -1,5 +1,5 @@
  30587. ---- a/drivers/net/wireless/b43/Makefile
  30588. -+++ b/drivers/net/wireless/b43/Makefile
  30589. +--- a/drivers/net/wireless/broadcom/b43/Makefile
  30590. ++++ b/drivers/net/wireless/broadcom/b43/Makefile
  30591. @@ -17,7 +17,7 @@ b43-$(CPTCFG_B43_PHY_AC) += phy_ac.o
  30592. b43-y += sysfs.o
  30593. b43-y += xmit.o
  30594. @@ -9,8 +9,8 @@
  30595. b43-y += rfkill.o
  30596. b43-y += ppr.o
  30597. b43-$(CPTCFG_B43_LEDS) += leds.o
  30598. ---- a/drivers/net/wireless/b43/main.c
  30599. -+++ b/drivers/net/wireless/b43/main.c
  30600. +--- a/drivers/net/wireless/broadcom/b43/main.c
  30601. ++++ b/drivers/net/wireless/broadcom/b43/main.c
  30602. @@ -2008,10 +2008,12 @@ static void b43_do_interrupt_thread(stru
  30603. dma_reason[0], dma_reason[1],
  30604. dma_reason[2], dma_reason[3],
  30605. @@ -24,8 +24,8 @@
  30606. b43_controller_restart(dev, "DMA error");
  30607. return;
  30608. }
  30609. ---- a/drivers/net/wireless/b43/pio.h
  30610. -+++ b/drivers/net/wireless/b43/pio.h
  30611. +--- a/drivers/net/wireless/broadcom/b43/pio.h
  30612. ++++ b/drivers/net/wireless/broadcom/b43/pio.h
  30613. @@ -150,7 +150,7 @@ static inline void b43_piorx_write32(str
  30614. b43_write32(q->dev, q->mmio_base + offset, value);
  30615. }
  30616. @@ -73,9 +73,9 @@
  30617. +#endif /* CPTCFG_B43_PIO */
  30618. #endif /* B43_PIO_H_ */
  30619. ---- a/drivers/net/wireless/b43/Kconfig
  30620. -+++ b/drivers/net/wireless/b43/Kconfig
  30621. -@@ -118,7 +118,7 @@ config B43_BCMA_PIO
  30622. +--- a/drivers/net/wireless/broadcom/b43/Kconfig
  30623. ++++ b/drivers/net/wireless/broadcom/b43/Kconfig
  30624. +@@ -98,7 +98,7 @@ config B43_BCMA_PIO
  30625. default y
  30626. config B43_PIO
  30627. diff --git a/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch b/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  30628. index ac58dba..06c731f 100644
  30629. --- a/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  30630. +++ b/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  30631. @@ -1,5 +1,5 @@
  30632. ---- a/drivers/net/wireless/b43/main.c
  30633. -+++ b/drivers/net/wireless/b43/main.c
  30634. +--- a/drivers/net/wireless/broadcom/b43/main.c
  30635. ++++ b/drivers/net/wireless/broadcom/b43/main.c
  30636. @@ -1648,7 +1648,7 @@ static void b43_write_beacon_template(st
  30637. len, ram_offset, shm_size_offset, rate);
  30638. @@ -9,7 +9,7 @@
  30639. antenna = b43_antenna_to_phyctl(antenna);
  30640. ctl = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_BEACPHYCTL);
  30641. /* We can't send beacons with short preamble. Would get PHY errors. */
  30642. -@@ -3302,8 +3302,8 @@ static int b43_chip_init(struct b43_wlde
  30643. +@@ -3300,8 +3300,8 @@ static int b43_chip_init(struct b43_wlde
  30644. /* Select the antennae */
  30645. if (phy->ops->set_rx_antenna)
  30646. @@ -20,7 +20,7 @@
  30647. if (phy->type == B43_PHYTYPE_B) {
  30648. value16 = b43_read16(dev, 0x005E);
  30649. -@@ -4003,7 +4003,6 @@ static int b43_op_config(struct ieee8021
  30650. +@@ -4001,7 +4001,6 @@ static int b43_op_config(struct ieee8021
  30651. struct b43_wldev *dev = wl->current_dev;
  30652. struct b43_phy *phy = &dev->phy;
  30653. struct ieee80211_conf *conf = &hw->conf;
  30654. @@ -28,7 +28,7 @@
  30655. int err = 0;
  30656. mutex_lock(&wl->mutex);
  30657. -@@ -4046,11 +4045,9 @@ static int b43_op_config(struct ieee8021
  30658. +@@ -4044,11 +4043,9 @@ static int b43_op_config(struct ieee8021
  30659. }
  30660. /* Antennas for RX and management frame TX. */
  30661. @@ -42,7 +42,7 @@
  30662. if (wl->radio_enabled != phy->radio_on) {
  30663. if (wl->radio_enabled) {
  30664. -@@ -5213,6 +5210,47 @@ static int b43_op_get_survey(struct ieee
  30665. +@@ -5209,6 +5206,47 @@ static int b43_op_get_survey(struct ieee
  30666. return 0;
  30667. }
  30668. @@ -90,7 +90,7 @@
  30669. static const struct ieee80211_ops b43_hw_ops = {
  30670. .tx = b43_op_tx,
  30671. .conf_tx = b43_op_conf_tx,
  30672. -@@ -5234,6 +5272,8 @@ static const struct ieee80211_ops b43_hw
  30673. +@@ -5230,6 +5268,8 @@ static const struct ieee80211_ops b43_hw
  30674. .sw_scan_complete = b43_op_sw_scan_complete_notifier,
  30675. .get_survey = b43_op_get_survey,
  30676. .rfkill_poll = b43_rfkill_poll,
  30677. @@ -99,7 +99,7 @@
  30678. };
  30679. /* Hard-reset the chip. Do not call this directly.
  30680. -@@ -5542,6 +5582,8 @@ static int b43_one_core_attach(struct b4
  30681. +@@ -5538,6 +5578,8 @@ static int b43_one_core_attach(struct b4
  30682. if (!wldev)
  30683. goto out;
  30684. @@ -108,7 +108,7 @@
  30685. wldev->use_pio = b43_modparam_pio;
  30686. wldev->dev = dev;
  30687. wldev->wl = wl;
  30688. -@@ -5632,6 +5674,9 @@ static struct b43_wl *b43_wireless_init(
  30689. +@@ -5628,6 +5670,9 @@ static struct b43_wl *b43_wireless_init(
  30690. hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
  30691. @@ -118,8 +118,8 @@
  30692. wl->hw_registred = false;
  30693. hw->max_rates = 2;
  30694. SET_IEEE80211_DEV(hw, dev->dev);
  30695. ---- a/drivers/net/wireless/b43/b43.h
  30696. -+++ b/drivers/net/wireless/b43/b43.h
  30697. +--- a/drivers/net/wireless/broadcom/b43/b43.h
  30698. ++++ b/drivers/net/wireless/broadcom/b43/b43.h
  30699. @@ -840,6 +840,8 @@ struct b43_wldev {
  30700. bool hwcrypto_enabled; /* TRUE, if HW crypto acceleration is enabled. */
  30701. bool use_pio; /* TRUE if next init should use PIO */
  30702. diff --git a/package/kernel/mac80211/patches/841-b43-reduce-number-of-RX-slots.patch b/package/kernel/mac80211/patches/841-b43-reduce-number-of-RX-slots.patch
  30703. index 9c51ac6..5899706 100644
  30704. --- a/package/kernel/mac80211/patches/841-b43-reduce-number-of-RX-slots.patch
  30705. +++ b/package/kernel/mac80211/patches/841-b43-reduce-number-of-RX-slots.patch
  30706. @@ -1,5 +1,5 @@
  30707. ---- a/drivers/net/wireless/b43/dma.h
  30708. -+++ b/drivers/net/wireless/b43/dma.h
  30709. +--- a/drivers/net/wireless/broadcom/b43/dma.h
  30710. ++++ b/drivers/net/wireless/broadcom/b43/dma.h
  30711. @@ -169,7 +169,7 @@ struct b43_dmadesc_generic {
  30712. /* DMA engine tuning knobs */
  30713. diff --git a/package/kernel/mac80211/patches/845-b43-only-use-gpio-0-1-for-led.patch b/package/kernel/mac80211/patches/845-b43-only-use-gpio-0-1-for-led.patch
  30714. index d4f9a88..8d0c041 100644
  30715. --- a/package/kernel/mac80211/patches/845-b43-only-use-gpio-0-1-for-led.patch
  30716. +++ b/package/kernel/mac80211/patches/845-b43-only-use-gpio-0-1-for-led.patch
  30717. @@ -1,5 +1,5 @@
  30718. ---- a/drivers/net/wireless/b43/main.c
  30719. -+++ b/drivers/net/wireless/b43/main.c
  30720. +--- a/drivers/net/wireless/broadcom/b43/main.c
  30721. ++++ b/drivers/net/wireless/broadcom/b43/main.c
  30722. @@ -2899,6 +2899,14 @@ static int b43_gpio_init(struct b43_wlde
  30723. } else if (dev->dev->chip_id == 0x5354) {
  30724. /* Don't allow overtaking buttons GPIOs */
  30725. diff --git a/package/kernel/mac80211/patches/847-b43-always-take-overlapping-devs.patch b/package/kernel/mac80211/patches/847-b43-always-take-overlapping-devs.patch
  30726. index 9d1d419..ef7f3c9 100644
  30727. --- a/package/kernel/mac80211/patches/847-b43-always-take-overlapping-devs.patch
  30728. +++ b/package/kernel/mac80211/patches/847-b43-always-take-overlapping-devs.patch
  30729. @@ -1,6 +1,6 @@
  30730. ---- a/drivers/net/wireless/b43/main.c
  30731. -+++ b/drivers/net/wireless/b43/main.c
  30732. -@@ -118,7 +118,7 @@ static int b43_modparam_pio = 0;
  30733. +--- a/drivers/net/wireless/broadcom/b43/main.c
  30734. ++++ b/drivers/net/wireless/broadcom/b43/main.c
  30735. +@@ -117,7 +117,7 @@ static int b43_modparam_pio = 0;
  30736. module_param_named(pio, b43_modparam_pio, int, 0644);
  30737. MODULE_PARM_DESC(pio, "Use PIO accesses by default: 0=DMA, 1=PIO");
  30738. diff --git a/package/kernel/mac80211/patches/850-brcmsmac-remove-extra-regulation-restriction.patch b/package/kernel/mac80211/patches/850-brcmsmac-remove-extra-regulation-restriction.patch
  30739. index 185c427..3c93386 100644
  30740. --- a/package/kernel/mac80211/patches/850-brcmsmac-remove-extra-regulation-restriction.patch
  30741. +++ b/package/kernel/mac80211/patches/850-brcmsmac-remove-extra-regulation-restriction.patch
  30742. @@ -1,5 +1,5 @@
  30743. ---- a/drivers/net/wireless/brcm80211/brcmsmac/channel.c
  30744. -+++ b/drivers/net/wireless/brcm80211/brcmsmac/channel.c
  30745. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/channel.c
  30746. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/channel.c
  30747. @@ -58,19 +58,12 @@
  30748. (((c) < 149) ? 3 : 4))))
  30749. diff --git a/package/kernel/mac80211/patches/860-brcmfmac-use-bcm47xx-platform-NVRAM-as-fallback.patch b/package/kernel/mac80211/patches/860-brcmfmac-use-bcm47xx-platform-NVRAM-as-fallback.patch
  30750. deleted file mode 100644
  30751. index 44bb779..0000000
  30752. --- a/package/kernel/mac80211/patches/860-brcmfmac-use-bcm47xx-platform-NVRAM-as-fallback.patch
  30753. +++ /dev/null
  30754. @@ -1,80 +0,0 @@
  30755. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  30756. -Date: Mon, 8 Jun 2015 16:59:31 +0200
  30757. -Subject: [PATCH] brcmfmac: use bcm47xx platform NVRAM as fallback
  30758. -MIME-Version: 1.0
  30759. -Content-Type: text/plain; charset=UTF-8
  30760. -Content-Transfer-Encoding: 8bit
  30761. -
  30762. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  30763. ----
  30764. -
  30765. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  30766. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  30767. -@@ -19,6 +19,9 @@
  30768. - #include <linux/device.h>
  30769. - #include <linux/firmware.h>
  30770. - #include <linux/module.h>
  30771. -+#if IS_ENABLED(CONFIG_BCM47XX_NVRAM)
  30772. -+#include <linux/bcm47xx_nvram.h>
  30773. -+#endif
  30774. -
  30775. - #include "debug.h"
  30776. - #include "firmware.h"
  30777. -@@ -424,17 +427,42 @@ struct brcmf_fw {
  30778. - static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx)
  30779. - {
  30780. - struct brcmf_fw *fwctx = ctx;
  30781. -+#if IS_ENABLED(CONFIG_BCM47XX_NVRAM)
  30782. -+ const u8 *bcm47xx_nvram = NULL;
  30783. -+ size_t bcm47xx_nvram_len;
  30784. -+#endif
  30785. -+ const u8 *data = NULL;
  30786. -+ size_t data_len;
  30787. - u32 nvram_length = 0;
  30788. - void *nvram = NULL;
  30789. -
  30790. - brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(fwctx->dev));
  30791. -- if (!fw && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL))
  30792. -+ if (fw) {
  30793. -+ data = fw->data;
  30794. -+ data_len = fw->size;
  30795. -+ }
  30796. -+#if IS_ENABLED(CONFIG_BCM47XX_NVRAM)
  30797. -+ else {
  30798. -+ bcm47xx_nvram = bcm47xx_nvram_get_contents(&bcm47xx_nvram_len);
  30799. -+ if (bcm47xx_nvram) {
  30800. -+ data = bcm47xx_nvram;
  30801. -+ data_len = bcm47xx_nvram_len;
  30802. -+ brcmf_err("Found platform NVRAM (%zu B)\n", data_len);
  30803. -+ }
  30804. -+ }
  30805. -+#endif
  30806. -+ if (!data && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL))
  30807. - goto fail;
  30808. -
  30809. -- if (fw) {
  30810. -- nvram = brcmf_fw_nvram_strip(fw->data, fw->size, &nvram_length,
  30811. -+ if (data) {
  30812. -+ nvram = brcmf_fw_nvram_strip(data, data_len, &nvram_length,
  30813. - fwctx->domain_nr, fwctx->bus_nr);
  30814. -- release_firmware(fw);
  30815. -+ if (fw)
  30816. -+ release_firmware(fw);
  30817. -+#if IS_ENABLED(CONFIG_BCM47XX_NVRAM)
  30818. -+ if (bcm47xx_nvram)
  30819. -+ bcm47xx_nvram_release_contents(bcm47xx_nvram);
  30820. -+#endif
  30821. - if (!nvram && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL))
  30822. - goto fail;
  30823. - }
  30824. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  30825. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  30826. -@@ -19,6 +19,8 @@
  30827. -
  30828. - #include <linux/net.h> /* net_ratelimit() */
  30829. -
  30830. -+#include <linux/net.h>
  30831. -+
  30832. - /* message levels */
  30833. - #define BRCMF_TRACE_VAL 0x00000002
  30834. - #define BRCMF_INFO_VAL 0x00000004
  30835. diff --git a/package/kernel/mac80211/patches/861-brcmfmac-register-wiphy-s-during-module_init.patch b/package/kernel/mac80211/patches/861-brcmfmac-register-wiphy-s-during-module_init.patch
  30836. index 14f8a00..95d93ae 100644
  30837. --- a/package/kernel/mac80211/patches/861-brcmfmac-register-wiphy-s-during-module_init.patch
  30838. +++ b/package/kernel/mac80211/patches/861-brcmfmac-register-wiphy-s-during-module_init.patch
  30839. @@ -11,9 +11,9 @@ module loads successfully.
  30840. Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  30841. ---
  30842. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  30843. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  30844. -@@ -1226,6 +1226,7 @@ static int __init brcmfmac_module_init(v
  30845. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  30846. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  30847. +@@ -1332,6 +1332,7 @@ static int __init brcmfmac_module_init(v
  30848. #endif
  30849. if (!schedule_work(&brcmf_driver_work))
  30850. return -EBUSY;
  30851. @@ -21,9 +21,9 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  30852. return 0;
  30853. }
  30854. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  30855. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  30856. -@@ -422,13 +422,14 @@ struct brcmf_fw {
  30857. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  30858. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  30859. +@@ -418,6 +418,7 @@ struct brcmf_fw {
  30860. u16 bus_nr;
  30861. void (*done)(struct device *dev, const struct firmware *fw,
  30862. void *nvram_image, u32 nvram_len);
  30863. @@ -31,16 +31,8 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  30864. };
  30865. static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx)
  30866. - {
  30867. - struct brcmf_fw *fwctx = ctx;
  30868. - #if IS_ENABLED(CONFIG_BCM47XX_NVRAM)
  30869. -- const u8 *bcm47xx_nvram = NULL;
  30870. -+ u8 *bcm47xx_nvram = NULL;
  30871. - size_t bcm47xx_nvram_len;
  30872. - #endif
  30873. - const u8 *data = NULL;
  30874. -@@ -468,6 +469,8 @@ static void brcmf_fw_request_nvram_done(
  30875. - }
  30876. +@@ -452,6 +453,8 @@ static void brcmf_fw_request_nvram_done(
  30877. + goto fail;
  30878. fwctx->done(fwctx->dev, fwctx->code, nvram, nvram_length);
  30879. + if (fwctx->completion)
  30880. @@ -48,7 +40,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  30881. kfree(fwctx);
  30882. return;
  30883. -@@ -475,6 +478,8 @@ fail:
  30884. +@@ -459,6 +462,8 @@ fail:
  30885. brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  30886. release_firmware(fwctx->code);
  30887. device_release_driver(fwctx->dev);
  30888. @@ -57,7 +49,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  30889. kfree(fwctx);
  30890. }
  30891. -@@ -490,6 +495,8 @@ static void brcmf_fw_request_code_done(c
  30892. +@@ -474,6 +479,8 @@ static void brcmf_fw_request_code_done(c
  30893. /* only requested code so done here */
  30894. if (!(fwctx->flags & BRCMF_FW_REQUEST_NVRAM)) {
  30895. fwctx->done(fwctx->dev, fw, NULL, 0);
  30896. @@ -66,16 +58,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  30897. kfree(fwctx);
  30898. return;
  30899. }
  30900. -@@ -504,6 +511,8 @@ static void brcmf_fw_request_code_done(c
  30901. - /* when nvram is optional call .done() callback here */
  30902. - if (fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL) {
  30903. - fwctx->done(fwctx->dev, fw, NULL, 0);
  30904. -+ if (fwctx->completion)
  30905. -+ complete(fwctx->completion);
  30906. - kfree(fwctx);
  30907. - return;
  30908. - }
  30909. -@@ -513,6 +522,8 @@ static void brcmf_fw_request_code_done(c
  30910. +@@ -491,6 +498,8 @@ static void brcmf_fw_request_code_done(c
  30911. fail:
  30912. brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  30913. device_release_driver(fwctx->dev);
  30914. @@ -84,7 +67,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  30915. kfree(fwctx);
  30916. }
  30917. -@@ -524,6 +535,8 @@ int brcmf_fw_get_firmwares_pcie(struct d
  30918. +@@ -502,6 +511,8 @@ int brcmf_fw_get_firmwares_pcie(struct d
  30919. u16 domain_nr, u16 bus_nr)
  30920. {
  30921. struct brcmf_fw *fwctx;
  30922. @@ -93,7 +76,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  30923. brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev));
  30924. if (!fw_cb || !code)
  30925. -@@ -544,9 +557,17 @@ int brcmf_fw_get_firmwares_pcie(struct d
  30926. +@@ -522,9 +533,17 @@ int brcmf_fw_get_firmwares_pcie(struct d
  30927. fwctx->domain_nr = domain_nr;
  30928. fwctx->bus_nr = bus_nr;
  30929. 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
  30930. index 32c4a6f..9aeb97e 100644
  30931. --- a/package/kernel/mac80211/patches/862-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
  30932. +++ b/package/kernel/mac80211/patches/862-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
  30933. @@ -8,9 +8,9 @@ Content-Transfer-Encoding: 8bit
  30934. Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  30935. ---
  30936. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  30937. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  30938. -@@ -608,9 +608,37 @@ static struct wireless_dev *brcmf_cfg802
  30939. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  30940. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  30941. +@@ -618,9 +618,37 @@ static struct wireless_dev *brcmf_cfg802
  30942. u32 *flags,
  30943. struct vif_params *params)
  30944. {
  30945. diff --git a/package/kernel/mac80211/patches/863-brcmfmac-fix-setting-primary-channel-for-80-MHz-widt.patch b/package/kernel/mac80211/patches/863-brcmfmac-fix-setting-primary-channel-for-80-MHz-widt.patch
  30946. deleted file mode 100644
  30947. index d6b9e37..0000000
  30948. --- a/package/kernel/mac80211/patches/863-brcmfmac-fix-setting-primary-channel-for-80-MHz-widt.patch
  30949. +++ /dev/null
  30950. @@ -1,65 +0,0 @@
  30951. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  30952. -Date: Wed, 20 Jan 2016 16:35:12 +0100
  30953. -Subject: [PATCH] brcmfmac: fix setting primary channel for 80 MHz width
  30954. -MIME-Version: 1.0
  30955. -Content-Type: text/plain; charset=UTF-8
  30956. -Content-Transfer-Encoding: 8bit
  30957. -
  30958. -First of all it changes the way we calculate primary channel offset. If
  30959. -we use e.g. 80 MHz channel with primary frequency 5180 MHz (which means
  30960. -center frequency is 5210 MHz) it makes sense to calculate primary offset
  30961. -as -30 MHz.
  30962. -Then it fixes values we compare primary_offset with. We were comparing
  30963. -offset in MHz against -2 or 2 which was resulting in picking a wrong
  30964. -primary channel.
  30965. -
  30966. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  30967. ----
  30968. - .../brcm80211/brcmfmac/cfg80211.c | 23 ++++++++++------------
  30969. - 1 file changed, 10 insertions(+), 13 deletions(-)
  30970. -
  30971. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  30972. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  30973. -@@ -246,7 +246,7 @@ static u16 chandef_to_chanspec(struct br
  30974. - brcmf_dbg(TRACE, "chandef: control %d center %d width %d\n",
  30975. - ch->chan->center_freq, ch->center_freq1, ch->width);
  30976. - ch_inf.chnum = ieee80211_frequency_to_channel(ch->center_freq1);
  30977. -- primary_offset = ch->center_freq1 - ch->chan->center_freq;
  30978. -+ primary_offset = ch->chan->center_freq - ch->center_freq1;
  30979. - switch (ch->width) {
  30980. - case NL80211_CHAN_WIDTH_20:
  30981. - case NL80211_CHAN_WIDTH_20_NOHT:
  30982. -@@ -255,24 +255,21 @@ static u16 chandef_to_chanspec(struct br
  30983. - break;
  30984. - case NL80211_CHAN_WIDTH_40:
  30985. - ch_inf.bw = BRCMU_CHAN_BW_40;
  30986. -- if (primary_offset < 0)
  30987. -+ if (primary_offset > 0)
  30988. - ch_inf.sb = BRCMU_CHAN_SB_U;
  30989. - else
  30990. - ch_inf.sb = BRCMU_CHAN_SB_L;
  30991. - break;
  30992. - case NL80211_CHAN_WIDTH_80:
  30993. - ch_inf.bw = BRCMU_CHAN_BW_80;
  30994. -- if (primary_offset < 0) {
  30995. -- if (primary_offset < -CH_10MHZ_APART)
  30996. -- ch_inf.sb = BRCMU_CHAN_SB_UU;
  30997. -- else
  30998. -- ch_inf.sb = BRCMU_CHAN_SB_UL;
  30999. -- } else {
  31000. -- if (primary_offset > CH_10MHZ_APART)
  31001. -- ch_inf.sb = BRCMU_CHAN_SB_LL;
  31002. -- else
  31003. -- ch_inf.sb = BRCMU_CHAN_SB_LU;
  31004. -- }
  31005. -+ if (primary_offset == -30)
  31006. -+ ch_inf.sb = BRCMU_CHAN_SB_LL;
  31007. -+ else if (primary_offset == -10)
  31008. -+ ch_inf.sb = BRCMU_CHAN_SB_LU;
  31009. -+ else if (primary_offset == 10)
  31010. -+ ch_inf.sb = BRCMU_CHAN_SB_UL;
  31011. -+ else
  31012. -+ ch_inf.sb = BRCMU_CHAN_SB_UU;
  31013. - break;
  31014. - case NL80211_CHAN_WIDTH_80P80:
  31015. - case NL80211_CHAN_WIDTH_160:
  31016. 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
  31017. deleted file mode 100644
  31018. index 856dea8..0000000
  31019. --- a/package/kernel/mac80211/patches/900-wlcore-Add-support-for-DT-platform-data.patch
  31020. +++ /dev/null
  31021. @@ -1,139 +0,0 @@
  31022. -When running with DT, we no longer have a board file that can set up the
  31023. -platform data for wlcore. Allow this data to be passed from DT.
  31024. -
  31025. -Since some platforms use a gpio-irq, add support for passing either the
  31026. -irq number or the gpio number. For the latter case, the driver will
  31027. -request the gpio and convert it to the irq number. If an irq is
  31028. -specified, it'll be used as is.
  31029. -
  31030. -[Arik - the pdev_data pointer does not belong to us and is freed when
  31031. -the device is released. Dereference to our private data first.]
  31032. -
  31033. -Signed-off-by: Ido Yariv <ido@wizery.com>
  31034. -Signed-off-by: Arik Nemtsov <arik@wizery.com>
  31035. ----
  31036. - drivers/net/wireless/ti/wlcore/sdio.c | 71 ++++++++++++++++++++++++++++++++---
  31037. - include/linux/wl12xx.h | 3 +-
  31038. - 2 files changed, 67 insertions(+), 7 deletions(-)
  31039. -
  31040. ---- a/drivers/net/wireless/ti/wlcore/sdio.c
  31041. -+++ b/drivers/net/wireless/ti/wlcore/sdio.c
  31042. -@@ -34,6 +34,7 @@
  31043. - #include <linux/wl12xx.h>
  31044. - #include <linux/pm_runtime.h>
  31045. - #include <linux/printk.h>
  31046. -+#include <linux/of.h>
  31047. -
  31048. - #include "wlcore.h"
  31049. - #include "wl12xx_80211.h"
  31050. -@@ -214,6 +215,61 @@ static struct wl1271_if_operations sdio_
  31051. - .set_block_size = wl1271_sdio_set_block_size,
  31052. - };
  31053. -
  31054. -+static const struct of_device_id wlcore_of_match[] = {
  31055. -+ {
  31056. -+ .compatible = "wlcore",
  31057. -+ },
  31058. -+ {}
  31059. -+};
  31060. -+MODULE_DEVICE_TABLE(of, wlcore_of_match);
  31061. -+
  31062. -+static struct wl12xx_platform_data *get_platform_data(struct device *dev)
  31063. -+{
  31064. -+ struct wl12xx_platform_data *pdata;
  31065. -+ struct device_node *np;
  31066. -+ u32 gpio;
  31067. -+
  31068. -+ pdata = wl12xx_get_platform_data();
  31069. -+ if (!IS_ERR(pdata))
  31070. -+ return kmemdup(pdata, sizeof(*pdata), GFP_KERNEL);
  31071. -+
  31072. -+ np = of_find_matching_node(NULL, wlcore_of_match);
  31073. -+ if (!np) {
  31074. -+ dev_err(dev, "No platform data set\n");
  31075. -+ return NULL;
  31076. -+ }
  31077. -+
  31078. -+ pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
  31079. -+ if (!pdata) {
  31080. -+ dev_err(dev, "Can't allocate platform data\n");
  31081. -+ return NULL;
  31082. -+ }
  31083. -+
  31084. -+ if (of_property_read_u32(np, "irq", &pdata->irq)) {
  31085. -+ if (!of_property_read_u32(np, "gpio", &gpio) &&
  31086. -+ !gpio_request_one(gpio, GPIOF_IN, "wlcore_irq")) {
  31087. -+ pdata->gpio = gpio;
  31088. -+ pdata->irq = gpio_to_irq(gpio);
  31089. -+ }
  31090. -+ }
  31091. -+
  31092. -+ /* Optional fields */
  31093. -+ pdata->use_eeprom = of_property_read_bool(np, "use-eeprom");
  31094. -+ of_property_read_u32(np, "board-ref-clock", &pdata->board_ref_clock);
  31095. -+ of_property_read_u32(np, "board-tcxo-clock", &pdata->board_tcxo_clock);
  31096. -+ of_property_read_u32(np, "platform-quirks", &pdata->platform_quirks);
  31097. -+
  31098. -+ return pdata;
  31099. -+}
  31100. -+
  31101. -+static void del_platform_data(struct wl12xx_platform_data *pdata)
  31102. -+{
  31103. -+ if (pdata->gpio)
  31104. -+ gpio_free(pdata->gpio);
  31105. -+
  31106. -+ kfree(pdata);
  31107. -+}
  31108. -+
  31109. - static int wl1271_probe(struct sdio_func *func,
  31110. - const struct sdio_device_id *id)
  31111. - {
  31112. -@@ -245,10 +301,10 @@ static int wl1271_probe(struct sdio_func
  31113. - /* Use block mode for transferring over one block size of data */
  31114. - func->card->quirks |= MMC_QUIRK_BLKSZ_FOR_BYTE_MODE;
  31115. -
  31116. -- pdev_data.pdata = wl12xx_get_platform_data();
  31117. -- if (IS_ERR(pdev_data.pdata)) {
  31118. -- ret = PTR_ERR(pdev_data.pdata);
  31119. -- dev_err(glue->dev, "missing wlan platform data: %d\n", ret);
  31120. -+ pdev_data.pdata = get_platform_data(&func->dev);
  31121. -+ if (!pdev_data.pdata) {
  31122. -+ ret = -EINVAL;
  31123. -+ dev_err(glue->dev, "missing wlan platform data\n");
  31124. - goto out_free_glue;
  31125. - }
  31126. -
  31127. -@@ -279,7 +335,7 @@ static int wl1271_probe(struct sdio_func
  31128. - if (!glue->core) {
  31129. - dev_err(glue->dev, "can't allocate platform_device");
  31130. - ret = -ENOMEM;
  31131. -- goto out_free_glue;
  31132. -+ goto out_free_pdata;
  31133. - }
  31134. -
  31135. - glue->core->dev.parent = &func->dev;
  31136. -@@ -313,6 +369,9 @@ static int wl1271_probe(struct sdio_func
  31137. - out_dev_put:
  31138. - platform_device_put(glue->core);
  31139. -
  31140. -+out_free_pdata:
  31141. -+ del_platform_data(pdev_data->pdata);
  31142. -+
  31143. - out_free_glue:
  31144. - kfree(glue);
  31145. -
  31146. -@@ -323,11 +382,14 @@ out:
  31147. - static void wl1271_remove(struct sdio_func *func)
  31148. - {
  31149. - struct wl12xx_sdio_glue *glue = sdio_get_drvdata(func);
  31150. -+ struct wlcore_platdev_data *pdev_data = glue->core->dev.platform_data;
  31151. -+ struct wl12xx_platform_data *pdata = pdev_data->pdata;
  31152. -
  31153. - /* Undo decrement done above in wl1271_probe */
  31154. - pm_runtime_get_noresume(&func->dev);
  31155. -
  31156. - platform_device_unregister(glue->core);
  31157. -+ del_platform_data(pdata);
  31158. - kfree(glue);
  31159. - }
  31160. -
  31161. diff --git a/package/kernel/mac80211/patches/910-00-rt2x00-enable-rt2800soc-for-mt7620.patch b/package/kernel/mac80211/patches/910-00-rt2x00-enable-rt2800soc-for-mt7620.patch
  31162. index e6b2d7b..bc9f799 100644
  31163. --- a/package/kernel/mac80211/patches/910-00-rt2x00-enable-rt2800soc-for-mt7620.patch
  31164. +++ b/package/kernel/mac80211/patches/910-00-rt2x00-enable-rt2800soc-for-mt7620.patch
  31165. @@ -1,5 +1,5 @@
  31166. ---- a/drivers/net/wireless/rt2x00/Kconfig
  31167. -+++ b/drivers/net/wireless/rt2x00/Kconfig
  31168. +--- a/drivers/net/wireless/ralink/rt2x00/Kconfig
  31169. ++++ b/drivers/net/wireless/ralink/rt2x00/Kconfig
  31170. @@ -211,7 +211,7 @@ endif
  31171. config RT2800SOC
  31172. tristate "Ralink WiSoC support"
  31173. 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
  31174. index 501910f..f2e21ea 100644
  31175. --- a/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch
  31176. +++ b/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch
  31177. @@ -1,5 +1,5 @@
  31178. ---- a/drivers/net/wireless/rt2x00/rt2800.h
  31179. -+++ b/drivers/net/wireless/rt2x00/rt2800.h
  31180. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
  31181. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
  31182. @@ -81,6 +81,7 @@
  31183. #define RF5372 0x5372
  31184. #define RF5390 0x5390
  31185. @@ -62,8 +62,8 @@
  31186. /* TX_PWR_CFG_7 */
  31187. #define TX_PWR_CFG_7 0x13d4
  31188. #define TX_PWR_CFG_7_OFDM54_CH0 FIELD32(0x0000000f)
  31189. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  31190. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  31191. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  31192. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  31193. @@ -61,6 +61,8 @@
  31194. rt2800_regbusy_read((__dev), BBP_CSR_CFG, BBP_CSR_CFG_BUSY, (__reg))
  31195. #define WAIT_FOR_RFCSR(__dev, __reg) \
  31196. @@ -91,7 +91,8 @@
  31197. + rt2x00_set_field32(&reg, RF_CSR_CFG_REGNUM_MT7620, word);
  31198. + rt2x00_set_field32(&reg, RF_CSR_CFG_WRITE_MT7620, 1);
  31199. + rt2x00_set_field32(&reg, RF_CSR_CFG_BUSY_MT7620, 1);
  31200. -+
  31201. +
  31202. +- rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg);
  31203. + rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg);
  31204. + }
  31205. + break;
  31206. @@ -103,8 +104,7 @@
  31207. + rt2x00_set_field32(&reg, RF_CSR_CFG_REGNUM, word);
  31208. + rt2x00_set_field32(&reg, RF_CSR_CFG_WRITE, 1);
  31209. + rt2x00_set_field32(&reg, RF_CSR_CFG_BUSY, 1);
  31210. -
  31211. -- rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg);
  31212. ++
  31213. + rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg);
  31214. + }
  31215. + break;
  31216. @@ -210,7 +210,7 @@
  31217. case RT5592:
  31218. *txwi_size = TXWI_DESC_SIZE_5WORDS;
  31219. *rxwi_size = RXWI_DESC_SIZE_6WORDS;
  31220. -@@ -3326,6 +3399,312 @@ static void rt2800_config_channel_rf55xx
  31221. +@@ -3303,6 +3376,312 @@ static void rt2800_config_channel_rf55xx
  31222. rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x19 : 0x7F);
  31223. }
  31224. @@ -258,6 +258,7 @@
  31225. + u32 mac_sys_ctrl, mac_status;
  31226. + u32 tx_pin = 0x00150F0F;
  31227. + struct hw_mode_spec *spec = &rt2x00dev->spec;
  31228. ++ struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
  31229. +
  31230. + /* Frequeny plan setting */
  31231. + /*
  31232. @@ -383,7 +384,6 @@
  31233. + rfcsr &= (~0x4);
  31234. + rt2800_rfcsr_write(rt2x00dev, 28, rfcsr);
  31235. +
  31236. -+ struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
  31237. + /*if (bScan == FALSE)*/
  31238. + if (conf_is_ht40(conf)) {
  31239. + txrx_agc_fc = rt2x00_get_field8(drv_data->calibration_bw40,
  31240. @@ -523,7 +523,7 @@
  31241. static void rt2800_bbp_write_with_rx_chain(struct rt2x00_dev *rt2x00dev,
  31242. const unsigned int word,
  31243. const u8 value)
  31244. -@@ -3482,7 +3861,7 @@ static void rt2800_config_channel(struct
  31245. +@@ -3459,7 +3838,7 @@ static void rt2800_config_channel(struct
  31246. struct channel_info *info)
  31247. {
  31248. u32 reg;
  31249. @@ -532,7 +532,7 @@
  31250. u8 bbp, rfcsr;
  31251. info->default_power1 = rt2800_txpower_to_dev(rt2x00dev, rf->channel,
  31252. -@@ -3536,6 +3915,9 @@ static void rt2800_config_channel(struct
  31253. +@@ -3513,6 +3892,9 @@ static void rt2800_config_channel(struct
  31254. case RF5592:
  31255. rt2800_config_channel_rf55xx(rt2x00dev, conf, rf, info);
  31256. break;
  31257. @@ -542,7 +542,7 @@
  31258. default:
  31259. rt2800_config_channel_rf2xxx(rt2x00dev, conf, rf, info);
  31260. }
  31261. -@@ -3638,7 +4020,7 @@ static void rt2800_config_channel(struct
  31262. +@@ -3615,7 +3997,7 @@ static void rt2800_config_channel(struct
  31263. else if (rt2x00_rt(rt2x00dev, RT3593) ||
  31264. rt2x00_rt(rt2x00dev, RT3883))
  31265. rt2800_bbp_write(rt2x00dev, 82, 0x82);
  31266. @@ -551,7 +551,7 @@
  31267. rt2800_bbp_write(rt2x00dev, 82, 0xf2);
  31268. if (rt2x00_rt(rt2x00dev, RT3593) ||
  31269. -@@ -3660,7 +4042,7 @@ static void rt2800_config_channel(struct
  31270. +@@ -3637,7 +4019,7 @@ static void rt2800_config_channel(struct
  31271. if (rt2x00_rt(rt2x00dev, RT3572))
  31272. rt2800_rfcsr_write(rt2x00dev, 8, 0);
  31273. @@ -560,7 +560,7 @@
  31274. switch (rt2x00dev->default_ant.tx_chain_num) {
  31275. case 3:
  31276. -@@ -3709,6 +4091,7 @@ static void rt2800_config_channel(struct
  31277. +@@ -3686,6 +4068,7 @@ static void rt2800_config_channel(struct
  31278. rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFTR_EN, 1);
  31279. rt2x00_set_field32(&tx_pin, TX_PIN_CFG_TRSW_EN, 1);
  31280. @@ -568,7 +568,7 @@
  31281. rt2800_register_write(rt2x00dev, TX_PIN_CFG, tx_pin);
  31282. -@@ -4725,6 +5108,14 @@ void rt2800_vco_calibration(struct rt2x0
  31283. +@@ -4702,6 +5085,14 @@ void rt2800_vco_calibration(struct rt2x0
  31284. rt2x00_set_field8(&rfcsr, RFCSR3_VCOCAL_EN, 1);
  31285. rt2800_rfcsr_write(rt2x00dev, 3, rfcsr);
  31286. break;
  31287. @@ -583,7 +583,7 @@
  31288. default:
  31289. return;
  31290. }
  31291. -@@ -5125,9 +5516,42 @@ static int rt2800_init_registers(struct
  31292. +@@ -5102,9 +5493,42 @@ static int rt2800_init_registers(struct
  31293. } else if (rt2x00_rt(rt2x00dev, RT5390) ||
  31294. rt2x00_rt(rt2x00dev, RT5392) ||
  31295. rt2x00_rt(rt2x00dev, RT5592)) {
  31296. @@ -629,7 +629,7 @@
  31297. } else if (rt2x00_rt(rt2x00dev, RT5350)) {
  31298. rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
  31299. } else {
  31300. -@@ -6159,6 +6583,225 @@ static void rt2800_init_bbp_5592(struct
  31301. +@@ -6136,6 +6560,225 @@ static void rt2800_init_bbp_5592(struct
  31302. rt2800_bbp_write(rt2x00dev, 103, 0xc0);
  31303. }
  31304. @@ -855,7 +855,7 @@
  31305. static void rt2800_init_bbp(struct rt2x00_dev *rt2x00dev)
  31306. {
  31307. unsigned int i;
  31308. -@@ -6201,7 +6844,10 @@ static void rt2800_init_bbp(struct rt2x0
  31309. +@@ -6178,7 +6821,10 @@ static void rt2800_init_bbp(struct rt2x0
  31310. return;
  31311. case RT5390:
  31312. case RT5392:
  31313. @@ -867,7 +867,7 @@
  31314. break;
  31315. case RT5592:
  31316. rt2800_init_bbp_5592(rt2x00dev);
  31317. -@@ -7415,6 +8061,295 @@ static void rt2800_init_rfcsr_5592(struc
  31318. +@@ -7392,6 +8038,296 @@ static void rt2800_init_rfcsr_5592(struc
  31319. rt2800_led_open_drain_enable(rt2x00dev);
  31320. }
  31321. @@ -875,6 +875,8 @@
  31322. +{
  31323. + u16 freq;
  31324. + u8 rfvalue;
  31325. ++ struct hw_mode_spec *spec = &rt2x00dev->spec;
  31326. ++
  31327. + /* Initialize RF central register to default value */
  31328. + rt2800_rfcsr_write(rt2x00dev, 0, 0x02);
  31329. + rt2800_rfcsr_write(rt2x00dev, 1, 0x03);
  31330. @@ -921,7 +923,6 @@
  31331. + rt2800_rfcsr_write(rt2x00dev, 42, 0x5B);
  31332. + rt2800_rfcsr_write(rt2x00dev, 43, 0x00);
  31333. +
  31334. -+ struct hw_mode_spec *spec = &rt2x00dev->spec;
  31335. + rt2800_rfcsr_write(rt2x00dev, 11, 0x21);
  31336. + if (spec->clk_is_20mhz)
  31337. + rt2800_rfcsr_write(rt2x00dev, 13, 0x03);
  31338. @@ -1163,7 +1164,7 @@
  31339. static void rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
  31340. {
  31341. if (rt2800_is_305x_soc(rt2x00dev)) {
  31342. -@@ -7450,7 +8385,10 @@ static void rt2800_init_rfcsr(struct rt2
  31343. +@@ -7427,7 +8363,10 @@ static void rt2800_init_rfcsr(struct rt2
  31344. rt2800_init_rfcsr_5350(rt2x00dev);
  31345. break;
  31346. case RT5390:
  31347. @@ -1175,7 +1176,7 @@
  31348. break;
  31349. case RT5392:
  31350. rt2800_init_rfcsr_5392(rt2x00dev);
  31351. -@@ -7882,6 +8820,7 @@ static int rt2800_init_eeprom(struct rt2
  31352. +@@ -7859,6 +8798,7 @@ static int rt2800_init_eeprom(struct rt2
  31353. case RF5390:
  31354. case RF5392:
  31355. case RF5592:
  31356. @@ -1183,7 +1184,7 @@
  31357. break;
  31358. default:
  31359. rt2x00_err(rt2x00dev, "Invalid RF chipset 0x%04x detected\n",
  31360. -@@ -8448,6 +9387,7 @@ static int rt2800_probe_hw_mode(struct r
  31361. +@@ -8423,6 +9363,7 @@ static int rt2800_probe_hw_mode(struct r
  31362. case RF5372:
  31363. case RF5390:
  31364. case RF5392:
  31365. @@ -1191,7 +1192,7 @@
  31366. spec->num_channels = 14;
  31367. if (spec->clk_is_20mhz)
  31368. spec->channels = rf_vals_xtal20mhz_3x;
  31369. -@@ -8588,6 +9528,7 @@ static int rt2800_probe_hw_mode(struct r
  31370. +@@ -8563,6 +9504,7 @@ static int rt2800_probe_hw_mode(struct r
  31371. case RF5372:
  31372. case RF5390:
  31373. case RF5392:
  31374. 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
  31375. deleted file mode 100644
  31376. index 4c04d4f..0000000
  31377. --- a/package/kernel/mac80211/patches/920-ath10k_allow_fallback_to_board_bin_on_empty_otp_stream.patch
  31378. +++ /dev/null
  31379. @@ -1,20 +0,0 @@
  31380. ---- a/drivers/net/wireless/ath/ath10k/core.c
  31381. -+++ b/drivers/net/wireless/ath/ath10k/core.c
  31382. -@@ -387,9 +387,14 @@ static int ath10k_download_and_run_otp(s
  31383. -
  31384. - ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot otp execute result %d\n", result);
  31385. -
  31386. -- if (!skip_otp && result != 0) {
  31387. -- ath10k_err(ar, "otp calibration failed: %d", result);
  31388. -- return -EINVAL;
  31389. -+ if (!skip_otp) {
  31390. -+ if (result == 2) {
  31391. -+ ath10k_warn(ar, "otp stream is empty, using board.bin contents");
  31392. -+ return 0;
  31393. -+ } else if (result != 0) {
  31394. -+ ath10k_err(ar, "otp calibration failed: %d", result);
  31395. -+ return -EINVAL;
  31396. -+ }
  31397. - }
  31398. -
  31399. - return 0;
  31400. diff --git a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  31401. index eed3814..8c6d720 100644
  31402. --- a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  31403. +++ b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  31404. @@ -14,7 +14,7 @@ Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  31405. --- a/drivers/net/wireless/ath/ath10k/core.c
  31406. +++ b/drivers/net/wireless/ath/ath10k/core.c
  31407. -@@ -1323,6 +1323,16 @@ int ath10k_core_register(struct ath10k *
  31408. +@@ -1914,6 +1914,16 @@ int ath10k_core_register(struct ath10k *
  31409. ar->chip_id = chip_id;
  31410. queue_work(ar->workqueue, &ar->register_work);
  31411. 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
  31412. index 8003f86..281b447 100644
  31413. --- a/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
  31414. +++ b/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
  31415. @@ -1,6 +1,6 @@
  31416. --- a/drivers/net/wireless/ath/ath10k/mac.c
  31417. +++ b/drivers/net/wireless/ath/ath10k/mac.c
  31418. -@@ -5416,6 +5416,21 @@ struct ath10k_vif *ath10k_get_arvif(stru
  31419. +@@ -7141,6 +7141,21 @@ struct ath10k_vif *ath10k_get_arvif(stru
  31420. return arvif_iter.arvif;
  31421. }
  31422. @@ -22,7 +22,7 @@
  31423. int ath10k_mac_register(struct ath10k *ar)
  31424. {
  31425. static const u32 cipher_suites[] = {
  31426. -@@ -5590,6 +5605,12 @@ int ath10k_mac_register(struct ath10k *a
  31427. +@@ -7357,6 +7372,12 @@ int ath10k_mac_register(struct ath10k *a
  31428. ar->hw->wiphy->cipher_suites = cipher_suites;
  31429. ar->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  31430. diff --git a/package/kernel/mac80211/patches/940-mwl8k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/940-mwl8k_init_devices_synchronously.patch
  31431. new file mode 100644
  31432. index 0000000..357faee
  31433. --- /dev/null
  31434. +++ b/package/kernel/mac80211/patches/940-mwl8k_init_devices_synchronously.patch
  31435. @@ -0,0 +1,20 @@
  31436. +--- a/drivers/net/wireless/marvell/mwl8k.c
  31437. ++++ b/drivers/net/wireless/marvell/mwl8k.c
  31438. +@@ -6264,6 +6264,8 @@ static int mwl8k_probe(struct pci_dev *p
  31439. +
  31440. + priv->running_bsses = 0;
  31441. +
  31442. ++ wait_for_completion(&priv->firmware_loading_complete);
  31443. ++
  31444. + return rc;
  31445. +
  31446. + err_stop_firmware:
  31447. +@@ -6297,8 +6299,6 @@ static void mwl8k_remove(struct pci_dev
  31448. + return;
  31449. + priv = hw->priv;
  31450. +
  31451. +- wait_for_completion(&priv->firmware_loading_complete);
  31452. +-
  31453. + if (priv->fw_state == FW_STATE_ERROR) {
  31454. + mwl8k_hw_reset(priv);
  31455. + goto unmap;
  31456. diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile
  31457. index 5ede95a..c098832 100644
  31458. --- a/package/kernel/mt76/Makefile
  31459. +++ b/package/kernel/mt76/Makefile
  31460. @@ -1,7 +1,7 @@
  31461. include $(TOPDIR)/rules.mk
  31462. PKG_NAME:=mt76
  31463. -PKG_VERSION:=2015-10-12
  31464. +PKG_VERSION:=2016-02-08
  31465. PKG_RELEASE=1
  31466. PKG_LICENSE:=GPLv2
  31467. @@ -10,7 +10,7 @@ PKG_LICENSE_FILES:=
  31468. PKG_SOURCE_URL:=https://github.com/openwrt/mt76
  31469. PKG_SOURCE_PROTO:=git
  31470. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  31471. -PKG_SOURCE_VERSION:=2f31d1e329dc43074a05782624195860c45b099a
  31472. +PKG_SOURCE_VERSION:=84a312645c7b805255e6d7b6191e9f62142985d9
  31473. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
  31474. PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  31475. @@ -23,8 +23,10 @@ define KernelPackage/mt76
  31476. SUBMENU:=Wireless Drivers
  31477. TITLE:=MediaTek MT76x2 wireless driver
  31478. DEPENDS:=+kmod-mac80211 +@DRIVER_11N_SUPPORT @PCI_SUPPORT
  31479. - FILES:=$(PKG_BUILD_DIR)/mt76pci.ko
  31480. - AUTOLOAD:=$(call AutoLoad,50,mac80211 mt76pci)
  31481. + FILES:=\
  31482. + $(PKG_BUILD_DIR)/mt76.ko \
  31483. + $(PKG_BUILD_DIR)/mt76x2e.ko
  31484. + AUTOLOAD:=$(call AutoLoad,50,mac80211 mt76 mt76x2e)
  31485. endef
  31486. NOSTDINC_FLAGS = \
  31487. diff --git a/package/kernel/mt76/patches/001-backport_ieee80211_hw_set.patch b/package/kernel/mt76/patches/001-backport_ieee80211_hw_set.patch
  31488. deleted file mode 100644
  31489. index e94574d..0000000
  31490. --- a/package/kernel/mt76/patches/001-backport_ieee80211_hw_set.patch
  31491. +++ /dev/null
  31492. @@ -1,12 +0,0 @@
  31493. ---- a/init.c
  31494. -+++ b/init.c
  31495. -@@ -16,6 +16,9 @@
  31496. - #include "eeprom.h"
  31497. - #include "mcu.h"
  31498. -
  31499. -+#define ieee80211_hw_set(hw, flag) \
  31500. -+ do { (hw)->flags |= IEEE80211_HW_##flag; } while(0)
  31501. -+
  31502. - static bool
  31503. - mt76_wait_for_mac(struct mt76_dev *dev)
  31504. - {
  31505. diff --git a/package/kernel/mt76/patches/002-disable_fast_xmit.patch b/package/kernel/mt76/patches/002-disable_fast_xmit.patch
  31506. deleted file mode 100644
  31507. index f7a011b..0000000
  31508. --- a/package/kernel/mt76/patches/002-disable_fast_xmit.patch
  31509. +++ /dev/null
  31510. @@ -1,10 +0,0 @@
  31511. ---- a/init.c
  31512. -+++ b/init.c
  31513. -@@ -816,7 +816,6 @@ int mt76_register_device(struct mt76_dev
  31514. - ieee80211_hw_set(hw, HOST_BROADCAST_PS_BUFFERING);
  31515. - ieee80211_hw_set(hw, AMPDU_AGGREGATION);
  31516. - ieee80211_hw_set(hw, SUPPORTS_RC_TABLE);
  31517. -- ieee80211_hw_set(hw, SUPPORT_FAST_XMIT);
  31518. -
  31519. - hw->sta_data_size = sizeof(struct mt76_sta);
  31520. - hw->vif_data_size = sizeof(struct mt76_vif);
  31521. diff --git a/package/kernel/mwlwifi/patches/100-drop_old_api.patch b/package/kernel/mwlwifi/patches/100-drop_old_api.patch
  31522. new file mode 100644
  31523. index 0000000..d2e149e
  31524. --- /dev/null
  31525. +++ b/package/kernel/mwlwifi/patches/100-drop_old_api.patch
  31526. @@ -0,0 +1,92 @@
  31527. +--- a/main.c
  31528. ++++ b/main.c
  31529. +@@ -418,11 +418,7 @@ static void mwl_set_ht_caps(struct mwl_p
  31530. + band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_20;
  31531. + band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_40;
  31532. +
  31533. +-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
  31534. +- hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;
  31535. +-#else
  31536. + ieee80211_hw_set(hw, AMPDU_AGGREGATION);
  31537. +-#endif
  31538. + band->ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K;
  31539. + band->ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_4;
  31540. +
  31541. +@@ -524,29 +520,16 @@ static int mwl_wl_init(struct mwl_priv *
  31542. + hw->queues = SYSADPT_TX_WMM_QUEUES;
  31543. +
  31544. + /* Set rssi values to dBm */
  31545. +-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
  31546. +- hw->flags |= IEEE80211_HW_SIGNAL_DBM | IEEE80211_HW_HAS_RATE_CONTROL;
  31547. +-#else
  31548. + ieee80211_hw_set(hw, SIGNAL_DBM);
  31549. + ieee80211_hw_set(hw, HAS_RATE_CONTROL);
  31550. +-#endif
  31551. +
  31552. + /* Ask mac80211 not to trigger PS mode
  31553. + * based on PM bit of incoming frames.
  31554. + */
  31555. +-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
  31556. +- hw->flags |= IEEE80211_HW_AP_LINK_PS;
  31557. +-#else
  31558. + ieee80211_hw_set(hw, AP_LINK_PS);
  31559. +-#endif
  31560. +
  31561. +-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
  31562. +- hw->flags |= IEEE80211_HW_SUPPORTS_PER_STA_GTK |
  31563. +- IEEE80211_HW_MFP_CAPABLE;
  31564. +-#else
  31565. + ieee80211_hw_set(hw, SUPPORTS_PER_STA_GTK);
  31566. + ieee80211_hw_set(hw, MFP_CAPABLE);
  31567. +-#endif
  31568. +
  31569. + hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
  31570. +
  31571. +--- a/dev.h
  31572. ++++ b/dev.h
  31573. +@@ -484,10 +484,6 @@ static inline struct mwl_sta *mwl_dev_ge
  31574. + return (struct mwl_sta *)&sta->drv_priv;
  31575. + }
  31576. +
  31577. +-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)
  31578. +-#define ether_addr_copy(dst, src) memcpy(dst, src, ETH_ALEN)
  31579. +-#endif
  31580. +-
  31581. + /* Defined in mac80211.c. */
  31582. + extern const struct ieee80211_ops mwl_mac80211_ops;
  31583. +
  31584. +--- a/mac80211.c
  31585. ++++ b/mac80211.c
  31586. +@@ -572,19 +572,11 @@ static int mwl_mac80211_get_survey(struc
  31587. + return 0;
  31588. + }
  31589. +
  31590. +-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
  31591. +-static int mwl_mac80211_ampdu_action(struct ieee80211_hw *hw,
  31592. +- struct ieee80211_vif *vif,
  31593. +- enum ieee80211_ampdu_mlme_action action,
  31594. +- struct ieee80211_sta *sta,
  31595. +- u16 tid, u16 *ssn, u8 buf_size)
  31596. +-#else
  31597. + static int mwl_mac80211_ampdu_action(struct ieee80211_hw *hw,
  31598. + struct ieee80211_vif *vif,
  31599. + enum ieee80211_ampdu_mlme_action action,
  31600. + struct ieee80211_sta *sta,
  31601. + u16 tid, u16 *ssn, u8 buf_size, bool amsdu)
  31602. +-#endif
  31603. + {
  31604. + int rc = 0;
  31605. + struct mwl_priv *priv = hw->priv;
  31606. +--- a/rx.c
  31607. ++++ b/rx.c
  31608. +@@ -232,10 +232,8 @@ static inline void mwl_rx_prepare_status
  31609. + status->flag |= RX_FLAG_VHT;
  31610. + if (bw == RX_RATE_INFO_HT40)
  31611. + status->flag |= RX_FLAG_40MHZ;
  31612. +-#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 18, 0)
  31613. + if (bw == RX_RATE_INFO_HT80)
  31614. + status->vht_flag |= RX_VHT_FLAG_80MHZ;
  31615. +-#endif
  31616. + if (gi == RX_RATE_INFO_SHORT_INTERVAL)
  31617. + status->flag |= RX_FLAG_SHORT_GI;
  31618. + status->vht_nss = (nss + 1);
  31619. diff --git a/package/kernel/mwlwifi/patches/110-api_sync.patch b/package/kernel/mwlwifi/patches/110-api_sync.patch
  31620. new file mode 100644
  31621. index 0000000..ed3e06a
  31622. --- /dev/null
  31623. +++ b/package/kernel/mwlwifi/patches/110-api_sync.patch
  31624. @@ -0,0 +1,19 @@
  31625. +--- a/mac80211.c
  31626. ++++ b/mac80211.c
  31627. +@@ -597,10 +597,13 @@ static int mwl_mac80211_get_survey(struc
  31628. +
  31629. + static int mwl_mac80211_ampdu_action(struct ieee80211_hw *hw,
  31630. + struct ieee80211_vif *vif,
  31631. +- enum ieee80211_ampdu_mlme_action action,
  31632. +- struct ieee80211_sta *sta,
  31633. +- u16 tid, u16 *ssn, u8 buf_size, bool amsdu)
  31634. ++ struct ieee80211_ampdu_params *params)
  31635. + {
  31636. ++ enum ieee80211_ampdu_mlme_action action = params->action;
  31637. ++ struct ieee80211_sta *sta = params->sta;
  31638. ++ u16 tid = params->tid;
  31639. ++ u16 *ssn = &params->ssn;
  31640. ++ u8 buf_size = params->buf_size;
  31641. + int rc = 0;
  31642. + struct mwl_priv *priv = hw->priv;
  31643. + struct mwl_ampdu_stream *stream;
  31644. diff --git a/target/linux/generic/files/include/linux/ath9k_platform.h b/target/linux/generic/files/include/linux/ath9k_platform.h
  31645. index 9fa7016..30ce216 100644
  31646. --- a/target/linux/generic/files/include/linux/ath9k_platform.h
  31647. +++ b/target/linux/generic/files/include/linux/ath9k_platform.h
  31648. @@ -36,6 +36,7 @@ struct ath9k_platform_data {
  31649. bool tx_gain_buffalo;
  31650. bool disable_2ghz;
  31651. bool disable_5ghz;
  31652. + bool led_active_high;
  31653. int (*get_mac_revision)(void);
  31654. int (*external_reset)(void);
  31655. diff --git a/target/linux/generic/patches-3.18/030-backport_bcm47xx_nvram.patch b/target/linux/generic/patches-3.18/030-backport_bcm47xx_nvram.patch
  31656. new file mode 100644
  31657. index 0000000..7ae8b1d
  31658. --- /dev/null
  31659. +++ b/target/linux/generic/patches-3.18/030-backport_bcm47xx_nvram.patch
  31660. @@ -0,0 +1,52 @@
  31661. +--- /dev/null
  31662. ++++ b/include/linux/bcm47xx_nvram.h
  31663. +@@ -0,0 +1,49 @@
  31664. ++/*
  31665. ++ * This program is free software; you can redistribute it and/or modify it
  31666. ++ * under the terms of the GNU General Public License as published by the
  31667. ++ * Free Software Foundation; either version 2 of the License, or (at your
  31668. ++ * option) any later version.
  31669. ++ */
  31670. ++
  31671. ++#ifndef __BCM47XX_NVRAM_H
  31672. ++#define __BCM47XX_NVRAM_H
  31673. ++
  31674. ++#include <linux/types.h>
  31675. ++#include <linux/kernel.h>
  31676. ++#include <linux/vmalloc.h>
  31677. ++
  31678. ++#ifdef CONFIG_BCM47XX_NVRAM
  31679. ++int bcm47xx_nvram_init_from_mem(u32 base, u32 lim);
  31680. ++int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len);
  31681. ++int bcm47xx_nvram_gpio_pin(const char *name);
  31682. ++char *bcm47xx_nvram_get_contents(size_t *val_len);
  31683. ++static inline void bcm47xx_nvram_release_contents(char *nvram)
  31684. ++{
  31685. ++ vfree(nvram);
  31686. ++};
  31687. ++#else
  31688. ++static inline int bcm47xx_nvram_init_from_mem(u32 base, u32 lim)
  31689. ++{
  31690. ++ return -ENOTSUPP;
  31691. ++};
  31692. ++static inline int bcm47xx_nvram_getenv(const char *name, char *val,
  31693. ++ size_t val_len)
  31694. ++{
  31695. ++ return -ENOTSUPP;
  31696. ++};
  31697. ++static inline int bcm47xx_nvram_gpio_pin(const char *name)
  31698. ++{
  31699. ++ return -ENOTSUPP;
  31700. ++};
  31701. ++
  31702. ++static inline char *bcm47xx_nvram_get_contents(size_t *val_len)
  31703. ++{
  31704. ++ return NULL;
  31705. ++};
  31706. ++
  31707. ++static inline void bcm47xx_nvram_release_contents(char *nvram)
  31708. ++{
  31709. ++};
  31710. ++#endif
  31711. ++
  31712. ++#endif /* __BCM47XX_NVRAM_H */
  31713. diff --git a/target/linux/generic/patches-3.18/031-bcma-from-4.5.patch b/target/linux/generic/patches-3.18/031-bcma-from-4.5.patch
  31714. new file mode 100644
  31715. index 0000000..171395d
  31716. --- /dev/null
  31717. +++ b/target/linux/generic/patches-3.18/031-bcma-from-4.5.patch
  31718. @@ -0,0 +1,49 @@
  31719. +--- a/drivers/bcma/main.c
  31720. ++++ b/drivers/bcma/main.c
  31721. +@@ -637,11 +637,36 @@ static int bcma_device_uevent(struct dev
  31722. + core->id.rev, core->id.class);
  31723. + }
  31724. +
  31725. +-static int __init bcma_modinit(void)
  31726. ++static unsigned int bcma_bus_registered;
  31727. ++
  31728. ++/*
  31729. ++ * If built-in, bus has to be registered early, before any driver calls
  31730. ++ * bcma_driver_register.
  31731. ++ * Otherwise registering driver would trigger BUG in driver_register.
  31732. ++ */
  31733. ++static int __init bcma_init_bus_register(void)
  31734. + {
  31735. + int err;
  31736. +
  31737. ++ if (bcma_bus_registered)
  31738. ++ return 0;
  31739. ++
  31740. + err = bus_register(&bcma_bus_type);
  31741. ++ if (!err)
  31742. ++ bcma_bus_registered = 1;
  31743. ++
  31744. ++ return err;
  31745. ++}
  31746. ++#ifndef MODULE
  31747. ++fs_initcall(bcma_init_bus_register);
  31748. ++#endif
  31749. ++
  31750. ++/* Main initialization has to be done with SPI/mtd/NAND/SPROM available */
  31751. ++static int __init bcma_modinit(void)
  31752. ++{
  31753. ++ int err;
  31754. ++
  31755. ++ err = bcma_init_bus_register();
  31756. + if (err)
  31757. + return err;
  31758. +
  31759. +@@ -660,7 +685,7 @@ static int __init bcma_modinit(void)
  31760. +
  31761. + return err;
  31762. + }
  31763. +-fs_initcall(bcma_modinit);
  31764. ++module_init(bcma_modinit);
  31765. +
  31766. + static void __exit bcma_modexit(void)
  31767. + {
  31768. diff --git a/target/linux/generic/patches-3.18/032-bcma-from-4.6.patch b/target/linux/generic/patches-3.18/032-bcma-from-4.6.patch
  31769. new file mode 100644
  31770. index 0000000..a74d9ee
  31771. --- /dev/null
  31772. +++ b/target/linux/generic/patches-3.18/032-bcma-from-4.6.patch
  31773. @@ -0,0 +1,444 @@
  31774. +--- a/drivers/bcma/driver_chipcommon.c
  31775. ++++ b/drivers/bcma/driver_chipcommon.c
  31776. +@@ -15,6 +15,8 @@
  31777. + #include <linux/platform_device.h>
  31778. + #include <linux/bcma/bcma.h>
  31779. +
  31780. ++static void bcma_chipco_serial_init(struct bcma_drv_cc *cc);
  31781. ++
  31782. + static inline u32 bcma_cc_write32_masked(struct bcma_drv_cc *cc, u16 offset,
  31783. + u32 mask, u32 value)
  31784. + {
  31785. +@@ -115,6 +117,8 @@ int bcma_chipco_watchdog_register(struct
  31786. +
  31787. + void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc)
  31788. + {
  31789. ++ struct bcma_bus *bus = cc->core->bus;
  31790. ++
  31791. + if (cc->early_setup_done)
  31792. + return;
  31793. +
  31794. +@@ -129,6 +133,9 @@ void bcma_core_chipcommon_early_init(str
  31795. + if (cc->capabilities & BCMA_CC_CAP_PMU)
  31796. + bcma_pmu_early_init(cc);
  31797. +
  31798. ++ if (IS_BUILTIN(CONFIG_BCM47XX) && bus->hosttype == BCMA_HOSTTYPE_SOC)
  31799. ++ bcma_chipco_serial_init(cc);
  31800. ++
  31801. + cc->early_setup_done = true;
  31802. + }
  31803. +
  31804. +@@ -185,11 +192,12 @@ u32 bcma_chipco_watchdog_timer_set(struc
  31805. + ticks = 2;
  31806. + else if (ticks > maxt)
  31807. + ticks = maxt;
  31808. +- bcma_cc_write32(cc, BCMA_CC_PMU_WATCHDOG, ticks);
  31809. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_WATCHDOG, ticks);
  31810. + } else {
  31811. + struct bcma_bus *bus = cc->core->bus;
  31812. +
  31813. + if (bus->chipinfo.id != BCMA_CHIP_ID_BCM4707 &&
  31814. ++ bus->chipinfo.id != BCMA_CHIP_ID_BCM47094 &&
  31815. + bus->chipinfo.id != BCMA_CHIP_ID_BCM53018)
  31816. + bcma_core_set_clockmode(cc->core,
  31817. + ticks ? BCMA_CLKMODE_FAST : BCMA_CLKMODE_DYNAMIC);
  31818. +@@ -314,9 +322,9 @@ u32 bcma_chipco_gpio_pulldown(struct bcm
  31819. + return res;
  31820. + }
  31821. +
  31822. +-#ifdef CONFIG_BCMA_DRIVER_MIPS
  31823. +-void bcma_chipco_serial_init(struct bcma_drv_cc *cc)
  31824. ++static void bcma_chipco_serial_init(struct bcma_drv_cc *cc)
  31825. + {
  31826. ++#if IS_BUILTIN(CONFIG_BCM47XX)
  31827. + unsigned int irq;
  31828. + u32 baud_base;
  31829. + u32 i;
  31830. +@@ -358,5 +366,5 @@ void bcma_chipco_serial_init(struct bcma
  31831. + ports[i].baud_base = baud_base;
  31832. + ports[i].reg_shift = 0;
  31833. + }
  31834. ++#endif /* CONFIG_BCM47XX */
  31835. + }
  31836. +-#endif /* CONFIG_BCMA_DRIVER_MIPS */
  31837. +--- a/drivers/bcma/driver_chipcommon_pmu.c
  31838. ++++ b/drivers/bcma/driver_chipcommon_pmu.c
  31839. +@@ -15,44 +15,44 @@
  31840. +
  31841. + u32 bcma_chipco_pll_read(struct bcma_drv_cc *cc, u32 offset)
  31842. + {
  31843. +- bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR, offset);
  31844. +- bcma_cc_read32(cc, BCMA_CC_PLLCTL_ADDR);
  31845. +- return bcma_cc_read32(cc, BCMA_CC_PLLCTL_DATA);
  31846. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR, offset);
  31847. ++ bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_ADDR);
  31848. ++ return bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_DATA);
  31849. + }
  31850. + EXPORT_SYMBOL_GPL(bcma_chipco_pll_read);
  31851. +
  31852. + void bcma_chipco_pll_write(struct bcma_drv_cc *cc, u32 offset, u32 value)
  31853. + {
  31854. +- bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR, offset);
  31855. +- bcma_cc_read32(cc, BCMA_CC_PLLCTL_ADDR);
  31856. +- bcma_cc_write32(cc, BCMA_CC_PLLCTL_DATA, value);
  31857. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR, offset);
  31858. ++ bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_ADDR);
  31859. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_DATA, value);
  31860. + }
  31861. + EXPORT_SYMBOL_GPL(bcma_chipco_pll_write);
  31862. +
  31863. + void bcma_chipco_pll_maskset(struct bcma_drv_cc *cc, u32 offset, u32 mask,
  31864. + u32 set)
  31865. + {
  31866. +- bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR, offset);
  31867. +- bcma_cc_read32(cc, BCMA_CC_PLLCTL_ADDR);
  31868. +- bcma_cc_maskset32(cc, BCMA_CC_PLLCTL_DATA, mask, set);
  31869. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR, offset);
  31870. ++ bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_ADDR);
  31871. ++ bcma_pmu_maskset32(cc, BCMA_CC_PMU_PLLCTL_DATA, mask, set);
  31872. + }
  31873. + EXPORT_SYMBOL_GPL(bcma_chipco_pll_maskset);
  31874. +
  31875. + void bcma_chipco_chipctl_maskset(struct bcma_drv_cc *cc,
  31876. + u32 offset, u32 mask, u32 set)
  31877. + {
  31878. +- bcma_cc_write32(cc, BCMA_CC_CHIPCTL_ADDR, offset);
  31879. +- bcma_cc_read32(cc, BCMA_CC_CHIPCTL_ADDR);
  31880. +- bcma_cc_maskset32(cc, BCMA_CC_CHIPCTL_DATA, mask, set);
  31881. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_CHIPCTL_ADDR, offset);
  31882. ++ bcma_pmu_read32(cc, BCMA_CC_PMU_CHIPCTL_ADDR);
  31883. ++ bcma_pmu_maskset32(cc, BCMA_CC_PMU_CHIPCTL_DATA, mask, set);
  31884. + }
  31885. + EXPORT_SYMBOL_GPL(bcma_chipco_chipctl_maskset);
  31886. +
  31887. + void bcma_chipco_regctl_maskset(struct bcma_drv_cc *cc, u32 offset, u32 mask,
  31888. + u32 set)
  31889. + {
  31890. +- bcma_cc_write32(cc, BCMA_CC_REGCTL_ADDR, offset);
  31891. +- bcma_cc_read32(cc, BCMA_CC_REGCTL_ADDR);
  31892. +- bcma_cc_maskset32(cc, BCMA_CC_REGCTL_DATA, mask, set);
  31893. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_REGCTL_ADDR, offset);
  31894. ++ bcma_pmu_read32(cc, BCMA_CC_PMU_REGCTL_ADDR);
  31895. ++ bcma_pmu_maskset32(cc, BCMA_CC_PMU_REGCTL_DATA, mask, set);
  31896. + }
  31897. + EXPORT_SYMBOL_GPL(bcma_chipco_regctl_maskset);
  31898. +
  31899. +@@ -60,18 +60,18 @@ static u32 bcma_pmu_xtalfreq(struct bcma
  31900. + {
  31901. + u32 ilp_ctl, alp_hz;
  31902. +
  31903. +- if (!(bcma_cc_read32(cc, BCMA_CC_PMU_STAT) &
  31904. ++ if (!(bcma_pmu_read32(cc, BCMA_CC_PMU_STAT) &
  31905. + BCMA_CC_PMU_STAT_EXT_LPO_AVAIL))
  31906. + return 0;
  31907. +
  31908. +- bcma_cc_write32(cc, BCMA_CC_PMU_XTAL_FREQ,
  31909. +- BIT(BCMA_CC_PMU_XTAL_FREQ_MEASURE_SHIFT));
  31910. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_XTAL_FREQ,
  31911. ++ BIT(BCMA_CC_PMU_XTAL_FREQ_MEASURE_SHIFT));
  31912. + usleep_range(1000, 2000);
  31913. +
  31914. +- ilp_ctl = bcma_cc_read32(cc, BCMA_CC_PMU_XTAL_FREQ);
  31915. ++ ilp_ctl = bcma_pmu_read32(cc, BCMA_CC_PMU_XTAL_FREQ);
  31916. + ilp_ctl &= BCMA_CC_PMU_XTAL_FREQ_ILPCTL_MASK;
  31917. +
  31918. +- bcma_cc_write32(cc, BCMA_CC_PMU_XTAL_FREQ, 0);
  31919. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_XTAL_FREQ, 0);
  31920. +
  31921. + alp_hz = ilp_ctl * 32768 / 4;
  31922. + return (alp_hz + 50000) / 100000 * 100;
  31923. +@@ -127,8 +127,8 @@ static void bcma_pmu2_pll_init0(struct b
  31924. + mask = (u32)~(BCMA_RES_4314_HT_AVAIL |
  31925. + BCMA_RES_4314_MACPHY_CLK_AVAIL);
  31926. +
  31927. +- bcma_cc_mask32(cc, BCMA_CC_PMU_MINRES_MSK, mask);
  31928. +- bcma_cc_mask32(cc, BCMA_CC_PMU_MAXRES_MSK, mask);
  31929. ++ bcma_pmu_mask32(cc, BCMA_CC_PMU_MINRES_MSK, mask);
  31930. ++ bcma_pmu_mask32(cc, BCMA_CC_PMU_MAXRES_MSK, mask);
  31931. + bcma_wait_value(cc->core, BCMA_CLKCTLST,
  31932. + BCMA_CLKCTLST_HAVEHT, 0, 20000);
  31933. + break;
  31934. +@@ -140,7 +140,7 @@ static void bcma_pmu2_pll_init0(struct b
  31935. +
  31936. + /* Flush */
  31937. + if (cc->pmu.rev >= 2)
  31938. +- bcma_cc_set32(cc, BCMA_CC_PMU_CTL, BCMA_CC_PMU_CTL_PLL_UPD);
  31939. ++ bcma_pmu_set32(cc, BCMA_CC_PMU_CTL, BCMA_CC_PMU_CTL_PLL_UPD);
  31940. +
  31941. + /* TODO: Do we need to update OTP? */
  31942. + }
  31943. +@@ -195,9 +195,9 @@ static void bcma_pmu_resources_init(stru
  31944. +
  31945. + /* Set the resource masks. */
  31946. + if (min_msk)
  31947. +- bcma_cc_write32(cc, BCMA_CC_PMU_MINRES_MSK, min_msk);
  31948. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_MINRES_MSK, min_msk);
  31949. + if (max_msk)
  31950. +- bcma_cc_write32(cc, BCMA_CC_PMU_MAXRES_MSK, max_msk);
  31951. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_MAXRES_MSK, max_msk);
  31952. +
  31953. + /*
  31954. + * Add some delay; allow resources to come up and settle.
  31955. +@@ -269,23 +269,33 @@ static void bcma_pmu_workarounds(struct
  31956. +
  31957. + void bcma_pmu_early_init(struct bcma_drv_cc *cc)
  31958. + {
  31959. ++ struct bcma_bus *bus = cc->core->bus;
  31960. + u32 pmucap;
  31961. +
  31962. +- pmucap = bcma_cc_read32(cc, BCMA_CC_PMU_CAP);
  31963. ++ if (cc->core->id.rev >= 35 &&
  31964. ++ cc->capabilities_ext & BCMA_CC_CAP_EXT_AOB_PRESENT) {
  31965. ++ cc->pmu.core = bcma_find_core(bus, BCMA_CORE_PMU);
  31966. ++ if (!cc->pmu.core)
  31967. ++ bcma_warn(bus, "Couldn't find expected PMU core");
  31968. ++ }
  31969. ++ if (!cc->pmu.core)
  31970. ++ cc->pmu.core = cc->core;
  31971. ++
  31972. ++ pmucap = bcma_pmu_read32(cc, BCMA_CC_PMU_CAP);
  31973. + cc->pmu.rev = (pmucap & BCMA_CC_PMU_CAP_REVISION);
  31974. +
  31975. +- bcma_debug(cc->core->bus, "Found rev %u PMU (capabilities 0x%08X)\n",
  31976. +- cc->pmu.rev, pmucap);
  31977. ++ bcma_debug(bus, "Found rev %u PMU (capabilities 0x%08X)\n", cc->pmu.rev,
  31978. ++ pmucap);
  31979. + }
  31980. +
  31981. + void bcma_pmu_init(struct bcma_drv_cc *cc)
  31982. + {
  31983. + if (cc->pmu.rev == 1)
  31984. +- bcma_cc_mask32(cc, BCMA_CC_PMU_CTL,
  31985. +- ~BCMA_CC_PMU_CTL_NOILPONW);
  31986. ++ bcma_pmu_mask32(cc, BCMA_CC_PMU_CTL,
  31987. ++ ~BCMA_CC_PMU_CTL_NOILPONW);
  31988. + else
  31989. +- bcma_cc_set32(cc, BCMA_CC_PMU_CTL,
  31990. +- BCMA_CC_PMU_CTL_NOILPONW);
  31991. ++ bcma_pmu_set32(cc, BCMA_CC_PMU_CTL,
  31992. ++ BCMA_CC_PMU_CTL_NOILPONW);
  31993. +
  31994. + bcma_pmu_pll_init(cc);
  31995. + bcma_pmu_resources_init(cc);
  31996. +@@ -472,8 +482,8 @@ u32 bcma_pmu_get_cpu_clock(struct bcma_d
  31997. + static void bcma_pmu_spuravoid_pll_write(struct bcma_drv_cc *cc, u32 offset,
  31998. + u32 value)
  31999. + {
  32000. +- bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR, offset);
  32001. +- bcma_cc_write32(cc, BCMA_CC_PLLCTL_DATA, value);
  32002. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR, offset);
  32003. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_DATA, value);
  32004. + }
  32005. +
  32006. + void bcma_pmu_spuravoid_pllupdate(struct bcma_drv_cc *cc, int spuravoid)
  32007. +@@ -497,20 +507,20 @@ void bcma_pmu_spuravoid_pllupdate(struct
  32008. + bus->chipinfo.id == BCMA_CHIP_ID_BCM53572) ? 6 : 0;
  32009. +
  32010. + /* RMW only the P1 divider */
  32011. +- bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR,
  32012. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR,
  32013. + BCMA_CC_PMU_PLL_CTL0 + phypll_offset);
  32014. +- tmp = bcma_cc_read32(cc, BCMA_CC_PLLCTL_DATA);
  32015. ++ tmp = bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_DATA);
  32016. + tmp &= (~(BCMA_CC_PMU1_PLL0_PC0_P1DIV_MASK));
  32017. + tmp |= (bcm5357_bcm43236_p1div[spuravoid] << BCMA_CC_PMU1_PLL0_PC0_P1DIV_SHIFT);
  32018. +- bcma_cc_write32(cc, BCMA_CC_PLLCTL_DATA, tmp);
  32019. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_DATA, tmp);
  32020. +
  32021. + /* RMW only the int feedback divider */
  32022. +- bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR,
  32023. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR,
  32024. + BCMA_CC_PMU_PLL_CTL2 + phypll_offset);
  32025. +- tmp = bcma_cc_read32(cc, BCMA_CC_PLLCTL_DATA);
  32026. ++ tmp = bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_DATA);
  32027. + tmp &= ~(BCMA_CC_PMU1_PLL0_PC2_NDIV_INT_MASK);
  32028. + tmp |= (bcm5357_bcm43236_ndiv[spuravoid]) << BCMA_CC_PMU1_PLL0_PC2_NDIV_INT_SHIFT;
  32029. +- bcma_cc_write32(cc, BCMA_CC_PLLCTL_DATA, tmp);
  32030. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_DATA, tmp);
  32031. +
  32032. + tmp = BCMA_CC_PMU_CTL_PLL_UPD;
  32033. + break;
  32034. +@@ -646,7 +656,7 @@ void bcma_pmu_spuravoid_pllupdate(struct
  32035. + break;
  32036. + }
  32037. +
  32038. +- tmp |= bcma_cc_read32(cc, BCMA_CC_PMU_CTL);
  32039. +- bcma_cc_write32(cc, BCMA_CC_PMU_CTL, tmp);
  32040. ++ tmp |= bcma_pmu_read32(cc, BCMA_CC_PMU_CTL);
  32041. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_CTL, tmp);
  32042. + }
  32043. + EXPORT_SYMBOL_GPL(bcma_pmu_spuravoid_pllupdate);
  32044. +--- a/drivers/bcma/driver_chipcommon_sflash.c
  32045. ++++ b/drivers/bcma/driver_chipcommon_sflash.c
  32046. +@@ -38,6 +38,7 @@ static const struct bcma_sflash_tbl_e bc
  32047. + { "M25P32", 0x15, 0x10000, 64, },
  32048. + { "M25P64", 0x16, 0x10000, 128, },
  32049. + { "M25FL128", 0x17, 0x10000, 256, },
  32050. ++ { "MX25L25635F", 0x18, 0x10000, 512, },
  32051. + { NULL },
  32052. + };
  32053. +
  32054. +--- a/drivers/bcma/scan.c
  32055. ++++ b/drivers/bcma/scan.c
  32056. +@@ -98,6 +98,9 @@ static const struct bcma_device_id_name
  32057. + { BCMA_CORE_SHIM, "SHIM" },
  32058. + { BCMA_CORE_PCIE2, "PCIe Gen2" },
  32059. + { BCMA_CORE_ARM_CR4, "ARM CR4" },
  32060. ++ { BCMA_CORE_GCI, "GCI" },
  32061. ++ { BCMA_CORE_CMEM, "CNDS DDR2/3 memory controller" },
  32062. ++ { BCMA_CORE_ARM_CA7, "ARM CA7" },
  32063. + { BCMA_CORE_DEFAULT, "Default" },
  32064. + };
  32065. +
  32066. +@@ -315,6 +318,8 @@ static int bcma_get_next_core(struct bcm
  32067. + switch (core->id.id) {
  32068. + case BCMA_CORE_4706_MAC_GBIT_COMMON:
  32069. + case BCMA_CORE_NS_CHIPCOMMON_B:
  32070. ++ case BCMA_CORE_PMU:
  32071. ++ case BCMA_CORE_GCI:
  32072. + /* Not used yet: case BCMA_CORE_OOB_ROUTER: */
  32073. + break;
  32074. + default:
  32075. +--- a/drivers/net/wireless/b43/main.c
  32076. ++++ b/drivers/net/wireless/b43/main.c
  32077. +@@ -1215,10 +1215,10 @@ void b43_wireless_core_phy_pll_reset(str
  32078. + case B43_BUS_BCMA:
  32079. + bcma_cc = &dev->dev->bdev->bus->drv_cc;
  32080. +
  32081. +- bcma_cc_write32(bcma_cc, BCMA_CC_CHIPCTL_ADDR, 0);
  32082. +- bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4);
  32083. +- bcma_cc_set32(bcma_cc, BCMA_CC_CHIPCTL_DATA, 0x4);
  32084. +- bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4);
  32085. ++ bcma_cc_write32(bcma_cc, BCMA_CC_PMU_CHIPCTL_ADDR, 0);
  32086. ++ bcma_cc_mask32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, ~0x4);
  32087. ++ bcma_cc_set32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, 0x4);
  32088. ++ bcma_cc_mask32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, ~0x4);
  32089. + break;
  32090. + #endif
  32091. + #ifdef CONFIG_B43_SSB
  32092. +--- a/include/linux/bcma/bcma.h
  32093. ++++ b/include/linux/bcma/bcma.h
  32094. +@@ -151,6 +151,8 @@ struct bcma_host_ops {
  32095. + #define BCMA_CORE_PCIE2 0x83C /* PCI Express Gen2 */
  32096. + #define BCMA_CORE_USB30_DEV 0x83D
  32097. + #define BCMA_CORE_ARM_CR4 0x83E
  32098. ++#define BCMA_CORE_GCI 0x840
  32099. ++#define BCMA_CORE_CMEM 0x846 /* CNDS DDR2/3 memory controller */
  32100. + #define BCMA_CORE_ARM_CA7 0x847
  32101. + #define BCMA_CORE_SYS_MEM 0x849
  32102. + #define BCMA_CORE_DEFAULT 0xFFF
  32103. +@@ -199,6 +201,7 @@ struct bcma_host_ops {
  32104. + #define BCMA_PKG_ID_BCM4707 1
  32105. + #define BCMA_PKG_ID_BCM4708 2
  32106. + #define BCMA_PKG_ID_BCM4709 0
  32107. ++#define BCMA_CHIP_ID_BCM47094 53030
  32108. + #define BCMA_CHIP_ID_BCM53018 53018
  32109. +
  32110. + /* Board types (on PCI usually equals to the subsystem dev id) */
  32111. +--- a/include/linux/bcma/bcma_driver_chipcommon.h
  32112. ++++ b/include/linux/bcma/bcma_driver_chipcommon.h
  32113. +@@ -217,6 +217,11 @@
  32114. + #define BCMA_CC_CLKDIV_JTAG_SHIFT 8
  32115. + #define BCMA_CC_CLKDIV_UART 0x000000FF
  32116. + #define BCMA_CC_CAP_EXT 0x00AC /* Capabilities */
  32117. ++#define BCMA_CC_CAP_EXT_SECI_PRESENT 0x00000001
  32118. ++#define BCMA_CC_CAP_EXT_GSIO_PRESENT 0x00000002
  32119. ++#define BCMA_CC_CAP_EXT_GCI_PRESENT 0x00000004
  32120. ++#define BCMA_CC_CAP_EXT_SECI_PUART_PRESENT 0x00000008 /* UART present */
  32121. ++#define BCMA_CC_CAP_EXT_AOB_PRESENT 0x00000040
  32122. + #define BCMA_CC_PLLONDELAY 0x00B0 /* Rev >= 4 only */
  32123. + #define BCMA_CC_FREFSELDELAY 0x00B4 /* Rev >= 4 only */
  32124. + #define BCMA_CC_SLOWCLKCTL 0x00B8 /* 6 <= Rev <= 9 only */
  32125. +@@ -351,12 +356,12 @@
  32126. + #define BCMA_CC_PMU_RES_REQTS 0x0640 /* PMU res req timer sel */
  32127. + #define BCMA_CC_PMU_RES_REQT 0x0644 /* PMU res req timer */
  32128. + #define BCMA_CC_PMU_RES_REQM 0x0648 /* PMU res req mask */
  32129. +-#define BCMA_CC_CHIPCTL_ADDR 0x0650
  32130. +-#define BCMA_CC_CHIPCTL_DATA 0x0654
  32131. +-#define BCMA_CC_REGCTL_ADDR 0x0658
  32132. +-#define BCMA_CC_REGCTL_DATA 0x065C
  32133. +-#define BCMA_CC_PLLCTL_ADDR 0x0660
  32134. +-#define BCMA_CC_PLLCTL_DATA 0x0664
  32135. ++#define BCMA_CC_PMU_CHIPCTL_ADDR 0x0650
  32136. ++#define BCMA_CC_PMU_CHIPCTL_DATA 0x0654
  32137. ++#define BCMA_CC_PMU_REGCTL_ADDR 0x0658
  32138. ++#define BCMA_CC_PMU_REGCTL_DATA 0x065C
  32139. ++#define BCMA_CC_PMU_PLLCTL_ADDR 0x0660
  32140. ++#define BCMA_CC_PMU_PLLCTL_DATA 0x0664
  32141. + #define BCMA_CC_PMU_STRAPOPT 0x0668 /* (corerev >= 28) */
  32142. + #define BCMA_CC_PMU_XTAL_FREQ 0x066C /* (pmurev >= 10) */
  32143. + #define BCMA_CC_PMU_XTAL_FREQ_ILPCTL_MASK 0x00001FFF
  32144. +@@ -566,6 +571,7 @@
  32145. + * Check availability with ((struct bcma_chipcommon)->capabilities & BCMA_CC_CAP_PMU)
  32146. + */
  32147. + struct bcma_chipcommon_pmu {
  32148. ++ struct bcma_device *core; /* Can be separated core or just ChipCommon one */
  32149. + u8 rev; /* PMU revision */
  32150. + u32 crystalfreq; /* The active crystal frequency (in kHz) */
  32151. + };
  32152. +@@ -663,6 +669,19 @@ struct bcma_drv_cc_b {
  32153. + #define bcma_cc_maskset32(cc, offset, mask, set) \
  32154. + bcma_cc_write32(cc, offset, (bcma_cc_read32(cc, offset) & (mask)) | (set))
  32155. +
  32156. ++/* PMU registers access */
  32157. ++#define bcma_pmu_read32(cc, offset) \
  32158. ++ bcma_read32((cc)->pmu.core, offset)
  32159. ++#define bcma_pmu_write32(cc, offset, val) \
  32160. ++ bcma_write32((cc)->pmu.core, offset, val)
  32161. ++
  32162. ++#define bcma_pmu_mask32(cc, offset, mask) \
  32163. ++ bcma_pmu_write32(cc, offset, bcma_pmu_read32(cc, offset) & (mask))
  32164. ++#define bcma_pmu_set32(cc, offset, set) \
  32165. ++ bcma_pmu_write32(cc, offset, bcma_pmu_read32(cc, offset) | (set))
  32166. ++#define bcma_pmu_maskset32(cc, offset, mask, set) \
  32167. ++ bcma_pmu_write32(cc, offset, (bcma_pmu_read32(cc, offset) & (mask)) | (set))
  32168. ++
  32169. + extern u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks);
  32170. +
  32171. + extern u32 bcma_chipco_get_alp_clock(struct bcma_drv_cc *cc);
  32172. +--- a/drivers/bcma/bcma_private.h
  32173. ++++ b/drivers/bcma/bcma_private.h
  32174. +@@ -47,7 +47,6 @@ void bcma_core_chipcommon_early_init(str
  32175. + void bcma_core_chipcommon_init(struct bcma_drv_cc *cc);
  32176. + void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable);
  32177. + #ifdef CONFIG_BCMA_DRIVER_MIPS
  32178. +-void bcma_chipco_serial_init(struct bcma_drv_cc *cc);
  32179. + extern struct platform_device bcma_pflash_dev;
  32180. + #endif /* CONFIG_BCMA_DRIVER_MIPS */
  32181. +
  32182. +--- a/drivers/bcma/driver_gpio.c
  32183. ++++ b/drivers/bcma/driver_gpio.c
  32184. +@@ -229,6 +229,7 @@ int bcma_gpio_init(struct bcma_drv_cc *c
  32185. + case BCMA_CHIP_ID_BCM4707:
  32186. + case BCMA_CHIP_ID_BCM5357:
  32187. + case BCMA_CHIP_ID_BCM53572:
  32188. ++ case BCMA_CHIP_ID_BCM47094:
  32189. + chip->ngpio = 32;
  32190. + break;
  32191. + default:
  32192. +--- a/drivers/bcma/driver_mips.c
  32193. ++++ b/drivers/bcma/driver_mips.c
  32194. +@@ -328,12 +328,9 @@ static void bcma_core_mips_flash_detect(
  32195. +
  32196. + void bcma_core_mips_early_init(struct bcma_drv_mips *mcore)
  32197. + {
  32198. +- struct bcma_bus *bus = mcore->core->bus;
  32199. +-
  32200. + if (mcore->early_setup_done)
  32201. + return;
  32202. +
  32203. +- bcma_chipco_serial_init(&bus->drv_cc);
  32204. + bcma_core_mips_flash_detect(mcore);
  32205. +
  32206. + mcore->early_setup_done = true;
  32207. +--- a/drivers/bcma/host_pci.c
  32208. ++++ b/drivers/bcma/host_pci.c
  32209. +@@ -294,7 +294,7 @@ static const struct pci_device_id bcma_p
  32210. + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4358) },
  32211. + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4359) },
  32212. + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4360) },
  32213. +- { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4365) },
  32214. ++ { PCI_DEVICE_SUB(PCI_VENDOR_ID_BROADCOM, 0x4365, PCI_VENDOR_ID_DELL, 0x0016) },
  32215. + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a0) },
  32216. + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a9) },
  32217. + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43aa) },