0007-mac80211-backport-from-trunk-r48810.patch 1.2 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Sun, 28 Feb 2016 03:14:24 +0100
  3. Subject: mac80211: backport from trunk r48810
  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..752a8e0
  623. --- /dev/null
  624. +++ b/package/firmware/linux-firmware/marvell.mk
  625. @@ -0,0 +1,56 @@
  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. +Package/libertas-spi-firmware = $(call Package/firmware-default,Marvell 8686 SPI firmware)
  673. +define Package/libertas-spi-firmware/install
  674. + $(INSTALL_DIR) $(1)/lib/firmware/libertas
  675. + $(INSTALL_DATA) \
  676. + $(PKG_BUILD_DIR)/libertas/gspi8686_v9_helper.bin \
  677. + $(PKG_BUILD_DIR)/libertas/gspi8686_v9.bin \
  678. + $(1)/lib/firmware/libertas
  679. +endef
  680. +$(eval $(call BuildPackage,libertas-spi-firmware))
  681. +
  682. diff --git a/package/firmware/linux-firmware/mediatek.mk b/package/firmware/linux-firmware/mediatek.mk
  683. new file mode 100644
  684. index 0000000..591ffee
  685. --- /dev/null
  686. +++ b/package/firmware/linux-firmware/mediatek.mk
  687. @@ -0,0 +1,43 @@
  688. +Package/mt7601u-firmware = $(call Package/firmware-default,MediaTek MT7601U firmware)
  689. +define Package/mt7601u-firmware/install
  690. + $(INSTALL_DIR) $(1)/lib/firmware
  691. + $(INSTALL_DATA) \
  692. + $(PKG_BUILD_DIR)/mt7601u.bin \
  693. + $(1)/lib/firmware
  694. +endef
  695. +$(eval $(call BuildPackage,mt7601u-firmware))
  696. +
  697. +Package/rt2800-pci-firmware = $(call Package/firmware-default,Ralink RT28xx/3xxx PCI/SoC firmware)
  698. +define Package/rt2800-pci-firmware/install
  699. + $(INSTALL_DIR) $(1)/lib/firmware
  700. + $(INSTALL_DATA) \
  701. + $(PKG_BUILD_DIR)/rt2860.bin \
  702. + $(PKG_BUILD_DIR)/rt3290.bin \
  703. + $(1)/lib/firmware
  704. +endef
  705. +$(eval $(call BuildPackage,rt2800-pci-firmware))
  706. +
  707. +Package/rt2800-usb-firmware = $(call Package/firmware-default,Ralink RT28xx/3xxx USB firmware)
  708. +define Package/rt2800-usb-firmware/install
  709. + $(INSTALL_DIR) $(1)/lib/firmware
  710. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rt2870.bin $(1)/lib/firmware/
  711. +endef
  712. +$(eval $(call BuildPackage,rt2800-usb-firmware))
  713. +
  714. +Package/rt61-pci-firmware = $(call Package/firmware-default,Ralink RT2561 firmware)
  715. +define Package/rt61-pci-firmware/install
  716. + $(INSTALL_DIR) $(1)/lib/firmware
  717. + $(INSTALL_DATA) \
  718. + $(PKG_BUILD_DIR)/rt2561.bin \
  719. + $(PKG_BUILD_DIR)/rt2561s.bin \
  720. + $(PKG_BUILD_DIR)/rt2661.bin \
  721. + $(1)/lib/firmware/
  722. +endef
  723. +$(eval $(call BuildPackage,rt61-pci-firmware))
  724. +
  725. +Package/rt73-pci-firmware = $(call Package/firmware-default,Ralink RT2573 firmware)
  726. +define Package/rt73-usb-firmware/install
  727. + $(INSTALL_DIR) $(1)/lib/firmware
  728. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rt73.bin $(1)/lib/firmware/
  729. +endef
  730. +$(eval $(call BuildPackage,rt73-pci-firmware))
  731. diff --git a/package/firmware/linux-firmware/qca.mk b/package/firmware/linux-firmware/qca.mk
  732. new file mode 100644
  733. index 0000000..7ad27ef
  734. --- /dev/null
  735. +++ b/package/firmware/linux-firmware/qca.mk
  736. @@ -0,0 +1,25 @@
  737. +Package/ar3k-firmware = $(call Package/firmware-default,ath3k firmware)
  738. +define Package/ar3k-firmware/install
  739. + $(INSTALL_DIR) $(1)/lib/firmware/ar3k
  740. + $(CP) \
  741. + $(PKG_BUILD_DIR)/ar3k/*.dfu \
  742. + $(1)/lib/firmware/ar3k
  743. +endef
  744. +$(eval $(call BuildPackage,ar3k-firmware))
  745. +
  746. +Package/ath9k-htc-firmware = $(call Package/firmware-default,AR9271/AR7010 firmware)
  747. +define Package/ath9k-htc-firmware/install
  748. + $(INSTALL_DIR) $(1)/lib/firmware/ath9k_htc
  749. + $(INSTALL_DATA) \
  750. + $(PKG_BUILD_DIR)/ath9k_htc/htc_9271-1.4.0.fw \
  751. + $(PKG_BUILD_DIR)/ath9k_htc/htc_7010-1.4.0.fw \
  752. + $(1)/lib/firmware/ath9k_htc
  753. +endef
  754. +$(eval $(call BuildPackage,ath9k-htc-firmware))
  755. +
  756. +Package/carl9170-firmware = $(call Package/firmware-default,AR9170 firmware)
  757. +define Package/carl9170-firmware/install
  758. + $(INSTALL_DIR) $(1)/lib/firmware
  759. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/carl9170-1.fw $(1)/lib/firmware
  760. +endef
  761. +$(eval $(call BuildPackage,carl9170-firmware))
  762. diff --git a/package/firmware/linux-firmware/realtek.mk b/package/firmware/linux-firmware/realtek.mk
  763. new file mode 100644
  764. index 0000000..0f8b1ce
  765. --- /dev/null
  766. +++ b/package/firmware/linux-firmware/realtek.mk
  767. @@ -0,0 +1,50 @@
  768. +Package/r8169-firmware = $(call Package/firmware-default,RealTek RTL8169 firmware)
  769. +define Package/r8169-firmware/install
  770. + $(INSTALL_DIR) $(1)/lib/firmware/rtl_nic
  771. + $(CP) \
  772. + $(PKG_BUILD_DIR)/rtl_nic/* \
  773. + $(1)/lib/firmware/rtl_nic
  774. +endef
  775. +$(eval $(call BuildPackage,r8169-firmware))
  776. +
  777. +Package/r8188eu-firmware = $(call Package/firmware-default,RealTek RTL8188EU firmware)
  778. +define Package/r8188eu-firmware/install
  779. + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  780. + $(CP) \
  781. + $(PKG_BUILD_DIR)/rtlwifi/rtl8188eufw.bin \
  782. + $(1)/lib/firmware/rtlwifi
  783. +endef
  784. +$(eval $(call BuildPackage,r8188eu-firmware))
  785. +
  786. +Package/rtl8192ce-firmware = $(call Package/firmware-default,RealTek RTL8192CE firmware)
  787. +define Package/rtl8192ce-firmware/install
  788. + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  789. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8192cfw.bin $(1)/lib/firmware/rtlwifi
  790. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8192cfwU.bin $(1)/lib/firmware/rtlwifi
  791. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8192cfwU_B.bin $(1)/lib/firmware/rtlwifi
  792. +endef
  793. +$(eval $(call BuildPackage,rtl8192ce-firmware))
  794. +
  795. +Package/rtl8192cu-firmware = $(call Package/firmware-default,RealTek RTL8192CU firmware)
  796. +define Package/rtl8192cu-firmware/install
  797. + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  798. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8192cufw.bin $(1)/lib/firmware/rtlwifi
  799. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8192cufw_A.bin $(1)/lib/firmware/rtlwifi
  800. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8192cufw_B.bin $(1)/lib/firmware/rtlwifi
  801. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8192cufw_TMSC.bin $(1)/lib/firmware/rtlwifi
  802. +endef
  803. +$(eval $(call BuildPackage,rtl8192cu-firmware))
  804. +
  805. +Package/rtl8192de-firmware = $(call Package/firmware-default,RealTek RTL8192DE firmware)
  806. +define Package/rtl8192de-firmware/install
  807. + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  808. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8192defw.bin $(1)/lib/firmware/rtlwifi
  809. +endef
  810. +$(eval $(call BuildPackage,rtl8192de-firmware))
  811. +
  812. +Package/rtl8192se-firmware = $(call Package/firmware-default,RealTek RTL8192SE firmware)
  813. +define KernelPackage/rtl8192se/install
  814. + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  815. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8192sefw.bin $(1)/lib/firmware/rtlwifi
  816. +endef
  817. +$(eval $(call BuildPackage,rtl8192se-firmware))
  818. diff --git a/package/firmware/linux-firmware/ti.mk b/package/firmware/linux-firmware/ti.mk
  819. new file mode 100644
  820. index 0000000..a1e12fc
  821. --- /dev/null
  822. +++ b/package/firmware/linux-firmware/ti.mk
  823. @@ -0,0 +1,25 @@
  824. +Package/wl12xx-firmware = $(call Package/firmware-default,TI WL12xx firmware)
  825. +define Package/wl12xx-firmware/install
  826. + $(INSTALL_DIR) $(1)/lib/firmware/ti-connectivity
  827. + $(INSTALL_DATA) \
  828. + $(PKG_BUILD_DIR)/ti-connectivity/wl127x-fw-5-mr.bin \
  829. + $(PKG_BUILD_DIR)/ti-connectivity/wl127x-fw-5-plt.bin \
  830. + $(PKG_BUILD_DIR)/ti-connectivity/wl127x-fw-5-sr.bin \
  831. + $(PKG_BUILD_DIR)/ti-connectivity/wl1271-nvs.bin \
  832. + $(PKG_BUILD_DIR)/ti-connectivity/wl128x-fw-5-mr.bin \
  833. + $(PKG_BUILD_DIR)/ti-connectivity/wl128x-fw-5-plt.bin \
  834. + $(PKG_BUILD_DIR)/ti-connectivity/wl128x-fw-5-sr.bin \
  835. + $(PKG_BUILD_DIR)/ti-connectivity/wl128x-nvs.bin \
  836. + $(1)/lib/firmware/ti-connectivity
  837. +endef
  838. +$(eval $(call BuildPackage,wl12xx-firmware))
  839. +
  840. +Package/wl18xx-firmware = $(call Package/firmware-default,TI WL18xx firmware)
  841. +define Package/wl18xx-firmware/install
  842. + $(INSTALL_DIR) $(1)/lib/firmware/ti-connectivity
  843. + $(INSTALL_DATA) \
  844. + $(PKG_BUILD_DIR)/ti-connectivity/wl18xx-fw-4.bin \
  845. + $(1)/lib/firmware/ti-connectivity
  846. +endef
  847. +$(eval $(call BuildPackage,wl18xx-firmware))
  848. +
  849. diff --git a/package/kernel/acx-mac80211/Makefile b/package/kernel/acx-mac80211/Makefile
  850. index 1820e7a..c5c020d 100644
  851. --- a/package/kernel/acx-mac80211/Makefile
  852. +++ b/package/kernel/acx-mac80211/Makefile
  853. @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk
  854. include $(INCLUDE_DIR)/kernel.mk
  855. PKG_NAME:=acx-mac80211
  856. -PKG_REV:=v20130127
  857. -PKG_VERSION:=20130909
  858. +PKG_REV:=b6fc31491020cb01d2cd1acc170cfa03ced7e726
  859. +PKG_VERSION:=20140216
  860. PKG_RELEASE:=1
  861. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  862. -PKG_SOURCE_URL:=git://acx100.git.sourceforge.net/gitroot/acx100/acx-mac80211
  863. +PKG_SOURCE_URL:=git://git.code.sf.net/p/acx100/acx-mac80211
  864. PKG_SOURCE_PROTO:=git
  865. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  866. PKG_SOURCE_VERSION:=$(PKG_REV)
  867. @@ -190,7 +190,7 @@ define Build/Compile
  868. CROSS_COMPILE="$(TARGET_CROSS)" \
  869. SUBDIRS="$(PKG_BUILD_DIR)" \
  870. $(PKG_EXTRA_KCONFIG) \
  871. - EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS) -DCONFIG_ACX_MAC80211_VERSION=\"KERNEL_VERSION(3,14,0)\"" \
  872. + EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS) -DCONFIG_ACX_MAC80211_VERSION=\"KERNEL_VERSION(4,2,0)\"" \
  873. LINUXINCLUDE="-I$(STAGING_DIR)/usr/include/mac80211-backport/uapi -I$(STAGING_DIR)/usr/include/mac80211-backport \
  874. -I$(STAGING_DIR)/usr/include/mac80211/uapi -I$(STAGING_DIR)/usr/include/mac80211 \
  875. -I$(LINUX_DIR)/include -I$(LINUX_DIR)/include/$(LINUX_UAPI_DIR) \
  876. 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
  877. deleted file mode 100644
  878. index fa4a6be..0000000
  879. --- a/package/kernel/acx-mac80211/patches/001-pci-mem-Fix-3.8-build.patch
  880. +++ /dev/null
  881. @@ -1,129 +0,0 @@
  882. -From 8a0f5890019bf43f4bc95ef0754b062ddfcfa9cd Mon Sep 17 00:00:00 2001
  883. -From: Oliver Winker <oliver@oli1170.net>
  884. -Date: Sun, 10 Mar 2013 21:04:23 +0100
  885. -Subject: [PATCH 1/3] pci, mem: Fix 3.8 build
  886. -
  887. -__devexit and __devinit not used anymore in 3.8
  888. -
  889. -Signed-off-by: Reinhard Karcher <reinhard.karcher@gmx.net>
  890. -Signed-off-by: Oliver Winker <oliver@oli1170.net>
  891. ----
  892. - mem.c | 13 ++++++++++++-
  893. - pci.c | 26 +++++++++++++++++++++++++-
  894. - 2 files changed, 37 insertions(+), 2 deletions(-)
  895. -
  896. ---- a/mem.c
  897. -+++ b/mem.c
  898. -@@ -2216,7 +2216,11 @@ int acx100mem_ioctl_set_phy_amp_bias(str
  899. - * ==================================================
  900. - */
  901. -
  902. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  903. - static int __devinit acxmem_probe(struct platform_device *pdev)
  904. -+#else
  905. -+static int acxmem_probe(struct platform_device *pdev)
  906. -+#endif
  907. - {
  908. - acx_device_t *adev = NULL;
  909. - const char *chip_name;
  910. -@@ -2392,7 +2396,11 @@ static int __devinit acxmem_probe(struct
  911. - * pdev - ptr to PCI device structure containing info about pci
  912. - * configuration
  913. - */
  914. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  915. - static int __devexit acxmem_remove(struct platform_device *pdev)
  916. -+#else
  917. -+static int acxmem_remove(struct platform_device *pdev)
  918. -+#endif
  919. - {
  920. - struct ieee80211_hw *hw = (struct ieee80211_hw *)
  921. - platform_get_drvdata(pdev);
  922. -@@ -2594,8 +2602,11 @@ static struct platform_driver acxmem_dri
  923. - .name = "acx-mem",
  924. - },
  925. - .probe = acxmem_probe,
  926. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  927. - .remove = __devexit_p(acxmem_remove),
  928. --
  929. -+#else
  930. -+ .remove = acxmem_remove,
  931. -+#endif
  932. - #ifdef CONFIG_PM
  933. - .suspend = acxmem_e_suspend,
  934. - .resume = acxmem_e_resume
  935. ---- a/pci.c
  936. -+++ b/pci.c
  937. -@@ -1039,7 +1039,11 @@ int acx100pci_ioctl_set_phy_amp_bias(str
  938. - * id - ptr to the device id entry that matched this device
  939. - */
  940. - #ifdef CONFIG_PCI
  941. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  942. - static int __devinit acxpci_probe(struct pci_dev *pdev,
  943. -+#else
  944. -+static int acxpci_probe(struct pci_dev *pdev,
  945. -+#endif
  946. - const struct pci_device_id *id)
  947. - {
  948. - unsigned long mem_region1 = 0;
  949. -@@ -1292,7 +1296,11 @@ static int __devinit acxpci_probe(struct
  950. - *
  951. - * pdev - ptr to PCI device structure containing info about pci configuration
  952. - */
  953. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  954. - static void __devexit acxpci_remove(struct pci_dev *pdev)
  955. -+#else
  956. -+static void acxpci_remove(struct pci_dev *pdev)
  957. -+#endif
  958. - {
  959. - struct ieee80211_hw *hw
  960. - = (struct ieee80211_hw *) pci_get_drvdata(pdev);
  961. -@@ -1505,7 +1513,11 @@ static struct pci_driver acxpci_driver =
  962. - .name = "acx_pci",
  963. - .id_table = acxpci_id_tbl,
  964. - .probe = acxpci_probe,
  965. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  966. - .remove = __devexit_p(acxpci_remove),
  967. -+#else
  968. -+ .remove = acxpci_remove,
  969. -+#endif
  970. - #ifdef CONFIG_PM
  971. - .suspend = acxpci_e_suspend,
  972. - .resume = acxpci_e_resume
  973. -@@ -1603,8 +1615,12 @@ static struct vlynq_device_id acx_vlynq_
  974. - };
  975. -
  976. -
  977. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  978. - static __devinit int vlynq_probe(struct vlynq_device *vdev,
  979. -- struct vlynq_device_id *id)
  980. -+#else
  981. -+static int vlynq_probe(struct vlynq_device *vdev,
  982. -+#endif
  983. -+ struct vlynq_device_id *id)
  984. - {
  985. - int result = -EIO, i;
  986. - u32 addr;
  987. -@@ -1785,7 +1801,11 @@ static __devinit int vlynq_probe(struct
  988. - return result;
  989. - }
  990. -
  991. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  992. - static __devexit void vlynq_remove(struct vlynq_device *vdev)
  993. -+#else
  994. -+static void vlynq_remove(struct vlynq_device *vdev)
  995. -+#endif
  996. - {
  997. - struct ieee80211_hw *hw = vlynq_get_drvdata(vdev);
  998. - acx_device_t *adev = hw2adev(hw);
  999. -@@ -1851,7 +1871,11 @@ static struct vlynq_driver acxvlynq_driv
  1000. - .name = "acx_vlynq",
  1001. - .id_table = acx_vlynq_id,
  1002. - .probe = vlynq_probe,
  1003. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  1004. - .remove = __devexit_p(vlynq_remove),
  1005. -+#else
  1006. -+ .remove = vlynq_remove,
  1007. -+#endif
  1008. - };
  1009. - #endif /* CONFIG_VLYNQ */
  1010. -
  1011. 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
  1012. deleted file mode 100644
  1013. index c737844..0000000
  1014. --- a/package/kernel/acx-mac80211/patches/003-Fix-3.10-build.patch
  1015. +++ /dev/null
  1016. @@ -1,31 +0,0 @@
  1017. -From 1daf4bfdb072b08f3b4e412bbfa9645f88dc0a01 Mon Sep 17 00:00:00 2001
  1018. -From: Oliver Winker <oliver@oli1170.net>
  1019. -Date: Tue, 3 Sep 2013 20:36:36 +0200
  1020. -Subject: [PATCH 3/3] Fix 3.10 build
  1021. -
  1022. -Signed-off-by: Reinhard Karcher <reinhard.karcher@gmx.net>
  1023. -Signed-off-by: Oliver Winker <oliver@oli1170.net>
  1024. ----
  1025. - main.c | 7 +++++++
  1026. - 1 file changed, 7 insertions(+)
  1027. -
  1028. ---- a/main.c
  1029. -+++ b/main.c
  1030. -@@ -682,10 +682,17 @@ int acx_op_config(struct ieee80211_hw *h
  1031. -
  1032. - if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
  1033. - logf1(L_DEBUG, "IEEE80211_CONF_CHANGE_CHANNEL,"
  1034. -+#if CONFIG_ACX_MAC80211_VERSION >= KERNEL_VERSION(3, 10, 0)
  1035. -+ "channel->hw_value=%i\n", conf->chandef.chan->hw_value);
  1036. -+
  1037. -+ acx_set_channel(adev, conf->chandef.chan->hw_value,
  1038. -+ conf->chandef.chan->center_freq);
  1039. -+#else
  1040. - "channel->hw_value=%i\n", conf->channel->hw_value);
  1041. -
  1042. - acx_set_channel(adev, conf->channel->hw_value,
  1043. - conf->channel->center_freq);
  1044. -+#endif
  1045. -
  1046. - changed_not_done &= ~IEEE80211_CONF_CHANGE_CHANNEL;
  1047. - }
  1048. 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
  1049. deleted file mode 100644
  1050. index 847b573..0000000
  1051. --- a/package/kernel/acx-mac80211/patches/004-Fix-3.14-build.patch
  1052. +++ /dev/null
  1053. @@ -1,22 +0,0 @@
  1054. -From d17fcac710e629463591f6bd09d76b66ec591583 Mon Sep 17 00:00:00 2001
  1055. -From: Hauke Mehrtens <hauke@hauke-m.de>
  1056. -Date: Wed, 5 Feb 2014 20:57:07 +0100
  1057. -Subject: [PATCH] Fix 3.14 build
  1058. -
  1059. -Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  1060. ----
  1061. - main.c | 2 ++
  1062. - 1 file changed, 2 insertions(+)
  1063. -
  1064. ---- a/main.c
  1065. -+++ b/main.c
  1066. -@@ -500,7 +500,9 @@ int acx_init_ieee80211(acx_device_t *ade
  1067. - hw->flags &= ~IEEE80211_HW_RX_INCLUDES_FCS;
  1068. - hw->queues = 1;
  1069. - hw->wiphy->max_scan_ssids = 1;
  1070. -+#if CONFIG_ACX_MAC80211_VERSION < KERNEL_VERSION(3, 14, 0)
  1071. - hw->channel_change_time = 10000;
  1072. -+#endif
  1073. -
  1074. - /* OW TODO Check if RTS/CTS threshold can be included here */
  1075. -
  1076. diff --git a/package/kernel/acx-mac80211/patches/300-kernel_4_2.patch b/package/kernel/acx-mac80211/patches/300-kernel_4_2.patch
  1077. new file mode 100644
  1078. index 0000000..ee92b94
  1079. --- /dev/null
  1080. +++ b/package/kernel/acx-mac80211/patches/300-kernel_4_2.patch
  1081. @@ -0,0 +1,67 @@
  1082. +diff --git a/main.c b/main.c
  1083. +index bfec856..3c482d9 100644
  1084. +--- a/main.c
  1085. ++++ b/main.c
  1086. +@@ -497,7 +497,7 @@ int acx_free_mechanics(acx_device_t *adev)
  1087. +
  1088. + int acx_init_ieee80211(acx_device_t *adev, struct ieee80211_hw *hw)
  1089. + {
  1090. +- hw->flags &= ~IEEE80211_HW_RX_INCLUDES_FCS;
  1091. ++ __clear_bit(IEEE80211_HW_RX_INCLUDES_FCS, hw->flags);
  1092. + hw->queues = 1;
  1093. + hw->wiphy->max_scan_ssids = 1;
  1094. +
  1095. +@@ -525,7 +525,7 @@ int acx_init_ieee80211(acx_device_t *adev, struct ieee80211_hw *hw)
  1096. + /* We base signal quality on winlevel approach of previous driver
  1097. + * TODO OW 20100615 This should into a common init code
  1098. + */
  1099. +- hw->flags |= IEEE80211_HW_SIGNAL_UNSPEC;
  1100. ++ __set_bit(IEEE80211_HW_SIGNAL_UNSPEC, hw->flags);
  1101. + hw->max_signal = 100;
  1102. +
  1103. + if (IS_ACX100(adev)) {
  1104. +@@ -945,8 +945,8 @@ void acx_op_configure_filter(struct ieee80211_hw *hw,
  1105. + changed_flags, *total_flags);
  1106. +
  1107. + /* OWI TODO: Set also FIF_PROBE_REQ ? */
  1108. +- *total_flags &= (FIF_PROMISC_IN_BSS | FIF_ALLMULTI | FIF_FCSFAIL
  1109. +- | FIF_CONTROL | FIF_OTHER_BSS);
  1110. ++ *total_flags &= (FIF_ALLMULTI | FIF_FCSFAIL | FIF_CONTROL
  1111. ++ | FIF_OTHER_BSS);
  1112. +
  1113. + logf1(L_DEBUG, "2: *total_flags=0x%08x\n", *total_flags);
  1114. +
  1115. +@@ -1045,9 +1045,10 @@ void acx_op_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
  1116. + }
  1117. +
  1118. + int acx_op_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  1119. +- struct cfg80211_scan_request *req)
  1120. ++ struct ieee80211_scan_request *hw_req)
  1121. + {
  1122. + acx_device_t *adev = hw2adev(hw);
  1123. ++ struct cfg80211_scan_request *req = &hw_req->req;
  1124. + struct sk_buff *skb;
  1125. + size_t ssid_len = 0;
  1126. + u8 *ssid = NULL;
  1127. +@@ -1082,7 +1083,7 @@ int acx_op_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  1128. + goto out;
  1129. + }
  1130. + #else
  1131. +- skb = ieee80211_probereq_get(adev->hw, adev->vif, ssid, ssid_len,
  1132. ++ skb = ieee80211_probereq_get(adev->hw, vif->addr, ssid, ssid_len,
  1133. + req->ie_len);
  1134. + if (!skb) {
  1135. + ret = -ENOMEM;
  1136. +diff --git a/main.h b/main.h
  1137. +index 293f5c8..84ecb9a 100644
  1138. +--- a/main.h
  1139. ++++ b/main.h
  1140. +@@ -62,7 +62,7 @@ void acx_op_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
  1141. + #endif
  1142. +
  1143. + int acx_op_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  1144. +- struct cfg80211_scan_request *req);
  1145. ++ struct ieee80211_scan_request *req);
  1146. +
  1147. + int acx_recover_hw(acx_device_t *adev);
  1148. +
  1149. diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
  1150. index a1eedce..525537c 100644
  1151. --- a/package/kernel/mac80211/Makefile
  1152. +++ b/package/kernel/mac80211/Makefile
  1153. @@ -10,11 +10,11 @@ include $(INCLUDE_DIR)/kernel.mk
  1154. PKG_NAME:=mac80211
  1155. -PKG_VERSION:=2015-03-09
  1156. -PKG_RELEASE:=3
  1157. +PKG_VERSION:=2016-01-10
  1158. +PKG_RELEASE:=1
  1159. PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
  1160. PKG_BACKPORT_VERSION:=
  1161. -PKG_MD5SUM:=6d4b04e4ce8a1f54dabfb04f4709453c
  1162. +PKG_MD5SUM:=be5fae2e8d6f7490f9b073374fb895ba
  1163. PKG_SOURCE:=compat-wireless-$(PKG_VERSION)$(PKG_BACKPORT_VERSION).tar.bz2
  1164. PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION)
  1165. @@ -23,15 +23,29 @@ PKG_BUILD_PARALLEL:=1
  1166. PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  1167. PKG_DRIVERS = \
  1168. - adm8211 ath5k libertas-usb libertas-sdio p54-common p54-pci p54-usb p54-spi \
  1169. - rt2x00-lib rt2x00-pci rt2x00-usb rt2800-lib rt2400-pci rt2500-pci \
  1170. - rt2500-usb rt61-pci rt73-usb rt2800-mmio rt2800-pci rt2800-usb rt2800-soc \
  1171. - rtl8180 rtl8187 zd1211rw mac80211-hwsim carl9170 b43 b43legacy \
  1172. - ath9k-common ath9k ath9k-htc ath10k ath net-libipw net-ipw2100 net-ipw2200 \
  1173. - mwl8k mwifiex-pcie net-hermes net-hermes-pci net-hermes-plx net-hermes-pcmcia \
  1174. - iwl-legacy iwl3945 iwl4965 iwlagn wlcore wl12xx wl18xx lib80211 \
  1175. + adm8211 \
  1176. + ath ath5k ath9k ath9k-common ath9k-htc ath10k \
  1177. + b43 b43legacy \
  1178. + carl9170 \
  1179. + hermes hermes-pci hermes-pcmcia hermes-plx\
  1180. + iwl-legacy iwl3945 iwl4965 iwlwifi \
  1181. + lib80211 \
  1182. + libipw ipw2100 ipw2200 \
  1183. + libertas-sdio libertas-usb libertas-spi \
  1184. + mac80211-hwsim \
  1185. + mt7601u \
  1186. + mwl8k mwifiex-pcie \
  1187. + p54-common p54-pci p54-spi p54-usb \
  1188. + rt2x00-lib rt2x00-pci rt2x00-usb \
  1189. + rt2400-pci rt2500-pci rt2500-usb \
  1190. + rt2800-lib rt2800-mmio rt2800-pci rt2800-soc rt2800-usb \
  1191. + rt61-pci rt73-usb \
  1192. + rtl8180 rtl8187 \
  1193. rtlwifi rtlwifi-pci rtlwifi-usb rtl8192c-common rtl8192ce rtl8192se \
  1194. - rtl8192de rtl8192cu
  1195. + rtl8192de rtl8192cu \
  1196. + rtl8xxxu \
  1197. + wlcore wl12xx wl18xx \
  1198. + zd1211rw
  1199. PKG_CONFIG_DEPENDS:= \
  1200. CONFIG_PACKAGE_kmod-mac80211 \
  1201. @@ -60,7 +74,6 @@ define KernelPackage/mac80211/Default
  1202. SUBMENU:=$(WMENU)
  1203. URL:=https://wireless.wiki.kernel.org/
  1204. MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  1205. - DEPENDS:=@!TARGET_uml
  1206. endef
  1207. define KernelPackage/cfg80211
  1208. @@ -97,6 +110,15 @@ define KernelPackage/mac80211/config
  1209. Select this to see extensive information about
  1210. the internal state of mac80211 in debugfs.
  1211. + config PACKAGE_MAC80211_TRACING
  1212. + bool "Enable tracing (mac80211 and supported drivers)"
  1213. + select KERNEL_FTRACE
  1214. + select KERNEL_ENABLE_DEFAULT_TRACERS
  1215. + default n
  1216. + help
  1217. + Select this to enable tracing of mac80211 and
  1218. + related wifi drivers (using trace-cmd).
  1219. +
  1220. config PACKAGE_MAC80211_MESH
  1221. bool "Enable 802.11s mesh support"
  1222. default y
  1223. @@ -108,833 +130,703 @@ define KernelPackage/mac80211/description
  1224. Generic IEEE 802.11 Networking Stack (mac80211)
  1225. endef
  1226. -PKG_LINUX_FIRMWARE_NAME:=linux-firmware
  1227. -PKG_LINUX_FIRMWARE_VERSION:=f404336ba808cbd57547196e13367079a23b822c
  1228. -PKG_LINUX_FIRMWARE_SOURCE:=$(PKG_LINUX_FIRMWARE_NAME)-2015-03-20-$(PKG_LINUX_FIRMWARE_VERSION).tar.bz2
  1229. -PKG_LINUX_FIRMWARE_PROTO:=git
  1230. -PKG_LINUX_FIRMWARE_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
  1231. -PKG_LINUX_FIRMWARE_SUBDIR:=$(PKG_LINUX_FIRMWARE_NAME)-$(PKG_LINUX_FIRMWARE_VERSION)
  1232. -#PKG_LINUX_FIRMWARE_MIRROR_MD5SUM:=e219333f01835c6e556875a9e0deb3f9
  1233. -
  1234. -define Download/linux-firmware
  1235. - FILE:=$(PKG_LINUX_FIRMWARE_SOURCE)
  1236. - URL:=$(PKG_LINUX_FIRMWARE_SOURCE_URL)
  1237. - MD5SUM:=$(PKG_LINUX_FIRMWARE_MD5SUM)
  1238. - PROTO:=$(PKG_LINUX_FIRMWARE_PROTO)
  1239. - VERSION:=$(PKG_LINUX_FIRMWARE_VERSION)
  1240. - SUBDIR:=$(PKG_LINUX_FIRMWARE_SUBDIR)
  1241. - MIRROR_MD5SUM:=$(PKG_LINUX_FIRMWARE_MIRROR_MD5SUM)
  1242. -endef
  1243. -$(eval $(call Download,linux-firmware))
  1244. -
  1245. -PKG_ATH10K_LINUX_FIRMWARE_NAME:=ath10k-firmware
  1246. -PKG_ATH10K_LINUX_FIRMWARE_VERSION:=da0f85d924226ee30c46e037120621c9e192b39e
  1247. -PKG_ATH10K_LINUX_FIRMWARE_SOURCE:=$(PKG_ATH10K_LINUX_FIRMWARE_NAME)-$(PKG_ATH10K_LINUX_FIRMWARE_VERSION).tar.bz2
  1248. -PKG_ATH10K_LINUX_FIRMWARE_PROTO:=git
  1249. -PKG_ATH10K_LINUX_FIRMWARE_SOURCE_URL:=https://github.com/kvalo/ath10k-firmware.git
  1250. -PKG_ATH10K_LINUX_FIRMWARE_SUBDIR:=$(PKG_ATH10K_LINUX_FIRMWARE_NAME)-$(PKG_ATH10K_LINUX_FIRMWARE_VERSION)
  1251. -#PKG_ATH10K_LINUX_FIRMWARE_MIRROR_MD5SUM:=?
  1252. -
  1253. -define Download/ath10k-firmware
  1254. - FILE:=$(PKG_ATH10K_LINUX_FIRMWARE_SOURCE)
  1255. - URL:=$(PKG_ATH10K_LINUX_FIRMWARE_SOURCE_URL)
  1256. - PROTO:=$(PKG_ATH10K_LINUX_FIRMWARE_PROTO)
  1257. - VERSION:=$(PKG_ATH10K_LINUX_FIRMWARE_VERSION)
  1258. - SUBDIR:=$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)
  1259. - #MIRROR_MD5SUM:=$(PKG_ATH10K_LINUX_FIRMWARE_MIRROR_MD5SUM)
  1260. -endef
  1261. -$(eval $(call Download,ath10k-firmware))
  1262. -
  1263. -# Prism54 drivers
  1264. -P54PCIFW:=2.13.12.0.arm
  1265. -P54USBFW:=2.13.24.0.lm87.arm
  1266. -P54SPIFW:=2.13.0.0.a.13.14.arm
  1267. -
  1268. -define Download/p54usb
  1269. - FILE:=$(P54USBFW)
  1270. - URL:=http://daemonizer.de/prism54/prism54-fw/fw-usb
  1271. - MD5SUM:=8e8ab005a4f8f0123bcdc51bc25b47f6
  1272. -endef
  1273. -$(eval $(call Download,p54usb))
  1274. -
  1275. -define Download/p54pci
  1276. - FILE:=$(P54PCIFW)
  1277. - URL:=http://daemonizer.de/prism54/prism54-fw/fw-softmac
  1278. - MD5SUM:=ff7536af2092b1c4b21315bd103ef4c4
  1279. -endef
  1280. -$(eval $(call Download,p54pci))
  1281. -
  1282. -define Download/p54spi
  1283. - FILE:=$(P54SPIFW)
  1284. - URL:=http://daemonizer.de/prism54/prism54-fw/stlc4560
  1285. - MD5SUM:=42661f8ecbadd88012807493f596081d
  1286. -endef
  1287. -$(eval $(call Download,p54spi))
  1288. -
  1289. -define KernelPackage/p54/Default
  1290. - $(call KernelPackage/mac80211/Default)
  1291. - TITLE:=Prism54 Drivers
  1292. -endef
  1293. -
  1294. -define KernelPackage/p54/description
  1295. - Kernel module for Prism54 chipsets (mac80211)
  1296. -endef
  1297. -
  1298. -define KernelPackage/p54-common
  1299. - $(call KernelPackage/p54/Default)
  1300. - DEPENDS+= @PCI_SUPPORT||@USB_SUPPORT||@TARGET_omap24xx +kmod-mac80211 +kmod-lib-crc-ccitt
  1301. - TITLE+= (COMMON)
  1302. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54common.ko
  1303. -endef
  1304. -
  1305. -define KernelPackage/p54-pci
  1306. - $(call KernelPackage/p54/Default)
  1307. - TITLE+= (PCI)
  1308. - DEPENDS+= @PCI_SUPPORT +kmod-p54-common
  1309. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54pci.ko
  1310. - AUTOLOAD:=$(call AutoProbe,p54pci)
  1311. -endef
  1312. -
  1313. -define KernelPackage/p54-usb
  1314. - $(call KernelPackage/p54/Default)
  1315. - TITLE+= (USB)
  1316. - DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-p54-common
  1317. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54usb.ko
  1318. - AUTOLOAD:=$(call AutoProbe,p54usb)
  1319. -endef
  1320. -
  1321. -define KernelPackage/p54-spi
  1322. - $(call KernelPackage/p54/Default)
  1323. - TITLE+= (SPI)
  1324. - DEPENDS+= @TARGET_omap24xx +kmod-p54-common
  1325. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54spi.ko
  1326. - AUTOLOAD:=$(call AutoProbe,p54spi)
  1327. -endef
  1328. -
  1329. -define KernelPackage/rt2x00/Default
  1330. +define KernelPackage/adm8211
  1331. $(call KernelPackage/mac80211/Default)
  1332. - TITLE:=Ralink Drivers for RT2x00 cards
  1333. + TITLE:=ADMTek 8211 support
  1334. + DEPENDS+=@PCI_SUPPORT +kmod-mac80211 +kmod-eeprom-93cx6
  1335. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/admtek/adm8211.ko
  1336. + AUTOLOAD:=$(call AutoProbe,adm8211)
  1337. endef
  1338. -define KernelPackage/rt2x00-lib
  1339. -$(call KernelPackage/rt2x00/Default)
  1340. - DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-mac80211 +kmod-lib-crc-itu-t
  1341. - TITLE+= (LIB)
  1342. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00lib.ko
  1343. - MENU:=1
  1344. -endef
  1345. +define KernelPackage/ath/config
  1346. + if PACKAGE_kmod-ath
  1347. + config ATH_USER_REGD
  1348. + bool "Force Atheros drivers to respect the user's regdomain settings"
  1349. + help
  1350. + Atheros' idea of regulatory handling is that the EEPROM of the card defines
  1351. + the regulatory limits and the user is only allowed to restrict the settings
  1352. + even further, even if the country allows frequencies or power levels that
  1353. + are forbidden by the EEPROM settings.
  1354. -define KernelPackage/rt2x00-lib/config
  1355. - if PACKAGE_kmod-rt2x00-lib
  1356. + Select this option if you want the driver to respect the user's decision about
  1357. + regulatory settings.
  1358. - config PACKAGE_RT2X00_LIB_DEBUGFS
  1359. - bool "Enable rt2x00 debugfs support"
  1360. - depends on PACKAGE_MAC80211_DEBUGFS
  1361. + config PACKAGE_ATH_DEBUG
  1362. + bool "Atheros wireless debugging"
  1363. help
  1364. - Enable creation of debugfs files for the rt2x00 drivers.
  1365. - These debugfs files support both reading and writing of the
  1366. - most important register types of the rt2x00 hardware.
  1367. + Say Y, if you want to debug atheros wireless drivers.
  1368. + Only ath9k & ath10k make use of this.
  1369. - config PACKAGE_RT2X00_DEBUG
  1370. - bool "Enable rt2x00 debug output"
  1371. + config PACKAGE_ATH_DFS
  1372. + bool "Enable DFS support"
  1373. + default y
  1374. help
  1375. - Enable debugging output for all rt2x00 modules
  1376. + Dynamic frequency selection (DFS) is required for most of the 5 GHz band
  1377. + channels in Europe, US, and Japan.
  1378. - endif
  1379. -endef
  1380. + Select this option if you want to use such channels.
  1381. -define KernelPackage/rt2x00-mmio
  1382. -$(call KernelPackage/rt2x00/Default)
  1383. - DEPENDS+= @(PCI_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib +kmod-eeprom-93cx6
  1384. - HIDDEN:=1
  1385. - TITLE+= (MMIO)
  1386. - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00mmio.ko
  1387. + endif
  1388. endef
  1389. -define KernelPackage/rt2x00-pci
  1390. -$(call KernelPackage/rt2x00/Default)
  1391. - DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-mmio +kmod-rt2x00-lib
  1392. - HIDDEN:=1
  1393. - TITLE+= (PCI)
  1394. - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00pci.ko
  1395. - AUTOLOAD:=$(call AutoProbe,rt2x00pci)
  1396. +define KernelPackage/ath
  1397. + $(call KernelPackage/mac80211/Default)
  1398. + TITLE:=Atheros common driver part
  1399. + DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx||TARGET_ath25 +kmod-mac80211
  1400. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath.ko
  1401. + MENU:=1
  1402. endef
  1403. -define KernelPackage/rt2x00-usb
  1404. -$(call KernelPackage/rt2x00/Default)
  1405. - DEPENDS+= @USB_SUPPORT +kmod-rt2x00-lib +kmod-usb-core
  1406. - HIDDEN:=1
  1407. - TITLE+= (USB)
  1408. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00usb.ko
  1409. - AUTOLOAD:=$(call AutoProbe,rt2x00usb)
  1410. +define KernelPackage/ath/description
  1411. + This module contains some common parts needed by Atheros Wireless drivers.
  1412. endef
  1413. -define KernelPackage/rt2800-lib
  1414. -$(call KernelPackage/rt2x00/Default)
  1415. - DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib +kmod-lib-crc-ccitt +@DRIVER_11N_SUPPORT
  1416. - HIDDEN:=1
  1417. - TITLE+= (rt2800 LIB)
  1418. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800lib.ko
  1419. +define KernelPackage/ath5k
  1420. + $(call KernelPackage/mac80211/Default)
  1421. + TITLE:=Atheros 5xxx wireless cards support
  1422. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath5k
  1423. + DEPENDS+= @PCI_SUPPORT||@TARGET_ath25 +kmod-ath
  1424. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath5k/ath5k.ko
  1425. + AUTOLOAD:=$(call AutoProbe,ath5k)
  1426. endef
  1427. -define KernelPackage/rt2400-pci
  1428. -$(call KernelPackage/rt2x00/Default)
  1429. - DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
  1430. - TITLE+= (RT2400 PCI)
  1431. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2400pci.ko
  1432. - AUTOLOAD:=$(call AutoProbe,rt2400pci)
  1433. +define KernelPackage/ath5k/description
  1434. + This module adds support for wireless adapters based on
  1435. + Atheros 5xxx chipset.
  1436. endef
  1437. -define KernelPackage/rt2500-pci
  1438. -$(call KernelPackage/rt2x00/Default)
  1439. - DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
  1440. - TITLE+= (RT2500 PCI)
  1441. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2500pci.ko
  1442. - AUTOLOAD:=$(call AutoProbe,rt2500pci)
  1443. +define KernelPackage/ath9k-common
  1444. + $(call KernelPackage/mac80211/Default)
  1445. + TITLE:=Atheros 802.11n wireless devices (common code for ath9k and ath9k_htc)
  1446. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  1447. + DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY
  1448. + FILES:= \
  1449. + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_common.ko \
  1450. + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_hw.ko
  1451. endef
  1452. -define KernelPackage/rt2500-usb
  1453. -$(call KernelPackage/rt2x00/Default)
  1454. - DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb
  1455. - TITLE+= (RT2500 USB)
  1456. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2500usb.ko
  1457. - AUTOLOAD:=$(call AutoProbe,rt2500usb)
  1458. +define KernelPackage/ath9k
  1459. + $(call KernelPackage/mac80211/Default)
  1460. + TITLE:=Atheros 802.11n PCI wireless cards support
  1461. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  1462. + DEPENDS+= @PCI_SUPPORT||TARGET_ar71xx +kmod-ath9k-common
  1463. + FILES:= \
  1464. + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k.ko
  1465. + AUTOLOAD:=$(call AutoProbe,ath9k)
  1466. endef
  1467. -define KernelPackage/rt61-pci
  1468. -$(call KernelPackage/rt2x00/Default)
  1469. - DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
  1470. - TITLE+= (RT2x61 PCI)
  1471. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt61pci.ko
  1472. - AUTOLOAD:=$(call AutoProbe,rt61pci)
  1473. +define KernelPackage/ath9k/description
  1474. +This module adds support for wireless adapters based on
  1475. +Atheros IEEE 802.11n AR5008 and AR9001 family of chipsets.
  1476. endef
  1477. -define KernelPackage/rt73-usb
  1478. - $(call KernelPackage/rt2x00/Default)
  1479. - DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb
  1480. - TITLE+= (RT73 USB)
  1481. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt73usb.ko
  1482. - AUTOLOAD:=$(call AutoProbe,rt73usb)
  1483. -endef
  1484. +define KernelPackage/ath9k/config
  1485. -define KernelPackage/rt2800-mmio
  1486. -$(call KernelPackage/rt2x00/Default)
  1487. - TITLE += (RT28xx/RT3xxx MMIO)
  1488. - DEPENDS += +kmod-rt2800-lib +kmod-rt2x00-mmio
  1489. - HIDDEN:=1
  1490. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800mmio.ko
  1491. -endef
  1492. + config ATH9K_SUPPORT_PCOEM
  1493. + bool "Support chips used in PC OEM cards"
  1494. + depends on PACKAGE_kmod-ath9k
  1495. -define KernelPackage/rt2800-soc
  1496. -$(call KernelPackage/rt2x00/Default)
  1497. - DEPENDS += @(TARGET_ramips_rt288x||TARGET_ramips_rt305x||TARGET_ramips_rt3883||TARGET_ramips_mt7620) +kmod-rt2800-mmio +kmod-rt2800-lib
  1498. - TITLE += (RT28xx/RT3xxx SoC)
  1499. - FILES := \
  1500. - $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00soc.ko \
  1501. - $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800soc.ko
  1502. - AUTOLOAD:=$(call AutoProbe,rt2800soc)
  1503. endef
  1504. -define KernelPackage/rt2800-pci
  1505. -$(call KernelPackage/rt2x00/Default)
  1506. - DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci +kmod-rt2800-lib +kmod-rt2800-mmio
  1507. - TITLE+= (RT2860 PCI)
  1508. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800pci.ko
  1509. - AUTOLOAD:=$(call AutoProbe,rt2800pci)
  1510. +define KernelPackage/ath9k-htc
  1511. + $(call KernelPackage/mac80211/Default)
  1512. + TITLE:=Atheros 802.11n USB device support
  1513. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  1514. + DEPENDS+= @USB_SUPPORT +kmod-ath9k-common +kmod-usb-core +ath9k-htc-firmware
  1515. + FILES:= \
  1516. + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_htc.ko
  1517. + AUTOLOAD:=$(call AutoProbe,ath9k_htc)
  1518. endef
  1519. -define KernelPackage/rt2800-usb
  1520. -$(call KernelPackage/rt2x00/Default)
  1521. - DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb +kmod-rt2800-lib +kmod-lib-crc-ccitt
  1522. - TITLE+= (RT2870 USB)
  1523. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800usb.ko
  1524. - AUTOLOAD:=$(call AutoProbe,rt2800usb)
  1525. +define KernelPackage/ath9k-htc/description
  1526. +This module adds support for wireless adapters based on
  1527. +Atheros USB AR9271 and AR7010 family of chipsets.
  1528. endef
  1529. -define KernelPackage/rtl818x/Default
  1530. +define KernelPackage/ath10k
  1531. $(call KernelPackage/mac80211/Default)
  1532. - TITLE:=Realtek Drivers for RTL818x devices
  1533. - URL:=http://wireless.kernel.org/en/users/Drivers/rtl8187
  1534. - DEPENDS+= +kmod-eeprom-93cx6 +kmod-mac80211
  1535. + TITLE:=Atheros 802.11ac wireless cards support
  1536. + URL:=https://wireless.wiki.kernel.org/en/users/Drivers/ath10k
  1537. + DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY
  1538. + FILES:= \
  1539. + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_core.ko \
  1540. + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_pci.ko
  1541. + AUTOLOAD:=$(call AutoLoad,55,ath10k_core ath10k_pci)
  1542. endef
  1543. -define KernelPackage/rtl8180
  1544. - $(call KernelPackage/rtl818x/Default)
  1545. - DEPENDS+= @PCI_SUPPORT
  1546. - TITLE+= (RTL8180 PCI)
  1547. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtl818x/rtl8180/rtl818x_pci.ko
  1548. - AUTOLOAD:=$(call AutoProbe,rtl818x_pci)
  1549. +define KernelPackage/ath10k/description
  1550. +This module adds support for wireless adapters based on
  1551. +Atheros IEEE 802.11ac family of chipsets. For now only
  1552. +PCI is supported.
  1553. endef
  1554. -define KernelPackage/rtl8187
  1555. -$(call KernelPackage/rtl818x/Default)
  1556. - DEPENDS+= @USB_SUPPORT +kmod-usb-core
  1557. - TITLE+= (RTL8187 USB)
  1558. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtl818x/rtl8187/rtl8187.ko
  1559. - AUTOLOAD:=$(call AutoProbe,rtl8187)
  1560. -endef
  1561. +#Broadcom firmware
  1562. +ifneq ($(CONFIG_B43_FW_6_30),)
  1563. + PKG_B43_FWV4_NAME:=broadcom-wl
  1564. + PKG_B43_FWV4_VERSION:=6.30.163.46
  1565. + PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).wl_apsta.o
  1566. + PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  1567. + PKG_B43_FWV4_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/
  1568. + PKG_B43_FWV4_MD5SUM:=6fe97e9368d25342a1ab943d3cf3496d
  1569. +else
  1570. +ifneq ($(CONFIG_B43_FW_5_10),)
  1571. + PKG_B43_FWV4_NAME:=broadcom-wl
  1572. + PKG_B43_FWV4_VERSION:=5.10.56.27.3
  1573. + PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/driver/wl_apsta/wl_prebuilt.o
  1574. + PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)_mipsel.tar.bz2
  1575. + PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
  1576. + PKG_B43_FWV4_MD5SUM:=3363e3a6b3d9d73c49dea870c7834eac
  1577. +else
  1578. +ifneq ($(CONFIG_B43_FW_4_178),)
  1579. + PKG_B43_FWV4_NAME:=broadcom-wl
  1580. + PKG_B43_FWV4_VERSION:=4.178.10.4
  1581. + PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/linux/wl_apsta.o
  1582. + PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  1583. + PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
  1584. + PKG_B43_FWV4_MD5SUM:=14477e8cbbb91b11896affac9b219fdb
  1585. +else
  1586. +ifneq ($(CONFIG_B43_FW_5_100_138),)
  1587. + PKG_B43_FWV4_NAME:=broadcom-wl
  1588. + PKG_B43_FWV4_VERSION:=5.100.138
  1589. + PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/linux/wl_apsta.o
  1590. + PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  1591. + PKG_B43_FWV4_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/
  1592. + PKG_B43_FWV4_MD5SUM:=f4e357b09eaf5d8b1f1920cf3493a555
  1593. +else
  1594. + PKG_B43_FWV4_NAME:=broadcom-wl
  1595. + PKG_B43_FWV4_VERSION:=4.150.10.5
  1596. + PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/driver/wl_apsta_mimo.o
  1597. + PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  1598. + PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
  1599. + PKG_B43_FWV4_MD5SUM:=0c6ba9687114c6b598e8019e262d9a60
  1600. +endif
  1601. +endif
  1602. +endif
  1603. +endif
  1604. +ifneq ($(CONFIG_B43_OPENFIRMWARE),)
  1605. + PKG_B43_FWV4_NAME:=broadcom-wl
  1606. + PKG_B43_FWV4_VERSION:=5.2
  1607. + PKG_B43_FWV4_OBJECT:=openfwwf-$(PKG_B43_FWV4_VERSION)
  1608. + PKG_B43_FWV4_SOURCE:=openfwwf-$(PKG_B43_FWV4_VERSION).tar.gz
  1609. + PKG_B43_FWV4_SOURCE_URL:=http://www.ing.unibs.it/openfwwf/firmware/
  1610. + PKG_B43_FWV4_MD5SUM:=e045a135453274e439ae183f8498b0fa
  1611. +endif
  1612. -define KernelPackage/rtlwifi/config
  1613. - config PACKAGE_RTLWIFI_DEBUG
  1614. - bool "Realtek wireless debugging"
  1615. - depends on PACKAGE_kmod-rtlwifi
  1616. - help
  1617. - Say Y, if you want to debug realtek wireless drivers.
  1618. +define Download/b43
  1619. + FILE:=$(PKG_B43_FWV4_SOURCE)
  1620. + URL:=$(PKG_B43_FWV4_SOURCE_URL)
  1621. + MD5SUM:=$(PKG_B43_FWV4_MD5SUM)
  1622. endef
  1623. +$(eval $(call Download,b43))
  1624. -define KernelPackage/rtlwifi
  1625. +define KernelPackage/b43
  1626. $(call KernelPackage/mac80211/Default)
  1627. - TITLE:=Realtek common driver part
  1628. - DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT) +kmod-mac80211 +@DRIVER_11N_SUPPORT
  1629. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtlwifi.ko
  1630. - HIDDEN:=1
  1631. + TITLE:=Broadcom 43xx wireless support
  1632. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/b43
  1633. + KCONFIG:= \
  1634. + CONFIG_HW_RANDOM=y
  1635. + # Depend on PCI_SUPPORT to make sure we can select kmod-bcma or kmod-ssb
  1636. + DEPENDS += \
  1637. + @PCI_SUPPORT +kmod-mac80211 \
  1638. + $(if $(CONFIG_PACKAGE_B43_USE_SSB),+kmod-ssb) \
  1639. + $(if $(CONFIG_PACKAGE_B43_USE_BCMA),+kmod-bcma)
  1640. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/broadcom/b43/b43.ko
  1641. + AUTOLOAD:=$(call AutoProbe,b43)
  1642. + MENU:=1
  1643. endef
  1644. -define KernelPackage/rtlwifi-pci
  1645. - $(call KernelPackage/mac80211/Default)
  1646. - TITLE:=Realtek common driver part (PCI support)
  1647. - DEPENDS+= @PCI_SUPPORT +kmod-rtlwifi
  1648. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl_pci.ko
  1649. - AUTOLOAD:=$(call AutoProbe,rtl_pci)
  1650. - HIDDEN:=1
  1651. -endef
  1652. +define KernelPackage/b43/config
  1653. -define KernelPackage/rtlwifi-usb
  1654. - $(call KernelPackage/mac80211/Default)
  1655. - TITLE:=Realtek common driver part (USB support)
  1656. - DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-rtlwifi
  1657. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl_usb.ko
  1658. - AUTOLOAD:=$(call AutoProbe,rtl_usb)
  1659. - HIDDEN:=1
  1660. -endef
  1661. +config PACKAGE_B43_USE_SSB
  1662. + select PACKAGE_kmod-ssb
  1663. + tristate
  1664. + depends on !TARGET_brcm47xx && !TARGET_brcm63xx
  1665. + default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA_AND_SSB
  1666. + default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_SSB
  1667. -define KernelPackage/rtl8192c-common
  1668. - $(call KernelPackage/mac80211/Default)
  1669. - TITLE:=Realtek RTL8192CE/RTL8192CU common support module
  1670. - DEPENDS+= +kmod-rtlwifi
  1671. - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192c/rtl8192c-common.ko
  1672. - HIDDEN:=1
  1673. -endef
  1674. +config PACKAGE_B43_USE_BCMA
  1675. + select PACKAGE_kmod-bcma
  1676. + tristate
  1677. + depends on !TARGET_brcm47xx && !TARGET_bcm53xx
  1678. + default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA_AND_SSB
  1679. + default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA
  1680. -define KernelPackage/rtl8192ce
  1681. - $(call KernelPackage/mac80211/Default)
  1682. - TITLE:=Realtek RTL8192CE/RTL8188CE support
  1683. - DEPENDS+= +kmod-rtlwifi-pci +kmod-rtl8192c-common
  1684. - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192ce/rtl8192ce.ko
  1685. - AUTOLOAD:=$(call AutoProbe,rtl8192ce)
  1686. -endef
  1687. + if PACKAGE_kmod-b43
  1688. -define KernelPackage/rtl8192ce/install
  1689. - $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  1690. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cfw.bin $(1)/lib/firmware/rtlwifi
  1691. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cfwU.bin $(1)/lib/firmware/rtlwifi
  1692. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cfwU_B.bin $(1)/lib/firmware/rtlwifi
  1693. -endef
  1694. + choice
  1695. + prompt "b43 firmware version"
  1696. + default B43_FW_5_100_138
  1697. + help
  1698. + This option allows you to select the version of the b43 firmware.
  1699. -define KernelPackage/rtl8192se
  1700. - $(call KernelPackage/mac80211/Default)
  1701. - TITLE:=Realtek RTL8192SE/RTL8191SE support
  1702. - DEPENDS+= +kmod-rtlwifi-pci
  1703. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192se/rtl8192se.ko
  1704. - AUTOLOAD:=$(call AutoProbe,rtl8192se)
  1705. -endef
  1706. + config B43_FW_4_150
  1707. + bool "Firmware 410.2160 from driver 4.150.10.5 (old stable)"
  1708. + help
  1709. + Old stable firmware for BCM43xx devices.
  1710. -define KernelPackage/rtl8192se/install
  1711. - $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  1712. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192sefw.bin $(1)/lib/firmware/rtlwifi
  1713. -endef
  1714. + If unsure, select this.
  1715. -define KernelPackage/rtl8192de
  1716. - $(call KernelPackage/mac80211/Default)
  1717. - TITLE:=Realtek RTL8192DE/RTL8188DE support
  1718. - DEPENDS+= +kmod-rtlwifi-pci
  1719. - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192de/rtl8192de.ko
  1720. - AUTOLOAD:=$(call AutoProbe,rtl8192de)
  1721. -endef
  1722. + config B43_FW_4_178
  1723. + bool "Firmware 478.104 from driver 4.178.10.4"
  1724. + help
  1725. + Older firmware for BCM43xx devices.
  1726. -define KernelPackage/rtl8192de/install
  1727. - $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  1728. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192defw.bin $(1)/lib/firmware/rtlwifi
  1729. -endef
  1730. + If unsure, select the "stable" firmware.
  1731. -define KernelPackage/rtl8192cu
  1732. - $(call KernelPackage/mac80211/Default)
  1733. - TITLE:=Realtek RTL8192CU/RTL8188CU support
  1734. - DEPENDS+= +kmod-rtlwifi-usb +kmod-rtl8192c-common
  1735. - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192cu/rtl8192cu.ko
  1736. - AUTOLOAD:=$(call AutoProbe,rtl8192cu)
  1737. -endef
  1738. + config B43_FW_5_10
  1739. + bool "Firmware 508.1084 from driver 5.10.56.27"
  1740. + help
  1741. + Older firmware for BCM43xx devices.
  1742. -define KernelPackage/rtl8192cu/install
  1743. - $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  1744. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw.bin $(1)/lib/firmware/rtlwifi
  1745. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw_A.bin $(1)/lib/firmware/rtlwifi
  1746. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw_B.bin $(1)/lib/firmware/rtlwifi
  1747. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw_TMSC.bin $(1)/lib/firmware/rtlwifi
  1748. -endef
  1749. + If unsure, select the "stable" firmware.
  1750. -ZD1211FW_NAME:=zd1211-firmware
  1751. -ZD1211FW_VERSION:=1.4
  1752. -define Download/zd1211rw
  1753. - FILE:=$(ZD1211FW_NAME)-$(ZD1211FW_VERSION).tar.bz2
  1754. - URL:=@SF/zd1211/
  1755. - MD5SUM:=19f28781d76569af8551c9d11294c870
  1756. -endef
  1757. -$(eval $(call Download,zd1211rw))
  1758. + config B43_FW_5_100_138
  1759. + bool "Firmware 666.2 from driver 5.100.138 (stable)"
  1760. + help
  1761. + The currently default firmware for BCM43xx devices.
  1762. -define KernelPackage/zd1211rw
  1763. - $(call KernelPackage/mac80211/Default)
  1764. - TITLE:=Zydas ZD1211 support
  1765. - DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-mac80211
  1766. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/zd1211rw/zd1211rw.ko
  1767. - AUTOLOAD:=$(call AutoProbe,zd1211rw)
  1768. -endef
  1769. + This firmware currently gets most of the testing and is needed for some N-PHY devices.
  1770. -define KernelPackage/adm8211
  1771. - $(call KernelPackage/mac80211/Default)
  1772. - TITLE:=ADMTek 8211 support
  1773. - DEPENDS+=@PCI_SUPPORT +kmod-mac80211 +kmod-eeprom-93cx6
  1774. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/adm8211.ko
  1775. - AUTOLOAD:=$(call AutoProbe,adm8211)
  1776. -endef
  1777. + If unsure, select the this firmware.
  1778. -define KernelPackage/ath/config
  1779. - if PACKAGE_kmod-ath
  1780. - config ATH_USER_REGD
  1781. - bool "Force Atheros drivers to respect the user's regdomain settings"
  1782. + config B43_FW_6_30
  1783. + bool "Firmware 784.2 from driver 6.30.163.46 (experimental)"
  1784. help
  1785. - Atheros' idea of regulatory handling is that the EEPROM of the card defines
  1786. - the regulatory limits and the user is only allowed to restrict the settings
  1787. - even further, even if the country allows frequencies or power levels that
  1788. - are forbidden by the EEPROM settings.
  1789. + Newer experimental firmware for BCM43xx devices.
  1790. +
  1791. + This firmware is mostly untested.
  1792. +
  1793. + If unsure, select the "stable" firmware.
  1794. +
  1795. + config B43_OPENFIRMWARE
  1796. + bool "Open FirmWare for WiFi networks"
  1797. + help
  1798. + Opensource firmware for BCM43xx devices.
  1799. +
  1800. + Do _not_ select this, unless you know what you are doing.
  1801. + The Opensource firmware is not suitable for embedded devices, yet.
  1802. + It does not support QoS, which is bad for AccessPoints.
  1803. + It does not support hardware crypto acceleration, which is a showstopper
  1804. + for embedded devices with low CPU resources.
  1805. +
  1806. + If unsure, select the "stable" firmware.
  1807. +
  1808. + endchoice
  1809. +
  1810. + config B43_FW_SQUASH
  1811. + bool "Remove unnecessary firmware files"
  1812. + depends on !B43_OPENFIRMWARE
  1813. + default y
  1814. + help
  1815. + This options allows you to remove unnecessary b43 firmware files
  1816. + from the final rootfs image. This can reduce the rootfs size by
  1817. + up to 200k.
  1818. +
  1819. + If unsure, say Y.
  1820. +
  1821. + config B43_FW_SQUASH_COREREVS
  1822. + string "Core revisions to include"
  1823. + depends on B43_FW_SQUASH
  1824. + default "5,6,7,8,9,10,11,13,15" if TARGET_brcm47xx_legacy
  1825. + default "16,28,29,30" if TARGET_brcm47xx_mips74k
  1826. + default "5,6,7,8,9,10,11,13,15,16,28,29,30"
  1827. + help
  1828. + This is a comma seperated list of core revision numbers.
  1829. +
  1830. + Example (keep files for rev5 only):
  1831. + 5
  1832. +
  1833. + Example (keep files for rev5 and rev11):
  1834. + 5,11
  1835. +
  1836. + config B43_FW_SQUASH_PHYTYPES
  1837. + string "PHY types to include"
  1838. + depends on B43_FW_SQUASH
  1839. + default "G,N,LP" if TARGET_brcm47xx_legacy
  1840. + default "N,HT" if TARGET_brcm47xx_mips74k
  1841. + default "G,N,LP,HT"
  1842. + help
  1843. + This is a comma seperated list of PHY types:
  1844. + A => A-PHY
  1845. + AG => Dual A-PHY G-PHY
  1846. + G => G-PHY
  1847. + LP => LP-PHY
  1848. + N => N-PHY
  1849. + HT => HT-PHY
  1850. + LCN => LCN-PHY
  1851. + LCN40 => LCN40-PHY
  1852. + AC => AC-PHY
  1853. +
  1854. + Example (keep files for G-PHY only):
  1855. + G
  1856. +
  1857. + Example (keep files for G-PHY and N-PHY):
  1858. + G,N
  1859. +
  1860. + choice
  1861. + prompt "Supported buses"
  1862. + default PACKAGE_B43_BUSES_BCMA_AND_SSB
  1863. + help
  1864. + This allows choosing buses that b43 should support.
  1865. +
  1866. + config PACKAGE_B43_BUSES_BCMA_AND_SSB
  1867. + depends on !TARGET_brcm47xx_legacy && !TARGET_brcm47xx_mips74k && !TARGET_bcm53xx
  1868. + bool "BCMA and SSB"
  1869. +
  1870. + config PACKAGE_B43_BUSES_BCMA
  1871. + depends on !TARGET_brcm47xx_legacy
  1872. + bool "BCMA only"
  1873. +
  1874. + config PACKAGE_B43_BUSES_SSB
  1875. + depends on !TARGET_brcm47xx_mips74k && !TARGET_bcm53xx
  1876. + bool "SSB only"
  1877. +
  1878. + endchoice
  1879. +
  1880. + config PACKAGE_B43_DEBUG
  1881. + bool "Enable debug output and debugfs for b43"
  1882. + default n
  1883. + help
  1884. + Enable additional debug output and runtime sanity checks for b43
  1885. + and enables the debugfs interface.
  1886. +
  1887. + If unsure, say N.
  1888. +
  1889. + config PACKAGE_B43_PIO
  1890. + bool "Enable support for PIO transfer mode"
  1891. + default n
  1892. + help
  1893. + Enable support for using PIO instead of DMA. Unless you have DMA
  1894. + transfer problems you don't need this.
  1895. - Select this option if you want the driver to respect the user's decision about
  1896. - regulatory settings.
  1897. + If unsure, say N.
  1898. - config PACKAGE_ATH_DEBUG
  1899. - bool "Atheros wireless debugging"
  1900. + config PACKAGE_B43_PHY_G
  1901. + bool "Enable support for G-PHYs"
  1902. + default n if TARGET_brcm47xx_mips74k
  1903. + default y
  1904. help
  1905. - Say Y, if you want to debug atheros wireless drivers.
  1906. - Right now only ath9k makes use of this.
  1907. + Enable support for G-PHY. This includes support for the following devices:
  1908. + PCI: BCM4306, BCM4311, BCM4318
  1909. + SoC: BCM5352E, BCM4712
  1910. - config PACKAGE_ATH_DFS
  1911. - bool "Enable DFS support"
  1912. + If unsure, say Y.
  1913. +
  1914. + config PACKAGE_B43_PHY_N
  1915. + bool "Enable support for N-PHYs"
  1916. default y
  1917. help
  1918. - Dynamic frequency selection (DFS) is required for most of the 5 GHz band
  1919. - channels in Europe, US, and Japan.
  1920. + Enable support for N-PHY. This includes support for the following devices:
  1921. + PCI: BCM4321, BCM4322, BCM43222, BCM43224, BCM43225
  1922. + SoC: BCM4716, BCM4717, BCM4718
  1923. - Select this option if you want to use such channels.
  1924. + Currently only 11g speed is available.
  1925. - endif
  1926. -endef
  1927. + If unsure, say Y.
  1928. -define KernelPackage/ath
  1929. - $(call KernelPackage/mac80211/Default)
  1930. - TITLE:=Atheros common driver part
  1931. - DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx||TARGET_ath25 +kmod-mac80211
  1932. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath.ko
  1933. - MENU:=1
  1934. -endef
  1935. + config PACKAGE_B43_PHY_LP
  1936. + bool "Enable support for LP-PHYs"
  1937. + default n if TARGET_brcm47xx_mips74k
  1938. + default y
  1939. + help
  1940. + Enable support for LP-PHY. This includes support for the following devices:
  1941. + PCI: BCM4312
  1942. + SoC: BCM5354
  1943. -define KernelPackage/ath/description
  1944. - This module contains some common parts needed by Atheros Wireless drivers.
  1945. -endef
  1946. + If unsure, say Y.
  1947. -define KernelPackage/ath5k
  1948. - $(call KernelPackage/mac80211/Default)
  1949. - TITLE:=Atheros 5xxx wireless cards support
  1950. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath5k
  1951. - DEPENDS+= @PCI_SUPPORT||@TARGET_ath25 +kmod-ath
  1952. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath5k/ath5k.ko
  1953. - AUTOLOAD:=$(call AutoProbe,ath5k)
  1954. -endef
  1955. + config PACKAGE_B43_PHY_HT
  1956. + bool "Enable support for HT-PHYs"
  1957. + default n if TARGET_brcm47xx_legacy
  1958. + default y
  1959. + help
  1960. + Enable support for HT-PHY. This includes support for the following devices:
  1961. + PCI: BCM4331
  1962. -define KernelPackage/ath5k/description
  1963. - This module adds support for wireless adapters based on
  1964. - Atheros 5xxx chipset.
  1965. -endef
  1966. + Currently only 11g speed is available.
  1967. -define KernelPackage/ath9k-common
  1968. - $(call KernelPackage/mac80211/Default)
  1969. - TITLE:=Atheros 802.11n wireless devices (common code for ath9k and ath9k_htc)
  1970. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  1971. - DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx +kmod-ath +@DRIVER_11N_SUPPORT +@KERNEL_RELAY
  1972. - FILES:= \
  1973. - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_common.ko \
  1974. - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_hw.ko
  1975. -endef
  1976. + If unsure, say Y.
  1977. -define KernelPackage/ath9k
  1978. - $(call KernelPackage/mac80211/Default)
  1979. - TITLE:=Atheros 802.11n PCI wireless cards support
  1980. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  1981. - DEPENDS+= @PCI_SUPPORT||TARGET_ar71xx +kmod-ath9k-common
  1982. - FILES:= \
  1983. - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k.ko
  1984. - AUTOLOAD:=$(call AutoProbe,ath9k)
  1985. -endef
  1986. + config PACKAGE_B43_PHY_LCN
  1987. + bool "Enable support for LCN-PHYs"
  1988. + depends on BROKEN
  1989. + default n
  1990. + help
  1991. + Currently broken.
  1992. -define KernelPackage/ath9k/description
  1993. -This module adds support for wireless adapters based on
  1994. -Atheros IEEE 802.11n AR5008 and AR9001 family of chipsets.
  1995. -endef
  1996. + If unsure, say N.
  1997. -define KernelPackage/ath9k/config
  1998. + endif
  1999. +endef
  2000. - config ATH9K_SUPPORT_PCOEM
  2001. - bool "Support chips used in PC OEM cards"
  2002. - depends on PACKAGE_kmod-ath9k
  2003. -
  2004. +define KernelPackage/b43/description
  2005. +Kernel module for Broadcom 43xx wireless support (mac80211 stack) new
  2006. endef
  2007. -define KernelPackage/ath9k-htc
  2008. +define KernelPackage/b43legacy
  2009. $(call KernelPackage/mac80211/Default)
  2010. - TITLE:=Atheros 802.11n USB device support
  2011. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  2012. - DEPENDS+= @USB_SUPPORT +kmod-ath9k-common +kmod-usb-core
  2013. - FILES:= \
  2014. - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_htc.ko
  2015. - AUTOLOAD:=$(call AutoProbe,ath9k_htc)
  2016. + TITLE:=Broadcom 43xx-legacy wireless support
  2017. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/b43
  2018. + KCONFIG:= \
  2019. + CONFIG_HW_RANDOM=y
  2020. + DEPENDS+= +kmod-mac80211 +!(TARGET_brcm47xx||TARGET_brcm63xx):kmod-ssb +b43legacy-firmware
  2021. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/broadcom/b43legacy/b43legacy.ko
  2022. + AUTOLOAD:=$(call AutoProbe,b43legacy)
  2023. + MENU:=1
  2024. endef
  2025. -define KernelPackage/ath9k-htc/description
  2026. -This module adds support for wireless adapters based on
  2027. -Atheros USB AR9271 and AR7010 family of chipsets.
  2028. +define KernelPackage/b43legacy/description
  2029. +Kernel module for Broadcom 43xx-legacy wireless support (mac80211 stack) new
  2030. endef
  2031. -define KernelPackage/ath10k
  2032. +
  2033. +define KernelPackage/brcmutil
  2034. $(call KernelPackage/mac80211/Default)
  2035. - TITLE:=Atheros 802.11ac wireless cards support
  2036. - URL:=https://wireless.wiki.kernel.org/en/users/Drivers/ath10k
  2037. - DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT
  2038. - FILES:= \
  2039. - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_core.ko \
  2040. - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_pci.ko
  2041. - AUTOLOAD:=$(call AutoLoad,55,ath10k_core ath10k_pci)
  2042. + TITLE:=Broadcom IEEE802.11n common driver parts
  2043. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
  2044. + DEPENDS+=@PCI_SUPPORT||USB_SUPPORT
  2045. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/broadcom/brcm80211/brcmutil/brcmutil.ko
  2046. + AUTOLOAD:=$(call AutoProbe,brcmutil)
  2047. + MENU:=1
  2048. endef
  2049. -define KernelPackage/ath10k/description
  2050. -This module adds support for wireless adapters based on
  2051. -Atheros IEEE 802.11ac family of chipsets. For now only
  2052. -PCI is supported.
  2053. +define KernelPackage/brcmutil/description
  2054. + This module contains some common parts needed by Broadcom Wireless drivers brcmsmac and brcmfmac.
  2055. endef
  2056. -define KernelPackage/ath10k/config
  2057. - if PACKAGE_kmod-ath10k
  2058. -
  2059. - config ATH10K_STA_FW
  2060. - bool "Firmware optimized for STA operation"
  2061. - default n
  2062. - help
  2063. - Use the ath10k firmware optimized for wireless client instead
  2064. - of access point operation.
  2065. +define KernelPackage/brcmutil/config
  2066. + if PACKAGE_kmod-brcmutil
  2067. - config ATH10K_API2_FW
  2068. - bool "Firmware optimized for AP operation (v10.1 / API v2)"
  2069. - default n
  2070. - depends on !ATH10K_STA_FW
  2071. + config PACKAGE_BRCM80211_DEBUG
  2072. + bool "Broadcom wireless driver debugging"
  2073. help
  2074. - Use the ath10k firmware from the 10.1 SDK using API v2 optimized
  2075. - for access point operation if the default firmware keeps crashing.
  2076. + Say Y, if you want to debug brcmsmac and brcmfmac wireless driver.
  2077. endif
  2078. endef
  2079. -define KernelPackage/carl9170
  2080. - $(call KernelPackage/mac80211/Default)
  2081. - TITLE:=Driver for Atheros AR9170 USB sticks
  2082. - DEPENDS:=@USB_SUPPORT +kmod-mac80211 +kmod-ath +kmod-usb-core +kmod-input-core +@DRIVER_11N_SUPPORT
  2083. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/carl9170/carl9170.ko
  2084. - AUTOLOAD:=$(call AutoProbe,carl9170)
  2085. +PKG_BRCMSMAC_FW_NAME:=broadcom-wl
  2086. +PKG_BRCMSMAC_FW_VERSION:=5.100.138
  2087. +PKG_BRCMSMAC_FW_OBJECT:=$(PKG_BRCMSMAC_FW_NAME)-$(PKG_BRCMSMAC_FW_VERSION)/linux/wl_apsta.o
  2088. +PKG_BRCMSMAC_FW_SOURCE:=$(PKG_BRCMSMAC_FW_NAME)-$(PKG_BRCMSMAC_FW_VERSION).tar.bz2
  2089. +PKG_BRCMSMAC_FW_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/
  2090. +PKG_BRCMSMAC_FW_MD5SUM:=f4e357b09eaf5d8b1f1920cf3493a555
  2091. +
  2092. +define Download/brcmsmac
  2093. + FILE:=$(PKG_BRCMSMAC_FW_SOURCE)
  2094. + URL:=$(PKG_BRCMSMAC_FW_SOURCE_URL)
  2095. + MD5SUM:=$(PKG_BRCMSMAC_FW_MD5SUM)
  2096. endef
  2097. +$(eval $(call Download,brcmsmac))
  2098. -define KernelPackage/lib80211
  2099. +define KernelPackage/brcmsmac
  2100. $(call KernelPackage/mac80211/Default)
  2101. - TITLE:=802.11 Networking stack
  2102. - DEPENDS:=+kmod-cfg80211
  2103. - FILES:= \
  2104. - $(PKG_BUILD_DIR)/net/wireless/lib80211.ko \
  2105. - $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_wep.ko \
  2106. - $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_ccmp.ko \
  2107. - $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_tkip.ko
  2108. - AUTOLOAD:=$(call AutoProbe, \
  2109. - lib80211 \
  2110. - lib80211_crypt_wep \
  2111. - lib80211_crypt_ccmp \
  2112. - lib80211_crypt_tkip \
  2113. - )
  2114. + TITLE:=Broadcom IEEE802.11n PCIe SoftMAC WLAN driver
  2115. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
  2116. + 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
  2117. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/broadcom/brcm80211/brcmsmac/brcmsmac.ko
  2118. + AUTOLOAD:=$(call AutoProbe,brcmsmac)
  2119. + MENU:=1
  2120. endef
  2121. -define KernelPackage/lib80211/description
  2122. - Kernel modules for 802.11 Networking stack
  2123. - Includes:
  2124. - - lib80211
  2125. - - lib80211_crypt_wep
  2126. - - lib80211_crypt_tkip
  2127. - - lib80211_crytp_ccmp
  2128. +define KernelPackage/brcmsmac/description
  2129. + Kernel module for Broadcom IEEE802.11n PCIe Wireless cards
  2130. endef
  2131. -define KernelPackage/libertas-usb
  2132. - $(call KernelPackage/mac80211/Default)
  2133. - DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +kmod-usb-core +kmod-lib80211 +@DRIVER_WEXT_SUPPORT
  2134. - TITLE:=Marvell 88W8015 Wireless Driver
  2135. - FILES:= \
  2136. - $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/libertas.ko \
  2137. - $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/usb8xxx.ko
  2138. - AUTOLOAD:=$(call AutoProbe,libertas usb8xxx)
  2139. -endef
  2140. +define KernelPackage/brcmsmac/config
  2141. + if PACKAGE_kmod-brcmsmac
  2142. -define KernelPackage/libertas-sdio
  2143. - $(call KernelPackage/mac80211/Default)
  2144. - DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +kmod-mmc +@DRIVER_WEXT_SUPPORT @!TARGET_uml
  2145. - TITLE:=Marvell 88W8686 Wireless Driver
  2146. - FILES:= \
  2147. - $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/libertas.ko \
  2148. - $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/libertas_sdio.ko
  2149. - AUTOLOAD:=$(call AutoProbe,libertas libertas_sdio)
  2150. -endef
  2151. + config BRCMSMAC_USE_FW_FROM_WL
  2152. + bool "Use firmware extracted from broadcom proprietary driver"
  2153. + default y
  2154. + help
  2155. + Instead of using the official brcmsmac firmware a firmware
  2156. + version 666.2 extracted from the proprietary Broadcom driver
  2157. + is used. This is needed to get core rev 17 used in bcm4716
  2158. + to work.
  2159. -define KernelPackage/mac80211-hwsim
  2160. - $(call KernelPackage/mac80211/Default)
  2161. - TITLE:=mac80211 HW simulation device
  2162. - DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT
  2163. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mac80211_hwsim.ko
  2164. - AUTOLOAD:=$(call AutoProbe,mac80211_hwsim)
  2165. + If unsure, say Y.
  2166. +
  2167. + endif
  2168. endef
  2169. -define KernelPackage/net-libipw
  2170. +
  2171. +define KernelPackage/brcmfmac
  2172. $(call KernelPackage/mac80211/Default)
  2173. - TITLE:=libipw for ipw2100 and ipw2200
  2174. - 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
  2175. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ipw2x00/libipw.ko
  2176. - AUTOLOAD:=$(call AutoProbe,libipw)
  2177. + TITLE:=Broadcom IEEE802.11n USB FullMAC WLAN driver
  2178. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
  2179. + DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +@DRIVER_11N_SUPPORT +kmod-brcmutil \
  2180. + +BRCMFMAC_PCIE:brcmfmac-firmware-pcie \
  2181. + +BRCMFMAC_SDIO:kmod-mmc +BRCMFMAC_SDIO:brcmfmac-firmware-sdio \
  2182. + +BRCMFMAC_USB:kmod-usb-core +BRCMFMAC_USB:brcmfmac-firmware-usb
  2183. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko
  2184. + AUTOLOAD:=$(call AutoProbe,brcmfmac)
  2185. endef
  2186. -define KernelPackage/net-libipw/description
  2187. - Hardware independent IEEE 802.11 networking stack for ipw2100 and ipw2200.
  2188. +define KernelPackage/brcmfmac/description
  2189. + Kernel module for Broadcom IEEE802.11n USB Wireless cards
  2190. endef
  2191. -IPW2100_NAME:=ipw2100-fw
  2192. -IPW2100_VERSION:=1.3
  2193. -
  2194. -define Download/net-ipw2100
  2195. - URL:=http://bughost.org/firmware/
  2196. - FILE:=$(IPW2100_NAME)-$(IPW2100_VERSION).tgz
  2197. - MD5SUM=46aa75bcda1a00efa841f9707bbbd113
  2198. -endef
  2199. -$(eval $(call Download,net-ipw2100))
  2200. +define KernelPackage/brcmfmac/config
  2201. + if PACKAGE_kmod-brcmfmac
  2202. -define KernelPackage/net-ipw2100
  2203. - $(call KernelPackage/mac80211/Default)
  2204. - TITLE:=Intel IPW2100 driver
  2205. - DEPENDS:=@PCI_SUPPORT +kmod-net-libipw
  2206. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ipw2x00/ipw2100.ko
  2207. - AUTOLOAD:=$(call AutoProbe,ipw2100)
  2208. -endef
  2209. + config BRCMFMAC_SDIO
  2210. + bool "Enable SDIO bus interface support"
  2211. + default n
  2212. + help
  2213. + Enable support for cards attached to an SDIO bus.
  2214. + Select this option only if you are sure that your
  2215. + board has a Broadcom wireless chip atacched to
  2216. + that bus.
  2217. -define KernelPackage/net-ipw2100/description
  2218. - Kernel support for Intel IPW2100
  2219. - Includes:
  2220. - - ipw2100
  2221. -endef
  2222. + config BRCMFMAC_USB
  2223. + bool "Enable USB bus interface support"
  2224. + depends on USB_SUPPORT
  2225. + default y
  2226. + help
  2227. + Supported USB connected chipsets:
  2228. + BCM43235, BCM43236, BCM43238 (all in revision 3 only)
  2229. + BCM43143, BCM43242, BCM43566, BCM43569
  2230. -IPW2200_NAME:=ipw2200-fw
  2231. -IPW2200_VERSION:=3.1
  2232. + config BRCMFMAC_PCIE
  2233. + bool "Enable PCIE bus interface support"
  2234. + depends on PCI_SUPPORT
  2235. + default y
  2236. + help
  2237. + Supported PCIe connected chipsets:
  2238. + BCM4354, BCM4356, BCM43567, BCM43570, BCM43602
  2239. -define Download/net-ipw2200
  2240. - URL:=http://bughost.org/firmware/
  2241. - FILE:=$(IPW2200_NAME)-$(IPW2200_VERSION).tgz
  2242. - MD5SUM=eaba788643c7cc7483dd67ace70f6e99
  2243. + endif
  2244. endef
  2245. -$(eval $(call Download,net-ipw2200))
  2246. -define KernelPackage/net-ipw2200
  2247. - $(call KernelPackage/mac80211/Default)
  2248. - TITLE:=Intel IPW2200 driver
  2249. - DEPENDS:=@PCI_SUPPORT +kmod-net-libipw
  2250. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ipw2x00/ipw2200.ko
  2251. - AUTOLOAD:=$(call AutoProbe,ipw2200)
  2252. -endef
  2253. -define KernelPackage/net-ipw2200/description
  2254. - Kernel support for Intel IPW2200
  2255. - Includes:
  2256. - - ipw2200
  2257. +define KernelPackage/carl9170
  2258. + $(call KernelPackage/mac80211/Default)
  2259. + TITLE:=Driver for Atheros AR9170 USB sticks
  2260. + DEPENDS:=@USB_SUPPORT +kmod-mac80211 +kmod-ath +kmod-usb-core +kmod-input-core +@DRIVER_11N_SUPPORT +carl9170-firmware
  2261. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/carl9170/carl9170.ko
  2262. + AUTOLOAD:=$(call AutoProbe,carl9170)
  2263. endef
  2264. -define KernelPackage/net-hermes
  2265. +define KernelPackage/hermes
  2266. $(call KernelPackage/mac80211/Default)
  2267. TITLE:=Hermes 802.11b chipset support
  2268. - DEPENDS:=@PCI_SUPPORT||PCMCIA_SUPPORT +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT
  2269. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/orinoco/orinoco.ko
  2270. + DEPENDS:=@PCI_SUPPORT||PCMCIA_SUPPORT +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT +kmod-crypto-michael-mic
  2271. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/orinoco/orinoco.ko
  2272. AUTOLOAD:=$(call AutoProbe,orinoco)
  2273. endef
  2274. -define KernelPackage/net-hermes/description
  2275. +define KernelPackage/hermes/description
  2276. Kernel support for Hermes 802.11b chipsets
  2277. endef
  2278. -define KernelPackage/net-hermes-pci
  2279. +define KernelPackage/hermes-pci
  2280. $(call KernelPackage/mac80211/Default)
  2281. TITLE:=Intersil Prism 2.5 PCI support
  2282. - DEPENDS:=@PCI_SUPPORT +kmod-net-hermes
  2283. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/orinoco/orinoco_pci.ko
  2284. + DEPENDS:=@PCI_SUPPORT +kmod-hermes
  2285. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/orinoco/orinoco_pci.ko
  2286. AUTOLOAD:=$(call AutoProbe,orinoco_pci)
  2287. endef
  2288. -define KernelPackage/net-hermes-pci/description
  2289. +define KernelPackage/hermes-pci/description
  2290. Kernel modules for Intersil Prism 2.5 PCI support
  2291. endef
  2292. -define KernelPackage/net-hermes-plx
  2293. +define KernelPackage/hermes-plx
  2294. $(call KernelPackage/mac80211/Default)
  2295. TITLE:=PLX9052 based PCI adaptor
  2296. - DEPENDS:=@PCI_SUPPORT +kmod-net-hermes
  2297. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/orinoco/orinoco_plx.ko
  2298. + DEPENDS:=@PCI_SUPPORT +kmod-hermes
  2299. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/orinoco/orinoco_plx.ko
  2300. AUTOLOAD:=$(call AutoProbe,orinoco_plx)
  2301. endef
  2302. -define KernelPackage/net-hermes-plx/description
  2303. +define KernelPackage/hermes-plx/description
  2304. Kernel modules for Hermes in PLX9052 based PCI adaptors
  2305. endef
  2306. -define KernelPackage/net-hermes-pcmcia
  2307. +define KernelPackage/hermes-pcmcia
  2308. $(call KernelPackage/mac80211/Default)
  2309. TITLE:=Hermes based PCMCIA adaptors
  2310. - DEPENDS:=@PCMCIA_SUPPORT +kmod-net-hermes @BROKEN
  2311. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/orinoco/orinoco_cs.ko
  2312. + DEPENDS:=@PCMCIA_SUPPORT +kmod-hermes @BROKEN
  2313. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/orinoco/orinoco_cs.ko
  2314. AUTOLOAD:=$(call AutoProbe,orinoco_cs)
  2315. endef
  2316. -define KernelPackage/net-hermes-pcmcia/description
  2317. +define KernelPackage/hermes-pcmcia/description
  2318. Kernel modules for Hermes based PCMCIA adaptors
  2319. endef
  2320. -define KernelPackage/iwlagn
  2321. +
  2322. +define KernelPackage/iwlwifi
  2323. $(call KernelPackage/mac80211/Default)
  2324. - DEPENDS:= +kmod-mac80211 @PCI_SUPPORT +@DRIVER_11N_SUPPORT
  2325. + DEPENDS:= +kmod-mac80211 @PCI_SUPPORT +@DRIVER_11N_SUPPORT +iwlwifi-firmware
  2326. TITLE:=Intel AGN Wireless support
  2327. FILES:= \
  2328. - $(PKG_BUILD_DIR)/drivers/net/wireless/iwlwifi/iwlwifi.ko \
  2329. - $(PKG_BUILD_DIR)/drivers/net/wireless/iwlwifi/dvm/iwldvm.ko
  2330. - AUTOLOAD:=$(call AutoProbe,iwlwifi iwldvm)
  2331. + $(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlwifi/iwlwifi.ko \
  2332. + $(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlwifi/dvm/iwldvm.ko \
  2333. + $(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlwifi/mvm/iwlmvm.ko
  2334. + AUTOLOAD:=$(call AutoProbe,iwlwifi iwldvm iwlmvm)
  2335. MENU:=1
  2336. endef
  2337. -define KernelPackage/iwlagn/description
  2338. - iwlagn kernel module for Intel 5000/5150/1000/6000/6050/6005/6030/100 support
  2339. -endef
  2340. -
  2341. -define KernelPackage/iwlagn/config
  2342. - if PACKAGE_kmod-iwlagn
  2343. -
  2344. - config IWL5000_FW
  2345. - bool "Intel 5000 Firmware"
  2346. - default y
  2347. - help
  2348. - Download and install firmware for:
  2349. - Intel Wireless WiFi 5100AGN, 5300AGN, and 5350AGN
  2350. -
  2351. - config IWL5150_FW
  2352. - bool "Intel 5150 Firmware"
  2353. - default y
  2354. - help
  2355. - Download and install firmware for:
  2356. - Intel Wireless WiFi 5150AGN
  2357. -
  2358. - config IWL1000_FW
  2359. - bool "Intel 1000 Firmware"
  2360. - default y
  2361. - help
  2362. - Download and install firmware for:
  2363. - Intel Centrino Wireless-N 1000
  2364. -
  2365. - config IWL6000_FW
  2366. - bool "Intel 6000 Firmware"
  2367. - default y
  2368. - help
  2369. - Download and install firmware for:
  2370. - Intel Centrino Ultimate-N 6300 and Advanced-N 6200
  2371. -
  2372. - config IWL6050_FW
  2373. - bool "Intel 6050 Firmware"
  2374. - default y
  2375. - help
  2376. - Download and install firmware for:
  2377. - Intel Centrino Advanced-N + WiMAX 6250 and Wireless-N + WiMAX 6150
  2378. -
  2379. - config IWL6005_FW
  2380. - bool "Intel 6005 Firmware"
  2381. - default y
  2382. +define KernelPackage/iwlwifi/description
  2383. + iwlwifi kernel module for
  2384. + Intel Wireless WiFi Link 6250AGN Adapter
  2385. + Intel 6000 Series Wi-Fi Adapters (6200AGN and 6300AGN)
  2386. + Intel WiFi Link 1000BGN
  2387. + Intel Wireless WiFi 5150AGN
  2388. + Intel Wireless WiFi 5100AGN, 5300AGN, and 5350AGN
  2389. + Intel 6005 Series Wi-Fi Adapters
  2390. + Intel 6030 Series Wi-Fi Adapters
  2391. + Intel Wireless WiFi Link 6150BGN 2 Adapter
  2392. + Intel 100 Series Wi-Fi Adapters (100BGN and 130BGN)
  2393. + Intel 2000 Series Wi-Fi Adapters
  2394. + Intel 7260 Wi-Fi Adapter
  2395. + Intel 3160 Wi-Fi Adapter
  2396. + Intel 7265 Wi-Fi Adapter
  2397. + Intel 8260 Wi-Fi Adapter
  2398. + Intel 3165 Wi-Fi Adapter
  2399. +endef
  2400. +
  2401. +define KernelPackage/iwlwifi/config
  2402. + if PACKAGE_kmod-iwlwifi
  2403. +
  2404. + config PACKAGE_IWLWIFI_DEBUG
  2405. + bool "Enable full debugging output in the iwlwifi driver"
  2406. + default n
  2407. help
  2408. - Download and install firmware for:
  2409. - Intel Centrino Advanced-N 6205
  2410. + This option will enable debug tracing output for the iwlwifi drivers
  2411. - config IWL6030_FW
  2412. - bool "Intel 6030 Firmware"
  2413. - default y
  2414. - help
  2415. - Download and install firmware for:
  2416. - Intel Centrino Advanced-N 6230, Wireless-N 1030, Wireless-N 130 and Advanced-N 6235
  2417. + This will result in the kernel module being ~100k larger. You can
  2418. + control which debug output is sent to the kernel log by setting the
  2419. + value in
  2420. - config IWL7260_FW
  2421. - bool "Intel 7260 Firmware"
  2422. - default y
  2423. - help
  2424. - Download and install firmware for:
  2425. - Intel Dual Band Wireless-N 7260 and Intel Dual Band Wireless-AC 7260
  2426. + /sys/module/iwlwifi/parameters/debug
  2427. - config IWL7265_FW
  2428. - bool "Intel 7265 Firmware"
  2429. - default y
  2430. - help
  2431. - Download and install firmware for:
  2432. - Intel Wireless 7265
  2433. + This entry will only exist if this option is enabled.
  2434. - config IWL100_FW
  2435. - bool "Intel 100 Firmware"
  2436. - default y
  2437. - help
  2438. - Download and install firmware for:
  2439. - Intel Centrino Wireless-N 100
  2440. + To set a value, simply echo an 8-byte hex value to the same file:
  2441. - config IWL2000_FW
  2442. - bool "Intel 2000 Firmware"
  2443. - default y
  2444. - help
  2445. - Download and install firmware for:
  2446. - Intel Centrino Wireless-N 2200
  2447. + % echo 0x43fff > /sys/module/iwlwifi/parameters/debug
  2448. - config IWL2030_FW
  2449. - bool "Intel 2030 Firmware"
  2450. - default y
  2451. - help
  2452. - Download and install firmware for:
  2453. - Intel Centrino Wireless-N 2230
  2454. + You can find the list of debug mask values in:
  2455. + drivers/net/wireless/intel/iwlwifi/iwl-debug.h
  2456. - config IWL105_FW
  2457. - bool "Intel 105 Firmware"
  2458. - default y
  2459. - help
  2460. - Download and install firmware for:
  2461. - Intel Centrino Wireless-N 105
  2462. + If this is your first time using this driver, you should say Y here
  2463. + as the debug information can assist others in helping you resolve
  2464. + any problems you may encounter.
  2465. - config IWL135_FW
  2466. - bool "Intel 135 Firmware"
  2467. - default y
  2468. + config PACKAGE_IWLWIFI_DEBUGFS
  2469. + bool "iwlwifi debugfs support"
  2470. + depends on PACKAGE_MAC80211_DEBUGFS
  2471. + default n
  2472. help
  2473. - Download and install firmware for:
  2474. - Intel Centrino Wireless-N 135
  2475. + Enable creation of debugfs files for the iwlwifi drivers. This
  2476. + is a low-impact option that allows getting insight into the
  2477. + driver's state at runtime.
  2478. - config IWL3160_FW
  2479. - bool "Intel 3160 Firmware"
  2480. - default y
  2481. - help
  2482. - Download and install firmware for:
  2483. - Intel Wireless 3160
  2484. endif
  2485. endef
  2486. @@ -942,7 +834,7 @@ define KernelPackage/iwl-legacy
  2487. $(call KernelPackage/mac80211/Default)
  2488. DEPENDS:= +kmod-mac80211 @PCI_SUPPORT
  2489. TITLE:=Intel legacy Wireless support
  2490. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/iwlegacy/iwlegacy.ko
  2491. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlegacy/iwlegacy.ko
  2492. AUTOLOAD:=$(call AutoProbe,iwlegacy)
  2493. endef
  2494. @@ -952,9 +844,9 @@ endef
  2495. define KernelPackage/iwl3945
  2496. $(call KernelPackage/mac80211/Default)
  2497. - DEPENDS:= +kmod-mac80211 +kmod-iwl-legacy
  2498. + DEPENDS:= +kmod-mac80211 +kmod-iwl-legacy +iwl3945-firmware
  2499. TITLE:=Intel iwl3945 Wireless support
  2500. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/iwlegacy/iwl3945.ko
  2501. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlegacy/iwl3945.ko
  2502. AUTOLOAD:=$(call AutoProbe,iwl3945)
  2503. endef
  2504. @@ -964,9 +856,9 @@ endef
  2505. define KernelPackage/iwl4965
  2506. $(call KernelPackage/mac80211/Default)
  2507. - DEPENDS:= +kmod-mac80211 +kmod-iwl-legacy +@DRIVER_11N_SUPPORT
  2508. + DEPENDS:= +kmod-mac80211 +kmod-iwl-legacy +@DRIVER_11N_SUPPORT +iwl4965-firmware
  2509. TITLE:=Intel iwl4965 Wireless support
  2510. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/iwlegacy/iwl4965.ko
  2511. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlegacy/iwl4965.ko
  2512. AUTOLOAD:=$(call AutoProbe,iwl4965)
  2513. endef
  2514. @@ -975,557 +867,576 @@ define KernelPackage/iwl4965/description
  2515. endef
  2516. -define KernelPackage/mwl8k
  2517. - $(call KernelPackage/mac80211/Default)
  2518. - TITLE:=Driver for Marvell TOPDOG 802.11 Wireless cards
  2519. - URL:=http://wireless.kernel.org/en/users/Drivers/mwl8k
  2520. - DEPENDS+= @PCI_SUPPORT +kmod-mac80211 +@DRIVER_11N_SUPPORT
  2521. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mwl8k.ko
  2522. - AUTOLOAD:=$(call AutoProbe,mwl8k)
  2523. -endef
  2524. -
  2525. -define KernelPackage/mwl8k/description
  2526. - Kernel modules for Marvell TOPDOG 802.11 Wireless cards
  2527. -endef
  2528. -
  2529. -
  2530. -define KernelPackage/mwifiex-pcie
  2531. - $(call KernelPackage/mac80211/Default)
  2532. - TITLE:=Driver for Marvell 802.11n/802.11ac PCIe Wireless cards
  2533. - URL:=http://wireless.kernel.org/en/users/Drivers/mwifiex
  2534. - DEPENDS+= @PCI_SUPPORT +kmod-mac80211 +@DRIVER_11N_SUPPORT
  2535. - FILES:= \
  2536. - $(PKG_BUILD_DIR)/drivers/net/wireless/mwifiex/mwifiex.ko \
  2537. - $(PKG_BUILD_DIR)/drivers/net/wireless/mwifiex/mwifiex_pcie.ko
  2538. - AUTOLOAD:=$(call AutoProbe,mwifiex_pcie)
  2539. -endef
  2540. -
  2541. -define KernelPackage/mwifiex-pcie/description
  2542. - Kernel modules for Marvell 802.11n/802.11ac PCIe Wireless cards
  2543. -endef
  2544. -
  2545. -
  2546. -define KernelPackage/wlcore
  2547. +define KernelPackage/lib80211
  2548. $(call KernelPackage/mac80211/Default)
  2549. - TITLE:=TI common driver part
  2550. - DEPENDS+= @TARGET_omap +kmod-mac80211 +@DRIVER_11N_SUPPORT
  2551. + TITLE:=802.11 Networking stack
  2552. + DEPENDS:=+kmod-cfg80211
  2553. FILES:= \
  2554. - $(PKG_BUILD_DIR)/drivers/net/wireless/ti/wlcore/wlcore.ko \
  2555. - $(PKG_BUILD_DIR)/drivers/net/wireless/ti/wlcore/wlcore_sdio.ko
  2556. - AUTOLOAD:=$(call AutoProbe,wlcore wlcore_sdio)
  2557. -endef
  2558. -
  2559. -define KernelPackage/wlcore/description
  2560. - This module contains some common parts needed by TI Wireless drivers.
  2561. -endef
  2562. -
  2563. -define KernelPackage/wl12xx
  2564. - $(call KernelPackage/mac80211/Default)
  2565. - TITLE:=Driver for TI WL12xx
  2566. - URL:=http://wireless.kernel.org/en/users/Drivers/wl12xx
  2567. - DEPENDS+= +kmod-wlcore
  2568. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ti/wl12xx/wl12xx.ko
  2569. - AUTOLOAD:=$(call AutoProbe,wl12xx)
  2570. -endef
  2571. -
  2572. -define KernelPackage/wl12xx/description
  2573. - Kernel modules for TI WL12xx
  2574. -endef
  2575. -
  2576. -define KernelPackage/wl18xx
  2577. - $(call KernelPackage/mac80211/Default)
  2578. - TITLE:=Driver for TI WL18xx
  2579. - URL:=http://wireless.kernel.org/en/users/Drivers/wl18xx
  2580. - DEPENDS+= +kmod-wlcore
  2581. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ti/wl18xx/wl18xx.ko
  2582. - AUTOLOAD:=$(call AutoProbe,wl18xx)
  2583. -endef
  2584. -
  2585. -define KernelPackage/wl18xx/description
  2586. - Kernel modules for TI WL18xx
  2587. -endef
  2588. -
  2589. -
  2590. -#Broadcom firmware
  2591. -ifneq ($(CONFIG_B43_FW_6_30),)
  2592. - PKG_B43_FWV4_NAME:=broadcom-wl
  2593. - PKG_B43_FWV4_VERSION:=6.30.163.46
  2594. - PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).wl_apsta.o
  2595. - PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  2596. - PKG_B43_FWV4_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/
  2597. - PKG_B43_FWV4_MD5SUM:=6fe97e9368d25342a1ab943d3cf3496d
  2598. -else
  2599. -ifneq ($(CONFIG_B43_FW_5_10),)
  2600. - PKG_B43_FWV4_NAME:=broadcom-wl
  2601. - PKG_B43_FWV4_VERSION:=5.10.56.27.3
  2602. - PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/driver/wl_apsta/wl_prebuilt.o
  2603. - PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)_mipsel.tar.bz2
  2604. - PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
  2605. - PKG_B43_FWV4_MD5SUM:=3363e3a6b3d9d73c49dea870c7834eac
  2606. -else
  2607. -ifneq ($(CONFIG_B43_FW_4_178),)
  2608. - PKG_B43_FWV4_NAME:=broadcom-wl
  2609. - PKG_B43_FWV4_VERSION:=4.178.10.4
  2610. - PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/linux/wl_apsta.o
  2611. - PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  2612. - PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
  2613. - PKG_B43_FWV4_MD5SUM:=14477e8cbbb91b11896affac9b219fdb
  2614. -else
  2615. -ifneq ($(CONFIG_B43_FW_5_100_138),)
  2616. - PKG_B43_FWV4_NAME:=broadcom-wl
  2617. - PKG_B43_FWV4_VERSION:=5.100.138
  2618. - PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/linux/wl_apsta.o
  2619. - PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  2620. - PKG_B43_FWV4_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/
  2621. - PKG_B43_FWV4_MD5SUM:=f4e357b09eaf5d8b1f1920cf3493a555
  2622. -else
  2623. - PKG_B43_FWV4_NAME:=broadcom-wl
  2624. - PKG_B43_FWV4_VERSION:=4.150.10.5
  2625. - PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/driver/wl_apsta_mimo.o
  2626. - PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  2627. - PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
  2628. - PKG_B43_FWV4_MD5SUM:=0c6ba9687114c6b598e8019e262d9a60
  2629. -endif
  2630. -endif
  2631. -endif
  2632. -endif
  2633. -ifneq ($(CONFIG_B43_OPENFIRMWARE),)
  2634. - PKG_B43_FWV4_NAME:=broadcom-wl
  2635. - PKG_B43_FWV4_VERSION:=5.2
  2636. - PKG_B43_FWV4_OBJECT:=openfwwf-$(PKG_B43_FWV4_VERSION)
  2637. - PKG_B43_FWV4_SOURCE:=openfwwf-$(PKG_B43_FWV4_VERSION).tar.gz
  2638. - PKG_B43_FWV4_SOURCE_URL:=http://www.ing.unibs.it/openfwwf/firmware/
  2639. - PKG_B43_FWV4_MD5SUM:=e045a135453274e439ae183f8498b0fa
  2640. -endif
  2641. -
  2642. -
  2643. -PKG_B43_FWV3_NAME:=wl_apsta
  2644. -PKG_B43_FWV3_VERSION:=3.130.20.0
  2645. -PKG_B43_FWV3_SOURCE:=$(PKG_B43_FWV3_NAME)-$(PKG_B43_FWV3_VERSION).o
  2646. -PKG_B43_FWV3_SOURCE_URL:=http://downloads.openwrt.org/sources/
  2647. -PKG_B43_FWV3_MD5SUM:=e08665c5c5b66beb9c3b2dd54aa80cb3
  2648. -
  2649. -define Download/b43
  2650. - FILE:=$(PKG_B43_FWV4_SOURCE)
  2651. - URL:=$(PKG_B43_FWV4_SOURCE_URL)
  2652. - MD5SUM:=$(PKG_B43_FWV4_MD5SUM)
  2653. + $(PKG_BUILD_DIR)/net/wireless/lib80211.ko \
  2654. + $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_wep.ko \
  2655. + $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_ccmp.ko \
  2656. + $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_tkip.ko
  2657. + AUTOLOAD:=$(call AutoProbe, \
  2658. + lib80211 \
  2659. + lib80211_crypt_wep \
  2660. + lib80211_crypt_ccmp \
  2661. + lib80211_crypt_tkip \
  2662. + )
  2663. endef
  2664. -$(eval $(call Download,b43))
  2665. -define Download/b43legacy
  2666. - FILE:=$(PKG_B43_FWV3_SOURCE)
  2667. - URL:=$(PKG_B43_FWV3_SOURCE_URL)
  2668. - MD5SUM:=$(PKG_B43_FWV3_MD5SUM)
  2669. +define KernelPackage/lib80211/description
  2670. + Kernel modules for 802.11 Networking stack
  2671. + Includes:
  2672. + - lib80211
  2673. + - lib80211_crypt_wep
  2674. + - lib80211_crypt_tkip
  2675. + - lib80211_crytp_ccmp
  2676. endef
  2677. -$(eval $(call Download,b43legacy))
  2678. -define KernelPackage/b43
  2679. +define KernelPackage/libipw
  2680. $(call KernelPackage/mac80211/Default)
  2681. - TITLE:=Broadcom 43xx wireless support
  2682. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/b43
  2683. - KCONFIG:= \
  2684. - CONFIG_HW_RANDOM=y
  2685. - # Depend on PCI_SUPPORT to make sure we can select kmod-bcma or kmod-ssb
  2686. - DEPENDS += \
  2687. - @PCI_SUPPORT +kmod-mac80211 \
  2688. - $(if $(CONFIG_PACKAGE_B43_USE_SSB),+kmod-ssb) \
  2689. - $(if $(CONFIG_PACKAGE_B43_USE_BCMA),+kmod-bcma)
  2690. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/b43/b43.ko
  2691. - AUTOLOAD:=$(call AutoProbe,b43)
  2692. - MENU:=1
  2693. -endef
  2694. -
  2695. -define KernelPackage/b43/config
  2696. -
  2697. -config PACKAGE_B43_USE_SSB
  2698. - select PACKAGE_kmod-ssb
  2699. - tristate
  2700. - depends on !TARGET_brcm47xx && !TARGET_brcm63xx
  2701. - default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA_AND_SSB
  2702. - default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_SSB
  2703. -
  2704. -config PACKAGE_B43_USE_BCMA
  2705. - select PACKAGE_kmod-bcma
  2706. - tristate
  2707. - depends on !TARGET_brcm47xx && !TARGET_bcm53xx
  2708. - default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA_AND_SSB
  2709. - default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA
  2710. -
  2711. - if PACKAGE_kmod-b43
  2712. + TITLE:=libipw for ipw2100 and ipw2200
  2713. + DEPENDS:=@PCI_SUPPORT +kmod-crypto-michael-mic +kmod-lib80211 +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT @!BIG_ENDIAN
  2714. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/ipw2x00/libipw.ko
  2715. + AUTOLOAD:=$(call AutoProbe,libipw)
  2716. +endef
  2717. - choice
  2718. - prompt "b43 firmware version"
  2719. - default B43_FW_5_100_138
  2720. - help
  2721. - This option allows you to select the version of the b43 firmware.
  2722. +define KernelPackage/libipw/description
  2723. + Hardware independent IEEE 802.11 networking stack for ipw2100 and ipw2200.
  2724. +endef
  2725. - config B43_FW_4_150
  2726. - bool "Firmware 410.2160 from driver 4.150.10.5 (old stable)"
  2727. - help
  2728. - Old stable firmware for BCM43xx devices.
  2729. +IPW2100_NAME:=ipw2100-fw
  2730. +IPW2100_VERSION:=1.3
  2731. - If unsure, select this.
  2732. +define Download/ipw2100
  2733. + URL:=http://bughost.org/firmware/
  2734. + FILE:=$(IPW2100_NAME)-$(IPW2100_VERSION).tgz
  2735. + MD5SUM=46aa75bcda1a00efa841f9707bbbd113
  2736. +endef
  2737. +$(eval $(call Download,ipw2100))
  2738. - config B43_FW_4_178
  2739. - bool "Firmware 478.104 from driver 4.178.10.4"
  2740. - help
  2741. - Older firmware for BCM43xx devices.
  2742. +define KernelPackage/ipw2100
  2743. + $(call KernelPackage/mac80211/Default)
  2744. + TITLE:=Intel IPW2100 driver
  2745. + DEPENDS:=@PCI_SUPPORT +kmod-libipw
  2746. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/ipw2x00/ipw2100.ko
  2747. + AUTOLOAD:=$(call AutoProbe,ipw2100)
  2748. +endef
  2749. - If unsure, select the "stable" firmware.
  2750. +define KernelPackage/ipw2100/description
  2751. + Kernel support for Intel IPW2100
  2752. + Includes:
  2753. + - ipw2100
  2754. +endef
  2755. - config B43_FW_5_10
  2756. - bool "Firmware 508.1084 from driver 5.10.56.27"
  2757. - help
  2758. - Older firmware for BCM43xx devices.
  2759. +IPW2200_NAME:=ipw2200-fw
  2760. +IPW2200_VERSION:=3.1
  2761. - If unsure, select the "stable" firmware.
  2762. +define Download/ipw2200
  2763. + URL:=http://bughost.org/firmware/
  2764. + FILE:=$(IPW2200_NAME)-$(IPW2200_VERSION).tgz
  2765. + MD5SUM=eaba788643c7cc7483dd67ace70f6e99
  2766. +endef
  2767. +$(eval $(call Download,ipw2200))
  2768. - config B43_FW_5_100_138
  2769. - bool "Firmware 666.2 from driver 5.100.138 (stable)"
  2770. - help
  2771. - The currently default firmware for BCM43xx devices.
  2772. +define KernelPackage/ipw2200
  2773. + $(call KernelPackage/mac80211/Default)
  2774. + TITLE:=Intel IPW2200 driver
  2775. + DEPENDS:=@PCI_SUPPORT +kmod-libipw
  2776. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/ipw2x00/ipw2200.ko
  2777. + AUTOLOAD:=$(call AutoProbe,ipw2200)
  2778. +endef
  2779. - This firmware currently gets most of the testing and is needed for some N-PHY devices.
  2780. +define KernelPackage/ipw2200/description
  2781. + Kernel support for Intel IPW2200
  2782. + Includes:
  2783. + - ipw2200
  2784. +endef
  2785. - If unsure, select the this firmware.
  2786. - config B43_FW_6_30
  2787. - bool "Firmware 784.2 from driver 6.30.163.46 (experimental)"
  2788. - help
  2789. - Newer experimental firmware for BCM43xx devices.
  2790. +define KernelPackage/libertas-usb
  2791. + $(call KernelPackage/mac80211/Default)
  2792. + DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +kmod-usb-core +kmod-lib80211 +@DRIVER_WEXT_SUPPORT +libertas-usb-firmware
  2793. + TITLE:=Marvell 88W8015 Wireless Driver
  2794. + FILES:= \
  2795. + $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/libertas/libertas.ko \
  2796. + $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/libertas/usb8xxx.ko
  2797. + AUTOLOAD:=$(call AutoProbe,libertas usb8xxx)
  2798. +endef
  2799. - This firmware is mostly untested.
  2800. +define KernelPackage/libertas-sdio
  2801. + $(call KernelPackage/mac80211/Default)
  2802. + DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +kmod-mmc +@DRIVER_WEXT_SUPPORT @!TARGET_uml +libertas-sdio-firmware
  2803. + TITLE:=Marvell 88W8686 Wireless Driver
  2804. + FILES:= \
  2805. + $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/libertas/libertas.ko \
  2806. + $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/libertas/libertas_sdio.ko
  2807. + AUTOLOAD:=$(call AutoProbe,libertas libertas_sdio)
  2808. +endef
  2809. - If unsure, select the "stable" firmware.
  2810. +define KernelPackage/libertas-spi
  2811. + $(call KernelPackage/mac80211/Default)
  2812. + SUBMENU:=Wireless Drivers
  2813. + DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +@DRIVER_WEXT_SUPPORT +libertas-spi-firmware
  2814. + KCONFIG := \
  2815. + CONFIG_SPI=y \
  2816. + CONFIG_SPI_MASTER=y
  2817. + TITLE:=Marvell 88W8686 SPI Wireless Driver
  2818. + FILES:= \
  2819. + $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/libertas/libertas.ko \
  2820. + $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/libertas/libertas_spi.ko
  2821. + AUTOLOAD:=$(call AutoProbe,libertas libertas_spi)
  2822. +endef
  2823. - config B43_OPENFIRMWARE
  2824. - bool "Open FirmWare for WiFi networks"
  2825. - help
  2826. - Opensource firmware for BCM43xx devices.
  2827. +define KernelPackage/mac80211-hwsim
  2828. + $(call KernelPackage/mac80211/Default)
  2829. + TITLE:=mac80211 HW simulation device
  2830. + DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT
  2831. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mac80211_hwsim.ko
  2832. + AUTOLOAD:=$(call AutoProbe,mac80211_hwsim)
  2833. +endef
  2834. - Do _not_ select this, unless you know what you are doing.
  2835. - The Opensource firmware is not suitable for embedded devices, yet.
  2836. - It does not support QoS, which is bad for AccessPoints.
  2837. - It does not support hardware crypto acceleration, which is a showstopper
  2838. - for embedded devices with low CPU resources.
  2839. - If unsure, select the "stable" firmware.
  2840. +define KernelPackage/mt7601u
  2841. + $(call KernelPackage/mac80211/Default)
  2842. + TITLE:=MT7601U-based USB dongles Wireless Driver
  2843. + DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT @USB_SUPPORT +kmod-usb-core +mt7601u-firmware
  2844. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mediatek/mt7601u/mt7601u.ko
  2845. + AUTOLOAD:=$(call AutoProbe,mt7601u)
  2846. +endef
  2847. - endchoice
  2848. - config B43_FW_SQUASH
  2849. - bool "Remove unnecessary firmware files"
  2850. - depends on !B43_OPENFIRMWARE
  2851. - default y
  2852. - help
  2853. - This options allows you to remove unnecessary b43 firmware files
  2854. - from the final rootfs image. This can reduce the rootfs size by
  2855. - up to 200k.
  2856. +define KernelPackage/mwl8k
  2857. + $(call KernelPackage/mac80211/Default)
  2858. + TITLE:=Driver for Marvell TOPDOG 802.11 Wireless cards
  2859. + URL:=http://wireless.kernel.org/en/users/Drivers/mwl8k
  2860. + DEPENDS+= @PCI_SUPPORT +kmod-mac80211 +@DRIVER_11N_SUPPORT +mwl8k-firmware
  2861. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mwl8k.ko
  2862. + AUTOLOAD:=$(call AutoProbe,mwl8k)
  2863. +endef
  2864. - If unsure, say Y.
  2865. +define KernelPackage/mwl8k/description
  2866. + Kernel modules for Marvell TOPDOG 802.11 Wireless cards
  2867. +endef
  2868. - config B43_FW_SQUASH_COREREVS
  2869. - string "Core revisions to include"
  2870. - depends on B43_FW_SQUASH
  2871. - default "5,6,7,8,9,10,11,13,15" if TARGET_brcm47xx_legacy
  2872. - default "16,28,29,30" if TARGET_brcm47xx_mips74k
  2873. - default "5,6,7,8,9,10,11,13,15,16,28,29,30"
  2874. - help
  2875. - This is a comma seperated list of core revision numbers.
  2876. - Example (keep files for rev5 only):
  2877. - 5
  2878. +define KernelPackage/mwifiex-pcie
  2879. + $(call KernelPackage/mac80211/Default)
  2880. + TITLE:=Driver for Marvell 802.11n/802.11ac PCIe Wireless cards
  2881. + URL:=http://wireless.kernel.org/en/users/Drivers/mwifiex
  2882. + DEPENDS+= @PCI_SUPPORT +kmod-mac80211 +@DRIVER_11N_SUPPORT +mwifiex-pcie-firmware
  2883. + FILES:= \
  2884. + $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mwifiex/mwifiex.ko \
  2885. + $(PKG_BUILD_DIR)/drivers/net/wireless/marvell/mwifiex/mwifiex_pcie.ko
  2886. + AUTOLOAD:=$(call AutoProbe,mwifiex_pcie)
  2887. +endef
  2888. - Example (keep files for rev5 and rev11):
  2889. - 5,11
  2890. +define KernelPackage/mwifiex-pcie/description
  2891. + Kernel modules for Marvell 802.11n/802.11ac PCIe Wireless cards
  2892. +endef
  2893. - config B43_FW_SQUASH_PHYTYPES
  2894. - string "PHY types to include"
  2895. - depends on B43_FW_SQUASH
  2896. - default "G,N,LP" if TARGET_brcm47xx_legacy
  2897. - default "N,HT" if TARGET_brcm47xx_mips74k
  2898. - default "G,N,LP,HT"
  2899. - help
  2900. - This is a comma seperated list of PHY types:
  2901. - A => A-PHY
  2902. - AG => Dual A-PHY G-PHY
  2903. - G => G-PHY
  2904. - LP => LP-PHY
  2905. - N => N-PHY
  2906. - HT => HT-PHY
  2907. - LCN => LCN-PHY
  2908. - LCN40 => LCN40-PHY
  2909. - AC => AC-PHY
  2910. - Example (keep files for G-PHY only):
  2911. - G
  2912. +# Prism54 drivers
  2913. +P54PCIFW:=2.13.12.0.arm
  2914. +P54USBFW:=2.13.24.0.lm87.arm
  2915. +P54SPIFW:=2.13.0.0.a.13.14.arm
  2916. - Example (keep files for G-PHY and N-PHY):
  2917. - G,N
  2918. +define Download/p54usb
  2919. + FILE:=$(P54USBFW)
  2920. + URL:=http://daemonizer.de/prism54/prism54-fw/fw-usb
  2921. + MD5SUM:=8e8ab005a4f8f0123bcdc51bc25b47f6
  2922. +endef
  2923. +$(eval $(call Download,p54usb))
  2924. - choice
  2925. - prompt "Supported buses"
  2926. - default PACKAGE_B43_BUSES_BCMA_AND_SSB
  2927. - help
  2928. - This allows choosing buses that b43 should support.
  2929. +define Download/p54pci
  2930. + FILE:=$(P54PCIFW)
  2931. + URL:=http://daemonizer.de/prism54/prism54-fw/fw-softmac
  2932. + MD5SUM:=ff7536af2092b1c4b21315bd103ef4c4
  2933. +endef
  2934. +$(eval $(call Download,p54pci))
  2935. - config PACKAGE_B43_BUSES_BCMA_AND_SSB
  2936. - depends on !TARGET_brcm47xx_legacy && !TARGET_brcm47xx_mips74k && !TARGET_bcm53xx
  2937. - bool "BCMA and SSB"
  2938. +define Download/p54spi
  2939. + FILE:=$(P54SPIFW)
  2940. + URL:=http://daemonizer.de/prism54/prism54-fw/stlc4560
  2941. + MD5SUM:=42661f8ecbadd88012807493f596081d
  2942. +endef
  2943. +$(eval $(call Download,p54spi))
  2944. - config PACKAGE_B43_BUSES_BCMA
  2945. - depends on !TARGET_brcm47xx_legacy
  2946. - bool "BCMA only"
  2947. +define KernelPackage/p54/Default
  2948. + $(call KernelPackage/mac80211/Default)
  2949. + TITLE:=Prism54 Drivers
  2950. +endef
  2951. - config PACKAGE_B43_BUSES_SSB
  2952. - depends on !TARGET_brcm47xx_mips74k && !TARGET_bcm53xx
  2953. - bool "SSB only"
  2954. +define KernelPackage/p54/description
  2955. + Kernel module for Prism54 chipsets (mac80211)
  2956. +endef
  2957. - endchoice
  2958. +define KernelPackage/p54-common
  2959. + $(call KernelPackage/p54/Default)
  2960. + DEPENDS+= @PCI_SUPPORT||@USB_SUPPORT||@TARGET_omap24xx +kmod-mac80211 +kmod-lib-crc-ccitt
  2961. + TITLE+= (COMMON)
  2962. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/p54/p54common.ko
  2963. +endef
  2964. - config PACKAGE_B43_DEBUG
  2965. - bool "Enable debug output and debugfs for b43"
  2966. - default n
  2967. - help
  2968. - Enable additional debug output and runtime sanity checks for b43
  2969. - and enables the debugfs interface.
  2970. +define KernelPackage/p54-pci
  2971. + $(call KernelPackage/p54/Default)
  2972. + TITLE+= (PCI)
  2973. + DEPENDS+= @PCI_SUPPORT +kmod-p54-common
  2974. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/p54/p54pci.ko
  2975. + AUTOLOAD:=$(call AutoProbe,p54pci)
  2976. +endef
  2977. - If unsure, say N.
  2978. +define KernelPackage/p54-usb
  2979. + $(call KernelPackage/p54/Default)
  2980. + TITLE+= (USB)
  2981. + DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-p54-common
  2982. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/p54/p54usb.ko
  2983. + AUTOLOAD:=$(call AutoProbe,p54usb)
  2984. +endef
  2985. - config PACKAGE_B43_PIO
  2986. - bool "Enable support for PIO transfer mode"
  2987. - default n
  2988. - help
  2989. - Enable support for using PIO instead of DMA. Unless you have DMA
  2990. - transfer problems you don't need this.
  2991. +define KernelPackage/p54-spi
  2992. + $(call KernelPackage/p54/Default)
  2993. + TITLE+= (SPI)
  2994. + DEPENDS+= @TARGET_omap24xx +kmod-p54-common
  2995. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/p54/p54spi.ko
  2996. + AUTOLOAD:=$(call AutoProbe,p54spi)
  2997. +endef
  2998. - If unsure, say N.
  2999. +define KernelPackage/rt2x00/Default
  3000. + $(call KernelPackage/mac80211/Default)
  3001. + TITLE:=Ralink Drivers for RT2x00 cards
  3002. +endef
  3003. - config PACKAGE_B43_PHY_G
  3004. - bool "Enable support for G-PHYs"
  3005. - default n if TARGET_brcm47xx_mips74k
  3006. - default y
  3007. - help
  3008. - Enable support for G-PHY. This includes support for the following devices:
  3009. - PCI: BCM4306, BCM4311, BCM4318
  3010. - SoC: BCM5352E, BCM4712
  3011. +define KernelPackage/rt2x00-lib
  3012. +$(call KernelPackage/rt2x00/Default)
  3013. + DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-mac80211 +kmod-lib-crc-itu-t
  3014. + TITLE+= (LIB)
  3015. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2x00lib.ko
  3016. + MENU:=1
  3017. +endef
  3018. - If unsure, say Y.
  3019. +define KernelPackage/rt2x00-lib/config
  3020. + if PACKAGE_kmod-rt2x00-lib
  3021. - config PACKAGE_B43_PHY_N
  3022. - bool "Enable support for N-PHYs"
  3023. - default y
  3024. + config PACKAGE_RT2X00_LIB_DEBUGFS
  3025. + bool "Enable rt2x00 debugfs support"
  3026. + depends on PACKAGE_MAC80211_DEBUGFS
  3027. help
  3028. - Enable support for N-PHY. This includes support for the following devices:
  3029. - PCI: BCM4321, BCM4322, BCM43222, BCM43224, BCM43225
  3030. - SoC: BCM4716, BCM4717, BCM4718
  3031. + Enable creation of debugfs files for the rt2x00 drivers.
  3032. + These debugfs files support both reading and writing of the
  3033. + most important register types of the rt2x00 hardware.
  3034. - Currently only 11g speed is available.
  3035. + config PACKAGE_RT2X00_DEBUG
  3036. + bool "Enable rt2x00 debug output"
  3037. + help
  3038. + Enable debugging output for all rt2x00 modules
  3039. - If unsure, say Y.
  3040. + endif
  3041. +endef
  3042. - config PACKAGE_B43_PHY_LP
  3043. - bool "Enable support for LP-PHYs"
  3044. - default n if TARGET_brcm47xx_mips74k
  3045. - default y
  3046. - help
  3047. - Enable support for LP-PHY. This includes support for the following devices:
  3048. - PCI: BCM4312
  3049. - SoC: BCM5354
  3050. +define KernelPackage/rt2x00-mmio
  3051. +$(call KernelPackage/rt2x00/Default)
  3052. + DEPENDS+= @(PCI_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib +kmod-eeprom-93cx6
  3053. + HIDDEN:=1
  3054. + TITLE+= (MMIO)
  3055. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2x00mmio.ko
  3056. +endef
  3057. - If unsure, say Y.
  3058. +define KernelPackage/rt2x00-pci
  3059. +$(call KernelPackage/rt2x00/Default)
  3060. + DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-mmio +kmod-rt2x00-lib
  3061. + HIDDEN:=1
  3062. + TITLE+= (PCI)
  3063. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2x00pci.ko
  3064. + AUTOLOAD:=$(call AutoProbe,rt2x00pci)
  3065. +endef
  3066. - config PACKAGE_B43_PHY_HT
  3067. - bool "Enable support for HT-PHYs"
  3068. - default n if TARGET_brcm47xx_legacy
  3069. - default y
  3070. - help
  3071. - Enable support for HT-PHY. This includes support for the following devices:
  3072. - PCI: BCM4331
  3073. +define KernelPackage/rt2x00-usb
  3074. +$(call KernelPackage/rt2x00/Default)
  3075. + DEPENDS+= @USB_SUPPORT +kmod-rt2x00-lib +kmod-usb-core
  3076. + HIDDEN:=1
  3077. + TITLE+= (USB)
  3078. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2x00usb.ko
  3079. + AUTOLOAD:=$(call AutoProbe,rt2x00usb)
  3080. +endef
  3081. - Currently only 11g speed is available.
  3082. +define KernelPackage/rt2800-lib
  3083. +$(call KernelPackage/rt2x00/Default)
  3084. + DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib +kmod-lib-crc-ccitt +@DRIVER_11N_SUPPORT
  3085. + HIDDEN:=1
  3086. + TITLE+= (rt2800 LIB)
  3087. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2800lib.ko
  3088. +endef
  3089. - If unsure, say Y.
  3090. +define KernelPackage/rt2400-pci
  3091. +$(call KernelPackage/rt2x00/Default)
  3092. + DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
  3093. + TITLE+= (RT2400 PCI)
  3094. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2400pci.ko
  3095. + AUTOLOAD:=$(call AutoProbe,rt2400pci)
  3096. +endef
  3097. - config PACKAGE_B43_PHY_LCN
  3098. - bool "Enable support for LCN-PHYs"
  3099. - depends on BROKEN
  3100. - default n
  3101. - help
  3102. - Currently broken.
  3103. +define KernelPackage/rt2500-pci
  3104. +$(call KernelPackage/rt2x00/Default)
  3105. + DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
  3106. + TITLE+= (RT2500 PCI)
  3107. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2500pci.ko
  3108. + AUTOLOAD:=$(call AutoProbe,rt2500pci)
  3109. +endef
  3110. - If unsure, say N.
  3111. +define KernelPackage/rt2500-usb
  3112. +$(call KernelPackage/rt2x00/Default)
  3113. + DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb
  3114. + TITLE+= (RT2500 USB)
  3115. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2500usb.ko
  3116. + AUTOLOAD:=$(call AutoProbe,rt2500usb)
  3117. +endef
  3118. - endif
  3119. +define KernelPackage/rt2800-mmio
  3120. +$(call KernelPackage/rt2x00/Default)
  3121. + TITLE += (RT28xx/RT3xxx MMIO)
  3122. + DEPENDS += +kmod-rt2800-lib +kmod-rt2x00-mmio
  3123. + HIDDEN:=1
  3124. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2800mmio.ko
  3125. endef
  3126. -define KernelPackage/b43/description
  3127. -Kernel module for Broadcom 43xx wireless support (mac80211 stack) new
  3128. +define KernelPackage/rt2800-soc
  3129. +$(call KernelPackage/rt2x00/Default)
  3130. + DEPENDS += @(TARGET_ramips_rt288x||TARGET_ramips_rt305x||TARGET_ramips_rt3883||TARGET_ramips_mt7620) +kmod-rt2800-mmio +kmod-rt2800-lib
  3131. + TITLE += (RT28xx/RT3xxx SoC)
  3132. + FILES := \
  3133. + $(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2x00soc.ko \
  3134. + $(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2800soc.ko
  3135. + AUTOLOAD:=$(call AutoProbe,rt2800soc)
  3136. endef
  3137. -define KernelPackage/b43legacy
  3138. - $(call KernelPackage/mac80211/Default)
  3139. - TITLE:=Broadcom 43xx-legacy wireless support
  3140. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/b43
  3141. - KCONFIG:= \
  3142. - CONFIG_HW_RANDOM=y
  3143. - DEPENDS+= +kmod-mac80211 +!(TARGET_brcm47xx||TARGET_brcm63xx):kmod-ssb
  3144. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/b43legacy/b43legacy.ko
  3145. - AUTOLOAD:=$(call AutoProbe,b43legacy)
  3146. - MENU:=1
  3147. +define KernelPackage/rt2800-pci
  3148. +$(call KernelPackage/rt2x00/Default)
  3149. + DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci +kmod-rt2800-lib +kmod-rt2800-mmio +rt2800-pci-firmware
  3150. + TITLE+= (RT2860 PCI)
  3151. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2800pci.ko
  3152. + AUTOLOAD:=$(call AutoProbe,rt2800pci)
  3153. endef
  3154. -define KernelPackage/b43legacy/config
  3155. - if PACKAGE_kmod-b43legacy
  3156. +define KernelPackage/rt2800-usb
  3157. +$(call KernelPackage/rt2x00/Default)
  3158. + DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb +kmod-rt2800-lib +kmod-lib-crc-ccitt +rt2800-usb-firmware
  3159. + TITLE+= (RT2870 USB)
  3160. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt2800usb.ko
  3161. + AUTOLOAD:=$(call AutoProbe,rt2800usb)
  3162. +endef
  3163. - config B43LEGACY_FW_SQUASH
  3164. - bool "Remove unnecessary firmware files"
  3165. - default y
  3166. - help
  3167. - This options allows you to remove unnecessary b43legacy firmware files
  3168. - from the final rootfs image. This can reduce the rootfs size by
  3169. - up to 50k.
  3170. - If unsure, say Y.
  3171. +define KernelPackage/rt61-pci
  3172. +$(call KernelPackage/rt2x00/Default)
  3173. + DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci +rt61-pci-firmware
  3174. + TITLE+= (RT2x61 PCI)
  3175. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt61pci.ko
  3176. + AUTOLOAD:=$(call AutoProbe,rt61pci)
  3177. +endef
  3178. - config B43LEGACY_FW_SQUASH_COREREVS
  3179. - string "Core revisions to include"
  3180. - depends on B43LEGACY_FW_SQUASH
  3181. - default "1,2,3,4"
  3182. - help
  3183. - This is a comma seperated list of core revision numbers.
  3184. +define KernelPackage/rt73-usb
  3185. + $(call KernelPackage/rt2x00/Default)
  3186. + DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb +rt73-usb-firmware
  3187. + TITLE+= (RT73 USB)
  3188. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ralink/rt2x00/rt73usb.ko
  3189. + AUTOLOAD:=$(call AutoProbe,rt73usb)
  3190. +endef
  3191. - Example (keep files for rev4 only):
  3192. - 4
  3193. - Example (keep files for rev2 and rev4):
  3194. - 2,4
  3195. +define KernelPackage/rtl818x/Default
  3196. + $(call KernelPackage/mac80211/Default)
  3197. + TITLE:=Realtek Drivers for RTL818x devices
  3198. + URL:=http://wireless.kernel.org/en/users/Drivers/rtl8187
  3199. + DEPENDS+= +kmod-eeprom-93cx6 +kmod-mac80211
  3200. +endef
  3201. - endif
  3202. +define KernelPackage/rtl8180
  3203. + $(call KernelPackage/rtl818x/Default)
  3204. + DEPENDS+= @PCI_SUPPORT
  3205. + TITLE+= (RTL8180 PCI)
  3206. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtl818x/rtl8180/rtl818x_pci.ko
  3207. + AUTOLOAD:=$(call AutoProbe,rtl818x_pci)
  3208. endef
  3209. -define KernelPackage/b43legacy/description
  3210. -Kernel module for Broadcom 43xx-legacy wireless support (mac80211 stack) new
  3211. +define KernelPackage/rtl8187
  3212. +$(call KernelPackage/rtl818x/Default)
  3213. + DEPENDS+= @USB_SUPPORT +kmod-usb-core
  3214. + TITLE+= (RTL8187 USB)
  3215. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8187.ko
  3216. + AUTOLOAD:=$(call AutoProbe,rtl8187)
  3217. endef
  3218. +define KernelPackage/rtlwifi/config
  3219. + config PACKAGE_RTLWIFI_DEBUG
  3220. + bool "Realtek wireless debugging"
  3221. + depends on PACKAGE_kmod-rtlwifi
  3222. + help
  3223. + Say Y, if you want to debug realtek wireless drivers.
  3224. +
  3225. +endef
  3226. -define KernelPackage/brcmutil
  3227. +define KernelPackage/rtlwifi
  3228. $(call KernelPackage/mac80211/Default)
  3229. - TITLE:=Broadcom IEEE802.11n common driver parts
  3230. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
  3231. - DEPENDS+=@PCI_SUPPORT||USB_SUPPORT
  3232. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/brcm80211/brcmutil/brcmutil.ko
  3233. - AUTOLOAD:=$(call AutoProbe,brcmutil)
  3234. - MENU:=1
  3235. + TITLE:=Realtek common driver part
  3236. + DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT) +kmod-mac80211 +@DRIVER_11N_SUPPORT
  3237. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtlwifi.ko
  3238. + HIDDEN:=1
  3239. endef
  3240. -define KernelPackage/brcmutil/description
  3241. - This module contains some common parts needed by Broadcom Wireless drivers brcmsmac and brcmfmac.
  3242. +define KernelPackage/rtlwifi-pci
  3243. + $(call KernelPackage/mac80211/Default)
  3244. + TITLE:=Realtek common driver part (PCI support)
  3245. + DEPENDS+= @PCI_SUPPORT +kmod-rtlwifi
  3246. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl_pci.ko
  3247. + AUTOLOAD:=$(call AutoProbe,rtl_pci)
  3248. + HIDDEN:=1
  3249. endef
  3250. -define KernelPackage/brcmutil/config
  3251. - if PACKAGE_kmod-brcmutil
  3252. +define KernelPackage/rtlwifi-usb
  3253. + $(call KernelPackage/mac80211/Default)
  3254. + TITLE:=Realtek common driver part (USB support)
  3255. + DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-rtlwifi
  3256. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl_usb.ko
  3257. + AUTOLOAD:=$(call AutoProbe,rtl_usb)
  3258. + HIDDEN:=1
  3259. +endef
  3260. - config PACKAGE_BRCM80211_DEBUG
  3261. - bool "Broadcom wireless driver debugging"
  3262. - help
  3263. - Say Y, if you want to debug brcmsmac and brcmfmac wireless driver.
  3264. +define KernelPackage/rtl8192c-common
  3265. + $(call KernelPackage/mac80211/Default)
  3266. + TITLE:=Realtek RTL8192CE/RTL8192CU common support module
  3267. + DEPENDS+= +kmod-rtlwifi
  3268. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl8192c/rtl8192c-common.ko
  3269. + HIDDEN:=1
  3270. +endef
  3271. - endif
  3272. +define KernelPackage/rtl8192ce
  3273. + $(call KernelPackage/mac80211/Default)
  3274. + TITLE:=Realtek RTL8192CE/RTL8188CE support
  3275. + DEPENDS+= +kmod-rtlwifi-pci +kmod-rtl8192c-common +rtl8192ce-firmware
  3276. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/rtl8192ce.ko
  3277. + AUTOLOAD:=$(call AutoProbe,rtl8192ce)
  3278. endef
  3279. -PKG_BRCMSMAC_FW_NAME:=broadcom-wl
  3280. -PKG_BRCMSMAC_FW_VERSION:=5.100.138
  3281. -PKG_BRCMSMAC_FW_OBJECT:=$(PKG_BRCMSMAC_FW_NAME)-$(PKG_BRCMSMAC_FW_VERSION)/linux/wl_apsta.o
  3282. -PKG_BRCMSMAC_FW_SOURCE:=$(PKG_BRCMSMAC_FW_NAME)-$(PKG_BRCMSMAC_FW_VERSION).tar.bz2
  3283. -PKG_BRCMSMAC_FW_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/
  3284. -PKG_BRCMSMAC_FW_MD5SUM:=f4e357b09eaf5d8b1f1920cf3493a555
  3285. +define KernelPackage/rtl8192se
  3286. + $(call KernelPackage/mac80211/Default)
  3287. + TITLE:=Realtek RTL8192SE/RTL8191SE support
  3288. + DEPENDS+= +kmod-rtlwifi-pci +rtl8192se-firmware
  3289. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl8192se/rtl8192se.ko
  3290. + AUTOLOAD:=$(call AutoProbe,rtl8192se)
  3291. +endef
  3292. -define Download/brcmsmac
  3293. - FILE:=$(PKG_BRCMSMAC_FW_SOURCE)
  3294. - URL:=$(PKG_BRCMSMAC_FW_SOURCE_URL)
  3295. - MD5SUM:=$(PKG_BRCMSMAC_FW_MD5SUM)
  3296. +define KernelPackage/rtl8192de
  3297. + $(call KernelPackage/mac80211/Default)
  3298. + TITLE:=Realtek RTL8192DE/RTL8188DE support
  3299. + DEPENDS+= +kmod-rtlwifi-pci +rtl8192de-firmware
  3300. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl8192de/rtl8192de.ko
  3301. + AUTOLOAD:=$(call AutoProbe,rtl8192de)
  3302. endef
  3303. -$(eval $(call Download,brcmsmac))
  3304. -define KernelPackage/brcmsmac
  3305. +define KernelPackage/rtl8192cu
  3306. $(call KernelPackage/mac80211/Default)
  3307. - TITLE:=Broadcom IEEE802.11n PCIe SoftMAC WLAN driver
  3308. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
  3309. - DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT +!TARGET_brcm47xx:kmod-bcma +kmod-lib-cordic +kmod-lib-crc8 +kmod-brcmutil
  3310. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/brcm80211/brcmsmac/brcmsmac.ko
  3311. - AUTOLOAD:=$(call AutoProbe,brcmsmac)
  3312. - MENU:=1
  3313. + TITLE:=Realtek RTL8192CU/RTL8188CU support
  3314. + DEPENDS+= +kmod-rtlwifi-usb +kmod-rtl8192c-common +rtl8192cu-firmware
  3315. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/rtl8192cu.ko
  3316. + AUTOLOAD:=$(call AutoProbe,rtl8192cu)
  3317. endef
  3318. -define KernelPackage/brcmsmac/description
  3319. - Kernel module for Broadcom IEEE802.11n PCIe Wireless cards
  3320. +
  3321. +define KernelPackage/rtl8xxxu
  3322. + $(call KernelPackage/mac80211/Default)
  3323. + TITLE:=alternative Realtek RTL8XXXU support
  3324. + DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-mac80211
  3325. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.ko
  3326. + AUTOLOAD:=$(call AutoProbe,rtl8xxxu)
  3327. endef
  3328. -define KernelPackage/brcmsmac/config
  3329. - if PACKAGE_kmod-brcmsmac
  3330. +define KernelPackage/rtl8xxxu/description
  3331. + This is an alternative driver for various Realtek RTL8XXX
  3332. + parts written to utilize the Linux mac80211 stack.
  3333. + The driver is known to work with a number of RTL8723AU,
  3334. + RL8188CU, RTL8188RU, RTL8191CU, and RTL8192CU devices
  3335. - config BRCMSMAC_USE_FW_FROM_WL
  3336. - bool "Use firmware extracted from broadcom proprietary driver"
  3337. - default y
  3338. - help
  3339. - Instead of using the official brcmsmac firmware a firmware
  3340. - version 666.2 extracted from the proprietary Broadcom driver
  3341. - is used. This is needed to get core rev 17 used in bcm4716
  3342. - to work.
  3343. + This driver is under development and has a limited feature
  3344. + set. In particular it does not yet support 40MHz channels
  3345. + and power management. However it should have a smaller
  3346. + memory footprint than the vendor drivers and benetifs
  3347. + from the in kernel mac80211 stack.
  3348. +
  3349. + It can coexist with drivers from drivers/staging/rtl8723au,
  3350. + drivers/staging/rtl8192u, and drivers/net/wireless/rtlwifi,
  3351. + but you will need to control which module you wish to load.
  3352. - If unsure, say Y.
  3353. + RTL8XXXU_UNTESTED is enabled
  3354. + This option enables detection of Realtek 8723/8188/8191/8192 WiFi
  3355. + USB devices which have not been tested directly by the driver
  3356. + author or reported to be working by third parties.
  3357. - endif
  3358. + Please report your results!
  3359. endef
  3360. -define KernelPackage/brcmfmac
  3361. +define KernelPackage/wlcore
  3362. $(call KernelPackage/mac80211/Default)
  3363. - TITLE:=Broadcom IEEE802.11n USB FullMAC WLAN driver
  3364. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
  3365. - DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +@DRIVER_11N_SUPPORT +kmod-brcmutil +BRCMFMAC_SDIO:kmod-mmc +BRCMFMAC_USB:kmod-usb-core
  3366. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/brcm80211/brcmfmac/brcmfmac.ko
  3367. - AUTOLOAD:=$(call AutoProbe,brcmfmac)
  3368. + TITLE:=TI common driver part
  3369. + DEPENDS+= @TARGET_omap +kmod-mac80211 +@DRIVER_11N_SUPPORT
  3370. + FILES:= \
  3371. + $(PKG_BUILD_DIR)/drivers/net/wireless/ti/wlcore/wlcore.ko \
  3372. + $(PKG_BUILD_DIR)/drivers/net/wireless/ti/wlcore/wlcore_sdio.ko
  3373. + AUTOLOAD:=$(call AutoProbe,wlcore wlcore_sdio)
  3374. endef
  3375. -define KernelPackage/brcmfmac/description
  3376. - Kernel module for Broadcom IEEE802.11n USB Wireless cards
  3377. +define KernelPackage/wlcore/description
  3378. + This module contains some common parts needed by TI Wireless drivers.
  3379. endef
  3380. -define KernelPackage/brcmfmac/config
  3381. - if PACKAGE_kmod-brcmfmac
  3382. +define KernelPackage/wl12xx
  3383. + $(call KernelPackage/mac80211/Default)
  3384. + TITLE:=Driver for TI WL12xx
  3385. + URL:=http://wireless.kernel.org/en/users/Drivers/wl12xx
  3386. + DEPENDS+= +kmod-wlcore +wl12xx-firmware
  3387. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ti/wl12xx/wl12xx.ko
  3388. + AUTOLOAD:=$(call AutoProbe,wl12xx)
  3389. +endef
  3390. - config BRCMFMAC_SDIO
  3391. - bool "Enable SDIO bus interface support"
  3392. - default n
  3393. - help
  3394. - Enable support for cards attached to an SDIO bus.
  3395. - Select this option only if you are sure that your
  3396. - board has a Broadcom wireless chip atacched to
  3397. - that bus.
  3398. +define KernelPackage/wl12xx/description
  3399. + Kernel modules for TI WL12xx
  3400. +endef
  3401. - config BRCMFMAC_USB
  3402. - bool "Enable USB bus interface support"
  3403. - depends on USB_SUPPORT
  3404. - default y
  3405. - help
  3406. - Supported USB connected chipsets:
  3407. - BCM43235, BCM43236, BCM43238 (all in revision 3 only)
  3408. - BCM43143, BCM43242, BCM43566, BCM43569
  3409. +define KernelPackage/wl18xx
  3410. + $(call KernelPackage/mac80211/Default)
  3411. + TITLE:=Driver for TI WL18xx
  3412. + URL:=http://wireless.kernel.org/en/users/Drivers/wl18xx
  3413. + DEPENDS+= +kmod-wlcore +wl18xx-firmware
  3414. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ti/wl18xx/wl18xx.ko
  3415. + AUTOLOAD:=$(call AutoProbe,wl18xx)
  3416. +endef
  3417. - config BRCMFMAC_PCIE
  3418. - bool "Enable PCIE bus interface support"
  3419. - depends on PCI_SUPPORT
  3420. - default y
  3421. - help
  3422. - Supported PCIe connected chipsets:
  3423. - BCM4354, BCM4356, BCM43567, BCM43570, BCM43602
  3424. +define KernelPackage/wl18xx/description
  3425. + Kernel modules for TI WL18xx
  3426. +endef
  3427. - endif
  3428. +
  3429. +ZD1211FW_NAME:=zd1211-firmware
  3430. +ZD1211FW_VERSION:=1.4
  3431. +define Download/zd1211rw
  3432. + FILE:=$(ZD1211FW_NAME)-$(ZD1211FW_VERSION).tar.bz2
  3433. + URL:=@SF/zd1211/
  3434. + MD5SUM:=19f28781d76569af8551c9d11294c870
  3435. +endef
  3436. +$(eval $(call Download,zd1211rw))
  3437. +
  3438. +define KernelPackage/zd1211rw
  3439. + $(call KernelPackage/mac80211/Default)
  3440. + TITLE:=Zydas ZD1211 support
  3441. + DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-mac80211
  3442. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/zydas/zd1211rw/zd1211rw.ko
  3443. + AUTOLOAD:=$(call AutoProbe,zd1211rw)
  3444. endef
  3445. +
  3446. +
  3447. config_package=$(if $(CONFIG_PACKAGE_kmod-$(1)),m)
  3448. config-y:= \
  3449. @@ -1538,6 +1449,20 @@ config-y:= \
  3450. MAC80211_RC_MINSTREL_HT \
  3451. MAC80211_RC_MINSTREL_VHT \
  3452. MAC80211_RC_DEFAULT_MINSTREL \
  3453. + WLAN_VENDOR_ADMTEK \
  3454. + WLAN_VENDOR_ATH \
  3455. + WLAN_VENDOR_ATMEL \
  3456. + WLAN_VENDOR_BROADCOM \
  3457. + WLAN_VENDOR_INTEL \
  3458. + WLAN_VENDOR_INTERSIL \
  3459. + WLAN_VENDOR_MARVELL \
  3460. + WLAN_VENDOR_MEDIATEK \
  3461. + WLAN_VENDOR_RALINK \
  3462. + WLAN_VENDOR_REALTEK \
  3463. + WLAN_VENDOR_RSI \
  3464. + WLAN_VENDOR_ST \
  3465. + WLAN_VENDOR_TI \
  3466. + WLAN_VENDOR_ZYDAS \
  3467. config-$(call config_package,cfg80211) += CFG80211
  3468. @@ -1554,6 +1479,16 @@ ifdef CONFIG_PACKAGE_MAC80211_DEBUGFS
  3469. ATH5K_DEBUG
  3470. endif
  3471. +ifdef CONFIG_PACKAGE_MAC80211_TRACING
  3472. + config-y += \
  3473. + ATH10K_TRACING \
  3474. + ATH6KL_TRACING \
  3475. + ATH_TRACEPOINTS \
  3476. + WIL6210_TRACING \
  3477. + ATH5K_TRACER \
  3478. + IWLWIFI_DEVICE_TRACING
  3479. +endif
  3480. +
  3481. config-$(call config_package,lib80211) += LIB80211 LIB80211_CRYPT_WEP LIB80211_CRYPT_CCMP LIB80211_CRYPT_TKIP
  3482. config-$(call config_package,ath) += ATH_CARDS ATH_COMMON
  3483. @@ -1602,6 +1537,8 @@ config-$(CONFIG_BRCMFMAC_PCIE) += BRCMFMAC_PCIE
  3484. config-$(CONFIG_PACKAGE_BRCM80211_DEBUG) += BRCMDBG
  3485. config-$(call config_package,mac80211-hwsim) += MAC80211_HWSIM
  3486. +config-$(call config_package,mt7601u) += MT7601U
  3487. +config-y += WL_MEDIATEK
  3488. config-$(call config_package,rt2x00-lib) += RT2X00 RT2X00_LIB
  3489. config-$(call config_package,rt2x00-pci) += RT2X00_LIB_PCI
  3490. @@ -1623,31 +1560,34 @@ config-$(call config_package,rt2800-pci) += RT2800PCI
  3491. config-y += RT2800PCI_RT33XX RT2800PCI_RT35XX RT2800PCI_RT53XX RT2800PCI_RT3290
  3492. config-$(call config_package,rt2800-usb) += RT2800USB
  3493. -config-y += RT2800USB_RT33XX RT2800USB_RT35XX RT2800USB_RT3573 RT2800USB_RT53XX RT2800USB_RT55XX
  3494. +config-y += RT2800USB_RT33XX RT2800USB_RT35XX RT2800USB_RT3573 RT2800USB_RT53XX RT2800USB_RT55XX RT2800USB_UNKNOWN
  3495. config-$(call config_package,iwl-legacy) += IWLEGACY
  3496. config-$(call config_package,iwl3945) += IWL3945
  3497. config-$(call config_package,iwl4965) += IWL4965
  3498. -config-$(call config_package,iwlagn) += IWLWIFI IWLDVM
  3499. +config-$(call config_package,iwlwifi) += IWLWIFI IWLDVM IWLMVM
  3500. +config-$(CONFIG_PACKAGE_IWLWIFI_DEBUG)+= IWLWIFI_DEBUG
  3501. +config-$(CONFIG_PACKAGE_IWLWIFI_DEBUGFS)+= IWLWIFI_DEBUGFS
  3502. -config-$(call config_package,net-libipw) += LIBIPW
  3503. -config-$(call config_package,net-ipw2100) += IPW2100
  3504. -config-$(call config_package,net-ipw2200) += IPW2200
  3505. +config-$(call config_package,libipw) += LIBIPW
  3506. +config-$(call config_package,ipw2100) += IPW2100
  3507. +config-$(call config_package,ipw2200) += IPW2200
  3508. config-$(call config_package,p54-common) += P54_COMMON
  3509. config-$(call config_package,p54-pci) += P54_PCI
  3510. config-$(call config_package,p54-usb) += P54_USB
  3511. config-$(call config_package,p54-spi) += P54_SPI
  3512. -config-$(call config_package,net-hermes) += HERMES
  3513. -config-$(call config_package,net-hermes-pci) += PCI_HERMES
  3514. -config-$(call config_package,net-hermes-plx) += PLX_HERMES
  3515. -config-$(call config_package,net-hermes-pcmcia) += PCMCIA_HERMES
  3516. +config-$(call config_package,hermes) += HERMES
  3517. +config-$(call config_package,hermes-pci) += PCI_HERMES
  3518. +config-$(call config_package,hermes-plx) += PLX_HERMES
  3519. +config-$(call config_package,hermes-pcmcia) += PCMCIA_HERMES
  3520. config-y += HERMES_PRISM
  3521. config-$(call config_package,adm8211) += ADM8211
  3522. config-$(call config_package,libertas-sdio) += LIBERTAS LIBERTAS_SDIO
  3523. config-$(call config_package,libertas-usb) += LIBERTAS LIBERTAS_USB
  3524. +config-$(call config_package,libertas-spi) += LIBERTAS LIBERTAS_SPI
  3525. config-$(call config_package,mwl8k) += MWL8K
  3526. config-$(call config_package,mwifiex-pcie) += MWIFIEX MWIFIEX_PCIE
  3527. config-$(call config_package,rtl8180) += RTL8180
  3528. @@ -1668,12 +1608,15 @@ config-$(call config_package,rtl8192de) += RTL8192DE
  3529. config-$(call config_package,rtl8192cu) += RTL8192CU
  3530. config-$(CONFIG_PACKAGE_RTLWIFI_DEBUG) += RTLWIFI_DEBUG
  3531. +config-$(call config_package,rtl8xxxu) += RTL8XXXU
  3532. +config-y += RTL8XXXU_UNTESTED
  3533. +
  3534. config-$(CONFIG_LEDS_TRIGGERS) += MAC80211_LEDS B43_LEDS B43LEGACY_LEDS
  3535. MAKE_OPTS:= -C "$(PKG_BUILD_DIR)" \
  3536. CROSS_COMPILE="$(KERNEL_CROSS)" \
  3537. ARCH="$(LINUX_KARCH)" \
  3538. - EXTRA_CFLAGS="-I$(PKG_BUILD_DIR)/include" \
  3539. + EXTRA_CFLAGS="-I$(PKG_BUILD_DIR)/include $(IREMAP_CFLAGS)" \
  3540. KLIB_BUILD="$(LINUX_DIR)" \
  3541. MODPROBE=true \
  3542. KLIB=$(TARGET_MODULES_DIR) \
  3543. @@ -1702,8 +1645,6 @@ define Build/Prepare
  3544. $(TAR) -C $(PKG_BUILD_DIR) -xzf $(DL_DIR)/$(IPW2100_NAME)-$(IPW2100_VERSION).tgz
  3545. $(TAR) -C $(PKG_BUILD_DIR) -xzf $(DL_DIR)/$(IPW2200_NAME)-$(IPW2200_VERSION).tgz
  3546. $(TAR) -C $(PKG_BUILD_DIR) -xjf $(DL_DIR)/$(ZD1211FW_NAME)-$(ZD1211FW_VERSION).tar.bz2
  3547. - $(TAR) -C $(PKG_BUILD_DIR) -xjf $(DL_DIR)/$(PKG_LINUX_FIRMWARE_SOURCE)
  3548. - $(TAR) -C $(PKG_BUILD_DIR) -xjf $(DL_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SOURCE)
  3549. rm -rf \
  3550. $(PKG_BUILD_DIR)/include/linux/ssb \
  3551. $(PKG_BUILD_DIR)/include/linux/bcma \
  3552. @@ -1715,7 +1656,8 @@ define Build/Prepare
  3553. $(PKG_BUILD_DIR)/include/linux/eeprom_93cx6.h \
  3554. $(PKG_BUILD_DIR)/include/linux/wl12xx.h \
  3555. $(PKG_BUILD_DIR)/include/linux/spi/libertas_spi.h \
  3556. - $(PKG_BUILD_DIR)/include/net/ieee80211.h
  3557. + $(PKG_BUILD_DIR)/include/net/ieee80211.h \
  3558. + $(PKG_BUILD_DIR)/backport-include/linux/bcm47xx_nvram.h
  3559. echo 'compat-wireless-$(PKG_VERSION)-$(PKG_RELEASE)-$(REVISION)' > $(PKG_BUILD_DIR)/compat_version
  3560. $(CP) ./files/regdb.txt $(PKG_BUILD_DIR)/net/wireless/db.txt
  3561. @@ -1753,220 +1695,6 @@ define Build/InstallDev
  3562. rm -f $(1)/usr/include/mac80211-backport/linux/module.h
  3563. endef
  3564. -define KernelPackage/libertas-usb/install
  3565. - $(INSTALL_DIR) $(1)/lib/firmware/libertas
  3566. - $(INSTALL_DATA) \
  3567. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/usb8388_v9.bin \
  3568. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/usb8682.bin \
  3569. - $(1)/lib/firmware/libertas/
  3570. -endef
  3571. -
  3572. -define KernelPackage/libertas-sdio/install
  3573. - $(INSTALL_DIR) $(1)/lib/firmware/libertas
  3574. - $(INSTALL_DATA) \
  3575. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8385_helper.bin \
  3576. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8385.bin \
  3577. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8686_v9_helper.bin \
  3578. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8686_v9.bin \
  3579. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8688_helper.bin \
  3580. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8688.bin \
  3581. - $(1)/lib/firmware/libertas
  3582. -endef
  3583. -
  3584. -define KernelPackage/cfg80211/install
  3585. - $(INSTALL_DIR) $(1)/lib/wifi $(1)/lib/netifd/wireless
  3586. - $(INSTALL_DATA) ./files/lib/wifi/mac80211.sh $(1)/lib/wifi
  3587. - $(INSTALL_BIN) ./files/lib/netifd/wireless/mac80211.sh $(1)/lib/netifd/wireless
  3588. -endef
  3589. -
  3590. -define KernelPackage/p54-pci/install
  3591. - $(INSTALL_DIR) $(1)/lib/firmware
  3592. - $(INSTALL_DATA) $(DL_DIR)/$(P54PCIFW) $(1)/lib/firmware/isl3886pci
  3593. -endef
  3594. -
  3595. -define KernelPackage/p54-usb/install
  3596. - $(INSTALL_DIR) $(1)/lib/firmware
  3597. - $(INSTALL_DATA) $(DL_DIR)/$(P54USBFW) $(1)/lib/firmware/isl3887usb
  3598. -endef
  3599. -
  3600. -define KernelPackage/p54-spi/install
  3601. - $(INSTALL_DIR) $(1)/lib/firmware
  3602. - $(INSTALL_DATA) $(DL_DIR)/$(P54SPIFW) $(1)/lib/firmware/3826.arm
  3603. -endef
  3604. -
  3605. -define KernelPackage/rt61-pci/install
  3606. - $(INSTALL_DIR) $(1)/lib/firmware
  3607. - $(INSTALL_DATA) \
  3608. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2561.bin \
  3609. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2561s.bin \
  3610. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2661.bin \
  3611. - $(1)/lib/firmware/
  3612. -endef
  3613. -
  3614. -define KernelPackage/rt73-usb/install
  3615. - $(INSTALL_DIR) $(1)/lib/firmware
  3616. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt73.bin $(1)/lib/firmware/
  3617. -endef
  3618. -
  3619. -define KernelPackage/rt2800-pci/install
  3620. - $(INSTALL_DIR) $(1)/lib/firmware
  3621. - $(INSTALL_DATA) \
  3622. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2860.bin \
  3623. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt3290.bin \
  3624. - $(1)/lib/firmware
  3625. -endef
  3626. -
  3627. -define KernelPackage/rt2800-usb/install
  3628. - $(INSTALL_DIR) $(1)/lib/firmware
  3629. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2870.bin $(1)/lib/firmware/
  3630. -endef
  3631. -
  3632. -define KernelPackage/wl12xx/install
  3633. - $(INSTALL_DIR) $(1)/lib/firmware/ti-connectivity
  3634. - $(INSTALL_DATA) \
  3635. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl127x-fw-5-mr.bin \
  3636. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl127x-fw-5-plt.bin \
  3637. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl127x-fw-5-sr.bin \
  3638. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl1271-nvs.bin \
  3639. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-fw-5-mr.bin \
  3640. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-fw-5-plt.bin \
  3641. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-fw-5-sr.bin \
  3642. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-nvs.bin \
  3643. - $(1)/lib/firmware/ti-connectivity
  3644. -endef
  3645. -
  3646. -define KernelPackage/wl18xx/install
  3647. - $(INSTALL_DIR) $(1)/lib/firmware/ti-connectivity
  3648. - $(INSTALL_DATA) \
  3649. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl18xx-conf.bin \
  3650. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl18xx-fw-3.bin \
  3651. - $(1)/lib/firmware/ti-connectivity
  3652. -endef
  3653. -
  3654. -define KernelPackage/zd1211rw/install
  3655. - $(INSTALL_DIR) $(1)/lib/firmware/zd1211
  3656. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(ZD1211FW_NAME)/zd1211* $(1)/lib/firmware/zd1211
  3657. -endef
  3658. -
  3659. -define KernelPackage/carl9170/install
  3660. - $(INSTALL_DIR) $(1)/lib/firmware
  3661. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/carl9170-1.fw $(1)/lib/firmware
  3662. -endef
  3663. -
  3664. -define KernelPackage/ath9k-htc/install
  3665. - $(INSTALL_DIR) $(1)/lib/firmware
  3666. - $(INSTALL_DATA) \
  3667. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/htc_9271.fw \
  3668. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/htc_7010.fw \
  3669. - $(1)/lib/firmware/
  3670. -endef
  3671. -
  3672. -define KernelPackage/ath10k/install
  3673. - $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
  3674. - $(INSTALL_DATA) \
  3675. - $(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/ath10k/QCA988X/hw2.0/board.bin \
  3676. - $(1)/lib/firmware/ath10k/QCA988X/hw2.0/
  3677. -ifeq ($(CONFIG_ATH10K_STA_FW),y)
  3678. - $(INSTALL_DATA) \
  3679. - $(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/main/firmware-2.bin_999.999.0.636 \
  3680. - $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-2.bin
  3681. -else ifeq ($(CONFIG_ATH10K_API2_FW),y)
  3682. - $(INSTALL_DATA) \
  3683. - $(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/10.1/firmware-2.bin_10.1.467.2-1 \
  3684. - $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-2.bin
  3685. -else
  3686. - $(INSTALL_DATA) \
  3687. - $(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/10.2.4/firmware-4.bin_10.2.4.45 \
  3688. - $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-4.bin
  3689. -endif
  3690. -endef
  3691. -
  3692. -define KernelPackage/mwl8k/install
  3693. - $(INSTALL_DIR) $(1)/lib/firmware/mwl8k
  3694. - $(INSTALL_DATA) \
  3695. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/fmimage_8366_ap-3.fw \
  3696. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/fmimage_8366.fw \
  3697. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/helper_8366.fw \
  3698. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/fmimage_8687.fw \
  3699. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/helper_8687.fw \
  3700. - $(1)/lib/firmware/mwl8k/
  3701. -endef
  3702. -
  3703. -define KernelPackage/mwifiex-pcie/install
  3704. - $(INSTALL_DIR) $(1)/lib/firmware/mrvl
  3705. - $(INSTALL_DATA) \
  3706. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mrvl/pcie8897_uapsta.bin \
  3707. - $(1)/lib/firmware/mrvl/
  3708. -endef
  3709. -
  3710. -define KernelPackage/net-ipw2100/install
  3711. - $(INSTALL_DIR) $(1)/lib/firmware
  3712. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/ipw2100-$(IPW2100_VERSION)*.fw $(1)/lib/firmware
  3713. -endef
  3714. -
  3715. -define KernelPackage/net-ipw2200/install
  3716. - $(INSTALL_DIR) $(1)/lib/firmware
  3717. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(IPW2200_NAME)-$(IPW2200_VERSION)/ipw2200*.fw $(1)/lib/firmware
  3718. -endef
  3719. -
  3720. -define KernelPackage/iwlagn/install
  3721. - $(INSTALL_DIR) $(1)/lib/firmware
  3722. -ifneq ($(CONFIG_IWL5000_FW),)
  3723. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-5000-5.ucode $(1)/lib/firmware
  3724. -endif
  3725. -ifneq ($(CONFIG_IWL5150_FW),)
  3726. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-5150-2.ucode $(1)/lib/firmware
  3727. -endif
  3728. -ifneq ($(CONFIG_IWL1000_FW),)
  3729. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-1000-5.ucode $(1)/lib/firmware
  3730. -endif
  3731. -ifneq ($(CONFIG_IWL6000_FW),)
  3732. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6000-4.ucode $(1)/lib/firmware
  3733. -endif
  3734. -ifneq ($(CONFIG_IWL6050_FW),)
  3735. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6050-5.ucode $(1)/lib/firmware
  3736. -endif
  3737. -ifneq ($(CONFIG_IWL6005_FW),)
  3738. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6000g2a-6.ucode $(1)/lib/firmware
  3739. -endif
  3740. -ifneq ($(CONFIG_IWL6030_FW),)
  3741. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6000g2b-6.ucode $(1)/lib/firmware
  3742. -endif
  3743. -ifneq ($(CONFIG_IWL7260_FW),)
  3744. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-7260-9.ucode $(1)/lib/firmware
  3745. -endif
  3746. -ifneq ($(CONFIG_IWL7265_FW),)
  3747. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-7265-9.ucode $(1)/lib/firmware
  3748. -endif
  3749. -ifneq ($(CONFIG_IWL100_FW),)
  3750. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-100-5.ucode $(1)/lib/firmware
  3751. -endif
  3752. -ifneq ($(CONFIG_IWL2000_FW),)
  3753. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-2000-6.ucode $(1)/lib/firmware
  3754. -endif
  3755. -ifneq ($(CONFIG_IWL2030_FW),)
  3756. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-2030-6.ucode $(1)/lib/firmware
  3757. -endif
  3758. -ifneq ($(CONFIG_IWL105_FW),)
  3759. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-105-6.ucode $(1)/lib/firmware
  3760. -endif
  3761. -ifneq ($(CONFIG_IWL135_FW),)
  3762. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-135-6.ucode $(1)/lib/firmware
  3763. -endif
  3764. -ifneq ($(CONFIG_IWL3160_FW),)
  3765. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-3160-9.ucode $(1)/lib/firmware
  3766. -endif
  3767. -endef
  3768. -
  3769. -define KernelPackage/iwl3945/install
  3770. - $(INSTALL_DIR) $(1)/lib/firmware
  3771. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-3945-2.ucode $(1)/lib/firmware
  3772. -endef
  3773. -
  3774. -define KernelPackage/iwl4965/install
  3775. - $(INSTALL_DIR) $(1)/lib/firmware
  3776. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-4965-2.ucode $(1)/lib/firmware
  3777. -endef
  3778. define KernelPackage/b43/install
  3779. rm -rf $(1)/lib/firmware/
  3780. @@ -1990,51 +1718,85 @@ ifneq ($(CONFIG_B43_FW_SQUASH),)
  3781. endif
  3782. endef
  3783. -define KernelPackage/b43legacy/install
  3784. - $(INSTALL_DIR) $(1)/lib/firmware/
  3785. - b43-fwcutter --unsupported -w $(1)/lib/firmware/ $(DL_DIR)/$(PKG_B43_FWV3_SOURCE)
  3786. -ifneq ($(CONFIG_B43LEGACY_FW_SQUASH),)
  3787. - b43-fwsquash.py "G" "$(CONFIG_B43LEGACY_FW_SQUASH_COREREVS)" "$(1)/lib/firmware/b43legacy"
  3788. -endif
  3789. -endef
  3790. -
  3791. define KernelPackage/brcmsmac/install
  3792. $(INSTALL_DIR) $(1)/lib/firmware/brcm
  3793. ifeq ($(CONFIG_BRCMSMAC_USE_FW_FROM_WL),y)
  3794. tar xjf "$(DL_DIR)/$(PKG_BRCMSMAC_FW_SOURCE)" -C "$(PKG_BUILD_DIR)"
  3795. b43-fwcutter --brcmsmac -w $(1)/lib/firmware/ $(PKG_BUILD_DIR)/$(PKG_BRCMSMAC_FW_OBJECT)
  3796. -else
  3797. - $(INSTALL_DATA) \
  3798. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/brcm/bcm43xx-0.fw \
  3799. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/brcm/bcm43xx_hdr-0.fw \
  3800. - $(1)/lib/firmware/brcm/
  3801. endif
  3802. endef
  3803. -define KernelPackage/brcmfmac/install
  3804. - $(INSTALL_DIR) $(1)/lib/firmware/brcm
  3805. -ifneq ($(CONFIG_BRCMFMAC_USB),)
  3806. - $(INSTALL_DATA) \
  3807. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/brcm/brcmfmac43236b.bin \
  3808. - $(1)/lib/firmware/brcm/
  3809. - $(INSTALL_DATA) \
  3810. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/brcm/brcmfmac43143.bin \
  3811. - $(1)/lib/firmware/brcm/
  3812. -endif
  3813. -ifneq ($(CONFIG_BRCMFMAC_PCIE),)
  3814. - $(INSTALL_DATA) \
  3815. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/brcm/brcmfmac43602-pcie.ap.bin \
  3816. - $(1)/lib/firmware/brcm/brcmfmac43602-pcie.bin
  3817. -endif
  3818. +define KernelPackage/cfg80211/install
  3819. + $(INSTALL_DIR) $(1)/lib/wifi $(1)/lib/netifd/wireless
  3820. + $(INSTALL_DATA) ./files/lib/wifi/mac80211.sh $(1)/lib/wifi
  3821. + $(INSTALL_BIN) ./files/lib/netifd/wireless/mac80211.sh $(1)/lib/netifd/wireless
  3822. +endef
  3823. +
  3824. +define KernelPackage/ipw2100/install
  3825. + $(INSTALL_DIR) $(1)/lib/firmware
  3826. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/ipw2100-$(IPW2100_VERSION)*.fw $(1)/lib/firmware
  3827. +endef
  3828. +
  3829. +define KernelPackage/ipw2200/install
  3830. + $(INSTALL_DIR) $(1)/lib/firmware
  3831. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(IPW2200_NAME)-$(IPW2200_VERSION)/ipw2200*.fw $(1)/lib/firmware
  3832. +endef
  3833. +
  3834. +define KernelPackage/p54-pci/install
  3835. + $(INSTALL_DIR) $(1)/lib/firmware
  3836. + $(INSTALL_DATA) $(DL_DIR)/$(P54PCIFW) $(1)/lib/firmware/isl3886pci
  3837. +endef
  3838. +
  3839. +define KernelPackage/p54-usb/install
  3840. + $(INSTALL_DIR) $(1)/lib/firmware
  3841. + $(INSTALL_DATA) $(DL_DIR)/$(P54USBFW) $(1)/lib/firmware/isl3887usb
  3842. +endef
  3843. +
  3844. +define KernelPackage/p54-spi/install
  3845. + $(INSTALL_DIR) $(1)/lib/firmware
  3846. + $(INSTALL_DATA) $(DL_DIR)/$(P54SPIFW) $(1)/lib/firmware/3826.arm
  3847. endef
  3848. +define KernelPackage/zd1211rw/install
  3849. + $(INSTALL_DIR) $(1)/lib/firmware/zd1211
  3850. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(ZD1211FW_NAME)/zd1211* $(1)/lib/firmware/zd1211
  3851. +endef
  3852. +
  3853. +
  3854. $(eval $(call KernelPackage,adm8211))
  3855. +$(eval $(call KernelPackage,ath))
  3856. +$(eval $(call KernelPackage,ath10k))
  3857. $(eval $(call KernelPackage,ath5k))
  3858. +$(eval $(call KernelPackage,ath9k))
  3859. +$(eval $(call KernelPackage,ath9k-common))
  3860. +$(eval $(call KernelPackage,ath9k-htc))
  3861. +$(eval $(call KernelPackage,b43))
  3862. +$(eval $(call KernelPackage,b43legacy))
  3863. +$(eval $(call KernelPackage,brcmsmac))
  3864. +$(eval $(call KernelPackage,brcmfmac))
  3865. +$(eval $(call KernelPackage,brcmutil))
  3866. +$(eval $(call KernelPackage,carl9170))
  3867. +$(eval $(call KernelPackage,cfg80211))
  3868. +$(eval $(call KernelPackage,hermes))
  3869. +$(eval $(call KernelPackage,hermes-pci))
  3870. +$(eval $(call KernelPackage,hermes-plx))
  3871. +$(eval $(call KernelPackage,hermes-pcmcia))
  3872. +$(eval $(call KernelPackage,iwlwifi))
  3873. +$(eval $(call KernelPackage,iwl-legacy))
  3874. +$(eval $(call KernelPackage,iwl4965))
  3875. +$(eval $(call KernelPackage,iwl3945))
  3876. $(eval $(call KernelPackage,lib80211))
  3877. $(eval $(call KernelPackage,libertas-usb))
  3878. $(eval $(call KernelPackage,libertas-sdio))
  3879. -$(eval $(call KernelPackage,cfg80211))
  3880. +$(eval $(call KernelPackage,libertas-spi))
  3881. +$(eval $(call KernelPackage,libipw))
  3882. +$(eval $(call KernelPackage,ipw2100))
  3883. +$(eval $(call KernelPackage,ipw2200))
  3884. $(eval $(call KernelPackage,mac80211))
  3885. +$(eval $(call KernelPackage,mac80211-hwsim))
  3886. +$(eval $(call KernelPackage,mt7601u))
  3887. +$(eval $(call KernelPackage,mwl8k))
  3888. +$(eval $(call KernelPackage,mwifiex-pcie))
  3889. $(eval $(call KernelPackage,p54-common))
  3890. $(eval $(call KernelPackage,p54-pci))
  3891. $(eval $(call KernelPackage,p54-usb))
  3892. @@ -2047,12 +1809,12 @@ $(eval $(call KernelPackage,rt2800-lib))
  3893. $(eval $(call KernelPackage,rt2400-pci))
  3894. $(eval $(call KernelPackage,rt2500-pci))
  3895. $(eval $(call KernelPackage,rt2500-usb))
  3896. -$(eval $(call KernelPackage,rt61-pci))
  3897. -$(eval $(call KernelPackage,rt73-usb))
  3898. $(eval $(call KernelPackage,rt2800-mmio))
  3899. $(eval $(call KernelPackage,rt2800-soc))
  3900. $(eval $(call KernelPackage,rt2800-pci))
  3901. $(eval $(call KernelPackage,rt2800-usb))
  3902. +$(eval $(call KernelPackage,rt61-pci))
  3903. +$(eval $(call KernelPackage,rt73-usb))
  3904. $(eval $(call KernelPackage,rtl8180))
  3905. $(eval $(call KernelPackage,rtl8187))
  3906. $(eval $(call KernelPackage,rtlwifi))
  3907. @@ -2063,32 +1825,8 @@ $(eval $(call KernelPackage,rtl8192ce))
  3908. $(eval $(call KernelPackage,rtl8192se))
  3909. $(eval $(call KernelPackage,rtl8192de))
  3910. $(eval $(call KernelPackage,rtl8192cu))
  3911. -$(eval $(call KernelPackage,zd1211rw))
  3912. -$(eval $(call KernelPackage,mac80211-hwsim))
  3913. -$(eval $(call KernelPackage,ath9k-common))
  3914. -$(eval $(call KernelPackage,ath9k))
  3915. -$(eval $(call KernelPackage,ath9k-htc))
  3916. -$(eval $(call KernelPackage,ath10k))
  3917. -$(eval $(call KernelPackage,ath))
  3918. -$(eval $(call KernelPackage,carl9170))
  3919. -$(eval $(call KernelPackage,b43))
  3920. -$(eval $(call KernelPackage,b43legacy))
  3921. -$(eval $(call KernelPackage,brcmutil))
  3922. -$(eval $(call KernelPackage,brcmsmac))
  3923. -$(eval $(call KernelPackage,brcmfmac))
  3924. -$(eval $(call KernelPackage,net-libipw))
  3925. -$(eval $(call KernelPackage,net-ipw2100))
  3926. -$(eval $(call KernelPackage,net-ipw2200))
  3927. -$(eval $(call KernelPackage,iwlagn))
  3928. -$(eval $(call KernelPackage,iwl-legacy))
  3929. -$(eval $(call KernelPackage,iwl4965))
  3930. -$(eval $(call KernelPackage,iwl3945))
  3931. -$(eval $(call KernelPackage,mwl8k))
  3932. -$(eval $(call KernelPackage,mwifiex-pcie))
  3933. -$(eval $(call KernelPackage,net-hermes))
  3934. -$(eval $(call KernelPackage,net-hermes-pci))
  3935. -$(eval $(call KernelPackage,net-hermes-plx))
  3936. -$(eval $(call KernelPackage,net-hermes-pcmcia))
  3937. +$(eval $(call KernelPackage,rtl8xxxu))
  3938. $(eval $(call KernelPackage,wlcore))
  3939. $(eval $(call KernelPackage,wl12xx))
  3940. $(eval $(call KernelPackage,wl18xx))
  3941. +$(eval $(call KernelPackage,zd1211rw))
  3942. diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  3943. index 2852f3e..02c195e 100644
  3944. --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  3945. +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  3946. @@ -23,6 +23,7 @@ drv_mac80211_init_device_config() {
  3947. config_add_int rxantenna txantenna antenna_gain txpower distance
  3948. config_add_boolean noscan ht_coex
  3949. config_add_array ht_capab
  3950. + config_add_array channels
  3951. config_add_boolean \
  3952. rxldpc \
  3953. short_gi_80 \
  3954. @@ -89,6 +90,7 @@ mac80211_hostapd_setup_base() {
  3955. json_select config
  3956. [ "$auto_channel" -gt 0 ] && channel=acs_survey
  3957. + [ "$auto_channel" -gt 0 ] && json_get_values channel_list channels
  3958. json_get_vars noscan ht_coex
  3959. json_get_values ht_capab_list ht_capab
  3960. @@ -301,6 +303,7 @@ mac80211_hostapd_setup_base() {
  3961. hostapd_prepare_device_config "$hostapd_conf_file" nl80211
  3962. cat >> "$hostapd_conf_file" <<EOF
  3963. ${channel:+channel=$channel}
  3964. +${channel_list:+chanlist=$channel_list}
  3965. ${noscan:+noscan=$noscan}
  3966. $base_cfg
  3967. @@ -391,11 +394,10 @@ mac80211_generate_mac() {
  3968. find_phy() {
  3969. [ -n "$phy" -a -d /sys/class/ieee80211/$phy ] && return 0
  3970. [ -n "$path" ] && {
  3971. - for phy in /sys/devices/$path/ieee80211/phy*; do
  3972. - [ -e "$phy" ] && {
  3973. - phy="${phy##*/}"
  3974. - return 0
  3975. - }
  3976. + for phy in $(ls /sys/class/ieee80211 2>/dev/null); do
  3977. + case "$(readlink -f /sys/class/ieee80211/$phy/device)" in
  3978. + *$path) return 0;;
  3979. + esac
  3980. done
  3981. }
  3982. [ -n "$macaddr" ] && {
  3983. @@ -455,12 +457,7 @@ mac80211_prepare_vif() {
  3984. }
  3985. ;;
  3986. mesh)
  3987. - json_get_vars key mesh_id
  3988. - if [ -n "$key" ]; then
  3989. - iw phy "$phy" interface add "$ifname" type mp
  3990. - else
  3991. - iw phy "$phy" interface add "$ifname" type mp mesh_id "$mesh_id"
  3992. - fi
  3993. + iw phy "$phy" interface add "$ifname" type mp
  3994. ;;
  3995. monitor)
  3996. iw phy "$phy" interface add "$ifname" type monitor
  3997. @@ -486,7 +483,7 @@ mac80211_prepare_vif() {
  3998. # All interfaces must have unique mac addresses
  3999. # which can either be explicitly set in the device
  4000. # section, or automatically generated
  4001. - ifconfig "$ifname" hw ether "$macaddr"
  4002. + ip link set dev "$ifname" address "$macaddr"
  4003. fi
  4004. json_select ..
  4005. @@ -501,7 +498,7 @@ mac80211_setup_supplicant() {
  4006. mac80211_setup_adhoc_htmode() {
  4007. case "$htmode" in
  4008. VHT20|HT20) ibss_htmode=HT20;;
  4009. - HT40*|VHT40|VHT80|VHT160)
  4010. + HT40*|VHT40|VHT160)
  4011. case "$hwmode" in
  4012. a)
  4013. case "$(( ($channel / 4) % 2 ))" in
  4014. @@ -525,6 +522,9 @@ mac80211_setup_adhoc_htmode() {
  4015. esac
  4016. [ "$auto_channel" -gt 0 ] && ibss_htmode="HT40+"
  4017. ;;
  4018. + VHT80)
  4019. + ibss_htmode="80MHZ"
  4020. + ;;
  4021. NONE|NOHT)
  4022. ibss_htmode="NOHT"
  4023. ;;
  4024. @@ -585,7 +585,7 @@ mac80211_setup_vif() {
  4025. json_get_vars mode
  4026. json_get_var vif_txpower txpower
  4027. - ifconfig "$ifname" up || {
  4028. + ip link set dev "$ifname" up || {
  4029. wireless_setup_vif_failed IFUP_ERROR
  4030. json_select ..
  4031. return
  4032. @@ -606,6 +606,13 @@ mac80211_setup_vif() {
  4033. wireless_vif_parse_encryption
  4034. mac80211_setup_supplicant || failed=1
  4035. fi
  4036. + else
  4037. + json_get_vars mesh_id mcast_rate
  4038. +
  4039. + mcval=
  4040. + [ -n "$mcast_rate" ] && wpa_supplicant_add_rate mcval "$mcast_rate"
  4041. +
  4042. + iw dev "$ifname" mesh join "$mesh_id" ${mcval:+mcast-rate $mcval}
  4043. fi
  4044. for var in $MP_CONFIG_INT $MP_CONFIG_BOOL $MP_CONFIG_STRING; do
  4045. @@ -641,7 +648,7 @@ mac80211_interface_cleanup() {
  4046. local phy="$1"
  4047. for wdev in $(list_phy_interfaces "$phy"); do
  4048. - ifconfig "$wdev" down 2>/dev/null
  4049. + ip link set dev "$wdev" down 2>/dev/null
  4050. iw dev "$wdev" del
  4051. done
  4052. }
  4053. diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
  4054. index ea229d6..06f3b8b 100644
  4055. --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh
  4056. +++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
  4057. @@ -9,11 +9,10 @@ lookup_phy() {
  4058. local devpath
  4059. config_get devpath "$device" path
  4060. [ -n "$devpath" ] && {
  4061. - for _phy in /sys/devices/$devpath/ieee80211/phy*; do
  4062. - [ -e "$_phy" ] && {
  4063. - phy="${_phy##*/}"
  4064. - return
  4065. - }
  4066. + for phy in $(ls /sys/class/ieee80211 2>/dev/null); do
  4067. + case "$(readlink -f /sys/class/ieee80211/$phy/device)" in
  4068. + *$devpath) return;;
  4069. + esac
  4070. done
  4071. }
  4072. @@ -102,6 +101,9 @@ detect_mac80211() {
  4073. fi
  4074. if [ -n "$path" ]; then
  4075. path="${path##/sys/devices/}"
  4076. + case "$path" in
  4077. + platform*/pci*) path="${path##platform/}";;
  4078. + esac
  4079. dev_id=" option path '$path'"
  4080. else
  4081. dev_id=" option macaddr $(cat /sys/class/ieee80211/${dev}/macaddress)"
  4082. diff --git a/package/kernel/mac80211/patches/001-fix_build.patch b/package/kernel/mac80211/patches/001-fix_build.patch
  4083. index 818983e..402649d 100644
  4084. --- a/package/kernel/mac80211/patches/001-fix_build.patch
  4085. +++ b/package/kernel/mac80211/patches/001-fix_build.patch
  4086. @@ -27,7 +27,7 @@
  4087. @set -e ; test -f .local-symbols || ( \
  4088. echo "/--------------" ;\
  4089. echo "| You shouldn't run make in the backports tree, but only in" ;\
  4090. -@@ -60,56 +62,60 @@ mrproper:
  4091. +@@ -60,57 +62,61 @@ mrproper:
  4092. echo "| (that isn't currently running.)" ;\
  4093. echo "\\--" ;\
  4094. false)
  4095. @@ -56,11 +56,12 @@
  4096. - done \
  4097. - ) > Kconfig.kernel ;\
  4098. - kver=$$($(MAKE) --no-print-directory -C $(KLIB_BUILD) kernelversion | \
  4099. -- sed 's/^\(\(3\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\
  4100. +- sed 's/^\(\([3-4]\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\
  4101. - test "$$kver" != "" || echo "Kernel version parse failed!" ;\
  4102. - test "$$kver" != "" ;\
  4103. - kvers="$$(seq 14 39 | sed 's/^/2.6./')" ;\
  4104. -- kvers="$$kvers $$(seq 0 99 | sed 's/^/3./')" ;\
  4105. +- kvers="$$kvers $$(seq 0 19 | sed 's/^/3./')" ;\
  4106. +- kvers="$$kvers $$(seq 0 99 | sed 's/^/4./')" ;\
  4107. - print=0 ;\
  4108. - for v in $$kvers ; do \
  4109. - if [ "$$print" = "1" ] ; then \
  4110. @@ -111,11 +112,12 @@
  4111. +
  4112. +Kconfig.versions: Kconfig.kernel
  4113. + @kver=$$($(MAKE) --no-print-directory -C $(KLIB_BUILD) kernelversion | \
  4114. -+ sed 's/^\(\(3\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\
  4115. ++ sed 's/^\(\([3-4]\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\
  4116. + test "$$kver" != "" || echo "Kernel version parse failed!" ;\
  4117. + test "$$kver" != "" ;\
  4118. + kvers="$$(seq 14 39 | sed 's/^/2.6./')" ;\
  4119. -+ kvers="$$kvers $$(seq 0 99 | sed 's/^/3./')" ;\
  4120. ++ kvers="$$kvers $$(seq 0 19 | sed 's/^/3./')" ;\
  4121. ++ kvers="$$kvers $$(seq 0 99 | sed 's/^/4./')" ;\
  4122. + print=0 ;\
  4123. + for v in $$kvers ; do \
  4124. + if [ "$$print" = "1" ] ; then \
  4125. diff --git a/package/kernel/mac80211/patches/002-change_allconfig.patch b/package/kernel/mac80211/patches/002-change_allconfig.patch
  4126. index 91ad20f..bd5bebf 100644
  4127. --- a/package/kernel/mac80211/patches/002-change_allconfig.patch
  4128. +++ b/package/kernel/mac80211/patches/002-change_allconfig.patch
  4129. @@ -1,6 +1,6 @@
  4130. --- a/kconf/conf.c
  4131. +++ b/kconf/conf.c
  4132. -@@ -578,40 +578,12 @@ int main(int ac, char **av)
  4133. +@@ -593,40 +593,12 @@ int main(int ac, char **av)
  4134. case oldconfig:
  4135. case listnewconfig:
  4136. case olddefconfig:
  4137. @@ -42,3 +42,23 @@
  4138. break;
  4139. default:
  4140. break;
  4141. +--- a/kconf/confdata.c
  4142. ++++ b/kconf/confdata.c
  4143. +@@ -1169,6 +1169,8 @@ bool conf_set_all_new_symbols(enum conf_
  4144. + }
  4145. + bool has_changed = false;
  4146. +
  4147. ++ sym_clear_all_valid();
  4148. ++
  4149. + for_all_symbols(i, sym) {
  4150. + if (sym_has_value(sym) || (sym->flags & SYMBOL_VALID))
  4151. + continue;
  4152. +@@ -1212,8 +1214,6 @@ bool conf_set_all_new_symbols(enum conf_
  4153. +
  4154. + }
  4155. +
  4156. +- sym_clear_all_valid();
  4157. +-
  4158. + /*
  4159. + * We have different type of choice blocks.
  4160. + * If curr.tri equals to mod then we can select several
  4161. 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
  4162. new file mode 100644
  4163. index 0000000..9adfd8f
  4164. --- /dev/null
  4165. +++ b/package/kernel/mac80211/patches/004-backports-add-skb_free_frag.patch
  4166. @@ -0,0 +1,21 @@
  4167. +From: Felix Fietkau <nbd@openwrt.org>
  4168. +Date: Thu, 28 Jan 2016 15:16:35 +0100
  4169. +Subject: [PATCH] backports: add skb_free_frag()
  4170. +
  4171. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  4172. +---
  4173. +
  4174. +--- a/backport-include/linux/skbuff.h
  4175. ++++ b/backport-include/linux/skbuff.h
  4176. +@@ -300,4 +300,11 @@ int skb_ensure_writable(struct sk_buff *
  4177. +
  4178. + #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) */
  4179. +
  4180. ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
  4181. ++static inline void skb_free_frag(void *data)
  4182. ++{
  4183. ++ put_page(virt_to_head_page(data));
  4184. ++}
  4185. ++#endif
  4186. ++
  4187. + #endif /* __BACKPORT_SKBUFF_H */
  4188. diff --git a/package/kernel/mac80211/patches/004-backports_debugfs_fix.patch b/package/kernel/mac80211/patches/004-backports_debugfs_fix.patch
  4189. deleted file mode 100644
  4190. index d48a723..0000000
  4191. --- a/package/kernel/mac80211/patches/004-backports_debugfs_fix.patch
  4192. +++ /dev/null
  4193. @@ -1,10 +0,0 @@
  4194. ---- a/backport-include/linux/debugfs.h
  4195. -+++ b/backport-include/linux/debugfs.h
  4196. -@@ -3,6 +3,7 @@
  4197. - #include_next <linux/debugfs.h>
  4198. - #include <linux/version.h>
  4199. - #include <generated/utsrelease.h>
  4200. -+#include <linux/device.h>
  4201. -
  4202. - #if defined(CONFIG_DEBUG_FS)
  4203. - struct dentry *debugfs_create_devm_seqfile(struct device *dev, const char *name,
  4204. 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
  4205. new file mode 100644
  4206. index 0000000..9b672a8
  4207. --- /dev/null
  4208. +++ b/package/kernel/mac80211/patches/005-backports-add-napi_alloc_frag.patch
  4209. @@ -0,0 +1,20 @@
  4210. +From: Felix Fietkau <nbd@openwrt.org>
  4211. +Date: Thu, 28 Jan 2016 15:19:22 +0100
  4212. +Subject: [PATCH] backports: add napi_alloc_frag
  4213. +
  4214. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  4215. +---
  4216. +
  4217. +--- a/backport-include/linux/netdevice.h
  4218. ++++ b/backport-include/linux/netdevice.h
  4219. +@@ -232,6 +232,10 @@ static inline void backport_unregister_n
  4220. + #define unregister_netdevice_many LINUX_BACKPORT(unregister_netdevice_many)
  4221. + #endif
  4222. +
  4223. ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
  4224. ++#define napi_alloc_frag netdev_alloc_frag
  4225. ++#endif
  4226. ++
  4227. + /*
  4228. + * Complicated way of saying: We only backport netdev_rss_key stuff on kernels
  4229. + * that either already have net_get_random_once() (>= 3.13) or where we've been
  4230. diff --git a/package/kernel/mac80211/patches/008-fix_netdev_unregister.patch b/package/kernel/mac80211/patches/008-fix_netdev_unregister.patch
  4231. deleted file mode 100644
  4232. index e07f323..0000000
  4233. --- a/package/kernel/mac80211/patches/008-fix_netdev_unregister.patch
  4234. +++ /dev/null
  4235. @@ -1,16 +0,0 @@
  4236. ---- a/net/mac80211/iface.c
  4237. -+++ b/net/mac80211/iface.c
  4238. -@@ -1858,6 +1858,13 @@ void ieee80211_remove_interfaces(struct
  4239. - }
  4240. - mutex_unlock(&local->iflist_mtx);
  4241. - unregister_netdevice_many(&unreg_list);
  4242. -+#if (!(LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,45) && \
  4243. -+ LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)) && \
  4244. -+ !(LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,9) && \
  4245. -+ LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0)) && \
  4246. -+ (LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)))
  4247. -+ list_del(&unreg_list);
  4248. -+#endif
  4249. -
  4250. - list_for_each_entry_safe(sdata, tmp, &wdev_list, list) {
  4251. - list_del(&sdata->list);
  4252. diff --git a/package/kernel/mac80211/patches/020-add_mpls_h.patch b/package/kernel/mac80211/patches/020-add_mpls_h.patch
  4253. deleted file mode 100644
  4254. index e5310bc..0000000
  4255. --- a/package/kernel/mac80211/patches/020-add_mpls_h.patch
  4256. +++ /dev/null
  4257. @@ -1,37 +0,0 @@
  4258. ---- /dev/null
  4259. -+++ b/include/uapi/linux/mpls.h
  4260. -@@ -0,0 +1,34 @@
  4261. -+#ifndef _UAPI_MPLS_H
  4262. -+#define _UAPI_MPLS_H
  4263. -+
  4264. -+#include <linux/types.h>
  4265. -+#include <asm/byteorder.h>
  4266. -+
  4267. -+/* Reference: RFC 5462, RFC 3032
  4268. -+ *
  4269. -+ * 0 1 2 3
  4270. -+ * 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
  4271. -+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4272. -+ * | Label | TC |S| TTL |
  4273. -+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4274. -+ *
  4275. -+ * Label: Label Value, 20 bits
  4276. -+ * TC: Traffic Class field, 3 bits
  4277. -+ * S: Bottom of Stack, 1 bit
  4278. -+ * TTL: Time to Live, 8 bits
  4279. -+ */
  4280. -+
  4281. -+struct mpls_label {
  4282. -+ __be32 entry;
  4283. -+};
  4284. -+
  4285. -+#define MPLS_LS_LABEL_MASK 0xFFFFF000
  4286. -+#define MPLS_LS_LABEL_SHIFT 12
  4287. -+#define MPLS_LS_TC_MASK 0x00000E00
  4288. -+#define MPLS_LS_TC_SHIFT 9
  4289. -+#define MPLS_LS_S_MASK 0x00000100
  4290. -+#define MPLS_LS_S_SHIFT 8
  4291. -+#define MPLS_LS_TTL_MASK 0x000000FF
  4292. -+#define MPLS_LS_TTL_SHIFT 0
  4293. -+
  4294. -+#endif /* _UAPI_MPLS_H */
  4295. diff --git a/package/kernel/mac80211/patches/030-rt2x00_options.patch b/package/kernel/mac80211/patches/030-rt2x00_options.patch
  4296. index 35b5b5d..a4ca884 100644
  4297. --- a/package/kernel/mac80211/patches/030-rt2x00_options.patch
  4298. +++ b/package/kernel/mac80211/patches/030-rt2x00_options.patch
  4299. @@ -1,5 +1,5 @@
  4300. ---- a/drivers/net/wireless/rt2x00/Kconfig
  4301. -+++ b/drivers/net/wireless/rt2x00/Kconfig
  4302. +--- a/drivers/net/wireless/ralink/rt2x00/Kconfig
  4303. ++++ b/drivers/net/wireless/ralink/rt2x00/Kconfig
  4304. @@ -225,36 +225,37 @@ config RT2800SOC
  4305. @@ -43,5 +43,5 @@
  4306. - tristate
  4307. + tristate "RT2x00 support"
  4308. depends on m
  4309. - select BPAUTO_AVERAGE
  4310. + config RT2X00_LIB_FIRMWARE
  4311. diff --git a/package/kernel/mac80211/patches/040-brcmutil_option.patch b/package/kernel/mac80211/patches/040-brcmutil_option.patch
  4312. index 8a6cae6..167332d 100644
  4313. --- a/package/kernel/mac80211/patches/040-brcmutil_option.patch
  4314. +++ b/package/kernel/mac80211/patches/040-brcmutil_option.patch
  4315. @@ -1,5 +1,5 @@
  4316. ---- a/drivers/net/wireless/brcm80211/Kconfig
  4317. -+++ b/drivers/net/wireless/brcm80211/Kconfig
  4318. +--- a/drivers/net/wireless/broadcom/brcm80211/Kconfig
  4319. ++++ b/drivers/net/wireless/broadcom/brcm80211/Kconfig
  4320. @@ -1,5 +1,5 @@
  4321. config BRCMUTIL
  4322. - tristate
  4323. diff --git a/package/kernel/mac80211/patches/045-bcma-from-4.1.patch b/package/kernel/mac80211/patches/045-bcma-from-4.1.patch
  4324. deleted file mode 100644
  4325. index dce217f..0000000
  4326. --- a/package/kernel/mac80211/patches/045-bcma-from-4.1.patch
  4327. +++ /dev/null
  4328. @@ -1,104 +0,0 @@
  4329. ---- a/drivers/bcma/driver_pci.c
  4330. -+++ b/drivers/bcma/driver_pci.c
  4331. -@@ -282,39 +282,6 @@ void bcma_core_pci_power_save(struct bcm
  4332. - }
  4333. - EXPORT_SYMBOL_GPL(bcma_core_pci_power_save);
  4334. -
  4335. --int bcma_core_pci_irq_ctl(struct bcma_bus *bus, struct bcma_device *core,
  4336. -- bool enable)
  4337. --{
  4338. -- struct pci_dev *pdev;
  4339. -- u32 coremask, tmp;
  4340. -- int err = 0;
  4341. --
  4342. -- if (bus->hosttype != BCMA_HOSTTYPE_PCI) {
  4343. -- /* This bcma device is not on a PCI host-bus. So the IRQs are
  4344. -- * not routed through the PCI core.
  4345. -- * So we must not enable routing through the PCI core. */
  4346. -- goto out;
  4347. -- }
  4348. --
  4349. -- pdev = bus->host_pci;
  4350. --
  4351. -- err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp);
  4352. -- if (err)
  4353. -- goto out;
  4354. --
  4355. -- coremask = BIT(core->core_index) << 8;
  4356. -- if (enable)
  4357. -- tmp |= coremask;
  4358. -- else
  4359. -- tmp &= ~coremask;
  4360. --
  4361. -- err = pci_write_config_dword(pdev, BCMA_PCI_IRQMASK, tmp);
  4362. --
  4363. --out:
  4364. -- return err;
  4365. --}
  4366. --EXPORT_SYMBOL_GPL(bcma_core_pci_irq_ctl);
  4367. --
  4368. - static void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend)
  4369. - {
  4370. - u32 w;
  4371. ---- a/drivers/bcma/host_pci.c
  4372. -+++ b/drivers/bcma/host_pci.c
  4373. -@@ -351,3 +351,37 @@ void bcma_host_pci_down(struct bcma_bus
  4374. - bcma_core_pci_down(&bus->drv_pci[0]);
  4375. - }
  4376. - EXPORT_SYMBOL_GPL(bcma_host_pci_down);
  4377. -+
  4378. -+/* See also si_pci_setup */
  4379. -+int bcma_host_pci_irq_ctl(struct bcma_bus *bus, struct bcma_device *core,
  4380. -+ bool enable)
  4381. -+{
  4382. -+ struct pci_dev *pdev;
  4383. -+ u32 coremask, tmp;
  4384. -+ int err = 0;
  4385. -+
  4386. -+ if (bus->hosttype != BCMA_HOSTTYPE_PCI) {
  4387. -+ /* This bcma device is not on a PCI host-bus. So the IRQs are
  4388. -+ * not routed through the PCI core.
  4389. -+ * So we must not enable routing through the PCI core. */
  4390. -+ goto out;
  4391. -+ }
  4392. -+
  4393. -+ pdev = bus->host_pci;
  4394. -+
  4395. -+ err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp);
  4396. -+ if (err)
  4397. -+ goto out;
  4398. -+
  4399. -+ coremask = BIT(core->core_index) << 8;
  4400. -+ if (enable)
  4401. -+ tmp |= coremask;
  4402. -+ else
  4403. -+ tmp &= ~coremask;
  4404. -+
  4405. -+ err = pci_write_config_dword(pdev, BCMA_PCI_IRQMASK, tmp);
  4406. -+
  4407. -+out:
  4408. -+ return err;
  4409. -+}
  4410. -+EXPORT_SYMBOL_GPL(bcma_host_pci_irq_ctl);
  4411. ---- a/drivers/net/wireless/b43/main.c
  4412. -+++ b/drivers/net/wireless/b43/main.c
  4413. -@@ -4866,7 +4866,7 @@ static int b43_wireless_core_init(struct
  4414. - switch (dev->dev->bus_type) {
  4415. - #ifdef CPTCFG_B43_BCMA
  4416. - case B43_BUS_BCMA:
  4417. -- bcma_core_pci_irq_ctl(dev->dev->bdev->bus,
  4418. -+ bcma_host_pci_irq_ctl(dev->dev->bdev->bus,
  4419. - dev->dev->bdev, true);
  4420. - bcma_host_pci_up(dev->dev->bdev->bus);
  4421. - break;
  4422. ---- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
  4423. -+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
  4424. -@@ -4959,7 +4959,7 @@ static int brcms_b_up_prep(struct brcms_
  4425. - * Configure pci/pcmcia here instead of in brcms_c_attach()
  4426. - * to allow mfg hotswap: down, hotswap (chip power cycle), up.
  4427. - */
  4428. -- bcma_core_pci_irq_ctl(wlc_hw->d11core->bus, wlc_hw->d11core,
  4429. -+ bcma_host_pci_irq_ctl(wlc_hw->d11core->bus, wlc_hw->d11core,
  4430. - true);
  4431. -
  4432. - /*
  4433. diff --git a/package/kernel/mac80211/patches/050-lib80211_option.patch b/package/kernel/mac80211/patches/050-lib80211_option.patch
  4434. index 5fe5558..3fc8c05 100644
  4435. --- a/package/kernel/mac80211/patches/050-lib80211_option.patch
  4436. +++ b/package/kernel/mac80211/patches/050-lib80211_option.patch
  4437. @@ -1,6 +1,6 @@
  4438. --- a/net/wireless/Kconfig
  4439. +++ b/net/wireless/Kconfig
  4440. -@@ -174,7 +174,7 @@ config CFG80211_WEXT_EXPORT
  4441. +@@ -171,7 +171,7 @@ config CFG80211_WEXT_EXPORT
  4442. wext compatibility symbols to be exported.
  4443. config LIB80211
  4444. @@ -9,7 +9,7 @@
  4445. depends on m
  4446. default n
  4447. help
  4448. -@@ -184,15 +184,15 @@ config LIB80211
  4449. +@@ -181,15 +181,15 @@ config LIB80211
  4450. Drivers should select this themselves if needed.
  4451. config LIB80211_CRYPT_WEP
  4452. diff --git a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  4453. index d307949..fd1e1cf 100644
  4454. --- a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  4455. +++ b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  4456. @@ -1,9 +1,9 @@
  4457. --- a/.local-symbols
  4458. +++ b/.local-symbols
  4459. -@@ -344,40 +344,3 @@ USB_CDC_PHONET=
  4460. - USB_IPHETH=
  4461. +@@ -476,44 +476,6 @@ USB_IPHETH=
  4462. USB_SIERRA_NET=
  4463. USB_VL600=
  4464. + USB_NET_CH9200=
  4465. -SSB_POSSIBLE=
  4466. -SSB=
  4467. -SSB_SPROM=
  4468. @@ -15,6 +15,7 @@
  4469. -SSB_PCMCIAHOST=
  4470. -SSB_SDIOHOST_POSSIBLE=
  4471. -SSB_SDIOHOST=
  4472. +-SSB_HOST_SOC=
  4473. -SSB_SILENT=
  4474. -SSB_DEBUG=
  4475. -SSB_SERIAL=
  4476. @@ -32,28 +33,20 @@
  4477. -BCMA_BLOCKIO=
  4478. -BCMA_HOST_PCI_POSSIBLE=
  4479. -BCMA_HOST_PCI=
  4480. --BCMA_DRIVER_PCI_HOSTMODE=
  4481. -BCMA_HOST_SOC=
  4482. -BCMA_DRIVER_PCI=
  4483. +-BCMA_DRIVER_PCI_HOSTMODE=
  4484. -BCMA_DRIVER_MIPS=
  4485. -BCMA_SFLASH=
  4486. -BCMA_NFLASH=
  4487. -BCMA_DRIVER_GMAC_CMN=
  4488. -BCMA_DRIVER_GPIO=
  4489. -BCMA_DEBUG=
  4490. ---- a/Makefile.kernel
  4491. -+++ b/Makefile.kernel
  4492. -@@ -38,8 +38,6 @@ obj-$(CPTCFG_MAC80211) += net/mac80211/
  4493. - obj-$(CPTCFG_WLAN) += drivers/net/wireless/
  4494. - #obj-$(CPTCFG_BT) += net/bluetooth/
  4495. - #obj-$(CPTCFG_BT) += drivers/bluetooth/
  4496. --obj-$(CPTCFG_SSB) += drivers/ssb/
  4497. --obj-$(CPTCFG_BCMA) += drivers/bcma/
  4498. - #obj-$(CPTCFG_ETHERNET) += drivers/net/ethernet/
  4499. - obj-$(CPTCFG_USB_NET_RNDIS_WLAN) += drivers/net/usb/
  4500. - #obj-$(CPTCFG_NFC) += net/nfc/
  4501. ---- a/drivers/net/wireless/b43/main.c
  4502. -+++ b/drivers/net/wireless/b43/main.c
  4503. + NFC=
  4504. + NFC_DIGITAL=
  4505. + NFC_NCI=
  4506. +--- a/drivers/net/wireless/broadcom/b43/main.c
  4507. ++++ b/drivers/net/wireless/broadcom/b43/main.c
  4508. @@ -2866,7 +2866,7 @@ static struct ssb_device *b43_ssb_gpio_d
  4509. {
  4510. struct ssb_bus *bus = dev->dev->sdev->bus;
  4511. @@ -63,7 +56,7 @@
  4512. return (bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev);
  4513. #else
  4514. return bus->chipco.dev;
  4515. -@@ -4907,7 +4907,7 @@ static int b43_wireless_core_init(struct
  4516. +@@ -4903,7 +4903,7 @@ static int b43_wireless_core_init(struct
  4517. }
  4518. if (sprom->boardflags_lo & B43_BFL_XTAL_NOSLOW)
  4519. hf |= B43_HF_DSCRQ; /* Disable slowclock requests from ucode. */
  4520. @@ -72,8 +65,8 @@
  4521. if (dev->dev->bus_type == B43_BUS_SSB &&
  4522. dev->dev->sdev->bus->bustype == SSB_BUSTYPE_PCI &&
  4523. dev->dev->sdev->bus->pcicore.dev->id.revision <= 10)
  4524. ---- a/drivers/net/wireless/b43legacy/main.c
  4525. -+++ b/drivers/net/wireless/b43legacy/main.c
  4526. +--- a/drivers/net/wireless/broadcom/b43legacy/main.c
  4527. ++++ b/drivers/net/wireless/broadcom/b43legacy/main.c
  4528. @@ -1937,7 +1937,7 @@ static int b43legacy_gpio_init(struct b4
  4529. if (dev->dev->id.revision >= 2)
  4530. mask |= 0x0010; /* FIXME: This is redundant. */
  4531. @@ -92,8 +85,8 @@
  4532. pcidev = bus->pcicore.dev;
  4533. #endif
  4534. gpiodev = bus->chipco.dev ? : pcidev;
  4535. ---- a/drivers/net/wireless/brcm80211/brcmsmac/Makefile
  4536. -+++ b/drivers/net/wireless/brcm80211/brcmsmac/Makefile
  4537. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/Makefile
  4538. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/Makefile
  4539. @@ -43,6 +43,6 @@ brcmsmac-y := \
  4540. brcms_trace_events.o \
  4541. debug.o
  4542. @@ -102,8 +95,8 @@
  4543. +brcmsmac-$(CONFIG_BCMA_DRIVER_GPIO) += led.o
  4544. obj-$(CPTCFG_BRCMSMAC) += brcmsmac.o
  4545. ---- a/drivers/net/wireless/brcm80211/brcmsmac/led.h
  4546. -+++ b/drivers/net/wireless/brcm80211/brcmsmac/led.h
  4547. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/led.h
  4548. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/led.h
  4549. @@ -22,7 +22,7 @@ struct brcms_led {
  4550. bool active_low;
  4551. };
  4552. @@ -116,12 +109,23 @@
  4553. --- a/Kconfig.sources
  4554. +++ b/Kconfig.sources
  4555. @@ -9,9 +9,6 @@ source "$BACKPORT_DIR/drivers/net/wirele
  4556. - #source "$BACKPORT_DIR/drivers/net/ethernet/Kconfig"
  4557. + source "$BACKPORT_DIR/drivers/net/ethernet/Kconfig"
  4558. source "$BACKPORT_DIR/drivers/net/usb/Kconfig"
  4559. -source "$BACKPORT_DIR/drivers/ssb/Kconfig"
  4560. -source "$BACKPORT_DIR/drivers/bcma/Kconfig"
  4561. -
  4562. - #source "$BACKPORT_DIR/net/nfc/Kconfig"
  4563. + source "$BACKPORT_DIR/net/nfc/Kconfig"
  4564. - #source "$BACKPORT_DIR/drivers/media/Kconfig"
  4565. + source "$BACKPORT_DIR/drivers/media/Kconfig"
  4566. +--- a/Makefile.kernel
  4567. ++++ b/Makefile.kernel
  4568. +@@ -38,8 +38,6 @@ obj-$(CPTCFG_MAC80211) += net/mac80211/
  4569. + obj-$(CPTCFG_WLAN) += drivers/net/wireless/
  4570. + obj-$(CPTCFG_BT) += net/bluetooth/
  4571. + obj-$(CPTCFG_BT) += drivers/bluetooth/
  4572. +-obj-$(CPTCFG_SSB) += drivers/ssb/
  4573. +-obj-$(CPTCFG_BCMA) += drivers/bcma/
  4574. + obj-$(CPTCFG_ETHERNET) += drivers/net/ethernet/
  4575. + obj-$(CPTCFG_USB_NET_RNDIS_WLAN) += drivers/net/usb/
  4576. + obj-$(CPTCFG_NFC) += net/nfc/
  4577. diff --git a/package/kernel/mac80211/patches/070-ath_common_config.patch b/package/kernel/mac80211/patches/070-ath_common_config.patch
  4578. index c6e9cd8..41774fe 100644
  4579. --- a/package/kernel/mac80211/patches/070-ath_common_config.patch
  4580. +++ b/package/kernel/mac80211/patches/070-ath_common_config.patch
  4581. @@ -1,10 +1,9 @@
  4582. --- a/drivers/net/wireless/ath/Kconfig
  4583. +++ b/drivers/net/wireless/ath/Kconfig
  4584. -@@ -6,6 +6,7 @@ menuconfig ATH_CARDS
  4585. - tristate "Atheros Wireless Cards"
  4586. +@@ -1,5 +1,5 @@
  4587. + config ATH_COMMON
  4588. +- tristate
  4589. ++ tristate "ath.ko"
  4590. depends on m
  4591. - depends on CFG80211 && (!UML || BROKEN)
  4592. -+ select ATH_COMMON
  4593. - ---help---
  4594. - This will enable the support for the Atheros wireless drivers.
  4595. - ath5k, ath9k, ath9k_htc and ar9170 drivers share some common code, this option
  4596. +
  4597. + config WLAN_VENDOR_ATH
  4598. 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
  4599. deleted file mode 100644
  4600. index 85c5280..0000000
  4601. --- a/package/kernel/mac80211/patches/090-linux_3_18_12_compat.patch
  4602. +++ /dev/null
  4603. @@ -1,29 +0,0 @@
  4604. ---- a/backport-include/linux/wait.h
  4605. -+++ b/backport-include/linux/wait.h
  4606. -@@ -23,7 +23,7 @@ backport_wait_on_bit_io(void *word, int
  4607. -
  4608. - #endif
  4609. -
  4610. --#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
  4611. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,12)
  4612. - #define WQ_FLAG_WOKEN 0x02
  4613. -
  4614. - #define wait_woken LINUX_BACKPORT(wait_woken)
  4615. ---- a/compat/backport-3.19.c
  4616. -+++ b/compat/backport-3.19.c
  4617. -@@ -15,6 +15,7 @@
  4618. - #include <linux/netdevice.h>
  4619. - #include <linux/debugfs.h>
  4620. -
  4621. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,12)
  4622. - static inline bool is_kthread_should_stop(void)
  4623. - {
  4624. - return (current->flags & PF_KTHREAD) && kthread_should_stop();
  4625. -@@ -79,6 +80,7 @@ int woken_wake_function(wait_queue_t *wa
  4626. - return default_wake_function(wait, mode, sync, key);
  4627. - }
  4628. - EXPORT_SYMBOL(woken_wake_function);
  4629. -+#endif
  4630. -
  4631. - #ifdef __BACKPORT_NETDEV_RSS_KEY_FILL
  4632. - u8 netdev_rss_key[NETDEV_RSS_KEY_LEN];
  4633. diff --git a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  4634. new file mode 100644
  4635. index 0000000..02f46c7
  4636. --- /dev/null
  4637. +++ b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  4638. @@ -0,0 +1,376 @@
  4639. +--- a/net/mac80211/Kconfig
  4640. ++++ b/net/mac80211/Kconfig
  4641. +@@ -5,8 +5,6 @@ config MAC80211
  4642. + depends on CRYPTO
  4643. + depends on CRYPTO_ARC4
  4644. + depends on CRYPTO_AES
  4645. +- select BPAUTO_CRYPTO_CCM
  4646. +- depends on CRYPTO_GCM
  4647. + depends on CRC32
  4648. + ---help---
  4649. + This option enables the hardware independent IEEE 802.11
  4650. +--- a/net/mac80211/Makefile
  4651. ++++ b/net/mac80211/Makefile
  4652. +@@ -16,9 +16,7 @@ mac80211-y := \
  4653. + michael.o \
  4654. + tkip.o \
  4655. + aes_ccm.o \
  4656. +- aes_gcm.o \
  4657. + aes_cmac.o \
  4658. +- aes_gmac.o \
  4659. + cfg.o \
  4660. + ethtool.o \
  4661. + rx.o \
  4662. +--- a/net/mac80211/aes_ccm.c
  4663. ++++ b/net/mac80211/aes_ccm.c
  4664. +@@ -13,89 +13,132 @@
  4665. + #include <linux/types.h>
  4666. + #include <linux/err.h>
  4667. + #include <crypto/aead.h>
  4668. ++#include <crypto/aes.h>
  4669. +
  4670. + #include <net/mac80211.h>
  4671. + #include "key.h"
  4672. + #include "aes_ccm.h"
  4673. +
  4674. +-void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  4675. +- u8 *data, size_t data_len, u8 *mic,
  4676. +- size_t mic_len)
  4677. ++static void aes_ccm_prepare(struct crypto_cipher *tfm, u8 *b_0, u8 *aad, u8 *s_0,
  4678. ++ u8 *a, u8 *b)
  4679. + {
  4680. +- struct scatterlist sg[3];
  4681. ++ int i;
  4682. ++
  4683. ++ crypto_cipher_encrypt_one(tfm, b, b_0);
  4684. ++
  4685. ++ /* Extra Authenticate-only data (always two AES blocks) */
  4686. ++ for (i = 0; i < AES_BLOCK_SIZE; i++)
  4687. ++ aad[i] ^= b[i];
  4688. ++ crypto_cipher_encrypt_one(tfm, b, aad);
  4689. ++
  4690. ++ aad += AES_BLOCK_SIZE;
  4691. ++
  4692. ++ for (i = 0; i < AES_BLOCK_SIZE; i++)
  4693. ++ aad[i] ^= b[i];
  4694. ++ crypto_cipher_encrypt_one(tfm, a, aad);
  4695. +
  4696. +- char aead_req_data[sizeof(struct aead_request) +
  4697. +- crypto_aead_reqsize(tfm)]
  4698. +- __aligned(__alignof__(struct aead_request));
  4699. +- struct aead_request *aead_req = (void *) aead_req_data;
  4700. ++ /* Mask out bits from auth-only-b_0 */
  4701. ++ b_0[0] &= 0x07;
  4702. +
  4703. +- memset(aead_req, 0, sizeof(aead_req_data));
  4704. ++ /* S_0 is used to encrypt T (= MIC) */
  4705. ++ b_0[14] = 0;
  4706. ++ b_0[15] = 0;
  4707. ++ crypto_cipher_encrypt_one(tfm, s_0, b_0);
  4708. ++}
  4709. +
  4710. +- sg_init_table(sg, 3);
  4711. +- sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad));
  4712. +- sg_set_buf(&sg[1], data, data_len);
  4713. +- sg_set_buf(&sg[2], mic, mic_len);
  4714. +
  4715. +- aead_request_set_tfm(aead_req, tfm);
  4716. +- aead_request_set_crypt(aead_req, sg, sg, data_len, b_0);
  4717. +- aead_request_set_ad(aead_req, sg[0].length);
  4718. ++void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
  4719. ++ u8 *data, size_t data_len, u8 *mic,
  4720. ++ size_t mic_len)
  4721. ++{
  4722. ++ int i, j, last_len, num_blocks;
  4723. ++ u8 b[AES_BLOCK_SIZE];
  4724. ++ u8 s_0[AES_BLOCK_SIZE];
  4725. ++ u8 e[AES_BLOCK_SIZE];
  4726. ++ u8 *pos, *cpos;
  4727. ++
  4728. ++ num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
  4729. ++ last_len = data_len % AES_BLOCK_SIZE;
  4730. ++ aes_ccm_prepare(tfm, b_0, aad, s_0, b, b);
  4731. ++
  4732. ++ /* Process payload blocks */
  4733. ++ pos = data;
  4734. ++ cpos = data;
  4735. ++ for (j = 1; j <= num_blocks; j++) {
  4736. ++ int blen = (j == num_blocks && last_len) ?
  4737. ++ last_len : AES_BLOCK_SIZE;
  4738. ++
  4739. ++ /* Authentication followed by encryption */
  4740. ++ for (i = 0; i < blen; i++)
  4741. ++ b[i] ^= pos[i];
  4742. ++ crypto_cipher_encrypt_one(tfm, b, b);
  4743. ++
  4744. ++ b_0[14] = (j >> 8) & 0xff;
  4745. ++ b_0[15] = j & 0xff;
  4746. ++ crypto_cipher_encrypt_one(tfm, e, b_0);
  4747. ++ for (i = 0; i < blen; i++)
  4748. ++ *cpos++ = *pos++ ^ e[i];
  4749. ++ }
  4750. +
  4751. +- crypto_aead_encrypt(aead_req);
  4752. ++ for (i = 0; i < mic_len; i++)
  4753. ++ mic[i] = b[i] ^ s_0[i];
  4754. + }
  4755. +
  4756. +-int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  4757. ++int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
  4758. + u8 *data, size_t data_len, u8 *mic,
  4759. + size_t mic_len)
  4760. + {
  4761. +- struct scatterlist sg[3];
  4762. +- char aead_req_data[sizeof(struct aead_request) +
  4763. +- crypto_aead_reqsize(tfm)]
  4764. +- __aligned(__alignof__(struct aead_request));
  4765. +- struct aead_request *aead_req = (void *) aead_req_data;
  4766. +-
  4767. +- if (data_len == 0)
  4768. +- return -EINVAL;
  4769. +-
  4770. +- memset(aead_req, 0, sizeof(aead_req_data));
  4771. +-
  4772. +- sg_init_table(sg, 3);
  4773. +- sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad));
  4774. +- sg_set_buf(&sg[1], data, data_len);
  4775. +- sg_set_buf(&sg[2], mic, mic_len);
  4776. +-
  4777. +- aead_request_set_tfm(aead_req, tfm);
  4778. +- aead_request_set_crypt(aead_req, sg, sg, data_len + mic_len, b_0);
  4779. +- aead_request_set_ad(aead_req, sg[0].length);
  4780. ++ int i, j, last_len, num_blocks;
  4781. ++ u8 *pos, *cpos;
  4782. ++ u8 a[AES_BLOCK_SIZE];
  4783. ++ u8 b[AES_BLOCK_SIZE];
  4784. ++ u8 s_0[AES_BLOCK_SIZE];
  4785. ++
  4786. ++ num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
  4787. ++ last_len = data_len % AES_BLOCK_SIZE;
  4788. ++ aes_ccm_prepare(tfm, b_0, aad, s_0, a, b);
  4789. ++
  4790. ++ /* Process payload blocks */
  4791. ++ cpos = data;
  4792. ++ pos = data;
  4793. ++ for (j = 1; j <= num_blocks; j++) {
  4794. ++ int blen = (j == num_blocks && last_len) ?
  4795. ++ last_len : AES_BLOCK_SIZE;
  4796. ++
  4797. ++ /* Decryption followed by authentication */
  4798. ++ b_0[14] = (j >> 8) & 0xff;
  4799. ++ b_0[15] = j & 0xff;
  4800. ++ crypto_cipher_encrypt_one(tfm, b, b_0);
  4801. ++ for (i = 0; i < blen; i++) {
  4802. ++ *pos = *cpos++ ^ b[i];
  4803. ++ a[i] ^= *pos++;
  4804. ++ }
  4805. ++ crypto_cipher_encrypt_one(tfm, a, a);
  4806. ++ }
  4807. ++
  4808. ++ for (i = 0; i < mic_len; i++) {
  4809. ++ if ((mic[i] ^ s_0[i]) != a[i])
  4810. ++ return -1;
  4811. ++ }
  4812. +
  4813. +- return crypto_aead_decrypt(aead_req);
  4814. ++ return 0;
  4815. + }
  4816. +
  4817. +-struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[],
  4818. +- size_t key_len,
  4819. +- size_t mic_len)
  4820. ++struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[],
  4821. ++ size_t key_len,
  4822. ++ size_t mic_len)
  4823. + {
  4824. +- struct crypto_aead *tfm;
  4825. +- int err;
  4826. ++ struct crypto_cipher *tfm;
  4827. +
  4828. +- tfm = crypto_alloc_aead("ccm(aes)", 0, CRYPTO_ALG_ASYNC);
  4829. +- if (IS_ERR(tfm))
  4830. +- return tfm;
  4831. +-
  4832. +- err = crypto_aead_setkey(tfm, key, key_len);
  4833. +- if (err)
  4834. +- goto free_aead;
  4835. +- err = crypto_aead_setauthsize(tfm, mic_len);
  4836. +- if (err)
  4837. +- goto free_aead;
  4838. ++ tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
  4839. ++ if (!IS_ERR(tfm))
  4840. ++ crypto_cipher_setkey(tfm, key, key_len);
  4841. +
  4842. + return tfm;
  4843. +-
  4844. +-free_aead:
  4845. +- crypto_free_aead(tfm);
  4846. +- return ERR_PTR(err);
  4847. + }
  4848. +
  4849. +-void ieee80211_aes_key_free(struct crypto_aead *tfm)
  4850. ++
  4851. ++void ieee80211_aes_key_free(struct crypto_cipher *tfm)
  4852. + {
  4853. +- crypto_free_aead(tfm);
  4854. ++ crypto_free_cipher(tfm);
  4855. + }
  4856. +--- a/net/mac80211/aes_ccm.h
  4857. ++++ b/net/mac80211/aes_ccm.h
  4858. +@@ -12,15 +12,15 @@
  4859. +
  4860. + #include <linux/crypto.h>
  4861. +
  4862. +-struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[],
  4863. +- size_t key_len,
  4864. +- size_t mic_len);
  4865. +-void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  4866. ++struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[],
  4867. ++ size_t key_len,
  4868. ++ size_t mic_len);
  4869. ++void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
  4870. + u8 *data, size_t data_len, u8 *mic,
  4871. + size_t mic_len);
  4872. +-int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  4873. ++int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
  4874. + u8 *data, size_t data_len, u8 *mic,
  4875. + size_t mic_len);
  4876. +-void ieee80211_aes_key_free(struct crypto_aead *tfm);
  4877. ++void ieee80211_aes_key_free(struct crypto_cipher *tfm);
  4878. +
  4879. + #endif /* AES_CCM_H */
  4880. +--- a/net/mac80211/aes_gcm.h
  4881. ++++ b/net/mac80211/aes_gcm.h
  4882. +@@ -11,12 +11,28 @@
  4883. +
  4884. + #include <linux/crypto.h>
  4885. +
  4886. +-void ieee80211_aes_gcm_encrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  4887. +- u8 *data, size_t data_len, u8 *mic);
  4888. +-int ieee80211_aes_gcm_decrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  4889. +- u8 *data, size_t data_len, u8 *mic);
  4890. +-struct crypto_aead *ieee80211_aes_gcm_key_setup_encrypt(const u8 key[],
  4891. +- size_t key_len);
  4892. +-void ieee80211_aes_gcm_key_free(struct crypto_aead *tfm);
  4893. ++static inline void
  4894. ++ieee80211_aes_gcm_encrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  4895. ++ u8 *data, size_t data_len, u8 *mic)
  4896. ++{
  4897. ++}
  4898. ++
  4899. ++static inline int
  4900. ++ieee80211_aes_gcm_decrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  4901. ++ u8 *data, size_t data_len, u8 *mic)
  4902. ++{
  4903. ++ return -EOPNOTSUPP;
  4904. ++}
  4905. ++
  4906. ++static inline struct crypto_aead *
  4907. ++ieee80211_aes_gcm_key_setup_encrypt(const u8 key[], size_t key_len)
  4908. ++{
  4909. ++ return NULL;
  4910. ++}
  4911. ++
  4912. ++static inline void
  4913. ++ieee80211_aes_gcm_key_free(struct crypto_aead *tfm)
  4914. ++{
  4915. ++}
  4916. +
  4917. + #endif /* AES_GCM_H */
  4918. +--- a/net/mac80211/aes_gmac.h
  4919. ++++ b/net/mac80211/aes_gmac.h
  4920. +@@ -11,10 +11,22 @@
  4921. +
  4922. + #include <linux/crypto.h>
  4923. +
  4924. +-struct crypto_aead *ieee80211_aes_gmac_key_setup(const u8 key[],
  4925. +- size_t key_len);
  4926. +-int ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce,
  4927. +- const u8 *data, size_t data_len, u8 *mic);
  4928. +-void ieee80211_aes_gmac_key_free(struct crypto_aead *tfm);
  4929. ++static inline struct crypto_aead *
  4930. ++ieee80211_aes_gmac_key_setup(const u8 key[], size_t key_len)
  4931. ++{
  4932. ++ return NULL;
  4933. ++}
  4934. ++
  4935. ++static inline int
  4936. ++ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce,
  4937. ++ const u8 *data, size_t data_len, u8 *mic)
  4938. ++{
  4939. ++ return -EOPNOTSUPP;
  4940. ++}
  4941. ++
  4942. ++static inline void
  4943. ++ieee80211_aes_gmac_key_free(struct crypto_aead *tfm)
  4944. ++{
  4945. ++}
  4946. +
  4947. + #endif /* AES_GMAC_H */
  4948. +--- a/net/mac80211/key.h
  4949. ++++ b/net/mac80211/key.h
  4950. +@@ -84,7 +84,7 @@ struct ieee80211_key {
  4951. + * Management frames.
  4952. + */
  4953. + u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_CCMP_PN_LEN];
  4954. +- struct crypto_aead *tfm;
  4955. ++ struct crypto_cipher *tfm;
  4956. + u32 replays; /* dot11RSNAStatsCCMPReplays */
  4957. + } ccmp;
  4958. + struct {
  4959. +--- a/net/mac80211/wpa.c
  4960. ++++ b/net/mac80211/wpa.c
  4961. +@@ -307,7 +307,8 @@ ieee80211_crypto_tkip_decrypt(struct iee
  4962. + }
  4963. +
  4964. +
  4965. +-static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad)
  4966. ++static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad,
  4967. ++ u16 data_len)
  4968. + {
  4969. + __le16 mask_fc;
  4970. + int a4_included, mgmt;
  4971. +@@ -337,14 +338,8 @@ static void ccmp_special_blocks(struct s
  4972. + else
  4973. + qos_tid = 0;
  4974. +
  4975. +- /* In CCM, the initial vectors (IV) used for CTR mode encryption and CBC
  4976. +- * mode authentication are not allowed to collide, yet both are derived
  4977. +- * from this vector b_0. We only set L := 1 here to indicate that the
  4978. +- * data size can be represented in (L+1) bytes. The CCM layer will take
  4979. +- * care of storing the data length in the top (L+1) bytes and setting
  4980. +- * and clearing the other bits as is required to derive the two IVs.
  4981. +- */
  4982. +- b_0[0] = 0x1;
  4983. ++ /* First block, b_0 */
  4984. ++ b_0[0] = 0x59; /* flags: Adata: 1, M: 011, L: 001 */
  4985. +
  4986. + /* Nonce: Nonce Flags | A2 | PN
  4987. + * Nonce Flags: Priority (b0..b3) | Management (b4) | Reserved (b5..b7)
  4988. +@@ -352,6 +347,8 @@ static void ccmp_special_blocks(struct s
  4989. + b_0[1] = qos_tid | (mgmt << 4);
  4990. + memcpy(&b_0[2], hdr->addr2, ETH_ALEN);
  4991. + memcpy(&b_0[8], pn, IEEE80211_CCMP_PN_LEN);
  4992. ++ /* l(m) */
  4993. ++ put_unaligned_be16(data_len, &b_0[14]);
  4994. +
  4995. + /* AAD (extra authenticate-only data) / masked 802.11 header
  4996. + * FC | A1 | A2 | A3 | SC | [A4] | [QC] */
  4997. +@@ -463,7 +460,7 @@ static int ccmp_encrypt_skb(struct ieee8
  4998. + return 0;
  4999. +
  5000. + pos += IEEE80211_CCMP_HDR_LEN;
  5001. +- ccmp_special_blocks(skb, pn, b_0, aad);
  5002. ++ ccmp_special_blocks(skb, pn, b_0, aad, len);
  5003. + ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, b_0, aad, pos, len,
  5004. + skb_put(skb, mic_len), mic_len);
  5005. +
  5006. +@@ -534,7 +531,7 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  5007. + u8 aad[2 * AES_BLOCK_SIZE];
  5008. + u8 b_0[AES_BLOCK_SIZE];
  5009. + /* hardware didn't decrypt/verify MIC */
  5010. +- ccmp_special_blocks(skb, pn, b_0, aad);
  5011. ++ ccmp_special_blocks(skb, pn, b_0, aad, data_len);
  5012. +
  5013. + if (ieee80211_aes_ccm_decrypt(
  5014. + key->u.ccmp.tfm, b_0, aad,
  5015. diff --git a/package/kernel/mac80211/patches/100-revert-cryptoapi-ports.patch b/package/kernel/mac80211/patches/100-revert-cryptoapi-ports.patch
  5016. deleted file mode 100644
  5017. index ceca952..0000000
  5018. --- a/package/kernel/mac80211/patches/100-revert-cryptoapi-ports.patch
  5019. +++ /dev/null
  5020. @@ -1,2055 +0,0 @@
  5021. -This patch reverts the following commits from wireless-testing:
  5022. -
  5023. -8ade538bf39b1ee53418528fdacd36b8e65621b9
  5024. -56c52da2d554f081e8fce58ecbcf6a40c605b95b
  5025. -2b2ba0db1c820d04d5143452d70012cd44d7b578
  5026. -00b9cfa3ff38401bd70c34b250ca13e5ea347b4a
  5027. -4f031fa9f188b2b0641ac20087d9e16bcfb4e49d
  5028. -6e1ee5d2e9e411892b5d84e3ea93e3fc88ac786c
  5029. -30ef7ef9672d92ab2cac37f60a31955c118321e7
  5030. -f359d3fe832e49eeec2232b2af5a9e3aee6b4862 (only the changes in aes_cmac.{c,h})
  5031. -7ec7c4a9a686c608315739ab6a2b0527a240883c
  5032. ----
  5033. -
  5034. ---- a/include/linux/ieee80211.h
  5035. -+++ b/include/linux/ieee80211.h
  5036. -@@ -1017,15 +1017,6 @@ struct ieee80211_mmie {
  5037. - u8 mic[8];
  5038. - } __packed;
  5039. -
  5040. --/* Management MIC information element (IEEE 802.11w) for GMAC and CMAC-256 */
  5041. --struct ieee80211_mmie_16 {
  5042. -- u8 element_id;
  5043. -- u8 length;
  5044. -- __le16 key_id;
  5045. -- u8 sequence_number[6];
  5046. -- u8 mic[16];
  5047. --} __packed;
  5048. --
  5049. - struct ieee80211_vendor_ie {
  5050. - u8 element_id;
  5051. - u8 len;
  5052. ---- a/include/net/mac80211.h
  5053. -+++ b/include/net/mac80211.h
  5054. -@@ -1306,8 +1306,8 @@ struct ieee80211_vif *wdev_to_ieee80211_
  5055. - * @IEEE80211_KEY_FLAG_PAIRWISE: Set by mac80211, this flag indicates
  5056. - * that the key is pairwise rather then a shared key.
  5057. - * @IEEE80211_KEY_FLAG_SW_MGMT_TX: This flag should be set by the driver for a
  5058. -- * CCMP/GCMP key if it requires CCMP/GCMP encryption of management frames
  5059. -- * (MFP) to be done in software.
  5060. -+ * CCMP key if it requires CCMP encryption of management frames (MFP) to
  5061. -+ * be done in software.
  5062. - * @IEEE80211_KEY_FLAG_PUT_IV_SPACE: This flag should be set by the driver
  5063. - * if space should be prepared for the IV, but the IV
  5064. - * itself should not be generated. Do not set together with
  5065. -@@ -1322,7 +1322,7 @@ struct ieee80211_vif *wdev_to_ieee80211_
  5066. - * RX, if your crypto engine can't deal with TX you can also set the
  5067. - * %IEEE80211_KEY_FLAG_SW_MGMT_TX flag to encrypt such frames in SW.
  5068. - * @IEEE80211_KEY_FLAG_GENERATE_IV_MGMT: This flag should be set by the
  5069. -- * driver for a CCMP/GCMP key to indicate that is requires IV generation
  5070. -+ * driver for a CCMP key to indicate that is requires IV generation
  5071. - * only for managment frames (MFP).
  5072. - * @IEEE80211_KEY_FLAG_RESERVE_TAILROOM: This flag should be set by the
  5073. - * driver for a key to indicate that sufficient tailroom must always
  5074. -@@ -4112,10 +4112,6 @@ void ieee80211_aes_cmac_calculate_k1_k2(
  5075. - * reverse order than in packet)
  5076. - * @aes_cmac: PN data, most significant byte first (big endian,
  5077. - * reverse order than in packet)
  5078. -- * @aes_gmac: PN data, most significant byte first (big endian,
  5079. -- * reverse order than in packet)
  5080. -- * @gcmp: PN data, most significant byte first (big endian,
  5081. -- * reverse order than in packet)
  5082. - */
  5083. - struct ieee80211_key_seq {
  5084. - union {
  5085. -@@ -4129,12 +4125,6 @@ struct ieee80211_key_seq {
  5086. - struct {
  5087. - u8 pn[6];
  5088. - } aes_cmac;
  5089. -- struct {
  5090. -- u8 pn[6];
  5091. -- } aes_gmac;
  5092. -- struct {
  5093. -- u8 pn[6];
  5094. -- } gcmp;
  5095. - };
  5096. - };
  5097. -
  5098. -@@ -4159,7 +4149,7 @@ void ieee80211_get_key_tx_seq(struct iee
  5099. - * ieee80211_get_key_rx_seq - get key RX sequence counter
  5100. - *
  5101. - * @keyconf: the parameter passed with the set key
  5102. -- * @tid: The TID, or -1 for the management frame value (CCMP/GCMP only);
  5103. -+ * @tid: The TID, or -1 for the management frame value (CCMP only);
  5104. - * the value on TID 0 is also used for non-QoS frames. For
  5105. - * CMAC, only TID 0 is valid.
  5106. - * @seq: buffer to receive the sequence data
  5107. -@@ -4195,7 +4185,7 @@ void ieee80211_set_key_tx_seq(struct iee
  5108. - * ieee80211_set_key_rx_seq - set key RX sequence counter
  5109. - *
  5110. - * @keyconf: the parameter passed with the set key
  5111. -- * @tid: The TID, or -1 for the management frame value (CCMP/GCMP only);
  5112. -+ * @tid: The TID, or -1 for the management frame value (CCMP only);
  5113. - * the value on TID 0 is also used for non-QoS frames. For
  5114. - * CMAC, only TID 0 is valid.
  5115. - * @seq: new sequence data
  5116. ---- a/net/mac80211/Kconfig
  5117. -+++ b/net/mac80211/Kconfig
  5118. -@@ -5,8 +5,6 @@ config MAC80211
  5119. - depends on CRYPTO
  5120. - depends on CRYPTO_ARC4
  5121. - depends on CRYPTO_AES
  5122. -- select BPAUTO_CRYPTO_CCM
  5123. -- depends on CRYPTO_GCM
  5124. - depends on CRC32
  5125. - select BPAUTO_AVERAGE
  5126. - ---help---
  5127. ---- a/net/mac80211/Makefile
  5128. -+++ b/net/mac80211/Makefile
  5129. -@@ -15,9 +15,7 @@ mac80211-y := \
  5130. - michael.o \
  5131. - tkip.o \
  5132. - aes_ccm.o \
  5133. -- aes_gcm.o \
  5134. - aes_cmac.o \
  5135. -- aes_gmac.o \
  5136. - cfg.o \
  5137. - ethtool.o \
  5138. - rx.o \
  5139. ---- a/net/mac80211/aes_ccm.c
  5140. -+++ b/net/mac80211/aes_ccm.c
  5141. -@@ -2,8 +2,6 @@
  5142. - * Copyright 2003-2004, Instant802 Networks, Inc.
  5143. - * Copyright 2005-2006, Devicescape Software, Inc.
  5144. - *
  5145. -- * Rewrite: Copyright (C) 2013 Linaro Ltd <ard.biesheuvel@linaro.org>
  5146. -- *
  5147. - * This program is free software; you can redistribute it and/or modify
  5148. - * it under the terms of the GNU General Public License version 2 as
  5149. - * published by the Free Software Foundation.
  5150. -@@ -19,82 +17,134 @@
  5151. - #include "key.h"
  5152. - #include "aes_ccm.h"
  5153. -
  5154. --void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  5155. -- u8 *data, size_t data_len, u8 *mic,
  5156. -- size_t mic_len)
  5157. -+static void aes_ccm_prepare(struct crypto_cipher *tfm, u8 *scratch, u8 *a)
  5158. -+{
  5159. -+ int i;
  5160. -+ u8 *b_0, *aad, *b, *s_0;
  5161. -+
  5162. -+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
  5163. -+ aad = scratch + 4 * AES_BLOCK_SIZE;
  5164. -+ b = scratch;
  5165. -+ s_0 = scratch + AES_BLOCK_SIZE;
  5166. -+
  5167. -+ crypto_cipher_encrypt_one(tfm, b, b_0);
  5168. -+
  5169. -+ /* Extra Authenticate-only data (always two AES blocks) */
  5170. -+ for (i = 0; i < AES_BLOCK_SIZE; i++)
  5171. -+ aad[i] ^= b[i];
  5172. -+ crypto_cipher_encrypt_one(tfm, b, aad);
  5173. -+
  5174. -+ aad += AES_BLOCK_SIZE;
  5175. -+
  5176. -+ for (i = 0; i < AES_BLOCK_SIZE; i++)
  5177. -+ aad[i] ^= b[i];
  5178. -+ crypto_cipher_encrypt_one(tfm, a, aad);
  5179. -+
  5180. -+ /* Mask out bits from auth-only-b_0 */
  5181. -+ b_0[0] &= 0x07;
  5182. -+
  5183. -+ /* S_0 is used to encrypt T (= MIC) */
  5184. -+ b_0[14] = 0;
  5185. -+ b_0[15] = 0;
  5186. -+ crypto_cipher_encrypt_one(tfm, s_0, b_0);
  5187. -+}
  5188. -+
  5189. -+
  5190. -+void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch,
  5191. -+ u8 *data, size_t data_len,
  5192. -+ u8 *cdata, u8 *mic)
  5193. - {
  5194. -- struct scatterlist assoc, pt, ct[2];
  5195. -+ int i, j, last_len, num_blocks;
  5196. -+ u8 *pos, *cpos, *b, *s_0, *e, *b_0;
  5197. -
  5198. -- char aead_req_data[sizeof(struct aead_request) +
  5199. -- crypto_aead_reqsize(tfm)]
  5200. -- __aligned(__alignof__(struct aead_request));
  5201. -- struct aead_request *aead_req = (void *) aead_req_data;
  5202. --
  5203. -- memset(aead_req, 0, sizeof(aead_req_data));
  5204. --
  5205. -- sg_init_one(&pt, data, data_len);
  5206. -- sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad));
  5207. -- sg_init_table(ct, 2);
  5208. -- sg_set_buf(&ct[0], data, data_len);
  5209. -- sg_set_buf(&ct[1], mic, mic_len);
  5210. --
  5211. -- aead_request_set_tfm(aead_req, tfm);
  5212. -- aead_request_set_assoc(aead_req, &assoc, assoc.length);
  5213. -- aead_request_set_crypt(aead_req, &pt, ct, data_len, b_0);
  5214. -+ b = scratch;
  5215. -+ s_0 = scratch + AES_BLOCK_SIZE;
  5216. -+ e = scratch + 2 * AES_BLOCK_SIZE;
  5217. -+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
  5218. -+
  5219. -+ num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
  5220. -+ last_len = data_len % AES_BLOCK_SIZE;
  5221. -+ aes_ccm_prepare(tfm, scratch, b);
  5222. -+
  5223. -+ /* Process payload blocks */
  5224. -+ pos = data;
  5225. -+ cpos = cdata;
  5226. -+ for (j = 1; j <= num_blocks; j++) {
  5227. -+ int blen = (j == num_blocks && last_len) ?
  5228. -+ last_len : AES_BLOCK_SIZE;
  5229. -+
  5230. -+ /* Authentication followed by encryption */
  5231. -+ for (i = 0; i < blen; i++)
  5232. -+ b[i] ^= pos[i];
  5233. -+ crypto_cipher_encrypt_one(tfm, b, b);
  5234. -+
  5235. -+ b_0[14] = (j >> 8) & 0xff;
  5236. -+ b_0[15] = j & 0xff;
  5237. -+ crypto_cipher_encrypt_one(tfm, e, b_0);
  5238. -+ for (i = 0; i < blen; i++)
  5239. -+ *cpos++ = *pos++ ^ e[i];
  5240. -+ }
  5241. -
  5242. -- crypto_aead_encrypt(aead_req);
  5243. -+ for (i = 0; i < IEEE80211_CCMP_MIC_LEN; i++)
  5244. -+ mic[i] = b[i] ^ s_0[i];
  5245. - }
  5246. -
  5247. --int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  5248. -- u8 *data, size_t data_len, u8 *mic,
  5249. -- size_t mic_len)
  5250. -+
  5251. -+int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *scratch,
  5252. -+ u8 *cdata, size_t data_len, u8 *mic, u8 *data)
  5253. - {
  5254. -- struct scatterlist assoc, pt, ct[2];
  5255. -- char aead_req_data[sizeof(struct aead_request) +
  5256. -- crypto_aead_reqsize(tfm)]
  5257. -- __aligned(__alignof__(struct aead_request));
  5258. -- struct aead_request *aead_req = (void *) aead_req_data;
  5259. --
  5260. -- if (data_len == 0)
  5261. -- return -EINVAL;
  5262. --
  5263. -- memset(aead_req, 0, sizeof(aead_req_data));
  5264. --
  5265. -- sg_init_one(&pt, data, data_len);
  5266. -- sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad));
  5267. -- sg_init_table(ct, 2);
  5268. -- sg_set_buf(&ct[0], data, data_len);
  5269. -- sg_set_buf(&ct[1], mic, mic_len);
  5270. --
  5271. -- aead_request_set_tfm(aead_req, tfm);
  5272. -- aead_request_set_assoc(aead_req, &assoc, assoc.length);
  5273. -- aead_request_set_crypt(aead_req, ct, &pt, data_len + mic_len, b_0);
  5274. -+ int i, j, last_len, num_blocks;
  5275. -+ u8 *pos, *cpos, *b, *s_0, *a, *b_0;
  5276. -+
  5277. -+ b = scratch;
  5278. -+ s_0 = scratch + AES_BLOCK_SIZE;
  5279. -+ a = scratch + 2 * AES_BLOCK_SIZE;
  5280. -+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
  5281. -+
  5282. -+ num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
  5283. -+ last_len = data_len % AES_BLOCK_SIZE;
  5284. -+ aes_ccm_prepare(tfm, scratch, a);
  5285. -+
  5286. -+ /* Process payload blocks */
  5287. -+ cpos = cdata;
  5288. -+ pos = data;
  5289. -+ for (j = 1; j <= num_blocks; j++) {
  5290. -+ int blen = (j == num_blocks && last_len) ?
  5291. -+ last_len : AES_BLOCK_SIZE;
  5292. -+
  5293. -+ /* Decryption followed by authentication */
  5294. -+ b_0[14] = (j >> 8) & 0xff;
  5295. -+ b_0[15] = j & 0xff;
  5296. -+ crypto_cipher_encrypt_one(tfm, b, b_0);
  5297. -+ for (i = 0; i < blen; i++) {
  5298. -+ *pos = *cpos++ ^ b[i];
  5299. -+ a[i] ^= *pos++;
  5300. -+ }
  5301. -+ crypto_cipher_encrypt_one(tfm, a, a);
  5302. -+ }
  5303. -+
  5304. -+ for (i = 0; i < IEEE80211_CCMP_MIC_LEN; i++) {
  5305. -+ if ((mic[i] ^ s_0[i]) != a[i])
  5306. -+ return -1;
  5307. -+ }
  5308. -
  5309. -- return crypto_aead_decrypt(aead_req);
  5310. -+ return 0;
  5311. - }
  5312. -
  5313. --struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[],
  5314. -- size_t key_len,
  5315. -- size_t mic_len)
  5316. -+
  5317. -+struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[])
  5318. - {
  5319. -- struct crypto_aead *tfm;
  5320. -- int err;
  5321. -+ struct crypto_cipher *tfm;
  5322. -
  5323. -- tfm = crypto_alloc_aead("ccm(aes)", 0, CRYPTO_ALG_ASYNC);
  5324. -- if (IS_ERR(tfm))
  5325. -- return tfm;
  5326. --
  5327. -- err = crypto_aead_setkey(tfm, key, key_len);
  5328. -- if (!err)
  5329. -- err = crypto_aead_setauthsize(tfm, mic_len);
  5330. -- if (!err)
  5331. -- return tfm;
  5332. -+ tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
  5333. -+ if (!IS_ERR(tfm))
  5334. -+ crypto_cipher_setkey(tfm, key, WLAN_KEY_LEN_CCMP);
  5335. -
  5336. -- crypto_free_aead(tfm);
  5337. -- return ERR_PTR(err);
  5338. -+ return tfm;
  5339. - }
  5340. -
  5341. --void ieee80211_aes_key_free(struct crypto_aead *tfm)
  5342. -+
  5343. -+void ieee80211_aes_key_free(struct crypto_cipher *tfm)
  5344. - {
  5345. -- crypto_free_aead(tfm);
  5346. -+ crypto_free_cipher(tfm);
  5347. - }
  5348. ---- a/net/mac80211/aes_ccm.h
  5349. -+++ b/net/mac80211/aes_ccm.h
  5350. -@@ -12,15 +12,13 @@
  5351. -
  5352. - #include <linux/crypto.h>
  5353. -
  5354. --struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[],
  5355. -- size_t key_len,
  5356. -- size_t mic_len);
  5357. --void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  5358. -- u8 *data, size_t data_len, u8 *mic,
  5359. -- size_t mic_len);
  5360. --int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  5361. -- u8 *data, size_t data_len, u8 *mic,
  5362. -- size_t mic_len);
  5363. --void ieee80211_aes_key_free(struct crypto_aead *tfm);
  5364. -+struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[]);
  5365. -+void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch,
  5366. -+ u8 *data, size_t data_len,
  5367. -+ u8 *cdata, u8 *mic);
  5368. -+int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *scratch,
  5369. -+ u8 *cdata, size_t data_len,
  5370. -+ u8 *mic, u8 *data);
  5371. -+void ieee80211_aes_key_free(struct crypto_cipher *tfm);
  5372. -
  5373. - #endif /* AES_CCM_H */
  5374. ---- a/net/mac80211/aes_cmac.c
  5375. -+++ b/net/mac80211/aes_cmac.c
  5376. -@@ -18,8 +18,8 @@
  5377. - #include "key.h"
  5378. - #include "aes_cmac.h"
  5379. -
  5380. -+#define AES_CMAC_KEY_LEN 16
  5381. - #define CMAC_TLEN 8 /* CMAC TLen = 64 bits (8 octets) */
  5382. --#define CMAC_TLEN_256 16 /* CMAC TLen = 128 bits (16 octets) */
  5383. - #define AAD_LEN 20
  5384. -
  5385. -
  5386. -@@ -35,9 +35,9 @@ static void gf_mulx(u8 *pad)
  5387. - pad[AES_BLOCK_SIZE - 1] ^= 0x87;
  5388. - }
  5389. -
  5390. --static void aes_cmac_vector(struct crypto_cipher *tfm, size_t num_elem,
  5391. -- const u8 *addr[], const size_t *len, u8 *mac,
  5392. -- size_t mac_len)
  5393. -+
  5394. -+static void aes_128_cmac_vector(struct crypto_cipher *tfm, size_t num_elem,
  5395. -+ const u8 *addr[], const size_t *len, u8 *mac)
  5396. - {
  5397. - u8 cbc[AES_BLOCK_SIZE], pad[AES_BLOCK_SIZE];
  5398. - const u8 *pos, *end;
  5399. -@@ -88,7 +88,7 @@ static void aes_cmac_vector(struct crypt
  5400. - for (i = 0; i < AES_BLOCK_SIZE; i++)
  5401. - pad[i] ^= cbc[i];
  5402. - crypto_cipher_encrypt_one(tfm, pad, pad);
  5403. -- memcpy(mac, pad, mac_len);
  5404. -+ memcpy(mac, pad, CMAC_TLEN);
  5405. - }
  5406. -
  5407. -
  5408. -@@ -107,35 +107,17 @@ void ieee80211_aes_cmac(struct crypto_ci
  5409. - addr[2] = zero;
  5410. - len[2] = CMAC_TLEN;
  5411. -
  5412. -- aes_cmac_vector(tfm, 3, addr, len, mic, CMAC_TLEN);
  5413. -+ aes_128_cmac_vector(tfm, 3, addr, len, mic);
  5414. - }
  5415. -
  5416. --void ieee80211_aes_cmac_256(struct crypto_cipher *tfm, const u8 *aad,
  5417. -- const u8 *data, size_t data_len, u8 *mic)
  5418. --{
  5419. -- const u8 *addr[3];
  5420. -- size_t len[3];
  5421. -- u8 zero[CMAC_TLEN_256];
  5422. --
  5423. -- memset(zero, 0, CMAC_TLEN_256);
  5424. -- addr[0] = aad;
  5425. -- len[0] = AAD_LEN;
  5426. -- addr[1] = data;
  5427. -- len[1] = data_len - CMAC_TLEN_256;
  5428. -- addr[2] = zero;
  5429. -- len[2] = CMAC_TLEN_256;
  5430. --
  5431. -- aes_cmac_vector(tfm, 3, addr, len, mic, CMAC_TLEN_256);
  5432. --}
  5433. -
  5434. --struct crypto_cipher *ieee80211_aes_cmac_key_setup(const u8 key[],
  5435. -- size_t key_len)
  5436. -+struct crypto_cipher * ieee80211_aes_cmac_key_setup(const u8 key[])
  5437. - {
  5438. - struct crypto_cipher *tfm;
  5439. -
  5440. - tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
  5441. - if (!IS_ERR(tfm))
  5442. -- crypto_cipher_setkey(tfm, key, key_len);
  5443. -+ crypto_cipher_setkey(tfm, key, AES_CMAC_KEY_LEN);
  5444. -
  5445. - return tfm;
  5446. - }
  5447. ---- a/net/mac80211/aes_cmac.h
  5448. -+++ b/net/mac80211/aes_cmac.h
  5449. -@@ -11,12 +11,9 @@
  5450. -
  5451. - #include <linux/crypto.h>
  5452. -
  5453. --struct crypto_cipher *ieee80211_aes_cmac_key_setup(const u8 key[],
  5454. -- size_t key_len);
  5455. -+struct crypto_cipher * ieee80211_aes_cmac_key_setup(const u8 key[]);
  5456. - void ieee80211_aes_cmac(struct crypto_cipher *tfm, const u8 *aad,
  5457. - const u8 *data, size_t data_len, u8 *mic);
  5458. --void ieee80211_aes_cmac_256(struct crypto_cipher *tfm, const u8 *aad,
  5459. -- const u8 *data, size_t data_len, u8 *mic);
  5460. - void ieee80211_aes_cmac_key_free(struct crypto_cipher *tfm);
  5461. -
  5462. - #endif /* AES_CMAC_H */
  5463. ---- a/net/mac80211/aes_gcm.c
  5464. -+++ /dev/null
  5465. -@@ -1,95 +0,0 @@
  5466. --/*
  5467. -- * Copyright 2014-2015, Qualcomm Atheros, Inc.
  5468. -- *
  5469. -- * This program is free software; you can redistribute it and/or modify
  5470. -- * it under the terms of the GNU General Public License version 2 as
  5471. -- * published by the Free Software Foundation.
  5472. -- */
  5473. --
  5474. --#include <linux/kernel.h>
  5475. --#include <linux/types.h>
  5476. --#include <linux/crypto.h>
  5477. --#include <linux/err.h>
  5478. --#include <crypto/aes.h>
  5479. --
  5480. --#include <net/mac80211.h>
  5481. --#include "key.h"
  5482. --#include "aes_gcm.h"
  5483. --
  5484. --void ieee80211_aes_gcm_encrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  5485. -- u8 *data, size_t data_len, u8 *mic)
  5486. --{
  5487. -- struct scatterlist assoc, pt, ct[2];
  5488. --
  5489. -- char aead_req_data[sizeof(struct aead_request) +
  5490. -- crypto_aead_reqsize(tfm)]
  5491. -- __aligned(__alignof__(struct aead_request));
  5492. -- struct aead_request *aead_req = (void *)aead_req_data;
  5493. --
  5494. -- memset(aead_req, 0, sizeof(aead_req_data));
  5495. --
  5496. -- sg_init_one(&pt, data, data_len);
  5497. -- sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad));
  5498. -- sg_init_table(ct, 2);
  5499. -- sg_set_buf(&ct[0], data, data_len);
  5500. -- sg_set_buf(&ct[1], mic, IEEE80211_GCMP_MIC_LEN);
  5501. --
  5502. -- aead_request_set_tfm(aead_req, tfm);
  5503. -- aead_request_set_assoc(aead_req, &assoc, assoc.length);
  5504. -- aead_request_set_crypt(aead_req, &pt, ct, data_len, j_0);
  5505. --
  5506. -- crypto_aead_encrypt(aead_req);
  5507. --}
  5508. --
  5509. --int ieee80211_aes_gcm_decrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  5510. -- u8 *data, size_t data_len, u8 *mic)
  5511. --{
  5512. -- struct scatterlist assoc, pt, ct[2];
  5513. -- char aead_req_data[sizeof(struct aead_request) +
  5514. -- crypto_aead_reqsize(tfm)]
  5515. -- __aligned(__alignof__(struct aead_request));
  5516. -- struct aead_request *aead_req = (void *)aead_req_data;
  5517. --
  5518. -- if (data_len == 0)
  5519. -- return -EINVAL;
  5520. --
  5521. -- memset(aead_req, 0, sizeof(aead_req_data));
  5522. --
  5523. -- sg_init_one(&pt, data, data_len);
  5524. -- sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad));
  5525. -- sg_init_table(ct, 2);
  5526. -- sg_set_buf(&ct[0], data, data_len);
  5527. -- sg_set_buf(&ct[1], mic, IEEE80211_GCMP_MIC_LEN);
  5528. --
  5529. -- aead_request_set_tfm(aead_req, tfm);
  5530. -- aead_request_set_assoc(aead_req, &assoc, assoc.length);
  5531. -- aead_request_set_crypt(aead_req, ct, &pt,
  5532. -- data_len + IEEE80211_GCMP_MIC_LEN, j_0);
  5533. --
  5534. -- return crypto_aead_decrypt(aead_req);
  5535. --}
  5536. --
  5537. --struct crypto_aead *ieee80211_aes_gcm_key_setup_encrypt(const u8 key[],
  5538. -- size_t key_len)
  5539. --{
  5540. -- struct crypto_aead *tfm;
  5541. -- int err;
  5542. --
  5543. -- tfm = crypto_alloc_aead("gcm(aes)", 0, CRYPTO_ALG_ASYNC);
  5544. -- if (IS_ERR(tfm))
  5545. -- return tfm;
  5546. --
  5547. -- err = crypto_aead_setkey(tfm, key, key_len);
  5548. -- if (!err)
  5549. -- err = crypto_aead_setauthsize(tfm, IEEE80211_GCMP_MIC_LEN);
  5550. -- if (!err)
  5551. -- return tfm;
  5552. --
  5553. -- crypto_free_aead(tfm);
  5554. -- return ERR_PTR(err);
  5555. --}
  5556. --
  5557. --void ieee80211_aes_gcm_key_free(struct crypto_aead *tfm)
  5558. --{
  5559. -- crypto_free_aead(tfm);
  5560. --}
  5561. ---- a/net/mac80211/aes_gcm.h
  5562. -+++ /dev/null
  5563. -@@ -1,22 +0,0 @@
  5564. --/*
  5565. -- * Copyright 2014-2015, Qualcomm Atheros, Inc.
  5566. -- *
  5567. -- * This program is free software; you can redistribute it and/or modify
  5568. -- * it under the terms of the GNU General Public License version 2 as
  5569. -- * published by the Free Software Foundation.
  5570. -- */
  5571. --
  5572. --#ifndef AES_GCM_H
  5573. --#define AES_GCM_H
  5574. --
  5575. --#include <linux/crypto.h>
  5576. --
  5577. --void ieee80211_aes_gcm_encrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  5578. -- u8 *data, size_t data_len, u8 *mic);
  5579. --int ieee80211_aes_gcm_decrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  5580. -- u8 *data, size_t data_len, u8 *mic);
  5581. --struct crypto_aead *ieee80211_aes_gcm_key_setup_encrypt(const u8 key[],
  5582. -- size_t key_len);
  5583. --void ieee80211_aes_gcm_key_free(struct crypto_aead *tfm);
  5584. --
  5585. --#endif /* AES_GCM_H */
  5586. ---- a/net/mac80211/aes_gmac.c
  5587. -+++ /dev/null
  5588. -@@ -1,84 +0,0 @@
  5589. --/*
  5590. -- * AES-GMAC for IEEE 802.11 BIP-GMAC-128 and BIP-GMAC-256
  5591. -- * Copyright 2015, Qualcomm Atheros, Inc.
  5592. -- *
  5593. -- * This program is free software; you can redistribute it and/or modify
  5594. -- * it under the terms of the GNU General Public License version 2 as
  5595. -- * published by the Free Software Foundation.
  5596. -- */
  5597. --
  5598. --#include <linux/kernel.h>
  5599. --#include <linux/types.h>
  5600. --#include <linux/crypto.h>
  5601. --#include <linux/err.h>
  5602. --#include <crypto/aes.h>
  5603. --
  5604. --#include <net/mac80211.h>
  5605. --#include "key.h"
  5606. --#include "aes_gmac.h"
  5607. --
  5608. --#define GMAC_MIC_LEN 16
  5609. --#define GMAC_NONCE_LEN 12
  5610. --#define AAD_LEN 20
  5611. --
  5612. --int ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce,
  5613. -- const u8 *data, size_t data_len, u8 *mic)
  5614. --{
  5615. -- struct scatterlist sg[3], ct[1];
  5616. -- char aead_req_data[sizeof(struct aead_request) +
  5617. -- crypto_aead_reqsize(tfm)]
  5618. -- __aligned(__alignof__(struct aead_request));
  5619. -- struct aead_request *aead_req = (void *)aead_req_data;
  5620. -- u8 zero[GMAC_MIC_LEN], iv[AES_BLOCK_SIZE];
  5621. --
  5622. -- if (data_len < GMAC_MIC_LEN)
  5623. -- return -EINVAL;
  5624. --
  5625. -- memset(aead_req, 0, sizeof(aead_req_data));
  5626. --
  5627. -- memset(zero, 0, GMAC_MIC_LEN);
  5628. -- sg_init_table(sg, 3);
  5629. -- sg_set_buf(&sg[0], aad, AAD_LEN);
  5630. -- sg_set_buf(&sg[1], data, data_len - GMAC_MIC_LEN);
  5631. -- sg_set_buf(&sg[2], zero, GMAC_MIC_LEN);
  5632. --
  5633. -- memcpy(iv, nonce, GMAC_NONCE_LEN);
  5634. -- memset(iv + GMAC_NONCE_LEN, 0, sizeof(iv) - GMAC_NONCE_LEN);
  5635. -- iv[AES_BLOCK_SIZE - 1] = 0x01;
  5636. --
  5637. -- sg_init_table(ct, 1);
  5638. -- sg_set_buf(&ct[0], mic, GMAC_MIC_LEN);
  5639. --
  5640. -- aead_request_set_tfm(aead_req, tfm);
  5641. -- aead_request_set_assoc(aead_req, sg, AAD_LEN + data_len);
  5642. -- aead_request_set_crypt(aead_req, NULL, ct, 0, iv);
  5643. --
  5644. -- crypto_aead_encrypt(aead_req);
  5645. --
  5646. -- return 0;
  5647. --}
  5648. --
  5649. --struct crypto_aead *ieee80211_aes_gmac_key_setup(const u8 key[],
  5650. -- size_t key_len)
  5651. --{
  5652. -- struct crypto_aead *tfm;
  5653. -- int err;
  5654. --
  5655. -- tfm = crypto_alloc_aead("gcm(aes)", 0, CRYPTO_ALG_ASYNC);
  5656. -- if (IS_ERR(tfm))
  5657. -- return tfm;
  5658. --
  5659. -- err = crypto_aead_setkey(tfm, key, key_len);
  5660. -- if (!err)
  5661. -- return tfm;
  5662. -- if (!err)
  5663. -- err = crypto_aead_setauthsize(tfm, GMAC_MIC_LEN);
  5664. --
  5665. -- crypto_free_aead(tfm);
  5666. -- return ERR_PTR(err);
  5667. --}
  5668. --
  5669. --void ieee80211_aes_gmac_key_free(struct crypto_aead *tfm)
  5670. --{
  5671. -- crypto_free_aead(tfm);
  5672. --}
  5673. ---- a/net/mac80211/aes_gmac.h
  5674. -+++ /dev/null
  5675. -@@ -1,20 +0,0 @@
  5676. --/*
  5677. -- * Copyright 2015, Qualcomm Atheros, Inc.
  5678. -- *
  5679. -- * This program is free software; you can redistribute it and/or modify
  5680. -- * it under the terms of the GNU General Public License version 2 as
  5681. -- * published by the Free Software Foundation.
  5682. -- */
  5683. --
  5684. --#ifndef AES_GMAC_H
  5685. --#define AES_GMAC_H
  5686. --
  5687. --#include <linux/crypto.h>
  5688. --
  5689. --struct crypto_aead *ieee80211_aes_gmac_key_setup(const u8 key[],
  5690. -- size_t key_len);
  5691. --int ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce,
  5692. -- const u8 *data, size_t data_len, u8 *mic);
  5693. --void ieee80211_aes_gmac_key_free(struct crypto_aead *tfm);
  5694. --
  5695. --#endif /* AES_GMAC_H */
  5696. ---- a/net/mac80211/cfg.c
  5697. -+++ b/net/mac80211/cfg.c
  5698. -@@ -162,13 +162,8 @@ static int ieee80211_add_key(struct wiph
  5699. - return -EINVAL;
  5700. - break;
  5701. - case WLAN_CIPHER_SUITE_CCMP:
  5702. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5703. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5704. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5705. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5706. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5707. - case WLAN_CIPHER_SUITE_GCMP:
  5708. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5709. - break;
  5710. - default:
  5711. - cs = ieee80211_cs_get(local, params->cipher, sdata->vif.type);
  5712. -@@ -353,7 +348,6 @@ static int ieee80211_get_key(struct wiph
  5713. - params.seq_len = 6;
  5714. - break;
  5715. - case WLAN_CIPHER_SUITE_CCMP:
  5716. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5717. - pn64 = atomic64_read(&key->u.ccmp.tx_pn);
  5718. - seq[0] = pn64;
  5719. - seq[1] = pn64 >> 8;
  5720. -@@ -365,35 +359,10 @@ static int ieee80211_get_key(struct wiph
  5721. - params.seq_len = 6;
  5722. - break;
  5723. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5724. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5725. - pn64 = atomic64_read(&key->u.aes_cmac.tx_pn);
  5726. - seq[0] = pn64;
  5727. - seq[1] = pn64 >> 8;
  5728. - seq[2] = pn64 >> 16;
  5729. -- seq[3] = pn64 >> 24;
  5730. -- seq[4] = pn64 >> 32;
  5731. -- seq[5] = pn64 >> 40;
  5732. -- params.seq = seq;
  5733. -- params.seq_len = 6;
  5734. -- break;
  5735. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5736. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5737. -- pn64 = atomic64_read(&key->u.aes_gmac.tx_pn);
  5738. -- seq[0] = pn64;
  5739. -- seq[1] = pn64 >> 8;
  5740. -- seq[2] = pn64 >> 16;
  5741. -- seq[3] = pn64 >> 24;
  5742. -- seq[4] = pn64 >> 32;
  5743. -- seq[5] = pn64 >> 40;
  5744. -- params.seq = seq;
  5745. -- params.seq_len = 6;
  5746. -- break;
  5747. -- case WLAN_CIPHER_SUITE_GCMP:
  5748. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5749. -- pn64 = atomic64_read(&key->u.gcmp.tx_pn);
  5750. -- seq[0] = pn64;
  5751. -- seq[1] = pn64 >> 8;
  5752. -- seq[2] = pn64 >> 16;
  5753. - seq[3] = pn64 >> 24;
  5754. - seq[4] = pn64 >> 32;
  5755. - seq[5] = pn64 >> 40;
  5756. ---- a/net/mac80211/debugfs_key.c
  5757. -+++ b/net/mac80211/debugfs_key.c
  5758. -@@ -94,33 +94,17 @@ static ssize_t key_tx_spec_read(struct f
  5759. - key->u.tkip.tx.iv16);
  5760. - break;
  5761. - case WLAN_CIPHER_SUITE_CCMP:
  5762. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5763. - pn = atomic64_read(&key->u.ccmp.tx_pn);
  5764. - len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n",
  5765. - (u8)(pn >> 40), (u8)(pn >> 32), (u8)(pn >> 24),
  5766. - (u8)(pn >> 16), (u8)(pn >> 8), (u8)pn);
  5767. - break;
  5768. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5769. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5770. - pn = atomic64_read(&key->u.aes_cmac.tx_pn);
  5771. - len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n",
  5772. - (u8)(pn >> 40), (u8)(pn >> 32), (u8)(pn >> 24),
  5773. - (u8)(pn >> 16), (u8)(pn >> 8), (u8)pn);
  5774. - break;
  5775. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5776. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5777. -- pn = atomic64_read(&key->u.aes_gmac.tx_pn);
  5778. -- len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n",
  5779. -- (u8)(pn >> 40), (u8)(pn >> 32), (u8)(pn >> 24),
  5780. -- (u8)(pn >> 16), (u8)(pn >> 8), (u8)pn);
  5781. -- break;
  5782. -- case WLAN_CIPHER_SUITE_GCMP:
  5783. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5784. -- pn = atomic64_read(&key->u.gcmp.tx_pn);
  5785. -- len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n",
  5786. -- (u8)(pn >> 40), (u8)(pn >> 32), (u8)(pn >> 24),
  5787. -- (u8)(pn >> 16), (u8)(pn >> 8), (u8)pn);
  5788. -- break;
  5789. - default:
  5790. - return 0;
  5791. - }
  5792. -@@ -150,7 +134,6 @@ static ssize_t key_rx_spec_read(struct f
  5793. - len = p - buf;
  5794. - break;
  5795. - case WLAN_CIPHER_SUITE_CCMP:
  5796. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5797. - for (i = 0; i < IEEE80211_NUM_TIDS + 1; i++) {
  5798. - rpn = key->u.ccmp.rx_pn[i];
  5799. - p += scnprintf(p, sizeof(buf)+buf-p,
  5800. -@@ -161,7 +144,6 @@ static ssize_t key_rx_spec_read(struct f
  5801. - len = p - buf;
  5802. - break;
  5803. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5804. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5805. - rpn = key->u.aes_cmac.rx_pn;
  5806. - p += scnprintf(p, sizeof(buf)+buf-p,
  5807. - "%02x%02x%02x%02x%02x%02x\n",
  5808. -@@ -169,26 +151,6 @@ static ssize_t key_rx_spec_read(struct f
  5809. - rpn[3], rpn[4], rpn[5]);
  5810. - len = p - buf;
  5811. - break;
  5812. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5813. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5814. -- rpn = key->u.aes_gmac.rx_pn;
  5815. -- p += scnprintf(p, sizeof(buf)+buf-p,
  5816. -- "%02x%02x%02x%02x%02x%02x\n",
  5817. -- rpn[0], rpn[1], rpn[2],
  5818. -- rpn[3], rpn[4], rpn[5]);
  5819. -- len = p - buf;
  5820. -- break;
  5821. -- case WLAN_CIPHER_SUITE_GCMP:
  5822. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5823. -- for (i = 0; i < IEEE80211_NUM_TIDS + 1; i++) {
  5824. -- rpn = key->u.gcmp.rx_pn[i];
  5825. -- p += scnprintf(p, sizeof(buf)+buf-p,
  5826. -- "%02x%02x%02x%02x%02x%02x\n",
  5827. -- rpn[0], rpn[1], rpn[2],
  5828. -- rpn[3], rpn[4], rpn[5]);
  5829. -- }
  5830. -- len = p - buf;
  5831. -- break;
  5832. - default:
  5833. - return 0;
  5834. - }
  5835. -@@ -205,23 +167,12 @@ static ssize_t key_replays_read(struct f
  5836. -
  5837. - switch (key->conf.cipher) {
  5838. - case WLAN_CIPHER_SUITE_CCMP:
  5839. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5840. - len = scnprintf(buf, sizeof(buf), "%u\n", key->u.ccmp.replays);
  5841. - break;
  5842. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5843. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5844. - len = scnprintf(buf, sizeof(buf), "%u\n",
  5845. - key->u.aes_cmac.replays);
  5846. - break;
  5847. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5848. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5849. -- len = scnprintf(buf, sizeof(buf), "%u\n",
  5850. -- key->u.aes_gmac.replays);
  5851. -- break;
  5852. -- case WLAN_CIPHER_SUITE_GCMP:
  5853. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5854. -- len = scnprintf(buf, sizeof(buf), "%u\n", key->u.gcmp.replays);
  5855. -- break;
  5856. - default:
  5857. - return 0;
  5858. - }
  5859. -@@ -238,15 +189,9 @@ static ssize_t key_icverrors_read(struct
  5860. -
  5861. - switch (key->conf.cipher) {
  5862. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5863. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5864. - len = scnprintf(buf, sizeof(buf), "%u\n",
  5865. - key->u.aes_cmac.icverrors);
  5866. - break;
  5867. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5868. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5869. -- len = scnprintf(buf, sizeof(buf), "%u\n",
  5870. -- key->u.aes_gmac.icverrors);
  5871. -- break;
  5872. - default:
  5873. - return 0;
  5874. - }
  5875. ---- a/net/mac80211/key.c
  5876. -+++ b/net/mac80211/key.c
  5877. -@@ -24,8 +24,6 @@
  5878. - #include "debugfs_key.h"
  5879. - #include "aes_ccm.h"
  5880. - #include "aes_cmac.h"
  5881. --#include "aes_gmac.h"
  5882. --#include "aes_gcm.h"
  5883. -
  5884. -
  5885. - /**
  5886. -@@ -164,13 +162,7 @@ static int ieee80211_key_enable_hw_accel
  5887. - case WLAN_CIPHER_SUITE_WEP104:
  5888. - case WLAN_CIPHER_SUITE_TKIP:
  5889. - case WLAN_CIPHER_SUITE_CCMP:
  5890. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5891. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5892. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5893. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5894. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5895. -- case WLAN_CIPHER_SUITE_GCMP:
  5896. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5897. - /* all of these we can do in software - if driver can */
  5898. - if (ret == 1)
  5899. - return 0;
  5900. -@@ -394,26 +386,7 @@ ieee80211_key_alloc(u32 cipher, int idx,
  5901. - * Initialize AES key state here as an optimization so that
  5902. - * it does not need to be initialized for every packet.
  5903. - */
  5904. -- key->u.ccmp.tfm = ieee80211_aes_key_setup_encrypt(
  5905. -- key_data, key_len, IEEE80211_CCMP_MIC_LEN);
  5906. -- if (IS_ERR(key->u.ccmp.tfm)) {
  5907. -- err = PTR_ERR(key->u.ccmp.tfm);
  5908. -- kfree(key);
  5909. -- return ERR_PTR(err);
  5910. -- }
  5911. -- break;
  5912. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5913. -- key->conf.iv_len = IEEE80211_CCMP_256_HDR_LEN;
  5914. -- key->conf.icv_len = IEEE80211_CCMP_256_MIC_LEN;
  5915. -- for (i = 0; seq && i < IEEE80211_NUM_TIDS + 1; i++)
  5916. -- for (j = 0; j < IEEE80211_CCMP_256_PN_LEN; j++)
  5917. -- key->u.ccmp.rx_pn[i][j] =
  5918. -- seq[IEEE80211_CCMP_256_PN_LEN - j - 1];
  5919. -- /* Initialize AES key state here as an optimization so that
  5920. -- * it does not need to be initialized for every packet.
  5921. -- */
  5922. -- key->u.ccmp.tfm = ieee80211_aes_key_setup_encrypt(
  5923. -- key_data, key_len, IEEE80211_CCMP_256_MIC_LEN);
  5924. -+ key->u.ccmp.tfm = ieee80211_aes_key_setup_encrypt(key_data);
  5925. - if (IS_ERR(key->u.ccmp.tfm)) {
  5926. - err = PTR_ERR(key->u.ccmp.tfm);
  5927. - kfree(key);
  5928. -@@ -421,12 +394,8 @@ ieee80211_key_alloc(u32 cipher, int idx,
  5929. - }
  5930. - break;
  5931. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5932. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5933. - key->conf.iv_len = 0;
  5934. -- if (cipher == WLAN_CIPHER_SUITE_AES_CMAC)
  5935. -- key->conf.icv_len = sizeof(struct ieee80211_mmie);
  5936. -- else
  5937. -- key->conf.icv_len = sizeof(struct ieee80211_mmie_16);
  5938. -+ key->conf.icv_len = sizeof(struct ieee80211_mmie);
  5939. - if (seq)
  5940. - for (j = 0; j < IEEE80211_CMAC_PN_LEN; j++)
  5941. - key->u.aes_cmac.rx_pn[j] =
  5942. -@@ -436,51 +405,13 @@ ieee80211_key_alloc(u32 cipher, int idx,
  5943. - * it does not need to be initialized for every packet.
  5944. - */
  5945. - key->u.aes_cmac.tfm =
  5946. -- ieee80211_aes_cmac_key_setup(key_data, key_len);
  5947. -+ ieee80211_aes_cmac_key_setup(key_data);
  5948. - if (IS_ERR(key->u.aes_cmac.tfm)) {
  5949. - err = PTR_ERR(key->u.aes_cmac.tfm);
  5950. - kfree(key);
  5951. - return ERR_PTR(err);
  5952. - }
  5953. - break;
  5954. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5955. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5956. -- key->conf.iv_len = 0;
  5957. -- key->conf.icv_len = sizeof(struct ieee80211_mmie_16);
  5958. -- if (seq)
  5959. -- for (j = 0; j < IEEE80211_GMAC_PN_LEN; j++)
  5960. -- key->u.aes_gmac.rx_pn[j] =
  5961. -- seq[IEEE80211_GMAC_PN_LEN - j - 1];
  5962. -- /* Initialize AES key state here as an optimization so that
  5963. -- * it does not need to be initialized for every packet.
  5964. -- */
  5965. -- key->u.aes_gmac.tfm =
  5966. -- ieee80211_aes_gmac_key_setup(key_data, key_len);
  5967. -- if (IS_ERR(key->u.aes_gmac.tfm)) {
  5968. -- err = PTR_ERR(key->u.aes_gmac.tfm);
  5969. -- kfree(key);
  5970. -- return ERR_PTR(err);
  5971. -- }
  5972. -- break;
  5973. -- case WLAN_CIPHER_SUITE_GCMP:
  5974. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5975. -- key->conf.iv_len = IEEE80211_GCMP_HDR_LEN;
  5976. -- key->conf.icv_len = IEEE80211_GCMP_MIC_LEN;
  5977. -- for (i = 0; seq && i < IEEE80211_NUM_TIDS + 1; i++)
  5978. -- for (j = 0; j < IEEE80211_GCMP_PN_LEN; j++)
  5979. -- key->u.gcmp.rx_pn[i][j] =
  5980. -- seq[IEEE80211_GCMP_PN_LEN - j - 1];
  5981. -- /* Initialize AES key state here as an optimization so that
  5982. -- * it does not need to be initialized for every packet.
  5983. -- */
  5984. -- key->u.gcmp.tfm = ieee80211_aes_gcm_key_setup_encrypt(key_data,
  5985. -- key_len);
  5986. -- if (IS_ERR(key->u.gcmp.tfm)) {
  5987. -- err = PTR_ERR(key->u.gcmp.tfm);
  5988. -- kfree(key);
  5989. -- return ERR_PTR(err);
  5990. -- }
  5991. -- break;
  5992. - default:
  5993. - if (cs) {
  5994. - size_t len = (seq_len > MAX_PN_LEN) ?
  5995. -@@ -502,24 +433,10 @@ ieee80211_key_alloc(u32 cipher, int idx,
  5996. -
  5997. - static void ieee80211_key_free_common(struct ieee80211_key *key)
  5998. - {
  5999. -- switch (key->conf.cipher) {
  6000. -- case WLAN_CIPHER_SUITE_CCMP:
  6001. -- case WLAN_CIPHER_SUITE_CCMP_256:
  6002. -+ if (key->conf.cipher == WLAN_CIPHER_SUITE_CCMP)
  6003. - ieee80211_aes_key_free(key->u.ccmp.tfm);
  6004. -- break;
  6005. -- case WLAN_CIPHER_SUITE_AES_CMAC:
  6006. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  6007. -+ if (key->conf.cipher == WLAN_CIPHER_SUITE_AES_CMAC)
  6008. - ieee80211_aes_cmac_key_free(key->u.aes_cmac.tfm);
  6009. -- break;
  6010. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  6011. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  6012. -- ieee80211_aes_gmac_key_free(key->u.aes_gmac.tfm);
  6013. -- break;
  6014. -- case WLAN_CIPHER_SUITE_GCMP:
  6015. -- case WLAN_CIPHER_SUITE_GCMP_256:
  6016. -- ieee80211_aes_gcm_key_free(key->u.gcmp.tfm);
  6017. -- break;
  6018. -- }
  6019. - kzfree(key);
  6020. - }
  6021. -
  6022. -@@ -826,7 +743,6 @@ void ieee80211_get_key_tx_seq(struct iee
  6023. - seq->tkip.iv16 = key->u.tkip.tx.iv16;
  6024. - break;
  6025. - case WLAN_CIPHER_SUITE_CCMP:
  6026. -- case WLAN_CIPHER_SUITE_CCMP_256:
  6027. - pn64 = atomic64_read(&key->u.ccmp.tx_pn);
  6028. - seq->ccmp.pn[5] = pn64;
  6029. - seq->ccmp.pn[4] = pn64 >> 8;
  6030. -@@ -836,7 +752,6 @@ void ieee80211_get_key_tx_seq(struct iee
  6031. - seq->ccmp.pn[0] = pn64 >> 40;
  6032. - break;
  6033. - case WLAN_CIPHER_SUITE_AES_CMAC:
  6034. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  6035. - pn64 = atomic64_read(&key->u.aes_cmac.tx_pn);
  6036. - seq->ccmp.pn[5] = pn64;
  6037. - seq->ccmp.pn[4] = pn64 >> 8;
  6038. -@@ -845,26 +760,6 @@ void ieee80211_get_key_tx_seq(struct iee
  6039. - seq->ccmp.pn[1] = pn64 >> 32;
  6040. - seq->ccmp.pn[0] = pn64 >> 40;
  6041. - break;
  6042. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  6043. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  6044. -- pn64 = atomic64_read(&key->u.aes_gmac.tx_pn);
  6045. -- seq->ccmp.pn[5] = pn64;
  6046. -- seq->ccmp.pn[4] = pn64 >> 8;
  6047. -- seq->ccmp.pn[3] = pn64 >> 16;
  6048. -- seq->ccmp.pn[2] = pn64 >> 24;
  6049. -- seq->ccmp.pn[1] = pn64 >> 32;
  6050. -- seq->ccmp.pn[0] = pn64 >> 40;
  6051. -- break;
  6052. -- case WLAN_CIPHER_SUITE_GCMP:
  6053. -- case WLAN_CIPHER_SUITE_GCMP_256:
  6054. -- pn64 = atomic64_read(&key->u.gcmp.tx_pn);
  6055. -- seq->gcmp.pn[5] = pn64;
  6056. -- seq->gcmp.pn[4] = pn64 >> 8;
  6057. -- seq->gcmp.pn[3] = pn64 >> 16;
  6058. -- seq->gcmp.pn[2] = pn64 >> 24;
  6059. -- seq->gcmp.pn[1] = pn64 >> 32;
  6060. -- seq->gcmp.pn[0] = pn64 >> 40;
  6061. -- break;
  6062. - default:
  6063. - WARN_ON(1);
  6064. - }
  6065. -@@ -887,7 +782,6 @@ void ieee80211_get_key_rx_seq(struct iee
  6066. - seq->tkip.iv16 = key->u.tkip.rx[tid].iv16;
  6067. - break;
  6068. - case WLAN_CIPHER_SUITE_CCMP:
  6069. -- case WLAN_CIPHER_SUITE_CCMP_256:
  6070. - if (WARN_ON(tid < -1 || tid >= IEEE80211_NUM_TIDS))
  6071. - return;
  6072. - if (tid < 0)
  6073. -@@ -897,29 +791,11 @@ void ieee80211_get_key_rx_seq(struct iee
  6074. - memcpy(seq->ccmp.pn, pn, IEEE80211_CCMP_PN_LEN);
  6075. - break;
  6076. - case WLAN_CIPHER_SUITE_AES_CMAC:
  6077. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  6078. - if (WARN_ON(tid != 0))
  6079. - return;
  6080. - pn = key->u.aes_cmac.rx_pn;
  6081. - memcpy(seq->aes_cmac.pn, pn, IEEE80211_CMAC_PN_LEN);
  6082. - break;
  6083. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  6084. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  6085. -- if (WARN_ON(tid != 0))
  6086. -- return;
  6087. -- pn = key->u.aes_gmac.rx_pn;
  6088. -- memcpy(seq->aes_gmac.pn, pn, IEEE80211_GMAC_PN_LEN);
  6089. -- break;
  6090. -- case WLAN_CIPHER_SUITE_GCMP:
  6091. -- case WLAN_CIPHER_SUITE_GCMP_256:
  6092. -- if (WARN_ON(tid < -1 || tid >= IEEE80211_NUM_TIDS))
  6093. -- return;
  6094. -- if (tid < 0)
  6095. -- pn = key->u.gcmp.rx_pn[IEEE80211_NUM_TIDS];
  6096. -- else
  6097. -- pn = key->u.gcmp.rx_pn[tid];
  6098. -- memcpy(seq->gcmp.pn, pn, IEEE80211_GCMP_PN_LEN);
  6099. -- break;
  6100. - }
  6101. - }
  6102. - EXPORT_SYMBOL(ieee80211_get_key_rx_seq);
  6103. -@@ -938,7 +814,6 @@ void ieee80211_set_key_tx_seq(struct iee
  6104. - key->u.tkip.tx.iv16 = seq->tkip.iv16;
  6105. - break;
  6106. - case WLAN_CIPHER_SUITE_CCMP:
  6107. -- case WLAN_CIPHER_SUITE_CCMP_256:
  6108. - pn64 = (u64)seq->ccmp.pn[5] |
  6109. - ((u64)seq->ccmp.pn[4] << 8) |
  6110. - ((u64)seq->ccmp.pn[3] << 16) |
  6111. -@@ -948,7 +823,6 @@ void ieee80211_set_key_tx_seq(struct iee
  6112. - atomic64_set(&key->u.ccmp.tx_pn, pn64);
  6113. - break;
  6114. - case WLAN_CIPHER_SUITE_AES_CMAC:
  6115. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  6116. - pn64 = (u64)seq->aes_cmac.pn[5] |
  6117. - ((u64)seq->aes_cmac.pn[4] << 8) |
  6118. - ((u64)seq->aes_cmac.pn[3] << 16) |
  6119. -@@ -957,26 +831,6 @@ void ieee80211_set_key_tx_seq(struct iee
  6120. - ((u64)seq->aes_cmac.pn[0] << 40);
  6121. - atomic64_set(&key->u.aes_cmac.tx_pn, pn64);
  6122. - break;
  6123. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  6124. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  6125. -- pn64 = (u64)seq->aes_gmac.pn[5] |
  6126. -- ((u64)seq->aes_gmac.pn[4] << 8) |
  6127. -- ((u64)seq->aes_gmac.pn[3] << 16) |
  6128. -- ((u64)seq->aes_gmac.pn[2] << 24) |
  6129. -- ((u64)seq->aes_gmac.pn[1] << 32) |
  6130. -- ((u64)seq->aes_gmac.pn[0] << 40);
  6131. -- atomic64_set(&key->u.aes_gmac.tx_pn, pn64);
  6132. -- break;
  6133. -- case WLAN_CIPHER_SUITE_GCMP:
  6134. -- case WLAN_CIPHER_SUITE_GCMP_256:
  6135. -- pn64 = (u64)seq->gcmp.pn[5] |
  6136. -- ((u64)seq->gcmp.pn[4] << 8) |
  6137. -- ((u64)seq->gcmp.pn[3] << 16) |
  6138. -- ((u64)seq->gcmp.pn[2] << 24) |
  6139. -- ((u64)seq->gcmp.pn[1] << 32) |
  6140. -- ((u64)seq->gcmp.pn[0] << 40);
  6141. -- atomic64_set(&key->u.gcmp.tx_pn, pn64);
  6142. -- break;
  6143. - default:
  6144. - WARN_ON(1);
  6145. - break;
  6146. -@@ -1000,7 +854,6 @@ void ieee80211_set_key_rx_seq(struct iee
  6147. - key->u.tkip.rx[tid].iv16 = seq->tkip.iv16;
  6148. - break;
  6149. - case WLAN_CIPHER_SUITE_CCMP:
  6150. -- case WLAN_CIPHER_SUITE_CCMP_256:
  6151. - if (WARN_ON(tid < -1 || tid >= IEEE80211_NUM_TIDS))
  6152. - return;
  6153. - if (tid < 0)
  6154. -@@ -1010,29 +863,11 @@ void ieee80211_set_key_rx_seq(struct iee
  6155. - memcpy(pn, seq->ccmp.pn, IEEE80211_CCMP_PN_LEN);
  6156. - break;
  6157. - case WLAN_CIPHER_SUITE_AES_CMAC:
  6158. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  6159. - if (WARN_ON(tid != 0))
  6160. - return;
  6161. - pn = key->u.aes_cmac.rx_pn;
  6162. - memcpy(pn, seq->aes_cmac.pn, IEEE80211_CMAC_PN_LEN);
  6163. - break;
  6164. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  6165. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  6166. -- if (WARN_ON(tid != 0))
  6167. -- return;
  6168. -- pn = key->u.aes_gmac.rx_pn;
  6169. -- memcpy(pn, seq->aes_gmac.pn, IEEE80211_GMAC_PN_LEN);
  6170. -- break;
  6171. -- case WLAN_CIPHER_SUITE_GCMP:
  6172. -- case WLAN_CIPHER_SUITE_GCMP_256:
  6173. -- if (WARN_ON(tid < -1 || tid >= IEEE80211_NUM_TIDS))
  6174. -- return;
  6175. -- if (tid < 0)
  6176. -- pn = key->u.gcmp.rx_pn[IEEE80211_NUM_TIDS];
  6177. -- else
  6178. -- pn = key->u.gcmp.rx_pn[tid];
  6179. -- memcpy(pn, seq->gcmp.pn, IEEE80211_GCMP_PN_LEN);
  6180. -- break;
  6181. - default:
  6182. - WARN_ON(1);
  6183. - break;
  6184. ---- a/net/mac80211/key.h
  6185. -+++ b/net/mac80211/key.h
  6186. -@@ -84,7 +84,7 @@ struct ieee80211_key {
  6187. - * Management frames.
  6188. - */
  6189. - u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_CCMP_PN_LEN];
  6190. -- struct crypto_aead *tfm;
  6191. -+ struct crypto_cipher *tfm;
  6192. - u32 replays; /* dot11RSNAStatsCCMPReplays */
  6193. - } ccmp;
  6194. - struct {
  6195. -@@ -95,24 +95,6 @@ struct ieee80211_key {
  6196. - u32 icverrors; /* dot11RSNAStatsCMACICVErrors */
  6197. - } aes_cmac;
  6198. - struct {
  6199. -- atomic64_t tx_pn;
  6200. -- u8 rx_pn[IEEE80211_GMAC_PN_LEN];
  6201. -- struct crypto_aead *tfm;
  6202. -- u32 replays; /* dot11RSNAStatsCMACReplays */
  6203. -- u32 icverrors; /* dot11RSNAStatsCMACICVErrors */
  6204. -- } aes_gmac;
  6205. -- struct {
  6206. -- atomic64_t tx_pn;
  6207. -- /* Last received packet number. The first
  6208. -- * IEEE80211_NUM_TIDS counters are used with Data
  6209. -- * frames and the last counter is used with Robust
  6210. -- * Management frames.
  6211. -- */
  6212. -- u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_GCMP_PN_LEN];
  6213. -- struct crypto_aead *tfm;
  6214. -- u32 replays; /* dot11RSNAStatsGCMPReplays */
  6215. -- } gcmp;
  6216. -- struct {
  6217. - /* generic cipher scheme */
  6218. - u8 rx_pn[IEEE80211_NUM_TIDS + 1][MAX_PN_LEN];
  6219. - } gen;
  6220. ---- a/net/mac80211/main.c
  6221. -+++ b/net/mac80211/main.c
  6222. -@@ -666,15 +666,9 @@ static int ieee80211_init_cipher_suites(
  6223. - WLAN_CIPHER_SUITE_WEP104,
  6224. - WLAN_CIPHER_SUITE_TKIP,
  6225. - WLAN_CIPHER_SUITE_CCMP,
  6226. -- WLAN_CIPHER_SUITE_CCMP_256,
  6227. -- WLAN_CIPHER_SUITE_GCMP,
  6228. -- WLAN_CIPHER_SUITE_GCMP_256,
  6229. -
  6230. - /* keep last -- depends on hw flags! */
  6231. -- WLAN_CIPHER_SUITE_AES_CMAC,
  6232. -- WLAN_CIPHER_SUITE_BIP_CMAC_256,
  6233. -- WLAN_CIPHER_SUITE_BIP_GMAC_128,
  6234. -- WLAN_CIPHER_SUITE_BIP_GMAC_256,
  6235. -+ WLAN_CIPHER_SUITE_AES_CMAC
  6236. - };
  6237. -
  6238. - if (local->hw.flags & IEEE80211_HW_SW_CRYPTO_CONTROL ||
  6239. -@@ -713,7 +707,7 @@ static int ieee80211_init_cipher_suites(
  6240. - local->hw.wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  6241. -
  6242. - if (!have_mfp)
  6243. -- local->hw.wiphy->n_cipher_suites -= 4;
  6244. -+ local->hw.wiphy->n_cipher_suites--;
  6245. -
  6246. - if (!have_wep) {
  6247. - local->hw.wiphy->cipher_suites += 2;
  6248. -@@ -730,42 +724,32 @@ static int ieee80211_init_cipher_suites(
  6249. - /* Driver specifies cipher schemes only (but not cipher suites
  6250. - * including the schemes)
  6251. - *
  6252. -- * We start counting ciphers defined by schemes, TKIP, CCMP,
  6253. -- * CCMP-256, GCMP, and GCMP-256
  6254. -+ * We start counting ciphers defined by schemes, TKIP and CCMP
  6255. - */
  6256. -- n_suites = local->hw.n_cipher_schemes + 5;
  6257. -+ n_suites = local->hw.n_cipher_schemes + 2;
  6258. -
  6259. - /* check if we have WEP40 and WEP104 */
  6260. - if (have_wep)
  6261. - n_suites += 2;
  6262. -
  6263. -- /* check if we have AES_CMAC, BIP-CMAC-256, BIP-GMAC-128,
  6264. -- * BIP-GMAC-256
  6265. -- */
  6266. -+ /* check if we have AES_CMAC */
  6267. - if (have_mfp)
  6268. -- n_suites += 4;
  6269. -+ n_suites++;
  6270. -
  6271. - suites = kmalloc(sizeof(u32) * n_suites, GFP_KERNEL);
  6272. - if (!suites)
  6273. - return -ENOMEM;
  6274. -
  6275. - suites[w++] = WLAN_CIPHER_SUITE_CCMP;
  6276. -- suites[w++] = WLAN_CIPHER_SUITE_CCMP_256;
  6277. - suites[w++] = WLAN_CIPHER_SUITE_TKIP;
  6278. -- suites[w++] = WLAN_CIPHER_SUITE_GCMP;
  6279. -- suites[w++] = WLAN_CIPHER_SUITE_GCMP_256;
  6280. -
  6281. - if (have_wep) {
  6282. - suites[w++] = WLAN_CIPHER_SUITE_WEP40;
  6283. - suites[w++] = WLAN_CIPHER_SUITE_WEP104;
  6284. - }
  6285. -
  6286. -- if (have_mfp) {
  6287. -+ if (have_mfp)
  6288. - suites[w++] = WLAN_CIPHER_SUITE_AES_CMAC;
  6289. -- suites[w++] = WLAN_CIPHER_SUITE_BIP_CMAC_256;
  6290. -- suites[w++] = WLAN_CIPHER_SUITE_BIP_GMAC_128;
  6291. -- suites[w++] = WLAN_CIPHER_SUITE_BIP_GMAC_256;
  6292. -- }
  6293. -
  6294. - for (r = 0; r < local->hw.n_cipher_schemes; r++)
  6295. - suites[w++] = cs[r].cipher;
  6296. ---- a/net/mac80211/rx.c
  6297. -+++ b/net/mac80211/rx.c
  6298. -@@ -647,7 +647,6 @@ static int ieee80211_get_mmie_keyidx(str
  6299. - {
  6300. - struct ieee80211_mgmt *hdr = (struct ieee80211_mgmt *) skb->data;
  6301. - struct ieee80211_mmie *mmie;
  6302. -- struct ieee80211_mmie_16 *mmie16;
  6303. -
  6304. - if (skb->len < 24 + sizeof(*mmie) || !is_multicast_ether_addr(hdr->da))
  6305. - return -1;
  6306. -@@ -657,18 +656,11 @@ static int ieee80211_get_mmie_keyidx(str
  6307. -
  6308. - mmie = (struct ieee80211_mmie *)
  6309. - (skb->data + skb->len - sizeof(*mmie));
  6310. -- if (mmie->element_id == WLAN_EID_MMIE &&
  6311. -- mmie->length == sizeof(*mmie) - 2)
  6312. -- return le16_to_cpu(mmie->key_id);
  6313. --
  6314. -- mmie16 = (struct ieee80211_mmie_16 *)
  6315. -- (skb->data + skb->len - sizeof(*mmie16));
  6316. -- if (skb->len >= 24 + sizeof(*mmie16) &&
  6317. -- mmie16->element_id == WLAN_EID_MMIE &&
  6318. -- mmie16->length == sizeof(*mmie16) - 2)
  6319. -- return le16_to_cpu(mmie16->key_id);
  6320. -+ if (mmie->element_id != WLAN_EID_MMIE ||
  6321. -+ mmie->length != sizeof(*mmie) - 2)
  6322. -+ return -1;
  6323. -
  6324. -- return -1;
  6325. -+ return le16_to_cpu(mmie->key_id);
  6326. - }
  6327. -
  6328. - static int iwl80211_get_cs_keyid(const struct ieee80211_cipher_scheme *cs,
  6329. -@@ -1658,27 +1650,11 @@ ieee80211_rx_h_decrypt(struct ieee80211_
  6330. - result = ieee80211_crypto_tkip_decrypt(rx);
  6331. - break;
  6332. - case WLAN_CIPHER_SUITE_CCMP:
  6333. -- result = ieee80211_crypto_ccmp_decrypt(
  6334. -- rx, IEEE80211_CCMP_MIC_LEN);
  6335. -- break;
  6336. -- case WLAN_CIPHER_SUITE_CCMP_256:
  6337. -- result = ieee80211_crypto_ccmp_decrypt(
  6338. -- rx, IEEE80211_CCMP_256_MIC_LEN);
  6339. -+ result = ieee80211_crypto_ccmp_decrypt(rx);
  6340. - break;
  6341. - case WLAN_CIPHER_SUITE_AES_CMAC:
  6342. - result = ieee80211_crypto_aes_cmac_decrypt(rx);
  6343. - break;
  6344. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  6345. -- result = ieee80211_crypto_aes_cmac_256_decrypt(rx);
  6346. -- break;
  6347. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  6348. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  6349. -- result = ieee80211_crypto_aes_gmac_decrypt(rx);
  6350. -- break;
  6351. -- case WLAN_CIPHER_SUITE_GCMP:
  6352. -- case WLAN_CIPHER_SUITE_GCMP_256:
  6353. -- result = ieee80211_crypto_gcmp_decrypt(rx);
  6354. -- break;
  6355. - default:
  6356. - result = ieee80211_crypto_hw_decrypt(rx);
  6357. - }
  6358. -@@ -1805,9 +1781,7 @@ ieee80211_rx_h_defragment(struct ieee802
  6359. - /* This is the first fragment of a new frame. */
  6360. - entry = ieee80211_reassemble_add(rx->sdata, frag, seq,
  6361. - rx->seqno_idx, &(rx->skb));
  6362. -- if (rx->key &&
  6363. -- (rx->key->conf.cipher == WLAN_CIPHER_SUITE_CCMP ||
  6364. -- rx->key->conf.cipher == WLAN_CIPHER_SUITE_CCMP_256) &&
  6365. -+ if (rx->key && rx->key->conf.cipher == WLAN_CIPHER_SUITE_CCMP &&
  6366. - ieee80211_has_protected(fc)) {
  6367. - int queue = rx->security_idx;
  6368. - /* Store CCMP PN so that we can verify that the next
  6369. -@@ -1836,9 +1810,7 @@ ieee80211_rx_h_defragment(struct ieee802
  6370. - int i;
  6371. - u8 pn[IEEE80211_CCMP_PN_LEN], *rpn;
  6372. - int queue;
  6373. -- if (!rx->key ||
  6374. -- (rx->key->conf.cipher != WLAN_CIPHER_SUITE_CCMP &&
  6375. -- rx->key->conf.cipher != WLAN_CIPHER_SUITE_CCMP_256))
  6376. -+ if (!rx->key || rx->key->conf.cipher != WLAN_CIPHER_SUITE_CCMP)
  6377. - return RX_DROP_UNUSABLE;
  6378. - memcpy(pn, entry->last_pn, IEEE80211_CCMP_PN_LEN);
  6379. - for (i = IEEE80211_CCMP_PN_LEN - 1; i >= 0; i--) {
  6380. ---- a/net/mac80211/tx.c
  6381. -+++ b/net/mac80211/tx.c
  6382. -@@ -626,9 +626,6 @@ ieee80211_tx_h_select_key(struct ieee802
  6383. - tx->key = NULL;
  6384. - break;
  6385. - case WLAN_CIPHER_SUITE_CCMP:
  6386. -- case WLAN_CIPHER_SUITE_CCMP_256:
  6387. -- case WLAN_CIPHER_SUITE_GCMP:
  6388. -- case WLAN_CIPHER_SUITE_GCMP_256:
  6389. - if (!ieee80211_is_data_present(hdr->frame_control) &&
  6390. - !ieee80211_use_mfp(hdr->frame_control, tx->sta,
  6391. - tx->skb))
  6392. -@@ -639,9 +636,6 @@ ieee80211_tx_h_select_key(struct ieee802
  6393. - ieee80211_is_mgmt(hdr->frame_control);
  6394. - break;
  6395. - case WLAN_CIPHER_SUITE_AES_CMAC:
  6396. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  6397. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  6398. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  6399. - if (!ieee80211_is_mgmt(hdr->frame_control))
  6400. - tx->key = NULL;
  6401. - break;
  6402. -@@ -1017,21 +1011,9 @@ ieee80211_tx_h_encrypt(struct ieee80211_
  6403. - case WLAN_CIPHER_SUITE_TKIP:
  6404. - return ieee80211_crypto_tkip_encrypt(tx);
  6405. - case WLAN_CIPHER_SUITE_CCMP:
  6406. -- return ieee80211_crypto_ccmp_encrypt(
  6407. -- tx, IEEE80211_CCMP_MIC_LEN);
  6408. -- case WLAN_CIPHER_SUITE_CCMP_256:
  6409. -- return ieee80211_crypto_ccmp_encrypt(
  6410. -- tx, IEEE80211_CCMP_256_MIC_LEN);
  6411. -+ return ieee80211_crypto_ccmp_encrypt(tx);
  6412. - case WLAN_CIPHER_SUITE_AES_CMAC:
  6413. - return ieee80211_crypto_aes_cmac_encrypt(tx);
  6414. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  6415. -- return ieee80211_crypto_aes_cmac_256_encrypt(tx);
  6416. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  6417. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  6418. -- return ieee80211_crypto_aes_gmac_encrypt(tx);
  6419. -- case WLAN_CIPHER_SUITE_GCMP:
  6420. -- case WLAN_CIPHER_SUITE_GCMP_256:
  6421. -- return ieee80211_crypto_gcmp_encrypt(tx);
  6422. - default:
  6423. - return ieee80211_crypto_hw_encrypt(tx);
  6424. - }
  6425. ---- a/net/mac80211/wpa.c
  6426. -+++ b/net/mac80211/wpa.c
  6427. -@@ -22,8 +22,6 @@
  6428. - #include "tkip.h"
  6429. - #include "aes_ccm.h"
  6430. - #include "aes_cmac.h"
  6431. --#include "aes_gmac.h"
  6432. --#include "aes_gcm.h"
  6433. - #include "wpa.h"
  6434. -
  6435. - ieee80211_tx_result
  6436. -@@ -304,15 +302,22 @@ ieee80211_crypto_tkip_decrypt(struct iee
  6437. - }
  6438. -
  6439. -
  6440. --static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad)
  6441. -+static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *scratch,
  6442. -+ int encrypted)
  6443. - {
  6444. - __le16 mask_fc;
  6445. - int a4_included, mgmt;
  6446. - u8 qos_tid;
  6447. -- u16 len_a;
  6448. -+ u8 *b_0, *aad;
  6449. -+ u16 data_len, len_a;
  6450. - unsigned int hdrlen;
  6451. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  6452. -
  6453. -+ memset(scratch, 0, 6 * AES_BLOCK_SIZE);
  6454. -+
  6455. -+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
  6456. -+ aad = scratch + 4 * AES_BLOCK_SIZE;
  6457. -+
  6458. - /*
  6459. - * Mask FC: zero subtype b4 b5 b6 (if not mgmt)
  6460. - * Retry, PwrMgt, MoreData; set Protected
  6461. -@@ -334,21 +339,20 @@ static void ccmp_special_blocks(struct s
  6462. - else
  6463. - qos_tid = 0;
  6464. -
  6465. -- /* In CCM, the initial vectors (IV) used for CTR mode encryption and CBC
  6466. -- * mode authentication are not allowed to collide, yet both are derived
  6467. -- * from this vector b_0. We only set L := 1 here to indicate that the
  6468. -- * data size can be represented in (L+1) bytes. The CCM layer will take
  6469. -- * care of storing the data length in the top (L+1) bytes and setting
  6470. -- * and clearing the other bits as is required to derive the two IVs.
  6471. -- */
  6472. -- b_0[0] = 0x1;
  6473. -+ data_len = skb->len - hdrlen - IEEE80211_CCMP_HDR_LEN;
  6474. -+ if (encrypted)
  6475. -+ data_len -= IEEE80211_CCMP_MIC_LEN;
  6476. -
  6477. -+ /* First block, b_0 */
  6478. -+ b_0[0] = 0x59; /* flags: Adata: 1, M: 011, L: 001 */
  6479. - /* Nonce: Nonce Flags | A2 | PN
  6480. - * Nonce Flags: Priority (b0..b3) | Management (b4) | Reserved (b5..b7)
  6481. - */
  6482. - b_0[1] = qos_tid | (mgmt << 4);
  6483. - memcpy(&b_0[2], hdr->addr2, ETH_ALEN);
  6484. - memcpy(&b_0[8], pn, IEEE80211_CCMP_PN_LEN);
  6485. -+ /* l(m) */
  6486. -+ put_unaligned_be16(data_len, &b_0[14]);
  6487. -
  6488. - /* AAD (extra authenticate-only data) / masked 802.11 header
  6489. - * FC | A1 | A2 | A3 | SC | [A4] | [QC] */
  6490. -@@ -395,8 +399,7 @@ static inline void ccmp_hdr2pn(u8 *pn, u
  6491. - }
  6492. -
  6493. -
  6494. --static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb,
  6495. -- unsigned int mic_len)
  6496. -+static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
  6497. - {
  6498. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  6499. - struct ieee80211_key *key = tx->key;
  6500. -@@ -405,8 +408,7 @@ static int ccmp_encrypt_skb(struct ieee8
  6501. - u8 *pos;
  6502. - u8 pn[6];
  6503. - u64 pn64;
  6504. -- u8 aad[2 * AES_BLOCK_SIZE];
  6505. -- u8 b_0[AES_BLOCK_SIZE];
  6506. -+ u8 scratch[6 * AES_BLOCK_SIZE];
  6507. -
  6508. - if (info->control.hw_key &&
  6509. - !(info->control.hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) &&
  6510. -@@ -427,7 +429,7 @@ static int ccmp_encrypt_skb(struct ieee8
  6511. - if (info->control.hw_key)
  6512. - tail = 0;
  6513. - else
  6514. -- tail = mic_len;
  6515. -+ tail = IEEE80211_CCMP_MIC_LEN;
  6516. -
  6517. - if (WARN_ON(skb_tailroom(skb) < tail ||
  6518. - skb_headroom(skb) < IEEE80211_CCMP_HDR_LEN))
  6519. -@@ -460,24 +462,23 @@ static int ccmp_encrypt_skb(struct ieee8
  6520. - return 0;
  6521. -
  6522. - pos += IEEE80211_CCMP_HDR_LEN;
  6523. -- ccmp_special_blocks(skb, pn, b_0, aad);
  6524. -- ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, b_0, aad, pos, len,
  6525. -- skb_put(skb, mic_len), mic_len);
  6526. -+ ccmp_special_blocks(skb, pn, scratch, 0);
  6527. -+ ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, scratch, pos, len,
  6528. -+ pos, skb_put(skb, IEEE80211_CCMP_MIC_LEN));
  6529. -
  6530. - return 0;
  6531. - }
  6532. -
  6533. -
  6534. - ieee80211_tx_result
  6535. --ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx,
  6536. -- unsigned int mic_len)
  6537. -+ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx)
  6538. - {
  6539. - struct sk_buff *skb;
  6540. -
  6541. - ieee80211_tx_set_protected(tx);
  6542. -
  6543. - skb_queue_walk(&tx->skbs, skb) {
  6544. -- if (ccmp_encrypt_skb(tx, skb, mic_len) < 0)
  6545. -+ if (ccmp_encrypt_skb(tx, skb) < 0)
  6546. - return TX_DROP;
  6547. - }
  6548. -
  6549. -@@ -486,8 +487,7 @@ ieee80211_crypto_ccmp_encrypt(struct iee
  6550. -
  6551. -
  6552. - ieee80211_rx_result
  6553. --ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx,
  6554. -- unsigned int mic_len)
  6555. -+ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx)
  6556. - {
  6557. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
  6558. - int hdrlen;
  6559. -@@ -504,7 +504,8 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  6560. - !ieee80211_is_robust_mgmt_frame(skb))
  6561. - return RX_CONTINUE;
  6562. -
  6563. -- data_len = skb->len - hdrlen - IEEE80211_CCMP_HDR_LEN - mic_len;
  6564. -+ data_len = skb->len - hdrlen - IEEE80211_CCMP_HDR_LEN -
  6565. -+ IEEE80211_CCMP_MIC_LEN;
  6566. - if (!rx->sta || data_len < 0)
  6567. - return RX_DROP_UNUSABLE;
  6568. -
  6569. -@@ -526,23 +527,23 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  6570. - }
  6571. -
  6572. - if (!(status->flag & RX_FLAG_DECRYPTED)) {
  6573. -- u8 aad[2 * AES_BLOCK_SIZE];
  6574. -- u8 b_0[AES_BLOCK_SIZE];
  6575. -+ u8 scratch[6 * AES_BLOCK_SIZE];
  6576. - /* hardware didn't decrypt/verify MIC */
  6577. -- ccmp_special_blocks(skb, pn, b_0, aad);
  6578. -+ ccmp_special_blocks(skb, pn, scratch, 1);
  6579. -
  6580. - if (ieee80211_aes_ccm_decrypt(
  6581. -- key->u.ccmp.tfm, b_0, aad,
  6582. -+ key->u.ccmp.tfm, scratch,
  6583. - skb->data + hdrlen + IEEE80211_CCMP_HDR_LEN,
  6584. - data_len,
  6585. -- skb->data + skb->len - mic_len, mic_len))
  6586. -+ skb->data + skb->len - IEEE80211_CCMP_MIC_LEN,
  6587. -+ skb->data + hdrlen + IEEE80211_CCMP_HDR_LEN))
  6588. - return RX_DROP_UNUSABLE;
  6589. - }
  6590. -
  6591. - memcpy(key->u.ccmp.rx_pn[queue], pn, IEEE80211_CCMP_PN_LEN);
  6592. -
  6593. - /* Remove CCMP header and MIC */
  6594. -- if (pskb_trim(skb, skb->len - mic_len))
  6595. -+ if (pskb_trim(skb, skb->len - IEEE80211_CCMP_MIC_LEN))
  6596. - return RX_DROP_UNUSABLE;
  6597. - memmove(skb->data + IEEE80211_CCMP_HDR_LEN, skb->data, hdrlen);
  6598. - skb_pull(skb, IEEE80211_CCMP_HDR_LEN);
  6599. -@@ -550,229 +551,6 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  6600. - return RX_CONTINUE;
  6601. - }
  6602. -
  6603. --static void gcmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *j_0, u8 *aad)
  6604. --{
  6605. -- __le16 mask_fc;
  6606. -- u8 qos_tid;
  6607. -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  6608. --
  6609. -- memcpy(j_0, hdr->addr2, ETH_ALEN);
  6610. -- memcpy(&j_0[ETH_ALEN], pn, IEEE80211_GCMP_PN_LEN);
  6611. -- j_0[13] = 0;
  6612. -- j_0[14] = 0;
  6613. -- j_0[AES_BLOCK_SIZE - 1] = 0x01;
  6614. --
  6615. -- /* AAD (extra authenticate-only data) / masked 802.11 header
  6616. -- * FC | A1 | A2 | A3 | SC | [A4] | [QC]
  6617. -- */
  6618. -- put_unaligned_be16(ieee80211_hdrlen(hdr->frame_control) - 2, &aad[0]);
  6619. -- /* Mask FC: zero subtype b4 b5 b6 (if not mgmt)
  6620. -- * Retry, PwrMgt, MoreData; set Protected
  6621. -- */
  6622. -- mask_fc = hdr->frame_control;
  6623. -- mask_fc &= ~cpu_to_le16(IEEE80211_FCTL_RETRY |
  6624. -- IEEE80211_FCTL_PM | IEEE80211_FCTL_MOREDATA);
  6625. -- if (!ieee80211_is_mgmt(hdr->frame_control))
  6626. -- mask_fc &= ~cpu_to_le16(0x0070);
  6627. -- mask_fc |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
  6628. --
  6629. -- put_unaligned(mask_fc, (__le16 *)&aad[2]);
  6630. -- memcpy(&aad[4], &hdr->addr1, 3 * ETH_ALEN);
  6631. --
  6632. -- /* Mask Seq#, leave Frag# */
  6633. -- aad[22] = *((u8 *)&hdr->seq_ctrl) & 0x0f;
  6634. -- aad[23] = 0;
  6635. --
  6636. -- if (ieee80211_is_data_qos(hdr->frame_control))
  6637. -- qos_tid = *ieee80211_get_qos_ctl(hdr) &
  6638. -- IEEE80211_QOS_CTL_TID_MASK;
  6639. -- else
  6640. -- qos_tid = 0;
  6641. --
  6642. -- if (ieee80211_has_a4(hdr->frame_control)) {
  6643. -- memcpy(&aad[24], hdr->addr4, ETH_ALEN);
  6644. -- aad[30] = qos_tid;
  6645. -- aad[31] = 0;
  6646. -- } else {
  6647. -- memset(&aad[24], 0, ETH_ALEN + IEEE80211_QOS_CTL_LEN);
  6648. -- aad[24] = qos_tid;
  6649. -- }
  6650. --}
  6651. --
  6652. --static inline void gcmp_pn2hdr(u8 *hdr, const u8 *pn, int key_id)
  6653. --{
  6654. -- hdr[0] = pn[5];
  6655. -- hdr[1] = pn[4];
  6656. -- hdr[2] = 0;
  6657. -- hdr[3] = 0x20 | (key_id << 6);
  6658. -- hdr[4] = pn[3];
  6659. -- hdr[5] = pn[2];
  6660. -- hdr[6] = pn[1];
  6661. -- hdr[7] = pn[0];
  6662. --}
  6663. --
  6664. --static inline void gcmp_hdr2pn(u8 *pn, const u8 *hdr)
  6665. --{
  6666. -- pn[0] = hdr[7];
  6667. -- pn[1] = hdr[6];
  6668. -- pn[2] = hdr[5];
  6669. -- pn[3] = hdr[4];
  6670. -- pn[4] = hdr[1];
  6671. -- pn[5] = hdr[0];
  6672. --}
  6673. --
  6674. --static int gcmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
  6675. --{
  6676. -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  6677. -- struct ieee80211_key *key = tx->key;
  6678. -- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  6679. -- int hdrlen, len, tail;
  6680. -- u8 *pos;
  6681. -- u8 pn[6];
  6682. -- u64 pn64;
  6683. -- u8 aad[2 * AES_BLOCK_SIZE];
  6684. -- u8 j_0[AES_BLOCK_SIZE];
  6685. --
  6686. -- if (info->control.hw_key &&
  6687. -- !(info->control.hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) &&
  6688. -- !(info->control.hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE) &&
  6689. -- !((info->control.hw_key->flags &
  6690. -- IEEE80211_KEY_FLAG_GENERATE_IV_MGMT) &&
  6691. -- ieee80211_is_mgmt(hdr->frame_control))) {
  6692. -- /* hwaccel has no need for preallocated room for GCMP
  6693. -- * header or MIC fields
  6694. -- */
  6695. -- return 0;
  6696. -- }
  6697. --
  6698. -- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  6699. -- len = skb->len - hdrlen;
  6700. --
  6701. -- if (info->control.hw_key)
  6702. -- tail = 0;
  6703. -- else
  6704. -- tail = IEEE80211_GCMP_MIC_LEN;
  6705. --
  6706. -- if (WARN_ON(skb_tailroom(skb) < tail ||
  6707. -- skb_headroom(skb) < IEEE80211_GCMP_HDR_LEN))
  6708. -- return -1;
  6709. --
  6710. -- pos = skb_push(skb, IEEE80211_GCMP_HDR_LEN);
  6711. -- memmove(pos, pos + IEEE80211_GCMP_HDR_LEN, hdrlen);
  6712. -- skb_set_network_header(skb, skb_network_offset(skb) +
  6713. -- IEEE80211_GCMP_HDR_LEN);
  6714. --
  6715. -- /* the HW only needs room for the IV, but not the actual IV */
  6716. -- if (info->control.hw_key &&
  6717. -- (info->control.hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE))
  6718. -- return 0;
  6719. --
  6720. -- hdr = (struct ieee80211_hdr *)pos;
  6721. -- pos += hdrlen;
  6722. --
  6723. -- pn64 = atomic64_inc_return(&key->u.gcmp.tx_pn);
  6724. --
  6725. -- pn[5] = pn64;
  6726. -- pn[4] = pn64 >> 8;
  6727. -- pn[3] = pn64 >> 16;
  6728. -- pn[2] = pn64 >> 24;
  6729. -- pn[1] = pn64 >> 32;
  6730. -- pn[0] = pn64 >> 40;
  6731. --
  6732. -- gcmp_pn2hdr(pos, pn, key->conf.keyidx);
  6733. --
  6734. -- /* hwaccel - with software GCMP header */
  6735. -- if (info->control.hw_key)
  6736. -- return 0;
  6737. --
  6738. -- pos += IEEE80211_GCMP_HDR_LEN;
  6739. -- gcmp_special_blocks(skb, pn, j_0, aad);
  6740. -- ieee80211_aes_gcm_encrypt(key->u.gcmp.tfm, j_0, aad, pos, len,
  6741. -- skb_put(skb, IEEE80211_GCMP_MIC_LEN));
  6742. --
  6743. -- return 0;
  6744. --}
  6745. --
  6746. --ieee80211_tx_result
  6747. --ieee80211_crypto_gcmp_encrypt(struct ieee80211_tx_data *tx)
  6748. --{
  6749. -- struct sk_buff *skb;
  6750. --
  6751. -- ieee80211_tx_set_protected(tx);
  6752. --
  6753. -- skb_queue_walk(&tx->skbs, skb) {
  6754. -- if (gcmp_encrypt_skb(tx, skb) < 0)
  6755. -- return TX_DROP;
  6756. -- }
  6757. --
  6758. -- return TX_CONTINUE;
  6759. --}
  6760. --
  6761. --ieee80211_rx_result
  6762. --ieee80211_crypto_gcmp_decrypt(struct ieee80211_rx_data *rx)
  6763. --{
  6764. -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
  6765. -- int hdrlen;
  6766. -- struct ieee80211_key *key = rx->key;
  6767. -- struct sk_buff *skb = rx->skb;
  6768. -- struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
  6769. -- u8 pn[IEEE80211_GCMP_PN_LEN];
  6770. -- int data_len;
  6771. -- int queue;
  6772. --
  6773. -- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  6774. --
  6775. -- if (!ieee80211_is_data(hdr->frame_control) &&
  6776. -- !ieee80211_is_robust_mgmt_frame(skb))
  6777. -- return RX_CONTINUE;
  6778. --
  6779. -- data_len = skb->len - hdrlen - IEEE80211_GCMP_HDR_LEN -
  6780. -- IEEE80211_GCMP_MIC_LEN;
  6781. -- if (!rx->sta || data_len < 0)
  6782. -- return RX_DROP_UNUSABLE;
  6783. --
  6784. -- if (status->flag & RX_FLAG_DECRYPTED) {
  6785. -- if (!pskb_may_pull(rx->skb, hdrlen + IEEE80211_GCMP_HDR_LEN))
  6786. -- return RX_DROP_UNUSABLE;
  6787. -- } else {
  6788. -- if (skb_linearize(rx->skb))
  6789. -- return RX_DROP_UNUSABLE;
  6790. -- }
  6791. --
  6792. -- gcmp_hdr2pn(pn, skb->data + hdrlen);
  6793. --
  6794. -- queue = rx->security_idx;
  6795. --
  6796. -- if (memcmp(pn, key->u.gcmp.rx_pn[queue], IEEE80211_GCMP_PN_LEN) <= 0) {
  6797. -- key->u.gcmp.replays++;
  6798. -- return RX_DROP_UNUSABLE;
  6799. -- }
  6800. --
  6801. -- if (!(status->flag & RX_FLAG_DECRYPTED)) {
  6802. -- u8 aad[2 * AES_BLOCK_SIZE];
  6803. -- u8 j_0[AES_BLOCK_SIZE];
  6804. -- /* hardware didn't decrypt/verify MIC */
  6805. -- gcmp_special_blocks(skb, pn, j_0, aad);
  6806. --
  6807. -- if (ieee80211_aes_gcm_decrypt(
  6808. -- key->u.gcmp.tfm, j_0, aad,
  6809. -- skb->data + hdrlen + IEEE80211_GCMP_HDR_LEN,
  6810. -- data_len,
  6811. -- skb->data + skb->len - IEEE80211_GCMP_MIC_LEN))
  6812. -- return RX_DROP_UNUSABLE;
  6813. -- }
  6814. --
  6815. -- memcpy(key->u.gcmp.rx_pn[queue], pn, IEEE80211_GCMP_PN_LEN);
  6816. --
  6817. -- /* Remove GCMP header and MIC */
  6818. -- if (pskb_trim(skb, skb->len - IEEE80211_GCMP_MIC_LEN))
  6819. -- return RX_DROP_UNUSABLE;
  6820. -- memmove(skb->data + IEEE80211_GCMP_HDR_LEN, skb->data, hdrlen);
  6821. -- skb_pull(skb, IEEE80211_GCMP_HDR_LEN);
  6822. --
  6823. -- return RX_CONTINUE;
  6824. --}
  6825. --
  6826. - static ieee80211_tx_result
  6827. - ieee80211_crypto_cs_encrypt(struct ieee80211_tx_data *tx,
  6828. - struct sk_buff *skb)
  6829. -@@ -956,48 +734,6 @@ ieee80211_crypto_aes_cmac_encrypt(struct
  6830. - return TX_CONTINUE;
  6831. - }
  6832. -
  6833. --ieee80211_tx_result
  6834. --ieee80211_crypto_aes_cmac_256_encrypt(struct ieee80211_tx_data *tx)
  6835. --{
  6836. -- struct sk_buff *skb;
  6837. -- struct ieee80211_tx_info *info;
  6838. -- struct ieee80211_key *key = tx->key;
  6839. -- struct ieee80211_mmie_16 *mmie;
  6840. -- u8 aad[20];
  6841. -- u64 pn64;
  6842. --
  6843. -- if (WARN_ON(skb_queue_len(&tx->skbs) != 1))
  6844. -- return TX_DROP;
  6845. --
  6846. -- skb = skb_peek(&tx->skbs);
  6847. --
  6848. -- info = IEEE80211_SKB_CB(skb);
  6849. --
  6850. -- if (info->control.hw_key)
  6851. -- return TX_CONTINUE;
  6852. --
  6853. -- if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie)))
  6854. -- return TX_DROP;
  6855. --
  6856. -- mmie = (struct ieee80211_mmie_16 *)skb_put(skb, sizeof(*mmie));
  6857. -- mmie->element_id = WLAN_EID_MMIE;
  6858. -- mmie->length = sizeof(*mmie) - 2;
  6859. -- mmie->key_id = cpu_to_le16(key->conf.keyidx);
  6860. --
  6861. -- /* PN = PN + 1 */
  6862. -- pn64 = atomic64_inc_return(&key->u.aes_cmac.tx_pn);
  6863. --
  6864. -- bip_ipn_set64(mmie->sequence_number, pn64);
  6865. --
  6866. -- bip_aad(skb, aad);
  6867. --
  6868. -- /* MIC = AES-256-CMAC(IGTK, AAD || Management Frame Body || MMIE, 128)
  6869. -- */
  6870. -- ieee80211_aes_cmac_256(key->u.aes_cmac.tfm, aad,
  6871. -- skb->data + 24, skb->len - 24, mmie->mic);
  6872. --
  6873. -- return TX_CONTINUE;
  6874. --}
  6875. -
  6876. - ieee80211_rx_result
  6877. - ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx)
  6878. -@@ -1045,160 +781,6 @@ ieee80211_crypto_aes_cmac_decrypt(struct
  6879. -
  6880. - /* Remove MMIE */
  6881. - skb_trim(skb, skb->len - sizeof(*mmie));
  6882. --
  6883. -- return RX_CONTINUE;
  6884. --}
  6885. --
  6886. --ieee80211_rx_result
  6887. --ieee80211_crypto_aes_cmac_256_decrypt(struct ieee80211_rx_data *rx)
  6888. --{
  6889. -- struct sk_buff *skb = rx->skb;
  6890. -- struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
  6891. -- struct ieee80211_key *key = rx->key;
  6892. -- struct ieee80211_mmie_16 *mmie;
  6893. -- u8 aad[20], mic[16], ipn[6];
  6894. -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  6895. --
  6896. -- if (!ieee80211_is_mgmt(hdr->frame_control))
  6897. -- return RX_CONTINUE;
  6898. --
  6899. -- /* management frames are already linear */
  6900. --
  6901. -- if (skb->len < 24 + sizeof(*mmie))
  6902. -- return RX_DROP_UNUSABLE;
  6903. --
  6904. -- mmie = (struct ieee80211_mmie_16 *)
  6905. -- (skb->data + skb->len - sizeof(*mmie));
  6906. -- if (mmie->element_id != WLAN_EID_MMIE ||
  6907. -- mmie->length != sizeof(*mmie) - 2)
  6908. -- return RX_DROP_UNUSABLE; /* Invalid MMIE */
  6909. --
  6910. -- bip_ipn_swap(ipn, mmie->sequence_number);
  6911. --
  6912. -- if (memcmp(ipn, key->u.aes_cmac.rx_pn, 6) <= 0) {
  6913. -- key->u.aes_cmac.replays++;
  6914. -- return RX_DROP_UNUSABLE;
  6915. -- }
  6916. --
  6917. -- if (!(status->flag & RX_FLAG_DECRYPTED)) {
  6918. -- /* hardware didn't decrypt/verify MIC */
  6919. -- bip_aad(skb, aad);
  6920. -- ieee80211_aes_cmac_256(key->u.aes_cmac.tfm, aad,
  6921. -- skb->data + 24, skb->len - 24, mic);
  6922. -- if (memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) {
  6923. -- key->u.aes_cmac.icverrors++;
  6924. -- return RX_DROP_UNUSABLE;
  6925. -- }
  6926. -- }
  6927. --
  6928. -- memcpy(key->u.aes_cmac.rx_pn, ipn, 6);
  6929. --
  6930. -- /* Remove MMIE */
  6931. -- skb_trim(skb, skb->len - sizeof(*mmie));
  6932. --
  6933. -- return RX_CONTINUE;
  6934. --}
  6935. --
  6936. --ieee80211_tx_result
  6937. --ieee80211_crypto_aes_gmac_encrypt(struct ieee80211_tx_data *tx)
  6938. --{
  6939. -- struct sk_buff *skb;
  6940. -- struct ieee80211_tx_info *info;
  6941. -- struct ieee80211_key *key = tx->key;
  6942. -- struct ieee80211_mmie_16 *mmie;
  6943. -- struct ieee80211_hdr *hdr;
  6944. -- u8 aad[20];
  6945. -- u64 pn64;
  6946. -- u8 nonce[12];
  6947. --
  6948. -- if (WARN_ON(skb_queue_len(&tx->skbs) != 1))
  6949. -- return TX_DROP;
  6950. --
  6951. -- skb = skb_peek(&tx->skbs);
  6952. --
  6953. -- info = IEEE80211_SKB_CB(skb);
  6954. --
  6955. -- if (info->control.hw_key)
  6956. -- return TX_CONTINUE;
  6957. --
  6958. -- if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie)))
  6959. -- return TX_DROP;
  6960. --
  6961. -- mmie = (struct ieee80211_mmie_16 *)skb_put(skb, sizeof(*mmie));
  6962. -- mmie->element_id = WLAN_EID_MMIE;
  6963. -- mmie->length = sizeof(*mmie) - 2;
  6964. -- mmie->key_id = cpu_to_le16(key->conf.keyidx);
  6965. --
  6966. -- /* PN = PN + 1 */
  6967. -- pn64 = atomic64_inc_return(&key->u.aes_gmac.tx_pn);
  6968. --
  6969. -- bip_ipn_set64(mmie->sequence_number, pn64);
  6970. --
  6971. -- bip_aad(skb, aad);
  6972. --
  6973. -- hdr = (struct ieee80211_hdr *)skb->data;
  6974. -- memcpy(nonce, hdr->addr2, ETH_ALEN);
  6975. -- bip_ipn_swap(nonce + ETH_ALEN, mmie->sequence_number);
  6976. --
  6977. -- /* MIC = AES-GMAC(IGTK, AAD || Management Frame Body || MMIE, 128) */
  6978. -- if (ieee80211_aes_gmac(key->u.aes_gmac.tfm, aad, nonce,
  6979. -- skb->data + 24, skb->len - 24, mmie->mic) < 0)
  6980. -- return TX_DROP;
  6981. --
  6982. -- return TX_CONTINUE;
  6983. --}
  6984. --
  6985. --ieee80211_rx_result
  6986. --ieee80211_crypto_aes_gmac_decrypt(struct ieee80211_rx_data *rx)
  6987. --{
  6988. -- struct sk_buff *skb = rx->skb;
  6989. -- struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
  6990. -- struct ieee80211_key *key = rx->key;
  6991. -- struct ieee80211_mmie_16 *mmie;
  6992. -- u8 aad[20], mic[16], ipn[6], nonce[12];
  6993. -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  6994. --
  6995. -- if (!ieee80211_is_mgmt(hdr->frame_control))
  6996. -- return RX_CONTINUE;
  6997. --
  6998. -- /* management frames are already linear */
  6999. --
  7000. -- if (skb->len < 24 + sizeof(*mmie))
  7001. -- return RX_DROP_UNUSABLE;
  7002. --
  7003. -- mmie = (struct ieee80211_mmie_16 *)
  7004. -- (skb->data + skb->len - sizeof(*mmie));
  7005. -- if (mmie->element_id != WLAN_EID_MMIE ||
  7006. -- mmie->length != sizeof(*mmie) - 2)
  7007. -- return RX_DROP_UNUSABLE; /* Invalid MMIE */
  7008. --
  7009. -- bip_ipn_swap(ipn, mmie->sequence_number);
  7010. --
  7011. -- if (memcmp(ipn, key->u.aes_gmac.rx_pn, 6) <= 0) {
  7012. -- key->u.aes_gmac.replays++;
  7013. -- return RX_DROP_UNUSABLE;
  7014. -- }
  7015. --
  7016. -- if (!(status->flag & RX_FLAG_DECRYPTED)) {
  7017. -- /* hardware didn't decrypt/verify MIC */
  7018. -- bip_aad(skb, aad);
  7019. --
  7020. -- memcpy(nonce, hdr->addr2, ETH_ALEN);
  7021. -- memcpy(nonce + ETH_ALEN, ipn, 6);
  7022. --
  7023. -- if (ieee80211_aes_gmac(key->u.aes_gmac.tfm, aad, nonce,
  7024. -- skb->data + 24, skb->len - 24,
  7025. -- mic) < 0 ||
  7026. -- memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) {
  7027. -- key->u.aes_gmac.icverrors++;
  7028. -- return RX_DROP_UNUSABLE;
  7029. -- }
  7030. -- }
  7031. --
  7032. -- memcpy(key->u.aes_gmac.rx_pn, ipn, 6);
  7033. --
  7034. -- /* Remove MMIE */
  7035. -- skb_trim(skb, skb->len - sizeof(*mmie));
  7036. -
  7037. - return RX_CONTINUE;
  7038. - }
  7039. ---- a/net/mac80211/wpa.h
  7040. -+++ b/net/mac80211/wpa.h
  7041. -@@ -24,32 +24,17 @@ ieee80211_rx_result
  7042. - ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx);
  7043. -
  7044. - ieee80211_tx_result
  7045. --ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx,
  7046. -- unsigned int mic_len);
  7047. -+ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx);
  7048. - ieee80211_rx_result
  7049. --ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx,
  7050. -- unsigned int mic_len);
  7051. -+ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx);
  7052. -
  7053. - ieee80211_tx_result
  7054. - ieee80211_crypto_aes_cmac_encrypt(struct ieee80211_tx_data *tx);
  7055. --ieee80211_tx_result
  7056. --ieee80211_crypto_aes_cmac_256_encrypt(struct ieee80211_tx_data *tx);
  7057. - ieee80211_rx_result
  7058. - ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx);
  7059. --ieee80211_rx_result
  7060. --ieee80211_crypto_aes_cmac_256_decrypt(struct ieee80211_rx_data *rx);
  7061. --ieee80211_tx_result
  7062. --ieee80211_crypto_aes_gmac_encrypt(struct ieee80211_tx_data *tx);
  7063. --ieee80211_rx_result
  7064. --ieee80211_crypto_aes_gmac_decrypt(struct ieee80211_rx_data *rx);
  7065. - ieee80211_tx_result
  7066. - ieee80211_crypto_hw_encrypt(struct ieee80211_tx_data *tx);
  7067. - ieee80211_rx_result
  7068. - ieee80211_crypto_hw_decrypt(struct ieee80211_rx_data *rx);
  7069. -
  7070. --ieee80211_tx_result
  7071. --ieee80211_crypto_gcmp_encrypt(struct ieee80211_tx_data *tx);
  7072. --ieee80211_rx_result
  7073. --ieee80211_crypto_gcmp_decrypt(struct ieee80211_rx_data *rx);
  7074. --
  7075. - #endif /* WPA_H */
  7076. 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
  7077. index 41a3c4f..d1d9fbd 100644
  7078. --- a/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
  7079. +++ b/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
  7080. @@ -2,7 +2,7 @@ Used for AP+STA support in OpenWrt - preserve AP mode keys across STA reconnects
  7081. --- a/net/mac80211/cfg.c
  7082. +++ b/net/mac80211/cfg.c
  7083. -@@ -856,7 +856,6 @@ static int ieee80211_stop_ap(struct wiph
  7084. +@@ -846,7 +846,6 @@ static int ieee80211_stop_ap(struct wiph
  7085. sdata->u.ap.driver_smps_mode = IEEE80211_SMPS_OFF;
  7086. __sta_info_flush(sdata, true);
  7087. diff --git a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  7088. index de79bd2..2855a88 100644
  7089. --- a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  7090. +++ b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  7091. @@ -1,6 +1,6 @@
  7092. --- a/net/mac80211/main.c
  7093. +++ b/net/mac80211/main.c
  7094. -@@ -287,7 +287,7 @@ void ieee80211_restart_hw(struct ieee802
  7095. +@@ -291,7 +291,7 @@ void ieee80211_restart_hw(struct ieee802
  7096. }
  7097. EXPORT_SYMBOL(ieee80211_restart_hw);
  7098. @@ -9,7 +9,7 @@
  7099. static int ieee80211_ifa_changed(struct notifier_block *nb,
  7100. unsigned long data, void *arg)
  7101. {
  7102. -@@ -346,7 +346,7 @@ static int ieee80211_ifa_changed(struct
  7103. +@@ -350,7 +350,7 @@ static int ieee80211_ifa_changed(struct
  7104. }
  7105. #endif
  7106. @@ -18,9 +18,9 @@
  7107. static int ieee80211_ifa6_changed(struct notifier_block *nb,
  7108. unsigned long data, void *arg)
  7109. {
  7110. -@@ -1057,14 +1057,14 @@ int ieee80211_register_hw(struct ieee802
  7111. - if (result)
  7112. - goto fail_pm_qos;
  7113. +@@ -1087,14 +1087,14 @@ int ieee80211_register_hw(struct ieee802
  7114. +
  7115. + rtnl_unlock();
  7116. -#ifdef CONFIG_INET
  7117. +#ifdef __disabled__CONFIG_INET
  7118. @@ -35,7 +35,7 @@
  7119. local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed;
  7120. result = register_inet6addr_notifier(&local->ifa6_notifier);
  7121. if (result)
  7122. -@@ -1073,13 +1073,13 @@ int ieee80211_register_hw(struct ieee802
  7123. +@@ -1103,13 +1103,13 @@ int ieee80211_register_hw(struct ieee802
  7124. return 0;
  7125. @@ -50,12 +50,12 @@
  7126. -#if defined(CONFIG_INET) || defined(CONFIG_IPV6)
  7127. +#if defined(__disabled__CONFIG_INET) || defined(__disabled__CONFIG_IPV6)
  7128. fail_ifa:
  7129. - pm_qos_remove_notifier(PM_QOS_NETWORK_LATENCY,
  7130. - &local->network_latency_notifier);
  7131. -@@ -1124,10 +1124,10 @@ void ieee80211_unregister_hw(struct ieee
  7132. + #endif
  7133. + rtnl_lock();
  7134. +@@ -1137,10 +1137,10 @@ void ieee80211_unregister_hw(struct ieee
  7135. + tasklet_kill(&local->tx_pending_tasklet);
  7136. + tasklet_kill(&local->tasklet);
  7137. - pm_qos_remove_notifier(PM_QOS_NETWORK_LATENCY,
  7138. - &local->network_latency_notifier);
  7139. -#ifdef CONFIG_INET
  7140. +#ifdef __disabled__CONFIG_INET
  7141. unregister_inetaddr_notifier(&local->ifa_notifier);
  7142. diff --git a/package/kernel/mac80211/patches/210-ap_scan.patch b/package/kernel/mac80211/patches/210-ap_scan.patch
  7143. index 47dcec3..a99cbd2 100644
  7144. --- a/package/kernel/mac80211/patches/210-ap_scan.patch
  7145. +++ b/package/kernel/mac80211/patches/210-ap_scan.patch
  7146. @@ -1,6 +1,6 @@
  7147. --- a/net/mac80211/cfg.c
  7148. +++ b/net/mac80211/cfg.c
  7149. -@@ -1963,7 +1963,7 @@ static int ieee80211_scan(struct wiphy *
  7150. +@@ -1999,7 +1999,7 @@ static int ieee80211_scan(struct wiphy *
  7151. * the frames sent while scanning on other channel will be
  7152. * lost)
  7153. */
  7154. 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
  7155. new file mode 100644
  7156. index 0000000..bddb15a
  7157. --- /dev/null
  7158. +++ b/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch
  7159. @@ -0,0 +1,31 @@
  7160. +From: Felix Fietkau <nbd@openwrt.org>
  7161. +Date: Sun, 7 Jun 2015 13:53:35 +0200
  7162. +Subject: [PATCH] ath9k: force rx_clear when disabling rx
  7163. +
  7164. +This makes stopping Rx more reliable and should reduce the frequency of
  7165. +Rx related DMA stop warnings
  7166. +
  7167. +Cc: stable@vger.kernel.org
  7168. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  7169. +---
  7170. +
  7171. +--- a/drivers/net/wireless/ath/ath9k/mac.c
  7172. ++++ b/drivers/net/wireless/ath/ath9k/mac.c
  7173. +@@ -677,13 +677,15 @@ void ath9k_hw_startpcureceive(struct ath
  7174. +
  7175. + ath9k_ani_reset(ah, is_scanning);
  7176. +
  7177. +- REG_CLR_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT));
  7178. ++ REG_CLR_BIT(ah, AR_DIAG_SW,
  7179. ++ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  7180. + }
  7181. + EXPORT_SYMBOL(ath9k_hw_startpcureceive);
  7182. +
  7183. + void ath9k_hw_abortpcurecv(struct ath_hw *ah)
  7184. + {
  7185. +- REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_ABORT | AR_DIAG_RX_DIS);
  7186. ++ REG_SET_BIT(ah, AR_DIAG_SW,
  7187. ++ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  7188. +
  7189. + ath9k_hw_disable_mib_counters(ah);
  7190. + }
  7191. 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
  7192. deleted file mode 100644
  7193. index 237121b..0000000
  7194. --- a/package/kernel/mac80211/patches/300-mac80211-add-an-intermediate-software-queue-implemen.patch
  7195. +++ /dev/null
  7196. @@ -1,882 +0,0 @@
  7197. -From: Felix Fietkau <nbd@openwrt.org>
  7198. -Date: Tue, 18 Nov 2014 23:58:51 +0100
  7199. -Subject: [PATCH] mac80211: add an intermediate software queue implementation
  7200. -
  7201. -This allows drivers to request per-vif and per-sta-tid queues from which
  7202. -they can pull frames. This makes it easier to keep the hardware queues
  7203. -short, and to improve fairness between clients and vifs.
  7204. -
  7205. -The task of scheduling packet transmission is left up to the driver -
  7206. -queueing is controlled by mac80211. Drivers can only dequeue packets by
  7207. -calling ieee80211_tx_dequeue. This makes it possible to add active queue
  7208. -management later without changing drivers using this code.
  7209. -
  7210. -This can also be used as a starting point to implement A-MSDU
  7211. -aggregation in a way that does not add artificially induced latency.
  7212. -
  7213. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  7214. ----
  7215. -
  7216. ---- a/include/net/mac80211.h
  7217. -+++ b/include/net/mac80211.h
  7218. -@@ -84,6 +84,39 @@
  7219. - *
  7220. - */
  7221. -
  7222. -+/**
  7223. -+ * DOC: mac80211 software tx queueing
  7224. -+ *
  7225. -+ * mac80211 provides an optional intermediate queueing implementation designed
  7226. -+ * to allow the driver to keep hardware queues short and provide some fairness
  7227. -+ * between different stations/interfaces.
  7228. -+ * In this model, the driver pulls data frames from the mac80211 queue instead
  7229. -+ * of letting mac80211 push them via drv_tx().
  7230. -+ * Other frames (e.g. control or management) are still pushed using drv_tx().
  7231. -+ *
  7232. -+ * Drivers indicate that they use this model by implementing the .wake_tx_queue
  7233. -+ * driver operation.
  7234. -+ *
  7235. -+ * Intermediate queues (struct ieee80211_txq) are kept per-sta per-tid, with a
  7236. -+ * single per-vif queue for multicast data frames.
  7237. -+ *
  7238. -+ * The driver is expected to initialize its private per-queue data for stations
  7239. -+ * and interfaces in the .add_interface and .sta_add ops.
  7240. -+ *
  7241. -+ * The driver can't access the queue directly. To dequeue a frame, it calls
  7242. -+ * ieee80211_tx_dequeue(). Whenever mac80211 adds a new frame to a queue, it
  7243. -+ * calls the .wake_tx_queue driver op.
  7244. -+ *
  7245. -+ * For AP powersave TIM handling, the driver only needs to indicate if it has
  7246. -+ * buffered packets in the driver specific data structures by calling
  7247. -+ * ieee80211_sta_set_buffered(). For frames buffered in the ieee80211_txq
  7248. -+ * struct, mac80211 sets the appropriate TIM PVB bits and calls
  7249. -+ * .release_buffered_frames().
  7250. -+ * In that callback the driver is therefore expected to release its own
  7251. -+ * buffered frames and afterwards also frames from the ieee80211_txq (obtained
  7252. -+ * via the usual ieee80211_tx_dequeue).
  7253. -+ */
  7254. -+
  7255. - struct device;
  7256. -
  7257. - /**
  7258. -@@ -1246,6 +1279,7 @@ enum ieee80211_vif_flags {
  7259. - * monitor interface (if that is requested.)
  7260. - * @drv_priv: data area for driver use, will always be aligned to
  7261. - * sizeof(void *).
  7262. -+ * @txq: the multicast data TX queue (if driver uses the TXQ abstraction)
  7263. - */
  7264. - struct ieee80211_vif {
  7265. - enum nl80211_iftype type;
  7266. -@@ -1257,6 +1291,8 @@ struct ieee80211_vif {
  7267. - u8 cab_queue;
  7268. - u8 hw_queue[IEEE80211_NUM_ACS];
  7269. -
  7270. -+ struct ieee80211_txq *txq;
  7271. -+
  7272. - struct ieee80211_chanctx_conf __rcu *chanctx_conf;
  7273. -
  7274. - u32 driver_flags;
  7275. -@@ -1501,6 +1537,7 @@ struct ieee80211_sta_rates {
  7276. - * @tdls_initiator: indicates the STA is an initiator of the TDLS link. Only
  7277. - * valid if the STA is a TDLS peer in the first place.
  7278. - * @mfp: indicates whether the STA uses management frame protection or not.
  7279. -+ * @txq: per-TID data TX queues (if driver uses the TXQ abstraction)
  7280. - */
  7281. - struct ieee80211_sta {
  7282. - u32 supp_rates[IEEE80211_NUM_BANDS];
  7283. -@@ -1519,6 +1556,8 @@ struct ieee80211_sta {
  7284. - bool tdls_initiator;
  7285. - bool mfp;
  7286. -
  7287. -+ struct ieee80211_txq *txq[IEEE80211_NUM_TIDS];
  7288. -+
  7289. - /* must be last */
  7290. - u8 drv_priv[0] __aligned(sizeof(void *));
  7291. - };
  7292. -@@ -1547,6 +1586,27 @@ struct ieee80211_tx_control {
  7293. - };
  7294. -
  7295. - /**
  7296. -+ * struct ieee80211_txq - Software intermediate tx queue
  7297. -+ *
  7298. -+ * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  7299. -+ * @sta: station table entry, %NULL for per-vif queue
  7300. -+ * @tid: the TID for this queue (unused for per-vif queue)
  7301. -+ * @ac: the AC for this queue
  7302. -+ *
  7303. -+ * The driver can obtain packets from this queue by calling
  7304. -+ * ieee80211_tx_dequeue().
  7305. -+ */
  7306. -+struct ieee80211_txq {
  7307. -+ struct ieee80211_vif *vif;
  7308. -+ struct ieee80211_sta *sta;
  7309. -+ u8 tid;
  7310. -+ u8 ac;
  7311. -+
  7312. -+ /* must be last */
  7313. -+ u8 drv_priv[0] __aligned(sizeof(void *));
  7314. -+};
  7315. -+
  7316. -+/**
  7317. - * enum ieee80211_hw_flags - hardware flags
  7318. - *
  7319. - * These flags are used to indicate hardware capabilities to
  7320. -@@ -1770,6 +1830,8 @@ enum ieee80211_hw_flags {
  7321. - * within &struct ieee80211_sta.
  7322. - * @chanctx_data_size: size (in bytes) of the drv_priv data area
  7323. - * within &struct ieee80211_chanctx_conf.
  7324. -+ * @txq_data_size: size (in bytes) of the drv_priv data area
  7325. -+ * within @struct ieee80211_txq.
  7326. - *
  7327. - * @max_rates: maximum number of alternate rate retry stages the hw
  7328. - * can handle.
  7329. -@@ -1818,6 +1880,9 @@ enum ieee80211_hw_flags {
  7330. - * @n_cipher_schemes: a size of an array of cipher schemes definitions.
  7331. - * @cipher_schemes: a pointer to an array of cipher scheme definitions
  7332. - * supported by HW.
  7333. -+ *
  7334. -+ * @txq_ac_max_pending: maximum number of frames per AC pending in all txq
  7335. -+ * entries for a vif.
  7336. - */
  7337. - struct ieee80211_hw {
  7338. - struct ieee80211_conf conf;
  7339. -@@ -1830,6 +1895,7 @@ struct ieee80211_hw {
  7340. - int vif_data_size;
  7341. - int sta_data_size;
  7342. - int chanctx_data_size;
  7343. -+ int txq_data_size;
  7344. - u16 queues;
  7345. - u16 max_listen_interval;
  7346. - s8 max_signal;
  7347. -@@ -1846,6 +1912,7 @@ struct ieee80211_hw {
  7348. - u8 uapsd_max_sp_len;
  7349. - u8 n_cipher_schemes;
  7350. - const struct ieee80211_cipher_scheme *cipher_schemes;
  7351. -+ int txq_ac_max_pending;
  7352. - };
  7353. -
  7354. - /**
  7355. -@@ -3007,6 +3074,8 @@ enum ieee80211_reconfig_type {
  7356. - * response template is provided, together with the location of the
  7357. - * switch-timing IE within the template. The skb can only be used within
  7358. - * the function call.
  7359. -+ *
  7360. -+ * @wake_tx_queue: Called when new packets have been added to the queue.
  7361. - */
  7362. - struct ieee80211_ops {
  7363. - void (*tx)(struct ieee80211_hw *hw,
  7364. -@@ -3238,6 +3307,9 @@ struct ieee80211_ops {
  7365. - void (*tdls_recv_channel_switch)(struct ieee80211_hw *hw,
  7366. - struct ieee80211_vif *vif,
  7367. - struct ieee80211_tdls_ch_sw_params *params);
  7368. -+
  7369. -+ void (*wake_tx_queue)(struct ieee80211_hw *hw,
  7370. -+ struct ieee80211_txq *txq);
  7371. - };
  7372. -
  7373. - /**
  7374. -@@ -5249,4 +5321,15 @@ void ieee80211_unreserve_tid(struct ieee
  7375. - */
  7376. - size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
  7377. - const u8 *ids, int n_ids, size_t offset);
  7378. -+
  7379. -+/**
  7380. -+ * ieee80211_tx_dequeue - dequeue a packet from a software tx queue
  7381. -+ *
  7382. -+ * @hw: pointer as obtained from ieee80211_alloc_hw()
  7383. -+ * @txq: pointer obtained from station or virtual interface
  7384. -+ *
  7385. -+ * Returns the skb if successful, %NULL if no frame was available.
  7386. -+ */
  7387. -+struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
  7388. -+ struct ieee80211_txq *txq);
  7389. - #endif /* MAC80211_H */
  7390. ---- a/net/mac80211/driver-ops.h
  7391. -+++ b/net/mac80211/driver-ops.h
  7392. -@@ -1367,4 +1367,16 @@ drv_tdls_recv_channel_switch(struct ieee
  7393. - trace_drv_return_void(local);
  7394. - }
  7395. -
  7396. -+static inline void drv_wake_tx_queue(struct ieee80211_local *local,
  7397. -+ struct txq_info *txq)
  7398. -+{
  7399. -+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->txq.vif);
  7400. -+
  7401. -+ if (!check_sdata_in_driver(sdata))
  7402. -+ return;
  7403. -+
  7404. -+ trace_drv_wake_tx_queue(local, sdata, txq);
  7405. -+ local->ops->wake_tx_queue(&local->hw, &txq->txq);
  7406. -+}
  7407. -+
  7408. - #endif /* __MAC80211_DRIVER_OPS */
  7409. ---- a/net/mac80211/ieee80211_i.h
  7410. -+++ b/net/mac80211/ieee80211_i.h
  7411. -@@ -809,6 +809,19 @@ struct mac80211_qos_map {
  7412. - struct rcu_head rcu_head;
  7413. - };
  7414. -
  7415. -+enum txq_info_flags {
  7416. -+ IEEE80211_TXQ_STOP,
  7417. -+ IEEE80211_TXQ_AMPDU,
  7418. -+};
  7419. -+
  7420. -+struct txq_info {
  7421. -+ struct sk_buff_head queue;
  7422. -+ unsigned long flags;
  7423. -+
  7424. -+ /* keep last! */
  7425. -+ struct ieee80211_txq txq;
  7426. -+};
  7427. -+
  7428. - struct ieee80211_sub_if_data {
  7429. - struct list_head list;
  7430. -
  7431. -@@ -853,6 +866,7 @@ struct ieee80211_sub_if_data {
  7432. - bool control_port_no_encrypt;
  7433. - int encrypt_headroom;
  7434. -
  7435. -+ atomic_t txqs_len[IEEE80211_NUM_ACS];
  7436. - struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS];
  7437. - struct mac80211_qos_map __rcu *qos_map;
  7438. -
  7439. -@@ -1453,6 +1467,10 @@ static inline struct ieee80211_local *hw
  7440. - return container_of(hw, struct ieee80211_local, hw);
  7441. - }
  7442. -
  7443. -+static inline struct txq_info *to_txq_info(struct ieee80211_txq *txq)
  7444. -+{
  7445. -+ return container_of(txq, struct txq_info, txq);
  7446. -+}
  7447. -
  7448. - static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr)
  7449. - {
  7450. -@@ -1905,6 +1923,9 @@ static inline bool ieee80211_can_run_wor
  7451. - return true;
  7452. - }
  7453. -
  7454. -+void ieee80211_init_tx_queue(struct ieee80211_sub_if_data *sdata,
  7455. -+ struct sta_info *sta,
  7456. -+ struct txq_info *txq, int tid);
  7457. - void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
  7458. - u16 transaction, u16 auth_alg, u16 status,
  7459. - const u8 *extra, size_t extra_len, const u8 *bssid,
  7460. ---- a/net/mac80211/iface.c
  7461. -+++ b/net/mac80211/iface.c
  7462. -@@ -969,6 +969,13 @@ static void ieee80211_do_stop(struct iee
  7463. - }
  7464. - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
  7465. -
  7466. -+ if (sdata->vif.txq) {
  7467. -+ struct txq_info *txqi = to_txq_info(sdata->vif.txq);
  7468. -+
  7469. -+ ieee80211_purge_tx_queue(&local->hw, &txqi->queue);
  7470. -+ atomic_set(&sdata->txqs_len[txqi->txq.ac], 0);
  7471. -+ }
  7472. -+
  7473. - if (local->open_count == 0)
  7474. - ieee80211_clear_tx_pending(local);
  7475. -
  7476. -@@ -1674,6 +1681,7 @@ int ieee80211_if_add(struct ieee80211_lo
  7477. - {
  7478. - struct net_device *ndev = NULL;
  7479. - struct ieee80211_sub_if_data *sdata = NULL;
  7480. -+ struct txq_info *txqi;
  7481. - int ret, i;
  7482. - int txqs = 1;
  7483. -
  7484. -@@ -1693,10 +1701,18 @@ int ieee80211_if_add(struct ieee80211_lo
  7485. - ieee80211_assign_perm_addr(local, wdev->address, type);
  7486. - memcpy(sdata->vif.addr, wdev->address, ETH_ALEN);
  7487. - } else {
  7488. -+ int size = ALIGN(sizeof(*sdata) + local->hw.vif_data_size,
  7489. -+ sizeof(void *));
  7490. -+ int txq_size = 0;
  7491. -+
  7492. -+ if (local->ops->wake_tx_queue)
  7493. -+ txq_size += sizeof(struct txq_info) +
  7494. -+ local->hw.txq_data_size;
  7495. -+
  7496. - if (local->hw.queues >= IEEE80211_NUM_ACS)
  7497. - txqs = IEEE80211_NUM_ACS;
  7498. -
  7499. -- ndev = alloc_netdev_mqs(sizeof(*sdata) + local->hw.vif_data_size,
  7500. -+ ndev = alloc_netdev_mqs(size + txq_size,
  7501. - name, NET_NAME_UNKNOWN,
  7502. - ieee80211_if_setup, txqs, 1);
  7503. - if (!ndev)
  7504. -@@ -1731,6 +1747,11 @@ int ieee80211_if_add(struct ieee80211_lo
  7505. - memcpy(sdata->vif.addr, ndev->dev_addr, ETH_ALEN);
  7506. - memcpy(sdata->name, ndev->name, IFNAMSIZ);
  7507. -
  7508. -+ if (txq_size) {
  7509. -+ txqi = netdev_priv(ndev) + size;
  7510. -+ ieee80211_init_tx_queue(sdata, NULL, txqi, 0);
  7511. -+ }
  7512. -+
  7513. - sdata->dev = ndev;
  7514. - }
  7515. -
  7516. ---- a/net/mac80211/main.c
  7517. -+++ b/net/mac80211/main.c
  7518. -@@ -1019,6 +1019,9 @@ int ieee80211_register_hw(struct ieee802
  7519. -
  7520. - local->dynamic_ps_forced_timeout = -1;
  7521. -
  7522. -+ if (!local->hw.txq_ac_max_pending)
  7523. -+ local->hw.txq_ac_max_pending = 64;
  7524. -+
  7525. - result = ieee80211_wep_init(local);
  7526. - if (result < 0)
  7527. - wiphy_debug(local->hw.wiphy, "Failed to initialize wep: %d\n",
  7528. ---- a/net/mac80211/sta_info.c
  7529. -+++ b/net/mac80211/sta_info.c
  7530. -@@ -118,6 +118,16 @@ static void __cleanup_single_sta(struct
  7531. - atomic_dec(&ps->num_sta_ps);
  7532. - }
  7533. -
  7534. -+ if (sta->sta.txq[0]) {
  7535. -+ for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) {
  7536. -+ struct txq_info *txqi = to_txq_info(sta->sta.txq[i]);
  7537. -+ int n = skb_queue_len(&txqi->queue);
  7538. -+
  7539. -+ ieee80211_purge_tx_queue(&local->hw, &txqi->queue);
  7540. -+ atomic_sub(n, &sdata->txqs_len[txqi->txq.ac]);
  7541. -+ }
  7542. -+ }
  7543. -+
  7544. - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
  7545. - local->total_ps_buffered -= skb_queue_len(&sta->ps_tx_buf[ac]);
  7546. - ieee80211_purge_tx_queue(&local->hw, &sta->ps_tx_buf[ac]);
  7547. -@@ -234,6 +244,8 @@ void sta_info_free(struct ieee80211_loca
  7548. -
  7549. - sta_dbg(sta->sdata, "Destroyed STA %pM\n", sta->sta.addr);
  7550. -
  7551. -+ if (sta->sta.txq[0])
  7552. -+ kfree(to_txq_info(sta->sta.txq[0]));
  7553. - kfree(rcu_dereference_raw(sta->sta.rates));
  7554. - kfree(sta);
  7555. - }
  7556. -@@ -285,11 +297,12 @@ struct sta_info *sta_info_alloc(struct i
  7557. - const u8 *addr, gfp_t gfp)
  7558. - {
  7559. - struct ieee80211_local *local = sdata->local;
  7560. -+ struct ieee80211_hw *hw = &local->hw;
  7561. - struct sta_info *sta;
  7562. - struct timespec uptime;
  7563. - int i;
  7564. -
  7565. -- sta = kzalloc(sizeof(*sta) + local->hw.sta_data_size, gfp);
  7566. -+ sta = kzalloc(sizeof(*sta) + hw->sta_data_size, gfp);
  7567. - if (!sta)
  7568. - return NULL;
  7569. -
  7570. -@@ -321,11 +334,25 @@ struct sta_info *sta_info_alloc(struct i
  7571. - for (i = 0; i < ARRAY_SIZE(sta->chain_signal_avg); i++)
  7572. - ewma_init(&sta->chain_signal_avg[i], 1024, 8);
  7573. -
  7574. -- if (sta_prepare_rate_control(local, sta, gfp)) {
  7575. -- kfree(sta);
  7576. -- return NULL;
  7577. -+ if (local->ops->wake_tx_queue) {
  7578. -+ void *txq_data;
  7579. -+ int size = sizeof(struct txq_info) +
  7580. -+ ALIGN(hw->txq_data_size, sizeof(void *));
  7581. -+
  7582. -+ txq_data = kcalloc(ARRAY_SIZE(sta->sta.txq), size, gfp);
  7583. -+ if (!txq_data)
  7584. -+ goto free;
  7585. -+
  7586. -+ for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) {
  7587. -+ struct txq_info *txq = txq_data + i * size;
  7588. -+
  7589. -+ ieee80211_init_tx_queue(sdata, sta, txq, i);
  7590. -+ }
  7591. - }
  7592. -
  7593. -+ if (sta_prepare_rate_control(local, sta, gfp))
  7594. -+ goto free_txq;
  7595. -+
  7596. - for (i = 0; i < IEEE80211_NUM_TIDS; i++) {
  7597. - /*
  7598. - * timer_to_tid must be initialized with identity mapping
  7599. -@@ -346,7 +373,7 @@ struct sta_info *sta_info_alloc(struct i
  7600. - if (sdata->vif.type == NL80211_IFTYPE_AP ||
  7601. - sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
  7602. - struct ieee80211_supported_band *sband =
  7603. -- local->hw.wiphy->bands[ieee80211_get_sdata_band(sdata)];
  7604. -+ hw->wiphy->bands[ieee80211_get_sdata_band(sdata)];
  7605. - u8 smps = (sband->ht_cap.cap & IEEE80211_HT_CAP_SM_PS) >>
  7606. - IEEE80211_HT_CAP_SM_PS_SHIFT;
  7607. - /*
  7608. -@@ -371,6 +398,13 @@ struct sta_info *sta_info_alloc(struct i
  7609. - sta_dbg(sdata, "Allocated STA %pM\n", sta->sta.addr);
  7610. -
  7611. - return sta;
  7612. -+
  7613. -+free_txq:
  7614. -+ if (sta->sta.txq[0])
  7615. -+ kfree(to_txq_info(sta->sta.txq[0]));
  7616. -+free:
  7617. -+ kfree(sta);
  7618. -+ return NULL;
  7619. - }
  7620. -
  7621. - static int sta_info_insert_check(struct sta_info *sta)
  7622. -@@ -640,6 +674,8 @@ static void __sta_info_recalc_tim(struct
  7623. -
  7624. - indicate_tim |=
  7625. - sta->driver_buffered_tids & tids;
  7626. -+ indicate_tim |=
  7627. -+ sta->txq_buffered_tids & tids;
  7628. - }
  7629. -
  7630. - done:
  7631. -@@ -1071,7 +1107,7 @@ void ieee80211_sta_ps_deliver_wakeup(str
  7632. - struct ieee80211_sub_if_data *sdata = sta->sdata;
  7633. - struct ieee80211_local *local = sdata->local;
  7634. - struct sk_buff_head pending;
  7635. -- int filtered = 0, buffered = 0, ac;
  7636. -+ int filtered = 0, buffered = 0, ac, i;
  7637. - unsigned long flags;
  7638. - struct ps_data *ps;
  7639. -
  7640. -@@ -1090,10 +1126,22 @@ void ieee80211_sta_ps_deliver_wakeup(str
  7641. -
  7642. - BUILD_BUG_ON(BITS_TO_LONGS(IEEE80211_NUM_TIDS) > 1);
  7643. - sta->driver_buffered_tids = 0;
  7644. -+ sta->txq_buffered_tids = 0;
  7645. -
  7646. - if (!(local->hw.flags & IEEE80211_HW_AP_LINK_PS))
  7647. - drv_sta_notify(local, sdata, STA_NOTIFY_AWAKE, &sta->sta);
  7648. -
  7649. -+ if (sta->sta.txq[0]) {
  7650. -+ for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) {
  7651. -+ struct txq_info *txqi = to_txq_info(sta->sta.txq[i]);
  7652. -+
  7653. -+ if (!skb_queue_len(&txqi->queue))
  7654. -+ continue;
  7655. -+
  7656. -+ drv_wake_tx_queue(local, txqi);
  7657. -+ }
  7658. -+ }
  7659. -+
  7660. - skb_queue_head_init(&pending);
  7661. -
  7662. - /* sync with ieee80211_tx_h_unicast_ps_buf */
  7663. -@@ -1275,8 +1323,10 @@ ieee80211_sta_ps_deliver_response(struct
  7664. - /* if we already have frames from software, then we can't also
  7665. - * release from hardware queues
  7666. - */
  7667. -- if (skb_queue_empty(&frames))
  7668. -+ if (skb_queue_empty(&frames)) {
  7669. - driver_release_tids |= sta->driver_buffered_tids & tids;
  7670. -+ driver_release_tids |= sta->txq_buffered_tids & tids;
  7671. -+ }
  7672. -
  7673. - if (driver_release_tids) {
  7674. - /* If the driver has data on more than one TID then
  7675. -@@ -1447,6 +1497,9 @@ ieee80211_sta_ps_deliver_response(struct
  7676. -
  7677. - sta_info_recalc_tim(sta);
  7678. - } else {
  7679. -+ unsigned long tids = sta->txq_buffered_tids & driver_release_tids;
  7680. -+ int tid;
  7681. -+
  7682. - /*
  7683. - * We need to release a frame that is buffered somewhere in the
  7684. - * driver ... it'll have to handle that.
  7685. -@@ -1466,8 +1519,22 @@ ieee80211_sta_ps_deliver_response(struct
  7686. - * that the TID(s) became empty before returning here from the
  7687. - * release function.
  7688. - * Either way, however, when the driver tells us that the TID(s)
  7689. -- * became empty we'll do the TIM recalculation.
  7690. -+ * became empty or we find that a txq became empty, we'll do the
  7691. -+ * TIM recalculation.
  7692. - */
  7693. -+
  7694. -+ if (!sta->sta.txq[0])
  7695. -+ return;
  7696. -+
  7697. -+ for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) {
  7698. -+ struct txq_info *txqi = to_txq_info(sta->sta.txq[tid]);
  7699. -+
  7700. -+ if (!(tids & BIT(tid)) || skb_queue_len(&txqi->queue))
  7701. -+ continue;
  7702. -+
  7703. -+ sta_info_recalc_tim(sta);
  7704. -+ break;
  7705. -+ }
  7706. - }
  7707. - }
  7708. -
  7709. ---- a/net/mac80211/sta_info.h
  7710. -+++ b/net/mac80211/sta_info.h
  7711. -@@ -274,6 +274,7 @@ struct sta_ampdu_mlme {
  7712. - * entered power saving state, these are also delivered to
  7713. - * the station when it leaves powersave or polls for frames
  7714. - * @driver_buffered_tids: bitmap of TIDs the driver has data buffered on
  7715. -+ * @txq_buffered_tids: bitmap of TIDs that mac80211 has txq data buffered on
  7716. - * @rx_packets: Number of MSDUs received from this STA
  7717. - * @rx_bytes: Number of bytes received from this STA
  7718. - * @last_rx: time (in jiffies) when last frame was received from this STA
  7719. -@@ -368,6 +369,7 @@ struct sta_info {
  7720. - struct sk_buff_head ps_tx_buf[IEEE80211_NUM_ACS];
  7721. - struct sk_buff_head tx_filtered[IEEE80211_NUM_ACS];
  7722. - unsigned long driver_buffered_tids;
  7723. -+ unsigned long txq_buffered_tids;
  7724. -
  7725. - /* Updated from RX path only, no locking requirements */
  7726. - unsigned long rx_packets;
  7727. ---- a/net/mac80211/trace.h
  7728. -+++ b/net/mac80211/trace.h
  7729. -@@ -2312,6 +2312,37 @@ TRACE_EVENT(drv_tdls_recv_channel_switch
  7730. - )
  7731. - );
  7732. -
  7733. -+TRACE_EVENT(drv_wake_tx_queue,
  7734. -+ TP_PROTO(struct ieee80211_local *local,
  7735. -+ struct ieee80211_sub_if_data *sdata,
  7736. -+ struct txq_info *txq),
  7737. -+
  7738. -+ TP_ARGS(local, sdata, txq),
  7739. -+
  7740. -+ TP_STRUCT__entry(
  7741. -+ LOCAL_ENTRY
  7742. -+ VIF_ENTRY
  7743. -+ STA_ENTRY
  7744. -+ __field(u8, ac)
  7745. -+ __field(u8, tid)
  7746. -+ ),
  7747. -+
  7748. -+ TP_fast_assign(
  7749. -+ struct ieee80211_sta *sta = txq->txq.sta;
  7750. -+
  7751. -+ LOCAL_ASSIGN;
  7752. -+ VIF_ASSIGN;
  7753. -+ STA_ASSIGN;
  7754. -+ __entry->ac = txq->txq.ac;
  7755. -+ __entry->tid = txq->txq.tid;
  7756. -+ ),
  7757. -+
  7758. -+ TP_printk(
  7759. -+ LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " ac:%d tid:%d",
  7760. -+ LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->ac, __entry->tid
  7761. -+ )
  7762. -+);
  7763. -+
  7764. - #ifdef CPTCFG_MAC80211_MESSAGE_TRACING
  7765. - #undef TRACE_SYSTEM
  7766. - #define TRACE_SYSTEM mac80211_msg
  7767. ---- a/net/mac80211/tx.c
  7768. -+++ b/net/mac80211/tx.c
  7769. -@@ -776,12 +776,22 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021
  7770. - return TX_CONTINUE;
  7771. - }
  7772. -
  7773. -+static __le16 ieee80211_tx_next_seq(struct sta_info *sta, int tid)
  7774. -+{
  7775. -+ u16 *seq = &sta->tid_seq[tid];
  7776. -+ __le16 ret = cpu_to_le16(*seq);
  7777. -+
  7778. -+ /* Increase the sequence number. */
  7779. -+ *seq = (*seq + 0x10) & IEEE80211_SCTL_SEQ;
  7780. -+
  7781. -+ return ret;
  7782. -+}
  7783. -+
  7784. - static ieee80211_tx_result debug_noinline
  7785. - ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx)
  7786. - {
  7787. - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
  7788. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
  7789. -- u16 *seq;
  7790. - u8 *qc;
  7791. - int tid;
  7792. -
  7793. -@@ -832,13 +842,10 @@ ieee80211_tx_h_sequence(struct ieee80211
  7794. -
  7795. - qc = ieee80211_get_qos_ctl(hdr);
  7796. - tid = *qc & IEEE80211_QOS_CTL_TID_MASK;
  7797. -- seq = &tx->sta->tid_seq[tid];
  7798. - tx->sta->tx_msdu[tid]++;
  7799. -
  7800. -- hdr->seq_ctrl = cpu_to_le16(*seq);
  7801. --
  7802. -- /* Increase the sequence number. */
  7803. -- *seq = (*seq + 0x10) & IEEE80211_SCTL_SEQ;
  7804. -+ if (!tx->sta->sta.txq[0])
  7805. -+ hdr->seq_ctrl = ieee80211_tx_next_seq(tx->sta, tid);
  7806. -
  7807. - return TX_CONTINUE;
  7808. - }
  7809. -@@ -1067,7 +1074,7 @@ static bool ieee80211_tx_prep_agg(struct
  7810. - * nothing -- this aggregation session is being started
  7811. - * but that might still fail with the driver
  7812. - */
  7813. -- } else {
  7814. -+ } else if (!tx->sta->sta.txq[tid]) {
  7815. - spin_lock(&tx->sta->lock);
  7816. - /*
  7817. - * Need to re-check now, because we may get here
  7818. -@@ -1201,13 +1208,102 @@ ieee80211_tx_prepare(struct ieee80211_su
  7819. - return TX_CONTINUE;
  7820. - }
  7821. -
  7822. -+static void ieee80211_drv_tx(struct ieee80211_local *local,
  7823. -+ struct ieee80211_vif *vif,
  7824. -+ struct ieee80211_sta *pubsta,
  7825. -+ struct sk_buff *skb)
  7826. -+{
  7827. -+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  7828. -+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
  7829. -+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  7830. -+ struct ieee80211_tx_control control = {
  7831. -+ .sta = pubsta,
  7832. -+ };
  7833. -+ struct ieee80211_txq *txq = NULL;
  7834. -+ struct txq_info *txqi;
  7835. -+ u8 ac;
  7836. -+
  7837. -+ if (info->control.flags & IEEE80211_TX_CTRL_PS_RESPONSE)
  7838. -+ goto tx_normal;
  7839. -+
  7840. -+ if (!ieee80211_is_data(hdr->frame_control))
  7841. -+ goto tx_normal;
  7842. -+
  7843. -+ if (pubsta) {
  7844. -+ u8 tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK;
  7845. -+
  7846. -+ txq = pubsta->txq[tid];
  7847. -+ } else if (vif) {
  7848. -+ txq = vif->txq;
  7849. -+ }
  7850. -+
  7851. -+ if (!txq)
  7852. -+ goto tx_normal;
  7853. -+
  7854. -+ ac = txq->ac;
  7855. -+ txqi = to_txq_info(txq);
  7856. -+ atomic_inc(&sdata->txqs_len[ac]);
  7857. -+ if (atomic_read(&sdata->txqs_len[ac]) >= local->hw.txq_ac_max_pending)
  7858. -+ netif_stop_subqueue(sdata->dev, ac);
  7859. -+
  7860. -+ skb_queue_tail(&txqi->queue, skb);
  7861. -+ drv_wake_tx_queue(local, txqi);
  7862. -+
  7863. -+ return;
  7864. -+
  7865. -+tx_normal:
  7866. -+ drv_tx(local, &control, skb);
  7867. -+}
  7868. -+
  7869. -+struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
  7870. -+ struct ieee80211_txq *txq)
  7871. -+{
  7872. -+ struct ieee80211_local *local = hw_to_local(hw);
  7873. -+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->vif);
  7874. -+ struct txq_info *txqi = container_of(txq, struct txq_info, txq);
  7875. -+ struct ieee80211_hdr *hdr;
  7876. -+ struct sk_buff *skb = NULL;
  7877. -+ u8 ac = txq->ac;
  7878. -+
  7879. -+ spin_lock_bh(&txqi->queue.lock);
  7880. -+
  7881. -+ if (test_bit(IEEE80211_TXQ_STOP, &txqi->flags))
  7882. -+ goto out;
  7883. -+
  7884. -+ skb = __skb_dequeue(&txqi->queue);
  7885. -+ if (!skb)
  7886. -+ goto out;
  7887. -+
  7888. -+ atomic_dec(&sdata->txqs_len[ac]);
  7889. -+ if (__netif_subqueue_stopped(sdata->dev, ac))
  7890. -+ ieee80211_propagate_queue_wake(local, sdata->vif.hw_queue[ac]);
  7891. -+
  7892. -+ hdr = (struct ieee80211_hdr *)skb->data;
  7893. -+ if (txq->sta && ieee80211_is_data_qos(hdr->frame_control)) {
  7894. -+ struct sta_info *sta = container_of(txq->sta, struct sta_info,
  7895. -+ sta);
  7896. -+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  7897. -+
  7898. -+ hdr->seq_ctrl = ieee80211_tx_next_seq(sta, txq->tid);
  7899. -+ if (test_bit(IEEE80211_TXQ_AMPDU, &txqi->flags))
  7900. -+ info->flags |= IEEE80211_TX_CTL_AMPDU;
  7901. -+ else
  7902. -+ info->flags &= ~IEEE80211_TX_CTL_AMPDU;
  7903. -+ }
  7904. -+
  7905. -+out:
  7906. -+ spin_unlock_bh(&txqi->queue.lock);
  7907. -+
  7908. -+ return skb;
  7909. -+}
  7910. -+EXPORT_SYMBOL(ieee80211_tx_dequeue);
  7911. -+
  7912. - static bool ieee80211_tx_frags(struct ieee80211_local *local,
  7913. - struct ieee80211_vif *vif,
  7914. - struct ieee80211_sta *sta,
  7915. - struct sk_buff_head *skbs,
  7916. - bool txpending)
  7917. - {
  7918. -- struct ieee80211_tx_control control;
  7919. - struct sk_buff *skb, *tmp;
  7920. - unsigned long flags;
  7921. -
  7922. -@@ -1265,10 +1361,9 @@ static bool ieee80211_tx_frags(struct ie
  7923. - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
  7924. -
  7925. - info->control.vif = vif;
  7926. -- control.sta = sta;
  7927. -
  7928. - __skb_unlink(skb, skbs);
  7929. -- drv_tx(local, &control, skb);
  7930. -+ ieee80211_drv_tx(local, vif, sta, skb);
  7931. - }
  7932. -
  7933. - return true;
  7934. ---- a/net/mac80211/util.c
  7935. -+++ b/net/mac80211/util.c
  7936. -@@ -308,6 +308,11 @@ void ieee80211_propagate_queue_wake(stru
  7937. - for (ac = 0; ac < n_acs; ac++) {
  7938. - int ac_queue = sdata->vif.hw_queue[ac];
  7939. -
  7940. -+ if (local->ops->wake_tx_queue &&
  7941. -+ (atomic_read(&sdata->txqs_len[ac]) >
  7942. -+ local->hw.txq_ac_max_pending))
  7943. -+ continue;
  7944. -+
  7945. - if (ac_queue == queue ||
  7946. - (sdata->vif.cab_queue == queue &&
  7947. - local->queue_stop_reasons[ac_queue] == 0 &&
  7948. -@@ -3307,3 +3312,20 @@ u8 *ieee80211_add_wmm_info_ie(u8 *buf, u
  7949. -
  7950. - return buf;
  7951. - }
  7952. -+
  7953. -+void ieee80211_init_tx_queue(struct ieee80211_sub_if_data *sdata,
  7954. -+ struct sta_info *sta,
  7955. -+ struct txq_info *txqi, int tid)
  7956. -+{
  7957. -+ skb_queue_head_init(&txqi->queue);
  7958. -+ txqi->txq.vif = &sdata->vif;
  7959. -+
  7960. -+ if (sta) {
  7961. -+ txqi->txq.sta = &sta->sta;
  7962. -+ sta->sta.txq[tid] = &txqi->txq;
  7963. -+ txqi->txq.ac = ieee802_1d_to_ac[tid & 7];
  7964. -+ } else {
  7965. -+ sdata->vif.txq = &txqi->txq;
  7966. -+ txqi->txq.ac = IEEE80211_AC_BE;
  7967. -+ }
  7968. -+}
  7969. ---- a/net/mac80211/rx.c
  7970. -+++ b/net/mac80211/rx.c
  7971. -@@ -1176,6 +1176,7 @@ static void sta_ps_start(struct sta_info
  7972. - struct ieee80211_sub_if_data *sdata = sta->sdata;
  7973. - struct ieee80211_local *local = sdata->local;
  7974. - struct ps_data *ps;
  7975. -+ int tid;
  7976. -
  7977. - if (sta->sdata->vif.type == NL80211_IFTYPE_AP ||
  7978. - sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
  7979. -@@ -1189,6 +1190,18 @@ static void sta_ps_start(struct sta_info
  7980. - drv_sta_notify(local, sdata, STA_NOTIFY_SLEEP, &sta->sta);
  7981. - ps_dbg(sdata, "STA %pM aid %d enters power save mode\n",
  7982. - sta->sta.addr, sta->sta.aid);
  7983. -+
  7984. -+ if (!sta->sta.txq[0])
  7985. -+ return;
  7986. -+
  7987. -+ for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) {
  7988. -+ struct txq_info *txqi = to_txq_info(sta->sta.txq[tid]);
  7989. -+
  7990. -+ if (!skb_queue_len(&txqi->queue))
  7991. -+ set_bit(tid, &sta->txq_buffered_tids);
  7992. -+ else
  7993. -+ clear_bit(tid, &sta->txq_buffered_tids);
  7994. -+ }
  7995. - }
  7996. -
  7997. - static void sta_ps_end(struct sta_info *sta)
  7998. ---- a/net/mac80211/agg-tx.c
  7999. -+++ b/net/mac80211/agg-tx.c
  8000. -@@ -188,6 +188,43 @@ ieee80211_wake_queue_agg(struct ieee8021
  8001. - __release(agg_queue);
  8002. - }
  8003. -
  8004. -+static void
  8005. -+ieee80211_agg_stop_txq(struct sta_info *sta, int tid)
  8006. -+{
  8007. -+ struct ieee80211_txq *txq = sta->sta.txq[tid];
  8008. -+ struct txq_info *txqi;
  8009. -+
  8010. -+ if (!txq)
  8011. -+ return;
  8012. -+
  8013. -+ txqi = to_txq_info(txq);
  8014. -+
  8015. -+ /* Lock here to protect against further seqno updates on dequeue */
  8016. -+ spin_lock_bh(&txqi->queue.lock);
  8017. -+ set_bit(IEEE80211_TXQ_STOP, &txqi->flags);
  8018. -+ spin_unlock_bh(&txqi->queue.lock);
  8019. -+}
  8020. -+
  8021. -+static void
  8022. -+ieee80211_agg_start_txq(struct sta_info *sta, int tid, bool enable)
  8023. -+{
  8024. -+ struct ieee80211_txq *txq = sta->sta.txq[tid];
  8025. -+ struct txq_info *txqi;
  8026. -+
  8027. -+ if (!txq)
  8028. -+ return;
  8029. -+
  8030. -+ txqi = to_txq_info(txq);
  8031. -+
  8032. -+ if (enable)
  8033. -+ set_bit(IEEE80211_TXQ_AMPDU, &txqi->flags);
  8034. -+ else
  8035. -+ clear_bit(IEEE80211_TXQ_AMPDU, &txqi->flags);
  8036. -+
  8037. -+ clear_bit(IEEE80211_TXQ_STOP, &txqi->flags);
  8038. -+ drv_wake_tx_queue(sta->sdata->local, txqi);
  8039. -+}
  8040. -+
  8041. - /*
  8042. - * splice packets from the STA's pending to the local pending,
  8043. - * requires a call to ieee80211_agg_splice_finish later
  8044. -@@ -247,6 +284,7 @@ static void ieee80211_remove_tid_tx(stru
  8045. - ieee80211_assign_tid_tx(sta, tid, NULL);
  8046. -
  8047. - ieee80211_agg_splice_finish(sta->sdata, tid);
  8048. -+ ieee80211_agg_start_txq(sta, tid, false);
  8049. -
  8050. - kfree_rcu(tid_tx, rcu_head);
  8051. - }
  8052. -@@ -418,6 +456,8 @@ void ieee80211_tx_ba_session_handle_star
  8053. - */
  8054. - clear_bit(HT_AGG_STATE_WANT_START, &tid_tx->state);
  8055. -
  8056. -+ ieee80211_agg_stop_txq(sta, tid);
  8057. -+
  8058. - /*
  8059. - * Make sure no packets are being processed. This ensures that
  8060. - * we have a valid starting sequence number and that in-flight
  8061. -@@ -440,6 +480,8 @@ void ieee80211_tx_ba_session_handle_star
  8062. - ieee80211_agg_splice_finish(sdata, tid);
  8063. - spin_unlock_bh(&sta->lock);
  8064. -
  8065. -+ ieee80211_agg_start_txq(sta, tid, false);
  8066. -+
  8067. - kfree_rcu(tid_tx, rcu_head);
  8068. - return;
  8069. - }
  8070. -@@ -666,6 +708,8 @@ static void ieee80211_agg_tx_operational
  8071. - ieee80211_agg_splice_finish(sta->sdata, tid);
  8072. -
  8073. - spin_unlock_bh(&sta->lock);
  8074. -+
  8075. -+ ieee80211_agg_start_txq(sta, tid, true);
  8076. - }
  8077. -
  8078. - void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid)
  8079. 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
  8080. new file mode 100644
  8081. index 0000000..a160dc4
  8082. --- /dev/null
  8083. +++ b/package/kernel/mac80211/patches/301-ath9k-limit-retries-for-powersave-response-frames.patch
  8084. @@ -0,0 +1,121 @@
  8085. +From: Felix Fietkau <nbd@openwrt.org>
  8086. +Date: Thu, 2 Jul 2015 15:20:56 +0200
  8087. +Subject: [PATCH] ath9k: limit retries for powersave response frames
  8088. +
  8089. +In some cases, the channel might be busy enough that an ath9k AP's
  8090. +response to PS-Poll frames might be too slow and the station has already
  8091. +gone to sleep. To avoid wasting too much airtime on this, limit the
  8092. +number of retries on such frames and ensure that no sample rate gets
  8093. +used.
  8094. +
  8095. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8096. +---
  8097. +
  8098. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  8099. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  8100. +@@ -136,10 +136,25 @@ static void ath_send_bar(struct ath_atx_
  8101. + }
  8102. +
  8103. + static void ath_set_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta,
  8104. +- struct ath_buf *bf)
  8105. ++ struct ath_buf *bf, bool ps)
  8106. + {
  8107. ++ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(bf->bf_mpdu);
  8108. ++
  8109. ++ if (ps) {
  8110. ++ /* Clear the first rate to avoid using a sample rate for PS frames */
  8111. ++ info->control.rates[0].idx = -1;
  8112. ++ info->control.rates[0].count = 0;
  8113. ++ }
  8114. ++
  8115. + ieee80211_get_tx_rates(vif, sta, bf->bf_mpdu, bf->rates,
  8116. + ARRAY_SIZE(bf->rates));
  8117. ++ if (!ps)
  8118. ++ return;
  8119. ++
  8120. ++ if (bf->rates[0].count > 2)
  8121. ++ bf->rates[0].count = 2;
  8122. ++
  8123. ++ bf->rates[1].idx = -1;
  8124. + }
  8125. +
  8126. + static void ath_txq_skb_done(struct ath_softc *sc, struct ath_txq *txq,
  8127. +@@ -1419,7 +1434,7 @@ ath_tx_form_burst(struct ath_softc *sc,
  8128. + if (tx_info->flags & IEEE80211_TX_CTL_AMPDU)
  8129. + break;
  8130. +
  8131. +- ath_set_rates(tid->an->vif, tid->an->sta, bf);
  8132. ++ ath_set_rates(tid->an->vif, tid->an->sta, bf, false);
  8133. + } while (1);
  8134. + }
  8135. +
  8136. +@@ -1450,7 +1465,7 @@ static bool ath_tx_sched_aggr(struct ath
  8137. + return false;
  8138. + }
  8139. +
  8140. +- ath_set_rates(tid->an->vif, tid->an->sta, bf);
  8141. ++ ath_set_rates(tid->an->vif, tid->an->sta, bf, false);
  8142. + if (aggr)
  8143. + last = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf,
  8144. + tid_q, &aggr_len);
  8145. +@@ -1647,7 +1662,7 @@ void ath9k_release_buffered_frames(struc
  8146. +
  8147. + __skb_unlink(bf->bf_mpdu, tid_q);
  8148. + list_add_tail(&bf->list, &bf_q);
  8149. +- ath_set_rates(tid->an->vif, tid->an->sta, bf);
  8150. ++ ath_set_rates(tid->an->vif, tid->an->sta, bf, true);
  8151. + if (bf_isampdu(bf)) {
  8152. + ath_tx_addto_baw(sc, tid, bf);
  8153. + bf->bf_state.bf_type &= ~BUF_AGGR;
  8154. +@@ -2293,7 +2308,7 @@ int ath_tx_start(struct ieee80211_hw *hw
  8155. + struct ath_txq *txq = txctl->txq;
  8156. + struct ath_atx_tid *tid = NULL;
  8157. + struct ath_buf *bf;
  8158. +- bool queue, skip_uapsd = false, ps_resp;
  8159. ++ bool queue, ps_resp;
  8160. + int q, ret;
  8161. +
  8162. + if (vif)
  8163. +@@ -2346,13 +2361,13 @@ int ath_tx_start(struct ieee80211_hw *hw
  8164. + if (!txctl->an)
  8165. + txctl->an = &avp->mcast_node;
  8166. + queue = true;
  8167. +- skip_uapsd = true;
  8168. ++ ps_resp = false;
  8169. + }
  8170. +
  8171. + if (txctl->an && queue)
  8172. + tid = ath_get_skb_tid(sc, txctl->an, skb);
  8173. +
  8174. +- if (!skip_uapsd && ps_resp) {
  8175. ++ if (ps_resp) {
  8176. + ath_txq_unlock(sc, txq);
  8177. + txq = sc->tx.uapsdq;
  8178. + ath_txq_lock(sc, txq);
  8179. +@@ -2390,7 +2405,7 @@ int ath_tx_start(struct ieee80211_hw *hw
  8180. + if (txctl->paprd)
  8181. + bf->bf_state.bfs_paprd_timestamp = jiffies;
  8182. +
  8183. +- ath_set_rates(vif, sta, bf);
  8184. ++ ath_set_rates(vif, sta, bf, ps_resp);
  8185. + ath_tx_send_normal(sc, txq, tid, skb);
  8186. +
  8187. + out:
  8188. +@@ -2429,7 +2444,7 @@ void ath_tx_cabq(struct ieee80211_hw *hw
  8189. + break;
  8190. +
  8191. + bf->bf_lastbf = bf;
  8192. +- ath_set_rates(vif, NULL, bf);
  8193. ++ ath_set_rates(vif, NULL, bf, false);
  8194. + ath_buf_set_rate(sc, bf, &info, fi->framelen, false);
  8195. + duration += info.rates[0].PktDuration;
  8196. + if (bf_tail)
  8197. +@@ -2932,7 +2947,7 @@ int ath9k_tx99_send(struct ath_softc *sc
  8198. + return -EINVAL;
  8199. + }
  8200. +
  8201. +- ath_set_rates(sc->tx99_vif, NULL, bf);
  8202. ++ ath_set_rates(sc->tx99_vif, NULL, bf, false);
  8203. +
  8204. + ath9k_hw_set_desc_link(sc->sc_ah, bf->bf_desc, bf->bf_daddr);
  8205. + ath9k_hw_tx99_start(sc->sc_ah, txctl->txq->axq_qnum);
  8206. diff --git a/package/kernel/mac80211/patches/301-mac80211-lock-rate-control.patch b/package/kernel/mac80211/patches/301-mac80211-lock-rate-control.patch
  8207. deleted file mode 100644
  8208. index 465d943..0000000
  8209. --- a/package/kernel/mac80211/patches/301-mac80211-lock-rate-control.patch
  8210. +++ /dev/null
  8211. @@ -1,125 +0,0 @@
  8212. -From: Johannes Berg <johannes.berg@intel.com>
  8213. -Date: Wed, 11 Mar 2015 09:14:15 +0100
  8214. -Subject: [PATCH] mac80211: lock rate control
  8215. -
  8216. -Both minstrel (reported by Sven Eckelmann) and the iwlwifi rate
  8217. -control aren't properly taking concurrency into account. It's
  8218. -likely that the same is true for other rate control algorithms.
  8219. -
  8220. -In the case of minstrel this manifests itself in crashes when an
  8221. -update and other data access are run concurrently, for example
  8222. -when the stations change bandwidth or similar. In iwlwifi, this
  8223. -can cause firmware crashes.
  8224. -
  8225. -Since fixing all rate control algorithms will be very difficult,
  8226. -just provide locking for invocations. This protects the internal
  8227. -data structures the algorithms maintain.
  8228. -
  8229. -I've manipulated hostapd to test this, by having it change its
  8230. -advertised bandwidth roughly ever 150ms. At the same time, I'm
  8231. -running a flood ping between the client and the AP, which causes
  8232. -this race of update vs. get_rate/status to easily happen on the
  8233. -client. With this change, the system survives this test.
  8234. -
  8235. -Reported-by: Sven Eckelmann <sven@open-mesh.com>
  8236. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  8237. ----
  8238. -
  8239. ---- a/net/mac80211/rate.c
  8240. -+++ b/net/mac80211/rate.c
  8241. -@@ -683,7 +683,13 @@ void rate_control_get_rate(struct ieee80
  8242. - if (sdata->local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL)
  8243. - return;
  8244. -
  8245. -- ref->ops->get_rate(ref->priv, ista, priv_sta, txrc);
  8246. -+ if (ista) {
  8247. -+ spin_lock_bh(&sta->rate_ctrl_lock);
  8248. -+ ref->ops->get_rate(ref->priv, ista, priv_sta, txrc);
  8249. -+ spin_unlock_bh(&sta->rate_ctrl_lock);
  8250. -+ } else {
  8251. -+ ref->ops->get_rate(ref->priv, NULL, NULL, txrc);
  8252. -+ }
  8253. -
  8254. - if (sdata->local->hw.flags & IEEE80211_HW_SUPPORTS_RC_TABLE)
  8255. - return;
  8256. ---- a/net/mac80211/rate.h
  8257. -+++ b/net/mac80211/rate.h
  8258. -@@ -42,10 +42,12 @@ static inline void rate_control_tx_statu
  8259. - if (!ref || !test_sta_flag(sta, WLAN_STA_RATE_CONTROL))
  8260. - return;
  8261. -
  8262. -+ spin_lock_bh(&sta->rate_ctrl_lock);
  8263. - if (ref->ops->tx_status)
  8264. - ref->ops->tx_status(ref->priv, sband, ista, priv_sta, skb);
  8265. - else
  8266. - ref->ops->tx_status_noskb(ref->priv, sband, ista, priv_sta, info);
  8267. -+ spin_unlock_bh(&sta->rate_ctrl_lock);
  8268. - }
  8269. -
  8270. - static inline void
  8271. -@@ -64,7 +66,9 @@ rate_control_tx_status_noskb(struct ieee
  8272. - if (WARN_ON_ONCE(!ref->ops->tx_status_noskb))
  8273. - return;
  8274. -
  8275. -+ spin_lock_bh(&sta->rate_ctrl_lock);
  8276. - ref->ops->tx_status_noskb(ref->priv, sband, ista, priv_sta, info);
  8277. -+ spin_unlock_bh(&sta->rate_ctrl_lock);
  8278. - }
  8279. -
  8280. - static inline void rate_control_rate_init(struct sta_info *sta)
  8281. -@@ -91,8 +95,10 @@ static inline void rate_control_rate_ini
  8282. -
  8283. - sband = local->hw.wiphy->bands[chanctx_conf->def.chan->band];
  8284. -
  8285. -+ spin_lock_bh(&sta->rate_ctrl_lock);
  8286. - ref->ops->rate_init(ref->priv, sband, &chanctx_conf->def, ista,
  8287. - priv_sta);
  8288. -+ spin_unlock_bh(&sta->rate_ctrl_lock);
  8289. - rcu_read_unlock();
  8290. - set_sta_flag(sta, WLAN_STA_RATE_CONTROL);
  8291. - }
  8292. -@@ -115,18 +121,20 @@ static inline void rate_control_rate_upd
  8293. - return;
  8294. - }
  8295. -
  8296. -+ spin_lock_bh(&sta->rate_ctrl_lock);
  8297. - ref->ops->rate_update(ref->priv, sband, &chanctx_conf->def,
  8298. - ista, priv_sta, changed);
  8299. -+ spin_unlock_bh(&sta->rate_ctrl_lock);
  8300. - rcu_read_unlock();
  8301. - }
  8302. - drv_sta_rc_update(local, sta->sdata, &sta->sta, changed);
  8303. - }
  8304. -
  8305. - static inline void *rate_control_alloc_sta(struct rate_control_ref *ref,
  8306. -- struct ieee80211_sta *sta,
  8307. -- gfp_t gfp)
  8308. -+ struct sta_info *sta, gfp_t gfp)
  8309. - {
  8310. -- return ref->ops->alloc_sta(ref->priv, sta, gfp);
  8311. -+ spin_lock_init(&sta->rate_ctrl_lock);
  8312. -+ return ref->ops->alloc_sta(ref->priv, &sta->sta, gfp);
  8313. - }
  8314. -
  8315. - static inline void rate_control_free_sta(struct sta_info *sta)
  8316. ---- a/net/mac80211/sta_info.c
  8317. -+++ b/net/mac80211/sta_info.c
  8318. -@@ -286,7 +286,7 @@ static int sta_prepare_rate_control(stru
  8319. -
  8320. - sta->rate_ctrl = local->rate_ctrl;
  8321. - sta->rate_ctrl_priv = rate_control_alloc_sta(sta->rate_ctrl,
  8322. -- &sta->sta, gfp);
  8323. -+ sta, gfp);
  8324. - if (!sta->rate_ctrl_priv)
  8325. - return -ENOMEM;
  8326. -
  8327. ---- a/net/mac80211/sta_info.h
  8328. -+++ b/net/mac80211/sta_info.h
  8329. -@@ -349,6 +349,7 @@ struct sta_info {
  8330. - u8 ptk_idx;
  8331. - struct rate_control_ref *rate_ctrl;
  8332. - void *rate_ctrl_priv;
  8333. -+ spinlock_t rate_ctrl_lock;
  8334. - spinlock_t lock;
  8335. -
  8336. - struct work_struct drv_deliver_wk;
  8337. 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
  8338. deleted file mode 100644
  8339. index e54e16e..0000000
  8340. --- a/package/kernel/mac80211/patches/302-ath9k-restart-only-triggering-DFS-detector-line.patch
  8341. +++ /dev/null
  8342. @@ -1,21 +0,0 @@
  8343. -From: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  8344. -Date: Tue, 10 Mar 2015 17:49:29 +0100
  8345. -Subject: [PATCH] ath9k: restart only triggering DFS detector line
  8346. -
  8347. -To support HT40 DFS mode, a triggering detector must
  8348. -reset only itself but not other detector lines.
  8349. -
  8350. -Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  8351. ----
  8352. -
  8353. ---- a/drivers/net/wireless/ath/dfs_pattern_detector.c
  8354. -+++ b/drivers/net/wireless/ath/dfs_pattern_detector.c
  8355. -@@ -289,7 +289,7 @@ dpd_add_pulse(struct dfs_pattern_detecto
  8356. - "count=%d, count_false=%d\n",
  8357. - event->freq, pd->rs->type_id,
  8358. - ps->pri, ps->count, ps->count_falses);
  8359. -- channel_detector_reset(dpd, cd);
  8360. -+ pd->reset(pd, dpd->last_pulse_ts);
  8361. - return true;
  8362. - }
  8363. - }
  8364. 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
  8365. new file mode 100644
  8366. index 0000000..22b987a
  8367. --- /dev/null
  8368. +++ b/package/kernel/mac80211/patches/302-ath9k_hw-add-low-power-tx-gain-table-for-AR953x.patch
  8369. @@ -0,0 +1,95 @@
  8370. +From: Felix Fietkau <nbd@openwrt.org>
  8371. +Date: Thu, 14 Jan 2016 03:14:03 +0100
  8372. +Subject: [PATCH] ath9k_hw: add low power tx gain table for AR953x
  8373. +
  8374. +Used in some newer TP-Link AR9533 devices.
  8375. +
  8376. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8377. +---
  8378. +
  8379. +--- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c
  8380. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
  8381. +@@ -698,6 +698,9 @@ static void ar9003_tx_gain_table_mode2(s
  8382. + else if (AR_SREV_9340(ah))
  8383. + INIT_INI_ARRAY(&ah->iniModesTxGain,
  8384. + ar9340Modes_low_ob_db_tx_gain_table_1p0);
  8385. ++ else if (AR_SREV_9531_11(ah))
  8386. ++ INIT_INI_ARRAY(&ah->iniModesTxGain,
  8387. ++ qca953x_1p1_modes_no_xpa_low_power_tx_gain_table);
  8388. + else if (AR_SREV_9485_11_OR_LATER(ah))
  8389. + INIT_INI_ARRAY(&ah->iniModesTxGain,
  8390. + ar9485Modes_low_ob_db_tx_gain_1_1);
  8391. +--- a/drivers/net/wireless/ath/ath9k/ar953x_initvals.h
  8392. ++++ b/drivers/net/wireless/ath/ath9k/ar953x_initvals.h
  8393. +@@ -757,6 +757,71 @@ static const u32 qca953x_1p1_modes_xpa_t
  8394. + {0x00016448, 0x6c927a70},
  8395. + };
  8396. +
  8397. ++static const u32 qca953x_1p1_modes_no_xpa_low_power_tx_gain_table[][2] = {
  8398. ++ /* Addr allmodes */
  8399. ++ {0x0000a2dc, 0xfff55592},
  8400. ++ {0x0000a2e0, 0xfff99924},
  8401. ++ {0x0000a2e4, 0xfffe1e00},
  8402. ++ {0x0000a2e8, 0xffffe000},
  8403. ++ {0x0000a410, 0x000050d6},
  8404. ++ {0x0000a500, 0x00000069},
  8405. ++ {0x0000a504, 0x0400006b},
  8406. ++ {0x0000a508, 0x0800006d},
  8407. ++ {0x0000a50c, 0x0c000269},
  8408. ++ {0x0000a510, 0x1000026b},
  8409. ++ {0x0000a514, 0x1400026d},
  8410. ++ {0x0000a518, 0x18000669},
  8411. ++ {0x0000a51c, 0x1c00066b},
  8412. ++ {0x0000a520, 0x1d000a68},
  8413. ++ {0x0000a524, 0x21000a6a},
  8414. ++ {0x0000a528, 0x25000a6c},
  8415. ++ {0x0000a52c, 0x29000a6e},
  8416. ++ {0x0000a530, 0x2d0012a9},
  8417. ++ {0x0000a534, 0x310012ab},
  8418. ++ {0x0000a538, 0x350012ad},
  8419. ++ {0x0000a53c, 0x39001b0a},
  8420. ++ {0x0000a540, 0x3d001b0c},
  8421. ++ {0x0000a544, 0x41001b0e},
  8422. ++ {0x0000a548, 0x43001bae},
  8423. ++ {0x0000a54c, 0x45001914},
  8424. ++ {0x0000a550, 0x47001916},
  8425. ++ {0x0000a554, 0x49001b96},
  8426. ++ {0x0000a558, 0x49001b96},
  8427. ++ {0x0000a55c, 0x49001b96},
  8428. ++ {0x0000a560, 0x49001b96},
  8429. ++ {0x0000a564, 0x49001b96},
  8430. ++ {0x0000a568, 0x49001b96},
  8431. ++ {0x0000a56c, 0x49001b96},
  8432. ++ {0x0000a570, 0x49001b96},
  8433. ++ {0x0000a574, 0x49001b96},
  8434. ++ {0x0000a578, 0x49001b96},
  8435. ++ {0x0000a57c, 0x49001b96},
  8436. ++ {0x0000a600, 0x00000000},
  8437. ++ {0x0000a604, 0x00000000},
  8438. ++ {0x0000a608, 0x00000000},
  8439. ++ {0x0000a60c, 0x00000000},
  8440. ++ {0x0000a610, 0x00000000},
  8441. ++ {0x0000a614, 0x00000000},
  8442. ++ {0x0000a618, 0x00804201},
  8443. ++ {0x0000a61c, 0x01408201},
  8444. ++ {0x0000a620, 0x01408502},
  8445. ++ {0x0000a624, 0x01408502},
  8446. ++ {0x0000a628, 0x01408502},
  8447. ++ {0x0000a62c, 0x01408502},
  8448. ++ {0x0000a630, 0x01408502},
  8449. ++ {0x0000a634, 0x01408502},
  8450. ++ {0x0000a638, 0x01408502},
  8451. ++ {0x0000a63c, 0x01408502},
  8452. ++ {0x0000b2dc, 0xfff55592},
  8453. ++ {0x0000b2e0, 0xfff99924},
  8454. ++ {0x0000b2e4, 0xfffe1e00},
  8455. ++ {0x0000b2e8, 0xffffe000},
  8456. ++ {0x00016044, 0x044922db},
  8457. ++ {0x00016048, 0x6c927a70},
  8458. ++ {0x00016444, 0x044922db},
  8459. ++ {0x00016448, 0x6c927a70},
  8460. ++};
  8461. ++
  8462. + static const u32 qca953x_2p0_baseband_core[][2] = {
  8463. + /* Addr allmodes */
  8464. + {0x00009800, 0xafe68e30},
  8465. 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
  8466. deleted file mode 100644
  8467. index ed268ea..0000000
  8468. --- a/package/kernel/mac80211/patches/303-ath9k-add-DFS-support-for-extension-channel.patch
  8469. +++ /dev/null
  8470. @@ -1,76 +0,0 @@
  8471. -From: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  8472. -Date: Tue, 10 Mar 2015 17:49:30 +0100
  8473. -Subject: [PATCH] ath9k: add DFS support for extension channel
  8474. -
  8475. -In HT40 modes, pulse events on primary and extension
  8476. -channel are processed individually. If valid, a pulse
  8477. -event will be fed into the detector
  8478. -* for primary frequency, or
  8479. -* for extension frequency (+/-20MHz based on HT40-mode)
  8480. -* or both
  8481. -
  8482. -With that, a 40MHz radar will result in two individual
  8483. -radar events.
  8484. -
  8485. -Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  8486. ----
  8487. -
  8488. ---- a/drivers/net/wireless/ath/ath9k/dfs.c
  8489. -+++ b/drivers/net/wireless/ath/ath9k/dfs.c
  8490. -@@ -126,8 +126,19 @@ ath9k_postprocess_radar_event(struct ath
  8491. - DFS_STAT_INC(sc, pulses_detected);
  8492. - return true;
  8493. - }
  8494. --#undef PRI_CH_RADAR_FOUND
  8495. --#undef EXT_CH_RADAR_FOUND
  8496. -+
  8497. -+static void
  8498. -+ath9k_dfs_process_radar_pulse(struct ath_softc *sc, struct pulse_event *pe)
  8499. -+{
  8500. -+ struct dfs_pattern_detector *pd = sc->dfs_detector;
  8501. -+ DFS_STAT_INC(sc, pulses_processed);
  8502. -+ if (pd == NULL)
  8503. -+ return;
  8504. -+ if (!pd->add_pulse(pd, pe))
  8505. -+ return;
  8506. -+ DFS_STAT_INC(sc, radar_detected);
  8507. -+ ieee80211_radar_detected(sc->hw);
  8508. -+}
  8509. -
  8510. - /*
  8511. - * DFS: check PHY-error for radar pulse and feed the detector
  8512. -@@ -176,18 +187,21 @@ void ath9k_dfs_process_phyerr(struct ath
  8513. - ard.pulse_length_pri = vdata_end[-3];
  8514. - pe.freq = ah->curchan->channel;
  8515. - pe.ts = mactime;
  8516. -- if (ath9k_postprocess_radar_event(sc, &ard, &pe)) {
  8517. -- struct dfs_pattern_detector *pd = sc->dfs_detector;
  8518. -- ath_dbg(common, DFS,
  8519. -- "ath9k_dfs_process_phyerr: channel=%d, ts=%llu, "
  8520. -- "width=%d, rssi=%d, delta_ts=%llu\n",
  8521. -- pe.freq, pe.ts, pe.width, pe.rssi,
  8522. -- pe.ts - sc->dfs_prev_pulse_ts);
  8523. -- sc->dfs_prev_pulse_ts = pe.ts;
  8524. -- DFS_STAT_INC(sc, pulses_processed);
  8525. -- if (pd != NULL && pd->add_pulse(pd, &pe)) {
  8526. -- DFS_STAT_INC(sc, radar_detected);
  8527. -- ieee80211_radar_detected(sc->hw);
  8528. -- }
  8529. -+ if (!ath9k_postprocess_radar_event(sc, &ard, &pe))
  8530. -+ return;
  8531. -+
  8532. -+ ath_dbg(common, DFS,
  8533. -+ "ath9k_dfs_process_phyerr: type=%d, freq=%d, ts=%llu, "
  8534. -+ "width=%d, rssi=%d, delta_ts=%llu\n",
  8535. -+ ard.pulse_bw_info, pe.freq, pe.ts, pe.width, pe.rssi,
  8536. -+ pe.ts - sc->dfs_prev_pulse_ts);
  8537. -+ sc->dfs_prev_pulse_ts = pe.ts;
  8538. -+ if (ard.pulse_bw_info & PRI_CH_RADAR_FOUND)
  8539. -+ ath9k_dfs_process_radar_pulse(sc, &pe);
  8540. -+ if (ard.pulse_bw_info & EXT_CH_RADAR_FOUND) {
  8541. -+ pe.freq += IS_CHAN_HT40PLUS(ah->curchan) ? 20 : -20;
  8542. -+ ath9k_dfs_process_radar_pulse(sc, &pe);
  8543. - }
  8544. - }
  8545. -+#undef PRI_CH_RADAR_FOUND
  8546. -+#undef EXT_CH_RADAR_FOUND
  8547. 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
  8548. new file mode 100644
  8549. index 0000000..7bb7435
  8550. --- /dev/null
  8551. +++ b/package/kernel/mac80211/patches/303-rt2x00-fix-monitor-mode-regression.patch
  8552. @@ -0,0 +1,156 @@
  8553. +From: Eli Cooper <elicooper@gmx.com>
  8554. +Date: Thu, 14 Jan 2016 00:07:12 +0800
  8555. +Subject: [PATCH] rt2x00: fix monitor mode regression
  8556. +
  8557. +Since commit df1404650ccbfeb76a84f301f22316be0d00a864 monitor mode for rt2x00
  8558. +has been made effectively useless because the hardware filter is configured to
  8559. +drop packets whose intended recipient is not the device, regardless of the
  8560. +presence of monitor mode interfaces.
  8561. +
  8562. +This patch fixes this regression by adding explicit monitor mode support, and
  8563. +configuring the hardware filter accordingly.
  8564. +
  8565. +Signed-off-by: Eli Cooper <elicooper@gmx.com>
  8566. +---
  8567. +
  8568. +--- a/drivers/net/wireless/ralink/rt2x00/rt2400pci.c
  8569. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2400pci.c
  8570. +@@ -273,8 +273,10 @@ static void rt2400pci_config_filter(stru
  8571. + !(filter_flags & FIF_PLCPFAIL));
  8572. + rt2x00_set_field32(&reg, RXCSR0_DROP_CONTROL,
  8573. + !(filter_flags & FIF_CONTROL));
  8574. +- rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME, 1);
  8575. ++ rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME,
  8576. ++ !rt2x00dev->is_monitoring);
  8577. + rt2x00_set_field32(&reg, RXCSR0_DROP_TODS,
  8578. ++ !rt2x00dev->is_monitoring &&
  8579. + !rt2x00dev->intf_ap_count);
  8580. + rt2x00_set_field32(&reg, RXCSR0_DROP_VERSION_ERROR, 1);
  8581. + rt2x00mmio_register_write(rt2x00dev, RXCSR0, reg);
  8582. +--- a/drivers/net/wireless/ralink/rt2x00/rt2500pci.c
  8583. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2500pci.c
  8584. +@@ -274,8 +274,10 @@ static void rt2500pci_config_filter(stru
  8585. + !(filter_flags & FIF_PLCPFAIL));
  8586. + rt2x00_set_field32(&reg, RXCSR0_DROP_CONTROL,
  8587. + !(filter_flags & FIF_CONTROL));
  8588. +- rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME, 1);
  8589. ++ rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME,
  8590. ++ !rt2x00dev->is_monitoring);
  8591. + rt2x00_set_field32(&reg, RXCSR0_DROP_TODS,
  8592. ++ !rt2x00dev->is_monitoring &&
  8593. + !rt2x00dev->intf_ap_count);
  8594. + rt2x00_set_field32(&reg, RXCSR0_DROP_VERSION_ERROR, 1);
  8595. + rt2x00_set_field32(&reg, RXCSR0_DROP_MCAST,
  8596. +--- a/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
  8597. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
  8598. +@@ -437,8 +437,10 @@ static void rt2500usb_config_filter(stru
  8599. + !(filter_flags & FIF_PLCPFAIL));
  8600. + rt2x00_set_field16(&reg, TXRX_CSR2_DROP_CONTROL,
  8601. + !(filter_flags & FIF_CONTROL));
  8602. +- rt2x00_set_field16(&reg, TXRX_CSR2_DROP_NOT_TO_ME, 1);
  8603. ++ rt2x00_set_field16(&reg, TXRX_CSR2_DROP_NOT_TO_ME,
  8604. ++ !rt2x00dev->is_monitoring);
  8605. + rt2x00_set_field16(&reg, TXRX_CSR2_DROP_TODS,
  8606. ++ !rt2x00dev->is_monitoring &&
  8607. + !rt2x00dev->intf_ap_count);
  8608. + rt2x00_set_field16(&reg, TXRX_CSR2_DROP_VERSION_ERROR, 1);
  8609. + rt2x00_set_field16(&reg, TXRX_CSR2_DROP_MULTICAST,
  8610. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  8611. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  8612. +@@ -1490,7 +1490,8 @@ void rt2800_config_filter(struct rt2x00_
  8613. + !(filter_flags & FIF_FCSFAIL));
  8614. + rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_PHY_ERROR,
  8615. + !(filter_flags & FIF_PLCPFAIL));
  8616. +- rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_TO_ME, 1);
  8617. ++ rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_TO_ME,
  8618. ++ !rt2x00dev->is_monitoring);
  8619. + rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_MY_BSSD, 0);
  8620. + rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_VER_ERROR, 1);
  8621. + rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_MULTICAST,
  8622. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  8623. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  8624. +@@ -844,11 +844,13 @@ struct rt2x00_dev {
  8625. + * - Open sta interface count.
  8626. + * - Association count.
  8627. + * - Beaconing enabled count.
  8628. ++ * - Whether the device is monitoring.
  8629. + */
  8630. + unsigned int intf_ap_count;
  8631. + unsigned int intf_sta_count;
  8632. + unsigned int intf_associated;
  8633. + unsigned int intf_beaconing;
  8634. ++ bool is_monitoring;
  8635. +
  8636. + /*
  8637. + * Interface combinations
  8638. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00config.c
  8639. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00config.c
  8640. +@@ -244,6 +244,16 @@ void rt2x00lib_config(struct rt2x00_dev
  8641. + (ieee80211_flags & IEEE80211_CONF_CHANGE_PS))
  8642. + cancel_delayed_work_sync(&rt2x00dev->autowakeup_work);
  8643. +
  8644. ++ if (ieee80211_flags & IEEE80211_CONF_CHANGE_MONITOR) {
  8645. ++ if (conf->flags & IEEE80211_CONF_MONITOR) {
  8646. ++ rt2x00_dbg(rt2x00dev, "Monitor mode is enabled\n");
  8647. ++ rt2x00dev->is_monitoring = true;
  8648. ++ } else {
  8649. ++ rt2x00_dbg(rt2x00dev, "Monitor mode is disabled\n");
  8650. ++ rt2x00dev->is_monitoring = false;
  8651. ++ }
  8652. ++ }
  8653. ++
  8654. + /*
  8655. + * Start configuration.
  8656. + */
  8657. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  8658. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  8659. +@@ -1204,6 +1204,7 @@ int rt2x00lib_start(struct rt2x00_dev *r
  8660. + rt2x00dev->intf_ap_count = 0;
  8661. + rt2x00dev->intf_sta_count = 0;
  8662. + rt2x00dev->intf_associated = 0;
  8663. ++ rt2x00dev->is_monitoring = false;
  8664. +
  8665. + /* Enable the radio */
  8666. + retval = rt2x00lib_enable_radio(rt2x00dev);
  8667. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
  8668. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
  8669. +@@ -385,11 +385,6 @@ void rt2x00mac_configure_filter(struct i
  8670. + *total_flags |= FIF_PSPOLL;
  8671. + }
  8672. +
  8673. +- /*
  8674. +- * Check if there is any work left for us.
  8675. +- */
  8676. +- if (rt2x00dev->packet_filter == *total_flags)
  8677. +- return;
  8678. + rt2x00dev->packet_filter = *total_flags;
  8679. +
  8680. + rt2x00dev->ops->lib->config_filter(rt2x00dev, *total_flags);
  8681. +--- a/drivers/net/wireless/ralink/rt2x00/rt61pci.c
  8682. ++++ b/drivers/net/wireless/ralink/rt2x00/rt61pci.c
  8683. +@@ -530,8 +530,10 @@ static void rt61pci_config_filter(struct
  8684. + !(filter_flags & FIF_PLCPFAIL));
  8685. + rt2x00_set_field32(&reg, TXRX_CSR0_DROP_CONTROL,
  8686. + !(filter_flags & (FIF_CONTROL | FIF_PSPOLL)));
  8687. +- rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME, 1);
  8688. ++ rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME,
  8689. ++ !rt2x00dev->is_monitoring);
  8690. + rt2x00_set_field32(&reg, TXRX_CSR0_DROP_TO_DS,
  8691. ++ !rt2x00dev->is_monitoring &&
  8692. + !rt2x00dev->intf_ap_count);
  8693. + rt2x00_set_field32(&reg, TXRX_CSR0_DROP_VERSION_ERROR, 1);
  8694. + rt2x00_set_field32(&reg, TXRX_CSR0_DROP_MULTICAST,
  8695. +--- a/drivers/net/wireless/ralink/rt2x00/rt73usb.c
  8696. ++++ b/drivers/net/wireless/ralink/rt2x00/rt73usb.c
  8697. +@@ -480,8 +480,10 @@ static void rt73usb_config_filter(struct
  8698. + !(filter_flags & FIF_PLCPFAIL));
  8699. + rt2x00_set_field32(&reg, TXRX_CSR0_DROP_CONTROL,
  8700. + !(filter_flags & (FIF_CONTROL | FIF_PSPOLL)));
  8701. +- rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME, 1);
  8702. ++ rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME,
  8703. ++ !rt2x00dev->is_monitoring);
  8704. + rt2x00_set_field32(&reg, TXRX_CSR0_DROP_TO_DS,
  8705. ++ !rt2x00dev->is_monitoring &&
  8706. + !rt2x00dev->intf_ap_count);
  8707. + rt2x00_set_field32(&reg, TXRX_CSR0_DROP_VERSION_ERROR, 1);
  8708. + rt2x00_set_field32(&reg, TXRX_CSR0_DROP_MULTICAST,
  8709. 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
  8710. deleted file mode 100644
  8711. index e1eab64..0000000
  8712. --- a/package/kernel/mac80211/patches/304-ath9k-allow-40MHz-radar-detection-width.patch
  8713. +++ /dev/null
  8714. @@ -1,19 +0,0 @@
  8715. -From: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  8716. -Date: Tue, 10 Mar 2015 17:49:31 +0100
  8717. -Subject: [PATCH] ath9k: allow 40MHz radar detection width
  8718. -
  8719. -Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  8720. ----
  8721. -
  8722. ---- a/drivers/net/wireless/ath/ath9k/init.c
  8723. -+++ b/drivers/net/wireless/ath/ath9k/init.c
  8724. -@@ -763,7 +763,8 @@ static const struct ieee80211_iface_comb
  8725. - .num_different_channels = 1,
  8726. - .beacon_int_infra_match = true,
  8727. - .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
  8728. -- BIT(NL80211_CHAN_WIDTH_20),
  8729. -+ BIT(NL80211_CHAN_WIDTH_20) |
  8730. -+ BIT(NL80211_CHAN_WIDTH_40),
  8731. - }
  8732. - #endif
  8733. - };
  8734. 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
  8735. new file mode 100644
  8736. index 0000000..049059a
  8737. --- /dev/null
  8738. +++ b/package/kernel/mac80211/patches/304-ath9k-avoid-ANI-restart-if-no-trigger.patch
  8739. @@ -0,0 +1,32 @@
  8740. +From: Miaoqing Pan <miaoqing@codeaurora.org>
  8741. +Date: Fri, 15 Jan 2016 18:17:17 +0800
  8742. +Subject: [PATCH] ath9k: avoid ANI restart if no trigger
  8743. +
  8744. +Fixes commit 54da20d83f0e ("ath9k_hw: improve ANI processing and rx desensitizing parameters")
  8745. +
  8746. +Call ath9k_ani_restart() only when the phy error rate reach the
  8747. +ANI immunity threshold. Sync the logic with internal code base.
  8748. +
  8749. +Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  8750. +---
  8751. +
  8752. +--- a/drivers/net/wireless/ath/ath9k/ani.c
  8753. ++++ b/drivers/net/wireless/ath/ath9k/ani.c
  8754. +@@ -444,14 +444,16 @@ void ath9k_hw_ani_monitor(struct ath_hw
  8755. + ofdmPhyErrRate < ah->config.ofdm_trig_low) {
  8756. + ath9k_hw_ani_lower_immunity(ah);
  8757. + aniState->ofdmsTurn = !aniState->ofdmsTurn;
  8758. ++ ath9k_ani_restart(ah);
  8759. + } else if (ofdmPhyErrRate > ah->config.ofdm_trig_high) {
  8760. + ath9k_hw_ani_ofdm_err_trigger(ah);
  8761. + aniState->ofdmsTurn = false;
  8762. ++ ath9k_ani_restart(ah);
  8763. + } else if (cckPhyErrRate > ah->config.cck_trig_high) {
  8764. + ath9k_hw_ani_cck_err_trigger(ah);
  8765. + aniState->ofdmsTurn = true;
  8766. ++ ath9k_ani_restart(ah);
  8767. + }
  8768. +- ath9k_ani_restart(ah);
  8769. + }
  8770. + }
  8771. + EXPORT_SYMBOL(ath9k_hw_ani_monitor);
  8772. diff --git a/package/kernel/mac80211/patches/305-ath5k-channel-change-fix.patch b/package/kernel/mac80211/patches/305-ath5k-channel-change-fix.patch
  8773. deleted file mode 100644
  8774. index 4cfa53f..0000000
  8775. --- a/package/kernel/mac80211/patches/305-ath5k-channel-change-fix.patch
  8776. +++ /dev/null
  8777. @@ -1,137 +0,0 @@
  8778. -From: Sergey Ryazanov <ryazanov.s.a@gmail.com>
  8779. -Date: Wed, 4 Mar 2015 05:12:10 +0300
  8780. -Subject: [PATCH] ath5k: channel change fix
  8781. -
  8782. -ath5k updates the channel pointer and after that it stops the Rx logic
  8783. -and apply channel to HW. In case of channel switch, such sequence
  8784. -creates a small window when a frame, which is received on the old
  8785. -channel is considered as a frame received on the new one.
  8786. -
  8787. -The most notable consequence of this situation occurs during the switch
  8788. -from 2 GHz band (CCK+OFDM) to the 5GHz band (OFDM-only). Frame received
  8789. -with CCK rate, e.g. beacon received at the 1mbps, causes the following
  8790. -warning:
  8791. -
  8792. - WARNING: at ath5k/base.c:589 ath5k_tasklet_rx+0x318/0x6ec [ath5k]()
  8793. - invalid hw_rix: 1a
  8794. - [..]
  8795. - Call Trace:
  8796. - [<802656a8>] show_stack+0x48/0x70
  8797. - [<802dd92c>] warn_slowpath_common+0x88/0xbc
  8798. - [<802dd98c>] warn_slowpath_fmt+0x2c/0x38
  8799. - [<81b51be8>] ath5k_tasklet_rx+0x318/0x6ec [ath5k]
  8800. - [<8028ac64>] tasklet_action+0x8c/0xf0
  8801. - [<80075804>] __do_softirq+0x180/0x32c
  8802. - [<80196ce8>] irq_exit+0x54/0x70
  8803. - [<80041848>] ret_from_irq+0x0/0x4
  8804. - [<80182fdc>] ioread32+0x4/0xc
  8805. - [<81b4c42c>] ath5k_hw_set_sleep_clock+0x2ec/0x474 [ath5k]
  8806. - [<81b4cf28>] ath5k_hw_reset+0x50/0xeb8 [ath5k]
  8807. - [<81b50900>] ath5k_reset+0xd4/0x310 [ath5k]
  8808. - [<81b557e8>] ath5k_config+0x4c/0x104 [ath5k]
  8809. - [<80d01770>] ieee80211_hw_config+0x2f4/0x35c [mac80211]
  8810. - [<80d09aa8>] ieee80211_scan_work+0x2e4/0x414 [mac80211]
  8811. - [<8022c3f4>] process_one_work+0x28c/0x400
  8812. - [<802df8f8>] worker_thread+0x258/0x3c0
  8813. - [<801b5710>] kthread+0xe0/0xec
  8814. - [<800418a8>] ret_from_kernel_thread+0x14/0x1c
  8815. -
  8816. -The easiest way to reproduce this warning is to run scan with dualband
  8817. -NIC in noisy environments, when the channel 11 runs multiple APs. In my
  8818. -tests if the APs num >= 12, the warning appears in the first few
  8819. -seconds of scanning.
  8820. -
  8821. -In order to fix this, the Rx disable code moved to a higher level and
  8822. -placed before the channel pointer update. This is also makes the code a
  8823. -bit more symmetrical, since we disable and enable the Rx in the same
  8824. -function.
  8825. -
  8826. -In fact, at the pointer update time new frames should not appear,
  8827. -because interrupt generation at this point should already be disabled.
  8828. -The next patch should address this issue.
  8829. -
  8830. -CC: Jiri Slaby <jirislaby@gmail.com>
  8831. -CC: Nick Kossifidis <mickflemm@gmail.com>
  8832. -CC: Luis R. Rodriguez <mcgrof@do-not-panic.com>
  8833. -Reported-by: Christophe Prevotaux <cprevotaux@nltinc.com>
  8834. -Tested-by: Christophe Prevotaux <cprevotaux@nltinc.com>
  8835. -Tested-by: Eric Bree <ebree@nltinc.com>
  8836. -Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
  8837. ----
  8838. -
  8839. ---- a/drivers/net/wireless/ath/ath5k/base.c
  8840. -+++ b/drivers/net/wireless/ath/ath5k/base.c
  8841. -@@ -2858,7 +2858,7 @@ ath5k_reset(struct ath5k_hw *ah, struct
  8842. - {
  8843. - struct ath_common *common = ath5k_hw_common(ah);
  8844. - int ret, ani_mode;
  8845. -- bool fast;
  8846. -+ bool fast = chan && modparam_fastchanswitch ? 1 : 0;
  8847. -
  8848. - ATH5K_DBG(ah, ATH5K_DEBUG_RESET, "resetting\n");
  8849. -
  8850. -@@ -2876,11 +2876,29 @@ ath5k_reset(struct ath5k_hw *ah, struct
  8851. - * so we should also free any remaining
  8852. - * tx buffers */
  8853. - ath5k_drain_tx_buffs(ah);
  8854. -+
  8855. -+ /* Stop PCU */
  8856. -+ ath5k_hw_stop_rx_pcu(ah);
  8857. -+
  8858. -+ /* Stop DMA
  8859. -+ *
  8860. -+ * Note: If DMA didn't stop continue
  8861. -+ * since only a reset will fix it.
  8862. -+ */
  8863. -+ ret = ath5k_hw_dma_stop(ah);
  8864. -+
  8865. -+ /* RF Bus grant won't work if we have pending
  8866. -+ * frames
  8867. -+ */
  8868. -+ if (ret && fast) {
  8869. -+ ATH5K_DBG(ah, ATH5K_DEBUG_RESET,
  8870. -+ "DMA didn't stop, falling back to normal reset\n");
  8871. -+ fast = false;
  8872. -+ }
  8873. -+
  8874. - if (chan)
  8875. - ah->curchan = chan;
  8876. -
  8877. -- fast = ((chan != NULL) && modparam_fastchanswitch) ? 1 : 0;
  8878. --
  8879. - ret = ath5k_hw_reset(ah, ah->opmode, ah->curchan, fast, skip_pcu);
  8880. - if (ret) {
  8881. - ATH5K_ERR(ah, "can't reset hardware (%d)\n", ret);
  8882. ---- a/drivers/net/wireless/ath/ath5k/reset.c
  8883. -+++ b/drivers/net/wireless/ath/ath5k/reset.c
  8884. -@@ -1169,30 +1169,6 @@ ath5k_hw_reset(struct ath5k_hw *ah, enum
  8885. - if (ah->ah_version == AR5K_AR5212)
  8886. - ath5k_hw_set_sleep_clock(ah, false);
  8887. -
  8888. -- /*
  8889. -- * Stop PCU
  8890. -- */
  8891. -- ath5k_hw_stop_rx_pcu(ah);
  8892. --
  8893. -- /*
  8894. -- * Stop DMA
  8895. -- *
  8896. -- * Note: If DMA didn't stop continue
  8897. -- * since only a reset will fix it.
  8898. -- */
  8899. -- ret = ath5k_hw_dma_stop(ah);
  8900. --
  8901. -- /* RF Bus grant won't work if we have pending
  8902. -- * frames */
  8903. -- if (ret && fast) {
  8904. -- ATH5K_DBG(ah, ATH5K_DEBUG_RESET,
  8905. -- "DMA didn't stop, falling back to normal reset\n");
  8906. -- fast = false;
  8907. -- /* Non fatal, just continue with
  8908. -- * normal reset */
  8909. -- ret = 0;
  8910. -- }
  8911. --
  8912. - mode = channel->hw_value;
  8913. - switch (mode) {
  8914. - case AR5K_MODE_11A:
  8915. 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
  8916. new file mode 100644
  8917. index 0000000..a1ac67c
  8918. --- /dev/null
  8919. +++ b/package/kernel/mac80211/patches/305-ath9k-clean-up-ANI-per-channel-pointer-checking.patch
  8920. @@ -0,0 +1,91 @@
  8921. +From: Miaoqing Pan <miaoqing@codeaurora.org>
  8922. +Date: Fri, 15 Jan 2016 18:17:18 +0800
  8923. +Subject: [PATCH] ath9k: clean up ANI per-channel pointer checking
  8924. +
  8925. +commit c24bd3620c50 ("ath9k: Do not maintain ANI state per-channel")
  8926. +removed per-channel handling, the code to check 'curchan' also
  8927. +should be removed as never used.
  8928. +
  8929. +Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  8930. +---
  8931. +
  8932. +--- a/drivers/net/wireless/ath/ath9k/ani.c
  8933. ++++ b/drivers/net/wireless/ath/ath9k/ani.c
  8934. +@@ -126,12 +126,8 @@ static void ath9k_hw_update_mibstats(str
  8935. +
  8936. + static void ath9k_ani_restart(struct ath_hw *ah)
  8937. + {
  8938. +- struct ar5416AniState *aniState;
  8939. +-
  8940. +- if (!ah->curchan)
  8941. +- return;
  8942. ++ struct ar5416AniState *aniState = &ah->ani;
  8943. +
  8944. +- aniState = &ah->ani;
  8945. + aniState->listenTime = 0;
  8946. +
  8947. + ENABLE_REGWRITE_BUFFER(ah);
  8948. +@@ -221,12 +217,7 @@ static void ath9k_hw_set_ofdm_nil(struct
  8949. +
  8950. + static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah)
  8951. + {
  8952. +- struct ar5416AniState *aniState;
  8953. +-
  8954. +- if (!ah->curchan)
  8955. +- return;
  8956. +-
  8957. +- aniState = &ah->ani;
  8958. ++ struct ar5416AniState *aniState = &ah->ani;
  8959. +
  8960. + if (aniState->ofdmNoiseImmunityLevel < ATH9K_ANI_OFDM_MAX_LEVEL)
  8961. + ath9k_hw_set_ofdm_nil(ah, aniState->ofdmNoiseImmunityLevel + 1, false);
  8962. +@@ -281,12 +272,7 @@ static void ath9k_hw_set_cck_nil(struct
  8963. +
  8964. + static void ath9k_hw_ani_cck_err_trigger(struct ath_hw *ah)
  8965. + {
  8966. +- struct ar5416AniState *aniState;
  8967. +-
  8968. +- if (!ah->curchan)
  8969. +- return;
  8970. +-
  8971. +- aniState = &ah->ani;
  8972. ++ struct ar5416AniState *aniState = &ah->ani;
  8973. +
  8974. + if (aniState->cckNoiseImmunityLevel < ATH9K_ANI_CCK_MAX_LEVEL)
  8975. + ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel + 1,
  8976. +@@ -299,9 +285,7 @@ static void ath9k_hw_ani_cck_err_trigger
  8977. + */
  8978. + static void ath9k_hw_ani_lower_immunity(struct ath_hw *ah)
  8979. + {
  8980. +- struct ar5416AniState *aniState;
  8981. +-
  8982. +- aniState = &ah->ani;
  8983. ++ struct ar5416AniState *aniState = &ah->ani;
  8984. +
  8985. + /* lower OFDM noise immunity */
  8986. + if (aniState->ofdmNoiseImmunityLevel > 0 &&
  8987. +@@ -329,7 +313,7 @@ void ath9k_ani_reset(struct ath_hw *ah,
  8988. + struct ath_common *common = ath9k_hw_common(ah);
  8989. + int ofdm_nil, cck_nil;
  8990. +
  8991. +- if (!ah->curchan)
  8992. ++ if (!chan)
  8993. + return;
  8994. +
  8995. + BUG_ON(aniState == NULL);
  8996. +@@ -416,14 +400,10 @@ static bool ath9k_hw_ani_read_counters(s
  8997. +
  8998. + void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan)
  8999. + {
  9000. +- struct ar5416AniState *aniState;
  9001. ++ struct ar5416AniState *aniState = &ah->ani;
  9002. + struct ath_common *common = ath9k_hw_common(ah);
  9003. + u32 ofdmPhyErrRate, cckPhyErrRate;
  9004. +
  9005. +- if (!ah->curchan)
  9006. +- return;
  9007. +-
  9008. +- aniState = &ah->ani;
  9009. + if (!ath9k_hw_ani_read_counters(ah))
  9010. + return;
  9011. +
  9012. diff --git a/package/kernel/mac80211/patches/306-ath5k-fix-reset-race.patch b/package/kernel/mac80211/patches/306-ath5k-fix-reset-race.patch
  9013. deleted file mode 100644
  9014. index 85a1904..0000000
  9015. --- a/package/kernel/mac80211/patches/306-ath5k-fix-reset-race.patch
  9016. +++ /dev/null
  9017. @@ -1,96 +0,0 @@
  9018. -From: Sergey Ryazanov <ryazanov.s.a@gmail.com>
  9019. -Date: Wed, 4 Mar 2015 05:12:11 +0300
  9020. -Subject: [PATCH] ath5k: fix reset race
  9021. -
  9022. -To prepare for reset ath5k should finish all asynchronous tasks. At
  9023. -first, it disables the interrupt generation, then it waits for the
  9024. -interrupt handler and tasklets completion, and then proceeds to the HW
  9025. -configuration update. But it does not consider that the interrupt
  9026. -handler or tasklet re-enables the interrupt generation. And we fall in a
  9027. -situation when ath5k assumes that interrupts are disabled, but it is
  9028. -not.
  9029. -
  9030. -This can lead to different consequences, such as reception of the frame,
  9031. -when we do not expect it. Under certain circumstances, this can lead to
  9032. -the following warning:
  9033. -
  9034. - WARNING: at ath5k/base.c:589 ath5k_tasklet_rx+0x318/0x6ec [ath5k]()
  9035. - invalid hw_rix: 1a
  9036. - [..]
  9037. - Call Trace:
  9038. - [<802656a8>] show_stack+0x48/0x70
  9039. - [<802dd92c>] warn_slowpath_common+0x88/0xbc
  9040. - [<802dd98c>] warn_slowpath_fmt+0x2c/0x38
  9041. - [<81b51be8>] ath5k_tasklet_rx+0x318/0x6ec [ath5k]
  9042. - [<8028ac64>] tasklet_action+0x8c/0xf0
  9043. - [<80075804>] __do_softirq+0x180/0x32c
  9044. - [<80196ce8>] irq_exit+0x54/0x70
  9045. - [<80041848>] ret_from_irq+0x0/0x4
  9046. - [<80182fdc>] ioread32+0x4/0xc
  9047. - [<81b4c42c>] ath5k_hw_set_sleep_clock+0x2ec/0x474 [ath5k]
  9048. - [<81b4cf28>] ath5k_hw_reset+0x50/0xeb8 [ath5k]
  9049. - [<81b50900>] ath5k_reset+0xd4/0x310 [ath5k]
  9050. - [<81b557e8>] ath5k_config+0x4c/0x104 [ath5k]
  9051. - [<80d01770>] ieee80211_hw_config+0x2f4/0x35c [mac80211]
  9052. - [<80d09aa8>] ieee80211_scan_work+0x2e4/0x414 [mac80211]
  9053. - [<8022c3f4>] process_one_work+0x28c/0x400
  9054. - [<802df8f8>] worker_thread+0x258/0x3c0
  9055. - [<801b5710>] kthread+0xe0/0xec
  9056. - [<800418a8>] ret_from_kernel_thread+0x14/0x1c
  9057. -
  9058. -Fix this issue by adding a new status flag, which forbids to re-enable
  9059. -the interrupt generation until the HW configuration is completed.
  9060. -
  9061. -Note: previous patch, which reorders the Rx disable code helps to avoid
  9062. -the above warning, but not fixes the root cause of unexpected frame
  9063. -receiving.
  9064. -
  9065. -CC: Jiri Slaby <jirislaby@gmail.com>
  9066. -CC: Nick Kossifidis <mickflemm@gmail.com>
  9067. -CC: Luis R. Rodriguez <mcgrof@do-not-panic.com>
  9068. -Reported-by: Christophe Prevotaux <cprevotaux@nltinc.com>
  9069. -Tested-by: Christophe Prevotaux <cprevotaux@nltinc.com>
  9070. -Tested-by: Eric Bree <ebree@nltinc.com>
  9071. -Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
  9072. ----
  9073. -
  9074. ---- a/drivers/net/wireless/ath/ath5k/ath5k.h
  9075. -+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
  9076. -@@ -1283,6 +1283,7 @@ struct ath5k_hw {
  9077. - #define ATH_STAT_PROMISC 1
  9078. - #define ATH_STAT_LEDSOFT 2 /* enable LED gpio status */
  9079. - #define ATH_STAT_STARTED 3 /* opened & irqs enabled */
  9080. -+#define ATH_STAT_RESET 4 /* hw reset */
  9081. -
  9082. - unsigned int filter_flags; /* HW flags, AR5K_RX_FILTER_* */
  9083. - unsigned int fif_filter_flags; /* Current FIF_* filter flags */
  9084. ---- a/drivers/net/wireless/ath/ath5k/base.c
  9085. -+++ b/drivers/net/wireless/ath/ath5k/base.c
  9086. -@@ -1523,6 +1523,9 @@ ath5k_set_current_imask(struct ath5k_hw
  9087. - enum ath5k_int imask;
  9088. - unsigned long flags;
  9089. -
  9090. -+ if (test_bit(ATH_STAT_RESET, ah->status))
  9091. -+ return;
  9092. -+
  9093. - spin_lock_irqsave(&ah->irqlock, flags);
  9094. - imask = ah->imask;
  9095. - if (ah->rx_pending)
  9096. -@@ -2862,6 +2865,8 @@ ath5k_reset(struct ath5k_hw *ah, struct
  9097. -
  9098. - ATH5K_DBG(ah, ATH5K_DEBUG_RESET, "resetting\n");
  9099. -
  9100. -+ __set_bit(ATH_STAT_RESET, ah->status);
  9101. -+
  9102. - ath5k_hw_set_imr(ah, 0);
  9103. - synchronize_irq(ah->irq);
  9104. - ath5k_stop_tasklets(ah);
  9105. -@@ -2952,6 +2957,8 @@ ath5k_reset(struct ath5k_hw *ah, struct
  9106. - */
  9107. - /* ath5k_chan_change(ah, c); */
  9108. -
  9109. -+ __clear_bit(ATH_STAT_RESET, ah->status);
  9110. -+
  9111. - ath5k_beacon_config(ah);
  9112. - /* intrs are enabled by ath5k_beacon_config */
  9113. -
  9114. 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
  9115. new file mode 100644
  9116. index 0000000..cf8194a
  9117. --- /dev/null
  9118. +++ b/package/kernel/mac80211/patches/306-ath9k-do-not-reset-while-BB-panic-0x4000409-on-ar956.patch
  9119. @@ -0,0 +1,31 @@
  9120. +From: Miaoqing Pan <miaoqing@codeaurora.org>
  9121. +Date: Fri, 15 Jan 2016 18:17:19 +0800
  9122. +Subject: [PATCH] ath9k: do not reset while BB panic(0x4000409) on ar9561
  9123. +
  9124. +BB panic(0x4000409) observed while AP enabling/disabling
  9125. +bursting.
  9126. +
  9127. +Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  9128. +---
  9129. +
  9130. +--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  9131. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  9132. +@@ -2071,7 +2071,8 @@ void ar9003_hw_attach_phy_ops(struct ath
  9133. + * to be disabled.
  9134. + *
  9135. + * 0x04000409: Packet stuck on receive.
  9136. +- * Full chip reset is required for all chips except AR9340.
  9137. ++ * Full chip reset is required for all chips except
  9138. ++ * AR9340, AR9531 and AR9561.
  9139. + */
  9140. +
  9141. + /*
  9142. +@@ -2100,7 +2101,7 @@ bool ar9003_hw_bb_watchdog_check(struct
  9143. + case 0x04000b09:
  9144. + return true;
  9145. + case 0x04000409:
  9146. +- if (AR_SREV_9340(ah) || AR_SREV_9531(ah))
  9147. ++ if (AR_SREV_9340(ah) || AR_SREV_9531(ah) || AR_SREV_9561(ah))
  9148. + return false;
  9149. + else
  9150. + return true;
  9151. 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
  9152. new file mode 100644
  9153. index 0000000..80b781c
  9154. --- /dev/null
  9155. +++ b/package/kernel/mac80211/patches/307-ath9k-fix-inconsistent-use-of-tab-and-space-in-inden.patch
  9156. @@ -0,0 +1,27 @@
  9157. +From: Miaoqing Pan <miaoqing@codeaurora.org>
  9158. +Date: Fri, 15 Jan 2016 18:17:20 +0800
  9159. +Subject: [PATCH] ath9k: fix inconsistent use of tab and space in
  9160. + indentation
  9161. +
  9162. +Minor changes for indenting.
  9163. +
  9164. +Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  9165. +---
  9166. +
  9167. +--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  9168. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  9169. +@@ -5485,11 +5485,11 @@ unsigned int ar9003_get_paprd_scale_fact
  9170. + AR9300_PAPRD_SCALE_1);
  9171. + else {
  9172. + if (chan->channel >= 5700)
  9173. +- return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20),
  9174. +- AR9300_PAPRD_SCALE_1);
  9175. ++ return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20),
  9176. ++ AR9300_PAPRD_SCALE_1);
  9177. + else if (chan->channel >= 5400)
  9178. + return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt40),
  9179. +- AR9300_PAPRD_SCALE_2);
  9180. ++ AR9300_PAPRD_SCALE_2);
  9181. + else
  9182. + return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt40),
  9183. + AR9300_PAPRD_SCALE_1);
  9184. 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
  9185. deleted file mode 100644
  9186. index ab9771e..0000000
  9187. --- a/package/kernel/mac80211/patches/307-ath9k-fix-tracking-of-enabled-AP-beacons.patch
  9188. +++ /dev/null
  9189. @@ -1,76 +0,0 @@
  9190. -From: Felix Fietkau <nbd@openwrt.org>
  9191. -Date: Thu, 12 Mar 2015 17:10:50 +0100
  9192. -Subject: [PATCH] ath9k: fix tracking of enabled AP beacons
  9193. -
  9194. -sc->nbcnvifs tracks assigned beacon slots, not enabled beacons.
  9195. -Therefore, it cannot be used to decide if cur_conf->enable_beacon (bool)
  9196. -should be updated, or if beacons have been enabled already.
  9197. -With the current code (depending on the order of calls), beacons often
  9198. -do not get enabled in an AP+STA setup.
  9199. -To fix tracking of enabled beacons, convert cur_conf->enable_beacon to a
  9200. -bitmask of enabled beacon slots.
  9201. -
  9202. -Cc: stable@vger.kernel.org
  9203. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9204. ----
  9205. -
  9206. ---- a/drivers/net/wireless/ath/ath9k/beacon.c
  9207. -+++ b/drivers/net/wireless/ath/ath9k/beacon.c
  9208. -@@ -219,12 +219,15 @@ void ath9k_beacon_remove_slot(struct ath
  9209. - struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  9210. - struct ath_vif *avp = (void *)vif->drv_priv;
  9211. - struct ath_buf *bf = avp->av_bcbuf;
  9212. -+ struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon;
  9213. -
  9214. - ath_dbg(common, CONFIG, "Removing interface at beacon slot: %d\n",
  9215. - avp->av_bslot);
  9216. -
  9217. - tasklet_disable(&sc->bcon_tasklet);
  9218. -
  9219. -+ cur_conf->enable_beacon &= ~BIT(avp->av_bslot);
  9220. -+
  9221. - if (bf && bf->bf_mpdu) {
  9222. - struct sk_buff *skb = bf->bf_mpdu;
  9223. - dma_unmap_single(sc->dev, bf->bf_buf_addr,
  9224. -@@ -521,8 +524,7 @@ static bool ath9k_allow_beacon_config(st
  9225. - }
  9226. -
  9227. - if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) {
  9228. -- if ((vif->type != NL80211_IFTYPE_AP) ||
  9229. -- (sc->nbcnvifs > 1)) {
  9230. -+ if (vif->type != NL80211_IFTYPE_AP) {
  9231. - ath_dbg(common, CONFIG,
  9232. - "An AP interface is already present !\n");
  9233. - return false;
  9234. -@@ -616,12 +618,14 @@ void ath9k_beacon_config(struct ath_soft
  9235. - * enabling/disabling SWBA.
  9236. - */
  9237. - if (changed & BSS_CHANGED_BEACON_ENABLED) {
  9238. -- if (!bss_conf->enable_beacon &&
  9239. -- (sc->nbcnvifs <= 1)) {
  9240. -- cur_conf->enable_beacon = false;
  9241. -- } else if (bss_conf->enable_beacon) {
  9242. -- cur_conf->enable_beacon = true;
  9243. -- ath9k_cache_beacon_config(sc, ctx, bss_conf);
  9244. -+ bool enabled = cur_conf->enable_beacon;
  9245. -+
  9246. -+ if (!bss_conf->enable_beacon) {
  9247. -+ cur_conf->enable_beacon &= ~BIT(avp->av_bslot);
  9248. -+ } else {
  9249. -+ cur_conf->enable_beacon |= BIT(avp->av_bslot);
  9250. -+ if (!enabled)
  9251. -+ ath9k_cache_beacon_config(sc, ctx, bss_conf);
  9252. - }
  9253. - }
  9254. -
  9255. ---- a/drivers/net/wireless/ath/ath9k/common.h
  9256. -+++ b/drivers/net/wireless/ath/ath9k/common.h
  9257. -@@ -54,7 +54,7 @@ struct ath_beacon_config {
  9258. - u16 dtim_period;
  9259. - u16 bmiss_timeout;
  9260. - u8 dtim_count;
  9261. -- bool enable_beacon;
  9262. -+ u8 enable_beacon;
  9263. - bool ibss_creator;
  9264. - u32 nexttbtt;
  9265. - u32 intval;
  9266. 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
  9267. new file mode 100644
  9268. index 0000000..d408866
  9269. --- /dev/null
  9270. +++ b/package/kernel/mac80211/patches/308-ath9k-fix-data-bus-error-on-ar9300-and-ar9580.patch
  9271. @@ -0,0 +1,65 @@
  9272. +From: Miaoqing Pan <miaoqing@codeaurora.org>
  9273. +Date: Fri, 15 Jan 2016 18:17:21 +0800
  9274. +Subject: [PATCH] ath9k: fix data bus error on ar9300 and ar9580
  9275. +
  9276. +One crash issue be found on ar9300: RTC_RC reg read leads crash, leading
  9277. +the data bus error, due to RTC_RC reg write not happen properly.
  9278. +
  9279. +Warm Reset trigger in continuous beacon stuck for one of the customer for
  9280. +other chip, noticed the MAC was stuck in RTC reset. After analysis noticed
  9281. +DMA did not complete when RTC was put in reset.
  9282. +
  9283. +So, before resetting the MAC need to make sure there are no pending DMA
  9284. +transactions because this reset does not reset all parts of the chip.
  9285. +
  9286. +The 12th and 11th bit of MAC _DMA_CFG register used to do that.
  9287. + 12 cfg_halt_ack 0x0
  9288. + 0 DMA has not yet halted
  9289. + 1 DMA has halted
  9290. + 11 cfg_halt_req 0x0
  9291. + 0 DMA logic operates normally
  9292. + 1 Request DMA logic to stop so software can reset the MAC
  9293. +
  9294. +The Bit [12] of this register indicates when the halt has taken effect or
  9295. +not. the DMA halt IS NOT recoverable; once software sets bit [11] to
  9296. +request a DMA halt, software must wait for bit [12] to be set and reset
  9297. +the MAC.
  9298. +
  9299. +So, the same thing we implemented for ar9580 chip.
  9300. +
  9301. +Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  9302. +---
  9303. +
  9304. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  9305. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  9306. +@@ -1368,6 +1368,16 @@ static bool ath9k_hw_set_reset(struct at
  9307. + if (ath9k_hw_mci_is_enabled(ah))
  9308. + ar9003_mci_check_gpm_offset(ah);
  9309. +
  9310. ++ /* DMA HALT added to resolve ar9300 and ar9580 bus error during
  9311. ++ * RTC_RC reg read
  9312. ++ */
  9313. ++ if (AR_SREV_9300(ah) || AR_SREV_9580(ah)) {
  9314. ++ REG_SET_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  9315. ++ ath9k_hw_wait(ah, AR_CFG, AR_CFG_HALT_ACK, AR_CFG_HALT_ACK,
  9316. ++ 20 * AH_WAIT_TIMEOUT);
  9317. ++ REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  9318. ++ }
  9319. ++
  9320. + REG_WRITE(ah, AR_RTC_RC, rst_flags);
  9321. +
  9322. + REGWRITE_BUFFER_FLUSH(ah);
  9323. +--- a/drivers/net/wireless/ath/ath9k/reg.h
  9324. ++++ b/drivers/net/wireless/ath/ath9k/reg.h
  9325. +@@ -34,8 +34,10 @@
  9326. + #define AR_CFG_SWRG 0x00000010
  9327. + #define AR_CFG_AP_ADHOC_INDICATION 0x00000020
  9328. + #define AR_CFG_PHOK 0x00000100
  9329. +-#define AR_CFG_CLK_GATE_DIS 0x00000400
  9330. + #define AR_CFG_EEBS 0x00000200
  9331. ++#define AR_CFG_CLK_GATE_DIS 0x00000400
  9332. ++#define AR_CFG_HALT_REQ 0x00000800
  9333. ++#define AR_CFG_HALT_ACK 0x00001000
  9334. + #define AR_CFG_PCI_MASTER_REQ_Q_THRESH 0x00060000
  9335. + #define AR_CFG_PCI_MASTER_REQ_Q_THRESH_S 17
  9336. +
  9337. 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
  9338. deleted file mode 100644
  9339. index d132636..0000000
  9340. --- a/package/kernel/mac80211/patches/308-mac80211-minstrel_ht-fix-rounding-issue-in-MCS-durat.patch
  9341. +++ /dev/null
  9342. @@ -1,43 +0,0 @@
  9343. -From: Felix Fietkau <nbd@openwrt.org>
  9344. -Date: Fri, 13 Mar 2015 10:49:40 +0100
  9345. -Subject: [PATCH] mac80211: minstrel_ht: fix rounding issue in MCS duration
  9346. - calculation
  9347. -
  9348. -On very high MCS bitrates, the calculated duration of rates that are
  9349. -next to each other can be very imprecise, due to the small packet size
  9350. -used as reference (1200 bytes).
  9351. -This is most visible in VHT80 nss=2 MCS8/9, for which minstrel shows the
  9352. -same throughput when the probability is also the same. This leads to a
  9353. -bad rate selection for such rates.
  9354. -
  9355. -Fix this issue by introducing an average A-MPDU size factor into the
  9356. -calculation.
  9357. -
  9358. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9359. ----
  9360. -
  9361. ---- a/net/mac80211/rc80211_minstrel_ht.c
  9362. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  9363. -@@ -17,10 +17,11 @@
  9364. - #include "rc80211_minstrel.h"
  9365. - #include "rc80211_minstrel_ht.h"
  9366. -
  9367. -+#define AVG_AMPDU_SIZE 16
  9368. - #define AVG_PKT_SIZE 1200
  9369. -
  9370. - /* Number of bits for an average sized packet */
  9371. --#define MCS_NBITS (AVG_PKT_SIZE << 3)
  9372. -+#define MCS_NBITS ((AVG_PKT_SIZE * AVG_AMPDU_SIZE) << 3)
  9373. -
  9374. - /* Number of symbols for a packet with (bps) bits per symbol */
  9375. - #define MCS_NSYMS(bps) DIV_ROUND_UP(MCS_NBITS, (bps))
  9376. -@@ -33,7 +34,8 @@
  9377. - )
  9378. -
  9379. - /* Transmit duration for the raw data part of an average sized packet */
  9380. --#define MCS_DURATION(streams, sgi, bps) MCS_SYMBOL_TIME(sgi, MCS_NSYMS((streams) * (bps)))
  9381. -+#define MCS_DURATION(streams, sgi, bps) \
  9382. -+ (MCS_SYMBOL_TIME(sgi, MCS_NSYMS((streams) * (bps))) / AVG_AMPDU_SIZE)
  9383. -
  9384. - #define BW_20 0
  9385. - #define BW_40 1
  9386. diff --git a/package/kernel/mac80211/patches/309-01-brcmfmac-add-missing-include.patch b/package/kernel/mac80211/patches/309-01-brcmfmac-add-missing-include.patch
  9387. new file mode 100644
  9388. index 0000000..d9511c8
  9389. --- /dev/null
  9390. +++ b/package/kernel/mac80211/patches/309-01-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/309-02-brcmfmac-fix-sdio-sg-table-alloc-crash.patch b/package/kernel/mac80211/patches/309-02-brcmfmac-fix-sdio-sg-table-alloc-crash.patch
  9412. new file mode 100644
  9413. index 0000000..711e019
  9414. --- /dev/null
  9415. +++ b/package/kernel/mac80211/patches/309-02-brcmfmac-fix-sdio-sg-table-alloc-crash.patch
  9416. @@ -0,0 +1,118 @@
  9417. +From: Hante Meuleman <meuleman@broadcom.com>
  9418. +Date: Tue, 19 Jan 2016 12:39:24 +0100
  9419. +Subject: [PATCH] brcmfmac: fix sdio sg table alloc crash
  9420. +
  9421. +With commit 7d34b0560567 ("brcmfmac: Move all module parameters to
  9422. +one place") a bug was introduced causing a null pointer exception.
  9423. +This patch fixes the bug by initializing the sg table till after
  9424. +the settings have been initialized.
  9425. +
  9426. +Fixes: 7d34b0560567 ("brcmfmac: Move all module parameters to one place")
  9427. +Reported-by: Marc Zyngier <marc.zyngier@arm.com>
  9428. +Tested-by: Marc Zyngier <marc.zyngier@arm.com>
  9429. +Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  9430. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  9431. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9432. +Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  9433. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9434. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9435. +---
  9436. +
  9437. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  9438. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  9439. +@@ -879,11 +879,24 @@ int brcmf_sdiod_abort(struct brcmf_sdio_
  9440. + return 0;
  9441. + }
  9442. +
  9443. +-static void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev)
  9444. ++void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev)
  9445. + {
  9446. ++ struct sdio_func *func;
  9447. ++ struct mmc_host *host;
  9448. ++ uint max_blocks;
  9449. + uint nents;
  9450. + int err;
  9451. +
  9452. ++ func = sdiodev->func[2];
  9453. ++ host = func->card->host;
  9454. ++ sdiodev->sg_support = host->max_segs > 1;
  9455. ++ max_blocks = min_t(uint, host->max_blk_count, 511u);
  9456. ++ sdiodev->max_request_size = min_t(uint, host->max_req_size,
  9457. ++ max_blocks * func->cur_blksize);
  9458. ++ sdiodev->max_segment_count = min_t(uint, host->max_segs,
  9459. ++ SG_MAX_SINGLE_ALLOC);
  9460. ++ sdiodev->max_segment_size = host->max_seg_size;
  9461. ++
  9462. + if (!sdiodev->sg_support)
  9463. + return;
  9464. +
  9465. +@@ -1021,9 +1034,6 @@ static void brcmf_sdiod_host_fixup(struc
  9466. +
  9467. + static int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev)
  9468. + {
  9469. +- struct sdio_func *func;
  9470. +- struct mmc_host *host;
  9471. +- uint max_blocks;
  9472. + int ret = 0;
  9473. +
  9474. + sdiodev->num_funcs = 2;
  9475. +@@ -1054,26 +1064,6 @@ static int brcmf_sdiod_probe(struct brcm
  9476. + goto out;
  9477. + }
  9478. +
  9479. +- /*
  9480. +- * determine host related variables after brcmf_sdiod_probe()
  9481. +- * as func->cur_blksize is properly set and F2 init has been
  9482. +- * completed successfully.
  9483. +- */
  9484. +- func = sdiodev->func[2];
  9485. +- host = func->card->host;
  9486. +- sdiodev->sg_support = host->max_segs > 1;
  9487. +- max_blocks = min_t(uint, host->max_blk_count, 511u);
  9488. +- sdiodev->max_request_size = min_t(uint, host->max_req_size,
  9489. +- max_blocks * func->cur_blksize);
  9490. +- sdiodev->max_segment_count = min_t(uint, host->max_segs,
  9491. +- SG_MAX_SINGLE_ALLOC);
  9492. +- sdiodev->max_segment_size = host->max_seg_size;
  9493. +-
  9494. +- /* allocate scatter-gather table. sg support
  9495. +- * will be disabled upon allocation failure.
  9496. +- */
  9497. +- brcmf_sdiod_sgtable_alloc(sdiodev);
  9498. +-
  9499. + ret = brcmf_sdiod_freezer_attach(sdiodev);
  9500. + if (ret)
  9501. + goto out;
  9502. +@@ -1084,7 +1074,7 @@ static int brcmf_sdiod_probe(struct brcm
  9503. + ret = -ENODEV;
  9504. + goto out;
  9505. + }
  9506. +- brcmf_sdiod_host_fixup(host);
  9507. ++ brcmf_sdiod_host_fixup(sdiodev->func[2]->card->host);
  9508. + out:
  9509. + if (ret)
  9510. + brcmf_sdiod_remove(sdiodev);
  9511. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  9512. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  9513. +@@ -4114,6 +4114,11 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
  9514. + goto fail;
  9515. + }
  9516. +
  9517. ++ /* allocate scatter-gather table. sg support
  9518. ++ * will be disabled upon allocation failure.
  9519. ++ */
  9520. ++ brcmf_sdiod_sgtable_alloc(bus->sdiodev);
  9521. ++
  9522. + /* Query the F2 block size, set roundup accordingly */
  9523. + bus->blocksize = bus->sdiodev->func[2]->cur_blksize;
  9524. + bus->roundup = min(max_roundup, bus->blocksize);
  9525. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  9526. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  9527. +@@ -342,6 +342,7 @@ int brcmf_sdiod_ramrw(struct brcmf_sdio_
  9528. +
  9529. + /* Issue an abort to the specified function */
  9530. + int brcmf_sdiod_abort(struct brcmf_sdio_dev *sdiodev, uint fn);
  9531. ++void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev);
  9532. + void brcmf_sdiod_change_state(struct brcmf_sdio_dev *sdiodev,
  9533. + enum brcmf_sdiod_state state);
  9534. + #ifdef CONFIG_PM_SLEEP
  9535. 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
  9536. deleted file mode 100644
  9537. index 945fbce..0000000
  9538. --- a/package/kernel/mac80211/patches/309-ath9k-disable-TPC-support-again-for-now.patch
  9539. +++ /dev/null
  9540. @@ -1,22 +0,0 @@
  9541. -From: Felix Fietkau <nbd@openwrt.org>
  9542. -Date: Sun, 15 Mar 2015 08:02:37 +0100
  9543. -Subject: [PATCH] ath9k: disable TPC support again (for now)
  9544. -
  9545. -TPC support has been observed to cause some tx power fluctuations on
  9546. -some devices with at least AR934x and AR938x chips.
  9547. -Disable it for now until the bugs have been found and fixed
  9548. -
  9549. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9550. ----
  9551. -
  9552. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  9553. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  9554. -@@ -424,7 +424,7 @@ static void ath9k_hw_init_defaults(struc
  9555. - ah->power_mode = ATH9K_PM_UNDEFINED;
  9556. - ah->htc_reset_init = true;
  9557. -
  9558. -- ah->tpc_enabled = true;
  9559. -+ ah->tpc_enabled = false;
  9560. -
  9561. - ah->ani_function = ATH9K_ANI_ALL;
  9562. - if (!AR_SREV_9300_20_OR_LATER(ah))
  9563. 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
  9564. new file mode 100644
  9565. index 0000000..287d6e1
  9566. --- /dev/null
  9567. +++ b/package/kernel/mac80211/patches/310-ath9k_hw-ignore-eeprom-magic-mismatch-on-flash-based.patch
  9568. @@ -0,0 +1,38 @@
  9569. +From: Felix Fietkau <nbd@openwrt.org>
  9570. +Date: Thu, 21 Jan 2016 16:28:44 +0100
  9571. +Subject: [PATCH] ath9k_hw: ignore eeprom magic mismatch on flash based devices
  9572. +
  9573. +Many AR913x based devices (maybe others too) do not have a valid EEPROM
  9574. +magic in their calibration data partition.
  9575. +
  9576. +Fixes: 6fa658fd5ab2 ("ath9k: Simplify and fix eeprom endianness swapping")
  9577. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9578. +---
  9579. +
  9580. +--- a/drivers/net/wireless/ath/ath9k/eeprom.c
  9581. ++++ b/drivers/net/wireless/ath/ath9k/eeprom.c
  9582. +@@ -150,18 +150,18 @@ int ath9k_hw_nvram_swap_data(struct ath_
  9583. + return -EIO;
  9584. + }
  9585. +
  9586. +- if (magic == AR5416_EEPROM_MAGIC) {
  9587. +- *swap_needed = false;
  9588. +- } else if (swab16(magic) == AR5416_EEPROM_MAGIC) {
  9589. ++ *swap_needed = false;
  9590. ++ if (swab16(magic) == AR5416_EEPROM_MAGIC) {
  9591. + if (ah->ah_flags & AH_NO_EEP_SWAP) {
  9592. + ath_info(common,
  9593. + "Ignoring endianness difference in EEPROM magic bytes.\n");
  9594. +-
  9595. +- *swap_needed = false;
  9596. + } else {
  9597. + *swap_needed = true;
  9598. + }
  9599. +- } else {
  9600. ++ } else if (magic != AR5416_EEPROM_MAGIC) {
  9601. ++ if (ath9k_hw_use_flash(ah))
  9602. ++ return 0;
  9603. ++
  9604. + ath_err(common,
  9605. + "Invalid EEPROM Magic (0x%04x).\n", magic);
  9606. + return -EINVAL;
  9607. 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
  9608. deleted file mode 100644
  9609. index bd3050e..0000000
  9610. --- a/package/kernel/mac80211/patches/310-mac80211-don-t-look-up-stations-for-multicast-addres.patch
  9611. +++ /dev/null
  9612. @@ -1,21 +0,0 @@
  9613. -From: Johannes Berg <johannes.berg@intel.com>
  9614. -Date: Tue, 24 Feb 2015 00:28:18 +0100
  9615. -Subject: [PATCH] mac80211: don't look up stations for multicast addresses
  9616. -
  9617. -Since multicast addresses don't exist as stations, don't attempt
  9618. -to look them up in the hashtable on TX.
  9619. -
  9620. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9621. ----
  9622. -
  9623. ---- a/net/mac80211/tx.c
  9624. -+++ b/net/mac80211/tx.c
  9625. -@@ -1161,7 +1161,7 @@ ieee80211_tx_prepare(struct ieee80211_su
  9626. - tx->sdata->control_port_protocol == tx->skb->protocol) {
  9627. - tx->sta = sta_info_get_bss(sdata, hdr->addr1);
  9628. - }
  9629. -- if (!tx->sta)
  9630. -+ if (!tx->sta && !is_multicast_ether_addr(hdr->addr1))
  9631. - tx->sta = sta_info_get(sdata, hdr->addr1);
  9632. -
  9633. - if (tx->sta && ieee80211_is_data_qos(hdr->frame_control) &&
  9634. 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
  9635. new file mode 100644
  9636. index 0000000..070efa9
  9637. --- /dev/null
  9638. +++ b/package/kernel/mac80211/patches/311-ath9k-do-not-limit-the-number-of-DFS-interfaces-to-1.patch
  9639. @@ -0,0 +1,55 @@
  9640. +From: Felix Fietkau <nbd@openwrt.org>
  9641. +Date: Fri, 22 Jan 2016 01:05:56 +0100
  9642. +Subject: [PATCH] ath9k: do not limit the number of DFS interfaces to 1
  9643. +
  9644. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9645. +---
  9646. +
  9647. +--- a/drivers/net/wireless/ath/ath9k/init.c
  9648. ++++ b/drivers/net/wireless/ath/ath9k/init.c
  9649. +@@ -751,14 +751,6 @@ static const struct ieee80211_iface_comb
  9650. +
  9651. + #endif /* CPTCFG_ATH9K_CHANNEL_CONTEXT */
  9652. +
  9653. +-static const struct ieee80211_iface_limit if_dfs_limits[] = {
  9654. +- { .max = 1, .types = BIT(NL80211_IFTYPE_AP) |
  9655. +-#ifdef CPTCFG_MAC80211_MESH
  9656. +- BIT(NL80211_IFTYPE_MESH_POINT) |
  9657. +-#endif
  9658. +- BIT(NL80211_IFTYPE_ADHOC) },
  9659. +-};
  9660. +-
  9661. + static const struct ieee80211_iface_combination if_comb[] = {
  9662. + {
  9663. + .limits = if_limits,
  9664. +@@ -766,6 +758,11 @@ static const struct ieee80211_iface_comb
  9665. + .max_interfaces = 2048,
  9666. + .num_different_channels = 1,
  9667. + .beacon_int_infra_match = true,
  9668. ++#ifdef CPTCFG_ATH9K_DFS_CERTIFIED
  9669. ++ .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
  9670. ++ BIT(NL80211_CHAN_WIDTH_20) |
  9671. ++ BIT(NL80211_CHAN_WIDTH_40),
  9672. ++#endif
  9673. + },
  9674. + {
  9675. + .limits = wds_limits,
  9676. +@@ -774,18 +771,6 @@ static const struct ieee80211_iface_comb
  9677. + .num_different_channels = 1,
  9678. + .beacon_int_infra_match = true,
  9679. + },
  9680. +-#ifdef CPTCFG_ATH9K_DFS_CERTIFIED
  9681. +- {
  9682. +- .limits = if_dfs_limits,
  9683. +- .n_limits = ARRAY_SIZE(if_dfs_limits),
  9684. +- .max_interfaces = 1,
  9685. +- .num_different_channels = 1,
  9686. +- .beacon_int_infra_match = true,
  9687. +- .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
  9688. +- BIT(NL80211_CHAN_WIDTH_20) |
  9689. +- BIT(NL80211_CHAN_WIDTH_40),
  9690. +- }
  9691. +-#endif
  9692. + };
  9693. +
  9694. + #ifdef CPTCFG_ATH9K_CHANNEL_CONTEXT
  9695. 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
  9696. deleted file mode 100644
  9697. index b2475b9..0000000
  9698. --- a/package/kernel/mac80211/patches/311-mac80211-remove-drop_unencrypted-code.patch
  9699. +++ /dev/null
  9700. @@ -1,130 +0,0 @@
  9701. -From: Johannes Berg <johannes.berg@intel.com>
  9702. -Date: Fri, 20 Mar 2015 11:41:58 +0100
  9703. -Subject: [PATCH] mac80211: remove drop_unencrypted code
  9704. -
  9705. -This mechanism was historic, and only ever used by IBSS, which
  9706. -also doesn't need to have it as it properly manages station's
  9707. -802.1X PAE state (or, with WEP, always has a key.)
  9708. -
  9709. -Remove the mechanism to clean up the code.
  9710. -
  9711. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9712. ----
  9713. -
  9714. ---- a/net/mac80211/debugfs.c
  9715. -+++ b/net/mac80211/debugfs.c
  9716. -@@ -274,8 +274,6 @@ void debugfs_hw_add(struct ieee80211_loc
  9717. - #ifdef CPTCFG_MAC80211_DEBUG_COUNTERS
  9718. - DEBUGFS_STATS_ADD(tx_handlers_drop, local->tx_handlers_drop);
  9719. - DEBUGFS_STATS_ADD(tx_handlers_queued, local->tx_handlers_queued);
  9720. -- DEBUGFS_STATS_ADD(tx_handlers_drop_unencrypted,
  9721. -- local->tx_handlers_drop_unencrypted);
  9722. - DEBUGFS_STATS_ADD(tx_handlers_drop_fragment,
  9723. - local->tx_handlers_drop_fragment);
  9724. - DEBUGFS_STATS_ADD(tx_handlers_drop_wep,
  9725. ---- a/net/mac80211/debugfs_netdev.c
  9726. -+++ b/net/mac80211/debugfs_netdev.c
  9727. -@@ -177,7 +177,6 @@ static ssize_t ieee80211_if_write_##name
  9728. - IEEE80211_IF_FILE_R(name)
  9729. -
  9730. - /* common attributes */
  9731. --IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC);
  9732. - IEEE80211_IF_FILE(rc_rateidx_mask_2ghz, rc_rateidx_mask[IEEE80211_BAND_2GHZ],
  9733. - HEX);
  9734. - IEEE80211_IF_FILE(rc_rateidx_mask_5ghz, rc_rateidx_mask[IEEE80211_BAND_5GHZ],
  9735. -@@ -562,7 +561,6 @@ IEEE80211_IF_FILE(dot11MeshAwakeWindowDu
  9736. -
  9737. - static void add_common_files(struct ieee80211_sub_if_data *sdata)
  9738. - {
  9739. -- DEBUGFS_ADD(drop_unencrypted);
  9740. - DEBUGFS_ADD(rc_rateidx_mask_2ghz);
  9741. - DEBUGFS_ADD(rc_rateidx_mask_5ghz);
  9742. - DEBUGFS_ADD(rc_rateidx_mcs_mask_2ghz);
  9743. ---- a/net/mac80211/ibss.c
  9744. -+++ b/net/mac80211/ibss.c
  9745. -@@ -249,8 +249,6 @@ static void __ieee80211_sta_join_ibss(st
  9746. - if (presp)
  9747. - kfree_rcu(presp, rcu_head);
  9748. -
  9749. -- sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0;
  9750. --
  9751. - /* make a copy of the chandef, it could be modified below. */
  9752. - chandef = *req_chandef;
  9753. - chan = chandef.chan;
  9754. -@@ -1289,8 +1287,6 @@ static void ieee80211_sta_create_ibss(st
  9755. -
  9756. - if (ifibss->privacy)
  9757. - capability |= WLAN_CAPABILITY_PRIVACY;
  9758. -- else
  9759. -- sdata->drop_unencrypted = 0;
  9760. -
  9761. - __ieee80211_sta_join_ibss(sdata, bssid, sdata->vif.bss_conf.beacon_int,
  9762. - &ifibss->chandef, ifibss->basic_rates,
  9763. ---- a/net/mac80211/ieee80211_i.h
  9764. -+++ b/net/mac80211/ieee80211_i.h
  9765. -@@ -842,8 +842,6 @@ struct ieee80211_sub_if_data {
  9766. -
  9767. - unsigned long state;
  9768. -
  9769. -- int drop_unencrypted;
  9770. --
  9771. - char name[IFNAMSIZ];
  9772. -
  9773. - /* Fragment table for host-based reassembly */
  9774. -@@ -1289,7 +1287,6 @@ struct ieee80211_local {
  9775. - /* TX/RX handler statistics */
  9776. - unsigned int tx_handlers_drop;
  9777. - unsigned int tx_handlers_queued;
  9778. -- unsigned int tx_handlers_drop_unencrypted;
  9779. - unsigned int tx_handlers_drop_fragment;
  9780. - unsigned int tx_handlers_drop_wep;
  9781. - unsigned int tx_handlers_drop_not_assoc;
  9782. ---- a/net/mac80211/iface.c
  9783. -+++ b/net/mac80211/iface.c
  9784. -@@ -1535,7 +1535,6 @@ int ieee80211_if_change_type(struct ieee
  9785. - }
  9786. -
  9787. - /* reset some values that shouldn't be kept across type changes */
  9788. -- sdata->drop_unencrypted = 0;
  9789. - if (type == NL80211_IFTYPE_STATION)
  9790. - sdata->u.mgd.use_4addr = false;
  9791. -
  9792. ---- a/net/mac80211/rx.c
  9793. -+++ b/net/mac80211/rx.c
  9794. -@@ -1897,8 +1897,7 @@ static int ieee80211_drop_unencrypted(st
  9795. - /* Drop unencrypted frames if key is set. */
  9796. - if (unlikely(!ieee80211_has_protected(fc) &&
  9797. - !ieee80211_is_nullfunc(fc) &&
  9798. -- ieee80211_is_data(fc) &&
  9799. -- (rx->key || rx->sdata->drop_unencrypted)))
  9800. -+ ieee80211_is_data(fc) && rx->key))
  9801. - return -EACCES;
  9802. -
  9803. - return 0;
  9804. ---- a/net/mac80211/tx.c
  9805. -+++ b/net/mac80211/tx.c
  9806. -@@ -594,23 +594,8 @@ ieee80211_tx_h_select_key(struct ieee802
  9807. - else if (!is_multicast_ether_addr(hdr->addr1) &&
  9808. - (key = rcu_dereference(tx->sdata->default_unicast_key)))
  9809. - tx->key = key;
  9810. -- else if (info->flags & IEEE80211_TX_CTL_INJECTED)
  9811. -+ else
  9812. - tx->key = NULL;
  9813. -- else if (!tx->sdata->drop_unencrypted)
  9814. -- tx->key = NULL;
  9815. -- else if (tx->skb->protocol == tx->sdata->control_port_protocol)
  9816. -- tx->key = NULL;
  9817. -- else if (ieee80211_is_robust_mgmt_frame(tx->skb) &&
  9818. -- !(ieee80211_is_action(hdr->frame_control) &&
  9819. -- tx->sta && test_sta_flag(tx->sta, WLAN_STA_MFP)))
  9820. -- tx->key = NULL;
  9821. -- else if (ieee80211_is_mgmt(hdr->frame_control) &&
  9822. -- !ieee80211_is_robust_mgmt_frame(tx->skb))
  9823. -- tx->key = NULL;
  9824. -- else {
  9825. -- I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted);
  9826. -- return TX_DROP;
  9827. -- }
  9828. -
  9829. - if (tx->key) {
  9830. - bool skip_hw = false;
  9831. 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
  9832. deleted file mode 100644
  9833. index 02a7fab..0000000
  9834. --- a/package/kernel/mac80211/patches/312-mac80211-don-t-look-up-destination-station-twice.patch
  9835. +++ /dev/null
  9836. @@ -1,71 +0,0 @@
  9837. -From: Johannes Berg <johannes.berg@intel.com>
  9838. -Date: Fri, 20 Mar 2015 16:24:21 +0100
  9839. -Subject: [PATCH] mac80211: don't look up destination station twice
  9840. -
  9841. -There's no need to look up the destination station twice while
  9842. -building the 802.11 header for a given frame if the frame will
  9843. -actually be transmitted to the station we initially looked up.
  9844. -
  9845. -This happens for 4-addr VLAN interfaces and TDLS connections, which
  9846. -both directly send the frame to the station they looked up, though
  9847. -in the case of TDLS some station conditions need to be checked.
  9848. -
  9849. -To avoid that, add a variable indicating that we've looked up the
  9850. -station that the frame is going to be transmitted to, and avoid the
  9851. -lookup/flag checking if it already has been done.
  9852. -
  9853. -In the TDLS case, also move the authorized/wme_sta flag assignment
  9854. -to the correct place, i.e. only when that station is really used.
  9855. -Before this change, the new lookup should always have succeeded so
  9856. -that the potentially erroneous data would be overwritten.
  9857. -
  9858. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9859. ----
  9860. -
  9861. ---- a/net/mac80211/tx.c
  9862. -+++ b/net/mac80211/tx.c
  9863. -@@ -1894,6 +1894,7 @@ static struct sk_buff *ieee80211_build_h
  9864. - bool wme_sta = false, authorized = false, tdls_auth = false;
  9865. - bool tdls_peer = false, tdls_setup_frame = false;
  9866. - bool multicast;
  9867. -+ bool have_station = false;
  9868. - u16 info_id = 0;
  9869. - struct ieee80211_chanctx_conf *chanctx_conf;
  9870. - struct ieee80211_sub_if_data *ap_sdata;
  9871. -@@ -1918,6 +1919,7 @@ static struct sk_buff *ieee80211_build_h
  9872. - hdrlen = 30;
  9873. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  9874. - wme_sta = sta->sta.wme;
  9875. -+ have_station = true;
  9876. - }
  9877. - ap_sdata = container_of(sdata->bss, struct ieee80211_sub_if_data,
  9878. - u.ap);
  9879. -@@ -2034,9 +2036,6 @@ static struct sk_buff *ieee80211_build_h
  9880. - if (sdata->wdev.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) {
  9881. - sta = sta_info_get(sdata, skb->data);
  9882. - if (sta) {
  9883. -- authorized = test_sta_flag(sta,
  9884. -- WLAN_STA_AUTHORIZED);
  9885. -- wme_sta = sta->sta.wme;
  9886. - tdls_peer = test_sta_flag(sta,
  9887. - WLAN_STA_TDLS_PEER);
  9888. - tdls_auth = test_sta_flag(sta,
  9889. -@@ -2068,6 +2067,9 @@ static struct sk_buff *ieee80211_build_h
  9890. - memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN);
  9891. - memcpy(hdr.addr3, sdata->u.mgd.bssid, ETH_ALEN);
  9892. - hdrlen = 24;
  9893. -+ have_station = true;
  9894. -+ authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  9895. -+ wme_sta = sta->sta.wme;
  9896. - } else if (sdata->u.mgd.use_4addr &&
  9897. - cpu_to_be16(ethertype) != sdata->control_port_protocol) {
  9898. - fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS |
  9899. -@@ -2130,7 +2132,7 @@ static struct sk_buff *ieee80211_build_h
  9900. - * in AP mode)
  9901. - */
  9902. - multicast = is_multicast_ether_addr(hdr.addr1);
  9903. -- if (!multicast) {
  9904. -+ if (!multicast && !have_station) {
  9905. - sta = sta_info_get(sdata, hdr.addr1);
  9906. - if (sta) {
  9907. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  9908. 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
  9909. new file mode 100644
  9910. index 0000000..61cafc7
  9911. --- /dev/null
  9912. +++ b/package/kernel/mac80211/patches/312-mac80211-fix-txq-queue-related-crashes.patch
  9913. @@ -0,0 +1,27 @@
  9914. +From: Michal Kazior <michal.kazior@tieto.com>
  9915. +Date: Thu, 21 Jan 2016 14:23:07 +0100
  9916. +Subject: [PATCH] mac80211: fix txq queue related crashes
  9917. +
  9918. +The driver can access the queue simultanously
  9919. +while mac80211 tears down the interface. Without
  9920. +spinlock protection this could lead to corrupting
  9921. +sk_buff_head and subsequently to an invalid
  9922. +pointer dereference.
  9923. +
  9924. +Fixes: ba8c3d6f16a1 ("mac80211: add an intermediate software queue implementation")
  9925. +Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
  9926. +---
  9927. +
  9928. +--- a/net/mac80211/iface.c
  9929. ++++ b/net/mac80211/iface.c
  9930. +@@ -977,7 +977,10 @@ static void ieee80211_do_stop(struct iee
  9931. + if (sdata->vif.txq) {
  9932. + struct txq_info *txqi = to_txq_info(sdata->vif.txq);
  9933. +
  9934. ++ spin_lock_bh(&txqi->queue.lock);
  9935. + ieee80211_purge_tx_queue(&local->hw, &txqi->queue);
  9936. ++ spin_unlock_bh(&txqi->queue.lock);
  9937. ++
  9938. + atomic_set(&sdata->txqs_len[txqi->txq.ac], 0);
  9939. + }
  9940. +
  9941. 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
  9942. deleted file mode 100644
  9943. index 4125351..0000000
  9944. --- a/package/kernel/mac80211/patches/313-mac80211-drop-4-addr-VLAN-frames-earlier-if-not-conn.patch
  9945. +++ /dev/null
  9946. @@ -1,27 +0,0 @@
  9947. -From: Johannes Berg <johannes.berg@intel.com>
  9948. -Date: Fri, 20 Mar 2015 16:24:22 +0100
  9949. -Subject: [PATCH] mac80211: drop 4-addr VLAN frames earlier if not
  9950. - connected
  9951. -
  9952. -If there's no station on the 4-addr VLAN interface, then frames
  9953. -cannot be transmitted. Drop such frames earlier, before setting
  9954. -up all the information for them.
  9955. -
  9956. -We should keep the old check though since that code might be used
  9957. -for other internally-generated frames.
  9958. -
  9959. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9960. ----
  9961. -
  9962. ---- a/net/mac80211/tx.c
  9963. -+++ b/net/mac80211/tx.c
  9964. -@@ -1920,6 +1920,9 @@ static struct sk_buff *ieee80211_build_h
  9965. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  9966. - wme_sta = sta->sta.wme;
  9967. - have_station = true;
  9968. -+ } else if (sdata->wdev.use_4addr) {
  9969. -+ ret = -ENOLINK;
  9970. -+ goto free;
  9971. - }
  9972. - ap_sdata = container_of(sdata->bss, struct ieee80211_sub_if_data,
  9973. - u.ap);
  9974. 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
  9975. new file mode 100644
  9976. index 0000000..844d43b
  9977. --- /dev/null
  9978. +++ b/package/kernel/mac80211/patches/313-mac80211-fix-unnecessary-frame-drops-in-mesh-fwding.patch
  9979. @@ -0,0 +1,57 @@
  9980. +From: Michal Kazior <michal.kazior@tieto.com>
  9981. +Date: Mon, 25 Jan 2016 14:43:24 +0100
  9982. +Subject: [PATCH] mac80211: fix unnecessary frame drops in mesh fwding
  9983. +
  9984. +The ieee80211_queue_stopped() expects hw queue
  9985. +number but it was given raw WMM AC number instead.
  9986. +
  9987. +This could cause frame drops and problems with
  9988. +traffic in some cases - most notably if driver
  9989. +doesn't map AC numbers to queue numbers 1:1 and
  9990. +uses ieee80211_stop_queues() and
  9991. +ieee80211_wake_queue() only without ever calling
  9992. +ieee80211_wake_queues().
  9993. +
  9994. +On ath10k it was possible to hit this problem in
  9995. +the following case:
  9996. +
  9997. + 1. wlan0 uses queue 0
  9998. + (ath10k maps queues per vif)
  9999. + 2. offchannel uses queue 15
  10000. + 3. queues 1-14 are unused
  10001. + 4. ieee80211_stop_queues()
  10002. + 5. ieee80211_wake_queue(q=0)
  10003. + 6. ieee80211_wake_queue(q=15)
  10004. + (other queues are not woken up because both
  10005. + driver and mac80211 know other queues are
  10006. + unused)
  10007. + 7. ieee80211_rx_h_mesh_fwding()
  10008. + 8. ieee80211_select_queue_80211() returns 2
  10009. + 9. ieee80211_queue_stopped(q=2) returns true
  10010. + 10. frame is dropped (oops!)
  10011. +
  10012. +Fixes: d3c1597b8d1b ("mac80211: fix forwarded mesh frame queue mapping")
  10013. +Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
  10014. +---
  10015. +
  10016. +--- a/net/mac80211/rx.c
  10017. ++++ b/net/mac80211/rx.c
  10018. +@@ -2235,7 +2235,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  10019. + struct ieee80211_local *local = rx->local;
  10020. + struct ieee80211_sub_if_data *sdata = rx->sdata;
  10021. + struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
  10022. +- u16 q, hdrlen;
  10023. ++ u16 ac, q, hdrlen;
  10024. +
  10025. + hdr = (struct ieee80211_hdr *) skb->data;
  10026. + hdrlen = ieee80211_hdrlen(hdr->frame_control);
  10027. +@@ -2304,7 +2304,8 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  10028. + ether_addr_equal(sdata->vif.addr, hdr->addr3))
  10029. + return RX_CONTINUE;
  10030. +
  10031. +- q = ieee80211_select_queue_80211(sdata, skb, hdr);
  10032. ++ ac = ieee80211_select_queue_80211(sdata, skb, hdr);
  10033. ++ q = sdata->vif.hw_queue[ac];
  10034. + if (ieee80211_queue_stopped(&local->hw, q)) {
  10035. + IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_congestion);
  10036. + return RX_DROP_MONITOR;
  10037. 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
  10038. new file mode 100644
  10039. index 0000000..5b3efbd
  10040. --- /dev/null
  10041. +++ b/package/kernel/mac80211/patches/314-mac80211-Requeue-work-after-scan-complete-for-all-VI.patch
  10042. @@ -0,0 +1,103 @@
  10043. +From: Sachin Kulkarni <Sachin.Kulkarni@imgtec.com>
  10044. +Date: Tue, 12 Jan 2016 14:30:19 +0530
  10045. +Subject: [PATCH] mac80211: Requeue work after scan complete for all VIF
  10046. + types.
  10047. +
  10048. +During a sw scan ieee80211_iface_work ignores work items for all vifs.
  10049. +However after the scan complete work is requeued only for STA, ADHOC
  10050. +and MESH iftypes.
  10051. +
  10052. +This occasionally results in event processing getting delayed/not
  10053. +processed for iftype AP when it coexists with a STA. This can result
  10054. +in data halt and eventually disconnection on the AP interface.
  10055. +
  10056. +Signed-off-by: Sachin Kulkarni <Sachin.Kulkarni@imgtec.com>
  10057. +Cc: linux-wireless@vger.kernel.org
  10058. +Cc: johannes@sipsolutions.net
  10059. +---
  10060. +
  10061. +--- a/net/mac80211/ibss.c
  10062. ++++ b/net/mac80211/ibss.c
  10063. +@@ -1731,7 +1731,6 @@ void ieee80211_ibss_notify_scan_complete
  10064. + if (sdata->vif.type != NL80211_IFTYPE_ADHOC)
  10065. + continue;
  10066. + sdata->u.ibss.last_scan_completed = jiffies;
  10067. +- ieee80211_queue_work(&local->hw, &sdata->work);
  10068. + }
  10069. + mutex_unlock(&local->iflist_mtx);
  10070. + }
  10071. +--- a/net/mac80211/mesh.c
  10072. ++++ b/net/mac80211/mesh.c
  10073. +@@ -1369,17 +1369,6 @@ out:
  10074. + sdata_unlock(sdata);
  10075. + }
  10076. +
  10077. +-void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local)
  10078. +-{
  10079. +- struct ieee80211_sub_if_data *sdata;
  10080. +-
  10081. +- rcu_read_lock();
  10082. +- list_for_each_entry_rcu(sdata, &local->interfaces, list)
  10083. +- if (ieee80211_vif_is_mesh(&sdata->vif) &&
  10084. +- ieee80211_sdata_running(sdata))
  10085. +- ieee80211_queue_work(&local->hw, &sdata->work);
  10086. +- rcu_read_unlock();
  10087. +-}
  10088. +
  10089. + void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata)
  10090. + {
  10091. +--- a/net/mac80211/mesh.h
  10092. ++++ b/net/mac80211/mesh.h
  10093. +@@ -362,14 +362,10 @@ static inline bool mesh_path_sel_is_hwmp
  10094. + return sdata->u.mesh.mesh_pp_id == IEEE80211_PATH_PROTOCOL_HWMP;
  10095. + }
  10096. +
  10097. +-void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local);
  10098. +-
  10099. + void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata);
  10100. + void mesh_sync_adjust_tbtt(struct ieee80211_sub_if_data *sdata);
  10101. + void ieee80211s_stop(void);
  10102. + #else
  10103. +-static inline void
  10104. +-ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local) {}
  10105. + static inline bool mesh_path_sel_is_hwmp(struct ieee80211_sub_if_data *sdata)
  10106. + { return false; }
  10107. + static inline void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata)
  10108. +--- a/net/mac80211/mlme.c
  10109. ++++ b/net/mac80211/mlme.c
  10110. +@@ -3978,8 +3978,6 @@ static void ieee80211_restart_sta_timer(
  10111. + if (!ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR))
  10112. + ieee80211_queue_work(&sdata->local->hw,
  10113. + &sdata->u.mgd.monitor_work);
  10114. +- /* and do all the other regular work too */
  10115. +- ieee80211_queue_work(&sdata->local->hw, &sdata->work);
  10116. + }
  10117. + }
  10118. +
  10119. +--- a/net/mac80211/scan.c
  10120. ++++ b/net/mac80211/scan.c
  10121. +@@ -314,6 +314,7 @@ static void __ieee80211_scan_completed(s
  10122. + bool was_scanning = local->scanning;
  10123. + struct cfg80211_scan_request *scan_req;
  10124. + struct ieee80211_sub_if_data *scan_sdata;
  10125. ++ struct ieee80211_sub_if_data *sdata;
  10126. +
  10127. + lockdep_assert_held(&local->mtx);
  10128. +
  10129. +@@ -373,7 +374,15 @@ static void __ieee80211_scan_completed(s
  10130. +
  10131. + ieee80211_mlme_notify_scan_completed(local);
  10132. + ieee80211_ibss_notify_scan_completed(local);
  10133. +- ieee80211_mesh_notify_scan_completed(local);
  10134. ++
  10135. ++ /* Requeue all the work that might have been ignored while
  10136. ++ * the scan was in progress
  10137. ++ */
  10138. ++ list_for_each_entry_rcu(sdata, &local->interfaces, list) {
  10139. ++ if (ieee80211_sdata_running(sdata))
  10140. ++ ieee80211_queue_work(&sdata->local->hw, &sdata->work);
  10141. ++ }
  10142. ++
  10143. + if (was_scanning)
  10144. + ieee80211_start_next_roc(local);
  10145. + }
  10146. 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
  10147. deleted file mode 100644
  10148. index 9105a64..0000000
  10149. --- a/package/kernel/mac80211/patches/314-mac80211-mesh-avoid-pointless-station-lookup.patch
  10150. +++ /dev/null
  10151. @@ -1,33 +0,0 @@
  10152. -From: Johannes Berg <johannes.berg@intel.com>
  10153. -Date: Fri, 20 Mar 2015 16:24:23 +0100
  10154. -Subject: [PATCH] mac80211: mesh: avoid pointless station lookup
  10155. -
  10156. -In ieee80211_build_hdr(), the station is looked up to build the
  10157. -header correctly (QoS field) and to check for authorization. For
  10158. -mesh, authorization isn't checked here, and QoS capability is
  10159. -mandatory, so the station lookup can be avoided.
  10160. -
  10161. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  10162. ----
  10163. -
  10164. ---- a/net/mac80211/tx.c
  10165. -+++ b/net/mac80211/tx.c
  10166. -@@ -2130,12 +2130,14 @@ static struct sk_buff *ieee80211_build_h
  10167. - }
  10168. -
  10169. - /*
  10170. -- * There's no need to try to look up the destination
  10171. -- * if it is a multicast address (which can only happen
  10172. -- * in AP mode)
  10173. -+ * There's no need to try to look up the destination station
  10174. -+ * if it is a multicast address. In mesh, there's no need to
  10175. -+ * look up the station at all as it always must be QoS capable
  10176. -+ * and mesh mode checks authorization later.
  10177. - */
  10178. - multicast = is_multicast_ether_addr(hdr.addr1);
  10179. -- if (!multicast && !have_station) {
  10180. -+ if (!multicast && !have_station &&
  10181. -+ !ieee80211_vif_is_mesh(&sdata->vif)) {
  10182. - sta = sta_info_get(sdata, hdr.addr1);
  10183. - if (sta) {
  10184. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  10185. 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
  10186. deleted file mode 100644
  10187. index d143025..0000000
  10188. --- a/package/kernel/mac80211/patches/315-mac80211-avoid-duplicate-TX-path-station-lookup.patch
  10189. +++ /dev/null
  10190. @@ -1,267 +0,0 @@
  10191. -From: Johannes Berg <johannes.berg@intel.com>
  10192. -Date: Fri, 20 Mar 2015 14:18:27 +0100
  10193. -Subject: [PATCH] mac80211: avoid duplicate TX path station lookup
  10194. -
  10195. -Instead of looking up the destination station twice in the TX path
  10196. -(first to build the header, and then for control processing), save
  10197. -it when building the header and use it later in the TX path.
  10198. -
  10199. -To avoid having to look up the station in the many callers, allow
  10200. -those to pass %NULL which keeps the existing lookup.
  10201. -
  10202. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  10203. ----
  10204. -
  10205. ---- a/net/mac80211/cfg.c
  10206. -+++ b/net/mac80211/cfg.c
  10207. -@@ -3565,7 +3565,7 @@ static int ieee80211_probe_client(struct
  10208. - nullfunc->qos_ctrl = cpu_to_le16(7);
  10209. -
  10210. - local_bh_disable();
  10211. -- ieee80211_xmit(sdata, skb);
  10212. -+ ieee80211_xmit(sdata, sta, skb);
  10213. - local_bh_enable();
  10214. - rcu_read_unlock();
  10215. -
  10216. ---- a/net/mac80211/ieee80211_i.h
  10217. -+++ b/net/mac80211/ieee80211_i.h
  10218. -@@ -1775,7 +1775,8 @@ void mac80211_ev_michael_mic_failure(str
  10219. - gfp_t gfp);
  10220. - void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata,
  10221. - bool bss_notify);
  10222. --void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb);
  10223. -+void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
  10224. -+ struct sta_info *sta, struct sk_buff *skb);
  10225. -
  10226. - void __ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata,
  10227. - struct sk_buff *skb, int tid,
  10228. ---- a/net/mac80211/sta_info.c
  10229. -+++ b/net/mac80211/sta_info.c
  10230. -@@ -1279,7 +1279,7 @@ static void ieee80211_send_null_response
  10231. - }
  10232. -
  10233. - info->band = chanctx_conf->def.chan->band;
  10234. -- ieee80211_xmit(sdata, skb);
  10235. -+ ieee80211_xmit(sdata, sta, skb);
  10236. - rcu_read_unlock();
  10237. - }
  10238. -
  10239. ---- a/net/mac80211/tx.c
  10240. -+++ b/net/mac80211/tx.c
  10241. -@@ -1110,11 +1110,13 @@ static bool ieee80211_tx_prep_agg(struct
  10242. -
  10243. - /*
  10244. - * initialises @tx
  10245. -+ * pass %NULL for the station if unknown, a valid pointer if known
  10246. -+ * or an ERR_PTR() if the station is known not to exist
  10247. - */
  10248. - static ieee80211_tx_result
  10249. - ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata,
  10250. - struct ieee80211_tx_data *tx,
  10251. -- struct sk_buff *skb)
  10252. -+ struct sta_info *sta, struct sk_buff *skb)
  10253. - {
  10254. - struct ieee80211_local *local = sdata->local;
  10255. - struct ieee80211_hdr *hdr;
  10256. -@@ -1137,17 +1139,22 @@ ieee80211_tx_prepare(struct ieee80211_su
  10257. -
  10258. - hdr = (struct ieee80211_hdr *) skb->data;
  10259. -
  10260. -- if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
  10261. -- tx->sta = rcu_dereference(sdata->u.vlan.sta);
  10262. -- if (!tx->sta && sdata->dev->ieee80211_ptr->use_4addr)
  10263. -- return TX_DROP;
  10264. -- } else if (info->flags & (IEEE80211_TX_CTL_INJECTED |
  10265. -- IEEE80211_TX_INTFL_NL80211_FRAME_TX) ||
  10266. -- tx->sdata->control_port_protocol == tx->skb->protocol) {
  10267. -- tx->sta = sta_info_get_bss(sdata, hdr->addr1);
  10268. -+ if (likely(sta)) {
  10269. -+ if (!IS_ERR(sta))
  10270. -+ tx->sta = sta;
  10271. -+ } else {
  10272. -+ if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
  10273. -+ tx->sta = rcu_dereference(sdata->u.vlan.sta);
  10274. -+ if (!tx->sta && sdata->wdev.use_4addr)
  10275. -+ return TX_DROP;
  10276. -+ } else if (info->flags & (IEEE80211_TX_INTFL_NL80211_FRAME_TX |
  10277. -+ IEEE80211_TX_CTL_INJECTED) ||
  10278. -+ tx->sdata->control_port_protocol == tx->skb->protocol) {
  10279. -+ tx->sta = sta_info_get_bss(sdata, hdr->addr1);
  10280. -+ }
  10281. -+ if (!tx->sta && !is_multicast_ether_addr(hdr->addr1))
  10282. -+ tx->sta = sta_info_get(sdata, hdr->addr1);
  10283. - }
  10284. -- if (!tx->sta && !is_multicast_ether_addr(hdr->addr1))
  10285. -- tx->sta = sta_info_get(sdata, hdr->addr1);
  10286. -
  10287. - if (tx->sta && ieee80211_is_data_qos(hdr->frame_control) &&
  10288. - !ieee80211_is_qos_nullfunc(hdr->frame_control) &&
  10289. -@@ -1485,7 +1492,7 @@ bool ieee80211_tx_prepare_skb(struct iee
  10290. - struct ieee80211_tx_data tx;
  10291. - struct sk_buff *skb2;
  10292. -
  10293. -- if (ieee80211_tx_prepare(sdata, &tx, skb) == TX_DROP)
  10294. -+ if (ieee80211_tx_prepare(sdata, &tx, NULL, skb) == TX_DROP)
  10295. - return false;
  10296. -
  10297. - info->band = band;
  10298. -@@ -1518,7 +1525,8 @@ EXPORT_SYMBOL(ieee80211_tx_prepare_skb);
  10299. - * Returns false if the frame couldn't be transmitted but was queued instead.
  10300. - */
  10301. - static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata,
  10302. -- struct sk_buff *skb, bool txpending)
  10303. -+ struct sta_info *sta, struct sk_buff *skb,
  10304. -+ bool txpending)
  10305. - {
  10306. - struct ieee80211_local *local = sdata->local;
  10307. - struct ieee80211_tx_data tx;
  10308. -@@ -1534,7 +1542,7 @@ static bool ieee80211_tx(struct ieee8021
  10309. -
  10310. - /* initialises tx */
  10311. - led_len = skb->len;
  10312. -- res_prepare = ieee80211_tx_prepare(sdata, &tx, skb);
  10313. -+ res_prepare = ieee80211_tx_prepare(sdata, &tx, sta, skb);
  10314. -
  10315. - if (unlikely(res_prepare == TX_DROP)) {
  10316. - ieee80211_free_txskb(&local->hw, skb);
  10317. -@@ -1590,7 +1598,8 @@ static int ieee80211_skb_resize(struct i
  10318. - return 0;
  10319. - }
  10320. -
  10321. --void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb)
  10322. -+void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
  10323. -+ struct sta_info *sta, struct sk_buff *skb)
  10324. - {
  10325. - struct ieee80211_local *local = sdata->local;
  10326. - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  10327. -@@ -1625,7 +1634,7 @@ void ieee80211_xmit(struct ieee80211_sub
  10328. - }
  10329. -
  10330. - ieee80211_set_qos_hdr(sdata, skb);
  10331. -- ieee80211_tx(sdata, skb, false);
  10332. -+ ieee80211_tx(sdata, sta, skb, false);
  10333. - }
  10334. -
  10335. - static bool ieee80211_parse_tx_radiotap(struct sk_buff *skb)
  10336. -@@ -1846,7 +1855,7 @@ netdev_tx_t ieee80211_monitor_start_xmit
  10337. - goto fail_rcu;
  10338. -
  10339. - info->band = chandef->chan->band;
  10340. -- ieee80211_xmit(sdata, skb);
  10341. -+ ieee80211_xmit(sdata, NULL, skb);
  10342. - rcu_read_unlock();
  10343. -
  10344. - return NETDEV_TX_OK;
  10345. -@@ -1877,7 +1886,8 @@ fail:
  10346. - * Returns: the (possibly reallocated) skb or an ERR_PTR() code
  10347. - */
  10348. - static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
  10349. -- struct sk_buff *skb, u32 info_flags)
  10350. -+ struct sk_buff *skb, u32 info_flags,
  10351. -+ struct sta_info **sta_out)
  10352. - {
  10353. - struct ieee80211_local *local = sdata->local;
  10354. - struct ieee80211_tx_info *info;
  10355. -@@ -1920,6 +1930,7 @@ static struct sk_buff *ieee80211_build_h
  10356. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  10357. - wme_sta = sta->sta.wme;
  10358. - have_station = true;
  10359. -+ *sta_out = sta;
  10360. - } else if (sdata->wdev.use_4addr) {
  10361. - ret = -ENOLINK;
  10362. - goto free;
  10363. -@@ -2073,6 +2084,7 @@ static struct sk_buff *ieee80211_build_h
  10364. - have_station = true;
  10365. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  10366. - wme_sta = sta->sta.wme;
  10367. -+ *sta_out = sta;
  10368. - } else if (sdata->u.mgd.use_4addr &&
  10369. - cpu_to_be16(ethertype) != sdata->control_port_protocol) {
  10370. - fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS |
  10371. -@@ -2136,13 +2148,18 @@ static struct sk_buff *ieee80211_build_h
  10372. - * and mesh mode checks authorization later.
  10373. - */
  10374. - multicast = is_multicast_ether_addr(hdr.addr1);
  10375. -- if (!multicast && !have_station &&
  10376. -- !ieee80211_vif_is_mesh(&sdata->vif)) {
  10377. -- sta = sta_info_get(sdata, hdr.addr1);
  10378. -+ if (multicast) {
  10379. -+ *sta_out = ERR_PTR(-ENOENT);
  10380. -+ } else if (!have_station && !ieee80211_vif_is_mesh(&sdata->vif)) {
  10381. -+ if (sdata->control_port_protocol == skb->protocol)
  10382. -+ sta = sta_info_get_bss(sdata, hdr.addr1);
  10383. -+ else
  10384. -+ sta = sta_info_get(sdata, hdr.addr1);
  10385. - if (sta) {
  10386. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  10387. - wme_sta = sta->sta.wme;
  10388. - }
  10389. -+ *sta_out = sta ?: ERR_PTR(-ENOENT);
  10390. - }
  10391. -
  10392. - /* For mesh, the use of the QoS header is mandatory */
  10393. -@@ -2320,6 +2337,7 @@ void __ieee80211_subif_start_xmit(struct
  10394. - u32 info_flags)
  10395. - {
  10396. - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  10397. -+ struct sta_info *sta = NULL;
  10398. -
  10399. - if (unlikely(skb->len < ETH_HLEN)) {
  10400. - kfree_skb(skb);
  10401. -@@ -2328,7 +2346,7 @@ void __ieee80211_subif_start_xmit(struct
  10402. -
  10403. - rcu_read_lock();
  10404. -
  10405. -- skb = ieee80211_build_hdr(sdata, skb, info_flags);
  10406. -+ skb = ieee80211_build_hdr(sdata, skb, info_flags, &sta);
  10407. - if (IS_ERR(skb))
  10408. - goto out;
  10409. -
  10410. -@@ -2336,7 +2354,7 @@ void __ieee80211_subif_start_xmit(struct
  10411. - dev->stats.tx_bytes += skb->len;
  10412. - dev->trans_start = jiffies;
  10413. -
  10414. -- ieee80211_xmit(sdata, skb);
  10415. -+ ieee80211_xmit(sdata, sta, skb);
  10416. - out:
  10417. - rcu_read_unlock();
  10418. - }
  10419. -@@ -2364,10 +2382,11 @@ ieee80211_build_data_template(struct iee
  10420. - .local = sdata->local,
  10421. - .sdata = sdata,
  10422. - };
  10423. -+ struct sta_info *sta_ignore;
  10424. -
  10425. - rcu_read_lock();
  10426. -
  10427. -- skb = ieee80211_build_hdr(sdata, skb, info_flags);
  10428. -+ skb = ieee80211_build_hdr(sdata, skb, info_flags, &sta_ignore);
  10429. - if (IS_ERR(skb))
  10430. - goto out;
  10431. -
  10432. -@@ -2425,7 +2444,7 @@ static bool ieee80211_tx_pending_skb(str
  10433. - return true;
  10434. - }
  10435. - info->band = chanctx_conf->def.chan->band;
  10436. -- result = ieee80211_tx(sdata, skb, true);
  10437. -+ result = ieee80211_tx(sdata, NULL, skb, true);
  10438. - } else {
  10439. - struct sk_buff_head skbs;
  10440. -
  10441. -@@ -3163,7 +3182,7 @@ ieee80211_get_buffered_bc(struct ieee802
  10442. -
  10443. - if (sdata->vif.type == NL80211_IFTYPE_AP)
  10444. - sdata = IEEE80211_DEV_TO_SUB_IF(skb->dev);
  10445. -- if (!ieee80211_tx_prepare(sdata, &tx, skb))
  10446. -+ if (!ieee80211_tx_prepare(sdata, &tx, NULL, skb))
  10447. - break;
  10448. - dev_kfree_skb_any(skb);
  10449. - }
  10450. -@@ -3295,6 +3314,6 @@ void __ieee80211_tx_skb_tid_band(struct
  10451. - */
  10452. - local_bh_disable();
  10453. - IEEE80211_SKB_CB(skb)->band = band;
  10454. -- ieee80211_xmit(sdata, skb);
  10455. -+ ieee80211_xmit(sdata, NULL, skb);
  10456. - local_bh_enable();
  10457. - }
  10458. 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
  10459. new file mode 100644
  10460. index 0000000..52fecb9
  10461. --- /dev/null
  10462. +++ b/package/kernel/mac80211/patches/315-mac80211-fix-ibss-scan-parameters.patch
  10463. @@ -0,0 +1,57 @@
  10464. +From: Sara Sharon <sara.sharon@intel.com>
  10465. +Date: Mon, 25 Jan 2016 15:46:35 +0200
  10466. +Subject: [PATCH] mac80211: fix ibss scan parameters
  10467. +
  10468. +When joining IBSS a full scan should be initiated in order to search
  10469. +for existing cell, unless the fixed_channel parameter was set.
  10470. +A default channel to create the IBSS on if no cell was found is
  10471. +provided as well.
  10472. +However - a scan is initiated only on the default channel provided
  10473. +regardless of whether ifibss->fixed_channel is set or not, with the
  10474. +obvious result of the cell not joining existing IBSS cell that is
  10475. +on another channel.
  10476. +
  10477. +Fixes: 76bed0f43b27 ("mac80211: IBSS fix scan request")
  10478. +Signed-off-by: Sara Sharon <sara.sharon@intel.com>
  10479. +Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
  10480. +---
  10481. +
  10482. +--- a/net/mac80211/ibss.c
  10483. ++++ b/net/mac80211/ibss.c
  10484. +@@ -7,6 +7,7 @@
  10485. + * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
  10486. + * Copyright 2009, Johannes Berg <johannes@sipsolutions.net>
  10487. + * Copyright 2013-2014 Intel Mobile Communications GmbH
  10488. ++ * Copyright(c) 2016 Intel Deutschland GmbH
  10489. + *
  10490. + * This program is free software; you can redistribute it and/or modify
  10491. + * it under the terms of the GNU General Public License version 2 as
  10492. +@@ -1483,14 +1484,21 @@ static void ieee80211_sta_find_ibss(stru
  10493. +
  10494. + sdata_info(sdata, "Trigger new scan to find an IBSS to join\n");
  10495. +
  10496. +- num = ieee80211_ibss_setup_scan_channels(local->hw.wiphy,
  10497. +- &ifibss->chandef,
  10498. +- channels,
  10499. +- ARRAY_SIZE(channels));
  10500. + scan_width = cfg80211_chandef_to_scan_width(&ifibss->chandef);
  10501. +- ieee80211_request_ibss_scan(sdata, ifibss->ssid,
  10502. +- ifibss->ssid_len, channels, num,
  10503. +- scan_width);
  10504. ++
  10505. ++ if (ifibss->fixed_channel) {
  10506. ++ num = ieee80211_ibss_setup_scan_channels(local->hw.wiphy,
  10507. ++ &ifibss->chandef,
  10508. ++ channels,
  10509. ++ ARRAY_SIZE(channels));
  10510. ++ ieee80211_request_ibss_scan(sdata, ifibss->ssid,
  10511. ++ ifibss->ssid_len, channels,
  10512. ++ num, scan_width);
  10513. ++ } else {
  10514. ++ ieee80211_request_ibss_scan(sdata, ifibss->ssid,
  10515. ++ ifibss->ssid_len, NULL,
  10516. ++ 0, scan_width);
  10517. ++ }
  10518. + } else {
  10519. + int interval = IEEE80211_SCAN_INTERVAL;
  10520. +
  10521. 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
  10522. deleted file mode 100644
  10523. index 77a82c2..0000000
  10524. --- a/package/kernel/mac80211/patches/316-mac80211-reduce-log-spam-from-ieee80211_handle_pwr_c.patch
  10525. +++ /dev/null
  10526. @@ -1,38 +0,0 @@
  10527. -From: John Linville <linville@tuxdriver.com>
  10528. -Date: Tue, 31 Mar 2015 10:49:14 -0400
  10529. -Subject: [PATCH] mac80211: reduce log spam from ieee80211_handle_pwr_constr
  10530. -
  10531. -This changes a couple of messages from sdata_info to sdata_dbg.
  10532. -This should reduce some log spam, as reported here:
  10533. -
  10534. - https://bugzilla.redhat.com/show_bug.cgi?id=1206468
  10535. -
  10536. -Signed-off-by: John W. Linville <linville@tuxdriver.com>
  10537. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  10538. ----
  10539. -
  10540. ---- a/net/mac80211/mlme.c
  10541. -+++ b/net/mac80211/mlme.c
  10542. -@@ -1347,15 +1347,15 @@ static u32 ieee80211_handle_pwr_constr(s
  10543. - */
  10544. - if (has_80211h_pwr &&
  10545. - (!has_cisco_pwr || pwr_level_80211h <= pwr_level_cisco)) {
  10546. -- sdata_info(sdata,
  10547. -- "Limiting TX power to %d (%d - %d) dBm as advertised by %pM\n",
  10548. -- pwr_level_80211h, chan_pwr, pwr_reduction_80211h,
  10549. -- sdata->u.mgd.bssid);
  10550. -+ sdata_dbg(sdata,
  10551. -+ "Limiting TX power to %d (%d - %d) dBm as advertised by %pM\n",
  10552. -+ pwr_level_80211h, chan_pwr, pwr_reduction_80211h,
  10553. -+ sdata->u.mgd.bssid);
  10554. - new_ap_level = pwr_level_80211h;
  10555. - } else { /* has_cisco_pwr is always true here. */
  10556. -- sdata_info(sdata,
  10557. -- "Limiting TX power to %d dBm as advertised by %pM\n",
  10558. -- pwr_level_cisco, sdata->u.mgd.bssid);
  10559. -+ sdata_dbg(sdata,
  10560. -+ "Limiting TX power to %d dBm as advertised by %pM\n",
  10561. -+ pwr_level_cisco, sdata->u.mgd.bssid);
  10562. - new_ap_level = pwr_level_cisco;
  10563. - }
  10564. -
  10565. 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
  10566. new file mode 100644
  10567. index 0000000..e78df36
  10568. --- /dev/null
  10569. +++ b/package/kernel/mac80211/patches/316-net-mac80211-agg-rx.c-fix-use-of-uninitialised-value.patch
  10570. @@ -0,0 +1,50 @@
  10571. +From: Chris Bainbridge <chris.bainbridge@gmail.com>
  10572. +Date: Wed, 27 Jan 2016 15:46:18 +0000
  10573. +Subject: [PATCH] net/mac80211/agg-rx.c: fix use of uninitialised values
  10574. +
  10575. +Use kzalloc instead of kmalloc for struct tid_ampdu_rx. Fixes:
  10576. +
  10577. +[ 7.976605] UBSAN: Undefined behaviour in net/mac80211/rx.c:932:29
  10578. +[ 7.976608] load of value 2 is not a valid value for type '_Bool'
  10579. +[ 7.976611] CPU: 3 PID: 1134 Comm: kworker/u16:7 Not tainted 4.5.0-rc1+ #265
  10580. +[ 7.976613] Hardware name: Apple Inc. MacBookPro10,2/Mac-AFD8A9D944EA4843, BIOS MBP102.88Z.0106.B0A.1509130955 09/13/2015
  10581. +[ 7.976616] Workqueue: phy0 rt2x00usb_work_rxdone
  10582. +[ 7.976619] 0000000000000004 ffff880254a7ba50 ffffffff8181d866 0000000000000007
  10583. +[ 7.976622] ffff880254a7ba78 ffff880254a7ba68 ffffffff8188422d ffffffff8379b500
  10584. +[ 7.976626] ffff880254a7bab8 ffffffff81884747 0000000000000202 0000000348620032
  10585. +[ 7.976629] Call Trace:
  10586. +[ 7.976633] [<ffffffff8181d866>] dump_stack+0x45/0x5f
  10587. +[ 7.976637] [<ffffffff8188422d>] ubsan_epilogue+0xd/0x40
  10588. +[ 7.976642] [<ffffffff81884747>] __ubsan_handle_load_invalid_value+0x67/0x70
  10589. +[ 7.976646] [<ffffffff82227b4d>] ieee80211_sta_reorder_release.isra.16+0x5ed/0x730
  10590. +[ 7.976650] [<ffffffff8222ca14>] ieee80211_prepare_and_rx_handle+0xd04/0x1c00
  10591. +[ 7.976654] [<ffffffff81cb27ce>] ? usb_hcd_map_urb_for_dma+0x65e/0x960
  10592. +[ 7.976659] [<ffffffff8222db03>] __ieee80211_rx_handle_packet+0x1f3/0x750
  10593. +[ 7.976663] [<ffffffff8222e4a7>] ieee80211_rx_napi+0x447/0x990
  10594. +[ 7.976667] [<ffffffff81c5fb85>] rt2x00lib_rxdone+0x305/0xbd0
  10595. +[ 7.976670] [<ffffffff811ac23f>] ? dequeue_task_fair+0x64f/0x1de0
  10596. +[ 7.976674] [<ffffffff811a1516>] ? sched_clock_cpu+0xe6/0x150
  10597. +[ 7.976678] [<ffffffff81c6c45c>] rt2x00usb_work_rxdone+0x7c/0x140
  10598. +[ 7.976682] [<ffffffff8117aef6>] process_one_work+0x226/0x860
  10599. +[ 7.976686] [<ffffffff8117b58c>] worker_thread+0x5c/0x680
  10600. +[ 7.976690] [<ffffffff8117b530>] ? process_one_work+0x860/0x860
  10601. +[ 7.976693] [<ffffffff81184f86>] kthread+0xf6/0x150
  10602. +[ 7.976697] [<ffffffff81184e90>] ? kthread_worker_fn+0x310/0x310
  10603. +[ 7.976700] [<ffffffff822a94df>] ret_from_fork+0x3f/0x70
  10604. +[ 7.976703] [<ffffffff81184e90>] ? kthread_worker_fn+0x310/0x310
  10605. +
  10606. +Link: https://lkml.org/lkml/2016/1/26/230
  10607. +Signed-off-by: Chris Bainbridge <chris.bainbridge@gmail.com>
  10608. +---
  10609. +
  10610. +--- a/net/mac80211/agg-rx.c
  10611. ++++ b/net/mac80211/agg-rx.c
  10612. +@@ -327,7 +327,7 @@ void __ieee80211_start_rx_ba_session(str
  10613. + }
  10614. +
  10615. + /* prepare A-MPDU MLME for Rx aggregation */
  10616. +- tid_agg_rx = kmalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL);
  10617. ++ tid_agg_rx = kzalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL);
  10618. + if (!tid_agg_rx)
  10619. + goto end;
  10620. +
  10621. 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
  10622. deleted file mode 100644
  10623. index e005fe7..0000000
  10624. --- a/package/kernel/mac80211/patches/317-brcmfmac-Fix-race-condition-in-msgbuf-ioctl-processi.patch
  10625. +++ /dev/null
  10626. @@ -1,35 +0,0 @@
  10627. -From: Hante Meuleman <meuleman@broadcom.com>
  10628. -Date: Fri, 6 Mar 2015 18:40:41 +0100
  10629. -Subject: [PATCH] brcmfmac: Fix race condition in msgbuf ioctl processing.
  10630. -
  10631. -Msgbuf is using a wait_event_timeout to wait for the response on
  10632. -an ioctl. The wakeup routine uses waitqueue_active to see if
  10633. -wait_event_timeout has been called. There is a chance that the
  10634. -response arrives before wait_event_timeout is called, this
  10635. -will result in situation that wait_event_timeout never gets
  10636. -woken again and assumed result will be a timeout. This patch
  10637. -removes that errornous situation by always setting the
  10638. -ctl_completed var before checking for queue active.
  10639. -
  10640. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  10641. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10642. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  10643. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10644. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10645. ----
  10646. -
  10647. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  10648. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  10649. -@@ -481,10 +481,9 @@ static int brcmf_msgbuf_ioctl_resp_wait(
  10650. -
  10651. - static void brcmf_msgbuf_ioctl_resp_wake(struct brcmf_msgbuf *msgbuf)
  10652. - {
  10653. -- if (waitqueue_active(&msgbuf->ioctl_resp_wait)) {
  10654. -- msgbuf->ctl_completed = true;
  10655. -+ msgbuf->ctl_completed = true;
  10656. -+ if (waitqueue_active(&msgbuf->ioctl_resp_wait))
  10657. - wake_up(&msgbuf->ioctl_resp_wait);
  10658. -- }
  10659. - }
  10660. -
  10661. -
  10662. 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
  10663. new file mode 100644
  10664. index 0000000..5bf53b9
  10665. --- /dev/null
  10666. +++ b/package/kernel/mac80211/patches/317-mac80211-minstrel_ht-fix-out-of-bound-in-minstrel_ht.patch
  10667. @@ -0,0 +1,45 @@
  10668. +From: Konstantin Khlebnikov <koct9i@gmail.com>
  10669. +Date: Fri, 29 Jan 2016 11:35:12 +0300
  10670. +Subject: [PATCH] mac80211: minstrel_ht: fix out-of-bound in
  10671. + minstrel_ht_set_best_prob_rate
  10672. +
  10673. +Patch fixes this splat
  10674. +
  10675. +BUG: KASAN: slab-out-of-bounds in minstrel_ht_update_stats.isra.7+0x6e1/0x9e0
  10676. +[mac80211] at addr ffff8800cee640f4 Read of size 4 by task swapper/3/0
  10677. +
  10678. +Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
  10679. +Link: http://lkml.kernel.org/r/CALYGNiNyJhSaVnE35qS6UCGaSb2Dx1_i5HcRavuOX14oTz2P+w@mail.gmail.com
  10680. +---
  10681. +
  10682. +--- a/net/mac80211/rc80211_minstrel_ht.c
  10683. ++++ b/net/mac80211/rc80211_minstrel_ht.c
  10684. +@@ -414,15 +414,16 @@ minstrel_ht_set_best_prob_rate(struct mi
  10685. + (max_tp_group != MINSTREL_CCK_GROUP))
  10686. + return;
  10687. +
  10688. ++ max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES;
  10689. ++ max_gpr_idx = mg->max_group_prob_rate % MCS_GROUP_RATES;
  10690. ++ max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_ewma;
  10691. ++
  10692. + if (mrs->prob_ewma > MINSTREL_FRAC(75, 100)) {
  10693. + cur_tp_avg = minstrel_ht_get_tp_avg(mi, cur_group, cur_idx,
  10694. + mrs->prob_ewma);
  10695. + if (cur_tp_avg > tmp_tp_avg)
  10696. + mi->max_prob_rate = index;
  10697. +
  10698. +- max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES;
  10699. +- max_gpr_idx = mg->max_group_prob_rate % MCS_GROUP_RATES;
  10700. +- max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_ewma;
  10701. + max_gpr_tp_avg = minstrel_ht_get_tp_avg(mi, max_gpr_group,
  10702. + max_gpr_idx,
  10703. + max_gpr_prob);
  10704. +@@ -431,7 +432,7 @@ minstrel_ht_set_best_prob_rate(struct mi
  10705. + } else {
  10706. + if (mrs->prob_ewma > tmp_prob)
  10707. + mi->max_prob_rate = index;
  10708. +- if (mrs->prob_ewma > mg->rates[mg->max_group_prob_rate].prob_ewma)
  10709. ++ if (mrs->prob_ewma > max_gpr_prob)
  10710. + mg->max_group_prob_rate = index;
  10711. + }
  10712. + }
  10713. 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
  10714. deleted file mode 100644
  10715. index c2cd1c5..0000000
  10716. --- a/package/kernel/mac80211/patches/318-brcmfmac-Update-msgbuf-commonring-size-for-improved-.patch
  10717. +++ /dev/null
  10718. @@ -1,30 +0,0 @@
  10719. -From: Hante Meuleman <meuleman@broadcom.com>
  10720. -Date: Wed, 18 Mar 2015 13:25:23 +0100
  10721. -Subject: [PATCH] brcmfmac: Update msgbuf commonring size for improved
  10722. - throughput.
  10723. -
  10724. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  10725. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10726. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  10727. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10728. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10729. ----
  10730. -
  10731. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h
  10732. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h
  10733. -@@ -17,11 +17,11 @@
  10734. -
  10735. - #ifdef CPTCFG_BRCMFMAC_PROTO_MSGBUF
  10736. -
  10737. --#define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_MAX_ITEM 20
  10738. --#define BRCMF_H2D_MSGRING_RXPOST_SUBMIT_MAX_ITEM 256
  10739. --#define BRCMF_D2H_MSGRING_CONTROL_COMPLETE_MAX_ITEM 20
  10740. -+#define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_MAX_ITEM 64
  10741. -+#define BRCMF_H2D_MSGRING_RXPOST_SUBMIT_MAX_ITEM 512
  10742. -+#define BRCMF_D2H_MSGRING_CONTROL_COMPLETE_MAX_ITEM 64
  10743. - #define BRCMF_D2H_MSGRING_TX_COMPLETE_MAX_ITEM 1024
  10744. --#define BRCMF_D2H_MSGRING_RX_COMPLETE_MAX_ITEM 256
  10745. -+#define BRCMF_D2H_MSGRING_RX_COMPLETE_MAX_ITEM 512
  10746. - #define BRCMF_H2D_TXFLOWRING_MAX_ITEM 512
  10747. -
  10748. - #define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_ITEMSIZE 40
  10749. 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
  10750. new file mode 100644
  10751. index 0000000..655dc4b
  10752. --- /dev/null
  10753. +++ b/package/kernel/mac80211/patches/318-mac80211-move-A-MSDU-skb_linearize-call-to-ieee80211.patch
  10754. @@ -0,0 +1,35 @@
  10755. +From: Felix Fietkau <nbd@openwrt.org>
  10756. +Date: Tue, 2 Feb 2016 14:39:08 +0100
  10757. +Subject: [PATCH] mac80211: move A-MSDU skb_linearize call to
  10758. + ieee80211_amsdu_to_8023s
  10759. +
  10760. +Prepararation for zero-copy A-MSDU support with page fragment SKBs
  10761. +
  10762. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  10763. +Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  10764. +---
  10765. +
  10766. +--- a/net/mac80211/rx.c
  10767. ++++ b/net/mac80211/rx.c
  10768. +@@ -2203,9 +2203,6 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx
  10769. + skb->dev = dev;
  10770. + __skb_queue_head_init(&frame_list);
  10771. +
  10772. +- if (skb_linearize(skb))
  10773. +- return RX_DROP_UNUSABLE;
  10774. +-
  10775. + ieee80211_amsdu_to_8023s(skb, &frame_list, dev->dev_addr,
  10776. + rx->sdata->vif.type,
  10777. + rx->local->hw.extra_tx_headroom, true);
  10778. +--- a/net/wireless/util.c
  10779. ++++ b/net/wireless/util.c
  10780. +@@ -657,6 +657,9 @@ void ieee80211_amsdu_to_8023s(struct sk_
  10781. + int remaining, err;
  10782. + u8 dst[ETH_ALEN], src[ETH_ALEN];
  10783. +
  10784. ++ if (skb_linearize(skb))
  10785. ++ goto out;
  10786. ++
  10787. + if (has_80211_header) {
  10788. + err = ieee80211_data_to_8023(skb, addr, iftype);
  10789. + if (err)
  10790. 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
  10791. deleted file mode 100644
  10792. index 6af69eb..0000000
  10793. --- a/package/kernel/mac80211/patches/319-ath9k_htc-add-new-WMI_REG_RMW_CMDID-command.patch
  10794. +++ /dev/null
  10795. @@ -1,307 +0,0 @@
  10796. -From: Oleksij Rempel <linux@rempel-privat.de>
  10797. -Date: Sun, 22 Mar 2015 19:29:46 +0100
  10798. -Subject: [PATCH] ath9k_htc: add new WMI_REG_RMW_CMDID command
  10799. -
  10800. -Since usb bus add extra delay on each request, a command
  10801. -with read + write requests is too expensive. We can dramtically
  10802. -reduce usb load by moving this command to firmware.
  10803. -
  10804. -In my tests, this patch will reduce channel scan time
  10805. -for about 5-10 seconds.
  10806. -
  10807. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  10808. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10809. ----
  10810. -
  10811. ---- a/drivers/net/wireless/ath/ath.h
  10812. -+++ b/drivers/net/wireless/ath/ath.h
  10813. -@@ -131,6 +131,9 @@ struct ath_ops {
  10814. - void (*enable_write_buffer)(void *);
  10815. - void (*write_flush) (void *);
  10816. - u32 (*rmw)(void *, u32 reg_offset, u32 set, u32 clr);
  10817. -+ void (*enable_rmw_buffer)(void *);
  10818. -+ void (*rmw_flush) (void *);
  10819. -+
  10820. - };
  10821. -
  10822. - struct ath_common;
  10823. ---- a/drivers/net/wireless/ath/ath9k/htc.h
  10824. -+++ b/drivers/net/wireless/ath/ath9k/htc.h
  10825. -@@ -444,6 +444,10 @@ static inline void ath9k_htc_stop_btcoex
  10826. - #define OP_BT_SCAN BIT(4)
  10827. - #define OP_TSF_RESET BIT(6)
  10828. -
  10829. -+enum htc_op_flags {
  10830. -+ HTC_FWFLAG_NO_RMW,
  10831. -+};
  10832. -+
  10833. - struct ath9k_htc_priv {
  10834. - struct device *dev;
  10835. - struct ieee80211_hw *hw;
  10836. -@@ -482,6 +486,7 @@ struct ath9k_htc_priv {
  10837. - bool reconfig_beacon;
  10838. - unsigned int rxfilter;
  10839. - unsigned long op_flags;
  10840. -+ unsigned long fw_flags;
  10841. -
  10842. - struct ath9k_hw_cal_data caldata;
  10843. - struct ath_spec_scan_priv spec_priv;
  10844. ---- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
  10845. -+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
  10846. -@@ -376,17 +376,139 @@ static void ath9k_regwrite_flush(void *h
  10847. - mutex_unlock(&priv->wmi->multi_write_mutex);
  10848. - }
  10849. -
  10850. --static u32 ath9k_reg_rmw(void *hw_priv, u32 reg_offset, u32 set, u32 clr)
  10851. -+static void ath9k_reg_rmw_buffer(void *hw_priv,
  10852. -+ u32 reg_offset, u32 set, u32 clr)
  10853. -+{
  10854. -+ struct ath_hw *ah = (struct ath_hw *) hw_priv;
  10855. -+ struct ath_common *common = ath9k_hw_common(ah);
  10856. -+ struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
  10857. -+ u32 rsp_status;
  10858. -+ int r;
  10859. -+
  10860. -+ mutex_lock(&priv->wmi->multi_rmw_mutex);
  10861. -+
  10862. -+ /* Store the register/value */
  10863. -+ priv->wmi->multi_rmw[priv->wmi->multi_rmw_idx].reg =
  10864. -+ cpu_to_be32(reg_offset);
  10865. -+ priv->wmi->multi_rmw[priv->wmi->multi_rmw_idx].set =
  10866. -+ cpu_to_be32(set);
  10867. -+ priv->wmi->multi_rmw[priv->wmi->multi_rmw_idx].clr =
  10868. -+ cpu_to_be32(clr);
  10869. -+
  10870. -+ priv->wmi->multi_rmw_idx++;
  10871. -+
  10872. -+ /* If the buffer is full, send it out. */
  10873. -+ if (priv->wmi->multi_rmw_idx == MAX_RMW_CMD_NUMBER) {
  10874. -+ r = ath9k_wmi_cmd(priv->wmi, WMI_REG_RMW_CMDID,
  10875. -+ (u8 *) &priv->wmi->multi_rmw,
  10876. -+ sizeof(struct register_write) * priv->wmi->multi_rmw_idx,
  10877. -+ (u8 *) &rsp_status, sizeof(rsp_status),
  10878. -+ 100);
  10879. -+ if (unlikely(r)) {
  10880. -+ ath_dbg(common, WMI,
  10881. -+ "REGISTER RMW FAILED, multi len: %d\n",
  10882. -+ priv->wmi->multi_rmw_idx);
  10883. -+ }
  10884. -+ priv->wmi->multi_rmw_idx = 0;
  10885. -+ }
  10886. -+
  10887. -+ mutex_unlock(&priv->wmi->multi_rmw_mutex);
  10888. -+}
  10889. -+
  10890. -+static void ath9k_reg_rmw_flush(void *hw_priv)
  10891. - {
  10892. -- u32 val;
  10893. -+ struct ath_hw *ah = (struct ath_hw *) hw_priv;
  10894. -+ struct ath_common *common = ath9k_hw_common(ah);
  10895. -+ struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
  10896. -+ u32 rsp_status;
  10897. -+ int r;
  10898. -+
  10899. -+ if (test_bit(HTC_FWFLAG_NO_RMW, &priv->fw_flags))
  10900. -+ return;
  10901. -+
  10902. -+ atomic_dec(&priv->wmi->m_rmw_cnt);
  10903. -+
  10904. -+ mutex_lock(&priv->wmi->multi_rmw_mutex);
  10905. -+
  10906. -+ if (priv->wmi->multi_rmw_idx) {
  10907. -+ r = ath9k_wmi_cmd(priv->wmi, WMI_REG_RMW_CMDID,
  10908. -+ (u8 *) &priv->wmi->multi_rmw,
  10909. -+ sizeof(struct register_rmw) * priv->wmi->multi_rmw_idx,
  10910. -+ (u8 *) &rsp_status, sizeof(rsp_status),
  10911. -+ 100);
  10912. -+ if (unlikely(r)) {
  10913. -+ ath_dbg(common, WMI,
  10914. -+ "REGISTER RMW FAILED, multi len: %d\n",
  10915. -+ priv->wmi->multi_rmw_idx);
  10916. -+ }
  10917. -+ priv->wmi->multi_rmw_idx = 0;
  10918. -+ }
  10919. -
  10920. -- val = ath9k_regread(hw_priv, reg_offset);
  10921. -- val &= ~clr;
  10922. -- val |= set;
  10923. -- ath9k_regwrite(hw_priv, val, reg_offset);
  10924. -+ mutex_unlock(&priv->wmi->multi_rmw_mutex);
  10925. -+}
  10926. -+
  10927. -+static void ath9k_enable_rmw_buffer(void *hw_priv)
  10928. -+{
  10929. -+ struct ath_hw *ah = (struct ath_hw *) hw_priv;
  10930. -+ struct ath_common *common = ath9k_hw_common(ah);
  10931. -+ struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
  10932. -+
  10933. -+ if (test_bit(HTC_FWFLAG_NO_RMW, &priv->fw_flags))
  10934. -+ return;
  10935. -+
  10936. -+ atomic_inc(&priv->wmi->m_rmw_cnt);
  10937. -+}
  10938. -+
  10939. -+static u32 ath9k_reg_rmw_single(void *hw_priv,
  10940. -+ u32 reg_offset, u32 set, u32 clr)
  10941. -+{
  10942. -+ struct ath_hw *ah = (struct ath_hw *) hw_priv;
  10943. -+ struct ath_common *common = ath9k_hw_common(ah);
  10944. -+ struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
  10945. -+ struct register_rmw buf, buf_ret;
  10946. -+ int ret;
  10947. -+ u32 val = 0;
  10948. -+
  10949. -+ buf.reg = cpu_to_be32(reg_offset);
  10950. -+ buf.set = cpu_to_be32(set);
  10951. -+ buf.clr = cpu_to_be32(clr);
  10952. -+
  10953. -+ ret = ath9k_wmi_cmd(priv->wmi, WMI_REG_RMW_CMDID,
  10954. -+ (u8 *) &buf, sizeof(buf),
  10955. -+ (u8 *) &buf_ret, sizeof(buf_ret),
  10956. -+ 100);
  10957. -+ if (unlikely(ret)) {
  10958. -+ ath_dbg(common, WMI, "REGISTER RMW FAILED:(0x%04x, %d)\n",
  10959. -+ reg_offset, ret);
  10960. -+ }
  10961. - return val;
  10962. - }
  10963. -
  10964. -+static u32 ath9k_reg_rmw(void *hw_priv, u32 reg_offset, u32 set, u32 clr)
  10965. -+{
  10966. -+ struct ath_hw *ah = (struct ath_hw *) hw_priv;
  10967. -+ struct ath_common *common = ath9k_hw_common(ah);
  10968. -+ struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
  10969. -+
  10970. -+ if (test_bit(HTC_FWFLAG_NO_RMW, &priv->fw_flags)) {
  10971. -+ u32 val;
  10972. -+
  10973. -+ val = REG_READ(ah, reg_offset);
  10974. -+ val &= ~clr;
  10975. -+ val |= set;
  10976. -+ REG_WRITE(ah, reg_offset, val);
  10977. -+
  10978. -+ return 0;
  10979. -+ }
  10980. -+
  10981. -+ if (atomic_read(&priv->wmi->m_rmw_cnt))
  10982. -+ ath9k_reg_rmw_buffer(hw_priv, reg_offset, set, clr);
  10983. -+ else
  10984. -+ ath9k_reg_rmw_single(hw_priv, reg_offset, set, clr);
  10985. -+
  10986. -+ return 0;
  10987. -+}
  10988. -+
  10989. - static void ath_usb_read_cachesize(struct ath_common *common, int *csz)
  10990. - {
  10991. - *csz = L1_CACHE_BYTES >> 2;
  10992. -@@ -501,6 +623,8 @@ static int ath9k_init_priv(struct ath9k_
  10993. - ah->reg_ops.write = ath9k_regwrite;
  10994. - ah->reg_ops.enable_write_buffer = ath9k_enable_regwrite_buffer;
  10995. - ah->reg_ops.write_flush = ath9k_regwrite_flush;
  10996. -+ ah->reg_ops.enable_rmw_buffer = ath9k_enable_rmw_buffer;
  10997. -+ ah->reg_ops.rmw_flush = ath9k_reg_rmw_flush;
  10998. - ah->reg_ops.rmw = ath9k_reg_rmw;
  10999. - priv->ah = ah;
  11000. -
  11001. -@@ -686,6 +810,12 @@ static int ath9k_init_firmware_version(s
  11002. - return -EINVAL;
  11003. - }
  11004. -
  11005. -+ if (priv->fw_version_major == 1 && priv->fw_version_minor < 4)
  11006. -+ set_bit(HTC_FWFLAG_NO_RMW, &priv->fw_flags);
  11007. -+
  11008. -+ dev_info(priv->dev, "FW RMW support: %s\n",
  11009. -+ test_bit(HTC_FWFLAG_NO_RMW, &priv->fw_flags) ? "Off" : "On");
  11010. -+
  11011. - return 0;
  11012. - }
  11013. -
  11014. ---- a/drivers/net/wireless/ath/ath9k/hw.h
  11015. -+++ b/drivers/net/wireless/ath/ath9k/hw.h
  11016. -@@ -100,6 +100,18 @@
  11017. - (_ah)->reg_ops.write_flush((_ah)); \
  11018. - } while (0)
  11019. -
  11020. -+#define ENABLE_REG_RMW_BUFFER(_ah) \
  11021. -+ do { \
  11022. -+ if ((_ah)->reg_ops.enable_rmw_buffer) \
  11023. -+ (_ah)->reg_ops.enable_rmw_buffer((_ah)); \
  11024. -+ } while (0)
  11025. -+
  11026. -+#define REG_RMW_BUFFER_FLUSH(_ah) \
  11027. -+ do { \
  11028. -+ if ((_ah)->reg_ops.rmw_flush) \
  11029. -+ (_ah)->reg_ops.rmw_flush((_ah)); \
  11030. -+ } while (0)
  11031. -+
  11032. - #define PR_EEP(_s, _val) \
  11033. - do { \
  11034. - len += scnprintf(buf + len, size - len, "%20s : %10d\n",\
  11035. ---- a/drivers/net/wireless/ath/ath9k/wmi.c
  11036. -+++ b/drivers/net/wireless/ath/ath9k/wmi.c
  11037. -@@ -61,6 +61,8 @@ static const char *wmi_cmd_to_name(enum
  11038. - return "WMI_REG_READ_CMDID";
  11039. - case WMI_REG_WRITE_CMDID:
  11040. - return "WMI_REG_WRITE_CMDID";
  11041. -+ case WMI_REG_RMW_CMDID:
  11042. -+ return "WMI_REG_RMW_CMDID";
  11043. - case WMI_RC_STATE_CHANGE_CMDID:
  11044. - return "WMI_RC_STATE_CHANGE_CMDID";
  11045. - case WMI_RC_RATE_UPDATE_CMDID:
  11046. -@@ -101,6 +103,7 @@ struct wmi *ath9k_init_wmi(struct ath9k_
  11047. - spin_lock_init(&wmi->event_lock);
  11048. - mutex_init(&wmi->op_mutex);
  11049. - mutex_init(&wmi->multi_write_mutex);
  11050. -+ mutex_init(&wmi->multi_rmw_mutex);
  11051. - init_completion(&wmi->cmd_wait);
  11052. - INIT_LIST_HEAD(&wmi->pending_tx_events);
  11053. - tasklet_init(&wmi->wmi_event_tasklet, ath9k_wmi_event_tasklet,
  11054. ---- a/drivers/net/wireless/ath/ath9k/wmi.h
  11055. -+++ b/drivers/net/wireless/ath/ath9k/wmi.h
  11056. -@@ -112,6 +112,7 @@ enum wmi_cmd_id {
  11057. - WMI_TX_STATS_CMDID,
  11058. - WMI_RX_STATS_CMDID,
  11059. - WMI_BITRATE_MASK_CMDID,
  11060. -+ WMI_REG_RMW_CMDID,
  11061. - };
  11062. -
  11063. - enum wmi_event_id {
  11064. -@@ -125,12 +126,19 @@ enum wmi_event_id {
  11065. - };
  11066. -
  11067. - #define MAX_CMD_NUMBER 62
  11068. -+#define MAX_RMW_CMD_NUMBER 15
  11069. -
  11070. - struct register_write {
  11071. - __be32 reg;
  11072. - __be32 val;
  11073. - };
  11074. -
  11075. -+struct register_rmw {
  11076. -+ __be32 reg;
  11077. -+ __be32 set;
  11078. -+ __be32 clr;
  11079. -+} __packed;
  11080. -+
  11081. - struct ath9k_htc_tx_event {
  11082. - int count;
  11083. - struct __wmi_event_txstatus txs;
  11084. -@@ -156,10 +164,18 @@ struct wmi {
  11085. -
  11086. - spinlock_t wmi_lock;
  11087. -
  11088. -+ /* multi write section */
  11089. - atomic_t mwrite_cnt;
  11090. - struct register_write multi_write[MAX_CMD_NUMBER];
  11091. - u32 multi_write_idx;
  11092. - struct mutex multi_write_mutex;
  11093. -+
  11094. -+ /* multi rmw section */
  11095. -+ atomic_t m_rmw_cnt;
  11096. -+ struct register_rmw multi_rmw[MAX_RMW_CMD_NUMBER];
  11097. -+ u32 multi_rmw_idx;
  11098. -+ struct mutex multi_rmw_mutex;
  11099. -+
  11100. - };
  11101. -
  11102. - struct wmi *ath9k_init_wmi(struct ath9k_htc_priv *priv);
  11103. 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
  11104. new file mode 100644
  11105. index 0000000..b646ab3
  11106. --- /dev/null
  11107. +++ b/package/kernel/mac80211/patches/319-cfg80211-add-function-for-802.3-conversion-with-sepa.patch
  11108. @@ -0,0 +1,186 @@
  11109. +From: Felix Fietkau <nbd@openwrt.org>
  11110. +Date: Tue, 2 Feb 2016 14:39:09 +0100
  11111. +Subject: [PATCH] cfg80211: add function for 802.3 conversion with separate
  11112. + output buffer
  11113. +
  11114. +Use skb_copy_bits in preparation for allowing fragmented skbs
  11115. +
  11116. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  11117. +Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  11118. +---
  11119. +
  11120. +--- a/net/wireless/util.c
  11121. ++++ b/net/wireless/util.c
  11122. +@@ -393,9 +393,9 @@ unsigned int ieee80211_get_hdrlen_from_s
  11123. + }
  11124. + EXPORT_SYMBOL(ieee80211_get_hdrlen_from_skb);
  11125. +
  11126. +-unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
  11127. ++static unsigned int __ieee80211_get_mesh_hdrlen(u8 flags)
  11128. + {
  11129. +- int ae = meshhdr->flags & MESH_FLAGS_AE;
  11130. ++ int ae = flags & MESH_FLAGS_AE;
  11131. + /* 802.11-2012, 8.2.4.7.3 */
  11132. + switch (ae) {
  11133. + default:
  11134. +@@ -407,21 +407,31 @@ unsigned int ieee80211_get_mesh_hdrlen(s
  11135. + return 18;
  11136. + }
  11137. + }
  11138. ++
  11139. ++unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
  11140. ++{
  11141. ++ return __ieee80211_get_mesh_hdrlen(meshhdr->flags);
  11142. ++}
  11143. + EXPORT_SYMBOL(ieee80211_get_mesh_hdrlen);
  11144. +
  11145. +-int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
  11146. +- enum nl80211_iftype iftype)
  11147. ++static int __ieee80211_data_to_8023(struct sk_buff *skb, struct ethhdr *ehdr,
  11148. ++ const u8 *addr, enum nl80211_iftype iftype)
  11149. + {
  11150. + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  11151. +- u16 hdrlen, ethertype;
  11152. +- u8 *payload;
  11153. +- u8 dst[ETH_ALEN];
  11154. +- u8 src[ETH_ALEN] __aligned(2);
  11155. ++ struct {
  11156. ++ u8 hdr[ETH_ALEN] __aligned(2);
  11157. ++ __be16 proto;
  11158. ++ } payload;
  11159. ++ struct ethhdr tmp;
  11160. ++ u16 hdrlen;
  11161. ++ u8 mesh_flags = 0;
  11162. +
  11163. + if (unlikely(!ieee80211_is_data_present(hdr->frame_control)))
  11164. + return -1;
  11165. +
  11166. + hdrlen = ieee80211_hdrlen(hdr->frame_control);
  11167. ++ if (skb->len < hdrlen + 8)
  11168. ++ return -1;
  11169. +
  11170. + /* convert IEEE 802.11 header + possible LLC headers into Ethernet
  11171. + * header
  11172. +@@ -432,8 +442,11 @@ int ieee80211_data_to_8023(struct sk_buf
  11173. + * 1 0 BSSID SA DA n/a
  11174. + * 1 1 RA TA DA SA
  11175. + */
  11176. +- memcpy(dst, ieee80211_get_DA(hdr), ETH_ALEN);
  11177. +- memcpy(src, ieee80211_get_SA(hdr), ETH_ALEN);
  11178. ++ memcpy(tmp.h_dest, ieee80211_get_DA(hdr), ETH_ALEN);
  11179. ++ memcpy(tmp.h_source, ieee80211_get_SA(hdr), ETH_ALEN);
  11180. ++
  11181. ++ if (iftype == NL80211_IFTYPE_MESH_POINT)
  11182. ++ skb_copy_bits(skb, hdrlen, &mesh_flags, 1);
  11183. +
  11184. + switch (hdr->frame_control &
  11185. + cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) {
  11186. +@@ -450,44 +463,31 @@ int ieee80211_data_to_8023(struct sk_buf
  11187. + iftype != NL80211_IFTYPE_STATION))
  11188. + return -1;
  11189. + if (iftype == NL80211_IFTYPE_MESH_POINT) {
  11190. +- struct ieee80211s_hdr *meshdr =
  11191. +- (struct ieee80211s_hdr *) (skb->data + hdrlen);
  11192. +- /* make sure meshdr->flags is on the linear part */
  11193. +- if (!pskb_may_pull(skb, hdrlen + 1))
  11194. +- return -1;
  11195. +- if (meshdr->flags & MESH_FLAGS_AE_A4)
  11196. ++ if (mesh_flags & MESH_FLAGS_AE_A4)
  11197. + return -1;
  11198. +- if (meshdr->flags & MESH_FLAGS_AE_A5_A6) {
  11199. ++ if (mesh_flags & MESH_FLAGS_AE_A5_A6) {
  11200. + skb_copy_bits(skb, hdrlen +
  11201. + offsetof(struct ieee80211s_hdr, eaddr1),
  11202. +- dst, ETH_ALEN);
  11203. +- skb_copy_bits(skb, hdrlen +
  11204. +- offsetof(struct ieee80211s_hdr, eaddr2),
  11205. +- src, ETH_ALEN);
  11206. ++ tmp.h_dest, 2 * ETH_ALEN);
  11207. + }
  11208. +- hdrlen += ieee80211_get_mesh_hdrlen(meshdr);
  11209. ++ hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags);
  11210. + }
  11211. + break;
  11212. + case cpu_to_le16(IEEE80211_FCTL_FROMDS):
  11213. + if ((iftype != NL80211_IFTYPE_STATION &&
  11214. + iftype != NL80211_IFTYPE_P2P_CLIENT &&
  11215. + iftype != NL80211_IFTYPE_MESH_POINT) ||
  11216. +- (is_multicast_ether_addr(dst) &&
  11217. +- ether_addr_equal(src, addr)))
  11218. ++ (is_multicast_ether_addr(tmp.h_dest) &&
  11219. ++ ether_addr_equal(tmp.h_source, addr)))
  11220. + return -1;
  11221. + if (iftype == NL80211_IFTYPE_MESH_POINT) {
  11222. +- struct ieee80211s_hdr *meshdr =
  11223. +- (struct ieee80211s_hdr *) (skb->data + hdrlen);
  11224. +- /* make sure meshdr->flags is on the linear part */
  11225. +- if (!pskb_may_pull(skb, hdrlen + 1))
  11226. +- return -1;
  11227. +- if (meshdr->flags & MESH_FLAGS_AE_A5_A6)
  11228. ++ if (mesh_flags & MESH_FLAGS_AE_A5_A6)
  11229. + return -1;
  11230. +- if (meshdr->flags & MESH_FLAGS_AE_A4)
  11231. ++ if (mesh_flags & MESH_FLAGS_AE_A4)
  11232. + skb_copy_bits(skb, hdrlen +
  11233. + offsetof(struct ieee80211s_hdr, eaddr1),
  11234. +- src, ETH_ALEN);
  11235. +- hdrlen += ieee80211_get_mesh_hdrlen(meshdr);
  11236. ++ tmp.h_source, ETH_ALEN);
  11237. ++ hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags);
  11238. + }
  11239. + break;
  11240. + case cpu_to_le16(0):
  11241. +@@ -498,33 +498,33 @@ int ieee80211_data_to_8023(struct sk_buf
  11242. + break;
  11243. + }
  11244. +
  11245. +- if (!pskb_may_pull(skb, hdrlen + 8))
  11246. +- return -1;
  11247. +-
  11248. +- payload = skb->data + hdrlen;
  11249. +- ethertype = (payload[6] << 8) | payload[7];
  11250. ++ skb_copy_bits(skb, hdrlen, &payload, sizeof(payload));
  11251. ++ tmp.h_proto = payload.proto;
  11252. +
  11253. +- if (likely((ether_addr_equal(payload, rfc1042_header) &&
  11254. +- ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) ||
  11255. +- ether_addr_equal(payload, bridge_tunnel_header))) {
  11256. ++ if (likely((ether_addr_equal(payload.hdr, rfc1042_header) &&
  11257. ++ tmp.h_proto != htons(ETH_P_AARP) &&
  11258. ++ tmp.h_proto != htons(ETH_P_IPX)) ||
  11259. ++ ether_addr_equal(payload.hdr, bridge_tunnel_header)))
  11260. + /* remove RFC1042 or Bridge-Tunnel encapsulation and
  11261. + * replace EtherType */
  11262. +- skb_pull(skb, hdrlen + 6);
  11263. +- memcpy(skb_push(skb, ETH_ALEN), src, ETH_ALEN);
  11264. +- memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN);
  11265. +- } else {
  11266. +- struct ethhdr *ehdr;
  11267. +- __be16 len;
  11268. ++ hdrlen += ETH_ALEN + 2;
  11269. ++ else
  11270. ++ tmp.h_proto = htons(skb->len);
  11271. +
  11272. +- skb_pull(skb, hdrlen);
  11273. +- len = htons(skb->len);
  11274. ++ pskb_pull(skb, hdrlen);
  11275. ++
  11276. ++ if (!ehdr)
  11277. + ehdr = (struct ethhdr *) skb_push(skb, sizeof(struct ethhdr));
  11278. +- memcpy(ehdr->h_dest, dst, ETH_ALEN);
  11279. +- memcpy(ehdr->h_source, src, ETH_ALEN);
  11280. +- ehdr->h_proto = len;
  11281. +- }
  11282. ++ memcpy(ehdr, &tmp, sizeof(tmp));
  11283. ++
  11284. + return 0;
  11285. + }
  11286. ++
  11287. ++int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
  11288. ++ enum nl80211_iftype iftype)
  11289. ++{
  11290. ++ return __ieee80211_data_to_8023(skb, NULL, addr, iftype);
  11291. ++}
  11292. + EXPORT_SYMBOL(ieee80211_data_to_8023);
  11293. +
  11294. + int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr,
  11295. 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
  11296. deleted file mode 100644
  11297. index c4dd1af..0000000
  11298. --- a/package/kernel/mac80211/patches/320-ath9k-ar9271_hw_pa_cal-use-defs-instead-of-magin-num.patch
  11299. +++ /dev/null
  11300. @@ -1,89 +0,0 @@
  11301. -From: Oleksij Rempel <linux@rempel-privat.de>
  11302. -Date: Sun, 22 Mar 2015 19:29:47 +0100
  11303. -Subject: [PATCH] ath9k: ar9271_hw_pa_cal - use defs instead of magin
  11304. - numbers
  11305. -
  11306. -This function uses mixed styles for register names/numbers which
  11307. -is make harder reading and optimisation.
  11308. -
  11309. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  11310. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11311. ----
  11312. -
  11313. ---- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  11314. -+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  11315. -@@ -430,22 +430,22 @@ static void ar9271_hw_pa_cal(struct ath_
  11316. - u32 regVal;
  11317. - unsigned int i;
  11318. - u32 regList[][2] = {
  11319. -- { 0x786c, 0 },
  11320. -- { 0x7854, 0 },
  11321. -- { 0x7820, 0 },
  11322. -- { 0x7824, 0 },
  11323. -- { 0x7868, 0 },
  11324. -- { 0x783c, 0 },
  11325. -- { 0x7838, 0 } ,
  11326. -- { 0x7828, 0 } ,
  11327. -+ { AR9285_AN_TOP3, 0 },
  11328. -+ { AR9285_AN_RXTXBB1, 0 },
  11329. -+ { AR9285_AN_RF2G1, 0 },
  11330. -+ { AR9285_AN_RF2G2, 0 },
  11331. -+ { AR9285_AN_TOP2, 0 },
  11332. -+ { AR9285_AN_RF2G8, 0 },
  11333. -+ { AR9285_AN_RF2G7, 0 } ,
  11334. -+ { AR9285_AN_RF2G3, 0 } ,
  11335. - };
  11336. -
  11337. - for (i = 0; i < ARRAY_SIZE(regList); i++)
  11338. - regList[i][1] = REG_READ(ah, regList[i][0]);
  11339. -
  11340. -- regVal = REG_READ(ah, 0x7834);
  11341. -+ regVal = REG_READ(ah, AR9285_AN_RF2G6);
  11342. - regVal &= (~(0x1));
  11343. -- REG_WRITE(ah, 0x7834, regVal);
  11344. -+ REG_WRITE(ah, AR9285_AN_RF2G6, regVal);
  11345. - regVal = REG_READ(ah, 0x9808);
  11346. - regVal |= (0x1 << 27);
  11347. - REG_WRITE(ah, 0x9808, regVal);
  11348. -@@ -477,7 +477,7 @@ static void ar9271_hw_pa_cal(struct ath_
  11349. - * does not matter since we turn it off
  11350. - */
  11351. - REG_RMW_FIELD(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PADRVGN2TAB0, 0);
  11352. --
  11353. -+ /* 7828, b0-11, ccom=fff */
  11354. - REG_RMW_FIELD(ah, AR9285_AN_RF2G3, AR9271_AN_RF2G3_CCOMP, 0xfff);
  11355. -
  11356. - /* Set:
  11357. -@@ -490,15 +490,16 @@ static void ar9271_hw_pa_cal(struct ath_
  11358. -
  11359. - /* find off_6_1; */
  11360. - for (i = 6; i > 0; i--) {
  11361. -- regVal = REG_READ(ah, 0x7834);
  11362. -+ regVal = REG_READ(ah, AR9285_AN_RF2G6);
  11363. - regVal |= (1 << (20 + i));
  11364. -- REG_WRITE(ah, 0x7834, regVal);
  11365. -+ REG_WRITE(ah, AR9285_AN_RF2G6, regVal);
  11366. - udelay(1);
  11367. - /* regVal = REG_READ(ah, 0x7834); */
  11368. - regVal &= (~(0x1 << (20 + i)));
  11369. -- regVal |= (MS(REG_READ(ah, 0x7840), AR9285_AN_RXTXBB1_SPARE9)
  11370. -+ regVal |= (MS(REG_READ(ah, AR9285_AN_RF2G9),
  11371. -+ AR9285_AN_RXTXBB1_SPARE9)
  11372. - << (20 + i));
  11373. -- REG_WRITE(ah, 0x7834, regVal);
  11374. -+ REG_WRITE(ah, AR9285_AN_RF2G6, regVal);
  11375. - }
  11376. -
  11377. - regVal = (regVal >> 20) & 0x7f;
  11378. -@@ -517,9 +518,9 @@ static void ar9271_hw_pa_cal(struct ath_
  11379. -
  11380. - ENABLE_REGWRITE_BUFFER(ah);
  11381. -
  11382. -- regVal = REG_READ(ah, 0x7834);
  11383. -+ regVal = REG_READ(ah, AR_AN_RF2G1_CH1);
  11384. - regVal |= 0x1;
  11385. -- REG_WRITE(ah, 0x7834, regVal);
  11386. -+ REG_WRITE(ah, AR_AN_RF2G1_CH1, regVal);
  11387. - regVal = REG_READ(ah, 0x9808);
  11388. - regVal &= (~(0x1 << 27));
  11389. - REG_WRITE(ah, 0x9808, regVal);
  11390. 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
  11391. new file mode 100644
  11392. index 0000000..2eeed22
  11393. --- /dev/null
  11394. +++ b/package/kernel/mac80211/patches/320-cfg80211-add-support-for-non-linear-skbs-in-ieee8021.patch
  11395. @@ -0,0 +1,159 @@
  11396. +From: Felix Fietkau <nbd@openwrt.org>
  11397. +Date: Tue, 2 Feb 2016 14:39:10 +0100
  11398. +Subject: [PATCH] cfg80211: add support for non-linear skbs in
  11399. + ieee80211_amsdu_to_8023s
  11400. +
  11401. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  11402. +Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  11403. +---
  11404. +
  11405. +--- a/net/wireless/util.c
  11406. ++++ b/net/wireless/util.c
  11407. +@@ -644,73 +644,75 @@ int ieee80211_data_from_8023(struct sk_b
  11408. + }
  11409. + EXPORT_SYMBOL(ieee80211_data_from_8023);
  11410. +
  11411. ++static struct sk_buff *
  11412. ++__ieee80211_amsdu_copy(struct sk_buff *skb, unsigned int hlen,
  11413. ++ int offset, int len)
  11414. ++{
  11415. ++ struct sk_buff *frame;
  11416. ++
  11417. ++ if (skb->len - offset < len)
  11418. ++ return NULL;
  11419. ++
  11420. ++ /*
  11421. ++ * Allocate and reserve two bytes more for payload
  11422. ++ * alignment since sizeof(struct ethhdr) is 14.
  11423. ++ */
  11424. ++ frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + len);
  11425. ++
  11426. ++ skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2);
  11427. ++ skb_copy_bits(skb, offset, skb_put(frame, len), len);
  11428. ++
  11429. ++ return frame;
  11430. ++}
  11431. +
  11432. + void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
  11433. + const u8 *addr, enum nl80211_iftype iftype,
  11434. + const unsigned int extra_headroom,
  11435. + bool has_80211_header)
  11436. + {
  11437. ++ unsigned int hlen = ALIGN(extra_headroom, 4);
  11438. + struct sk_buff *frame = NULL;
  11439. + u16 ethertype;
  11440. + u8 *payload;
  11441. +- const struct ethhdr *eth;
  11442. +- int remaining, err;
  11443. +- u8 dst[ETH_ALEN], src[ETH_ALEN];
  11444. +-
  11445. +- if (skb_linearize(skb))
  11446. +- goto out;
  11447. ++ int offset = 0, remaining, err;
  11448. ++ struct ethhdr eth;
  11449. ++ bool reuse_skb = true;
  11450. ++ bool last = false;
  11451. +
  11452. + if (has_80211_header) {
  11453. +- err = ieee80211_data_to_8023(skb, addr, iftype);
  11454. ++ err = __ieee80211_data_to_8023(skb, &eth, addr, iftype);
  11455. + if (err)
  11456. + goto out;
  11457. +-
  11458. +- /* skip the wrapping header */
  11459. +- eth = (struct ethhdr *) skb_pull(skb, sizeof(struct ethhdr));
  11460. +- if (!eth)
  11461. +- goto out;
  11462. +- } else {
  11463. +- eth = (struct ethhdr *) skb->data;
  11464. + }
  11465. +
  11466. +- while (skb != frame) {
  11467. ++ while (!last) {
  11468. ++ unsigned int subframe_len;
  11469. ++ int len;
  11470. + u8 padding;
  11471. +- __be16 len = eth->h_proto;
  11472. +- unsigned int subframe_len = sizeof(struct ethhdr) + ntohs(len);
  11473. +-
  11474. +- remaining = skb->len;
  11475. +- memcpy(dst, eth->h_dest, ETH_ALEN);
  11476. +- memcpy(src, eth->h_source, ETH_ALEN);
  11477. +
  11478. ++ skb_copy_bits(skb, offset, &eth, sizeof(eth));
  11479. ++ len = ntohs(eth.h_proto);
  11480. ++ subframe_len = sizeof(struct ethhdr) + len;
  11481. + padding = (4 - subframe_len) & 0x3;
  11482. ++
  11483. + /* the last MSDU has no padding */
  11484. ++ remaining = skb->len - offset;
  11485. + if (subframe_len > remaining)
  11486. + goto purge;
  11487. +
  11488. +- skb_pull(skb, sizeof(struct ethhdr));
  11489. ++ offset += sizeof(struct ethhdr);
  11490. + /* reuse skb for the last subframe */
  11491. +- if (remaining <= subframe_len + padding)
  11492. ++ last = remaining <= subframe_len + padding;
  11493. ++ if (!skb_is_nonlinear(skb) && last) {
  11494. ++ skb_pull(skb, offset);
  11495. + frame = skb;
  11496. +- else {
  11497. +- unsigned int hlen = ALIGN(extra_headroom, 4);
  11498. +- /*
  11499. +- * Allocate and reserve two bytes more for payload
  11500. +- * alignment since sizeof(struct ethhdr) is 14.
  11501. +- */
  11502. +- frame = dev_alloc_skb(hlen + subframe_len + 2);
  11503. ++ reuse_skb = true;
  11504. ++ } else {
  11505. ++ frame = __ieee80211_amsdu_copy(skb, hlen, offset, len);
  11506. + if (!frame)
  11507. + goto purge;
  11508. +
  11509. +- skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2);
  11510. +- memcpy(skb_put(frame, ntohs(len)), skb->data,
  11511. +- ntohs(len));
  11512. +-
  11513. +- eth = (struct ethhdr *)skb_pull(skb, ntohs(len) +
  11514. +- padding);
  11515. +- if (!eth) {
  11516. +- dev_kfree_skb(frame);
  11517. +- goto purge;
  11518. +- }
  11519. ++ offset += len + padding;
  11520. + }
  11521. +
  11522. + skb_reset_network_header(frame);
  11523. +@@ -719,24 +721,20 @@ void ieee80211_amsdu_to_8023s(struct sk_
  11524. +
  11525. + payload = frame->data;
  11526. + ethertype = (payload[6] << 8) | payload[7];
  11527. +-
  11528. + if (likely((ether_addr_equal(payload, rfc1042_header) &&
  11529. + ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) ||
  11530. + ether_addr_equal(payload, bridge_tunnel_header))) {
  11531. +- /* remove RFC1042 or Bridge-Tunnel
  11532. +- * encapsulation and replace EtherType */
  11533. +- skb_pull(frame, 6);
  11534. +- memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN);
  11535. +- memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN);
  11536. +- } else {
  11537. +- memcpy(skb_push(frame, sizeof(__be16)), &len,
  11538. +- sizeof(__be16));
  11539. +- memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN);
  11540. +- memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN);
  11541. ++ eth.h_proto = htons(ethertype);
  11542. ++ skb_pull(frame, ETH_ALEN + 2);
  11543. + }
  11544. ++
  11545. ++ memcpy(skb_push(frame, sizeof(eth)), &eth, sizeof(eth));
  11546. + __skb_queue_tail(list, frame);
  11547. + }
  11548. +
  11549. ++ if (!reuse_skb)
  11550. ++ dev_kfree_skb(skb);
  11551. ++
  11552. + return;
  11553. +
  11554. + purge:
  11555. 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
  11556. deleted file mode 100644
  11557. index f05287d..0000000
  11558. --- a/package/kernel/mac80211/patches/321-ath9k-ar9271_hw_pa_cal-use-proper-makroses.patch
  11559. +++ /dev/null
  11560. @@ -1,79 +0,0 @@
  11561. -From: Oleksij Rempel <linux@rempel-privat.de>
  11562. -Date: Sun, 22 Mar 2015 19:29:48 +0100
  11563. -Subject: [PATCH] ath9k: ar9271_hw_pa_cal: use proper makroses.
  11564. -
  11565. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  11566. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11567. ----
  11568. -
  11569. ---- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  11570. -+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  11571. -@@ -443,33 +443,30 @@ static void ar9271_hw_pa_cal(struct ath_
  11572. - for (i = 0; i < ARRAY_SIZE(regList); i++)
  11573. - regList[i][1] = REG_READ(ah, regList[i][0]);
  11574. -
  11575. -- regVal = REG_READ(ah, AR9285_AN_RF2G6);
  11576. -- regVal &= (~(0x1));
  11577. -- REG_WRITE(ah, AR9285_AN_RF2G6, regVal);
  11578. -- regVal = REG_READ(ah, 0x9808);
  11579. -- regVal |= (0x1 << 27);
  11580. -- REG_WRITE(ah, 0x9808, regVal);
  11581. --
  11582. -+ /* 7834, b1=0 */
  11583. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G6, 1 << 0);
  11584. -+ /* 9808, b27=1 */
  11585. -+ REG_SET_BIT(ah, 0x9808, 1 << 27);
  11586. - /* 786c,b23,1, pwddac=1 */
  11587. -- REG_RMW_FIELD(ah, AR9285_AN_TOP3, AR9285_AN_TOP3_PWDDAC, 1);
  11588. -+ REG_SET_BIT(ah, AR9285_AN_TOP3, AR9285_AN_TOP3_PWDDAC);
  11589. - /* 7854, b5,1, pdrxtxbb=1 */
  11590. -- REG_RMW_FIELD(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDRXTXBB1, 1);
  11591. -+ REG_SET_BIT(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDRXTXBB1);
  11592. - /* 7854, b7,1, pdv2i=1 */
  11593. -- REG_RMW_FIELD(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDV2I, 1);
  11594. -+ REG_SET_BIT(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDV2I);
  11595. - /* 7854, b8,1, pddacinterface=1 */
  11596. -- REG_RMW_FIELD(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDDACIF, 1);
  11597. -+ REG_SET_BIT(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDDACIF);
  11598. - /* 7824,b12,0, offcal=0 */
  11599. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G2, AR9285_AN_RF2G2_OFFCAL, 0);
  11600. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G2, AR9285_AN_RF2G2_OFFCAL);
  11601. - /* 7838, b1,0, pwddb=0 */
  11602. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PWDDB, 0);
  11603. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PWDDB);
  11604. - /* 7820,b11,0, enpacal=0 */
  11605. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_ENPACAL, 0);
  11606. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_ENPACAL);
  11607. - /* 7820,b25,1, pdpadrv1=0 */
  11608. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPADRV1, 0);
  11609. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPADRV1);
  11610. - /* 7820,b24,0, pdpadrv2=0 */
  11611. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPADRV2, 0);
  11612. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPADRV2);
  11613. - /* 7820,b23,0, pdpaout=0 */
  11614. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPAOUT, 0);
  11615. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPAOUT);
  11616. - /* 783c,b14-16,7, padrvgn2tab_0=7 */
  11617. - REG_RMW_FIELD(ah, AR9285_AN_RF2G8, AR9285_AN_RF2G8_PADRVGN2TAB0, 7);
  11618. - /*
  11619. -@@ -516,15 +513,13 @@ static void ar9271_hw_pa_cal(struct ath_
  11620. - ah->pacal_info.prev_offset = regVal;
  11621. - }
  11622. -
  11623. -- ENABLE_REGWRITE_BUFFER(ah);
  11624. -
  11625. -- regVal = REG_READ(ah, AR_AN_RF2G1_CH1);
  11626. -- regVal |= 0x1;
  11627. -- REG_WRITE(ah, AR_AN_RF2G1_CH1, regVal);
  11628. -- regVal = REG_READ(ah, 0x9808);
  11629. -- regVal &= (~(0x1 << 27));
  11630. -- REG_WRITE(ah, 0x9808, regVal);
  11631. -+ /* 7834, b1=1 */
  11632. -+ REG_SET_BIT(ah, AR9285_AN_RF2G6, 1 << 0);
  11633. -+ /* 9808, b27=0 */
  11634. -+ REG_CLR_BIT(ah, 0x9808, 1 << 27);
  11635. -
  11636. -+ ENABLE_REGWRITE_BUFFER(ah);
  11637. - for (i = 0; i < ARRAY_SIZE(regList); i++)
  11638. - REG_WRITE(ah, regList[i][0], regList[i][1]);
  11639. -
  11640. 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
  11641. new file mode 100644
  11642. index 0000000..c4155a1
  11643. --- /dev/null
  11644. +++ b/package/kernel/mac80211/patches/321-mac80211-Parse-legacy-and-HT-rate-in-injected-frames.patch
  11645. @@ -0,0 +1,155 @@
  11646. +From: Sven Eckelmann <sven@narfation.org>
  11647. +Date: Tue, 26 Jan 2016 17:11:13 +0100
  11648. +Subject: [PATCH] mac80211: Parse legacy and HT rate in injected frames
  11649. +
  11650. +Drivers/devices without their own rate control algorithm can get the
  11651. +information what rates they should use from either the radiotap header of
  11652. +injected frames or from the rate control algorithm. But the parsing of the
  11653. +legacy rate information from the radiotap header was removed in commit
  11654. +e6a9854b05c1 ("mac80211/drivers: rewrite the rate control API").
  11655. +
  11656. +The removal of this feature heavily reduced the usefulness of frame
  11657. +injection when wanting to simulate specific transmission behavior. Having
  11658. +rate parsing together with MCS rates and retry support allows a fine
  11659. +grained selection of the tx behavior of injected frames for these kind of
  11660. +tests.
  11661. +
  11662. +Signed-off-by: Sven Eckelmann <sven@narfation.org>
  11663. +Cc: Simon Wunderlich <sw@simonwunderlich.de>
  11664. +Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  11665. +---
  11666. +
  11667. +--- a/include/net/mac80211.h
  11668. ++++ b/include/net/mac80211.h
  11669. +@@ -708,12 +708,14 @@ enum mac80211_tx_info_flags {
  11670. + * protocol frame (e.g. EAP)
  11671. + * @IEEE80211_TX_CTRL_PS_RESPONSE: This frame is a response to a poll
  11672. + * frame (PS-Poll or uAPSD).
  11673. ++ * @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information
  11674. + *
  11675. + * These flags are used in tx_info->control.flags.
  11676. + */
  11677. + enum mac80211_tx_control_flags {
  11678. + IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0),
  11679. + IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1),
  11680. ++ IEEE80211_TX_CTRL_RATE_INJECT = BIT(2),
  11681. + };
  11682. +
  11683. + /*
  11684. +--- a/net/mac80211/tx.c
  11685. ++++ b/net/mac80211/tx.c
  11686. +@@ -710,6 +710,10 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021
  11687. +
  11688. + info->control.short_preamble = txrc.short_preamble;
  11689. +
  11690. ++ /* don't ask rate control when rate already injected via radiotap */
  11691. ++ if (info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT)
  11692. ++ return TX_CONTINUE;
  11693. ++
  11694. + if (tx->sta)
  11695. + assoc = test_sta_flag(tx->sta, WLAN_STA_ASSOC);
  11696. +
  11697. +@@ -1665,15 +1669,24 @@ void ieee80211_xmit(struct ieee80211_sub
  11698. + ieee80211_tx(sdata, sta, skb, false);
  11699. + }
  11700. +
  11701. +-static bool ieee80211_parse_tx_radiotap(struct sk_buff *skb)
  11702. ++static bool ieee80211_parse_tx_radiotap(struct ieee80211_local *local,
  11703. ++ struct sk_buff *skb)
  11704. + {
  11705. + struct ieee80211_radiotap_iterator iterator;
  11706. + struct ieee80211_radiotap_header *rthdr =
  11707. + (struct ieee80211_radiotap_header *) skb->data;
  11708. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  11709. ++ struct ieee80211_supported_band *sband =
  11710. ++ local->hw.wiphy->bands[info->band];
  11711. + int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len,
  11712. + NULL);
  11713. + u16 txflags;
  11714. ++ u16 rate = 0;
  11715. ++ bool rate_found = false;
  11716. ++ u8 rate_retries = 0;
  11717. ++ u16 rate_flags = 0;
  11718. ++ u8 mcs_known, mcs_flags;
  11719. ++ int i;
  11720. +
  11721. + info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
  11722. + IEEE80211_TX_CTL_DONTFRAG;
  11723. +@@ -1724,6 +1737,35 @@ static bool ieee80211_parse_tx_radiotap(
  11724. + info->flags |= IEEE80211_TX_CTL_NO_ACK;
  11725. + break;
  11726. +
  11727. ++ case IEEE80211_RADIOTAP_RATE:
  11728. ++ rate = *iterator.this_arg;
  11729. ++ rate_flags = 0;
  11730. ++ rate_found = true;
  11731. ++ break;
  11732. ++
  11733. ++ case IEEE80211_RADIOTAP_DATA_RETRIES:
  11734. ++ rate_retries = *iterator.this_arg;
  11735. ++ break;
  11736. ++
  11737. ++ case IEEE80211_RADIOTAP_MCS:
  11738. ++ mcs_known = iterator.this_arg[0];
  11739. ++ mcs_flags = iterator.this_arg[1];
  11740. ++ if (!(mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_MCS))
  11741. ++ break;
  11742. ++
  11743. ++ rate_found = true;
  11744. ++ rate = iterator.this_arg[2];
  11745. ++ rate_flags = IEEE80211_TX_RC_MCS;
  11746. ++
  11747. ++ if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_GI &&
  11748. ++ mcs_flags & IEEE80211_RADIOTAP_MCS_SGI)
  11749. ++ rate_flags |= IEEE80211_TX_RC_SHORT_GI;
  11750. ++
  11751. ++ if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_BW &&
  11752. ++ mcs_flags & IEEE80211_RADIOTAP_MCS_BW_40)
  11753. ++ rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
  11754. ++ break;
  11755. ++
  11756. + /*
  11757. + * Please update the file
  11758. + * Documentation/networking/mac80211-injection.txt
  11759. +@@ -1738,6 +1780,32 @@ static bool ieee80211_parse_tx_radiotap(
  11760. + if (ret != -ENOENT) /* ie, if we didn't simply run out of fields */
  11761. + return false;
  11762. +
  11763. ++ if (rate_found) {
  11764. ++ info->control.flags |= IEEE80211_TX_CTRL_RATE_INJECT;
  11765. ++
  11766. ++ for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
  11767. ++ info->control.rates[i].idx = -1;
  11768. ++ info->control.rates[i].flags = 0;
  11769. ++ info->control.rates[i].count = 0;
  11770. ++ }
  11771. ++
  11772. ++ if (rate_flags & IEEE80211_TX_RC_MCS) {
  11773. ++ info->control.rates[0].idx = rate;
  11774. ++ } else {
  11775. ++ for (i = 0; i < sband->n_bitrates; i++) {
  11776. ++ if (rate * 5 != sband->bitrates[i].bitrate)
  11777. ++ continue;
  11778. ++
  11779. ++ info->control.rates[0].idx = i;
  11780. ++ break;
  11781. ++ }
  11782. ++ }
  11783. ++
  11784. ++ info->control.rates[0].flags = rate_flags;
  11785. ++ info->control.rates[0].count = min_t(u8, rate_retries + 1,
  11786. ++ local->hw.max_rate_tries);
  11787. ++ }
  11788. ++
  11789. + /*
  11790. + * remove the radiotap header
  11791. + * iterator->_max_length was sanity-checked against
  11792. +@@ -1819,7 +1887,7 @@ netdev_tx_t ieee80211_monitor_start_xmit
  11793. + IEEE80211_TX_CTL_INJECTED;
  11794. +
  11795. + /* process and remove the injection radiotap header */
  11796. +- if (!ieee80211_parse_tx_radiotap(skb))
  11797. ++ if (!ieee80211_parse_tx_radiotap(local, skb))
  11798. + goto fail;
  11799. +
  11800. + rcu_read_lock();
  11801. 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
  11802. deleted file mode 100644
  11803. index 7247369..0000000
  11804. --- a/package/kernel/mac80211/patches/322-ath9k-ar9271_hw_pa_cal-use-RMW-buffer.patch
  11805. +++ /dev/null
  11806. @@ -1,48 +0,0 @@
  11807. -From: Oleksij Rempel <linux@rempel-privat.de>
  11808. -Date: Sun, 22 Mar 2015 19:29:49 +0100
  11809. -Subject: [PATCH] ath9k: ar9271_hw_pa_cal: use RMW buffer
  11810. -
  11811. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  11812. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11813. ----
  11814. -
  11815. ---- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  11816. -+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  11817. -@@ -436,13 +436,14 @@ static void ar9271_hw_pa_cal(struct ath_
  11818. - { AR9285_AN_RF2G2, 0 },
  11819. - { AR9285_AN_TOP2, 0 },
  11820. - { AR9285_AN_RF2G8, 0 },
  11821. -- { AR9285_AN_RF2G7, 0 } ,
  11822. -- { AR9285_AN_RF2G3, 0 } ,
  11823. -+ { AR9285_AN_RF2G7, 0 },
  11824. -+ { AR9285_AN_RF2G3, 0 },
  11825. - };
  11826. -
  11827. - for (i = 0; i < ARRAY_SIZE(regList); i++)
  11828. - regList[i][1] = REG_READ(ah, regList[i][0]);
  11829. -
  11830. -+ ENABLE_REG_RMW_BUFFER(ah);
  11831. - /* 7834, b1=0 */
  11832. - REG_CLR_BIT(ah, AR9285_AN_RF2G6, 1 << 0);
  11833. - /* 9808, b27=1 */
  11834. -@@ -476,6 +477,7 @@ static void ar9271_hw_pa_cal(struct ath_
  11835. - REG_RMW_FIELD(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PADRVGN2TAB0, 0);
  11836. - /* 7828, b0-11, ccom=fff */
  11837. - REG_RMW_FIELD(ah, AR9285_AN_RF2G3, AR9271_AN_RF2G3_CCOMP, 0xfff);
  11838. -+ REG_RMW_BUFFER_FLUSH(ah);
  11839. -
  11840. - /* Set:
  11841. - * localmode=1,bmode=1,bmoderxtx=1,synthon=1,
  11842. -@@ -514,10 +516,12 @@ static void ar9271_hw_pa_cal(struct ath_
  11843. - }
  11844. -
  11845. -
  11846. -+ ENABLE_REG_RMW_BUFFER(ah);
  11847. - /* 7834, b1=1 */
  11848. - REG_SET_BIT(ah, AR9285_AN_RF2G6, 1 << 0);
  11849. - /* 9808, b27=0 */
  11850. - REG_CLR_BIT(ah, 0x9808, 1 << 27);
  11851. -+ REG_RMW_BUFFER_FLUSH(ah);
  11852. -
  11853. - ENABLE_REGWRITE_BUFFER(ah);
  11854. - for (i = 0; i < ARRAY_SIZE(regList); i++)
  11855. 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
  11856. new file mode 100644
  11857. index 0000000..e7bfb9c
  11858. --- /dev/null
  11859. +++ b/package/kernel/mac80211/patches/322-mac80211-add-A-MSDU-tx-support.patch
  11860. @@ -0,0 +1,317 @@
  11861. +From: Felix Fietkau <nbd@openwrt.org>
  11862. +Date: Fri, 5 Feb 2016 01:38:51 +0100
  11863. +Subject: [PATCH] mac80211: add A-MSDU tx support
  11864. +
  11865. +Requires software tx queueing support. frag_list support (for zero-copy)
  11866. +is optional.
  11867. +
  11868. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  11869. +---
  11870. +
  11871. +--- a/include/net/mac80211.h
  11872. ++++ b/include/net/mac80211.h
  11873. +@@ -709,6 +709,7 @@ enum mac80211_tx_info_flags {
  11874. + * @IEEE80211_TX_CTRL_PS_RESPONSE: This frame is a response to a poll
  11875. + * frame (PS-Poll or uAPSD).
  11876. + * @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information
  11877. ++ * @IEEE80211_TX_CTRL_AMSDU: This frame is an A-MSDU frame
  11878. + *
  11879. + * These flags are used in tx_info->control.flags.
  11880. + */
  11881. +@@ -716,6 +717,7 @@ enum mac80211_tx_control_flags {
  11882. + IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0),
  11883. + IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1),
  11884. + IEEE80211_TX_CTRL_RATE_INJECT = BIT(2),
  11885. ++ IEEE80211_TX_CTRL_AMSDU = BIT(3),
  11886. + };
  11887. +
  11888. + /*
  11889. +@@ -1728,6 +1730,7 @@ struct ieee80211_sta_rates {
  11890. + * size is min(max_amsdu_len, 7935) bytes.
  11891. + * Both additional HT limits must be enforced by the low level driver.
  11892. + * This is defined by the spec (IEEE 802.11-2012 section 8.3.2.2 NOTE 2).
  11893. ++ * @max_rc_amsdu_len: Maximum A-MSDU size in bytes recommended by rate control.
  11894. + * @txq: per-TID data TX queues (if driver uses the TXQ abstraction)
  11895. + */
  11896. + struct ieee80211_sta {
  11897. +@@ -1748,6 +1751,7 @@ struct ieee80211_sta {
  11898. + bool mfp;
  11899. + u8 max_amsdu_subframes;
  11900. + u16 max_amsdu_len;
  11901. ++ u16 max_rc_amsdu_len;
  11902. +
  11903. + struct ieee80211_txq *txq[IEEE80211_NUM_TIDS];
  11904. +
  11905. +@@ -1961,6 +1965,15 @@ struct ieee80211_txq {
  11906. + * order and does not need to manage its own reorder buffer or BA session
  11907. + * timeout.
  11908. + *
  11909. ++ * @IEEE80211_HW_TX_AMSDU: Hardware (or driver) supports software aggregated
  11910. ++ * A-MSDU frames. Requires software tx queueing and fast-xmit support.
  11911. ++ * When not using minstrel/minstrel_ht rate control, the driver should
  11912. ++ * limit the maximum A-MSDU size based on the current tx rate by setting
  11913. ++ * max_rc_amsdu_len in struct ieee80211_sta.
  11914. ++ *
  11915. ++ * @IEEE80211_HW_TX_FRAG_LIST: Hardware (or driver) supports sending frag_list
  11916. ++ * skbs, needed for zero-copy software A-MSDU.
  11917. ++ *
  11918. + * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
  11919. + */
  11920. + enum ieee80211_hw_flags {
  11921. +@@ -1998,6 +2011,8 @@ enum ieee80211_hw_flags {
  11922. + IEEE80211_HW_BEACON_TX_STATUS,
  11923. + IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR,
  11924. + IEEE80211_HW_SUPPORTS_REORDERING_BUFFER,
  11925. ++ IEEE80211_HW_TX_AMSDU,
  11926. ++ IEEE80211_HW_TX_FRAG_LIST,
  11927. +
  11928. + /* keep last, obviously */
  11929. + NUM_IEEE80211_HW_FLAGS
  11930. +@@ -2070,6 +2085,9 @@ enum ieee80211_hw_flags {
  11931. + * size is smaller (an example is LinkSys WRT120N with FW v1.0.07
  11932. + * build 002 Jun 18 2012).
  11933. + *
  11934. ++ * @max_tx_fragments: maximum number of tx buffers per (A)-MSDU, sum
  11935. ++ * of 1 + skb_shinfo(skb)->nr_frags for each skb in the frag_list.
  11936. ++ *
  11937. + * @offchannel_tx_hw_queue: HW queue ID to use for offchannel TX
  11938. + * (if %IEEE80211_HW_QUEUE_CONTROL is set)
  11939. + *
  11940. +@@ -2124,6 +2142,7 @@ struct ieee80211_hw {
  11941. + u8 max_rate_tries;
  11942. + u8 max_rx_aggregation_subframes;
  11943. + u8 max_tx_aggregation_subframes;
  11944. ++ u8 max_tx_fragments;
  11945. + u8 offchannel_tx_hw_queue;
  11946. + u8 radiotap_mcs_details;
  11947. + u16 radiotap_vht_details;
  11948. +--- a/net/mac80211/agg-tx.c
  11949. ++++ b/net/mac80211/agg-tx.c
  11950. +@@ -935,6 +935,7 @@ void ieee80211_process_addba_resp(struct
  11951. + size_t len)
  11952. + {
  11953. + struct tid_ampdu_tx *tid_tx;
  11954. ++ struct ieee80211_txq *txq;
  11955. + u16 capab, tid;
  11956. + u8 buf_size;
  11957. + bool amsdu;
  11958. +@@ -945,6 +946,10 @@ void ieee80211_process_addba_resp(struct
  11959. + buf_size = (capab & IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK) >> 6;
  11960. + buf_size = min(buf_size, local->hw.max_tx_aggregation_subframes);
  11961. +
  11962. ++ txq = sta->sta.txq[tid];
  11963. ++ if (!amsdu && txq)
  11964. ++ set_bit(IEEE80211_TXQ_NO_AMSDU, &to_txq_info(txq)->flags);
  11965. ++
  11966. + mutex_lock(&sta->ampdu_mlme.mtx);
  11967. +
  11968. + tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
  11969. +--- a/net/mac80211/debugfs.c
  11970. ++++ b/net/mac80211/debugfs.c
  11971. +@@ -127,6 +127,8 @@ static const char *hw_flag_names[NUM_IEE
  11972. + FLAG(BEACON_TX_STATUS),
  11973. + FLAG(NEEDS_UNIQUE_STA_ADDR),
  11974. + FLAG(SUPPORTS_REORDERING_BUFFER),
  11975. ++ FLAG(TX_AMSDU),
  11976. ++ FLAG(TX_FRAG_LIST),
  11977. +
  11978. + /* keep last for the build bug below */
  11979. + (void *)0x1
  11980. +--- a/net/mac80211/ieee80211_i.h
  11981. ++++ b/net/mac80211/ieee80211_i.h
  11982. +@@ -799,6 +799,7 @@ struct mac80211_qos_map {
  11983. + enum txq_info_flags {
  11984. + IEEE80211_TXQ_STOP,
  11985. + IEEE80211_TXQ_AMPDU,
  11986. ++ IEEE80211_TXQ_NO_AMSDU,
  11987. + };
  11988. +
  11989. + struct txq_info {
  11990. +--- a/net/mac80211/tx.c
  11991. ++++ b/net/mac80211/tx.c
  11992. +@@ -1318,6 +1318,10 @@ struct sk_buff *ieee80211_tx_dequeue(str
  11993. + out:
  11994. + spin_unlock_bh(&txqi->queue.lock);
  11995. +
  11996. ++ if (skb && skb_has_frag_list(skb) &&
  11997. ++ !ieee80211_hw_check(&local->hw, TX_FRAG_LIST))
  11998. ++ skb_linearize(skb);
  11999. ++
  12000. + return skb;
  12001. + }
  12002. + EXPORT_SYMBOL(ieee80211_tx_dequeue);
  12003. +@@ -2757,6 +2761,163 @@ void ieee80211_clear_fast_xmit(struct st
  12004. + kfree_rcu(fast_tx, rcu_head);
  12005. + }
  12006. +
  12007. ++static bool ieee80211_amsdu_realloc_pad(struct ieee80211_local *local,
  12008. ++ struct sk_buff *skb, int headroom,
  12009. ++ int *subframe_len)
  12010. ++{
  12011. ++ int amsdu_len = *subframe_len + sizeof(struct ethhdr);
  12012. ++ int padding = (4 - amsdu_len) & 3;
  12013. ++
  12014. ++ if (skb_headroom(skb) < headroom || skb_tailroom(skb) < padding) {
  12015. ++ I802_DEBUG_INC(local->tx_expand_skb_head);
  12016. ++
  12017. ++ if (pskb_expand_head(skb, headroom, padding, GFP_ATOMIC)) {
  12018. ++ wiphy_debug(local->hw.wiphy,
  12019. ++ "failed to reallocate TX buffer\n");
  12020. ++ return false;
  12021. ++ }
  12022. ++ }
  12023. ++
  12024. ++ if (padding) {
  12025. ++ *subframe_len += padding;
  12026. ++ memset(skb_put(skb, padding), 0, padding);
  12027. ++ }
  12028. ++
  12029. ++ return true;
  12030. ++}
  12031. ++
  12032. ++static bool ieee80211_amsdu_prepare_head(struct ieee80211_sub_if_data *sdata,
  12033. ++ struct ieee80211_fast_tx *fast_tx,
  12034. ++ struct sk_buff *skb)
  12035. ++{
  12036. ++ struct ieee80211_local *local = sdata->local;
  12037. ++ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  12038. ++ struct ieee80211_hdr *hdr;
  12039. ++ struct ethhdr amsdu_hdr;
  12040. ++ int hdr_len = fast_tx->hdr_len - sizeof(rfc1042_header);
  12041. ++ int subframe_len = skb->len - hdr_len;
  12042. ++ void *data;
  12043. ++ u8 *qc;
  12044. ++
  12045. ++ if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)
  12046. ++ return false;
  12047. ++
  12048. ++ if (info->control.flags & IEEE80211_TX_CTRL_AMSDU)
  12049. ++ return true;
  12050. ++
  12051. ++ if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(amsdu_hdr),
  12052. ++ &subframe_len))
  12053. ++ return false;
  12054. ++
  12055. ++ amsdu_hdr.h_proto = cpu_to_be16(subframe_len);
  12056. ++ memcpy(amsdu_hdr.h_source, skb->data + fast_tx->sa_offs, ETH_ALEN);
  12057. ++ memcpy(amsdu_hdr.h_dest, skb->data + fast_tx->da_offs, ETH_ALEN);
  12058. ++
  12059. ++ data = skb_push(skb, sizeof(amsdu_hdr));
  12060. ++ memmove(data, data + sizeof(amsdu_hdr), hdr_len);
  12061. ++ memcpy(data + hdr_len, &amsdu_hdr, sizeof(amsdu_hdr));
  12062. ++
  12063. ++ hdr = data;
  12064. ++ qc = ieee80211_get_qos_ctl(hdr);
  12065. ++ *qc |= IEEE80211_QOS_CTL_A_MSDU_PRESENT;
  12066. ++
  12067. ++ info->control.flags |= IEEE80211_TX_CTRL_AMSDU;
  12068. ++
  12069. ++ return true;
  12070. ++}
  12071. ++
  12072. ++static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata,
  12073. ++ struct sta_info *sta,
  12074. ++ struct ieee80211_fast_tx *fast_tx,
  12075. ++ struct sk_buff *skb)
  12076. ++{
  12077. ++ struct ieee80211_local *local = sdata->local;
  12078. ++ u8 tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
  12079. ++ struct ieee80211_txq *txq = sta->sta.txq[tid];
  12080. ++ struct txq_info *txqi;
  12081. ++ struct sk_buff **frag_tail, *head;
  12082. ++ int subframe_len = skb->len - ETH_ALEN;
  12083. ++ u8 max_subframes = sta->sta.max_amsdu_subframes;
  12084. ++ int max_frags = local->hw.max_tx_fragments;
  12085. ++ int max_amsdu_len = sta->sta.max_amsdu_len;
  12086. ++ __be16 len;
  12087. ++ void *data;
  12088. ++ bool ret = false;
  12089. ++ int n = 1, nfrags;
  12090. ++
  12091. ++ if (!ieee80211_hw_check(&local->hw, TX_AMSDU))
  12092. ++ return false;
  12093. ++
  12094. ++ if (!txq)
  12095. ++ return false;
  12096. ++
  12097. ++ txqi = to_txq_info(txq);
  12098. ++ if (test_bit(IEEE80211_TXQ_NO_AMSDU, &txqi->flags))
  12099. ++ return false;
  12100. ++
  12101. ++ if (sta->sta.max_rc_amsdu_len)
  12102. ++ max_amsdu_len = min_t(int, max_amsdu_len,
  12103. ++ sta->sta.max_rc_amsdu_len);
  12104. ++
  12105. ++ spin_lock_bh(&txqi->queue.lock);
  12106. ++
  12107. ++ head = skb_peek_tail(&txqi->queue);
  12108. ++ if (!head)
  12109. ++ goto out;
  12110. ++
  12111. ++ if (skb->len + head->len > max_amsdu_len)
  12112. ++ goto out;
  12113. ++
  12114. ++ /*
  12115. ++ * HT A-MPDU limits maximum MPDU size to 4095 bytes. Since aggregation
  12116. ++ * sessions are started/stopped without txq flush, use the limit here
  12117. ++ * to avoid having to de-aggregate later.
  12118. ++ */
  12119. ++ if (skb->len + head->len > 4095 &&
  12120. ++ !sta->sta.vht_cap.vht_supported)
  12121. ++ goto out;
  12122. ++
  12123. ++ if (!ieee80211_amsdu_prepare_head(sdata, fast_tx, head))
  12124. ++ goto out;
  12125. ++
  12126. ++ nfrags = 1 + skb_shinfo(skb)->nr_frags;
  12127. ++ nfrags += 1 + skb_shinfo(head)->nr_frags;
  12128. ++ frag_tail = &skb_shinfo(head)->frag_list;
  12129. ++ while (*frag_tail) {
  12130. ++ nfrags += 1 + skb_shinfo(*frag_tail)->nr_frags;
  12131. ++ frag_tail = &(*frag_tail)->next;
  12132. ++ n++;
  12133. ++ }
  12134. ++
  12135. ++ if (max_subframes && n > max_subframes)
  12136. ++ goto out;
  12137. ++
  12138. ++ if (max_frags && nfrags > max_frags)
  12139. ++ goto out;
  12140. ++
  12141. ++ if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(rfc1042_header) + 2,
  12142. ++ &subframe_len))
  12143. ++ return false;
  12144. ++
  12145. ++ ret = true;
  12146. ++ data = skb_push(skb, ETH_ALEN + 2);
  12147. ++ memmove(data, data + ETH_ALEN + 2, 2 * ETH_ALEN);
  12148. ++
  12149. ++ data += 2 * ETH_ALEN;
  12150. ++ len = cpu_to_be16(subframe_len);
  12151. ++ memcpy(data, &len, 2);
  12152. ++ memcpy(data + 2, rfc1042_header, sizeof(rfc1042_header));
  12153. ++
  12154. ++ head->len += skb->len;
  12155. ++ head->data_len += skb->len;
  12156. ++ *frag_tail = skb;
  12157. ++
  12158. ++out:
  12159. ++ spin_unlock_bh(&txqi->queue.lock);
  12160. ++
  12161. ++ return ret;
  12162. ++}
  12163. ++
  12164. + static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
  12165. + struct net_device *dev, struct sta_info *sta,
  12166. + struct ieee80211_fast_tx *fast_tx,
  12167. +@@ -2811,6 +2972,10 @@ static bool ieee80211_xmit_fast(struct i
  12168. +
  12169. + ieee80211_tx_stats(dev, skb->len + extra_head);
  12170. +
  12171. ++ if ((hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) &&
  12172. ++ ieee80211_amsdu_aggregate(sdata, sta, fast_tx, skb))
  12173. ++ return true;
  12174. ++
  12175. + /* will not be crypto-handled beyond what we do here, so use false
  12176. + * as the may-encrypt argument for the resize to not account for
  12177. + * more room than we already have in 'extra_head'
  12178. diff --git a/package/kernel/mac80211/patches/323-0000-brcmfmac-fix-setting-primary-channel-for-80-MHz-widt.patch b/package/kernel/mac80211/patches/323-0000-brcmfmac-fix-setting-primary-channel-for-80-MHz-widt.patch
  12179. new file mode 100644
  12180. index 0000000..9277b2c
  12181. --- /dev/null
  12182. +++ b/package/kernel/mac80211/patches/323-0000-brcmfmac-fix-setting-primary-channel-for-80-MHz-widt.patch
  12183. @@ -0,0 +1,64 @@
  12184. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  12185. +Date: Wed, 20 Jan 2016 16:46:04 +0100
  12186. +Subject: [PATCH] brcmfmac: fix setting primary channel for 80 MHz width
  12187. +MIME-Version: 1.0
  12188. +Content-Type: text/plain; charset=UTF-8
  12189. +Content-Transfer-Encoding: 8bit
  12190. +
  12191. +First of all it changes the way we calculate primary channel offset. If
  12192. +we use e.g. 80 MHz channel with primary frequency 5180 MHz (which means
  12193. +center frequency is 5210 MHz) it makes sense to calculate primary offset
  12194. +as -30 MHz.
  12195. +Then it fixes values we compare primary_offset with. We were comparing
  12196. +offset in MHz against -2 or 2 which was resulting in picking a wrong
  12197. +primary channel.
  12198. +
  12199. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  12200. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12201. +---
  12202. +
  12203. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  12204. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  12205. +@@ -247,7 +247,7 @@ static u16 chandef_to_chanspec(struct br
  12206. + brcmf_dbg(TRACE, "chandef: control %d center %d width %d\n",
  12207. + ch->chan->center_freq, ch->center_freq1, ch->width);
  12208. + ch_inf.chnum = ieee80211_frequency_to_channel(ch->center_freq1);
  12209. +- primary_offset = ch->center_freq1 - ch->chan->center_freq;
  12210. ++ primary_offset = ch->chan->center_freq - ch->center_freq1;
  12211. + switch (ch->width) {
  12212. + case NL80211_CHAN_WIDTH_20:
  12213. + case NL80211_CHAN_WIDTH_20_NOHT:
  12214. +@@ -256,24 +256,21 @@ static u16 chandef_to_chanspec(struct br
  12215. + break;
  12216. + case NL80211_CHAN_WIDTH_40:
  12217. + ch_inf.bw = BRCMU_CHAN_BW_40;
  12218. +- if (primary_offset < 0)
  12219. ++ if (primary_offset > 0)
  12220. + ch_inf.sb = BRCMU_CHAN_SB_U;
  12221. + else
  12222. + ch_inf.sb = BRCMU_CHAN_SB_L;
  12223. + break;
  12224. + case NL80211_CHAN_WIDTH_80:
  12225. + ch_inf.bw = BRCMU_CHAN_BW_80;
  12226. +- if (primary_offset < 0) {
  12227. +- if (primary_offset < -CH_10MHZ_APART)
  12228. +- ch_inf.sb = BRCMU_CHAN_SB_UU;
  12229. +- else
  12230. +- ch_inf.sb = BRCMU_CHAN_SB_UL;
  12231. +- } else {
  12232. +- if (primary_offset > CH_10MHZ_APART)
  12233. +- ch_inf.sb = BRCMU_CHAN_SB_LL;
  12234. +- else
  12235. +- ch_inf.sb = BRCMU_CHAN_SB_LU;
  12236. +- }
  12237. ++ if (primary_offset == -30)
  12238. ++ ch_inf.sb = BRCMU_CHAN_SB_LL;
  12239. ++ else if (primary_offset == -10)
  12240. ++ ch_inf.sb = BRCMU_CHAN_SB_LU;
  12241. ++ else if (primary_offset == 10)
  12242. ++ ch_inf.sb = BRCMU_CHAN_SB_UL;
  12243. ++ else
  12244. ++ ch_inf.sb = BRCMU_CHAN_SB_UU;
  12245. + break;
  12246. + case NL80211_CHAN_WIDTH_80P80:
  12247. + case NL80211_CHAN_WIDTH_160:
  12248. 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
  12249. new file mode 100644
  12250. index 0000000..d7018da
  12251. --- /dev/null
  12252. +++ b/package/kernel/mac80211/patches/323-0001-brcmfmac-analyze-descriptors-of-current-component-on.patch
  12253. @@ -0,0 +1,51 @@
  12254. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  12255. +Date: Tue, 26 Jan 2016 17:57:01 +0100
  12256. +Subject: [PATCH] brcmfmac: analyze descriptors of current component only
  12257. +MIME-Version: 1.0
  12258. +Content-Type: text/plain; charset=UTF-8
  12259. +Content-Transfer-Encoding: 8bit
  12260. +
  12261. +So far we were looking for address descriptors without a check for
  12262. +crossing current component border. In case of dealing with unsupported
  12263. +descriptor or descriptor missing at all the code would incorrectly get
  12264. +data from another component.
  12265. +
  12266. +Consider this binary-described component from BCM4366 EROM:
  12267. +4bf83b01 TAG==CI CID==0x83b
  12268. +20080201 TAG==CI PORTS==0+1 WRAPPERS==0+1
  12269. +18400035 TAG==ADDR SZ_SZD TYPE_SLAVE
  12270. +00050000
  12271. +18107085 TAG==ADDR SZ_4K TYPE_SWRAP
  12272. +
  12273. +Driver was assigning invalid base address to this core:
  12274. +brcmfmac: [6 ] core 0x83b:32 base 0x18109000 wrap 0x18107000
  12275. +which came from totally different component defined in EROM:
  12276. +43b36701 TAG==CI CID==0x367
  12277. +00000201 TAG==CI PORTS==0+1 WRAPPERS==0+0
  12278. +18109005 TAG==ADDR SZ_4K TYPE_SLAVE
  12279. +
  12280. +This change will also allow us to support components without wrapper
  12281. +address in the future.
  12282. +
  12283. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  12284. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12285. +---
  12286. +
  12287. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  12288. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  12289. +@@ -803,7 +803,14 @@ static int brcmf_chip_dmp_get_regaddr(st
  12290. + *eromaddr -= 4;
  12291. + return -EFAULT;
  12292. + }
  12293. +- } while (desc != DMP_DESC_ADDRESS);
  12294. ++ } while (desc != DMP_DESC_ADDRESS &&
  12295. ++ desc != DMP_DESC_COMPONENT);
  12296. ++
  12297. ++ /* stop if we crossed current component border */
  12298. ++ if (desc == DMP_DESC_COMPONENT) {
  12299. ++ *eromaddr -= 4;
  12300. ++ return 0;
  12301. ++ }
  12302. +
  12303. + /* skip upper 32-bit address descriptor */
  12304. + if (val & DMP_DESC_ADDRSIZE_GT32)
  12305. 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
  12306. new file mode 100644
  12307. index 0000000..045ab49
  12308. --- /dev/null
  12309. +++ b/package/kernel/mac80211/patches/323-0002-brcmfmac-allow-storing-PMU-core-without-wrapper-addr.patch
  12310. @@ -0,0 +1,28 @@
  12311. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  12312. +Date: Tue, 26 Jan 2016 17:57:02 +0100
  12313. +Subject: [PATCH] brcmfmac: allow storing PMU core without wrapper address
  12314. +MIME-Version: 1.0
  12315. +Content-Type: text/plain; charset=UTF-8
  12316. +Content-Transfer-Encoding: 8bit
  12317. +
  12318. +Separated PMU core can be found in new devices and should be used for
  12319. +accessing PMU registers (which were routed through ChipCommon so far).
  12320. +This core is one of exceptions that doesn't have or need wrapper address
  12321. +to be still safely accessible.
  12322. +
  12323. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  12324. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12325. +---
  12326. +
  12327. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  12328. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  12329. +@@ -883,7 +883,8 @@ int brcmf_chip_dmp_erom_scan(struct brcm
  12330. + rev = (val & DMP_COMP_REVISION) >> DMP_COMP_REVISION_S;
  12331. +
  12332. + /* need core with ports */
  12333. +- if (nmw + nsw == 0)
  12334. ++ if (nmw + nsw == 0 &&
  12335. ++ id != BCMA_CORE_PMU)
  12336. + continue;
  12337. +
  12338. + /* try to obtain register address info */
  12339. 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
  12340. new file mode 100644
  12341. index 0000000..7b7ba4f
  12342. --- /dev/null
  12343. +++ b/package/kernel/mac80211/patches/323-0003-brcmfmac-read-extended-capabilities-of-ChipCommon-co.patch
  12344. @@ -0,0 +1,43 @@
  12345. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  12346. +Date: Tue, 26 Jan 2016 17:57:03 +0100
  12347. +Subject: [PATCH] brcmfmac: read extended capabilities of ChipCommon core
  12348. +MIME-Version: 1.0
  12349. +Content-Type: text/plain; charset=UTF-8
  12350. +Content-Transfer-Encoding: 8bit
  12351. +
  12352. +This is an extra bitfield with info about some present hardware.
  12353. +
  12354. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  12355. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12356. +---
  12357. +
  12358. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  12359. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  12360. +@@ -1025,6 +1025,9 @@ static int brcmf_chip_setup(struct brcmf
  12361. + /* get chipcommon capabilites */
  12362. + pub->cc_caps = chip->ops->read32(chip->ctx,
  12363. + CORE_CC_REG(base, capabilities));
  12364. ++ pub->cc_caps_ext = chip->ops->read32(chip->ctx,
  12365. ++ CORE_CC_REG(base,
  12366. ++ capabilities_ext));
  12367. +
  12368. + /* get pmu caps & rev */
  12369. + if (pub->cc_caps & CC_CAP_PMU) {
  12370. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  12371. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  12372. +@@ -27,6 +27,7 @@
  12373. + * @chip: chip identifier.
  12374. + * @chiprev: chip revision.
  12375. + * @cc_caps: chipcommon core capabilities.
  12376. ++ * @cc_caps_ext: chipcommon core extended capabilities.
  12377. + * @pmucaps: PMU capabilities.
  12378. + * @pmurev: PMU revision.
  12379. + * @rambase: RAM base address (only applicable for ARM CR4 chips).
  12380. +@@ -38,6 +39,7 @@ struct brcmf_chip {
  12381. + u32 chip;
  12382. + u32 chiprev;
  12383. + u32 cc_caps;
  12384. ++ u32 cc_caps_ext;
  12385. + u32 pmucaps;
  12386. + u32 pmurev;
  12387. + u32 rambase;
  12388. 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
  12389. new file mode 100644
  12390. index 0000000..2af6fd9
  12391. --- /dev/null
  12392. +++ b/package/kernel/mac80211/patches/323-0004-brcmfmac-access-PMU-registers-using-standalone-PMU-c.patch
  12393. @@ -0,0 +1,148 @@
  12394. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  12395. +Date: Tue, 26 Jan 2016 17:57:04 +0100
  12396. +Subject: [PATCH] brcmfmac: access PMU registers using standalone PMU core if
  12397. + available
  12398. +MIME-Version: 1.0
  12399. +Content-Type: text/plain; charset=UTF-8
  12400. +Content-Transfer-Encoding: 8bit
  12401. +
  12402. +On recent Broadcom chipsets PMU is present as separated core and it
  12403. +can't be accessed using ChipCommon anymore as it fails with e.g.:
  12404. +[ 18.198412] Unhandled fault: imprecise external abort (0x1406) at 0xb6da200f
  12405. +
  12406. +Add a new helper function that will return a proper core that should be
  12407. +used for accessing PMU registers.
  12408. +
  12409. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  12410. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12411. +---
  12412. +
  12413. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  12414. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  12415. +@@ -1014,6 +1014,7 @@ static int brcmf_chip_setup(struct brcmf
  12416. + {
  12417. + struct brcmf_chip *pub;
  12418. + struct brcmf_core_priv *cc;
  12419. ++ struct brcmf_core *pmu;
  12420. + u32 base;
  12421. + u32 val;
  12422. + int ret = 0;
  12423. +@@ -1030,9 +1031,10 @@ static int brcmf_chip_setup(struct brcmf
  12424. + capabilities_ext));
  12425. +
  12426. + /* get pmu caps & rev */
  12427. ++ pmu = brcmf_chip_get_pmu(pub); /* after reading cc_caps_ext */
  12428. + if (pub->cc_caps & CC_CAP_PMU) {
  12429. + val = chip->ops->read32(chip->ctx,
  12430. +- CORE_CC_REG(base, pmucapabilities));
  12431. ++ CORE_CC_REG(pmu->base, pmucapabilities));
  12432. + pub->pmurev = val & PCAP_REV_MASK;
  12433. + pub->pmucaps = val;
  12434. + }
  12435. +@@ -1131,6 +1133,23 @@ struct brcmf_core *brcmf_chip_get_chipco
  12436. + return &cc->pub;
  12437. + }
  12438. +
  12439. ++struct brcmf_core *brcmf_chip_get_pmu(struct brcmf_chip *pub)
  12440. ++{
  12441. ++ struct brcmf_core *cc = brcmf_chip_get_chipcommon(pub);
  12442. ++ struct brcmf_core *pmu;
  12443. ++
  12444. ++ /* See if there is separated PMU core available */
  12445. ++ if (cc->rev >= 35 &&
  12446. ++ pub->cc_caps_ext & BCMA_CC_CAP_EXT_AOB_PRESENT) {
  12447. ++ pmu = brcmf_chip_get_core(pub, BCMA_CORE_PMU);
  12448. ++ if (pmu)
  12449. ++ return pmu;
  12450. ++ }
  12451. ++
  12452. ++ /* Fallback to ChipCommon core for older hardware */
  12453. ++ return cc;
  12454. ++}
  12455. ++
  12456. + bool brcmf_chip_iscoreup(struct brcmf_core *pub)
  12457. + {
  12458. + struct brcmf_core_priv *core;
  12459. +@@ -1301,6 +1320,7 @@ bool brcmf_chip_sr_capable(struct brcmf_
  12460. + {
  12461. + u32 base, addr, reg, pmu_cc3_mask = ~0;
  12462. + struct brcmf_chip_priv *chip;
  12463. ++ struct brcmf_core *pmu = brcmf_chip_get_pmu(pub);
  12464. +
  12465. + brcmf_dbg(TRACE, "Enter\n");
  12466. +
  12467. +@@ -1320,9 +1340,9 @@ bool brcmf_chip_sr_capable(struct brcmf_
  12468. + case BRCM_CC_4335_CHIP_ID:
  12469. + case BRCM_CC_4339_CHIP_ID:
  12470. + /* read PMU chipcontrol register 3 */
  12471. +- addr = CORE_CC_REG(base, chipcontrol_addr);
  12472. ++ addr = CORE_CC_REG(pmu->base, chipcontrol_addr);
  12473. + chip->ops->write32(chip->ctx, addr, 3);
  12474. +- addr = CORE_CC_REG(base, chipcontrol_data);
  12475. ++ addr = CORE_CC_REG(pmu->base, chipcontrol_data);
  12476. + reg = chip->ops->read32(chip->ctx, addr);
  12477. + return (reg & pmu_cc3_mask) != 0;
  12478. + case BRCM_CC_43430_CHIP_ID:
  12479. +@@ -1330,12 +1350,12 @@ bool brcmf_chip_sr_capable(struct brcmf_
  12480. + reg = chip->ops->read32(chip->ctx, addr);
  12481. + return reg != 0;
  12482. + default:
  12483. +- addr = CORE_CC_REG(base, pmucapabilities_ext);
  12484. ++ addr = CORE_CC_REG(pmu->base, pmucapabilities_ext);
  12485. + reg = chip->ops->read32(chip->ctx, addr);
  12486. + if ((reg & PCAPEXT_SR_SUPPORTED_MASK) == 0)
  12487. + return false;
  12488. +
  12489. +- addr = CORE_CC_REG(base, retention_ctl);
  12490. ++ addr = CORE_CC_REG(pmu->base, retention_ctl);
  12491. + reg = chip->ops->read32(chip->ctx, addr);
  12492. + return (reg & (PMU_RCTL_MACPHY_DISABLE_MASK |
  12493. + PMU_RCTL_LOGIC_DISABLE_MASK)) == 0;
  12494. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  12495. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  12496. +@@ -85,6 +85,7 @@ struct brcmf_chip *brcmf_chip_attach(voi
  12497. + void brcmf_chip_detach(struct brcmf_chip *chip);
  12498. + struct brcmf_core *brcmf_chip_get_core(struct brcmf_chip *chip, u16 coreid);
  12499. + struct brcmf_core *brcmf_chip_get_chipcommon(struct brcmf_chip *chip);
  12500. ++struct brcmf_core *brcmf_chip_get_pmu(struct brcmf_chip *pub);
  12501. + bool brcmf_chip_iscoreup(struct brcmf_core *core);
  12502. + void brcmf_chip_coredisable(struct brcmf_core *core, u32 prereset, u32 reset);
  12503. + void brcmf_chip_resetcore(struct brcmf_core *core, u32 prereset, u32 reset,
  12504. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  12505. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  12506. +@@ -3615,7 +3615,6 @@ brcmf_sdio_drivestrengthinit(struct brcm
  12507. + const struct sdiod_drive_str *str_tab = NULL;
  12508. + u32 str_mask;
  12509. + u32 str_shift;
  12510. +- u32 base;
  12511. + u32 i;
  12512. + u32 drivestrength_sel = 0;
  12513. + u32 cc_data_temp;
  12514. +@@ -3658,14 +3657,15 @@ brcmf_sdio_drivestrengthinit(struct brcm
  12515. + }
  12516. +
  12517. + if (str_tab != NULL) {
  12518. ++ struct brcmf_core *pmu = brcmf_chip_get_pmu(ci);
  12519. ++
  12520. + for (i = 0; str_tab[i].strength != 0; i++) {
  12521. + if (drivestrength >= str_tab[i].strength) {
  12522. + drivestrength_sel = str_tab[i].sel;
  12523. + break;
  12524. + }
  12525. + }
  12526. +- base = brcmf_chip_get_chipcommon(ci)->base;
  12527. +- addr = CORE_CC_REG(base, chipcontrol_addr);
  12528. ++ addr = CORE_CC_REG(pmu->base, chipcontrol_addr);
  12529. + brcmf_sdiod_regwl(sdiodev, addr, 1, NULL);
  12530. + cc_data_temp = brcmf_sdiod_regrl(sdiodev, addr, NULL);
  12531. + cc_data_temp &= ~str_mask;
  12532. +@@ -3835,8 +3835,7 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
  12533. + goto fail;
  12534. +
  12535. + /* set PMUControl so a backplane reset does PMU state reload */
  12536. +- reg_addr = CORE_CC_REG(brcmf_chip_get_chipcommon(bus->ci)->base,
  12537. +- pmucontrol);
  12538. ++ reg_addr = CORE_CC_REG(brcmf_chip_get_pmu(bus->ci)->base, pmucontrol);
  12539. + reg_val = brcmf_sdiod_regrl(bus->sdiodev, reg_addr, &err);
  12540. + if (err)
  12541. + goto fail;
  12542. 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
  12543. new file mode 100644
  12544. index 0000000..35887fc
  12545. --- /dev/null
  12546. +++ b/package/kernel/mac80211/patches/323-0005-brcmfmac-add-support-for-14e4-4365-PCI-ID-with-BCM43.patch
  12547. @@ -0,0 +1,38 @@
  12548. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  12549. +Date: Tue, 26 Jan 2016 17:57:05 +0100
  12550. +Subject: [PATCH] brcmfmac: add support for 14e4:4365 PCI ID with BCM4366
  12551. + chipset
  12552. +MIME-Version: 1.0
  12553. +Content-Type: text/plain; charset=UTF-8
  12554. +Content-Transfer-Encoding: 8bit
  12555. +
  12556. +On Broadcom ARM routers BCM4366 cards are available with 14e4:4365 ID.
  12557. +Unfortunately this ID was already used by Broadcom for cards with
  12558. +BCM43142, a totally different chipset requiring SoftMAC driver. To avoid
  12559. +a conflict between brcmfmac and bcma use more specific ID entry with
  12560. +subvendor and subdevice specified.
  12561. +
  12562. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  12563. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12564. +---
  12565. +
  12566. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  12567. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  12568. +@@ -1951,6 +1951,9 @@ static const struct dev_pm_ops brcmf_pci
  12569. +
  12570. + #define BRCMF_PCIE_DEVICE(dev_id) { BRCM_PCIE_VENDOR_ID_BROADCOM, dev_id,\
  12571. + PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 }
  12572. ++#define BRCMF_PCIE_DEVICE_SUB(dev_id, subvend, subdev) { \
  12573. ++ BRCM_PCIE_VENDOR_ID_BROADCOM, dev_id,\
  12574. ++ subvend, subdev, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 }
  12575. +
  12576. + static struct pci_device_id brcmf_pcie_devid_table[] = {
  12577. + BRCMF_PCIE_DEVICE(BRCM_PCIE_4350_DEVICE_ID),
  12578. +@@ -1966,6 +1969,7 @@ static struct pci_device_id brcmf_pcie_d
  12579. + BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_DEVICE_ID),
  12580. + BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_2G_DEVICE_ID),
  12581. + BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_5G_DEVICE_ID),
  12582. ++ BRCMF_PCIE_DEVICE_SUB(0x4365, BRCM_PCIE_VENDOR_ID_BROADCOM, 0x4365),
  12583. + BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_DEVICE_ID),
  12584. + BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_2G_DEVICE_ID),
  12585. + BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_5G_DEVICE_ID),
  12586. 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
  12587. deleted file mode 100644
  12588. index 246bb9d..0000000
  12589. --- a/package/kernel/mac80211/patches/323-ath9k-add-multi_read-to-be-compatible-with-ath9k_htc.patch
  12590. +++ /dev/null
  12591. @@ -1,35 +0,0 @@
  12592. -From: Oleksij Rempel <linux@rempel-privat.de>
  12593. -Date: Sun, 22 Mar 2015 19:29:50 +0100
  12594. -Subject: [PATCH] ath9k: add multi_read to be compatible with ath9k_htc
  12595. -
  12596. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12597. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12598. ----
  12599. -
  12600. ---- a/drivers/net/wireless/ath/ath9k/init.c
  12601. -+++ b/drivers/net/wireless/ath/ath9k/init.c
  12602. -@@ -141,6 +141,16 @@ static unsigned int ath9k_ioread32(void
  12603. - return val;
  12604. - }
  12605. -
  12606. -+static void ath9k_multi_ioread32(void *hw_priv, u32 *addr,
  12607. -+ u32 *val, u16 count)
  12608. -+{
  12609. -+ int i;
  12610. -+
  12611. -+ for (i = 0; i < count; i++)
  12612. -+ val[i] = ath9k_ioread32(hw_priv, addr[i]);
  12613. -+}
  12614. -+
  12615. -+
  12616. - static unsigned int __ath9k_reg_rmw(struct ath_softc *sc, u32 reg_offset,
  12617. - u32 set, u32 clr)
  12618. - {
  12619. -@@ -530,6 +540,7 @@ static int ath9k_init_softc(u16 devid, s
  12620. - ah->hw = sc->hw;
  12621. - ah->hw_version.devid = devid;
  12622. - ah->reg_ops.read = ath9k_ioread32;
  12623. -+ ah->reg_ops.multi_read = ath9k_multi_ioread32;
  12624. - ah->reg_ops.write = ath9k_iowrite32;
  12625. - ah->reg_ops.rmw = ath9k_reg_rmw;
  12626. - pCap = &ah->caps;
  12627. 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
  12628. deleted file mode 100644
  12629. index 2eda1c9..0000000
  12630. --- a/package/kernel/mac80211/patches/324-ath9k-add-new-function-ath9k_hw_read_array.patch
  12631. +++ /dev/null
  12632. @@ -1,69 +0,0 @@
  12633. -From: Oleksij Rempel <linux@rempel-privat.de>
  12634. -Date: Sun, 22 Mar 2015 19:29:51 +0100
  12635. -Subject: [PATCH] ath9k: add new function ath9k_hw_read_array
  12636. -
  12637. -REG_READ generate most overhead on usb bus. It send and read micro packages
  12638. -and reduce usb bandwidth. To reduce this overhead we should read in batches.
  12639. -
  12640. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12641. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12642. ----
  12643. -
  12644. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  12645. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  12646. -@@ -121,6 +121,36 @@ void ath9k_hw_write_array(struct ath_hw
  12647. - REGWRITE_BUFFER_FLUSH(ah);
  12648. - }
  12649. -
  12650. -+void ath9k_hw_read_array(struct ath_hw *ah, u32 array[][2], int size)
  12651. -+{
  12652. -+ u32 *tmp_reg_list, *tmp_data;
  12653. -+ int i;
  12654. -+
  12655. -+ tmp_reg_list = kmalloc(size * sizeof(u32), GFP_KERNEL);
  12656. -+ if (!tmp_reg_list) {
  12657. -+ dev_err(ah->dev, "%s: tmp_reg_list: alloc filed\n", __func__);
  12658. -+ return;
  12659. -+ }
  12660. -+
  12661. -+ tmp_data = kmalloc(size * sizeof(u32), GFP_KERNEL);
  12662. -+ if (!tmp_data) {
  12663. -+ dev_err(ah->dev, "%s tmp_data: alloc filed\n", __func__);
  12664. -+ goto error_tmp_data;
  12665. -+ }
  12666. -+
  12667. -+ for (i = 0; i < size; i++)
  12668. -+ tmp_reg_list[i] = array[i][0];
  12669. -+
  12670. -+ REG_READ_MULTI(ah, tmp_reg_list, tmp_data, size);
  12671. -+
  12672. -+ for (i = 0; i < size; i++)
  12673. -+ array[i][1] = tmp_data[i];
  12674. -+
  12675. -+ kfree(tmp_data);
  12676. -+error_tmp_data:
  12677. -+ kfree(tmp_reg_list);
  12678. -+}
  12679. -+
  12680. - u32 ath9k_hw_reverse_bits(u32 val, u32 n)
  12681. - {
  12682. - u32 retval;
  12683. ---- a/drivers/net/wireless/ath/ath9k/hw.h
  12684. -+++ b/drivers/net/wireless/ath/ath9k/hw.h
  12685. -@@ -138,6 +138,8 @@
  12686. -
  12687. - #define REG_WRITE_ARRAY(iniarray, column, regWr) \
  12688. - ath9k_hw_write_array(ah, iniarray, column, &(regWr))
  12689. -+#define REG_READ_ARRAY(ah, array, size) \
  12690. -+ ath9k_hw_read_array(ah, array, size)
  12691. -
  12692. - #define AR_GPIO_OUTPUT_MUX_AS_OUTPUT 0
  12693. - #define AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED 1
  12694. -@@ -1020,6 +1022,7 @@ void ath9k_hw_synth_delay(struct ath_hw
  12695. - bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout);
  12696. - void ath9k_hw_write_array(struct ath_hw *ah, const struct ar5416IniArray *array,
  12697. - int column, unsigned int *writecnt);
  12698. -+void ath9k_hw_read_array(struct ath_hw *ah, u32 array[][2], int size);
  12699. - u32 ath9k_hw_reverse_bits(u32 val, u32 n);
  12700. - u16 ath9k_hw_computetxtime(struct ath_hw *ah,
  12701. - u8 phy, int kbps,
  12702. 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
  12703. new file mode 100644
  12704. index 0000000..6ce60f1
  12705. --- /dev/null
  12706. +++ b/package/kernel/mac80211/patches/324-brcmfmac-treat-NULL-character-in-NVRAM-as-separator.patch
  12707. @@ -0,0 +1,32 @@
  12708. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  12709. +Date: Sun, 31 Jan 2016 12:14:34 +0100
  12710. +Subject: [PATCH] brcmfmac: treat NULL character in NVRAM as separator
  12711. +MIME-Version: 1.0
  12712. +Content-Type: text/plain; charset=UTF-8
  12713. +Content-Transfer-Encoding: 8bit
  12714. +
  12715. +Platform NVRAM (stored on a flash partition) has entries separated by a
  12716. +NULL (\0) char. Our parsing code switches from VALUE state to IDLE
  12717. +whenever it meets a NULL (\0). When that happens our IDLE handler should
  12718. +simply consume it and analyze whatever is placed ahead.
  12719. +
  12720. +This fixes harmless warnings spamming debugging output:
  12721. +[ 155.165624] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=20: ignoring invalid character
  12722. +[ 155.180806] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=44: ignoring invalid character
  12723. +[ 155.195971] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=63: ignoring invalid character
  12724. +
  12725. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  12726. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12727. +---
  12728. +
  12729. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  12730. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  12731. +@@ -93,7 +93,7 @@ static enum nvram_parser_state brcmf_nvr
  12732. + c = nvp->data[nvp->pos];
  12733. + if (c == '\n')
  12734. + return COMMENT;
  12735. +- if (is_whitespace(c))
  12736. ++ if (is_whitespace(c) || c == '\0')
  12737. + goto proceed;
  12738. + if (c == '#')
  12739. + return COMMENT;
  12740. 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
  12741. deleted file mode 100644
  12742. index 4e4888f..0000000
  12743. --- a/package/kernel/mac80211/patches/325-ath9k-ar9271_hw_pa_cal-use-REG_READ_ARRAY.patch
  12744. +++ /dev/null
  12745. @@ -1,24 +0,0 @@
  12746. -From: Oleksij Rempel <linux@rempel-privat.de>
  12747. -Date: Sun, 22 Mar 2015 19:29:52 +0100
  12748. -Subject: [PATCH] ath9k: ar9271_hw_pa_cal: use REG_READ_ARRAY
  12749. -
  12750. -insted of reading each register separatly
  12751. -and waste 4ms on each operation, we can
  12752. -use one shot read.
  12753. -
  12754. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12755. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12756. ----
  12757. -
  12758. ---- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  12759. -+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  12760. -@@ -440,8 +440,7 @@ static void ar9271_hw_pa_cal(struct ath_
  12761. - { AR9285_AN_RF2G3, 0 },
  12762. - };
  12763. -
  12764. -- for (i = 0; i < ARRAY_SIZE(regList); i++)
  12765. -- regList[i][1] = REG_READ(ah, regList[i][0]);
  12766. -+ REG_READ_ARRAY(ah, regList, ARRAY_SIZE(regList));
  12767. -
  12768. - ENABLE_REG_RMW_BUFFER(ah);
  12769. - /* 7834, b1=0 */
  12770. 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
  12771. new file mode 100644
  12772. index 0000000..012dea1
  12773. --- /dev/null
  12774. +++ b/package/kernel/mac80211/patches/325-brcmfmac-sdio-Increase-the-default-timeouts-a-bit.patch
  12775. @@ -0,0 +1,41 @@
  12776. +From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
  12777. +Date: Mon, 25 Jan 2016 11:47:29 +0100
  12778. +Subject: [PATCH] brcmfmac: sdio: Increase the default timeouts a bit
  12779. +
  12780. +On a Radxa Rock2 board with a Ampak AP6335 (Broadcom 4339 core) it seems
  12781. +the card responds very quickly most of the time, unfortunately during
  12782. +initialisation it sometimes seems to take just a bit over 2 seconds to
  12783. +respond.
  12784. +
  12785. +This results intialization failing with message like:
  12786. + brcmf_c_preinit_dcmds: Retreiving cur_etheraddr failed, -52
  12787. + brcmf_bus_start: failed: -52
  12788. + brcmf_sdio_firmware_callback: dongle is not responding
  12789. +
  12790. +Increasing the timeout to allow for a bit more headroom allows the
  12791. +card to initialize reliably.
  12792. +
  12793. +A quick search online after diagnosing/fixing this showed that Google
  12794. +has a similar patch in their ChromeOS tree, so this doesn't seem
  12795. +specific to the board I'm using.
  12796. +
  12797. +Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
  12798. +Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
  12799. +Acked-by: Arend van Spriel <arend@broadcom.com>
  12800. +Reviewed-by: Douglas Anderson <dianders@chromium.org>
  12801. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12802. +---
  12803. +
  12804. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  12805. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  12806. +@@ -45,8 +45,8 @@
  12807. + #include "chip.h"
  12808. + #include "firmware.h"
  12809. +
  12810. +-#define DCMD_RESP_TIMEOUT msecs_to_jiffies(2000)
  12811. +-#define CTL_DONE_TIMEOUT msecs_to_jiffies(2000)
  12812. ++#define DCMD_RESP_TIMEOUT msecs_to_jiffies(2500)
  12813. ++#define CTL_DONE_TIMEOUT msecs_to_jiffies(2500)
  12814. +
  12815. + #ifdef DEBUG
  12816. +
  12817. 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
  12818. new file mode 100644
  12819. index 0000000..71f7a40
  12820. --- /dev/null
  12821. +++ b/package/kernel/mac80211/patches/326-ath9k-make-NF-load-complete-quickly-and-reliably.patch
  12822. @@ -0,0 +1,87 @@
  12823. +From: Miaoqing Pan <miaoqing@codeaurora.org>
  12824. +Date: Fri, 5 Feb 2016 09:45:50 +0800
  12825. +Subject: [PATCH] ath9k: make NF load complete quickly and reliably
  12826. +
  12827. +Make NF load complete quickly and reliably. NF load execution
  12828. +is delayed by HW to end of frame if frame Rx or Tx is ongoing.
  12829. +Increasing timeout to max frame duration. If NF cal is ongoing
  12830. +before NF load, stop it before load, and restart it afterwards.
  12831. +
  12832. +Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  12833. +---
  12834. +
  12835. +--- a/drivers/net/wireless/ath/ath9k/calib.c
  12836. ++++ b/drivers/net/wireless/ath/ath9k/calib.c
  12837. +@@ -241,6 +241,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  12838. + u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask;
  12839. + struct ath_common *common = ath9k_hw_common(ah);
  12840. + s16 default_nf = ath9k_hw_get_default_nf(ah, chan);
  12841. ++ u32 bb_agc_ctl = REG_READ(ah, AR_PHY_AGC_CONTROL);
  12842. +
  12843. + if (ah->caldata)
  12844. + h = ah->caldata->nfCalHist;
  12845. +@@ -264,6 +265,16 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  12846. + }
  12847. +
  12848. + /*
  12849. ++ * stop NF cal if ongoing to ensure NF load completes immediately
  12850. ++ * (or after end rx/tx frame if ongoing)
  12851. ++ */
  12852. ++ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NF) {
  12853. ++ REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
  12854. ++ REG_RMW_BUFFER_FLUSH(ah);
  12855. ++ ENABLE_REG_RMW_BUFFER(ah);
  12856. ++ }
  12857. ++
  12858. ++ /*
  12859. + * Load software filtered NF value into baseband internal minCCApwr
  12860. + * variable.
  12861. + */
  12862. +@@ -276,18 +287,33 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  12863. +
  12864. + /*
  12865. + * Wait for load to complete, should be fast, a few 10s of us.
  12866. +- * The max delay was changed from an original 250us to 10000us
  12867. +- * since 250us often results in NF load timeout and causes deaf
  12868. +- * condition during stress testing 12/12/2009
  12869. ++ * The max delay was changed from an original 250us to 22.2 msec.
  12870. ++ * This would increase timeout to the longest possible frame
  12871. ++ * (11n max length 22.1 msec)
  12872. + */
  12873. +- for (j = 0; j < 10000; j++) {
  12874. ++ for (j = 0; j < 22200; j++) {
  12875. + if ((REG_READ(ah, AR_PHY_AGC_CONTROL) &
  12876. +- AR_PHY_AGC_CONTROL_NF) == 0)
  12877. ++ AR_PHY_AGC_CONTROL_NF) == 0)
  12878. + break;
  12879. + udelay(10);
  12880. + }
  12881. +
  12882. + /*
  12883. ++ * Restart NF so it can continue.
  12884. ++ */
  12885. ++ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NF) {
  12886. ++ ENABLE_REG_RMW_BUFFER(ah);
  12887. ++ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_ENABLE_NF)
  12888. ++ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
  12889. ++ AR_PHY_AGC_CONTROL_ENABLE_NF);
  12890. ++ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NO_UPDATE_NF)
  12891. ++ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
  12892. ++ AR_PHY_AGC_CONTROL_NO_UPDATE_NF);
  12893. ++ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
  12894. ++ REG_RMW_BUFFER_FLUSH(ah);
  12895. ++ }
  12896. ++
  12897. ++ /*
  12898. + * We timed out waiting for the noisefloor to load, probably due to an
  12899. + * in-progress rx. Simply return here and allow the load plenty of time
  12900. + * to complete before the next calibration interval. We need to avoid
  12901. +@@ -296,7 +322,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  12902. + * here, the baseband nf cal will just be capped by our present
  12903. + * noisefloor until the next calibration timer.
  12904. + */
  12905. +- if (j == 10000) {
  12906. ++ if (j == 22200) {
  12907. + ath_dbg(common, ANY,
  12908. + "Timeout while waiting for nf to load: AR_PHY_AGC_CONTROL=0x%x\n",
  12909. + REG_READ(ah, AR_PHY_AGC_CONTROL));
  12910. 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
  12911. deleted file mode 100644
  12912. index a22cd1d..0000000
  12913. --- a/package/kernel/mac80211/patches/326-ath9k-use-one-shot-read-in-ath9k_hw_update_mibstats.patch
  12914. +++ /dev/null
  12915. @@ -1,39 +0,0 @@
  12916. -From: Oleksij Rempel <linux@rempel-privat.de>
  12917. -Date: Sun, 22 Mar 2015 19:29:53 +0100
  12918. -Subject: [PATCH] ath9k: use one shot read in ath9k_hw_update_mibstats
  12919. -
  12920. -this will reduce some overhead on usb bus.
  12921. -
  12922. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12923. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12924. ----
  12925. -
  12926. ---- a/drivers/net/wireless/ath/ath9k/ani.c
  12927. -+++ b/drivers/net/wireless/ath/ath9k/ani.c
  12928. -@@ -107,11 +107,21 @@ static const struct ani_cck_level_entry
  12929. - static void ath9k_hw_update_mibstats(struct ath_hw *ah,
  12930. - struct ath9k_mib_stats *stats)
  12931. - {
  12932. -- stats->ackrcv_bad += REG_READ(ah, AR_ACK_FAIL);
  12933. -- stats->rts_bad += REG_READ(ah, AR_RTS_FAIL);
  12934. -- stats->fcs_bad += REG_READ(ah, AR_FCS_FAIL);
  12935. -- stats->rts_good += REG_READ(ah, AR_RTS_OK);
  12936. -- stats->beacons += REG_READ(ah, AR_BEACON_CNT);
  12937. -+ u32 addr[5] = {AR_RTS_OK, AR_RTS_FAIL, AR_ACK_FAIL,
  12938. -+ AR_FCS_FAIL, AR_BEACON_CNT};
  12939. -+ u32 data[5];
  12940. -+
  12941. -+ REG_READ_MULTI(ah, &addr[0], &data[0], 5);
  12942. -+ /* AR_RTS_OK */
  12943. -+ stats->rts_good += data[0];
  12944. -+ /* AR_RTS_FAIL */
  12945. -+ stats->rts_bad += data[1];
  12946. -+ /* AR_ACK_FAIL */
  12947. -+ stats->ackrcv_bad += data[2];
  12948. -+ /* AR_FCS_FAIL */
  12949. -+ stats->fcs_bad += data[3];
  12950. -+ /* AR_BEACON_CNT */
  12951. -+ stats->beacons += data[4];
  12952. - }
  12953. -
  12954. - static void ath9k_ani_restart(struct ath_hw *ah)
  12955. 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
  12956. deleted file mode 100644
  12957. index e5a362f..0000000
  12958. --- a/package/kernel/mac80211/patches/327-ath9k-ath9k_hw_loadnf-use-REG_RMW.patch
  12959. +++ /dev/null
  12960. @@ -1,71 +0,0 @@
  12961. -From: Oleksij Rempel <linux@rempel-privat.de>
  12962. -Date: Sun, 22 Mar 2015 19:29:54 +0100
  12963. -Subject: [PATCH] ath9k: ath9k_hw_loadnf: use REG_RMW
  12964. -
  12965. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12966. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12967. ----
  12968. -
  12969. ---- a/drivers/net/wireless/ath/ath9k/calib.c
  12970. -+++ b/drivers/net/wireless/ath/ath9k/calib.c
  12971. -@@ -238,7 +238,6 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  12972. - {
  12973. - struct ath9k_nfcal_hist *h = NULL;
  12974. - unsigned i, j;
  12975. -- int32_t val;
  12976. - u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask;
  12977. - struct ath_common *common = ath9k_hw_common(ah);
  12978. - s16 default_nf = ath9k_hw_get_default_nf(ah, chan);
  12979. -@@ -246,6 +245,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  12980. - if (ah->caldata)
  12981. - h = ah->caldata->nfCalHist;
  12982. -
  12983. -+ ENABLE_REG_RMW_BUFFER(ah);
  12984. - for (i = 0; i < NUM_NF_READINGS; i++) {
  12985. - if (chainmask & (1 << i)) {
  12986. - s16 nfval;
  12987. -@@ -258,10 +258,8 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  12988. - else
  12989. - nfval = default_nf;
  12990. -
  12991. -- val = REG_READ(ah, ah->nf_regs[i]);
  12992. -- val &= 0xFFFFFE00;
  12993. -- val |= (((u32) nfval << 1) & 0x1ff);
  12994. -- REG_WRITE(ah, ah->nf_regs[i], val);
  12995. -+ REG_RMW(ah, ah->nf_regs[i],
  12996. -+ (((u32) nfval << 1) & 0x1ff), 0x1ff);
  12997. - }
  12998. - }
  12999. -
  13000. -@@ -274,6 +272,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  13001. - REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL,
  13002. - AR_PHY_AGC_CONTROL_NO_UPDATE_NF);
  13003. - REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
  13004. -+ REG_RMW_BUFFER_FLUSH(ah);
  13005. -
  13006. - /*
  13007. - * Wait for load to complete, should be fast, a few 10s of us.
  13008. -@@ -309,19 +308,17 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  13009. - * by the median we just loaded. This will be initial (and max) value
  13010. - * of next noise floor calibration the baseband does.
  13011. - */
  13012. -- ENABLE_REGWRITE_BUFFER(ah);
  13013. -+ ENABLE_REG_RMW_BUFFER(ah);
  13014. - for (i = 0; i < NUM_NF_READINGS; i++) {
  13015. - if (chainmask & (1 << i)) {
  13016. - if ((i >= AR5416_MAX_CHAINS) && !IS_CHAN_HT40(chan))
  13017. - continue;
  13018. -
  13019. -- val = REG_READ(ah, ah->nf_regs[i]);
  13020. -- val &= 0xFFFFFE00;
  13021. -- val |= (((u32) (-50) << 1) & 0x1ff);
  13022. -- REG_WRITE(ah, ah->nf_regs[i], val);
  13023. -+ REG_RMW(ah, ah->nf_regs[i],
  13024. -+ (((u32) (-50) << 1) & 0x1ff), 0x1ff);
  13025. - }
  13026. - }
  13027. -- REGWRITE_BUFFER_FLUSH(ah);
  13028. -+ REG_RMW_BUFFER_FLUSH(ah);
  13029. -
  13030. - return 0;
  13031. - }
  13032. 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
  13033. new file mode 100644
  13034. index 0000000..f7f9df9
  13035. --- /dev/null
  13036. +++ b/package/kernel/mac80211/patches/327-mac80211-Remove-MPP-table-entries-with-MPath.patch
  13037. @@ -0,0 +1,54 @@
  13038. +From: Henning Rogge <hrogge@gmail.com>
  13039. +Date: Wed, 3 Feb 2016 13:58:36 +0100
  13040. +Subject: [PATCH] mac80211: Remove MPP table entries with MPath
  13041. +
  13042. +Make the mesh_path_del() function remove all mpp table entries
  13043. +that are proxied by the removed mesh path.
  13044. +
  13045. +Acked-by: Bob Copeland <me@bobcopeland.com>
  13046. +Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
  13047. +Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  13048. +---
  13049. +
  13050. +--- a/net/mac80211/mesh_pathtbl.c
  13051. ++++ b/net/mac80211/mesh_pathtbl.c
  13052. +@@ -835,6 +835,29 @@ void mesh_path_flush_by_nexthop(struct s
  13053. + rcu_read_unlock();
  13054. + }
  13055. +
  13056. ++static void mpp_flush_by_proxy(struct ieee80211_sub_if_data *sdata,
  13057. ++ const u8 *proxy)
  13058. ++{
  13059. ++ struct mesh_table *tbl;
  13060. ++ struct mesh_path *mpp;
  13061. ++ struct mpath_node *node;
  13062. ++ int i;
  13063. ++
  13064. ++ rcu_read_lock();
  13065. ++ read_lock_bh(&pathtbl_resize_lock);
  13066. ++ tbl = resize_dereference_mpp_paths();
  13067. ++ for_each_mesh_entry(tbl, node, i) {
  13068. ++ mpp = node->mpath;
  13069. ++ if (ether_addr_equal(mpp->mpp, proxy)) {
  13070. ++ spin_lock(&tbl->hashwlock[i]);
  13071. ++ __mesh_path_del(tbl, node);
  13072. ++ spin_unlock(&tbl->hashwlock[i]);
  13073. ++ }
  13074. ++ }
  13075. ++ read_unlock_bh(&pathtbl_resize_lock);
  13076. ++ rcu_read_unlock();
  13077. ++}
  13078. ++
  13079. + static void table_flush_by_iface(struct mesh_table *tbl,
  13080. + struct ieee80211_sub_if_data *sdata)
  13081. + {
  13082. +@@ -892,6 +915,9 @@ int mesh_path_del(struct ieee80211_sub_i
  13083. + int hash_idx;
  13084. + int err = 0;
  13085. +
  13086. ++ /* flush relevant mpp entries first */
  13087. ++ mpp_flush_by_proxy(sdata, addr);
  13088. ++
  13089. + read_lock_bh(&pathtbl_resize_lock);
  13090. + tbl = resize_dereference_mesh_paths();
  13091. + hash_idx = mesh_table_hash(addr, sdata, tbl);
  13092. 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
  13093. deleted file mode 100644
  13094. index 01c8011..0000000
  13095. --- a/package/kernel/mac80211/patches/328-ath9k-write-buffer-related-optimisation-in-ar5008_hw.patch
  13096. +++ /dev/null
  13097. @@ -1,27 +0,0 @@
  13098. -From: Oleksij Rempel <linux@rempel-privat.de>
  13099. -Date: Sun, 22 Mar 2015 19:29:55 +0100
  13100. -Subject: [PATCH] ath9k: write buffer related optimisation in
  13101. - ar5008_hw_set_channel_regs
  13102. -
  13103. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  13104. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13105. ----
  13106. -
  13107. ---- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  13108. -+++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  13109. -@@ -681,12 +681,13 @@ static void ar5008_hw_set_channel_regs(s
  13110. - phymode |= AR_PHY_FC_DYN2040_PRI_CH;
  13111. -
  13112. - }
  13113. -+ ENABLE_REGWRITE_BUFFER(ah);
  13114. - REG_WRITE(ah, AR_PHY_TURBO, phymode);
  13115. -
  13116. -+ /* This function do only REG_WRITE, so
  13117. -+ * we can include it to REGWRITE_BUFFER. */
  13118. - ath9k_hw_set11nmac2040(ah, chan);
  13119. -
  13120. -- ENABLE_REGWRITE_BUFFER(ah);
  13121. --
  13122. - REG_WRITE(ah, AR_GTXTO, 25 << AR_GTXTO_TIMEOUT_LIMIT_S);
  13123. - REG_WRITE(ah, AR_CST, 0xF << AR_CST_TIMEOUT_LIMIT_S);
  13124. -
  13125. 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
  13126. new file mode 100644
  13127. index 0000000..740993c
  13128. --- /dev/null
  13129. +++ b/package/kernel/mac80211/patches/328-mac80211-let-unused-MPP-table-entries-timeout.patch
  13130. @@ -0,0 +1,104 @@
  13131. +From: Henning Rogge <hrogge@gmail.com>
  13132. +Date: Wed, 3 Feb 2016 13:58:37 +0100
  13133. +Subject: [PATCH] mac80211: let unused MPP table entries timeout
  13134. +
  13135. +Remember the last time when a mpp table entry is used for
  13136. +rx or tx and remove them after MESH_PATH_EXPIRE time.
  13137. +
  13138. +Acked-by: Bob Copeland <me@bobcopeland.com>
  13139. +Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
  13140. +Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  13141. +---
  13142. +
  13143. +--- a/net/mac80211/mesh_pathtbl.c
  13144. ++++ b/net/mac80211/mesh_pathtbl.c
  13145. +@@ -942,6 +942,46 @@ enddel:
  13146. + }
  13147. +
  13148. + /**
  13149. ++ * mpp_path_del - delete a mesh proxy path from the table
  13150. ++ *
  13151. ++ * @addr: addr address (ETH_ALEN length)
  13152. ++ * @sdata: local subif
  13153. ++ *
  13154. ++ * Returns: 0 if successful
  13155. ++ */
  13156. ++static int mpp_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  13157. ++{
  13158. ++ struct mesh_table *tbl;
  13159. ++ struct mesh_path *mpath;
  13160. ++ struct mpath_node *node;
  13161. ++ struct hlist_head *bucket;
  13162. ++ int hash_idx;
  13163. ++ int err = 0;
  13164. ++
  13165. ++ read_lock_bh(&pathtbl_resize_lock);
  13166. ++ tbl = resize_dereference_mpp_paths();
  13167. ++ hash_idx = mesh_table_hash(addr, sdata, tbl);
  13168. ++ bucket = &tbl->hash_buckets[hash_idx];
  13169. ++
  13170. ++ spin_lock(&tbl->hashwlock[hash_idx]);
  13171. ++ hlist_for_each_entry(node, bucket, list) {
  13172. ++ mpath = node->mpath;
  13173. ++ if (mpath->sdata == sdata &&
  13174. ++ ether_addr_equal(addr, mpath->dst)) {
  13175. ++ __mesh_path_del(tbl, node);
  13176. ++ goto enddel;
  13177. ++ }
  13178. ++ }
  13179. ++
  13180. ++ err = -ENXIO;
  13181. ++enddel:
  13182. ++ mesh_paths_generation++;
  13183. ++ spin_unlock(&tbl->hashwlock[hash_idx]);
  13184. ++ read_unlock_bh(&pathtbl_resize_lock);
  13185. ++ return err;
  13186. ++}
  13187. ++
  13188. ++/**
  13189. + * mesh_path_tx_pending - sends pending frames in a mesh path queue
  13190. + *
  13191. + * @mpath: mesh path to activate
  13192. +@@ -1157,6 +1197,17 @@ void mesh_path_expire(struct ieee80211_s
  13193. + time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE))
  13194. + mesh_path_del(mpath->sdata, mpath->dst);
  13195. + }
  13196. ++
  13197. ++ tbl = rcu_dereference(mpp_paths);
  13198. ++ for_each_mesh_entry(tbl, node, i) {
  13199. ++ if (node->mpath->sdata != sdata)
  13200. ++ continue;
  13201. ++ mpath = node->mpath;
  13202. ++ if ((!(mpath->flags & MESH_PATH_FIXED)) &&
  13203. ++ time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE))
  13204. ++ mpp_path_del(mpath->sdata, mpath->dst);
  13205. ++ }
  13206. ++
  13207. + rcu_read_unlock();
  13208. + }
  13209. +
  13210. +--- a/net/mac80211/rx.c
  13211. ++++ b/net/mac80211/rx.c
  13212. +@@ -2291,6 +2291,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  13213. + spin_lock_bh(&mppath->state_lock);
  13214. + if (!ether_addr_equal(mppath->mpp, mpp_addr))
  13215. + memcpy(mppath->mpp, mpp_addr, ETH_ALEN);
  13216. ++ mppath->exp_time = jiffies;
  13217. + spin_unlock_bh(&mppath->state_lock);
  13218. + }
  13219. + rcu_read_unlock();
  13220. +--- a/net/mac80211/tx.c
  13221. ++++ b/net/mac80211/tx.c
  13222. +@@ -2171,8 +2171,11 @@ static struct sk_buff *ieee80211_build_h
  13223. + mpp_lookup = true;
  13224. + }
  13225. +
  13226. +- if (mpp_lookup)
  13227. ++ if (mpp_lookup) {
  13228. + mppath = mpp_path_lookup(sdata, skb->data);
  13229. ++ if (mppath)
  13230. ++ mppath->exp_time = jiffies;
  13231. ++ }
  13232. +
  13233. + if (mppath && mpath)
  13234. + mesh_path_del(mpath->sdata, mpath->dst);
  13235. 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
  13236. deleted file mode 100644
  13237. index e5219f2..0000000
  13238. --- a/package/kernel/mac80211/patches/329-ath9k-ath9k_hw_set_4k_power_cal_tabl-use-rmw-buffer.patch
  13239. +++ /dev/null
  13240. @@ -1,26 +0,0 @@
  13241. -From: Oleksij Rempel <linux@rempel-privat.de>
  13242. -Date: Sun, 22 Mar 2015 19:29:56 +0100
  13243. -Subject: [PATCH] ath9k: ath9k_hw_set_4k_power_cal_tabl: use rmw buffer
  13244. -
  13245. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  13246. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13247. ----
  13248. -
  13249. ---- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  13250. -+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  13251. -@@ -389,6 +389,7 @@ static void ath9k_hw_set_4k_power_cal_ta
  13252. - }
  13253. - }
  13254. -
  13255. -+ ENABLE_REG_RMW_BUFFER(ah);
  13256. - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_NUM_PD_GAIN,
  13257. - (numXpdGain - 1) & 0x3);
  13258. - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_1,
  13259. -@@ -396,6 +397,7 @@ static void ath9k_hw_set_4k_power_cal_ta
  13260. - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_2,
  13261. - xpdGainValues[1]);
  13262. - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_3, 0);
  13263. -+ REG_RMW_BUFFER_FLUSH(ah);
  13264. -
  13265. - for (i = 0; i < AR5416_EEP4K_MAX_CHAINS; i++) {
  13266. - regChainOffset = i * 0x1000;
  13267. 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
  13268. new file mode 100644
  13269. index 0000000..0c36b1d
  13270. --- /dev/null
  13271. +++ b/package/kernel/mac80211/patches/329-mac80211-Unify-mesh-and-mpp-path-removal-function.patch
  13272. @@ -0,0 +1,143 @@
  13273. +From: Henning Rogge <hrogge@gmail.com>
  13274. +Date: Wed, 3 Feb 2016 13:58:38 +0100
  13275. +Subject: [PATCH] mac80211: Unify mesh and mpp path removal function
  13276. +
  13277. +mpp_path_del() and mesh_path_del() are mostly the same function.
  13278. +Move common code into a new static function.
  13279. +
  13280. +Acked-by: Bob Copeland <me@bobcopeland.com>
  13281. +Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
  13282. +Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  13283. +---
  13284. +
  13285. +--- a/net/mac80211/mesh_pathtbl.c
  13286. ++++ b/net/mac80211/mesh_pathtbl.c
  13287. +@@ -55,16 +55,21 @@ int mpp_paths_generation;
  13288. + static DEFINE_RWLOCK(pathtbl_resize_lock);
  13289. +
  13290. +
  13291. ++static inline struct mesh_table *resize_dereference_paths(
  13292. ++ struct mesh_table __rcu *table)
  13293. ++{
  13294. ++ return rcu_dereference_protected(table,
  13295. ++ lockdep_is_held(&pathtbl_resize_lock));
  13296. ++}
  13297. ++
  13298. + static inline struct mesh_table *resize_dereference_mesh_paths(void)
  13299. + {
  13300. +- return rcu_dereference_protected(mesh_paths,
  13301. +- lockdep_is_held(&pathtbl_resize_lock));
  13302. ++ return resize_dereference_paths(mesh_paths);
  13303. + }
  13304. +
  13305. + static inline struct mesh_table *resize_dereference_mpp_paths(void)
  13306. + {
  13307. +- return rcu_dereference_protected(mpp_paths,
  13308. +- lockdep_is_held(&pathtbl_resize_lock));
  13309. ++ return resize_dereference_paths(mpp_paths);
  13310. + }
  13311. +
  13312. + /*
  13313. +@@ -899,14 +904,17 @@ void mesh_path_flush_by_iface(struct iee
  13314. + }
  13315. +
  13316. + /**
  13317. +- * mesh_path_del - delete a mesh path from the table
  13318. ++ * table_path_del - delete a path from the mesh or mpp table
  13319. + *
  13320. +- * @addr: dst address (ETH_ALEN length)
  13321. ++ * @tbl: mesh or mpp path table
  13322. + * @sdata: local subif
  13323. ++ * @addr: dst address (ETH_ALEN length)
  13324. + *
  13325. + * Returns: 0 if successful
  13326. + */
  13327. +-int mesh_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  13328. ++static int table_path_del(struct mesh_table __rcu *rcu_tbl,
  13329. ++ struct ieee80211_sub_if_data *sdata,
  13330. ++ const u8 *addr)
  13331. + {
  13332. + struct mesh_table *tbl;
  13333. + struct mesh_path *mpath;
  13334. +@@ -915,11 +923,7 @@ int mesh_path_del(struct ieee80211_sub_i
  13335. + int hash_idx;
  13336. + int err = 0;
  13337. +
  13338. +- /* flush relevant mpp entries first */
  13339. +- mpp_flush_by_proxy(sdata, addr);
  13340. +-
  13341. +- read_lock_bh(&pathtbl_resize_lock);
  13342. +- tbl = resize_dereference_mesh_paths();
  13343. ++ tbl = resize_dereference_paths(rcu_tbl);
  13344. + hash_idx = mesh_table_hash(addr, sdata, tbl);
  13345. + bucket = &tbl->hash_buckets[hash_idx];
  13346. +
  13347. +@@ -935,9 +939,30 @@ int mesh_path_del(struct ieee80211_sub_i
  13348. +
  13349. + err = -ENXIO;
  13350. + enddel:
  13351. +- mesh_paths_generation++;
  13352. + spin_unlock(&tbl->hashwlock[hash_idx]);
  13353. ++ return err;
  13354. ++}
  13355. ++
  13356. ++/**
  13357. ++ * mesh_path_del - delete a mesh path from the table
  13358. ++ *
  13359. ++ * @addr: dst address (ETH_ALEN length)
  13360. ++ * @sdata: local subif
  13361. ++ *
  13362. ++ * Returns: 0 if successful
  13363. ++ */
  13364. ++int mesh_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  13365. ++{
  13366. ++ int err = 0;
  13367. ++
  13368. ++ /* flush relevant mpp entries first */
  13369. ++ mpp_flush_by_proxy(sdata, addr);
  13370. ++
  13371. ++ read_lock_bh(&pathtbl_resize_lock);
  13372. ++ err = table_path_del(mesh_paths, sdata, addr);
  13373. ++ mesh_paths_generation++;
  13374. + read_unlock_bh(&pathtbl_resize_lock);
  13375. ++
  13376. + return err;
  13377. + }
  13378. +
  13379. +@@ -951,33 +976,13 @@ enddel:
  13380. + */
  13381. + static int mpp_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  13382. + {
  13383. +- struct mesh_table *tbl;
  13384. +- struct mesh_path *mpath;
  13385. +- struct mpath_node *node;
  13386. +- struct hlist_head *bucket;
  13387. +- int hash_idx;
  13388. + int err = 0;
  13389. +
  13390. + read_lock_bh(&pathtbl_resize_lock);
  13391. +- tbl = resize_dereference_mpp_paths();
  13392. +- hash_idx = mesh_table_hash(addr, sdata, tbl);
  13393. +- bucket = &tbl->hash_buckets[hash_idx];
  13394. +-
  13395. +- spin_lock(&tbl->hashwlock[hash_idx]);
  13396. +- hlist_for_each_entry(node, bucket, list) {
  13397. +- mpath = node->mpath;
  13398. +- if (mpath->sdata == sdata &&
  13399. +- ether_addr_equal(addr, mpath->dst)) {
  13400. +- __mesh_path_del(tbl, node);
  13401. +- goto enddel;
  13402. +- }
  13403. +- }
  13404. +-
  13405. +- err = -ENXIO;
  13406. +-enddel:
  13407. +- mesh_paths_generation++;
  13408. +- spin_unlock(&tbl->hashwlock[hash_idx]);
  13409. ++ err = table_path_del(mpp_paths, sdata, addr);
  13410. ++ mpp_paths_generation++;
  13411. + read_unlock_bh(&pathtbl_resize_lock);
  13412. ++
  13413. + return err;
  13414. + }
  13415. +
  13416. 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
  13417. deleted file mode 100644
  13418. index 6ce3f40..0000000
  13419. --- a/package/kernel/mac80211/patches/330-ath9k-use-rmw-buffer-in-ath9k_hw_set_operating_mode-.patch
  13420. +++ /dev/null
  13421. @@ -1,43 +0,0 @@
  13422. -From: Oleksij Rempel <linux@rempel-privat.de>
  13423. -Date: Sun, 22 Mar 2015 19:29:57 +0100
  13424. -Subject: [PATCH] ath9k: use rmw buffer in ath9k_hw_set_operating_mode
  13425. - and ath9k_hw_reset
  13426. -
  13427. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  13428. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13429. ----
  13430. -
  13431. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  13432. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  13433. -@@ -1227,6 +1227,7 @@ static void ath9k_hw_set_operating_mode(
  13434. - u32 mask = AR_STA_ID1_STA_AP | AR_STA_ID1_ADHOC;
  13435. - u32 set = AR_STA_ID1_KSRCH_MODE;
  13436. -
  13437. -+ ENABLE_REG_RMW_BUFFER(ah);
  13438. - switch (opmode) {
  13439. - case NL80211_IFTYPE_ADHOC:
  13440. - if (!AR_SREV_9340_13(ah)) {
  13441. -@@ -1248,6 +1249,7 @@ static void ath9k_hw_set_operating_mode(
  13442. - break;
  13443. - }
  13444. - REG_RMW(ah, AR_STA_ID1, set, mask);
  13445. -+ REG_RMW_BUFFER_FLUSH(ah);
  13446. - }
  13447. -
  13448. - void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled,
  13449. -@@ -1960,6 +1962,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  13450. - if (!ath9k_hw_mci_is_enabled(ah))
  13451. - REG_WRITE(ah, AR_OBS, 8);
  13452. -
  13453. -+ ENABLE_REG_RMW_BUFFER(ah);
  13454. - if (ah->config.rx_intr_mitigation) {
  13455. - REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_LAST, ah->config.rimt_last);
  13456. - REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_FIRST, ah->config.rimt_first);
  13457. -@@ -1969,6 +1972,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  13458. - REG_RMW_FIELD(ah, AR_TIMT, AR_TIMT_LAST, 300);
  13459. - REG_RMW_FIELD(ah, AR_TIMT, AR_TIMT_FIRST, 750);
  13460. - }
  13461. -+ REG_RMW_BUFFER_FLUSH(ah);
  13462. -
  13463. - ath9k_hw_init_bb(ah, chan);
  13464. -
  13465. 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
  13466. new file mode 100644
  13467. index 0000000..4dc6d66
  13468. --- /dev/null
  13469. +++ b/package/kernel/mac80211/patches/330-mac80211-minstrel-Change-expected-throughput-unit-ba.patch
  13470. @@ -0,0 +1,51 @@
  13471. +From: Sven Eckelmann <sven.eckelmann@open-mesh.com>
  13472. +Date: Tue, 2 Feb 2016 08:12:26 +0100
  13473. +Subject: [PATCH] mac80211: minstrel: Change expected throughput unit back to
  13474. + Kbps
  13475. +
  13476. +The change from cur_tp to the function
  13477. +minstrel_get_tp_avg/minstrel_ht_get_tp_avg changed the unit used for the
  13478. +current throughput. For example in minstrel_ht the correct
  13479. +conversion between them would be:
  13480. +
  13481. + mrs->cur_tp / 10 == minstrel_ht_get_tp_avg(..).
  13482. +
  13483. +This factor 10 must also be included in the calculation of
  13484. +minstrel_get_expected_throughput and minstrel_ht_get_expected_throughput to
  13485. +return values with the unit [Kbps] instead of [10Kbps]. Otherwise routing
  13486. +algorithms like B.A.T.M.A.N. V will make incorrect decision based on these
  13487. +values. Its kernel based implementation expects expected_throughput always
  13488. +to have the unit [Kbps] and not sometimes [10Kbps] and sometimes [Kbps].
  13489. +
  13490. +The same requirement has iw or olsrdv2's nl80211 based statistics module
  13491. +which retrieve the same data via NL80211_STA_INFO_TX_BITRATE.
  13492. +
  13493. +Cc: stable@vger.kernel.org
  13494. +Fixes: 6a27b2c40b48 ("mac80211: restructure per-rate throughput calculation into function")
  13495. +Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  13496. +Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  13497. +---
  13498. +
  13499. +--- a/net/mac80211/rc80211_minstrel.c
  13500. ++++ b/net/mac80211/rc80211_minstrel.c
  13501. +@@ -711,7 +711,7 @@ static u32 minstrel_get_expected_through
  13502. + * computing cur_tp
  13503. + */
  13504. + tmp_mrs = &mi->r[idx].stats;
  13505. +- tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma);
  13506. ++ tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma) * 10;
  13507. + tmp_cur_tp = tmp_cur_tp * 1200 * 8 / 1024;
  13508. +
  13509. + return tmp_cur_tp;
  13510. +--- a/net/mac80211/rc80211_minstrel_ht.c
  13511. ++++ b/net/mac80211/rc80211_minstrel_ht.c
  13512. +@@ -1335,7 +1335,8 @@ static u32 minstrel_ht_get_expected_thro
  13513. + prob = mi->groups[i].rates[j].prob_ewma;
  13514. +
  13515. + /* convert tp_avg from pkt per second in kbps */
  13516. +- tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * AVG_PKT_SIZE * 8 / 1024;
  13517. ++ tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * 10;
  13518. ++ tp_avg = tp_avg * AVG_PKT_SIZE * 8 / 1024;
  13519. +
  13520. + return tp_avg;
  13521. + }
  13522. 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
  13523. deleted file mode 100644
  13524. index edd6160..0000000
  13525. --- a/package/kernel/mac80211/patches/331-ath9k-ath9k_hw_4k_set_board_values-use-rmw-buffer.patch
  13526. +++ /dev/null
  13527. @@ -1,26 +0,0 @@
  13528. -From: Oleksij Rempel <linux@rempel-privat.de>
  13529. -Date: Sun, 22 Mar 2015 19:29:58 +0100
  13530. -Subject: [PATCH] ath9k: ath9k_hw_4k_set_board_values: use rmw buffer
  13531. -
  13532. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  13533. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13534. ----
  13535. -
  13536. ---- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  13537. -+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  13538. -@@ -1082,6 +1082,7 @@ static void ath9k_hw_4k_set_board_values
  13539. - mask = BIT(0)|BIT(5)|BIT(10)|BIT(15)|BIT(20)|BIT(25);
  13540. - pwrctrl = mask * bb_desired_scale;
  13541. - clr = mask * 0x1f;
  13542. -+ ENABLE_REG_RMW_BUFFER(ah);
  13543. - REG_RMW(ah, AR_PHY_TX_PWRCTRL8, pwrctrl, clr);
  13544. - REG_RMW(ah, AR_PHY_TX_PWRCTRL10, pwrctrl, clr);
  13545. - REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL12, pwrctrl, clr);
  13546. -@@ -1096,6 +1097,7 @@ static void ath9k_hw_4k_set_board_values
  13547. - clr = mask * 0x1f;
  13548. - REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL11, pwrctrl, clr);
  13549. - REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL13, pwrctrl, clr);
  13550. -+ REG_RMW_BUFFER_FLUSH(ah);
  13551. - }
  13552. - }
  13553. -
  13554. 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
  13555. new file mode 100644
  13556. index 0000000..1fd016f
  13557. --- /dev/null
  13558. +++ b/package/kernel/mac80211/patches/331-brcmfmac-Increase-nr-of-supported-flowrings.patch
  13559. @@ -0,0 +1,307 @@
  13560. +From: Hante Meuleman <meuleman@broadcom.com>
  13561. +Date: Sun, 7 Feb 2016 18:08:24 +0100
  13562. +Subject: [PATCH] brcmfmac: Increase nr of supported flowrings.
  13563. +MIME-Version: 1.0
  13564. +Content-Type: text/plain; charset=UTF-8
  13565. +Content-Transfer-Encoding: 8bit
  13566. +
  13567. +New generation devices have firmware which has more than 256 flowrings.
  13568. +E.g. following debugging message comes from 14e4:4365 BCM4366:
  13569. +[ 194.606245] brcmfmac: brcmf_pcie_init_ringbuffers Nr of flowrings is 264
  13570. +
  13571. +At various code places (related to flowrings) we were using u8 which
  13572. +could lead to storing wrong number or infinite loops when indexing with
  13573. +this type. This issue was quite easy to spot in brcmf_flowring_detach
  13574. +where it led to infinite loop e.g. on failed initialization.
  13575. +
  13576. +This patch switches code to proper types and increases the maximum
  13577. +number of supported flowrings to 512.
  13578. +
  13579. +Originally this change was sent in September 2015, but back it was
  13580. +causing a regression on BCM43602 resulting in:
  13581. +Unable to handle kernel NULL pointer dereference at virtual address ...
  13582. +
  13583. +The reason for this regression was missing update (s/u8/u16) of struct
  13584. +brcmf_flowring_ring. This problem was handled in 9f64df9 ("brcmfmac: Fix
  13585. +bug in flowring management."). Starting with that it's safe to apply
  13586. +this original patch as it doesn't cause a regression anymore.
  13587. +
  13588. +This patch fixes an infinite loop on BCM4366 which is supported since
  13589. +4.4 so it makes sense to apply it to stable 4.4+.
  13590. +
  13591. +Cc: <stable@vger.kernel.org> # 4.4+
  13592. +Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  13593. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  13594. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13595. +Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  13596. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13597. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  13598. +---
  13599. +
  13600. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  13601. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  13602. +@@ -32,7 +32,7 @@
  13603. + #define BRCMF_FLOWRING_LOW (BRCMF_FLOWRING_HIGH - 256)
  13604. + #define BRCMF_FLOWRING_INVALID_IFIDX 0xff
  13605. +
  13606. +-#define BRCMF_FLOWRING_HASH_AP(da, fifo, ifidx) (da[5] + fifo + ifidx * 16)
  13607. ++#define BRCMF_FLOWRING_HASH_AP(da, fifo, ifidx) (da[5] * 2 + fifo + ifidx * 16)
  13608. + #define BRCMF_FLOWRING_HASH_STA(fifo, ifidx) (fifo + ifidx * 16)
  13609. +
  13610. + static const u8 brcmf_flowring_prio2fifo[] = {
  13611. +@@ -68,7 +68,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  13612. + u8 prio, u8 ifidx)
  13613. + {
  13614. + struct brcmf_flowring_hash *hash;
  13615. +- u8 hash_idx;
  13616. ++ u16 hash_idx;
  13617. + u32 i;
  13618. + bool found;
  13619. + bool sta;
  13620. +@@ -88,6 +88,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  13621. + }
  13622. + hash_idx = sta ? BRCMF_FLOWRING_HASH_STA(fifo, ifidx) :
  13623. + BRCMF_FLOWRING_HASH_AP(mac, fifo, ifidx);
  13624. ++ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  13625. + found = false;
  13626. + hash = flow->hash;
  13627. + for (i = 0; i < BRCMF_FLOWRING_HASHSIZE; i++) {
  13628. +@@ -98,6 +99,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  13629. + break;
  13630. + }
  13631. + hash_idx++;
  13632. ++ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  13633. + }
  13634. + if (found)
  13635. + return hash[hash_idx].flowid;
  13636. +@@ -111,7 +113,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  13637. + {
  13638. + struct brcmf_flowring_ring *ring;
  13639. + struct brcmf_flowring_hash *hash;
  13640. +- u8 hash_idx;
  13641. ++ u16 hash_idx;
  13642. + u32 i;
  13643. + bool found;
  13644. + u8 fifo;
  13645. +@@ -131,6 +133,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  13646. + }
  13647. + hash_idx = sta ? BRCMF_FLOWRING_HASH_STA(fifo, ifidx) :
  13648. + BRCMF_FLOWRING_HASH_AP(mac, fifo, ifidx);
  13649. ++ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  13650. + found = false;
  13651. + hash = flow->hash;
  13652. + for (i = 0; i < BRCMF_FLOWRING_HASHSIZE; i++) {
  13653. +@@ -140,6 +143,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  13654. + break;
  13655. + }
  13656. + hash_idx++;
  13657. ++ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  13658. + }
  13659. + if (found) {
  13660. + for (i = 0; i < flow->nrofrings; i++) {
  13661. +@@ -169,7 +173,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  13662. + }
  13663. +
  13664. +
  13665. +-u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u8 flowid)
  13666. ++u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u16 flowid)
  13667. + {
  13668. + struct brcmf_flowring_ring *ring;
  13669. +
  13670. +@@ -179,7 +183,7 @@ u8 brcmf_flowring_tid(struct brcmf_flowr
  13671. + }
  13672. +
  13673. +
  13674. +-static void brcmf_flowring_block(struct brcmf_flowring *flow, u8 flowid,
  13675. ++static void brcmf_flowring_block(struct brcmf_flowring *flow, u16 flowid,
  13676. + bool blocked)
  13677. + {
  13678. + struct brcmf_flowring_ring *ring;
  13679. +@@ -228,10 +232,10 @@ static void brcmf_flowring_block(struct
  13680. + }
  13681. +
  13682. +
  13683. +-void brcmf_flowring_delete(struct brcmf_flowring *flow, u8 flowid)
  13684. ++void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid)
  13685. + {
  13686. + struct brcmf_flowring_ring *ring;
  13687. +- u8 hash_idx;
  13688. ++ u16 hash_idx;
  13689. + struct sk_buff *skb;
  13690. +
  13691. + ring = flow->rings[flowid];
  13692. +@@ -253,7 +257,7 @@ void brcmf_flowring_delete(struct brcmf_
  13693. + }
  13694. +
  13695. +
  13696. +-u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  13697. ++u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u16 flowid,
  13698. + struct sk_buff *skb)
  13699. + {
  13700. + struct brcmf_flowring_ring *ring;
  13701. +@@ -279,7 +283,7 @@ u32 brcmf_flowring_enqueue(struct brcmf_
  13702. + }
  13703. +
  13704. +
  13705. +-struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u8 flowid)
  13706. ++struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u16 flowid)
  13707. + {
  13708. + struct brcmf_flowring_ring *ring;
  13709. + struct sk_buff *skb;
  13710. +@@ -300,7 +304,7 @@ struct sk_buff *brcmf_flowring_dequeue(s
  13711. + }
  13712. +
  13713. +
  13714. +-void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u8 flowid,
  13715. ++void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u16 flowid,
  13716. + struct sk_buff *skb)
  13717. + {
  13718. + struct brcmf_flowring_ring *ring;
  13719. +@@ -311,7 +315,7 @@ void brcmf_flowring_reinsert(struct brcm
  13720. + }
  13721. +
  13722. +
  13723. +-u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u8 flowid)
  13724. ++u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u16 flowid)
  13725. + {
  13726. + struct brcmf_flowring_ring *ring;
  13727. +
  13728. +@@ -326,7 +330,7 @@ u32 brcmf_flowring_qlen(struct brcmf_flo
  13729. + }
  13730. +
  13731. +
  13732. +-void brcmf_flowring_open(struct brcmf_flowring *flow, u8 flowid)
  13733. ++void brcmf_flowring_open(struct brcmf_flowring *flow, u16 flowid)
  13734. + {
  13735. + struct brcmf_flowring_ring *ring;
  13736. +
  13737. +@@ -340,10 +344,10 @@ void brcmf_flowring_open(struct brcmf_fl
  13738. + }
  13739. +
  13740. +
  13741. +-u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u8 flowid)
  13742. ++u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u16 flowid)
  13743. + {
  13744. + struct brcmf_flowring_ring *ring;
  13745. +- u8 hash_idx;
  13746. ++ u16 hash_idx;
  13747. +
  13748. + ring = flow->rings[flowid];
  13749. + hash_idx = ring->hash_id;
  13750. +@@ -384,7 +388,7 @@ void brcmf_flowring_detach(struct brcmf_
  13751. + struct brcmf_pub *drvr = bus_if->drvr;
  13752. + struct brcmf_flowring_tdls_entry *search;
  13753. + struct brcmf_flowring_tdls_entry *remove;
  13754. +- u8 flowid;
  13755. ++ u16 flowid;
  13756. +
  13757. + for (flowid = 0; flowid < flow->nrofrings; flowid++) {
  13758. + if (flow->rings[flowid])
  13759. +@@ -408,7 +412,7 @@ void brcmf_flowring_configure_addr_mode(
  13760. + struct brcmf_bus *bus_if = dev_get_drvdata(flow->dev);
  13761. + struct brcmf_pub *drvr = bus_if->drvr;
  13762. + u32 i;
  13763. +- u8 flowid;
  13764. ++ u16 flowid;
  13765. +
  13766. + if (flow->addr_mode[ifidx] != addr_mode) {
  13767. + for (i = 0; i < ARRAY_SIZE(flow->hash); i++) {
  13768. +@@ -434,7 +438,7 @@ void brcmf_flowring_delete_peer(struct b
  13769. + struct brcmf_flowring_tdls_entry *prev;
  13770. + struct brcmf_flowring_tdls_entry *search;
  13771. + u32 i;
  13772. +- u8 flowid;
  13773. ++ u16 flowid;
  13774. + bool sta;
  13775. +
  13776. + sta = (flow->addr_mode[ifidx] == ADDR_INDIRECT);
  13777. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.h
  13778. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.h
  13779. +@@ -16,7 +16,7 @@
  13780. + #define BRCMFMAC_FLOWRING_H
  13781. +
  13782. +
  13783. +-#define BRCMF_FLOWRING_HASHSIZE 256
  13784. ++#define BRCMF_FLOWRING_HASHSIZE 512 /* has to be 2^x */
  13785. + #define BRCMF_FLOWRING_INVALID_ID 0xFFFFFFFF
  13786. +
  13787. +
  13788. +@@ -24,7 +24,7 @@ struct brcmf_flowring_hash {
  13789. + u8 mac[ETH_ALEN];
  13790. + u8 fifo;
  13791. + u8 ifidx;
  13792. +- u8 flowid;
  13793. ++ u16 flowid;
  13794. + };
  13795. +
  13796. + enum ring_status {
  13797. +@@ -61,16 +61,16 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  13798. + u8 prio, u8 ifidx);
  13799. + u32 brcmf_flowring_create(struct brcmf_flowring *flow, u8 da[ETH_ALEN],
  13800. + u8 prio, u8 ifidx);
  13801. +-void brcmf_flowring_delete(struct brcmf_flowring *flow, u8 flowid);
  13802. +-void brcmf_flowring_open(struct brcmf_flowring *flow, u8 flowid);
  13803. +-u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u8 flowid);
  13804. +-u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  13805. ++void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid);
  13806. ++void brcmf_flowring_open(struct brcmf_flowring *flow, u16 flowid);
  13807. ++u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u16 flowid);
  13808. ++u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u16 flowid,
  13809. + struct sk_buff *skb);
  13810. +-struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u8 flowid);
  13811. +-void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u8 flowid,
  13812. ++struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u16 flowid);
  13813. ++void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u16 flowid,
  13814. + struct sk_buff *skb);
  13815. +-u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u8 flowid);
  13816. +-u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u8 flowid);
  13817. ++u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u16 flowid);
  13818. ++u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u16 flowid);
  13819. + struct brcmf_flowring *brcmf_flowring_attach(struct device *dev, u16 nrofrings);
  13820. + void brcmf_flowring_detach(struct brcmf_flowring *flow);
  13821. + void brcmf_flowring_configure_addr_mode(struct brcmf_flowring *flow, int ifidx,
  13822. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  13823. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  13824. +@@ -677,7 +677,7 @@ static u32 brcmf_msgbuf_flowring_create(
  13825. + }
  13826. +
  13827. +
  13828. +-static void brcmf_msgbuf_txflow(struct brcmf_msgbuf *msgbuf, u8 flowid)
  13829. ++static void brcmf_msgbuf_txflow(struct brcmf_msgbuf *msgbuf, u16 flowid)
  13830. + {
  13831. + struct brcmf_flowring *flow = msgbuf->flow;
  13832. + struct brcmf_commonring *commonring;
  13833. +@@ -1310,7 +1310,7 @@ int brcmf_proto_msgbuf_rx_trigger(struct
  13834. + }
  13835. +
  13836. +
  13837. +-void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid)
  13838. ++void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u16 flowid)
  13839. + {
  13840. + struct brcmf_msgbuf *msgbuf = (struct brcmf_msgbuf *)drvr->proto->pd;
  13841. + struct msgbuf_tx_flowring_delete_req *delete;
  13842. +@@ -1415,6 +1415,13 @@ int brcmf_proto_msgbuf_attach(struct brc
  13843. + u32 count;
  13844. +
  13845. + if_msgbuf = drvr->bus_if->msgbuf;
  13846. ++
  13847. ++ if (if_msgbuf->nrof_flowrings >= BRCMF_FLOWRING_HASHSIZE) {
  13848. ++ brcmf_err("driver not configured for this many flowrings %d\n",
  13849. ++ if_msgbuf->nrof_flowrings);
  13850. ++ if_msgbuf->nrof_flowrings = BRCMF_FLOWRING_HASHSIZE - 1;
  13851. ++ }
  13852. ++
  13853. + msgbuf = kzalloc(sizeof(*msgbuf), GFP_KERNEL);
  13854. + if (!msgbuf)
  13855. + goto fail;
  13856. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h
  13857. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h
  13858. +@@ -33,7 +33,7 @@
  13859. +
  13860. +
  13861. + int brcmf_proto_msgbuf_rx_trigger(struct device *dev);
  13862. +-void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid);
  13863. ++void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u16 flowid);
  13864. + int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr);
  13865. + void brcmf_proto_msgbuf_detach(struct brcmf_pub *drvr);
  13866. + #else
  13867. 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
  13868. deleted file mode 100644
  13869. index 3ce4428..0000000
  13870. --- a/package/kernel/mac80211/patches/332-ath9k-ath9k_hw_analog_shift_rmw-use-REG_RMW.patch
  13871. +++ /dev/null
  13872. @@ -1,27 +0,0 @@
  13873. -From: Oleksij Rempel <linux@rempel-privat.de>
  13874. -Date: Sun, 22 Mar 2015 19:29:59 +0100
  13875. -Subject: [PATCH] ath9k: ath9k_hw_analog_shift_rmw: use REG_RMW
  13876. -
  13877. -use REG_RMW in ath9k_hw_analog_shift_rmw.
  13878. -It will double execution speed on usb bus.
  13879. -
  13880. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  13881. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13882. ----
  13883. -
  13884. ---- a/drivers/net/wireless/ath/ath9k/eeprom.c
  13885. -+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
  13886. -@@ -27,12 +27,7 @@ void ath9k_hw_analog_shift_regwrite(stru
  13887. - void ath9k_hw_analog_shift_rmw(struct ath_hw *ah, u32 reg, u32 mask,
  13888. - u32 shift, u32 val)
  13889. - {
  13890. -- u32 regVal;
  13891. --
  13892. -- regVal = REG_READ(ah, reg) & ~mask;
  13893. -- regVal |= (val << shift) & mask;
  13894. --
  13895. -- REG_WRITE(ah, reg, regVal);
  13896. -+ REG_RMW(ah, reg, ((val << shift) & mask), mask);
  13897. -
  13898. - if (ah->config.analog_shiftreg)
  13899. - udelay(100);
  13900. 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
  13901. new file mode 100644
  13902. index 0000000..e414f23
  13903. --- /dev/null
  13904. +++ b/package/kernel/mac80211/patches/332-cfg80211-fix-faulty-variable-initialization-in-ieee8.patch
  13905. @@ -0,0 +1,22 @@
  13906. +From: Felix Fietkau <nbd@openwrt.org>
  13907. +Date: Mon, 8 Feb 2016 14:24:36 +0100
  13908. +Subject: [PATCH] cfg80211: fix faulty variable initialization in
  13909. + ieee80211_amsdu_to_8023s
  13910. +
  13911. +reuse_skb is set to true if the code decides to use the last segment.
  13912. +Fixes a memory leak
  13913. +
  13914. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  13915. +---
  13916. +
  13917. +--- a/net/wireless/util.c
  13918. ++++ b/net/wireless/util.c
  13919. +@@ -676,7 +676,7 @@ void ieee80211_amsdu_to_8023s(struct sk_
  13920. + u8 *payload;
  13921. + int offset = 0, remaining, err;
  13922. + struct ethhdr eth;
  13923. +- bool reuse_skb = true;
  13924. ++ bool reuse_skb = false;
  13925. + bool last = false;
  13926. +
  13927. + if (has_80211_header) {
  13928. 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
  13929. deleted file mode 100644
  13930. index 8f12b36..0000000
  13931. --- a/package/kernel/mac80211/patches/333-ath9k-use-REG_RMW-and-rmw-buffer-in-ath9k_hw_4k_set_.patch
  13932. +++ /dev/null
  13933. @@ -1,47 +0,0 @@
  13934. -From: Oleksij Rempel <linux@rempel-privat.de>
  13935. -Date: Sun, 22 Mar 2015 19:30:01 +0100
  13936. -Subject: [PATCH] ath9k: use REG_RMW and rmw buffer in
  13937. - ath9k_hw_4k_set_gain
  13938. -
  13939. -it is possible to reduce time needed for this function
  13940. -by rplacing REG_WRITE with REG_RMW (plus dummy 0) and putt all commands
  13941. -in same buffer.
  13942. -
  13943. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  13944. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13945. ----
  13946. -
  13947. ---- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  13948. -+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  13949. -@@ -772,15 +772,14 @@ static void ath9k_hw_4k_set_gain(struct
  13950. - struct ar5416_eeprom_4k *eep,
  13951. - u8 txRxAttenLocal)
  13952. - {
  13953. -- REG_WRITE(ah, AR_PHY_SWITCH_CHAIN_0,
  13954. -- pModal->antCtrlChain[0]);
  13955. --
  13956. -- REG_WRITE(ah, AR_PHY_TIMING_CTRL4(0),
  13957. -- (REG_READ(ah, AR_PHY_TIMING_CTRL4(0)) &
  13958. -- ~(AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF |
  13959. -- AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF)) |
  13960. -- SM(pModal->iqCalICh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF) |
  13961. -- SM(pModal->iqCalQCh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF));
  13962. -+ ENABLE_REG_RMW_BUFFER(ah);
  13963. -+ REG_RMW(ah, AR_PHY_SWITCH_CHAIN_0,
  13964. -+ pModal->antCtrlChain[0], 0);
  13965. -+
  13966. -+ REG_RMW(ah, AR_PHY_TIMING_CTRL4(0),
  13967. -+ SM(pModal->iqCalICh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF) |
  13968. -+ SM(pModal->iqCalQCh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF),
  13969. -+ AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF | AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF);
  13970. -
  13971. - if ((eep->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >=
  13972. - AR5416_EEP_MINOR_VER_3) {
  13973. -@@ -819,6 +818,7 @@ static void ath9k_hw_4k_set_gain(struct
  13974. - AR9280_PHY_RXGAIN_TXRX_ATTEN, txRxAttenLocal);
  13975. - REG_RMW_FIELD(ah, AR_PHY_RXGAIN + 0x1000,
  13976. - AR9280_PHY_RXGAIN_TXRX_MARGIN, pModal->rxTxMarginCh[0]);
  13977. -+ REG_RMW_BUFFER_FLUSH(ah);
  13978. - }
  13979. -
  13980. - /*
  13981. 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
  13982. new file mode 100644
  13983. index 0000000..6e2d0cf
  13984. --- /dev/null
  13985. +++ b/package/kernel/mac80211/patches/333-cfg80211-reuse-existing-page-fragments-in-A-MSDU-rx.patch
  13986. @@ -0,0 +1,132 @@
  13987. +From: Felix Fietkau <nbd@openwrt.org>
  13988. +Date: Mon, 8 Feb 2016 14:33:19 +0100
  13989. +Subject: [PATCH] cfg80211: reuse existing page fragments in A-MSDU rx
  13990. +
  13991. +This massively reduces data copying and thus improves rx performance
  13992. +
  13993. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  13994. +---
  13995. +
  13996. +--- a/net/wireless/util.c
  13997. ++++ b/net/wireless/util.c
  13998. +@@ -644,23 +644,93 @@ int ieee80211_data_from_8023(struct sk_b
  13999. + }
  14000. + EXPORT_SYMBOL(ieee80211_data_from_8023);
  14001. +
  14002. ++static void
  14003. ++__frame_add_frag(struct sk_buff *skb, struct page *page,
  14004. ++ void *ptr, int len, int size)
  14005. ++{
  14006. ++ struct skb_shared_info *sh = skb_shinfo(skb);
  14007. ++ int page_offset;
  14008. ++
  14009. ++ atomic_inc(&page->_count);
  14010. ++ page_offset = ptr - page_address(page);
  14011. ++ skb_add_rx_frag(skb, sh->nr_frags, page, page_offset, len, size);
  14012. ++}
  14013. ++
  14014. ++static void
  14015. ++__ieee80211_amsdu_copy_frag(struct sk_buff *skb, struct sk_buff *frame,
  14016. ++ int offset, int len)
  14017. ++{
  14018. ++ struct skb_shared_info *sh = skb_shinfo(skb);
  14019. ++ const skb_frag_t *frag = &sh->frags[-1];
  14020. ++ struct page *frag_page;
  14021. ++ void *frag_ptr;
  14022. ++ int frag_len, frag_size;
  14023. ++ int head_size = skb->len - skb->data_len;
  14024. ++ int cur_len;
  14025. ++
  14026. ++ frag_page = virt_to_head_page(skb->head);
  14027. ++ frag_ptr = skb->data;
  14028. ++ frag_size = head_size;
  14029. ++
  14030. ++ while (offset >= frag_size) {
  14031. ++ offset -= frag_size;
  14032. ++ frag++;
  14033. ++ frag_page = skb_frag_page(frag);
  14034. ++ frag_ptr = skb_frag_address(frag);
  14035. ++ frag_size = skb_frag_size(frag);
  14036. ++ }
  14037. ++
  14038. ++ frag_ptr += offset;
  14039. ++ frag_len = frag_size - offset;
  14040. ++
  14041. ++ cur_len = min(len, frag_len);
  14042. ++
  14043. ++ __frame_add_frag(frame, frag_page, frag_ptr, cur_len, frag_size);
  14044. ++ len -= cur_len;
  14045. ++
  14046. ++ while (len > 0) {
  14047. ++ frag++;
  14048. ++ frag_len = skb_frag_size(frag);
  14049. ++ cur_len = min(len, frag_len);
  14050. ++ __frame_add_frag(frame, skb_frag_page(frag),
  14051. ++ skb_frag_address(frag), cur_len, frag_len);
  14052. ++ len -= cur_len;
  14053. ++ }
  14054. ++}
  14055. ++
  14056. + static struct sk_buff *
  14057. + __ieee80211_amsdu_copy(struct sk_buff *skb, unsigned int hlen,
  14058. +- int offset, int len)
  14059. ++ int offset, int len, bool reuse_frag)
  14060. + {
  14061. + struct sk_buff *frame;
  14062. ++ int cur_len = len;
  14063. +
  14064. + if (skb->len - offset < len)
  14065. + return NULL;
  14066. +
  14067. + /*
  14068. ++ * When reusing framents, copy some data to the head to simplify
  14069. ++ * ethernet header handling and speed up protocol header processing
  14070. ++ * in the stack later.
  14071. ++ */
  14072. ++ if (reuse_frag)
  14073. ++ cur_len = min_t(int, len, 32);
  14074. ++
  14075. ++ /*
  14076. + * Allocate and reserve two bytes more for payload
  14077. + * alignment since sizeof(struct ethhdr) is 14.
  14078. + */
  14079. +- frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + len);
  14080. ++ frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + cur_len);
  14081. +
  14082. + skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2);
  14083. +- skb_copy_bits(skb, offset, skb_put(frame, len), len);
  14084. ++ skb_copy_bits(skb, offset, skb_put(frame, cur_len), cur_len);
  14085. ++
  14086. ++ len -= cur_len;
  14087. ++ if (!len)
  14088. ++ return frame;
  14089. ++
  14090. ++ offset += cur_len;
  14091. ++ __ieee80211_amsdu_copy_frag(skb, frame, offset, len);
  14092. +
  14093. + return frame;
  14094. + }
  14095. +@@ -676,6 +746,7 @@ void ieee80211_amsdu_to_8023s(struct sk_
  14096. + u8 *payload;
  14097. + int offset = 0, remaining, err;
  14098. + struct ethhdr eth;
  14099. ++ bool reuse_frag = skb->head_frag && !skb_has_frag_list(skb);
  14100. + bool reuse_skb = false;
  14101. + bool last = false;
  14102. +
  14103. +@@ -703,12 +774,13 @@ void ieee80211_amsdu_to_8023s(struct sk_
  14104. + offset += sizeof(struct ethhdr);
  14105. + /* reuse skb for the last subframe */
  14106. + last = remaining <= subframe_len + padding;
  14107. +- if (!skb_is_nonlinear(skb) && last) {
  14108. ++ if (!skb_is_nonlinear(skb) && !reuse_frag && last) {
  14109. + skb_pull(skb, offset);
  14110. + frame = skb;
  14111. + reuse_skb = true;
  14112. + } else {
  14113. +- frame = __ieee80211_amsdu_copy(skb, hlen, offset, len);
  14114. ++ frame = __ieee80211_amsdu_copy(skb, hlen, offset, len,
  14115. ++ reuse_frag);
  14116. + if (!frame)
  14117. + goto purge;
  14118. +
  14119. 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
  14120. deleted file mode 100644
  14121. index f26e059..0000000
  14122. --- a/package/kernel/mac80211/patches/334-ath9k-use-REG_RMW-and-rmw-buffer-in-ath9k_hw_def_set.patch
  14123. +++ /dev/null
  14124. @@ -1,67 +0,0 @@
  14125. -From: Oleksij Rempel <linux@rempel-privat.de>
  14126. -Date: Sun, 22 Mar 2015 19:30:03 +0100
  14127. -Subject: [PATCH] ath9k: use REG_RMW and rmw buffer in
  14128. - ath9k_hw_def_set_gain
  14129. -
  14130. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  14131. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14132. ----
  14133. -
  14134. ---- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
  14135. -+++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
  14136. -@@ -466,6 +466,7 @@ static void ath9k_hw_def_set_gain(struct
  14137. - struct ar5416_eeprom_def *eep,
  14138. - u8 txRxAttenLocal, int regChainOffset, int i)
  14139. - {
  14140. -+ ENABLE_REG_RMW_BUFFER(ah);
  14141. - if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_3) {
  14142. - txRxAttenLocal = pModal->txRxAttenCh[i];
  14143. -
  14144. -@@ -483,16 +484,12 @@ static void ath9k_hw_def_set_gain(struct
  14145. - AR_PHY_GAIN_2GHZ_XATTEN2_DB,
  14146. - pModal->xatten2Db[i]);
  14147. - } else {
  14148. -- REG_WRITE(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  14149. -- (REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) &
  14150. -- ~AR_PHY_GAIN_2GHZ_BSW_MARGIN)
  14151. -- | SM(pModal-> bswMargin[i],
  14152. -- AR_PHY_GAIN_2GHZ_BSW_MARGIN));
  14153. -- REG_WRITE(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  14154. -- (REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) &
  14155. -- ~AR_PHY_GAIN_2GHZ_BSW_ATTEN)
  14156. -- | SM(pModal->bswAtten[i],
  14157. -- AR_PHY_GAIN_2GHZ_BSW_ATTEN));
  14158. -+ REG_RMW(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  14159. -+ SM(pModal-> bswMargin[i], AR_PHY_GAIN_2GHZ_BSW_MARGIN),
  14160. -+ AR_PHY_GAIN_2GHZ_BSW_MARGIN);
  14161. -+ REG_RMW(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  14162. -+ SM(pModal->bswAtten[i], AR_PHY_GAIN_2GHZ_BSW_ATTEN),
  14163. -+ AR_PHY_GAIN_2GHZ_BSW_ATTEN);
  14164. - }
  14165. - }
  14166. -
  14167. -@@ -504,17 +501,14 @@ static void ath9k_hw_def_set_gain(struct
  14168. - AR_PHY_RXGAIN + regChainOffset,
  14169. - AR9280_PHY_RXGAIN_TXRX_MARGIN, pModal->rxTxMarginCh[i]);
  14170. - } else {
  14171. -- REG_WRITE(ah,
  14172. -- AR_PHY_RXGAIN + regChainOffset,
  14173. -- (REG_READ(ah, AR_PHY_RXGAIN + regChainOffset) &
  14174. -- ~AR_PHY_RXGAIN_TXRX_ATTEN)
  14175. -- | SM(txRxAttenLocal, AR_PHY_RXGAIN_TXRX_ATTEN));
  14176. -- REG_WRITE(ah,
  14177. -- AR_PHY_GAIN_2GHZ + regChainOffset,
  14178. -- (REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) &
  14179. -- ~AR_PHY_GAIN_2GHZ_RXTX_MARGIN) |
  14180. -- SM(pModal->rxTxMarginCh[i], AR_PHY_GAIN_2GHZ_RXTX_MARGIN));
  14181. -+ REG_RMW(ah, AR_PHY_RXGAIN + regChainOffset,
  14182. -+ SM(txRxAttenLocal, AR_PHY_RXGAIN_TXRX_ATTEN),
  14183. -+ AR_PHY_RXGAIN_TXRX_ATTEN);
  14184. -+ REG_RMW(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  14185. -+ SM(pModal->rxTxMarginCh[i], AR_PHY_GAIN_2GHZ_RXTX_MARGIN),
  14186. -+ AR_PHY_GAIN_2GHZ_RXTX_MARGIN);
  14187. - }
  14188. -+ REG_RMW_BUFFER_FLUSH(ah);
  14189. - }
  14190. -
  14191. - static void ath9k_hw_def_set_board_values(struct ath_hw *ah,
  14192. diff --git a/package/kernel/mac80211/patches/334-mac80211-fix-wiphy-supported_band-access.patch b/package/kernel/mac80211/patches/334-mac80211-fix-wiphy-supported_band-access.patch
  14193. new file mode 100644
  14194. index 0000000..f8f4f09
  14195. --- /dev/null
  14196. +++ b/package/kernel/mac80211/patches/334-mac80211-fix-wiphy-supported_band-access.patch
  14197. @@ -0,0 +1,36 @@
  14198. +From: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  14199. +Date: Wed, 10 Feb 2016 16:08:17 +0100
  14200. +Subject: [PATCH] mac80211: fix wiphy supported_band access
  14201. +
  14202. +Fix wiphy supported_band access in tx radiotap parsing. In particular,
  14203. +info->band is always set to 0 (IEEE80211_BAND_2GHZ) since it has not
  14204. +assigned yet. This cause a kernel crash on 5GHz only devices.
  14205. +Move ieee80211_parse_tx_radiotap() after info->band assignment
  14206. +
  14207. +Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  14208. +---
  14209. +
  14210. +--- a/net/mac80211/tx.c
  14211. ++++ b/net/mac80211/tx.c
  14212. +@@ -1890,10 +1890,6 @@ netdev_tx_t ieee80211_monitor_start_xmit
  14213. + info->flags = IEEE80211_TX_CTL_REQ_TX_STATUS |
  14214. + IEEE80211_TX_CTL_INJECTED;
  14215. +
  14216. +- /* process and remove the injection radiotap header */
  14217. +- if (!ieee80211_parse_tx_radiotap(local, skb))
  14218. +- goto fail;
  14219. +-
  14220. + rcu_read_lock();
  14221. +
  14222. + /*
  14223. +@@ -1955,6 +1951,10 @@ netdev_tx_t ieee80211_monitor_start_xmit
  14224. + goto fail_rcu;
  14225. +
  14226. + info->band = chandef->chan->band;
  14227. ++ /* process and remove the injection radiotap header */
  14228. ++ if (!ieee80211_parse_tx_radiotap(local, skb))
  14229. ++ goto fail_rcu;
  14230. ++
  14231. + ieee80211_xmit(sdata, NULL, skb);
  14232. + rcu_read_unlock();
  14233. +
  14234. 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
  14235. deleted file mode 100644
  14236. index 5e63a80..0000000
  14237. --- a/package/kernel/mac80211/patches/335-0001-brcmfmac-Fix-oops-when-SDIO-device-is-removed.patch
  14238. +++ /dev/null
  14239. @@ -1,44 +0,0 @@
  14240. -From: Hante Meuleman <meuleman@broadcom.com>
  14241. -Date: Fri, 6 Mar 2015 18:40:38 +0100
  14242. -Subject: [PATCH] brcmfmac: Fix oops when SDIO device is removed.
  14243. -
  14244. -On removal of SDIO card both functions of card will be getting
  14245. -a remove call. When the first is hanging in ctrl frame xmit then
  14246. -the second will cause oops. This patch fixes the xmit ctrl
  14247. -handling in case of serious errors and also limits the handling
  14248. -for remove to function 1 only.
  14249. -
  14250. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  14251. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  14252. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14253. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  14254. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  14255. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14256. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14257. ----
  14258. -
  14259. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  14260. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  14261. -@@ -1194,7 +1194,7 @@ static void brcmf_ops_sdio_remove(struct
  14262. - brcmf_dbg(SDIO, "sdio device ID: 0x%04x\n", func->device);
  14263. - brcmf_dbg(SDIO, "Function: %d\n", func->num);
  14264. -
  14265. -- if (func->num != 1 && func->num != 2)
  14266. -+ if (func->num != 1)
  14267. - return;
  14268. -
  14269. - bus_if = dev_get_drvdata(&func->dev);
  14270. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14271. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14272. -@@ -2740,6 +2740,11 @@ static void brcmf_sdio_dpc(struct brcmf_
  14273. - if ((bus->sdiodev->state != BRCMF_SDIOD_DATA) || (err != 0)) {
  14274. - brcmf_err("failed backplane access over SDIO, halting operation\n");
  14275. - atomic_set(&bus->intstatus, 0);
  14276. -+ if (bus->ctrl_frame_stat) {
  14277. -+ bus->ctrl_frame_err = -ENODEV;
  14278. -+ bus->ctrl_frame_stat = false;
  14279. -+ brcmf_sdio_wait_event_wakeup(bus);
  14280. -+ }
  14281. - } else if (atomic_read(&bus->intstatus) ||
  14282. - atomic_read(&bus->ipend) > 0 ||
  14283. - (!atomic_read(&bus->fcstate) &&
  14284. 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
  14285. deleted file mode 100644
  14286. index 201da75..0000000
  14287. --- a/package/kernel/mac80211/patches/335-0002-brcmfmac-Simplify-watchdog-sleep.patch
  14288. +++ /dev/null
  14289. @@ -1,157 +0,0 @@
  14290. -From: Hante Meuleman <meuleman@broadcom.com>
  14291. -Date: Fri, 6 Mar 2015 18:40:39 +0100
  14292. -Subject: [PATCH] brcmfmac: Simplify watchdog sleep.
  14293. -
  14294. -The watchdog thread is used to put the SDIO bus to sleep when the
  14295. -system is idling. This patch simplifies the way it is determined
  14296. -when sleep can be entered.
  14297. -
  14298. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  14299. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  14300. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14301. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  14302. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  14303. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14304. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14305. ----
  14306. -
  14307. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14308. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14309. -@@ -485,10 +485,9 @@ struct brcmf_sdio {
  14310. - #endif /* DEBUG */
  14311. -
  14312. - uint clkstate; /* State of sd and backplane clock(s) */
  14313. -- bool activity; /* Activity flag for clock down */
  14314. - s32 idletime; /* Control for activity timeout */
  14315. -- s32 idlecount; /* Activity timeout counter */
  14316. -- s32 idleclock; /* How to set bus driver when idle */
  14317. -+ s32 idlecount; /* Activity timeout counter */
  14318. -+ s32 idleclock; /* How to set bus driver when idle */
  14319. - bool rxflow_mode; /* Rx flow control mode */
  14320. - bool rxflow; /* Is rx flow control on */
  14321. - bool alp_only; /* Don't use HT clock (ALP only) */
  14322. -@@ -511,6 +510,7 @@ struct brcmf_sdio {
  14323. - struct workqueue_struct *brcmf_wq;
  14324. - struct work_struct datawork;
  14325. - atomic_t dpc_tskcnt;
  14326. -+ atomic_t dpc_running;
  14327. -
  14328. - bool txoff; /* Transmit flow-controlled */
  14329. - struct brcmf_sdio_count sdcnt;
  14330. -@@ -959,13 +959,8 @@ static int brcmf_sdio_clkctl(struct brcm
  14331. - brcmf_dbg(SDIO, "Enter\n");
  14332. -
  14333. - /* Early exit if we're already there */
  14334. -- if (bus->clkstate == target) {
  14335. -- if (target == CLK_AVAIL) {
  14336. -- brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  14337. -- bus->activity = true;
  14338. -- }
  14339. -+ if (bus->clkstate == target)
  14340. - return 0;
  14341. -- }
  14342. -
  14343. - switch (target) {
  14344. - case CLK_AVAIL:
  14345. -@@ -975,7 +970,6 @@ static int brcmf_sdio_clkctl(struct brcm
  14346. - /* Now request HT Avail on the backplane */
  14347. - brcmf_sdio_htclk(bus, true, pendok);
  14348. - brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  14349. -- bus->activity = true;
  14350. - break;
  14351. -
  14352. - case CLK_SDONLY:
  14353. -@@ -1024,17 +1018,6 @@ brcmf_sdio_bus_sleep(struct brcmf_sdio *
  14354. -
  14355. - /* Going to sleep */
  14356. - if (sleep) {
  14357. -- /* Don't sleep if something is pending */
  14358. -- if (atomic_read(&bus->intstatus) ||
  14359. -- atomic_read(&bus->ipend) > 0 ||
  14360. -- bus->ctrl_frame_stat ||
  14361. -- (!atomic_read(&bus->fcstate) &&
  14362. -- brcmu_pktq_mlen(&bus->txq, ~bus->flowcontrol) &&
  14363. -- data_ok(bus))) {
  14364. -- err = -EBUSY;
  14365. -- goto done;
  14366. -- }
  14367. --
  14368. - clkcsr = brcmf_sdiod_regrb(bus->sdiodev,
  14369. - SBSDIO_FUNC1_CHIPCLKCSR,
  14370. - &err);
  14371. -@@ -1045,11 +1028,7 @@ brcmf_sdio_bus_sleep(struct brcmf_sdio *
  14372. - SBSDIO_ALP_AVAIL_REQ, &err);
  14373. - }
  14374. - err = brcmf_sdio_kso_control(bus, false);
  14375. -- /* disable watchdog */
  14376. -- if (!err)
  14377. -- brcmf_sdio_wd_timer(bus, 0);
  14378. - } else {
  14379. -- bus->idlecount = 0;
  14380. - err = brcmf_sdio_kso_control(bus, true);
  14381. - }
  14382. - if (err) {
  14383. -@@ -3566,7 +3545,7 @@ void brcmf_sdio_isr(struct brcmf_sdio *b
  14384. - queue_work(bus->brcmf_wq, &bus->datawork);
  14385. - }
  14386. -
  14387. --static bool brcmf_sdio_bus_watchdog(struct brcmf_sdio *bus)
  14388. -+static void brcmf_sdio_bus_watchdog(struct brcmf_sdio *bus)
  14389. - {
  14390. - brcmf_dbg(TIMER, "Enter\n");
  14391. -
  14392. -@@ -3627,22 +3606,21 @@ static bool brcmf_sdio_bus_watchdog(stru
  14393. - #endif /* DEBUG */
  14394. -
  14395. - /* On idle timeout clear activity flag and/or turn off clock */
  14396. -- if ((bus->idletime > 0) && (bus->clkstate == CLK_AVAIL)) {
  14397. -- if (++bus->idlecount >= bus->idletime) {
  14398. -+ if ((atomic_read(&bus->dpc_tskcnt) == 0) &&
  14399. -+ (atomic_read(&bus->dpc_running) == 0) &&
  14400. -+ (bus->idletime > 0) && (bus->clkstate == CLK_AVAIL)) {
  14401. -+ bus->idlecount++;
  14402. -+ if (bus->idlecount > bus->idletime) {
  14403. -+ brcmf_dbg(SDIO, "idle\n");
  14404. -+ sdio_claim_host(bus->sdiodev->func[1]);
  14405. -+ brcmf_sdio_wd_timer(bus, 0);
  14406. - bus->idlecount = 0;
  14407. -- if (bus->activity) {
  14408. -- bus->activity = false;
  14409. -- brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  14410. -- } else {
  14411. -- brcmf_dbg(SDIO, "idle\n");
  14412. -- sdio_claim_host(bus->sdiodev->func[1]);
  14413. -- brcmf_sdio_bus_sleep(bus, true, false);
  14414. -- sdio_release_host(bus->sdiodev->func[1]);
  14415. -- }
  14416. -+ brcmf_sdio_bus_sleep(bus, true, false);
  14417. -+ sdio_release_host(bus->sdiodev->func[1]);
  14418. - }
  14419. -+ } else {
  14420. -+ bus->idlecount = 0;
  14421. - }
  14422. --
  14423. -- return (atomic_read(&bus->ipend) > 0);
  14424. - }
  14425. -
  14426. - static void brcmf_sdio_dataworker(struct work_struct *work)
  14427. -@@ -3651,8 +3629,11 @@ static void brcmf_sdio_dataworker(struct
  14428. - datawork);
  14429. -
  14430. - while (atomic_read(&bus->dpc_tskcnt)) {
  14431. -+ atomic_set(&bus->dpc_running, 1);
  14432. - atomic_set(&bus->dpc_tskcnt, 0);
  14433. - brcmf_sdio_dpc(bus);
  14434. -+ bus->idlecount = 0;
  14435. -+ atomic_set(&bus->dpc_running, 0);
  14436. - }
  14437. - if (brcmf_sdiod_freezing(bus->sdiodev)) {
  14438. - brcmf_sdiod_change_state(bus->sdiodev, BRCMF_SDIOD_DOWN);
  14439. -@@ -4154,6 +4135,7 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
  14440. - }
  14441. - /* Initialize DPC thread */
  14442. - atomic_set(&bus->dpc_tskcnt, 0);
  14443. -+ atomic_set(&bus->dpc_running, 0);
  14444. -
  14445. - /* Assign bus interface call back */
  14446. - bus->sdiodev->bus_if->dev = bus->sdiodev->dev;
  14447. 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
  14448. deleted file mode 100644
  14449. index 3a2de7a..0000000
  14450. --- a/package/kernel/mac80211/patches/335-0003-brcmfmac-Fix-possible-race-condition.patch
  14451. +++ /dev/null
  14452. @@ -1,83 +0,0 @@
  14453. -From: Hante Meuleman <meuleman@broadcom.com>
  14454. -Date: Fri, 6 Mar 2015 18:40:40 +0100
  14455. -Subject: [PATCH] brcmfmac: Fix possible race-condition.
  14456. -
  14457. -SDIO is using a "shared" variable to handoff ctl frames to DPC
  14458. -and to see when they are done. In a timeout situation this can
  14459. -lead to erroneous situation where DPC started to handle the ctl
  14460. -frame while the timeout expired. This patch will fix this by
  14461. -adding locking around the shared variable.
  14462. -
  14463. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  14464. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  14465. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14466. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  14467. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  14468. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14469. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14470. ----
  14471. -
  14472. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14473. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14474. -@@ -2700,11 +2700,13 @@ static void brcmf_sdio_dpc(struct brcmf_
  14475. - if (bus->ctrl_frame_stat && (bus->clkstate == CLK_AVAIL) &&
  14476. - data_ok(bus)) {
  14477. - sdio_claim_host(bus->sdiodev->func[1]);
  14478. -- err = brcmf_sdio_tx_ctrlframe(bus, bus->ctrl_frame_buf,
  14479. -- bus->ctrl_frame_len);
  14480. -+ if (bus->ctrl_frame_stat) {
  14481. -+ err = brcmf_sdio_tx_ctrlframe(bus, bus->ctrl_frame_buf,
  14482. -+ bus->ctrl_frame_len);
  14483. -+ bus->ctrl_frame_err = err;
  14484. -+ bus->ctrl_frame_stat = false;
  14485. -+ }
  14486. - sdio_release_host(bus->sdiodev->func[1]);
  14487. -- bus->ctrl_frame_err = err;
  14488. -- bus->ctrl_frame_stat = false;
  14489. - brcmf_sdio_wait_event_wakeup(bus);
  14490. - }
  14491. - /* Send queued frames (limit 1 if rx may still be pending) */
  14492. -@@ -2720,9 +2722,13 @@ static void brcmf_sdio_dpc(struct brcmf_
  14493. - brcmf_err("failed backplane access over SDIO, halting operation\n");
  14494. - atomic_set(&bus->intstatus, 0);
  14495. - if (bus->ctrl_frame_stat) {
  14496. -- bus->ctrl_frame_err = -ENODEV;
  14497. -- bus->ctrl_frame_stat = false;
  14498. -- brcmf_sdio_wait_event_wakeup(bus);
  14499. -+ sdio_claim_host(bus->sdiodev->func[1]);
  14500. -+ if (bus->ctrl_frame_stat) {
  14501. -+ bus->ctrl_frame_err = -ENODEV;
  14502. -+ bus->ctrl_frame_stat = false;
  14503. -+ brcmf_sdio_wait_event_wakeup(bus);
  14504. -+ }
  14505. -+ sdio_release_host(bus->sdiodev->func[1]);
  14506. - }
  14507. - } else if (atomic_read(&bus->intstatus) ||
  14508. - atomic_read(&bus->ipend) > 0 ||
  14509. -@@ -2930,15 +2936,20 @@ brcmf_sdio_bus_txctl(struct device *dev,
  14510. - brcmf_sdio_trigger_dpc(bus);
  14511. - wait_event_interruptible_timeout(bus->ctrl_wait, !bus->ctrl_frame_stat,
  14512. - msecs_to_jiffies(CTL_DONE_TIMEOUT));
  14513. --
  14514. -- if (!bus->ctrl_frame_stat) {
  14515. -+ ret = 0;
  14516. -+ if (bus->ctrl_frame_stat) {
  14517. -+ sdio_claim_host(bus->sdiodev->func[1]);
  14518. -+ if (bus->ctrl_frame_stat) {
  14519. -+ brcmf_dbg(SDIO, "ctrl_frame timeout\n");
  14520. -+ bus->ctrl_frame_stat = false;
  14521. -+ ret = -ETIMEDOUT;
  14522. -+ }
  14523. -+ sdio_release_host(bus->sdiodev->func[1]);
  14524. -+ }
  14525. -+ if (!ret) {
  14526. - brcmf_dbg(SDIO, "ctrl_frame complete, err=%d\n",
  14527. - bus->ctrl_frame_err);
  14528. - ret = bus->ctrl_frame_err;
  14529. -- } else {
  14530. -- brcmf_dbg(SDIO, "ctrl_frame timeout\n");
  14531. -- bus->ctrl_frame_stat = false;
  14532. -- ret = -ETIMEDOUT;
  14533. - }
  14534. -
  14535. - if (ret)
  14536. 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
  14537. deleted file mode 100644
  14538. index c9eb900..0000000
  14539. --- a/package/kernel/mac80211/patches/335-0004-brcmfmac-Add-support-for-BCM4345-SDIO-chipset.patch
  14540. +++ /dev/null
  14541. @@ -1,86 +0,0 @@
  14542. -From: Syed Asifful Dayyan <syedd@broadcom.com>
  14543. -Date: Fri, 6 Mar 2015 18:40:42 +0100
  14544. -Subject: [PATCH] brcmfmac: Add support for BCM4345 SDIO chipset.
  14545. -
  14546. -These changes add support for BCM4345 SDIO chipset.
  14547. -
  14548. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14549. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  14550. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14551. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  14552. -Signed-off-by: Syed Asifful Dayyan <syedd@broadcom.com>
  14553. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14554. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14555. ----
  14556. -
  14557. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  14558. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  14559. -@@ -1096,6 +1096,7 @@ static const struct sdio_device_id brcmf
  14560. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43341),
  14561. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43362),
  14562. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4335_4339),
  14563. -+ BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4345),
  14564. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4354),
  14565. - { /* end: all zeroes */ }
  14566. - };
  14567. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  14568. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  14569. -@@ -491,6 +491,10 @@ static void brcmf_chip_get_raminfo(struc
  14570. - case BRCM_CC_43362_CHIP_ID:
  14571. - ci->pub.ramsize = 0x3c000;
  14572. - break;
  14573. -+ case BRCM_CC_4345_CHIP_ID:
  14574. -+ ci->pub.ramsize = 0xc8000;
  14575. -+ ci->pub.rambase = 0x198000;
  14576. -+ break;
  14577. - case BRCM_CC_4339_CHIP_ID:
  14578. - case BRCM_CC_4354_CHIP_ID:
  14579. - case BRCM_CC_4356_CHIP_ID:
  14580. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14581. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14582. -@@ -617,6 +617,8 @@ static const struct sdiod_drive_str sdio
  14583. - #define BCM43362_NVRAM_NAME "brcm/brcmfmac43362-sdio.txt"
  14584. - #define BCM4339_FIRMWARE_NAME "brcm/brcmfmac4339-sdio.bin"
  14585. - #define BCM4339_NVRAM_NAME "brcm/brcmfmac4339-sdio.txt"
  14586. -+#define BCM4345_FIRMWARE_NAME "brcm/brcmfmac4345-sdio.bin"
  14587. -+#define BCM4345_NVRAM_NAME "brcm/brcmfmac4345-sdio.txt"
  14588. - #define BCM4354_FIRMWARE_NAME "brcm/brcmfmac4354-sdio.bin"
  14589. - #define BCM4354_NVRAM_NAME "brcm/brcmfmac4354-sdio.txt"
  14590. -
  14591. -@@ -640,6 +642,8 @@ MODULE_FIRMWARE(BCM43362_FIRMWARE_NAME);
  14592. - MODULE_FIRMWARE(BCM43362_NVRAM_NAME);
  14593. - MODULE_FIRMWARE(BCM4339_FIRMWARE_NAME);
  14594. - MODULE_FIRMWARE(BCM4339_NVRAM_NAME);
  14595. -+MODULE_FIRMWARE(BCM4345_FIRMWARE_NAME);
  14596. -+MODULE_FIRMWARE(BCM4345_NVRAM_NAME);
  14597. - MODULE_FIRMWARE(BCM4354_FIRMWARE_NAME);
  14598. - MODULE_FIRMWARE(BCM4354_NVRAM_NAME);
  14599. -
  14600. -@@ -669,6 +673,7 @@ static const struct brcmf_firmware_names
  14601. - { BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4335) },
  14602. - { BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, BRCMF_FIRMWARE_NVRAM(BCM43362) },
  14603. - { BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4339) },
  14604. -+ { BRCM_CC_4345_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4345) },
  14605. - { BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4354) }
  14606. - };
  14607. -
  14608. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  14609. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  14610. -@@ -37,6 +37,7 @@
  14611. - #define BRCM_CC_43362_CHIP_ID 43362
  14612. - #define BRCM_CC_4335_CHIP_ID 0x4335
  14613. - #define BRCM_CC_4339_CHIP_ID 0x4339
  14614. -+#define BRCM_CC_4345_CHIP_ID 0x4345
  14615. - #define BRCM_CC_4354_CHIP_ID 0x4354
  14616. - #define BRCM_CC_4356_CHIP_ID 0x4356
  14617. - #define BRCM_CC_43566_CHIP_ID 43566
  14618. ---- a/include/linux/mmc/sdio_ids.h
  14619. -+++ b/include/linux/mmc/sdio_ids.h
  14620. -@@ -33,6 +33,7 @@
  14621. - #define SDIO_DEVICE_ID_BROADCOM_43341 0xa94d
  14622. - #define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335
  14623. - #define SDIO_DEVICE_ID_BROADCOM_43362 0xa962
  14624. -+#define SDIO_DEVICE_ID_BROADCOM_4345 0x4345
  14625. - #define SDIO_DEVICE_ID_BROADCOM_4354 0x4354
  14626. -
  14627. - #define SDIO_VENDOR_ID_INTEL 0x0089
  14628. diff --git a/package/kernel/mac80211/patches/335-mac80211-minstrel_ht-set-A-MSDU-tx-limits-based-on-s.patch b/package/kernel/mac80211/patches/335-mac80211-minstrel_ht-set-A-MSDU-tx-limits-based-on-s.patch
  14629. new file mode 100644
  14630. index 0000000..acaacf7
  14631. --- /dev/null
  14632. +++ b/package/kernel/mac80211/patches/335-mac80211-minstrel_ht-set-A-MSDU-tx-limits-based-on-s.patch
  14633. @@ -0,0 +1,61 @@
  14634. +From: Felix Fietkau <nbd@openwrt.org>
  14635. +Date: Thu, 18 Feb 2016 19:30:05 +0100
  14636. +Subject: [PATCH] mac80211: minstrel_ht: set A-MSDU tx limits based on selected
  14637. + max_prob_rate
  14638. +
  14639. +Prevents excessive A-MSDU aggregation at low data rates or bad
  14640. +conditions.
  14641. +
  14642. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  14643. +---
  14644. +
  14645. +--- a/net/mac80211/rc80211_minstrel_ht.c
  14646. ++++ b/net/mac80211/rc80211_minstrel_ht.c
  14647. +@@ -883,6 +883,39 @@ minstrel_ht_set_rate(struct minstrel_pri
  14648. + ratetbl->rate[offset].flags = flags;
  14649. + }
  14650. +
  14651. ++static int
  14652. ++minstrel_ht_get_max_amsdu_len(struct minstrel_ht_sta *mi)
  14653. ++{
  14654. ++ int group = mi->max_prob_rate / MCS_GROUP_RATES;
  14655. ++ const struct mcs_group *g = &minstrel_mcs_groups[group];
  14656. ++ int rate = mi->max_prob_rate % MCS_GROUP_RATES;
  14657. ++
  14658. ++ /* Disable A-MSDU if max_prob_rate is bad */
  14659. ++ if (mi->groups[group].rates[rate].prob_ewma < MINSTREL_FRAC(50, 100))
  14660. ++ return 1;
  14661. ++
  14662. ++ /* If the rate is slower than single-stream MCS1, make A-MSDU limit small */
  14663. ++ if (g->duration[rate] > MCS_DURATION(1, 0, 52))
  14664. ++ return 500;
  14665. ++
  14666. ++ /*
  14667. ++ * If the rate is slower than single-stream MCS4, limit A-MSDU to usual
  14668. ++ * data packet size
  14669. ++ */
  14670. ++ if (g->duration[rate] > MCS_DURATION(1, 0, 104))
  14671. ++ return 1500;
  14672. ++
  14673. ++ /*
  14674. ++ * If the rate is slower than single-stream MCS7, limit A-MSDU to twice
  14675. ++ * the usual data packet size
  14676. ++ */
  14677. ++ if (g->duration[rate] > MCS_DURATION(1, 0, 260))
  14678. ++ return 3000;
  14679. ++
  14680. ++ /* unlimited */
  14681. ++ return 0;
  14682. ++}
  14683. ++
  14684. + static void
  14685. + minstrel_ht_update_rates(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
  14686. + {
  14687. +@@ -907,6 +940,7 @@ minstrel_ht_update_rates(struct minstrel
  14688. + minstrel_ht_set_rate(mp, mi, rates, i++, mi->max_prob_rate);
  14689. + }
  14690. +
  14691. ++ mi->sta->max_rc_amsdu_len = minstrel_ht_get_max_amsdu_len(mi);
  14692. + rates->rate[i].idx = -1;
  14693. + rate_control_set_rates(mp->hw, mi->sta, rates);
  14694. + }
  14695. 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
  14696. deleted file mode 100644
  14697. index 7a688c4..0000000
  14698. --- a/package/kernel/mac80211/patches/336-0001-brcmfmac-remove-duplication-of-ramsize-info.patch
  14699. +++ /dev/null
  14700. @@ -1,48 +0,0 @@
  14701. -From: Arend van Spriel <arend@broadcom.com>
  14702. -Date: Wed, 11 Mar 2015 16:11:27 +0100
  14703. -Subject: [PATCH] brcmfmac: remove duplication of ramsize info
  14704. -
  14705. -Removing the ramsize from the brcmf_sdio structure to avoid
  14706. -duplication. The information is available in brcmf_chip
  14707. -structure.
  14708. -
  14709. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14710. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14711. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14712. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14713. ----
  14714. -
  14715. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14716. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14717. -@@ -432,8 +432,6 @@ struct brcmf_sdio {
  14718. - struct brcmf_sdio_dev *sdiodev; /* sdio device handler */
  14719. - struct brcmf_chip *ci; /* Chip info struct */
  14720. -
  14721. -- u32 ramsize; /* Size of RAM in SOCRAM (bytes) */
  14722. --
  14723. - u32 hostintmask; /* Copy of Host Interrupt Mask */
  14724. - atomic_t intstatus; /* Intstatus bits (events) pending */
  14725. - atomic_t fcstate; /* State of dongle flow-control */
  14726. -@@ -1075,7 +1073,7 @@ static int brcmf_sdio_readshared(struct
  14727. - struct sdpcm_shared_le sh_le;
  14728. - __le32 addr_le;
  14729. -
  14730. -- shaddr = bus->ci->rambase + bus->ramsize - 4;
  14731. -+ shaddr = bus->ci->rambase + bus->ci->ramsize - 4;
  14732. -
  14733. - /*
  14734. - * Read last word in socram to determine
  14735. -@@ -3871,13 +3869,6 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
  14736. - drivestrength = DEFAULT_SDIO_DRIVE_STRENGTH;
  14737. - brcmf_sdio_drivestrengthinit(bus->sdiodev, bus->ci, drivestrength);
  14738. -
  14739. -- /* Get info on the SOCRAM cores... */
  14740. -- bus->ramsize = bus->ci->ramsize;
  14741. -- if (!(bus->ramsize)) {
  14742. -- brcmf_err("failed to find SOCRAM memory!\n");
  14743. -- goto fail;
  14744. -- }
  14745. --
  14746. - /* Set card control so an SDIO card reset does a WLAN backplane reset */
  14747. - reg_val = brcmf_sdiod_regrb(bus->sdiodev,
  14748. - SDIO_CCCR_BRCM_CARDCTRL, &err);
  14749. 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
  14750. deleted file mode 100644
  14751. index e2a2074..0000000
  14752. --- a/package/kernel/mac80211/patches/336-0002-brcmfmac-always-perform-cores-checks.patch
  14753. +++ /dev/null
  14754. @@ -1,74 +0,0 @@
  14755. -From: Arend van Spriel <arend@broadcom.com>
  14756. -Date: Wed, 11 Mar 2015 16:11:28 +0100
  14757. -Subject: [PATCH] brcmfmac: always perform cores checks
  14758. -
  14759. -Instead of checking the cores in the chip only if CONFIG_BRCMDBG
  14760. -is selected perform the check always and extend it with more sanity
  14761. -checking.
  14762. -
  14763. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14764. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14765. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14766. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14767. ----
  14768. -
  14769. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  14770. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  14771. -@@ -419,13 +419,13 @@ static struct brcmf_core *brcmf_chip_add
  14772. - return &core->pub;
  14773. - }
  14774. -
  14775. --#ifdef DEBUG
  14776. - /* safety check for chipinfo */
  14777. - static int brcmf_chip_cores_check(struct brcmf_chip_priv *ci)
  14778. - {
  14779. - struct brcmf_core_priv *core;
  14780. - bool need_socram = false;
  14781. - bool has_socram = false;
  14782. -+ bool cpu_found = false;
  14783. - int idx = 1;
  14784. -
  14785. - list_for_each_entry(core, &ci->cores, list) {
  14786. -@@ -435,12 +435,14 @@ static int brcmf_chip_cores_check(struct
  14787. -
  14788. - switch (core->pub.id) {
  14789. - case BCMA_CORE_ARM_CM3:
  14790. -+ cpu_found = true;
  14791. - need_socram = true;
  14792. - break;
  14793. - case BCMA_CORE_INTERNAL_MEM:
  14794. - has_socram = true;
  14795. - break;
  14796. - case BCMA_CORE_ARM_CR4:
  14797. -+ cpu_found = true;
  14798. - if (ci->pub.rambase == 0) {
  14799. - brcmf_err("RAM base not provided with ARM CR4 core\n");
  14800. - return -ENOMEM;
  14801. -@@ -451,19 +453,21 @@ static int brcmf_chip_cores_check(struct
  14802. - }
  14803. - }
  14804. -
  14805. -+ if (!cpu_found) {
  14806. -+ brcmf_err("CPU core not detected\n");
  14807. -+ return -ENXIO;
  14808. -+ }
  14809. - /* check RAM core presence for ARM CM3 core */
  14810. - if (need_socram && !has_socram) {
  14811. - brcmf_err("RAM core not provided with ARM CM3 core\n");
  14812. - return -ENODEV;
  14813. - }
  14814. -+ if (!ci->pub.ramsize) {
  14815. -+ brcmf_err("RAM size is undetermined\n");
  14816. -+ return -ENOMEM;
  14817. -+ }
  14818. - return 0;
  14819. - }
  14820. --#else /* DEBUG */
  14821. --static inline int brcmf_chip_cores_check(struct brcmf_chip_priv *ci)
  14822. --{
  14823. -- return 0;
  14824. --}
  14825. --#endif
  14826. -
  14827. - static void brcmf_chip_get_raminfo(struct brcmf_chip_priv *ci)
  14828. - {
  14829. 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
  14830. deleted file mode 100644
  14831. index a272800..0000000
  14832. --- a/package/kernel/mac80211/patches/336-0003-brcmfmac-rename-chip-download-functions.patch
  14833. +++ /dev/null
  14834. @@ -1,240 +0,0 @@
  14835. -From: Arend van Spriel <arend@broadcom.com>
  14836. -Date: Wed, 11 Mar 2015 16:11:29 +0100
  14837. -Subject: [PATCH] brcmfmac: rename chip download functions
  14838. -
  14839. -The functions brcmf_chip_[enter/exit]_download() are not exclusively
  14840. -used for firmware download so rename these more appropriate.
  14841. -
  14842. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14843. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14844. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14845. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14846. ----
  14847. -
  14848. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  14849. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  14850. -@@ -807,7 +807,7 @@ struct brcmf_chip *brcmf_chip_attach(voi
  14851. - err = -EINVAL;
  14852. - if (WARN_ON(!ops->prepare))
  14853. - err = -EINVAL;
  14854. -- if (WARN_ON(!ops->exit_dl))
  14855. -+ if (WARN_ON(!ops->activate))
  14856. - err = -EINVAL;
  14857. - if (err < 0)
  14858. - return ERR_PTR(-EINVAL);
  14859. -@@ -905,7 +905,7 @@ void brcmf_chip_resetcore(struct brcmf_c
  14860. - }
  14861. -
  14862. - static void
  14863. --brcmf_chip_cm3_enterdl(struct brcmf_chip_priv *chip)
  14864. -+brcmf_chip_cm3_set_passive(struct brcmf_chip_priv *chip)
  14865. - {
  14866. - struct brcmf_core *core;
  14867. -
  14868. -@@ -919,7 +919,7 @@ brcmf_chip_cm3_enterdl(struct brcmf_chip
  14869. - brcmf_chip_resetcore(core, 0, 0, 0);
  14870. - }
  14871. -
  14872. --static bool brcmf_chip_cm3_exitdl(struct brcmf_chip_priv *chip)
  14873. -+static bool brcmf_chip_cm3_set_active(struct brcmf_chip_priv *chip)
  14874. - {
  14875. - struct brcmf_core *core;
  14876. -
  14877. -@@ -929,7 +929,7 @@ static bool brcmf_chip_cm3_exitdl(struct
  14878. - return false;
  14879. - }
  14880. -
  14881. -- chip->ops->exit_dl(chip->ctx, &chip->pub, 0);
  14882. -+ chip->ops->activate(chip->ctx, &chip->pub, 0);
  14883. -
  14884. - core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_ARM_CM3);
  14885. - brcmf_chip_resetcore(core, 0, 0, 0);
  14886. -@@ -938,7 +938,7 @@ static bool brcmf_chip_cm3_exitdl(struct
  14887. - }
  14888. -
  14889. - static inline void
  14890. --brcmf_chip_cr4_enterdl(struct brcmf_chip_priv *chip)
  14891. -+brcmf_chip_cr4_set_passive(struct brcmf_chip_priv *chip)
  14892. - {
  14893. - struct brcmf_core *core;
  14894. -
  14895. -@@ -951,11 +951,11 @@ brcmf_chip_cr4_enterdl(struct brcmf_chip
  14896. - D11_BCMA_IOCTL_PHYCLOCKEN);
  14897. - }
  14898. -
  14899. --static bool brcmf_chip_cr4_exitdl(struct brcmf_chip_priv *chip, u32 rstvec)
  14900. -+static bool brcmf_chip_cr4_set_active(struct brcmf_chip_priv *chip, u32 rstvec)
  14901. - {
  14902. - struct brcmf_core *core;
  14903. -
  14904. -- chip->ops->exit_dl(chip->ctx, &chip->pub, rstvec);
  14905. -+ chip->ops->activate(chip->ctx, &chip->pub, rstvec);
  14906. -
  14907. - /* restore ARM */
  14908. - core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_ARM_CR4);
  14909. -@@ -964,7 +964,7 @@ static bool brcmf_chip_cr4_exitdl(struct
  14910. - return true;
  14911. - }
  14912. -
  14913. --void brcmf_chip_enter_download(struct brcmf_chip *pub)
  14914. -+void brcmf_chip_set_passive(struct brcmf_chip *pub)
  14915. - {
  14916. - struct brcmf_chip_priv *chip;
  14917. - struct brcmf_core *arm;
  14918. -@@ -974,14 +974,14 @@ void brcmf_chip_enter_download(struct br
  14919. - chip = container_of(pub, struct brcmf_chip_priv, pub);
  14920. - arm = brcmf_chip_get_core(pub, BCMA_CORE_ARM_CR4);
  14921. - if (arm) {
  14922. -- brcmf_chip_cr4_enterdl(chip);
  14923. -+ brcmf_chip_cr4_set_passive(chip);
  14924. - return;
  14925. - }
  14926. -
  14927. -- brcmf_chip_cm3_enterdl(chip);
  14928. -+ brcmf_chip_cm3_set_passive(chip);
  14929. - }
  14930. -
  14931. --bool brcmf_chip_exit_download(struct brcmf_chip *pub, u32 rstvec)
  14932. -+bool brcmf_chip_set_active(struct brcmf_chip *pub, u32 rstvec)
  14933. - {
  14934. - struct brcmf_chip_priv *chip;
  14935. - struct brcmf_core *arm;
  14936. -@@ -991,9 +991,9 @@ bool brcmf_chip_exit_download(struct brc
  14937. - chip = container_of(pub, struct brcmf_chip_priv, pub);
  14938. - arm = brcmf_chip_get_core(pub, BCMA_CORE_ARM_CR4);
  14939. - if (arm)
  14940. -- return brcmf_chip_cr4_exitdl(chip, rstvec);
  14941. -+ return brcmf_chip_cr4_set_active(chip, rstvec);
  14942. -
  14943. -- return brcmf_chip_cm3_exitdl(chip);
  14944. -+ return brcmf_chip_cm3_set_active(chip);
  14945. - }
  14946. -
  14947. - bool brcmf_chip_sr_capable(struct brcmf_chip *pub)
  14948. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  14949. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  14950. -@@ -64,7 +64,7 @@ struct brcmf_core {
  14951. - * @write32: write 32-bit value over bus.
  14952. - * @prepare: prepare bus for core configuration.
  14953. - * @setup: bus-specific core setup.
  14954. -- * @exit_dl: exit download state.
  14955. -+ * @active: chip becomes active.
  14956. - * The callback should use the provided @rstvec when non-zero.
  14957. - */
  14958. - struct brcmf_buscore_ops {
  14959. -@@ -72,7 +72,7 @@ struct brcmf_buscore_ops {
  14960. - void (*write32)(void *ctx, u32 addr, u32 value);
  14961. - int (*prepare)(void *ctx);
  14962. - int (*setup)(void *ctx, struct brcmf_chip *chip);
  14963. -- void (*exit_dl)(void *ctx, struct brcmf_chip *chip, u32 rstvec);
  14964. -+ void (*activate)(void *ctx, struct brcmf_chip *chip, u32 rstvec);
  14965. - };
  14966. -
  14967. - struct brcmf_chip *brcmf_chip_attach(void *ctx,
  14968. -@@ -84,8 +84,8 @@ bool brcmf_chip_iscoreup(struct brcmf_co
  14969. - void brcmf_chip_coredisable(struct brcmf_core *core, u32 prereset, u32 reset);
  14970. - void brcmf_chip_resetcore(struct brcmf_core *core, u32 prereset, u32 reset,
  14971. - u32 postreset);
  14972. --void brcmf_chip_enter_download(struct brcmf_chip *ci);
  14973. --bool brcmf_chip_exit_download(struct brcmf_chip *ci, u32 rstvec);
  14974. -+void brcmf_chip_set_passive(struct brcmf_chip *ci);
  14975. -+bool brcmf_chip_set_active(struct brcmf_chip *ci, u32 rstvec);
  14976. - bool brcmf_chip_sr_capable(struct brcmf_chip *pub);
  14977. -
  14978. - #endif /* BRCMF_AXIDMP_H */
  14979. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  14980. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  14981. -@@ -509,7 +509,7 @@ static void brcmf_pcie_attach(struct brc
  14982. -
  14983. - static int brcmf_pcie_enter_download_state(struct brcmf_pciedev_info *devinfo)
  14984. - {
  14985. -- brcmf_chip_enter_download(devinfo->ci);
  14986. -+ brcmf_chip_set_passive(devinfo->ci);
  14987. -
  14988. - if (devinfo->ci->chip == BRCM_CC_43602_CHIP_ID) {
  14989. - brcmf_pcie_select_core(devinfo, BCMA_CORE_ARM_CR4);
  14990. -@@ -536,7 +536,7 @@ static int brcmf_pcie_exit_download_stat
  14991. - brcmf_chip_resetcore(core, 0, 0, 0);
  14992. - }
  14993. -
  14994. -- return !brcmf_chip_exit_download(devinfo->ci, resetintr);
  14995. -+ return !brcmf_chip_set_active(devinfo->ci, resetintr);
  14996. - }
  14997. -
  14998. -
  14999. -@@ -1566,8 +1566,8 @@ static int brcmf_pcie_buscoreprep(void *
  15000. - }
  15001. -
  15002. -
  15003. --static void brcmf_pcie_buscore_exitdl(void *ctx, struct brcmf_chip *chip,
  15004. -- u32 rstvec)
  15005. -+static void brcmf_pcie_buscore_activate(void *ctx, struct brcmf_chip *chip,
  15006. -+ u32 rstvec)
  15007. - {
  15008. - struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)ctx;
  15009. -
  15010. -@@ -1577,7 +1577,7 @@ static void brcmf_pcie_buscore_exitdl(vo
  15011. -
  15012. - static const struct brcmf_buscore_ops brcmf_pcie_buscore_ops = {
  15013. - .prepare = brcmf_pcie_buscoreprep,
  15014. -- .exit_dl = brcmf_pcie_buscore_exitdl,
  15015. -+ .activate = brcmf_pcie_buscore_activate,
  15016. - .read32 = brcmf_pcie_buscore_read32,
  15017. - .write32 = brcmf_pcie_buscore_write32,
  15018. - };
  15019. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15020. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15021. -@@ -3357,7 +3357,7 @@ static int brcmf_sdio_download_firmware(
  15022. - brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
  15023. -
  15024. - /* Keep arm in reset */
  15025. -- brcmf_chip_enter_download(bus->ci);
  15026. -+ brcmf_chip_set_passive(bus->ci);
  15027. -
  15028. - rstvec = get_unaligned_le32(fw->data);
  15029. - brcmf_dbg(SDIO, "firmware rstvec: %x\n", rstvec);
  15030. -@@ -3378,7 +3378,7 @@ static int brcmf_sdio_download_firmware(
  15031. - }
  15032. -
  15033. - /* Take arm out of reset */
  15034. -- if (!brcmf_chip_exit_download(bus->ci, rstvec)) {
  15035. -+ if (!brcmf_chip_set_active(bus->ci, rstvec)) {
  15036. - brcmf_err("error getting out of ARM core reset\n");
  15037. - goto err;
  15038. - }
  15039. -@@ -3771,8 +3771,8 @@ static int brcmf_sdio_buscoreprep(void *
  15040. - return 0;
  15041. - }
  15042. -
  15043. --static void brcmf_sdio_buscore_exitdl(void *ctx, struct brcmf_chip *chip,
  15044. -- u32 rstvec)
  15045. -+static void brcmf_sdio_buscore_activate(void *ctx, struct brcmf_chip *chip,
  15046. -+ u32 rstvec)
  15047. - {
  15048. - struct brcmf_sdio_dev *sdiodev = ctx;
  15049. - struct brcmf_core *core;
  15050. -@@ -3815,7 +3815,7 @@ static void brcmf_sdio_buscore_write32(v
  15051. -
  15052. - static const struct brcmf_buscore_ops brcmf_sdio_buscore_ops = {
  15053. - .prepare = brcmf_sdio_buscoreprep,
  15054. -- .exit_dl = brcmf_sdio_buscore_exitdl,
  15055. -+ .activate = brcmf_sdio_buscore_activate,
  15056. - .read32 = brcmf_sdio_buscore_read32,
  15057. - .write32 = brcmf_sdio_buscore_write32,
  15058. - };
  15059. -@@ -4239,12 +4239,11 @@ void brcmf_sdio_remove(struct brcmf_sdio
  15060. - sdio_claim_host(bus->sdiodev->func[1]);
  15061. - brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
  15062. - /* Leave the device in state where it is
  15063. -- * 'quiet'. This is done by putting it in
  15064. -- * download_state which essentially resets
  15065. -- * all necessary cores.
  15066. -+ * 'passive'. This is done by resetting all
  15067. -+ * necessary cores.
  15068. - */
  15069. - msleep(20);
  15070. -- brcmf_chip_enter_download(bus->ci);
  15071. -+ brcmf_chip_set_passive(bus->ci);
  15072. - brcmf_sdio_clkctl(bus, CLK_NONE, false);
  15073. - sdio_release_host(bus->sdiodev->func[1]);
  15074. - }
  15075. 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
  15076. deleted file mode 100644
  15077. index 6b1dd81..0000000
  15078. --- a/package/kernel/mac80211/patches/336-0004-brcmfmac-assure-device-is-ready-for-download-after-b.patch
  15079. +++ /dev/null
  15080. @@ -1,61 +0,0 @@
  15081. -From: Arend van Spriel <arend@broadcom.com>
  15082. -Date: Wed, 11 Mar 2015 16:11:30 +0100
  15083. -Subject: [PATCH] brcmfmac: assure device is ready for download after
  15084. - brcmf_chip_attach()
  15085. -
  15086. -Make the brcmf_chip_attach() function responsible for putting the
  15087. -device in a state where it is accessible for firmware download.
  15088. -
  15089. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15090. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15091. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15092. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15093. ----
  15094. -
  15095. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  15096. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  15097. -@@ -786,12 +786,6 @@ static int brcmf_chip_setup(struct brcmf
  15098. - if (chip->ops->setup)
  15099. - ret = chip->ops->setup(chip->ctx, pub);
  15100. -
  15101. -- /*
  15102. -- * Make sure any on-chip ARM is off (in case strapping is wrong),
  15103. -- * or downloaded code was already running.
  15104. -- */
  15105. -- brcmf_chip_disable_arm(chip, BCMA_CORE_ARM_CM3);
  15106. -- brcmf_chip_disable_arm(chip, BCMA_CORE_ARM_CR4);
  15107. - return ret;
  15108. - }
  15109. -
  15110. -@@ -833,6 +827,8 @@ struct brcmf_chip *brcmf_chip_attach(voi
  15111. - if (err < 0)
  15112. - goto fail;
  15113. -
  15114. -+ /* assure chip is passive for download */
  15115. -+ brcmf_chip_set_passive(&chip->pub);
  15116. - return &chip->pub;
  15117. -
  15118. - fail:
  15119. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  15120. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  15121. -@@ -509,8 +509,6 @@ static void brcmf_pcie_attach(struct brc
  15122. -
  15123. - static int brcmf_pcie_enter_download_state(struct brcmf_pciedev_info *devinfo)
  15124. - {
  15125. -- brcmf_chip_set_passive(devinfo->ci);
  15126. --
  15127. - if (devinfo->ci->chip == BRCM_CC_43602_CHIP_ID) {
  15128. - brcmf_pcie_select_core(devinfo, BCMA_CORE_ARM_CR4);
  15129. - brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_ARMCR4REG_BANKIDX,
  15130. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15131. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15132. -@@ -3356,9 +3356,6 @@ static int brcmf_sdio_download_firmware(
  15133. - sdio_claim_host(bus->sdiodev->func[1]);
  15134. - brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
  15135. -
  15136. -- /* Keep arm in reset */
  15137. -- brcmf_chip_set_passive(bus->ci);
  15138. --
  15139. - rstvec = get_unaligned_le32(fw->data);
  15140. - brcmf_dbg(SDIO, "firmware rstvec: %x\n", rstvec);
  15141. -
  15142. 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
  15143. deleted file mode 100644
  15144. index bcc2ed4..0000000
  15145. --- a/package/kernel/mac80211/patches/336-0005-brcmfmac-extract-ram-size-info-from-internal-memory-.patch
  15146. +++ /dev/null
  15147. @@ -1,367 +0,0 @@
  15148. -From: Arend van Spriel <arend@broadcom.com>
  15149. -Date: Wed, 11 Mar 2015 16:11:31 +0100
  15150. -Subject: [PATCH] brcmfmac: extract ram size info from internal memory
  15151. - registers
  15152. -
  15153. -Instead of hard-coded memory sizes it is possible to obtain that
  15154. -information from the internal memory registers.
  15155. -
  15156. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15157. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  15158. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15159. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15160. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15161. ----
  15162. -
  15163. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  15164. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  15165. -@@ -100,9 +100,6 @@
  15166. - #define BCM4329_CORE_SOCRAM_BASE 0x18003000
  15167. - /* ARM Cortex M3 core, ID 0x82a */
  15168. - #define BCM4329_CORE_ARM_BASE 0x18002000
  15169. --#define BCM4329_RAMSIZE 0x48000
  15170. --/* bcm43143 */
  15171. --#define BCM43143_RAMSIZE 0x70000
  15172. -
  15173. - #define CORE_SB(base, field) \
  15174. - (base + SBCONFIGOFF + offsetof(struct sbconfig, field))
  15175. -@@ -150,6 +147,78 @@ struct sbconfig {
  15176. - u32 sbidhigh; /* identification */
  15177. - };
  15178. -
  15179. -+/* bankidx and bankinfo reg defines corerev >= 8 */
  15180. -+#define SOCRAM_BANKINFO_RETNTRAM_MASK 0x00010000
  15181. -+#define SOCRAM_BANKINFO_SZMASK 0x0000007f
  15182. -+#define SOCRAM_BANKIDX_ROM_MASK 0x00000100
  15183. -+
  15184. -+#define SOCRAM_BANKIDX_MEMTYPE_SHIFT 8
  15185. -+/* socram bankinfo memtype */
  15186. -+#define SOCRAM_MEMTYPE_RAM 0
  15187. -+#define SOCRAM_MEMTYPE_R0M 1
  15188. -+#define SOCRAM_MEMTYPE_DEVRAM 2
  15189. -+
  15190. -+#define SOCRAM_BANKINFO_SZBASE 8192
  15191. -+#define SRCI_LSS_MASK 0x00f00000
  15192. -+#define SRCI_LSS_SHIFT 20
  15193. -+#define SRCI_SRNB_MASK 0xf0
  15194. -+#define SRCI_SRNB_SHIFT 4
  15195. -+#define SRCI_SRBSZ_MASK 0xf
  15196. -+#define SRCI_SRBSZ_SHIFT 0
  15197. -+#define SR_BSZ_BASE 14
  15198. -+
  15199. -+struct sbsocramregs {
  15200. -+ u32 coreinfo;
  15201. -+ u32 bwalloc;
  15202. -+ u32 extracoreinfo;
  15203. -+ u32 biststat;
  15204. -+ u32 bankidx;
  15205. -+ u32 standbyctrl;
  15206. -+
  15207. -+ u32 errlogstatus; /* rev 6 */
  15208. -+ u32 errlogaddr; /* rev 6 */
  15209. -+ /* used for patching rev 3 & 5 */
  15210. -+ u32 cambankidx;
  15211. -+ u32 cambankstandbyctrl;
  15212. -+ u32 cambankpatchctrl;
  15213. -+ u32 cambankpatchtblbaseaddr;
  15214. -+ u32 cambankcmdreg;
  15215. -+ u32 cambankdatareg;
  15216. -+ u32 cambankmaskreg;
  15217. -+ u32 PAD[1];
  15218. -+ u32 bankinfo; /* corev 8 */
  15219. -+ u32 bankpda;
  15220. -+ u32 PAD[14];
  15221. -+ u32 extmemconfig;
  15222. -+ u32 extmemparitycsr;
  15223. -+ u32 extmemparityerrdata;
  15224. -+ u32 extmemparityerrcnt;
  15225. -+ u32 extmemwrctrlandsize;
  15226. -+ u32 PAD[84];
  15227. -+ u32 workaround;
  15228. -+ u32 pwrctl; /* corerev >= 2 */
  15229. -+ u32 PAD[133];
  15230. -+ u32 sr_control; /* corerev >= 15 */
  15231. -+ u32 sr_status; /* corerev >= 15 */
  15232. -+ u32 sr_address; /* corerev >= 15 */
  15233. -+ u32 sr_data; /* corerev >= 15 */
  15234. -+};
  15235. -+
  15236. -+#define SOCRAMREGOFFS(_f) offsetof(struct sbsocramregs, _f)
  15237. -+
  15238. -+#define ARMCR4_CAP (0x04)
  15239. -+#define ARMCR4_BANKIDX (0x40)
  15240. -+#define ARMCR4_BANKINFO (0x44)
  15241. -+#define ARMCR4_BANKPDA (0x4C)
  15242. -+
  15243. -+#define ARMCR4_TCBBNB_MASK 0xf0
  15244. -+#define ARMCR4_TCBBNB_SHIFT 4
  15245. -+#define ARMCR4_TCBANB_MASK 0xf
  15246. -+#define ARMCR4_TCBANB_SHIFT 0
  15247. -+
  15248. -+#define ARMCR4_BSZ_MASK 0x3f
  15249. -+#define ARMCR4_BSZ_MULT 8192
  15250. -+
  15251. - struct brcmf_core_priv {
  15252. - struct brcmf_core pub;
  15253. - u32 wrapbase;
  15254. -@@ -443,10 +512,6 @@ static int brcmf_chip_cores_check(struct
  15255. - break;
  15256. - case BCMA_CORE_ARM_CR4:
  15257. - cpu_found = true;
  15258. -- if (ci->pub.rambase == 0) {
  15259. -- brcmf_err("RAM base not provided with ARM CR4 core\n");
  15260. -- return -ENOMEM;
  15261. -- }
  15262. - break;
  15263. - default:
  15264. - break;
  15265. -@@ -462,60 +527,160 @@ static int brcmf_chip_cores_check(struct
  15266. - brcmf_err("RAM core not provided with ARM CM3 core\n");
  15267. - return -ENODEV;
  15268. - }
  15269. -- if (!ci->pub.ramsize) {
  15270. -- brcmf_err("RAM size is undetermined\n");
  15271. -- return -ENOMEM;
  15272. -- }
  15273. - return 0;
  15274. - }
  15275. -
  15276. --static void brcmf_chip_get_raminfo(struct brcmf_chip_priv *ci)
  15277. -+static u32 brcmf_chip_core_read32(struct brcmf_core_priv *core, u16 reg)
  15278. - {
  15279. -- switch (ci->pub.chip) {
  15280. -- case BRCM_CC_4329_CHIP_ID:
  15281. -- ci->pub.ramsize = BCM4329_RAMSIZE;
  15282. -- break;
  15283. -- case BRCM_CC_43143_CHIP_ID:
  15284. -- ci->pub.ramsize = BCM43143_RAMSIZE;
  15285. -- break;
  15286. -- case BRCM_CC_43241_CHIP_ID:
  15287. -- ci->pub.ramsize = 0x90000;
  15288. -- break;
  15289. -- case BRCM_CC_4330_CHIP_ID:
  15290. -- ci->pub.ramsize = 0x48000;
  15291. -- break;
  15292. -+ return core->chip->ops->read32(core->chip->ctx, core->pub.base + reg);
  15293. -+}
  15294. -+
  15295. -+static void brcmf_chip_core_write32(struct brcmf_core_priv *core,
  15296. -+ u16 reg, u32 val)
  15297. -+{
  15298. -+ core->chip->ops->write32(core->chip->ctx, core->pub.base + reg, val);
  15299. -+}
  15300. -+
  15301. -+static bool brcmf_chip_socram_banksize(struct brcmf_core_priv *core, u8 idx,
  15302. -+ u32 *banksize)
  15303. -+{
  15304. -+ u32 bankinfo;
  15305. -+ u32 bankidx = (SOCRAM_MEMTYPE_RAM << SOCRAM_BANKIDX_MEMTYPE_SHIFT);
  15306. -+
  15307. -+ bankidx |= idx;
  15308. -+ brcmf_chip_core_write32(core, SOCRAMREGOFFS(bankidx), bankidx);
  15309. -+ bankinfo = brcmf_chip_core_read32(core, SOCRAMREGOFFS(bankinfo));
  15310. -+ *banksize = (bankinfo & SOCRAM_BANKINFO_SZMASK) + 1;
  15311. -+ *banksize *= SOCRAM_BANKINFO_SZBASE;
  15312. -+ return !!(bankinfo & SOCRAM_BANKINFO_RETNTRAM_MASK);
  15313. -+}
  15314. -+
  15315. -+static void brcmf_chip_socram_ramsize(struct brcmf_core_priv *sr, u32 *ramsize,
  15316. -+ u32 *srsize)
  15317. -+{
  15318. -+ u32 coreinfo;
  15319. -+ uint nb, banksize, lss;
  15320. -+ bool retent;
  15321. -+ int i;
  15322. -+
  15323. -+ *ramsize = 0;
  15324. -+ *srsize = 0;
  15325. -+
  15326. -+ if (WARN_ON(sr->pub.rev < 4))
  15327. -+ return;
  15328. -+
  15329. -+ if (!brcmf_chip_iscoreup(&sr->pub))
  15330. -+ brcmf_chip_resetcore(&sr->pub, 0, 0, 0);
  15331. -+
  15332. -+ /* Get info for determining size */
  15333. -+ coreinfo = brcmf_chip_core_read32(sr, SOCRAMREGOFFS(coreinfo));
  15334. -+ nb = (coreinfo & SRCI_SRNB_MASK) >> SRCI_SRNB_SHIFT;
  15335. -+
  15336. -+ if ((sr->pub.rev <= 7) || (sr->pub.rev == 12)) {
  15337. -+ banksize = (coreinfo & SRCI_SRBSZ_MASK);
  15338. -+ lss = (coreinfo & SRCI_LSS_MASK) >> SRCI_LSS_SHIFT;
  15339. -+ if (lss != 0)
  15340. -+ nb--;
  15341. -+ *ramsize = nb * (1 << (banksize + SR_BSZ_BASE));
  15342. -+ if (lss != 0)
  15343. -+ *ramsize += (1 << ((lss - 1) + SR_BSZ_BASE));
  15344. -+ } else {
  15345. -+ nb = (coreinfo & SRCI_SRNB_MASK) >> SRCI_SRNB_SHIFT;
  15346. -+ for (i = 0; i < nb; i++) {
  15347. -+ retent = brcmf_chip_socram_banksize(sr, i, &banksize);
  15348. -+ *ramsize += banksize;
  15349. -+ if (retent)
  15350. -+ *srsize += banksize;
  15351. -+ }
  15352. -+ }
  15353. -+
  15354. -+ /* hardcoded save&restore memory sizes */
  15355. -+ switch (sr->chip->pub.chip) {
  15356. - case BRCM_CC_4334_CHIP_ID:
  15357. -- case BRCM_CC_43340_CHIP_ID:
  15358. -- ci->pub.ramsize = 0x80000;
  15359. -+ if (sr->chip->pub.chiprev < 2)
  15360. -+ *srsize = (32 * 1024);
  15361. - break;
  15362. -- case BRCM_CC_4335_CHIP_ID:
  15363. -- ci->pub.ramsize = 0xc0000;
  15364. -- ci->pub.rambase = 0x180000;
  15365. -- break;
  15366. -- case BRCM_CC_43362_CHIP_ID:
  15367. -- ci->pub.ramsize = 0x3c000;
  15368. -+ default:
  15369. - break;
  15370. -+ }
  15371. -+}
  15372. -+
  15373. -+/** Return the TCM-RAM size of the ARMCR4 core. */
  15374. -+static u32 brcmf_chip_tcm_ramsize(struct brcmf_core_priv *cr4)
  15375. -+{
  15376. -+ u32 corecap;
  15377. -+ u32 memsize = 0;
  15378. -+ u32 nab;
  15379. -+ u32 nbb;
  15380. -+ u32 totb;
  15381. -+ u32 bxinfo;
  15382. -+ u32 idx;
  15383. -+
  15384. -+ corecap = brcmf_chip_core_read32(cr4, ARMCR4_CAP);
  15385. -+
  15386. -+ nab = (corecap & ARMCR4_TCBANB_MASK) >> ARMCR4_TCBANB_SHIFT;
  15387. -+ nbb = (corecap & ARMCR4_TCBBNB_MASK) >> ARMCR4_TCBBNB_SHIFT;
  15388. -+ totb = nab + nbb;
  15389. -+
  15390. -+ for (idx = 0; idx < totb; idx++) {
  15391. -+ brcmf_chip_core_write32(cr4, ARMCR4_BANKIDX, idx);
  15392. -+ bxinfo = brcmf_chip_core_read32(cr4, ARMCR4_BANKINFO);
  15393. -+ memsize += ((bxinfo & ARMCR4_BSZ_MASK) + 1) * ARMCR4_BSZ_MULT;
  15394. -+ }
  15395. -+
  15396. -+ return memsize;
  15397. -+}
  15398. -+
  15399. -+static u32 brcmf_chip_tcm_rambase(struct brcmf_chip_priv *ci)
  15400. -+{
  15401. -+ switch (ci->pub.chip) {
  15402. - case BRCM_CC_4345_CHIP_ID:
  15403. -- ci->pub.ramsize = 0xc8000;
  15404. -- ci->pub.rambase = 0x198000;
  15405. -- break;
  15406. -+ return 0x198000;
  15407. -+ case BRCM_CC_4335_CHIP_ID:
  15408. - case BRCM_CC_4339_CHIP_ID:
  15409. - case BRCM_CC_4354_CHIP_ID:
  15410. - case BRCM_CC_4356_CHIP_ID:
  15411. - case BRCM_CC_43567_CHIP_ID:
  15412. - case BRCM_CC_43569_CHIP_ID:
  15413. - case BRCM_CC_43570_CHIP_ID:
  15414. -- ci->pub.ramsize = 0xc0000;
  15415. -- ci->pub.rambase = 0x180000;
  15416. -- break;
  15417. - case BRCM_CC_43602_CHIP_ID:
  15418. -- ci->pub.ramsize = 0xf0000;
  15419. -- ci->pub.rambase = 0x180000;
  15420. -- break;
  15421. -+ return 0x180000;
  15422. - default:
  15423. - brcmf_err("unknown chip: %s\n", ci->pub.name);
  15424. - break;
  15425. - }
  15426. -+ return 0;
  15427. -+}
  15428. -+
  15429. -+static int brcmf_chip_get_raminfo(struct brcmf_chip_priv *ci)
  15430. -+{
  15431. -+ struct brcmf_core_priv *mem_core;
  15432. -+ struct brcmf_core *mem;
  15433. -+
  15434. -+ mem = brcmf_chip_get_core(&ci->pub, BCMA_CORE_ARM_CR4);
  15435. -+ if (mem) {
  15436. -+ mem_core = container_of(mem, struct brcmf_core_priv, pub);
  15437. -+ ci->pub.ramsize = brcmf_chip_tcm_ramsize(mem_core);
  15438. -+ ci->pub.rambase = brcmf_chip_tcm_rambase(ci);
  15439. -+ if (!ci->pub.rambase) {
  15440. -+ brcmf_err("RAM base not provided with ARM CR4 core\n");
  15441. -+ return -EINVAL;
  15442. -+ }
  15443. -+ } else {
  15444. -+ mem = brcmf_chip_get_core(&ci->pub, BCMA_CORE_INTERNAL_MEM);
  15445. -+ mem_core = container_of(mem, struct brcmf_core_priv, pub);
  15446. -+ brcmf_chip_socram_ramsize(mem_core, &ci->pub.ramsize,
  15447. -+ &ci->pub.srsize);
  15448. -+ }
  15449. -+ brcmf_dbg(INFO, "RAM: base=0x%x size=%d (0x%x) sr=%d (0x%x)\n",
  15450. -+ ci->pub.rambase, ci->pub.ramsize, ci->pub.ramsize,
  15451. -+ ci->pub.srsize, ci->pub.srsize);
  15452. -+
  15453. -+ if (!ci->pub.ramsize) {
  15454. -+ brcmf_err("RAM size is undetermined\n");
  15455. -+ return -ENOMEM;
  15456. -+ }
  15457. -+ return 0;
  15458. - }
  15459. -
  15460. - static u32 brcmf_chip_dmp_get_desc(struct brcmf_chip_priv *ci, u32 *eromaddr,
  15461. -@@ -668,6 +833,7 @@ static int brcmf_chip_recognition(struct
  15462. - struct brcmf_core *core;
  15463. - u32 regdata;
  15464. - u32 socitype;
  15465. -+ int ret;
  15466. -
  15467. - /* Get CC core rev
  15468. - * Chipid is assume to be at offset 0 from SI_ENUM_BASE
  15469. -@@ -720,9 +886,13 @@ static int brcmf_chip_recognition(struct
  15470. - return -ENODEV;
  15471. - }
  15472. -
  15473. -- brcmf_chip_get_raminfo(ci);
  15474. --
  15475. -- return brcmf_chip_cores_check(ci);
  15476. -+ ret = brcmf_chip_cores_check(ci);
  15477. -+ if (ret)
  15478. -+ return ret;
  15479. -+
  15480. -+ /* assure chip is passive for core access */
  15481. -+ brcmf_chip_set_passive(&ci->pub);
  15482. -+ return brcmf_chip_get_raminfo(ci);
  15483. - }
  15484. -
  15485. - static void brcmf_chip_disable_arm(struct brcmf_chip_priv *chip, u16 id)
  15486. -@@ -827,8 +997,6 @@ struct brcmf_chip *brcmf_chip_attach(voi
  15487. - if (err < 0)
  15488. - goto fail;
  15489. -
  15490. -- /* assure chip is passive for download */
  15491. -- brcmf_chip_set_passive(&chip->pub);
  15492. - return &chip->pub;
  15493. -
  15494. - fail:
  15495. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  15496. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  15497. -@@ -30,7 +30,8 @@
  15498. - * @pmucaps: PMU capabilities.
  15499. - * @pmurev: PMU revision.
  15500. - * @rambase: RAM base address (only applicable for ARM CR4 chips).
  15501. -- * @ramsize: amount of RAM on chip.
  15502. -+ * @ramsize: amount of RAM on chip including retention.
  15503. -+ * @srsize: amount of retention RAM on chip.
  15504. - * @name: string representation of the chip identifier.
  15505. - */
  15506. - struct brcmf_chip {
  15507. -@@ -41,6 +42,7 @@ struct brcmf_chip {
  15508. - u32 pmurev;
  15509. - u32 rambase;
  15510. - u32 ramsize;
  15511. -+ u32 srsize;
  15512. - char name[8];
  15513. - };
  15514. -
  15515. 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
  15516. deleted file mode 100644
  15517. index 69618a7..0000000
  15518. --- a/package/kernel/mac80211/patches/336-0006-brcmfmac-take-save-restore-memory-into-account-for-S.patch
  15519. +++ /dev/null
  15520. @@ -1,96 +0,0 @@
  15521. -From: Arend van Spriel <arend@broadcom.com>
  15522. -Date: Wed, 11 Mar 2015 16:11:32 +0100
  15523. -Subject: [PATCH] brcmfmac: take save&restore memory into account for SDIO
  15524. - shared info
  15525. -
  15526. -The firmware provides pointer to SDIO shared information at end of
  15527. -RAM during firmware initialization. End of RAM is obviously determined
  15528. -by the actual ram size, but part of that may be used for save&restore
  15529. -memory. In that case another location in RAM will hold the pointer.
  15530. -
  15531. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15532. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15533. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15534. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15535. ----
  15536. -
  15537. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15538. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15539. -@@ -1067,44 +1067,47 @@ static inline bool brcmf_sdio_valid_shar
  15540. - static int brcmf_sdio_readshared(struct brcmf_sdio *bus,
  15541. - struct sdpcm_shared *sh)
  15542. - {
  15543. -- u32 addr;
  15544. -+ u32 addr = 0;
  15545. - int rv;
  15546. - u32 shaddr = 0;
  15547. - struct sdpcm_shared_le sh_le;
  15548. - __le32 addr_le;
  15549. -
  15550. -- shaddr = bus->ci->rambase + bus->ci->ramsize - 4;
  15551. -+ sdio_claim_host(bus->sdiodev->func[1]);
  15552. -+ brcmf_sdio_bus_sleep(bus, false, false);
  15553. -
  15554. - /*
  15555. - * Read last word in socram to determine
  15556. - * address of sdpcm_shared structure
  15557. - */
  15558. -- sdio_claim_host(bus->sdiodev->func[1]);
  15559. -- brcmf_sdio_bus_sleep(bus, false, false);
  15560. -- rv = brcmf_sdiod_ramrw(bus->sdiodev, false, shaddr, (u8 *)&addr_le, 4);
  15561. -- sdio_release_host(bus->sdiodev->func[1]);
  15562. -+ shaddr = bus->ci->rambase + bus->ci->ramsize - 4;
  15563. -+ if (!bus->ci->rambase && brcmf_chip_sr_capable(bus->ci))
  15564. -+ shaddr -= bus->ci->srsize;
  15565. -+ rv = brcmf_sdiod_ramrw(bus->sdiodev, false, shaddr,
  15566. -+ (u8 *)&addr_le, 4);
  15567. - if (rv < 0)
  15568. -- return rv;
  15569. --
  15570. -- addr = le32_to_cpu(addr_le);
  15571. --
  15572. -- brcmf_dbg(SDIO, "sdpcm_shared address 0x%08X\n", addr);
  15573. -+ goto fail;
  15574. -
  15575. - /*
  15576. - * Check if addr is valid.
  15577. - * NVRAM length at the end of memory should have been overwritten.
  15578. - */
  15579. -+ addr = le32_to_cpu(addr_le);
  15580. - if (!brcmf_sdio_valid_shared_address(addr)) {
  15581. -- brcmf_err("invalid sdpcm_shared address 0x%08X\n",
  15582. -- addr);
  15583. -- return -EINVAL;
  15584. -+ brcmf_err("invalid sdpcm_shared address 0x%08X\n", addr);
  15585. -+ rv = -EINVAL;
  15586. -+ goto fail;
  15587. - }
  15588. -
  15589. -+ brcmf_dbg(INFO, "sdpcm_shared address 0x%08X\n", addr);
  15590. -+
  15591. - /* Read hndrte_shared structure */
  15592. - rv = brcmf_sdiod_ramrw(bus->sdiodev, false, addr, (u8 *)&sh_le,
  15593. - sizeof(struct sdpcm_shared_le));
  15594. - if (rv < 0)
  15595. -- return rv;
  15596. -+ goto fail;
  15597. -+
  15598. -+ sdio_release_host(bus->sdiodev->func[1]);
  15599. -
  15600. - /* Endianness */
  15601. - sh->flags = le32_to_cpu(sh_le.flags);
  15602. -@@ -1121,8 +1124,13 @@ static int brcmf_sdio_readshared(struct
  15603. - sh->flags & SDPCM_SHARED_VERSION_MASK);
  15604. - return -EPROTO;
  15605. - }
  15606. --
  15607. - return 0;
  15608. -+
  15609. -+fail:
  15610. -+ brcmf_err("unable to obtain sdpcm_shared info: rv=%d (addr=0x%x)\n",
  15611. -+ rv, addr);
  15612. -+ sdio_release_host(bus->sdiodev->func[1]);
  15613. -+ return rv;
  15614. - }
  15615. -
  15616. - static void brcmf_sdio_get_console_addr(struct brcmf_sdio *bus)
  15617. 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
  15618. deleted file mode 100644
  15619. index 1b10dbb..0000000
  15620. --- a/package/kernel/mac80211/patches/336-0007-brcmfmac-fix-watchdog-timer-regression.patch
  15621. +++ /dev/null
  15622. @@ -1,59 +0,0 @@
  15623. -From: Arend van Spriel <arend@broadcom.com>
  15624. -Date: Wed, 11 Mar 2015 16:11:33 +0100
  15625. -Subject: [PATCH] brcmfmac: fix watchdog timer regression
  15626. -
  15627. -The watchdog timer is used to put the device in a low-power mode when
  15628. -it is idle for some time. This timer is stopped during that mode and
  15629. -should be restarted upon activity. This has been broken by commit
  15630. -d4150fced0365 ("brcmfmac: Simplify watchdog sleep."). This patch
  15631. -restores the behaviour as it was before that commit.
  15632. -
  15633. -Reported-by: Pontus Fuchs <pontusf@broadcom.com>
  15634. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15635. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15636. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15637. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15638. ----
  15639. -
  15640. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15641. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15642. -@@ -972,7 +972,6 @@ static int brcmf_sdio_clkctl(struct brcm
  15643. - brcmf_sdio_sdclk(bus, true);
  15644. - /* Now request HT Avail on the backplane */
  15645. - brcmf_sdio_htclk(bus, true, pendok);
  15646. -- brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  15647. - break;
  15648. -
  15649. - case CLK_SDONLY:
  15650. -@@ -984,7 +983,6 @@ static int brcmf_sdio_clkctl(struct brcm
  15651. - else
  15652. - brcmf_err("request for %d -> %d\n",
  15653. - bus->clkstate, target);
  15654. -- brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  15655. - break;
  15656. -
  15657. - case CLK_NONE:
  15658. -@@ -993,7 +991,6 @@ static int brcmf_sdio_clkctl(struct brcm
  15659. - brcmf_sdio_htclk(bus, false, false);
  15660. - /* Now remove the SD clock */
  15661. - brcmf_sdio_sdclk(bus, false);
  15662. -- brcmf_sdio_wd_timer(bus, 0);
  15663. - break;
  15664. - }
  15665. - #ifdef DEBUG
  15666. -@@ -1048,6 +1045,7 @@ end:
  15667. - brcmf_sdio_clkctl(bus, CLK_NONE, pendok);
  15668. - } else {
  15669. - brcmf_sdio_clkctl(bus, CLK_AVAIL, pendok);
  15670. -+ brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  15671. - }
  15672. - bus->sleeping = sleep;
  15673. - brcmf_dbg(SDIO, "new state %s\n",
  15674. -@@ -4242,6 +4240,7 @@ void brcmf_sdio_remove(struct brcmf_sdio
  15675. - if (bus->ci) {
  15676. - if (bus->sdiodev->state != BRCMF_SDIOD_NOMEDIUM) {
  15677. - sdio_claim_host(bus->sdiodev->func[1]);
  15678. -+ brcmf_sdio_wd_timer(bus, 0);
  15679. - brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
  15680. - /* Leave the device in state where it is
  15681. - * 'passive'. This is done by resetting all
  15682. diff --git a/package/kernel/mac80211/patches/336-mac80211-minstrel_ht-set-default-tx-aggregation-time.patch b/package/kernel/mac80211/patches/336-mac80211-minstrel_ht-set-default-tx-aggregation-time.patch
  15683. new file mode 100644
  15684. index 0000000..32a2ad6
  15685. --- /dev/null
  15686. +++ b/package/kernel/mac80211/patches/336-mac80211-minstrel_ht-set-default-tx-aggregation-time.patch
  15687. @@ -0,0 +1,31 @@
  15688. +From: Felix Fietkau <nbd@openwrt.org>
  15689. +Date: Thu, 18 Feb 2016 19:45:33 +0100
  15690. +Subject: [PATCH] mac80211: minstrel_ht: set default tx aggregation timeout to
  15691. + 0
  15692. +
  15693. +The value 5000 was put here with the addition of the timeout field to
  15694. +ieee80211_start_tx_ba_session. It was originally added in mac80211 to
  15695. +save resources for drivers like iwlwifi, which only supports a limited
  15696. +number of concurrent aggregation sessions.
  15697. +
  15698. +Since iwlwifi does not use minstrel_ht and other drivers don't need
  15699. +this, 0 is a better default - especially since there have been
  15700. +recent reports of aggregation setup related issues reproduced with
  15701. +ath9k. This should improve stability without causing any adverse
  15702. +effects.
  15703. +
  15704. +Cc: stable@vger.kernel.org
  15705. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  15706. +---
  15707. +
  15708. +--- a/net/mac80211/rc80211_minstrel_ht.c
  15709. ++++ b/net/mac80211/rc80211_minstrel_ht.c
  15710. +@@ -692,7 +692,7 @@ minstrel_aggr_check(struct ieee80211_sta
  15711. + if (likely(sta->ampdu_mlme.tid_tx[tid]))
  15712. + return;
  15713. +
  15714. +- ieee80211_start_tx_ba_session(pubsta, tid, 5000);
  15715. ++ ieee80211_start_tx_ba_session(pubsta, tid, 0);
  15716. + }
  15717. +
  15718. + static void
  15719. 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
  15720. deleted file mode 100644
  15721. index af76f13..0000000
  15722. --- a/package/kernel/mac80211/patches/337-0001-brcmfmac-avoid-runtime-pm-for-sdio-host-controller.patch
  15723. +++ /dev/null
  15724. @@ -1,44 +0,0 @@
  15725. -From: Arend van Spriel <arend@broadcom.com>
  15726. -Date: Wed, 18 Mar 2015 13:25:21 +0100
  15727. -Subject: [PATCH] brcmfmac: avoid runtime-pm for sdio host controller
  15728. -
  15729. -Several host controllers supporting runtime-pm are causing issues
  15730. -with our sdio wireless cards because they disable the sdio interrupt
  15731. -upon going into runtime suspend. This patch avoids that by doing
  15732. -a pm_runtime_forbid() call during the probe. Tested with Sony Vaio
  15733. -Duo 13 which uses sdhci-acpi host controller.
  15734. -
  15735. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15736. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  15737. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15738. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15739. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15740. ----
  15741. -
  15742. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  15743. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  15744. -@@ -29,6 +29,7 @@
  15745. - #include <linux/mmc/host.h>
  15746. - #include <linux/platform_device.h>
  15747. - #include <linux/platform_data/brcmfmac-sdio.h>
  15748. -+#include <linux/pm_runtime.h>
  15749. - #include <linux/suspend.h>
  15750. - #include <linux/errno.h>
  15751. - #include <linux/module.h>
  15752. -@@ -1006,6 +1007,7 @@ static int brcmf_sdiod_remove(struct brc
  15753. - sg_free_table(&sdiodev->sgtable);
  15754. - sdiodev->sbwad = 0;
  15755. -
  15756. -+ pm_runtime_allow(sdiodev->func[1]->card->host->parent);
  15757. - return 0;
  15758. - }
  15759. -
  15760. -@@ -1074,7 +1076,7 @@ static int brcmf_sdiod_probe(struct brcm
  15761. - ret = -ENODEV;
  15762. - goto out;
  15763. - }
  15764. --
  15765. -+ pm_runtime_forbid(host->parent);
  15766. - out:
  15767. - if (ret)
  15768. - brcmf_sdiod_remove(sdiodev);
  15769. 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
  15770. deleted file mode 100644
  15771. index c419cc6..0000000
  15772. --- a/package/kernel/mac80211/patches/337-0002-brcmfmac-Add-necessary-memory-barriers-for-SDIO.patch
  15773. +++ /dev/null
  15774. @@ -1,171 +0,0 @@
  15775. -From: Hante Meuleman <meuleman@broadcom.com>
  15776. -Date: Wed, 18 Mar 2015 13:25:22 +0100
  15777. -Subject: [PATCH] brcmfmac: Add necessary memory barriers for SDIO.
  15778. -
  15779. -SDIO uses a thread to handle all communication with the device,
  15780. -for this data is exchanged between threads. This data needs proper
  15781. -memory barriers to make sure that data "exchange" is going correct.
  15782. -
  15783. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  15784. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  15785. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15786. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  15787. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  15788. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15789. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15790. ----
  15791. -
  15792. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15793. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15794. -@@ -507,8 +507,8 @@ struct brcmf_sdio {
  15795. -
  15796. - struct workqueue_struct *brcmf_wq;
  15797. - struct work_struct datawork;
  15798. -- atomic_t dpc_tskcnt;
  15799. -- atomic_t dpc_running;
  15800. -+ bool dpc_triggered;
  15801. -+ bool dpc_running;
  15802. -
  15803. - bool txoff; /* Transmit flow-controlled */
  15804. - struct brcmf_sdio_count sdcnt;
  15805. -@@ -2713,6 +2713,7 @@ static void brcmf_sdio_dpc(struct brcmf_
  15806. - err = brcmf_sdio_tx_ctrlframe(bus, bus->ctrl_frame_buf,
  15807. - bus->ctrl_frame_len);
  15808. - bus->ctrl_frame_err = err;
  15809. -+ wmb();
  15810. - bus->ctrl_frame_stat = false;
  15811. - }
  15812. - sdio_release_host(bus->sdiodev->func[1]);
  15813. -@@ -2734,6 +2735,7 @@ static void brcmf_sdio_dpc(struct brcmf_
  15814. - sdio_claim_host(bus->sdiodev->func[1]);
  15815. - if (bus->ctrl_frame_stat) {
  15816. - bus->ctrl_frame_err = -ENODEV;
  15817. -+ wmb();
  15818. - bus->ctrl_frame_stat = false;
  15819. - brcmf_sdio_wait_event_wakeup(bus);
  15820. - }
  15821. -@@ -2744,7 +2746,7 @@ static void brcmf_sdio_dpc(struct brcmf_
  15822. - (!atomic_read(&bus->fcstate) &&
  15823. - brcmu_pktq_mlen(&bus->txq, ~bus->flowcontrol) &&
  15824. - data_ok(bus))) {
  15825. -- atomic_inc(&bus->dpc_tskcnt);
  15826. -+ bus->dpc_triggered = true;
  15827. - }
  15828. - }
  15829. -
  15830. -@@ -2940,6 +2942,7 @@ brcmf_sdio_bus_txctl(struct device *dev,
  15831. - /* Send from dpc */
  15832. - bus->ctrl_frame_buf = msg;
  15833. - bus->ctrl_frame_len = msglen;
  15834. -+ wmb();
  15835. - bus->ctrl_frame_stat = true;
  15836. -
  15837. - brcmf_sdio_trigger_dpc(bus);
  15838. -@@ -2958,6 +2961,7 @@ brcmf_sdio_bus_txctl(struct device *dev,
  15839. - if (!ret) {
  15840. - brcmf_dbg(SDIO, "ctrl_frame complete, err=%d\n",
  15841. - bus->ctrl_frame_err);
  15842. -+ rmb();
  15843. - ret = bus->ctrl_frame_err;
  15844. - }
  15845. -
  15846. -@@ -3526,8 +3530,8 @@ done:
  15847. -
  15848. - void brcmf_sdio_trigger_dpc(struct brcmf_sdio *bus)
  15849. - {
  15850. -- if (atomic_read(&bus->dpc_tskcnt) == 0) {
  15851. -- atomic_inc(&bus->dpc_tskcnt);
  15852. -+ if (!bus->dpc_triggered) {
  15853. -+ bus->dpc_triggered = true;
  15854. - queue_work(bus->brcmf_wq, &bus->datawork);
  15855. - }
  15856. - }
  15857. -@@ -3558,7 +3562,7 @@ void brcmf_sdio_isr(struct brcmf_sdio *b
  15858. - if (!bus->intr)
  15859. - brcmf_err("isr w/o interrupt configured!\n");
  15860. -
  15861. -- atomic_inc(&bus->dpc_tskcnt);
  15862. -+ bus->dpc_triggered = true;
  15863. - queue_work(bus->brcmf_wq, &bus->datawork);
  15864. - }
  15865. -
  15866. -@@ -3578,7 +3582,7 @@ static void brcmf_sdio_bus_watchdog(stru
  15867. - if (!bus->intr ||
  15868. - (bus->sdcnt.intrcount == bus->sdcnt.lastintrs)) {
  15869. -
  15870. -- if (atomic_read(&bus->dpc_tskcnt) == 0) {
  15871. -+ if (!bus->dpc_triggered) {
  15872. - u8 devpend;
  15873. -
  15874. - sdio_claim_host(bus->sdiodev->func[1]);
  15875. -@@ -3596,7 +3600,7 @@ static void brcmf_sdio_bus_watchdog(stru
  15876. - bus->sdcnt.pollcnt++;
  15877. - atomic_set(&bus->ipend, 1);
  15878. -
  15879. -- atomic_inc(&bus->dpc_tskcnt);
  15880. -+ bus->dpc_triggered = true;
  15881. - queue_work(bus->brcmf_wq, &bus->datawork);
  15882. - }
  15883. - }
  15884. -@@ -3623,17 +3627,21 @@ static void brcmf_sdio_bus_watchdog(stru
  15885. - #endif /* DEBUG */
  15886. -
  15887. - /* On idle timeout clear activity flag and/or turn off clock */
  15888. -- if ((atomic_read(&bus->dpc_tskcnt) == 0) &&
  15889. -- (atomic_read(&bus->dpc_running) == 0) &&
  15890. -- (bus->idletime > 0) && (bus->clkstate == CLK_AVAIL)) {
  15891. -- bus->idlecount++;
  15892. -- if (bus->idlecount > bus->idletime) {
  15893. -- brcmf_dbg(SDIO, "idle\n");
  15894. -- sdio_claim_host(bus->sdiodev->func[1]);
  15895. -- brcmf_sdio_wd_timer(bus, 0);
  15896. -+ if (!bus->dpc_triggered) {
  15897. -+ rmb();
  15898. -+ if ((!bus->dpc_running) && (bus->idletime > 0) &&
  15899. -+ (bus->clkstate == CLK_AVAIL)) {
  15900. -+ bus->idlecount++;
  15901. -+ if (bus->idlecount > bus->idletime) {
  15902. -+ brcmf_dbg(SDIO, "idle\n");
  15903. -+ sdio_claim_host(bus->sdiodev->func[1]);
  15904. -+ brcmf_sdio_wd_timer(bus, 0);
  15905. -+ bus->idlecount = 0;
  15906. -+ brcmf_sdio_bus_sleep(bus, true, false);
  15907. -+ sdio_release_host(bus->sdiodev->func[1]);
  15908. -+ }
  15909. -+ } else {
  15910. - bus->idlecount = 0;
  15911. -- brcmf_sdio_bus_sleep(bus, true, false);
  15912. -- sdio_release_host(bus->sdiodev->func[1]);
  15913. - }
  15914. - } else {
  15915. - bus->idlecount = 0;
  15916. -@@ -3645,13 +3653,14 @@ static void brcmf_sdio_dataworker(struct
  15917. - struct brcmf_sdio *bus = container_of(work, struct brcmf_sdio,
  15918. - datawork);
  15919. -
  15920. -- while (atomic_read(&bus->dpc_tskcnt)) {
  15921. -- atomic_set(&bus->dpc_running, 1);
  15922. -- atomic_set(&bus->dpc_tskcnt, 0);
  15923. -+ bus->dpc_running = true;
  15924. -+ wmb();
  15925. -+ while (ACCESS_ONCE(bus->dpc_triggered)) {
  15926. -+ bus->dpc_triggered = false;
  15927. - brcmf_sdio_dpc(bus);
  15928. - bus->idlecount = 0;
  15929. -- atomic_set(&bus->dpc_running, 0);
  15930. - }
  15931. -+ bus->dpc_running = false;
  15932. - if (brcmf_sdiod_freezing(bus->sdiodev)) {
  15933. - brcmf_sdiod_change_state(bus->sdiodev, BRCMF_SDIOD_DOWN);
  15934. - brcmf_sdiod_try_freeze(bus->sdiodev);
  15935. -@@ -4144,8 +4153,8 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
  15936. - bus->watchdog_tsk = NULL;
  15937. - }
  15938. - /* Initialize DPC thread */
  15939. -- atomic_set(&bus->dpc_tskcnt, 0);
  15940. -- atomic_set(&bus->dpc_running, 0);
  15941. -+ bus->dpc_triggered = false;
  15942. -+ bus->dpc_running = false;
  15943. -
  15944. - /* Assign bus interface call back */
  15945. - bus->sdiodev->bus_if->dev = bus->sdiodev->dev;
  15946. 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
  15947. deleted file mode 100644
  15948. index 1bc98a0..0000000
  15949. --- a/package/kernel/mac80211/patches/337-0003-brcmfmac-Remove-unnecessary-new-line-in-pcie-console.patch
  15950. +++ /dev/null
  15951. @@ -1,26 +0,0 @@
  15952. -From: Hante Meuleman <meuleman@broadcom.com>
  15953. -Date: Wed, 18 Mar 2015 13:25:24 +0100
  15954. -Subject: [PATCH] brcmfmac: Remove unnecessary new-line in pcie console
  15955. - logging.
  15956. -
  15957. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  15958. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15959. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  15960. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15961. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15962. ----
  15963. -
  15964. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  15965. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  15966. -@@ -651,10 +651,9 @@ static void brcmf_pcie_bus_console_read(
  15967. - console->log_str[console->log_idx] = ch;
  15968. - console->log_idx++;
  15969. - }
  15970. --
  15971. - if (ch == '\n') {
  15972. - console->log_str[console->log_idx] = 0;
  15973. -- brcmf_dbg(PCIE, "CONSOLE: %s\n", console->log_str);
  15974. -+ brcmf_dbg(PCIE, "CONSOLE: %s", console->log_str);
  15975. - console->log_idx = 0;
  15976. - }
  15977. - }
  15978. 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
  15979. deleted file mode 100644
  15980. index fcf0bf3..0000000
  15981. --- a/package/kernel/mac80211/patches/337-0004-brcmfmac-add-MODULE_FIRMWARE-macros-for-bcm4356-PCIe.patch
  15982. +++ /dev/null
  15983. @@ -1,26 +0,0 @@
  15984. -From: Arend van Spriel <arend@broadcom.com>
  15985. -Date: Wed, 18 Mar 2015 13:25:25 +0100
  15986. -Subject: [PATCH] brcmfmac: add MODULE_FIRMWARE() macros for bcm4356 PCIe
  15987. - device
  15988. -
  15989. -The BCM4356 PCIe wireless device was added recently but overlooked
  15990. -the fact that the MODULE_FIRMWARE() macros were missing for the
  15991. -firmwares needed by this device.
  15992. -
  15993. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15994. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15995. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15996. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15997. ----
  15998. -
  15999. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16000. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16001. -@@ -189,6 +189,8 @@ MODULE_FIRMWARE(BRCMF_PCIE_43602_FW_NAME
  16002. - MODULE_FIRMWARE(BRCMF_PCIE_43602_NVRAM_NAME);
  16003. - MODULE_FIRMWARE(BRCMF_PCIE_4354_FW_NAME);
  16004. - MODULE_FIRMWARE(BRCMF_PCIE_4354_NVRAM_NAME);
  16005. -+MODULE_FIRMWARE(BRCMF_PCIE_4356_FW_NAME);
  16006. -+MODULE_FIRMWARE(BRCMF_PCIE_4356_NVRAM_NAME);
  16007. - MODULE_FIRMWARE(BRCMF_PCIE_43570_FW_NAME);
  16008. - MODULE_FIRMWARE(BRCMF_PCIE_43570_NVRAM_NAME);
  16009. -
  16010. 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
  16011. deleted file mode 100644
  16012. index b3e9bc9..0000000
  16013. --- a/package/kernel/mac80211/patches/337-0005-brcmfmac-add-support-for-BCM43430-SDIO-chipset.patch
  16014. +++ /dev/null
  16015. @@ -1,138 +0,0 @@
  16016. -From: Arend van Spriel <arend@broadcom.com>
  16017. -Date: Wed, 18 Mar 2015 13:25:26 +0100
  16018. -Subject: [PATCH] brcmfmac: add support for BCM43430 SDIO chipset
  16019. -
  16020. -This patch added support for the BCM43430 802.11n SDIO chipset.
  16021. -
  16022. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16023. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  16024. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  16025. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16026. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16027. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16028. ----
  16029. -
  16030. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  16031. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  16032. -@@ -1098,6 +1098,7 @@ static const struct sdio_device_id brcmf
  16033. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43341),
  16034. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43362),
  16035. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4335_4339),
  16036. -+ BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43430),
  16037. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4345),
  16038. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4354),
  16039. - { /* end: all zeroes */ }
  16040. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  16041. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  16042. -@@ -600,6 +600,12 @@ static void brcmf_chip_socram_ramsize(st
  16043. - if (sr->chip->pub.chiprev < 2)
  16044. - *srsize = (32 * 1024);
  16045. - break;
  16046. -+ case BRCM_CC_43430_CHIP_ID:
  16047. -+ /* assume sr for now as we can not check
  16048. -+ * firmware sr capability at this point.
  16049. -+ */
  16050. -+ *srsize = (64 * 1024);
  16051. -+ break;
  16052. - default:
  16053. - break;
  16054. - }
  16055. -@@ -1072,6 +1078,7 @@ static void
  16056. - brcmf_chip_cm3_set_passive(struct brcmf_chip_priv *chip)
  16057. - {
  16058. - struct brcmf_core *core;
  16059. -+ struct brcmf_core_priv *sr;
  16060. -
  16061. - brcmf_chip_disable_arm(chip, BCMA_CORE_ARM_CM3);
  16062. - core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_80211);
  16063. -@@ -1081,6 +1088,13 @@ brcmf_chip_cm3_set_passive(struct brcmf_
  16064. - D11_BCMA_IOCTL_PHYCLOCKEN);
  16065. - core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_INTERNAL_MEM);
  16066. - brcmf_chip_resetcore(core, 0, 0, 0);
  16067. -+
  16068. -+ /* disable bank #3 remap for this device */
  16069. -+ if (chip->pub.chip == BRCM_CC_43430_CHIP_ID) {
  16070. -+ sr = container_of(core, struct brcmf_core_priv, pub);
  16071. -+ brcmf_chip_core_write32(sr, SOCRAMREGOFFS(bankidx), 3);
  16072. -+ brcmf_chip_core_write32(sr, SOCRAMREGOFFS(bankpda), 0);
  16073. -+ }
  16074. - }
  16075. -
  16076. - static bool brcmf_chip_cm3_set_active(struct brcmf_chip_priv *chip)
  16077. -@@ -1188,6 +1202,10 @@ bool brcmf_chip_sr_capable(struct brcmf_
  16078. - addr = CORE_CC_REG(base, chipcontrol_data);
  16079. - reg = chip->ops->read32(chip->ctx, addr);
  16080. - return (reg & pmu_cc3_mask) != 0;
  16081. -+ case BRCM_CC_43430_CHIP_ID:
  16082. -+ addr = CORE_CC_REG(base, sr_control1);
  16083. -+ reg = chip->ops->read32(chip->ctx, addr);
  16084. -+ return reg != 0;
  16085. - default:
  16086. - addr = CORE_CC_REG(base, pmucapabilities_ext);
  16087. - reg = chip->ops->read32(chip->ctx, addr);
  16088. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  16089. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  16090. -@@ -615,6 +615,8 @@ static const struct sdiod_drive_str sdio
  16091. - #define BCM43362_NVRAM_NAME "brcm/brcmfmac43362-sdio.txt"
  16092. - #define BCM4339_FIRMWARE_NAME "brcm/brcmfmac4339-sdio.bin"
  16093. - #define BCM4339_NVRAM_NAME "brcm/brcmfmac4339-sdio.txt"
  16094. -+#define BCM43430_FIRMWARE_NAME "brcm/brcmfmac43430-sdio.bin"
  16095. -+#define BCM43430_NVRAM_NAME "brcm/brcmfmac43430-sdio.txt"
  16096. - #define BCM4345_FIRMWARE_NAME "brcm/brcmfmac4345-sdio.bin"
  16097. - #define BCM4345_NVRAM_NAME "brcm/brcmfmac4345-sdio.txt"
  16098. - #define BCM4354_FIRMWARE_NAME "brcm/brcmfmac4354-sdio.bin"
  16099. -@@ -640,6 +642,8 @@ MODULE_FIRMWARE(BCM43362_FIRMWARE_NAME);
  16100. - MODULE_FIRMWARE(BCM43362_NVRAM_NAME);
  16101. - MODULE_FIRMWARE(BCM4339_FIRMWARE_NAME);
  16102. - MODULE_FIRMWARE(BCM4339_NVRAM_NAME);
  16103. -+MODULE_FIRMWARE(BCM43430_FIRMWARE_NAME);
  16104. -+MODULE_FIRMWARE(BCM43430_NVRAM_NAME);
  16105. - MODULE_FIRMWARE(BCM4345_FIRMWARE_NAME);
  16106. - MODULE_FIRMWARE(BCM4345_NVRAM_NAME);
  16107. - MODULE_FIRMWARE(BCM4354_FIRMWARE_NAME);
  16108. -@@ -671,6 +675,7 @@ static const struct brcmf_firmware_names
  16109. - { BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4335) },
  16110. - { BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, BRCMF_FIRMWARE_NVRAM(BCM43362) },
  16111. - { BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4339) },
  16112. -+ { BRCM_CC_43430_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM43430) },
  16113. - { BRCM_CC_4345_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4345) },
  16114. - { BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4354) }
  16115. - };
  16116. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  16117. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  16118. -@@ -37,6 +37,7 @@
  16119. - #define BRCM_CC_43362_CHIP_ID 43362
  16120. - #define BRCM_CC_4335_CHIP_ID 0x4335
  16121. - #define BRCM_CC_4339_CHIP_ID 0x4339
  16122. -+#define BRCM_CC_43430_CHIP_ID 43430
  16123. - #define BRCM_CC_4345_CHIP_ID 0x4345
  16124. - #define BRCM_CC_4354_CHIP_ID 0x4354
  16125. - #define BRCM_CC_4356_CHIP_ID 0x4356
  16126. ---- a/drivers/net/wireless/brcm80211/include/chipcommon.h
  16127. -+++ b/drivers/net/wireless/brcm80211/include/chipcommon.h
  16128. -@@ -183,7 +183,14 @@ struct chipcregs {
  16129. - u8 uart1lsr;
  16130. - u8 uart1msr;
  16131. - u8 uart1scratch;
  16132. -- u32 PAD[126];
  16133. -+ u32 PAD[62];
  16134. -+
  16135. -+ /* save/restore, corerev >= 48 */
  16136. -+ u32 sr_capability; /* 0x500 */
  16137. -+ u32 sr_control0; /* 0x504 */
  16138. -+ u32 sr_control1; /* 0x508 */
  16139. -+ u32 gpio_control; /* 0x50C */
  16140. -+ u32 PAD[60];
  16141. -
  16142. - /* PMU registers (corerev >= 20) */
  16143. - u32 pmucontrol; /* 0x600 */
  16144. ---- a/include/linux/mmc/sdio_ids.h
  16145. -+++ b/include/linux/mmc/sdio_ids.h
  16146. -@@ -33,6 +33,7 @@
  16147. - #define SDIO_DEVICE_ID_BROADCOM_43341 0xa94d
  16148. - #define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335
  16149. - #define SDIO_DEVICE_ID_BROADCOM_43362 0xa962
  16150. -+#define SDIO_DEVICE_ID_BROADCOM_43430 0xa9a6
  16151. - #define SDIO_DEVICE_ID_BROADCOM_4345 0x4345
  16152. - #define SDIO_DEVICE_ID_BROADCOM_4354 0x4354
  16153. -
  16154. 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
  16155. deleted file mode 100644
  16156. index c3d7bc2..0000000
  16157. --- a/package/kernel/mac80211/patches/337-0006-brcmfmac-only-support-the-BCM43455-7-device.patch
  16158. +++ /dev/null
  16159. @@ -1,50 +0,0 @@
  16160. -From: Arend van Spriel <arend@broadcom.com>
  16161. -Date: Wed, 18 Mar 2015 13:25:27 +0100
  16162. -Subject: [PATCH] brcmfmac: only support the BCM43455/7 device
  16163. -
  16164. -Recently support was added for the BCM4345 SDIO chipset by
  16165. -commit 9c51026509d7 ("brcmfmac: Add support for BCM4345 SDIO chipset")
  16166. -however this was verified using a BCM43455 device, which is
  16167. -a more recent revision of the chip. This patch assure that
  16168. -older revisions are not probed as they would fail.
  16169. -
  16170. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16171. -Reviewed-by: Syed Asifful Dayyan <syedd@broadcom.com>
  16172. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16173. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16174. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16175. ----
  16176. -
  16177. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  16178. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  16179. -@@ -617,8 +617,8 @@ static const struct sdiod_drive_str sdio
  16180. - #define BCM4339_NVRAM_NAME "brcm/brcmfmac4339-sdio.txt"
  16181. - #define BCM43430_FIRMWARE_NAME "brcm/brcmfmac43430-sdio.bin"
  16182. - #define BCM43430_NVRAM_NAME "brcm/brcmfmac43430-sdio.txt"
  16183. --#define BCM4345_FIRMWARE_NAME "brcm/brcmfmac4345-sdio.bin"
  16184. --#define BCM4345_NVRAM_NAME "brcm/brcmfmac4345-sdio.txt"
  16185. -+#define BCM43455_FIRMWARE_NAME "brcm/brcmfmac43455-sdio.bin"
  16186. -+#define BCM43455_NVRAM_NAME "brcm/brcmfmac43455-sdio.txt"
  16187. - #define BCM4354_FIRMWARE_NAME "brcm/brcmfmac4354-sdio.bin"
  16188. - #define BCM4354_NVRAM_NAME "brcm/brcmfmac4354-sdio.txt"
  16189. -
  16190. -@@ -644,8 +644,8 @@ MODULE_FIRMWARE(BCM4339_FIRMWARE_NAME);
  16191. - MODULE_FIRMWARE(BCM4339_NVRAM_NAME);
  16192. - MODULE_FIRMWARE(BCM43430_FIRMWARE_NAME);
  16193. - MODULE_FIRMWARE(BCM43430_NVRAM_NAME);
  16194. --MODULE_FIRMWARE(BCM4345_FIRMWARE_NAME);
  16195. --MODULE_FIRMWARE(BCM4345_NVRAM_NAME);
  16196. -+MODULE_FIRMWARE(BCM43455_FIRMWARE_NAME);
  16197. -+MODULE_FIRMWARE(BCM43455_NVRAM_NAME);
  16198. - MODULE_FIRMWARE(BCM4354_FIRMWARE_NAME);
  16199. - MODULE_FIRMWARE(BCM4354_NVRAM_NAME);
  16200. -
  16201. -@@ -676,7 +676,7 @@ static const struct brcmf_firmware_names
  16202. - { BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, BRCMF_FIRMWARE_NVRAM(BCM43362) },
  16203. - { BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4339) },
  16204. - { BRCM_CC_43430_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM43430) },
  16205. -- { BRCM_CC_4345_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4345) },
  16206. -+ { BRCM_CC_4345_CHIP_ID, 0xFFFFFFC0, BRCMF_FIRMWARE_NVRAM(BCM43455) },
  16207. - { BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4354) }
  16208. - };
  16209. -
  16210. 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
  16211. deleted file mode 100644
  16212. index a62cfdf..0000000
  16213. --- a/package/kernel/mac80211/patches/337-0007-brcmfmac-remove-support-for-unreleased-BCM4354-PCIe.patch
  16214. +++ /dev/null
  16215. @@ -1,52 +0,0 @@
  16216. -From: Arend van Spriel <arend@broadcom.com>
  16217. -Date: Wed, 18 Mar 2015 13:25:28 +0100
  16218. -Subject: [PATCH] brcmfmac: remove support for unreleased BCM4354 PCIe
  16219. -
  16220. -There are no known BCM4354 PCIe devices released so removing
  16221. -support from the driver until proven otherwise.
  16222. -
  16223. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16224. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16225. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16226. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16227. ----
  16228. -
  16229. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16230. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16231. -@@ -47,8 +47,6 @@ enum brcmf_pcie_state {
  16232. -
  16233. - #define BRCMF_PCIE_43602_FW_NAME "brcm/brcmfmac43602-pcie.bin"
  16234. - #define BRCMF_PCIE_43602_NVRAM_NAME "brcm/brcmfmac43602-pcie.txt"
  16235. --#define BRCMF_PCIE_4354_FW_NAME "brcm/brcmfmac4354-pcie.bin"
  16236. --#define BRCMF_PCIE_4354_NVRAM_NAME "brcm/brcmfmac4354-pcie.txt"
  16237. - #define BRCMF_PCIE_4356_FW_NAME "brcm/brcmfmac4356-pcie.bin"
  16238. - #define BRCMF_PCIE_4356_NVRAM_NAME "brcm/brcmfmac4356-pcie.txt"
  16239. - #define BRCMF_PCIE_43570_FW_NAME "brcm/brcmfmac43570-pcie.bin"
  16240. -@@ -187,8 +185,6 @@ enum brcmf_pcie_state {
  16241. -
  16242. - MODULE_FIRMWARE(BRCMF_PCIE_43602_FW_NAME);
  16243. - MODULE_FIRMWARE(BRCMF_PCIE_43602_NVRAM_NAME);
  16244. --MODULE_FIRMWARE(BRCMF_PCIE_4354_FW_NAME);
  16245. --MODULE_FIRMWARE(BRCMF_PCIE_4354_NVRAM_NAME);
  16246. - MODULE_FIRMWARE(BRCMF_PCIE_4356_FW_NAME);
  16247. - MODULE_FIRMWARE(BRCMF_PCIE_4356_NVRAM_NAME);
  16248. - MODULE_FIRMWARE(BRCMF_PCIE_43570_FW_NAME);
  16249. -@@ -1327,10 +1323,6 @@ static int brcmf_pcie_get_fwnames(struct
  16250. - fw_name = BRCMF_PCIE_43602_FW_NAME;
  16251. - nvram_name = BRCMF_PCIE_43602_NVRAM_NAME;
  16252. - break;
  16253. -- case BRCM_CC_4354_CHIP_ID:
  16254. -- fw_name = BRCMF_PCIE_4354_FW_NAME;
  16255. -- nvram_name = BRCMF_PCIE_4354_NVRAM_NAME;
  16256. -- break;
  16257. - case BRCM_CC_4356_CHIP_ID:
  16258. - fw_name = BRCMF_PCIE_4356_FW_NAME;
  16259. - nvram_name = BRCMF_PCIE_4356_NVRAM_NAME;
  16260. -@@ -1855,7 +1847,6 @@ cleanup:
  16261. - PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 }
  16262. -
  16263. - static struct pci_device_id brcmf_pcie_devid_table[] = {
  16264. -- BRCMF_PCIE_DEVICE(BRCM_PCIE_4354_DEVICE_ID),
  16265. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4356_DEVICE_ID),
  16266. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43567_DEVICE_ID),
  16267. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43570_DEVICE_ID),
  16268. diff --git a/package/kernel/mac80211/patches/337-mac80211-minstrel_ht-fix-a-logic-error-in-RTS-CTS-ha.patch b/package/kernel/mac80211/patches/337-mac80211-minstrel_ht-fix-a-logic-error-in-RTS-CTS-ha.patch
  16269. new file mode 100644
  16270. index 0000000..229351b
  16271. --- /dev/null
  16272. +++ b/package/kernel/mac80211/patches/337-mac80211-minstrel_ht-fix-a-logic-error-in-RTS-CTS-ha.patch
  16273. @@ -0,0 +1,26 @@
  16274. +From: Felix Fietkau <nbd@openwrt.org>
  16275. +Date: Wed, 24 Feb 2016 12:03:13 +0100
  16276. +Subject: [PATCH] mac80211: minstrel_ht: fix a logic error in RTS/CTS handling
  16277. +MIME-Version: 1.0
  16278. +Content-Type: text/plain; charset=UTF-8
  16279. +Content-Transfer-Encoding: 8bit
  16280. +
  16281. +RTS/CTS needs to be enabled if the rate is a fallback rate *or* if it's
  16282. +a dual-stream rate and the sta is in dynamic SMPS mode.
  16283. +
  16284. +Fixes: a3ebb4e1b763 ("mac80211: minstrel_ht: handle peers in dynamic SMPS")
  16285. +Reported-by: Matías Richart <mrichart@fing.edu.uy>
  16286. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  16287. +---
  16288. +
  16289. +--- a/net/mac80211/rc80211_minstrel_ht.c
  16290. ++++ b/net/mac80211/rc80211_minstrel_ht.c
  16291. +@@ -872,7 +872,7 @@ minstrel_ht_set_rate(struct minstrel_pri
  16292. + * - if station is in dynamic SMPS (and streams > 1)
  16293. + * - for fallback rates, to increase chances of getting through
  16294. + */
  16295. +- if (offset > 0 &&
  16296. ++ if (offset > 0 ||
  16297. + (mi->sta->smps_mode == IEEE80211_SMPS_DYNAMIC &&
  16298. + group->streams > 1)) {
  16299. + ratetbl->rate[offset].count = ratetbl->rate[offset].count_rts;
  16300. 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
  16301. deleted file mode 100644
  16302. index 366ff85..0000000
  16303. --- a/package/kernel/mac80211/patches/338-brcmfmac-disable-MBSS-feature-for-BCM43362.patch
  16304. +++ /dev/null
  16305. @@ -1,28 +0,0 @@
  16306. -From: Arend van Spriel <arend@broadcom.com>
  16307. -Date: Fri, 20 Mar 2015 22:18:17 +0100
  16308. -Subject: [PATCH] brcmfmac: disable MBSS feature for BCM43362
  16309. -
  16310. -The BCM43362 firmware falsely reports it is capable of providing
  16311. -MBSS. As a result AP mode no longer works for this device. Therefor
  16312. -disable MBSS in the driver for this chipset.
  16313. -
  16314. -Cc: stable@vger.kernel.org # 3.19.y
  16315. -Reported-by: Jorg Krause <jkrause@posteo.de>
  16316. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16317. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16318. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16319. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16320. ----
  16321. -
  16322. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  16323. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  16324. -@@ -126,7 +126,8 @@ void brcmf_feat_attach(struct brcmf_pub
  16325. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_MCHAN, "mchan");
  16326. - if (drvr->bus_if->wowl_supported)
  16327. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_WOWL, "wowl");
  16328. -- brcmf_feat_iovar_int_set(ifp, BRCMF_FEAT_MBSS, "mbss", 0);
  16329. -+ if (drvr->bus_if->chip != BRCM_CC_43362_CHIP_ID)
  16330. -+ brcmf_feat_iovar_int_set(ifp, BRCMF_FEAT_MBSS, "mbss", 0);
  16331. -
  16332. - /* set chip related quirks */
  16333. - switch (drvr->bus_if->chip) {
  16334. 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
  16335. deleted file mode 100644
  16336. index 6e461f6..0000000
  16337. --- a/package/kernel/mac80211/patches/339-0001-brcmfmac-use-static-superset-of-channels-for-wiphy-b.patch
  16338. +++ /dev/null
  16339. @@ -1,300 +0,0 @@
  16340. -From: Arend van Spriel <arend@broadcom.com>
  16341. -Date: Tue, 14 Apr 2015 20:10:24 +0200
  16342. -Subject: [PATCH] brcmfmac: use static superset of channels for wiphy
  16343. - bands
  16344. -
  16345. -The driver was constructing a list of channels per wiphy band
  16346. -by querying the device. This list is not what the hardware is
  16347. -able to do as it is already filtered by the country setting in
  16348. -the device. As user-space may change the country this would
  16349. -require updating the channel list which is not recommended [1].
  16350. -This patch introduces a superset of channels. The individual
  16351. -channels are disabled appropriately by querying the device.
  16352. -
  16353. -[1] http://mid.gmane.org/1426706320.3001.21.camel@sipsolutions.net
  16354. -
  16355. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16356. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  16357. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16358. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16359. ----
  16360. -
  16361. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  16362. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  16363. -@@ -129,13 +129,47 @@ static struct ieee80211_rate __wl_rates[
  16364. - RATETAB_ENT(BRCM_RATE_54M, 0),
  16365. - };
  16366. -
  16367. --#define wl_a_rates (__wl_rates + 4)
  16368. --#define wl_a_rates_size 8
  16369. - #define wl_g_rates (__wl_rates + 0)
  16370. --#define wl_g_rates_size 12
  16371. -+#define wl_g_rates_size ARRAY_SIZE(__wl_rates)
  16372. -+#define wl_a_rates (__wl_rates + 4)
  16373. -+#define wl_a_rates_size (wl_g_rates_size - 4)
  16374. -+
  16375. -+#define CHAN2G(_channel, _freq) { \
  16376. -+ .band = IEEE80211_BAND_2GHZ, \
  16377. -+ .center_freq = (_freq), \
  16378. -+ .hw_value = (_channel), \
  16379. -+ .flags = IEEE80211_CHAN_DISABLED, \
  16380. -+ .max_antenna_gain = 0, \
  16381. -+ .max_power = 30, \
  16382. -+}
  16383. -+
  16384. -+#define CHAN5G(_channel) { \
  16385. -+ .band = IEEE80211_BAND_5GHZ, \
  16386. -+ .center_freq = 5000 + (5 * (_channel)), \
  16387. -+ .hw_value = (_channel), \
  16388. -+ .flags = IEEE80211_CHAN_DISABLED, \
  16389. -+ .max_antenna_gain = 0, \
  16390. -+ .max_power = 30, \
  16391. -+}
  16392. -+
  16393. -+static struct ieee80211_channel __wl_2ghz_channels[] = {
  16394. -+ CHAN2G(1, 2412), CHAN2G(2, 2417), CHAN2G(3, 2422), CHAN2G(4, 2427),
  16395. -+ CHAN2G(5, 2432), CHAN2G(6, 2437), CHAN2G(7, 2442), CHAN2G(8, 2447),
  16396. -+ CHAN2G(9, 2452), CHAN2G(10, 2457), CHAN2G(11, 2462), CHAN2G(12, 2467),
  16397. -+ CHAN2G(13, 2472), CHAN2G(14, 2484)
  16398. -+};
  16399. -+
  16400. -+static struct ieee80211_channel __wl_5ghz_channels[] = {
  16401. -+ CHAN5G(34), CHAN5G(36), CHAN5G(38), CHAN5G(40), CHAN5G(42),
  16402. -+ CHAN5G(44), CHAN5G(46), CHAN5G(48), CHAN5G(52), CHAN5G(56),
  16403. -+ CHAN5G(60), CHAN5G(64), CHAN5G(100), CHAN5G(104), CHAN5G(108),
  16404. -+ CHAN5G(112), CHAN5G(116), CHAN5G(120), CHAN5G(124), CHAN5G(128),
  16405. -+ CHAN5G(132), CHAN5G(136), CHAN5G(140), CHAN5G(144), CHAN5G(149),
  16406. -+ CHAN5G(153), CHAN5G(157), CHAN5G(161), CHAN5G(165)
  16407. -+};
  16408. -
  16409. - /* Band templates duplicated per wiphy. The channel info
  16410. -- * is filled in after querying the device.
  16411. -+ * above is added to the band during setup.
  16412. - */
  16413. - static const struct ieee80211_supported_band __wl_band_2ghz = {
  16414. - .band = IEEE80211_BAND_2GHZ,
  16415. -@@ -143,7 +177,7 @@ static const struct ieee80211_supported_
  16416. - .n_bitrates = wl_g_rates_size,
  16417. - };
  16418. -
  16419. --static const struct ieee80211_supported_band __wl_band_5ghz_a = {
  16420. -+static const struct ieee80211_supported_band __wl_band_5ghz = {
  16421. - .band = IEEE80211_BAND_5GHZ,
  16422. - .bitrates = wl_a_rates,
  16423. - .n_bitrates = wl_a_rates_size,
  16424. -@@ -5252,40 +5286,6 @@ dongle_scantime_out:
  16425. - return err;
  16426. - }
  16427. -
  16428. --/* Filter the list of channels received from firmware counting only
  16429. -- * the 20MHz channels. The wiphy band data only needs those which get
  16430. -- * flagged to indicate if they can take part in higher bandwidth.
  16431. -- */
  16432. --static void brcmf_count_20mhz_channels(struct brcmf_cfg80211_info *cfg,
  16433. -- struct brcmf_chanspec_list *chlist,
  16434. -- u32 chcnt[])
  16435. --{
  16436. -- u32 total = le32_to_cpu(chlist->count);
  16437. -- struct brcmu_chan ch;
  16438. -- int i;
  16439. --
  16440. -- for (i = 0; i < total; i++) {
  16441. -- ch.chspec = (u16)le32_to_cpu(chlist->element[i]);
  16442. -- cfg->d11inf.decchspec(&ch);
  16443. --
  16444. -- /* Firmware gives a ordered list. We skip non-20MHz
  16445. -- * channels is 2G. For 5G we can abort upon reaching
  16446. -- * a non-20MHz channel in the list.
  16447. -- */
  16448. -- if (ch.bw != BRCMU_CHAN_BW_20) {
  16449. -- if (ch.band == BRCMU_CHAN_BAND_5G)
  16450. -- break;
  16451. -- else
  16452. -- continue;
  16453. -- }
  16454. --
  16455. -- if (ch.band == BRCMU_CHAN_BAND_2G)
  16456. -- chcnt[0] += 1;
  16457. -- else if (ch.band == BRCMU_CHAN_BAND_5G)
  16458. -- chcnt[1] += 1;
  16459. -- }
  16460. --}
  16461. --
  16462. - static void brcmf_update_bw40_channel_flag(struct ieee80211_channel *channel,
  16463. - struct brcmu_chan *ch)
  16464. - {
  16465. -@@ -5321,7 +5321,6 @@ static int brcmf_construct_chaninfo(stru
  16466. - u32 i, j;
  16467. - u32 total;
  16468. - u32 chaninfo;
  16469. -- u32 chcnt[2] = { 0, 0 };
  16470. - u32 index;
  16471. -
  16472. - pbuf = kzalloc(BRCMF_DCMD_MEDLEN, GFP_KERNEL);
  16473. -@@ -5338,42 +5337,15 @@ static int brcmf_construct_chaninfo(stru
  16474. - goto fail_pbuf;
  16475. - }
  16476. -
  16477. -- brcmf_count_20mhz_channels(cfg, list, chcnt);
  16478. - wiphy = cfg_to_wiphy(cfg);
  16479. -- if (chcnt[0]) {
  16480. -- band = kmemdup(&__wl_band_2ghz, sizeof(__wl_band_2ghz),
  16481. -- GFP_KERNEL);
  16482. -- if (band == NULL) {
  16483. -- err = -ENOMEM;
  16484. -- goto fail_pbuf;
  16485. -- }
  16486. -- band->channels = kcalloc(chcnt[0], sizeof(*channel),
  16487. -- GFP_KERNEL);
  16488. -- if (band->channels == NULL) {
  16489. -- kfree(band);
  16490. -- err = -ENOMEM;
  16491. -- goto fail_pbuf;
  16492. -- }
  16493. -- band->n_channels = 0;
  16494. -- wiphy->bands[IEEE80211_BAND_2GHZ] = band;
  16495. -- }
  16496. -- if (chcnt[1]) {
  16497. -- band = kmemdup(&__wl_band_5ghz_a, sizeof(__wl_band_5ghz_a),
  16498. -- GFP_KERNEL);
  16499. -- if (band == NULL) {
  16500. -- err = -ENOMEM;
  16501. -- goto fail_band2g;
  16502. -- }
  16503. -- band->channels = kcalloc(chcnt[1], sizeof(*channel),
  16504. -- GFP_KERNEL);
  16505. -- if (band->channels == NULL) {
  16506. -- kfree(band);
  16507. -- err = -ENOMEM;
  16508. -- goto fail_band2g;
  16509. -- }
  16510. -- band->n_channels = 0;
  16511. -- wiphy->bands[IEEE80211_BAND_5GHZ] = band;
  16512. -- }
  16513. -+ band = wiphy->bands[IEEE80211_BAND_2GHZ];
  16514. -+ if (band)
  16515. -+ for (i = 0; i < band->n_channels; i++)
  16516. -+ band->channels[i].flags = IEEE80211_CHAN_DISABLED;
  16517. -+ band = wiphy->bands[IEEE80211_BAND_5GHZ];
  16518. -+ if (band)
  16519. -+ for (i = 0; i < band->n_channels; i++)
  16520. -+ band->channels[i].flags = IEEE80211_CHAN_DISABLED;
  16521. -
  16522. - total = le32_to_cpu(list->count);
  16523. - for (i = 0; i < total; i++) {
  16524. -@@ -5388,6 +5360,8 @@ static int brcmf_construct_chaninfo(stru
  16525. - brcmf_err("Invalid channel Spec. 0x%x.\n", ch.chspec);
  16526. - continue;
  16527. - }
  16528. -+ if (!band)
  16529. -+ continue;
  16530. - if (!(bw_cap[band->band] & WLC_BW_40MHZ_BIT) &&
  16531. - ch.bw == BRCMU_CHAN_BW_40)
  16532. - continue;
  16533. -@@ -5415,9 +5389,9 @@ static int brcmf_construct_chaninfo(stru
  16534. - } else if (ch.bw == BRCMU_CHAN_BW_40) {
  16535. - brcmf_update_bw40_channel_flag(&channel[index], &ch);
  16536. - } else {
  16537. -- /* disable other bandwidths for now as mentioned
  16538. -- * order assure they are enabled for subsequent
  16539. -- * chanspecs.
  16540. -+ /* enable the channel and disable other bandwidths
  16541. -+ * for now as mentioned order assure they are enabled
  16542. -+ * for subsequent chanspecs.
  16543. - */
  16544. - channel[index].flags = IEEE80211_CHAN_NO_HT40 |
  16545. - IEEE80211_CHAN_NO_80MHZ;
  16546. -@@ -5436,16 +5410,8 @@ static int brcmf_construct_chaninfo(stru
  16547. - IEEE80211_CHAN_NO_IR;
  16548. - }
  16549. - }
  16550. -- if (index == band->n_channels)
  16551. -- band->n_channels++;
  16552. - }
  16553. -- kfree(pbuf);
  16554. -- return 0;
  16555. -
  16556. --fail_band2g:
  16557. -- kfree(wiphy->bands[IEEE80211_BAND_2GHZ]->channels);
  16558. -- kfree(wiphy->bands[IEEE80211_BAND_2GHZ]);
  16559. -- wiphy->bands[IEEE80211_BAND_2GHZ] = NULL;
  16560. - fail_pbuf:
  16561. - kfree(pbuf);
  16562. - return err;
  16563. -@@ -5778,7 +5744,12 @@ static void brcmf_wiphy_wowl_params(stru
  16564. -
  16565. - static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
  16566. - {
  16567. -+ struct ieee80211_supported_band *band;
  16568. - struct ieee80211_iface_combination ifc_combo;
  16569. -+ __le32 bandlist[3];
  16570. -+ u32 n_bands;
  16571. -+ int err, i;
  16572. -+
  16573. - wiphy->max_scan_ssids = WL_NUM_SCAN_MAX;
  16574. - wiphy->max_scan_ie_len = BRCMF_SCAN_IE_LEN_MAX;
  16575. - wiphy->max_num_pmkids = WL_NUM_PMKIDS_MAX;
  16576. -@@ -5820,7 +5791,52 @@ static int brcmf_setup_wiphy(struct wiph
  16577. - if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL))
  16578. - brcmf_wiphy_wowl_params(wiphy);
  16579. -
  16580. -- return brcmf_setup_wiphybands(wiphy);
  16581. -+ err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BANDLIST, &bandlist,
  16582. -+ sizeof(bandlist));
  16583. -+ if (err) {
  16584. -+ brcmf_err("could not obtain band info: err=%d\n", err);
  16585. -+ return err;
  16586. -+ }
  16587. -+ /* first entry in bandlist is number of bands */
  16588. -+ n_bands = le32_to_cpu(bandlist[0]);
  16589. -+ for (i = 1; i <= n_bands && i < ARRAY_SIZE(bandlist); i++) {
  16590. -+ if (bandlist[i] == cpu_to_le32(WLC_BAND_2G)) {
  16591. -+ band = kmemdup(&__wl_band_2ghz, sizeof(__wl_band_2ghz),
  16592. -+ GFP_KERNEL);
  16593. -+ if (!band)
  16594. -+ return -ENOMEM;
  16595. -+
  16596. -+ band->channels = kmemdup(&__wl_2ghz_channels,
  16597. -+ sizeof(__wl_2ghz_channels),
  16598. -+ GFP_KERNEL);
  16599. -+ if (!band->channels) {
  16600. -+ kfree(band);
  16601. -+ return -ENOMEM;
  16602. -+ }
  16603. -+
  16604. -+ band->n_channels = ARRAY_SIZE(__wl_2ghz_channels);
  16605. -+ wiphy->bands[IEEE80211_BAND_2GHZ] = band;
  16606. -+ }
  16607. -+ if (bandlist[i] == cpu_to_le32(WLC_BAND_5G)) {
  16608. -+ band = kmemdup(&__wl_band_5ghz, sizeof(__wl_band_5ghz),
  16609. -+ GFP_KERNEL);
  16610. -+ if (!band)
  16611. -+ return -ENOMEM;
  16612. -+
  16613. -+ band->channels = kmemdup(&__wl_5ghz_channels,
  16614. -+ sizeof(__wl_5ghz_channels),
  16615. -+ GFP_KERNEL);
  16616. -+ if (!band->channels) {
  16617. -+ kfree(band);
  16618. -+ return -ENOMEM;
  16619. -+ }
  16620. -+
  16621. -+ band->n_channels = ARRAY_SIZE(__wl_5ghz_channels);
  16622. -+ wiphy->bands[IEEE80211_BAND_5GHZ] = band;
  16623. -+ }
  16624. -+ }
  16625. -+ err = brcmf_setup_wiphybands(wiphy);
  16626. -+ return err;
  16627. - }
  16628. -
  16629. - static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg)
  16630. -@@ -6011,6 +6027,9 @@ static void brcmf_cfg80211_reg_notifier(
  16631. -
  16632. - static void brcmf_free_wiphy(struct wiphy *wiphy)
  16633. - {
  16634. -+ if (!wiphy)
  16635. -+ return;
  16636. -+
  16637. - kfree(wiphy->iface_combinations);
  16638. - if (wiphy->bands[IEEE80211_BAND_2GHZ]) {
  16639. - kfree(wiphy->bands[IEEE80211_BAND_2GHZ]->channels);
  16640. 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
  16641. deleted file mode 100644
  16642. index a0c22eb..0000000
  16643. --- a/package/kernel/mac80211/patches/339-0002-brcmfmac-update-wiphy-band-information-upon-updating.patch
  16644. +++ /dev/null
  16645. @@ -1,29 +0,0 @@
  16646. -From: Arend van Spriel <arend@broadcom.com>
  16647. -Date: Tue, 14 Apr 2015 20:10:25 +0200
  16648. -Subject: [PATCH] brcmfmac: update wiphy band information upon updating
  16649. - regulatory domain
  16650. -
  16651. -When change the country code the available channels may change. So
  16652. -the wiphy bands should be updated accordingly.
  16653. -
  16654. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  16655. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16656. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16657. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16658. ----
  16659. -
  16660. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  16661. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  16662. -@@ -6022,7 +6022,11 @@ static void brcmf_cfg80211_reg_notifier(
  16663. - memset(&ccreq, 0, sizeof(ccreq));
  16664. - ccreq.rev = cpu_to_le32(-1);
  16665. - memcpy(ccreq.ccode, req->alpha2, sizeof(req->alpha2));
  16666. -- brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq));
  16667. -+ if (brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq))) {
  16668. -+ brcmf_err("firmware rejected country setting\n");
  16669. -+ return;
  16670. -+ }
  16671. -+ brcmf_setup_wiphybands(wiphy);
  16672. - }
  16673. -
  16674. - static void brcmf_free_wiphy(struct wiphy *wiphy)
  16675. 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
  16676. deleted file mode 100644
  16677. index 193f507..0000000
  16678. --- a/package/kernel/mac80211/patches/339-0003-brcmfmac-add-description-for-feature-flags.patch
  16679. +++ /dev/null
  16680. @@ -1,24 +0,0 @@
  16681. -From: Arend van Spriel <arend@broadcom.com>
  16682. -Date: Tue, 14 Apr 2015 20:10:26 +0200
  16683. -Subject: [PATCH] brcmfmac: add description for feature flags
  16684. -
  16685. -Some feature flags were not described in the header file. Adding
  16686. -the description.
  16687. -
  16688. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16689. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16690. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16691. ----
  16692. -
  16693. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  16694. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  16695. -@@ -19,7 +19,9 @@
  16696. - /*
  16697. - * Features:
  16698. - *
  16699. -+ * MBSS: multiple BSSID support (eg. guest network in AP mode).
  16700. - * MCHAN: multi-channel for concurrent P2P.
  16701. -+ * WOWL: Wake-On-WLAN.
  16702. - */
  16703. - #define BRCMF_FEAT_LIST \
  16704. - BRCMF_FEAT_DEF(MBSS) \
  16705. 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
  16706. deleted file mode 100644
  16707. index 42330b4..0000000
  16708. --- a/package/kernel/mac80211/patches/339-0004-brcmfmac-make-scheduled-scan-support-conditional.patch
  16709. +++ /dev/null
  16710. @@ -1,51 +0,0 @@
  16711. -From: Arend van Spriel <arend@broadcom.com>
  16712. -Date: Tue, 14 Apr 2015 20:10:27 +0200
  16713. -Subject: [PATCH] brcmfmac: make scheduled scan support conditional
  16714. -
  16715. -The scheduled scan support depends on firmware supporting the PNO
  16716. -feature. This feature is optional so add a feature flag for this
  16717. -in the driver and announce scheduled scan support accordingly.
  16718. -
  16719. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16720. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16721. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16722. ----
  16723. -
  16724. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  16725. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  16726. -@@ -5782,7 +5782,8 @@ static int brcmf_setup_wiphy(struct wiph
  16727. - wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM;
  16728. - wiphy->mgmt_stypes = brcmf_txrx_stypes;
  16729. - wiphy->max_remain_on_channel_duration = 5000;
  16730. -- brcmf_wiphy_pno_params(wiphy);
  16731. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_PNO))
  16732. -+ brcmf_wiphy_pno_params(wiphy);
  16733. -
  16734. - /* vendor commands/events support */
  16735. - wiphy->vendor_commands = brcmf_vendor_cmds;
  16736. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  16737. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  16738. -@@ -124,6 +124,7 @@ void brcmf_feat_attach(struct brcmf_pub
  16739. - struct brcmf_if *ifp = drvr->iflist[0];
  16740. -
  16741. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_MCHAN, "mchan");
  16742. -+ brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_PNO, "pfn");
  16743. - if (drvr->bus_if->wowl_supported)
  16744. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_WOWL, "wowl");
  16745. - if (drvr->bus_if->chip != BRCM_CC_43362_CHIP_ID)
  16746. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  16747. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  16748. -@@ -21,11 +21,13 @@
  16749. - *
  16750. - * MBSS: multiple BSSID support (eg. guest network in AP mode).
  16751. - * MCHAN: multi-channel for concurrent P2P.
  16752. -+ * PNO: preferred network offload.
  16753. - * WOWL: Wake-On-WLAN.
  16754. - */
  16755. - #define BRCMF_FEAT_LIST \
  16756. - BRCMF_FEAT_DEF(MBSS) \
  16757. - BRCMF_FEAT_DEF(MCHAN) \
  16758. -+ BRCMF_FEAT_DEF(PNO) \
  16759. - BRCMF_FEAT_DEF(WOWL)
  16760. - /*
  16761. - * Quirks:
  16762. 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
  16763. deleted file mode 100644
  16764. index b859d46..0000000
  16765. --- a/package/kernel/mac80211/patches/339-0005-brcmfmac-add-support-for-BCM4324-rev-B5-chipset.patch
  16766. +++ /dev/null
  16767. @@ -1,43 +0,0 @@
  16768. -From: Arend van Spriel <arend@broadcom.com>
  16769. -Date: Tue, 14 Apr 2015 20:10:28 +0200
  16770. -Subject: [PATCH] brcmfmac: add support for BCM4324 rev B5 chipset
  16771. -
  16772. -This patch adds support for the BCM4324 B5 revision. This device
  16773. -is similar to BCM43241 from driver and firmware perspective. It
  16774. -is known to be used in Lenovo Thinkpad Tablet devices.
  16775. -
  16776. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16777. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16778. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16779. ----
  16780. -
  16781. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  16782. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  16783. -@@ -601,6 +601,8 @@ static const struct sdiod_drive_str sdio
  16784. - #define BCM43241B0_NVRAM_NAME "brcm/brcmfmac43241b0-sdio.txt"
  16785. - #define BCM43241B4_FIRMWARE_NAME "brcm/brcmfmac43241b4-sdio.bin"
  16786. - #define BCM43241B4_NVRAM_NAME "brcm/brcmfmac43241b4-sdio.txt"
  16787. -+#define BCM43241B5_FIRMWARE_NAME "brcm/brcmfmac43241b5-sdio.bin"
  16788. -+#define BCM43241B5_NVRAM_NAME "brcm/brcmfmac43241b5-sdio.txt"
  16789. - #define BCM4329_FIRMWARE_NAME "brcm/brcmfmac4329-sdio.bin"
  16790. - #define BCM4329_NVRAM_NAME "brcm/brcmfmac4329-sdio.txt"
  16791. - #define BCM4330_FIRMWARE_NAME "brcm/brcmfmac4330-sdio.bin"
  16792. -@@ -628,6 +630,8 @@ MODULE_FIRMWARE(BCM43241B0_FIRMWARE_NAME
  16793. - MODULE_FIRMWARE(BCM43241B0_NVRAM_NAME);
  16794. - MODULE_FIRMWARE(BCM43241B4_FIRMWARE_NAME);
  16795. - MODULE_FIRMWARE(BCM43241B4_NVRAM_NAME);
  16796. -+MODULE_FIRMWARE(BCM43241B5_FIRMWARE_NAME);
  16797. -+MODULE_FIRMWARE(BCM43241B5_NVRAM_NAME);
  16798. - MODULE_FIRMWARE(BCM4329_FIRMWARE_NAME);
  16799. - MODULE_FIRMWARE(BCM4329_NVRAM_NAME);
  16800. - MODULE_FIRMWARE(BCM4330_FIRMWARE_NAME);
  16801. -@@ -667,7 +671,8 @@ enum brcmf_firmware_type {
  16802. - static const struct brcmf_firmware_names brcmf_fwname_data[] = {
  16803. - { BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM43143) },
  16804. - { BRCM_CC_43241_CHIP_ID, 0x0000001F, BRCMF_FIRMWARE_NVRAM(BCM43241B0) },
  16805. -- { BRCM_CC_43241_CHIP_ID, 0xFFFFFFE0, BRCMF_FIRMWARE_NVRAM(BCM43241B4) },
  16806. -+ { BRCM_CC_43241_CHIP_ID, 0x00000020, BRCMF_FIRMWARE_NVRAM(BCM43241B4) },
  16807. -+ { BRCM_CC_43241_CHIP_ID, 0xFFFFFFC0, BRCMF_FIRMWARE_NVRAM(BCM43241B5) },
  16808. - { BRCM_CC_4329_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4329) },
  16809. - { BRCM_CC_4330_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4330) },
  16810. - { BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4334) },
  16811. 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
  16812. deleted file mode 100644
  16813. index d420308..0000000
  16814. --- a/package/kernel/mac80211/patches/339-0006-brcmfmac-process-interrupt-regardless-sdiod-state.patch
  16815. +++ /dev/null
  16816. @@ -1,27 +0,0 @@
  16817. -From: Arend van Spriel <arend@broadcom.com>
  16818. -Date: Tue, 14 Apr 2015 20:10:29 +0200
  16819. -Subject: [PATCH] brcmfmac: process interrupt regardless sdiod state
  16820. -
  16821. -When the sdio bus state is not ready to process we abort the
  16822. -interrupt service routine. This is not wanted as it keeps the
  16823. -interrupt source active. Better clear the interrupt source.
  16824. -
  16825. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16826. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16827. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  16828. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16829. ----
  16830. -
  16831. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  16832. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  16833. -@@ -3555,10 +3555,6 @@ void brcmf_sdio_isr(struct brcmf_sdio *b
  16834. - return;
  16835. - }
  16836. -
  16837. -- if (bus->sdiodev->state != BRCMF_SDIOD_DATA) {
  16838. -- brcmf_err("bus is down. we have nothing to do\n");
  16839. -- return;
  16840. -- }
  16841. - /* Count the interrupt call */
  16842. - bus->sdcnt.intrcount++;
  16843. - if (in_interrupt())
  16844. 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
  16845. deleted file mode 100644
  16846. index ac5584e..0000000
  16847. --- a/package/kernel/mac80211/patches/339-0007-brcmfmac-fix-sdio-suspend-and-resume.patch
  16848. +++ /dev/null
  16849. @@ -1,68 +0,0 @@
  16850. -From: Arend van Spriel <arend@broadcom.com>
  16851. -Date: Tue, 14 Apr 2015 20:10:30 +0200
  16852. -Subject: [PATCH] brcmfmac: fix sdio suspend and resume
  16853. -
  16854. -commit 330b4e4be937 ("brcmfmac: Add wowl support for SDIO devices.")
  16855. -changed the behaviour by removing the MMC_PM_KEEP_POWER flag for
  16856. -non-wowl scenario, which needs to be restored. Another necessary
  16857. -change is to mark the card as being non-removable. With this in place
  16858. -the suspend resume test passes successfully doing:
  16859. -
  16860. - # echo devices > /sys/power/pm_test
  16861. - # echo mem > /sys/power/state
  16862. -
  16863. -Note that power may still be switched off when system is going
  16864. -in S3 state.
  16865. -
  16866. -Reported-by: Fu, Zhonghui <<zhonghui.fu@linux.intel.com>
  16867. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16868. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  16869. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16870. ----
  16871. -
  16872. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  16873. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  16874. -@@ -1011,6 +1011,14 @@ static int brcmf_sdiod_remove(struct brc
  16875. - return 0;
  16876. - }
  16877. -
  16878. -+static void brcmf_sdiod_host_fixup(struct mmc_host *host)
  16879. -+{
  16880. -+ /* runtime-pm powers off the device */
  16881. -+ pm_runtime_forbid(host->parent);
  16882. -+ /* avoid removal detection upon resume */
  16883. -+ host->caps |= MMC_CAP_NONREMOVABLE;
  16884. -+}
  16885. -+
  16886. - static int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev)
  16887. - {
  16888. - struct sdio_func *func;
  16889. -@@ -1076,7 +1084,7 @@ static int brcmf_sdiod_probe(struct brcm
  16890. - ret = -ENODEV;
  16891. - goto out;
  16892. - }
  16893. -- pm_runtime_forbid(host->parent);
  16894. -+ brcmf_sdiod_host_fixup(host);
  16895. - out:
  16896. - if (ret)
  16897. - brcmf_sdiod_remove(sdiodev);
  16898. -@@ -1246,15 +1254,15 @@ static int brcmf_ops_sdio_suspend(struct
  16899. - brcmf_sdiod_freezer_on(sdiodev);
  16900. - brcmf_sdio_wd_timer(sdiodev->bus, 0);
  16901. -
  16902. -+ sdio_flags = MMC_PM_KEEP_POWER;
  16903. - if (sdiodev->wowl_enabled) {
  16904. -- sdio_flags = MMC_PM_KEEP_POWER;
  16905. - if (sdiodev->pdata->oob_irq_supported)
  16906. - enable_irq_wake(sdiodev->pdata->oob_irq_nr);
  16907. - else
  16908. -- sdio_flags = MMC_PM_WAKE_SDIO_IRQ;
  16909. -- if (sdio_set_host_pm_flags(sdiodev->func[1], sdio_flags))
  16910. -- brcmf_err("Failed to set pm_flags %x\n", sdio_flags);
  16911. -+ sdio_flags |= MMC_PM_WAKE_SDIO_IRQ;
  16912. - }
  16913. -+ if (sdio_set_host_pm_flags(sdiodev->func[1], sdio_flags))
  16914. -+ brcmf_err("Failed to set pm_flags %x\n", sdio_flags);
  16915. - return 0;
  16916. - }
  16917. -
  16918. 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
  16919. deleted file mode 100644
  16920. index a521b65..0000000
  16921. --- a/package/kernel/mac80211/patches/339-0008-brcmfmac-add-support-for-BCM4358-PCIe-device.patch
  16922. +++ /dev/null
  16923. @@ -1,77 +0,0 @@
  16924. -From: Arend van Spriel <arend@broadcom.com>
  16925. -Date: Tue, 14 Apr 2015 20:10:31 +0200
  16926. -Subject: [PATCH] brcmfmac: add support for BCM4358 PCIe device
  16927. -
  16928. -This patch adds support for the BCM4358 2x2 11ac device.
  16929. -
  16930. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16931. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16932. ----
  16933. -
  16934. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  16935. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  16936. -@@ -649,6 +649,7 @@ static u32 brcmf_chip_tcm_rambase(struct
  16937. - case BRCM_CC_43567_CHIP_ID:
  16938. - case BRCM_CC_43569_CHIP_ID:
  16939. - case BRCM_CC_43570_CHIP_ID:
  16940. -+ case BRCM_CC_4358_CHIP_ID:
  16941. - case BRCM_CC_43602_CHIP_ID:
  16942. - return 0x180000;
  16943. - default:
  16944. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16945. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16946. -@@ -51,6 +51,8 @@ enum brcmf_pcie_state {
  16947. - #define BRCMF_PCIE_4356_NVRAM_NAME "brcm/brcmfmac4356-pcie.txt"
  16948. - #define BRCMF_PCIE_43570_FW_NAME "brcm/brcmfmac43570-pcie.bin"
  16949. - #define BRCMF_PCIE_43570_NVRAM_NAME "brcm/brcmfmac43570-pcie.txt"
  16950. -+#define BRCMF_PCIE_4358_FW_NAME "brcm/brcmfmac4358-pcie.bin"
  16951. -+#define BRCMF_PCIE_4358_NVRAM_NAME "brcm/brcmfmac4358-pcie.txt"
  16952. -
  16953. - #define BRCMF_PCIE_FW_UP_TIMEOUT 2000 /* msec */
  16954. -
  16955. -@@ -189,6 +191,8 @@ MODULE_FIRMWARE(BRCMF_PCIE_4356_FW_NAME)
  16956. - MODULE_FIRMWARE(BRCMF_PCIE_4356_NVRAM_NAME);
  16957. - MODULE_FIRMWARE(BRCMF_PCIE_43570_FW_NAME);
  16958. - MODULE_FIRMWARE(BRCMF_PCIE_43570_NVRAM_NAME);
  16959. -+MODULE_FIRMWARE(BRCMF_PCIE_4358_FW_NAME);
  16960. -+MODULE_FIRMWARE(BRCMF_PCIE_4358_NVRAM_NAME);
  16961. -
  16962. -
  16963. - struct brcmf_pcie_console {
  16964. -@@ -1333,6 +1337,10 @@ static int brcmf_pcie_get_fwnames(struct
  16965. - fw_name = BRCMF_PCIE_43570_FW_NAME;
  16966. - nvram_name = BRCMF_PCIE_43570_NVRAM_NAME;
  16967. - break;
  16968. -+ case BRCM_CC_4358_CHIP_ID:
  16969. -+ fw_name = BRCMF_PCIE_4358_FW_NAME;
  16970. -+ nvram_name = BRCMF_PCIE_4358_NVRAM_NAME;
  16971. -+ break;
  16972. - default:
  16973. - brcmf_err("Unsupported chip 0x%04x\n", devinfo->ci->chip);
  16974. - return -ENODEV;
  16975. -@@ -1850,6 +1858,7 @@ static struct pci_device_id brcmf_pcie_d
  16976. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4356_DEVICE_ID),
  16977. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43567_DEVICE_ID),
  16978. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43570_DEVICE_ID),
  16979. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4358_DEVICE_ID),
  16980. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_DEVICE_ID),
  16981. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_2G_DEVICE_ID),
  16982. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_5G_DEVICE_ID),
  16983. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  16984. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  16985. -@@ -45,6 +45,7 @@
  16986. - #define BRCM_CC_43567_CHIP_ID 43567
  16987. - #define BRCM_CC_43569_CHIP_ID 43569
  16988. - #define BRCM_CC_43570_CHIP_ID 43570
  16989. -+#define BRCM_CC_4358_CHIP_ID 0x4358
  16990. - #define BRCM_CC_43602_CHIP_ID 43602
  16991. -
  16992. - /* USB Device IDs */
  16993. -@@ -59,6 +60,7 @@
  16994. - #define BRCM_PCIE_4356_DEVICE_ID 0x43ec
  16995. - #define BRCM_PCIE_43567_DEVICE_ID 0x43d3
  16996. - #define BRCM_PCIE_43570_DEVICE_ID 0x43d9
  16997. -+#define BRCM_PCIE_4358_DEVICE_ID 0x43e9
  16998. - #define BRCM_PCIE_43602_DEVICE_ID 0x43ba
  16999. - #define BRCM_PCIE_43602_2G_DEVICE_ID 0x43bb
  17000. - #define BRCM_PCIE_43602_5G_DEVICE_ID 0x43bc
  17001. 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
  17002. deleted file mode 100644
  17003. index bcbb984..0000000
  17004. --- a/package/kernel/mac80211/patches/339-0009-brcmfmac-add-additional-43602-pcie-device-id.patch
  17005. +++ /dev/null
  17006. @@ -1,30 +0,0 @@
  17007. -From: Hante Meuleman <meuleman@broadcom.com>
  17008. -Date: Tue, 14 Apr 2015 20:10:32 +0200
  17009. -Subject: [PATCH] brcmfmac: add additional 43602 pcie device id.
  17010. -
  17011. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  17012. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17013. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  17014. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17015. ----
  17016. -
  17017. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  17018. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  17019. -@@ -1862,6 +1862,7 @@ static struct pci_device_id brcmf_pcie_d
  17020. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_DEVICE_ID),
  17021. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_2G_DEVICE_ID),
  17022. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_5G_DEVICE_ID),
  17023. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_RAW_DEVICE_ID),
  17024. - { /* end: all zeroes */ }
  17025. - };
  17026. -
  17027. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  17028. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  17029. -@@ -64,6 +64,7 @@
  17030. - #define BRCM_PCIE_43602_DEVICE_ID 0x43ba
  17031. - #define BRCM_PCIE_43602_2G_DEVICE_ID 0x43bb
  17032. - #define BRCM_PCIE_43602_5G_DEVICE_ID 0x43bc
  17033. -+#define BRCM_PCIE_43602_RAW_DEVICE_ID 43602
  17034. -
  17035. - /* brcmsmac IDs */
  17036. - #define BCM4313_D11N2G_ID 0x4727 /* 4313 802.11n 2.4G device */
  17037. 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
  17038. deleted file mode 100644
  17039. index 5f9bbea..0000000
  17040. --- a/package/kernel/mac80211/patches/339-0010-brcmfmac-Add-support-for-multiple-PCIE-devices-in-nv.patch
  17041. +++ /dev/null
  17042. @@ -1,351 +0,0 @@
  17043. -From: Hante Meuleman <meuleman@broadcom.com>
  17044. -Date: Tue, 14 Apr 2015 20:10:33 +0200
  17045. -Subject: [PATCH] brcmfmac: Add support for multiple PCIE devices in
  17046. - nvram.
  17047. -
  17048. -With PCIE it is possible to support multiple devices with the
  17049. -same device type. They all load the same nvram file. In order to
  17050. -support this the nvram can specify which part of the nvram is
  17051. -for which pcie device. This patch adds support for these new
  17052. -types of nvram files.
  17053. -
  17054. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  17055. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  17056. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17057. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  17058. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  17059. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17060. ----
  17061. -
  17062. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17063. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17064. -@@ -23,6 +23,10 @@
  17065. - #include "debug.h"
  17066. - #include "firmware.h"
  17067. -
  17068. -+#define BRCMF_FW_MAX_NVRAM_SIZE 64000
  17069. -+#define BRCMF_FW_NVRAM_DEVPATH_LEN 19 /* devpath0=pcie/1/4/ */
  17070. -+#define BRCMF_FW_NVRAM_PCIEDEV_LEN 9 /* pcie/1/4/ */
  17071. -+
  17072. - char brcmf_firmware_path[BRCMF_FW_PATH_LEN];
  17073. - module_param_string(firmware_path, brcmf_firmware_path,
  17074. - BRCMF_FW_PATH_LEN, 0440);
  17075. -@@ -46,6 +50,8 @@ enum nvram_parser_state {
  17076. - * @column: current column in line.
  17077. - * @pos: byte offset in input buffer.
  17078. - * @entry: start position of key,value entry.
  17079. -+ * @multi_dev_v1: detect pcie multi device v1 (compressed).
  17080. -+ * @multi_dev_v2: detect pcie multi device v2.
  17081. - */
  17082. - struct nvram_parser {
  17083. - enum nvram_parser_state state;
  17084. -@@ -56,6 +62,8 @@ struct nvram_parser {
  17085. - u32 column;
  17086. - u32 pos;
  17087. - u32 entry;
  17088. -+ bool multi_dev_v1;
  17089. -+ bool multi_dev_v2;
  17090. - };
  17091. -
  17092. - static bool is_nvram_char(char c)
  17093. -@@ -108,6 +116,10 @@ static enum nvram_parser_state brcmf_nvr
  17094. - st = COMMENT;
  17095. - else
  17096. - st = VALUE;
  17097. -+ if (strncmp(&nvp->fwnv->data[nvp->entry], "devpath", 7) == 0)
  17098. -+ nvp->multi_dev_v1 = true;
  17099. -+ if (strncmp(&nvp->fwnv->data[nvp->entry], "pcie/", 5) == 0)
  17100. -+ nvp->multi_dev_v2 = true;
  17101. - } else if (!is_nvram_char(c)) {
  17102. - brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n",
  17103. - nvp->line, nvp->column);
  17104. -@@ -133,6 +145,8 @@ brcmf_nvram_handle_value(struct nvram_pa
  17105. - ekv = (u8 *)&nvp->fwnv->data[nvp->pos];
  17106. - skv = (u8 *)&nvp->fwnv->data[nvp->entry];
  17107. - cplen = ekv - skv;
  17108. -+ if (nvp->nvram_len + cplen + 1 >= BRCMF_FW_MAX_NVRAM_SIZE)
  17109. -+ return END;
  17110. - /* copy to output buffer */
  17111. - memcpy(&nvp->nvram[nvp->nvram_len], skv, cplen);
  17112. - nvp->nvram_len += cplen;
  17113. -@@ -180,10 +194,18 @@ static enum nvram_parser_state
  17114. - static int brcmf_init_nvram_parser(struct nvram_parser *nvp,
  17115. - const struct firmware *nv)
  17116. - {
  17117. -+ size_t size;
  17118. -+
  17119. - memset(nvp, 0, sizeof(*nvp));
  17120. - nvp->fwnv = nv;
  17121. -+ /* Limit size to MAX_NVRAM_SIZE, some files contain lot of comment */
  17122. -+ if (nv->size > BRCMF_FW_MAX_NVRAM_SIZE)
  17123. -+ size = BRCMF_FW_MAX_NVRAM_SIZE;
  17124. -+ else
  17125. -+ size = nv->size;
  17126. - /* Alloc for extra 0 byte + roundup by 4 + length field */
  17127. -- nvp->nvram = kzalloc(nv->size + 1 + 3 + sizeof(u32), GFP_KERNEL);
  17128. -+ size += 1 + 3 + sizeof(u32);
  17129. -+ nvp->nvram = kzalloc(size, GFP_KERNEL);
  17130. - if (!nvp->nvram)
  17131. - return -ENOMEM;
  17132. -
  17133. -@@ -192,12 +214,136 @@ static int brcmf_init_nvram_parser(struc
  17134. - return 0;
  17135. - }
  17136. -
  17137. -+/* brcmf_fw_strip_multi_v1 :Some nvram files contain settings for multiple
  17138. -+ * devices. Strip it down for one device, use domain_nr/bus_nr to determine
  17139. -+ * which data is to be returned. v1 is the version where nvram is stored
  17140. -+ * compressed and "devpath" maps to index for valid entries.
  17141. -+ */
  17142. -+static void brcmf_fw_strip_multi_v1(struct nvram_parser *nvp, u16 domain_nr,
  17143. -+ u16 bus_nr)
  17144. -+{
  17145. -+ u32 i, j;
  17146. -+ bool found;
  17147. -+ u8 *nvram;
  17148. -+ u8 id;
  17149. -+
  17150. -+ nvram = kzalloc(nvp->nvram_len + 1 + 3 + sizeof(u32), GFP_KERNEL);
  17151. -+ if (!nvram)
  17152. -+ goto fail;
  17153. -+
  17154. -+ /* min length: devpath0=pcie/1/4/ + 0:x=y */
  17155. -+ if (nvp->nvram_len < BRCMF_FW_NVRAM_DEVPATH_LEN + 6)
  17156. -+ goto fail;
  17157. -+
  17158. -+ /* First search for the devpathX and see if it is the configuration
  17159. -+ * for domain_nr/bus_nr. Search complete nvp
  17160. -+ */
  17161. -+ found = false;
  17162. -+ i = 0;
  17163. -+ while (i < nvp->nvram_len - BRCMF_FW_NVRAM_DEVPATH_LEN) {
  17164. -+ /* Format: devpathX=pcie/Y/Z/
  17165. -+ * Y = domain_nr, Z = bus_nr, X = virtual ID
  17166. -+ */
  17167. -+ if ((strncmp(&nvp->nvram[i], "devpath", 7) == 0) &&
  17168. -+ (strncmp(&nvp->nvram[i + 8], "=pcie/", 6) == 0)) {
  17169. -+ if (((nvp->nvram[i + 14] - '0') == domain_nr) &&
  17170. -+ ((nvp->nvram[i + 16] - '0') == bus_nr)) {
  17171. -+ id = nvp->nvram[i + 7] - '0';
  17172. -+ found = true;
  17173. -+ break;
  17174. -+ }
  17175. -+ }
  17176. -+ while (nvp->nvram[i] != 0)
  17177. -+ i++;
  17178. -+ i++;
  17179. -+ }
  17180. -+ if (!found)
  17181. -+ goto fail;
  17182. -+
  17183. -+ /* Now copy all valid entries, release old nvram and assign new one */
  17184. -+ i = 0;
  17185. -+ j = 0;
  17186. -+ while (i < nvp->nvram_len) {
  17187. -+ if ((nvp->nvram[i] - '0' == id) && (nvp->nvram[i + 1] == ':')) {
  17188. -+ i += 2;
  17189. -+ while (nvp->nvram[i] != 0) {
  17190. -+ nvram[j] = nvp->nvram[i];
  17191. -+ i++;
  17192. -+ j++;
  17193. -+ }
  17194. -+ nvram[j] = 0;
  17195. -+ j++;
  17196. -+ }
  17197. -+ while (nvp->nvram[i] != 0)
  17198. -+ i++;
  17199. -+ i++;
  17200. -+ }
  17201. -+ kfree(nvp->nvram);
  17202. -+ nvp->nvram = nvram;
  17203. -+ nvp->nvram_len = j;
  17204. -+ return;
  17205. -+
  17206. -+fail:
  17207. -+ kfree(nvram);
  17208. -+ nvp->nvram_len = 0;
  17209. -+}
  17210. -+
  17211. -+/* brcmf_fw_strip_multi_v2 :Some nvram files contain settings for multiple
  17212. -+ * devices. Strip it down for one device, use domain_nr/bus_nr to determine
  17213. -+ * which data is to be returned. v2 is the version where nvram is stored
  17214. -+ * uncompressed, all relevant valid entries are identified by
  17215. -+ * pcie/domain_nr/bus_nr:
  17216. -+ */
  17217. -+static void brcmf_fw_strip_multi_v2(struct nvram_parser *nvp, u16 domain_nr,
  17218. -+ u16 bus_nr)
  17219. -+{
  17220. -+ u32 i, j;
  17221. -+ u8 *nvram;
  17222. -+
  17223. -+ nvram = kzalloc(nvp->nvram_len + 1 + 3 + sizeof(u32), GFP_KERNEL);
  17224. -+ if (!nvram)
  17225. -+ goto fail;
  17226. -+
  17227. -+ /* Copy all valid entries, release old nvram and assign new one.
  17228. -+ * Valid entries are of type pcie/X/Y/ where X = domain_nr and
  17229. -+ * Y = bus_nr.
  17230. -+ */
  17231. -+ i = 0;
  17232. -+ j = 0;
  17233. -+ while (i < nvp->nvram_len - BRCMF_FW_NVRAM_PCIEDEV_LEN) {
  17234. -+ if ((strncmp(&nvp->nvram[i], "pcie/", 5) == 0) &&
  17235. -+ (nvp->nvram[i + 6] == '/') && (nvp->nvram[i + 8] == '/') &&
  17236. -+ ((nvp->nvram[i + 5] - '0') == domain_nr) &&
  17237. -+ ((nvp->nvram[i + 7] - '0') == bus_nr)) {
  17238. -+ i += BRCMF_FW_NVRAM_PCIEDEV_LEN;
  17239. -+ while (nvp->nvram[i] != 0) {
  17240. -+ nvram[j] = nvp->nvram[i];
  17241. -+ i++;
  17242. -+ j++;
  17243. -+ }
  17244. -+ nvram[j] = 0;
  17245. -+ j++;
  17246. -+ }
  17247. -+ while (nvp->nvram[i] != 0)
  17248. -+ i++;
  17249. -+ i++;
  17250. -+ }
  17251. -+ kfree(nvp->nvram);
  17252. -+ nvp->nvram = nvram;
  17253. -+ nvp->nvram_len = j;
  17254. -+ return;
  17255. -+fail:
  17256. -+ kfree(nvram);
  17257. -+ nvp->nvram_len = 0;
  17258. -+}
  17259. -+
  17260. - /* brcmf_nvram_strip :Takes a buffer of "<var>=<value>\n" lines read from a fil
  17261. - * and ending in a NUL. Removes carriage returns, empty lines, comment lines,
  17262. - * and converts newlines to NULs. Shortens buffer as needed and pads with NULs.
  17263. - * End of buffer is completed with token identifying length of buffer.
  17264. - */
  17265. --static void *brcmf_fw_nvram_strip(const struct firmware *nv, u32 *new_length)
  17266. -+static void *brcmf_fw_nvram_strip(const struct firmware *nv, u32 *new_length,
  17267. -+ u16 domain_nr, u16 bus_nr)
  17268. - {
  17269. - struct nvram_parser nvp;
  17270. - u32 pad;
  17271. -@@ -212,6 +358,16 @@ static void *brcmf_fw_nvram_strip(const
  17272. - if (nvp.state == END)
  17273. - break;
  17274. - }
  17275. -+ if (nvp.multi_dev_v1)
  17276. -+ brcmf_fw_strip_multi_v1(&nvp, domain_nr, bus_nr);
  17277. -+ else if (nvp.multi_dev_v2)
  17278. -+ brcmf_fw_strip_multi_v2(&nvp, domain_nr, bus_nr);
  17279. -+
  17280. -+ if (nvp.nvram_len == 0) {
  17281. -+ kfree(nvp.nvram);
  17282. -+ return NULL;
  17283. -+ }
  17284. -+
  17285. - pad = nvp.nvram_len;
  17286. - *new_length = roundup(nvp.nvram_len + 1, 4);
  17287. - while (pad != *new_length) {
  17288. -@@ -239,6 +395,8 @@ struct brcmf_fw {
  17289. - u16 flags;
  17290. - const struct firmware *code;
  17291. - const char *nvram_name;
  17292. -+ u16 domain_nr;
  17293. -+ u16 bus_nr;
  17294. - void (*done)(struct device *dev, const struct firmware *fw,
  17295. - void *nvram_image, u32 nvram_len);
  17296. - };
  17297. -@@ -254,7 +412,8 @@ static void brcmf_fw_request_nvram_done(
  17298. - goto fail;
  17299. -
  17300. - if (fw) {
  17301. -- nvram = brcmf_fw_nvram_strip(fw, &nvram_length);
  17302. -+ nvram = brcmf_fw_nvram_strip(fw, &nvram_length,
  17303. -+ fwctx->domain_nr, fwctx->bus_nr);
  17304. - release_firmware(fw);
  17305. - if (!nvram && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL))
  17306. - goto fail;
  17307. -@@ -309,11 +468,12 @@ fail:
  17308. - kfree(fwctx);
  17309. - }
  17310. -
  17311. --int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  17312. -- const char *code, const char *nvram,
  17313. -- void (*fw_cb)(struct device *dev,
  17314. -- const struct firmware *fw,
  17315. -- void *nvram_image, u32 nvram_len))
  17316. -+int brcmf_fw_get_firmwares_pcie(struct device *dev, u16 flags,
  17317. -+ const char *code, const char *nvram,
  17318. -+ void (*fw_cb)(struct device *dev,
  17319. -+ const struct firmware *fw,
  17320. -+ void *nvram_image, u32 nvram_len),
  17321. -+ u16 domain_nr, u16 bus_nr)
  17322. - {
  17323. - struct brcmf_fw *fwctx;
  17324. -
  17325. -@@ -333,8 +493,21 @@ int brcmf_fw_get_firmwares(struct device
  17326. - fwctx->done = fw_cb;
  17327. - if (flags & BRCMF_FW_REQUEST_NVRAM)
  17328. - fwctx->nvram_name = nvram;
  17329. -+ fwctx->domain_nr = domain_nr;
  17330. -+ fwctx->bus_nr = bus_nr;
  17331. -
  17332. - return request_firmware_nowait(THIS_MODULE, true, code, dev,
  17333. - GFP_KERNEL, fwctx,
  17334. - brcmf_fw_request_code_done);
  17335. - }
  17336. -+
  17337. -+int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  17338. -+ const char *code, const char *nvram,
  17339. -+ void (*fw_cb)(struct device *dev,
  17340. -+ const struct firmware *fw,
  17341. -+ void *nvram_image, u32 nvram_len))
  17342. -+{
  17343. -+ return brcmf_fw_get_firmwares_pcie(dev, flags, code, nvram, fw_cb, 0,
  17344. -+ 0);
  17345. -+}
  17346. -+
  17347. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.h
  17348. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.h
  17349. -@@ -32,6 +32,12 @@ void brcmf_fw_nvram_free(void *nvram);
  17350. - * fails it will not use the callback, but call device_release_driver()
  17351. - * instead which will call the driver .remove() callback.
  17352. - */
  17353. -+int brcmf_fw_get_firmwares_pcie(struct device *dev, u16 flags,
  17354. -+ const char *code, const char *nvram,
  17355. -+ void (*fw_cb)(struct device *dev,
  17356. -+ const struct firmware *fw,
  17357. -+ void *nvram_image, u32 nvram_len),
  17358. -+ u16 domain_nr, u16 bus_nr);
  17359. - int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  17360. - const char *code, const char *nvram,
  17361. - void (*fw_cb)(struct device *dev,
  17362. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  17363. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  17364. -@@ -1649,8 +1649,13 @@ brcmf_pcie_probe(struct pci_dev *pdev, c
  17365. - struct brcmf_pciedev_info *devinfo;
  17366. - struct brcmf_pciedev *pcie_bus_dev;
  17367. - struct brcmf_bus *bus;
  17368. -+ u16 domain_nr;
  17369. -+ u16 bus_nr;
  17370. -
  17371. -- brcmf_dbg(PCIE, "Enter %x:%x\n", pdev->vendor, pdev->device);
  17372. -+ domain_nr = pci_domain_nr(pdev->bus) + 1;
  17373. -+ bus_nr = pdev->bus->number;
  17374. -+ brcmf_dbg(PCIE, "Enter %x:%x (%d/%d)\n", pdev->vendor, pdev->device,
  17375. -+ domain_nr, bus_nr);
  17376. -
  17377. - ret = -ENOMEM;
  17378. - devinfo = kzalloc(sizeof(*devinfo), GFP_KERNEL);
  17379. -@@ -1699,10 +1704,10 @@ brcmf_pcie_probe(struct pci_dev *pdev, c
  17380. - if (ret)
  17381. - goto fail_bus;
  17382. -
  17383. -- ret = brcmf_fw_get_firmwares(bus->dev, BRCMF_FW_REQUEST_NVRAM |
  17384. -- BRCMF_FW_REQ_NV_OPTIONAL,
  17385. -- devinfo->fw_name, devinfo->nvram_name,
  17386. -- brcmf_pcie_setup);
  17387. -+ ret = brcmf_fw_get_firmwares_pcie(bus->dev, BRCMF_FW_REQUEST_NVRAM |
  17388. -+ BRCMF_FW_REQ_NV_OPTIONAL,
  17389. -+ devinfo->fw_name, devinfo->nvram_name,
  17390. -+ brcmf_pcie_setup, domain_nr, bus_nr);
  17391. - if (ret == 0)
  17392. - return 0;
  17393. - fail_bus:
  17394. diff --git a/package/kernel/mac80211/patches/340-brcmfmac-cleanup-a-sizeof.patch b/package/kernel/mac80211/patches/340-brcmfmac-cleanup-a-sizeof.patch
  17395. deleted file mode 100644
  17396. index d26e118..0000000
  17397. --- a/package/kernel/mac80211/patches/340-brcmfmac-cleanup-a-sizeof.patch
  17398. +++ /dev/null
  17399. @@ -1,23 +0,0 @@
  17400. -From: Dan Carpenter <dan.carpenter@oracle.com>
  17401. -Date: Thu, 7 May 2015 12:59:19 +0300
  17402. -Subject: [PATCH] brcmfmac: cleanup a sizeof()
  17403. -
  17404. -"flowrings" and "*flowrings" are both pointers so this always returns
  17405. -sizeof(void *) and the current code works fine. But "*flowrings" is
  17406. -intended here and static checkers complain, so lets change it.
  17407. -
  17408. -Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
  17409. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17410. ----
  17411. -
  17412. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  17413. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  17414. -@@ -1617,7 +1617,7 @@ static void brcmf_pcie_setup(struct devi
  17415. - bus->msgbuf->commonrings[i] =
  17416. - &devinfo->shared.commonrings[i]->commonring;
  17417. -
  17418. -- flowrings = kcalloc(devinfo->shared.nrof_flowrings, sizeof(flowrings),
  17419. -+ flowrings = kcalloc(devinfo->shared.nrof_flowrings, sizeof(*flowrings),
  17420. - GFP_KERNEL);
  17421. - if (!flowrings)
  17422. - goto fail;
  17423. 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
  17424. deleted file mode 100644
  17425. index 9b2880d..0000000
  17426. --- a/package/kernel/mac80211/patches/341-brcmfmac-check-result-of-USB-firmware-request.patch
  17427. +++ /dev/null
  17428. @@ -1,33 +0,0 @@
  17429. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17430. -Date: Thu, 7 May 2015 14:13:03 +0200
  17431. -Subject: [PATCH] brcmfmac: check result of USB firmware request
  17432. -MIME-Version: 1.0
  17433. -Content-Type: text/plain; charset=UTF-8
  17434. -Content-Transfer-Encoding: 8bit
  17435. -
  17436. -This prevents silence failures with driver waiting (infinitely) for a
  17437. -callback.
  17438. -
  17439. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  17440. -Acked-by: Arend van Spriel <arend@broadcom.com>
  17441. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17442. ----
  17443. -
  17444. ---- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  17445. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  17446. -@@ -1270,8 +1270,13 @@ static int brcmf_usb_probe_cb(struct brc
  17447. - bus->chiprev = bus_pub->chiprev;
  17448. -
  17449. - /* request firmware here */
  17450. -- brcmf_fw_get_firmwares(dev, 0, brcmf_usb_get_fwname(devinfo), NULL,
  17451. -- brcmf_usb_probe_phase2);
  17452. -+ ret = brcmf_fw_get_firmwares(dev, 0, brcmf_usb_get_fwname(devinfo),
  17453. -+ NULL, brcmf_usb_probe_phase2);
  17454. -+ if (ret) {
  17455. -+ brcmf_err("firmware request failed: %d\n", ret);
  17456. -+ goto fail;
  17457. -+ }
  17458. -+
  17459. - return 0;
  17460. -
  17461. - fail:
  17462. 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
  17463. deleted file mode 100644
  17464. index d46b300..0000000
  17465. --- a/package/kernel/mac80211/patches/342-brcmfmac-prohibit-ACPI-power-management-for-brcmfmac.patch
  17466. +++ /dev/null
  17467. @@ -1,47 +0,0 @@
  17468. -From: "Fu, Zhonghui" <zhonghui.fu@linux.intel.com>
  17469. -Date: Mon, 11 May 2015 10:41:32 +0800
  17470. -Subject: [PATCH] brcmfmac: prohibit ACPI power management for brcmfmac driver
  17471. -
  17472. -ACPI will manage WiFi chip's power state during suspend/resume
  17473. -process on some tablet platforms(such as ASUS T100TA). This is
  17474. -not supported by brcmfmac driver now, and the context of WiFi
  17475. -chip will be damaged after resume. This patch informs ACPI not
  17476. -to manage WiFi chip's power state.
  17477. -
  17478. -Signed-off-by: Zhonghui Fu <zhonghui.fu@linux.intel.com>
  17479. -Acked-by: Arend van Spriel <arend@broadcom.com>
  17480. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17481. ----
  17482. -
  17483. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  17484. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  17485. -@@ -33,6 +33,7 @@
  17486. - #include <linux/suspend.h>
  17487. - #include <linux/errno.h>
  17488. - #include <linux/module.h>
  17489. -+#include <linux/acpi.h>
  17490. - #include <net/cfg80211.h>
  17491. -
  17492. - #include <defs.h>
  17493. -@@ -1122,6 +1123,8 @@ static int brcmf_ops_sdio_probe(struct s
  17494. - int err;
  17495. - struct brcmf_sdio_dev *sdiodev;
  17496. - struct brcmf_bus *bus_if;
  17497. -+ struct device *dev;
  17498. -+ struct acpi_device *adev;
  17499. -
  17500. - brcmf_dbg(SDIO, "Enter\n");
  17501. - brcmf_dbg(SDIO, "Class=%x\n", func->class);
  17502. -@@ -1129,6 +1132,12 @@ static int brcmf_ops_sdio_probe(struct s
  17503. - brcmf_dbg(SDIO, "sdio device ID: 0x%04x\n", func->device);
  17504. - brcmf_dbg(SDIO, "Function#: %d\n", func->num);
  17505. -
  17506. -+ /* prohibit ACPI power management for this device */
  17507. -+ dev = &func->dev;
  17508. -+ adev = ACPI_COMPANION(dev);
  17509. -+ if (adev)
  17510. -+ adev->flags.power_manageable = 0;
  17511. -+
  17512. - /* Consume func num 1 but dont do anything with it. */
  17513. - if (func->num == 1)
  17514. - return 0;
  17515. 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
  17516. deleted file mode 100644
  17517. index 9b4609f..0000000
  17518. --- a/package/kernel/mac80211/patches/343-brcmfmac-avoid-gcc-5.1-warning.patch
  17519. +++ /dev/null
  17520. @@ -1,30 +0,0 @@
  17521. -From: Arnd Bergmann <arnd@arndb.de>
  17522. -Date: Tue, 12 May 2015 23:54:25 +0200
  17523. -Subject: [PATCH] brcmfmac: avoid gcc-5.1 warning
  17524. -
  17525. -gcc-5.0 gained a new warning in the fwsignal portion of the brcmfmac
  17526. -driver:
  17527. -
  17528. -drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c: In function 'brcmf_fws_txs_process':
  17529. -drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c:1478:8: warning: 'skb' may be used uninitialized in this function [-Wmaybe-uninitialized]
  17530. -
  17531. -This is a false positive, and marking the brcmf_fws_hanger_poppkt function
  17532. -as 'static inline' makes the warning go away. I have checked the object
  17533. -file output and while a little code gets moved around, the size of
  17534. -the binary remains identical.
  17535. -
  17536. -Signed-off-by: Arnd Bergmann <arnd@arndb.de>
  17537. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17538. ----
  17539. -
  17540. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  17541. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  17542. -@@ -635,7 +635,7 @@ static int brcmf_fws_hanger_pushpkt(stru
  17543. - return 0;
  17544. - }
  17545. -
  17546. --static int brcmf_fws_hanger_poppkt(struct brcmf_fws_hanger *h,
  17547. -+static inline int brcmf_fws_hanger_poppkt(struct brcmf_fws_hanger *h,
  17548. - u32 slot_id, struct sk_buff **pktout,
  17549. - bool remove_item)
  17550. - {
  17551. 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
  17552. deleted file mode 100644
  17553. index b16782d..0000000
  17554. --- a/package/kernel/mac80211/patches/344-0001-brcmfmac-allow-device-tree-node-without-interrupts-p.patch
  17555. +++ /dev/null
  17556. @@ -1,45 +0,0 @@
  17557. -From: Arend van Spriel <arend@broadcom.com>
  17558. -Date: Wed, 20 May 2015 14:09:47 +0200
  17559. -Subject: [PATCH] brcmfmac: allow device tree node without 'interrupts'
  17560. - property
  17561. -
  17562. -As described in the device tree bindings for 'brcm,bcm4329-fmac'
  17563. -nodes, the interrupts property is optional. So adding a check
  17564. -for the presence of this property before attempting to parse
  17565. -and map the interrupt. If not present or parsing fails return
  17566. -and fallback to in-band sdio interrupt.
  17567. -
  17568. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  17569. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17570. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17571. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17572. ----
  17573. -
  17574. ---- a/drivers/net/wireless/brcm80211/brcmfmac/of.c
  17575. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/of.c
  17576. -@@ -39,10 +39,16 @@ void brcmf_of_probe(struct brcmf_sdio_de
  17577. - if (!sdiodev->pdata)
  17578. - return;
  17579. -
  17580. -+ if (of_property_read_u32(np, "brcm,drive-strength", &val) == 0)
  17581. -+ sdiodev->pdata->drive_strength = val;
  17582. -+
  17583. -+ /* make sure there are interrupts defined in the node */
  17584. -+ if (!of_find_property(np, "interrupts", NULL))
  17585. -+ return;
  17586. -+
  17587. - irq = irq_of_parse_and_map(np, 0);
  17588. - if (!irq) {
  17589. - brcmf_err("interrupt could not be mapped\n");
  17590. -- devm_kfree(dev, sdiodev->pdata);
  17591. - return;
  17592. - }
  17593. - irqf = irqd_get_trigger_type(irq_get_irq_data(irq));
  17594. -@@ -50,7 +56,4 @@ void brcmf_of_probe(struct brcmf_sdio_de
  17595. - sdiodev->pdata->oob_irq_supported = true;
  17596. - sdiodev->pdata->oob_irq_nr = irq;
  17597. - sdiodev->pdata->oob_irq_flags = irqf;
  17598. --
  17599. -- if (of_property_read_u32(np, "brcm,drive-strength", &val) == 0)
  17600. -- sdiodev->pdata->drive_strength = val;
  17601. - }
  17602. 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
  17603. deleted file mode 100644
  17604. index f81250e..0000000
  17605. --- a/package/kernel/mac80211/patches/344-0002-brcmfmac-Improve-throughput-by-scheduling-msbug-flow.patch
  17606. +++ /dev/null
  17607. @@ -1,87 +0,0 @@
  17608. -From: Hante Meuleman <meuleman@broadcom.com>
  17609. -Date: Wed, 20 May 2015 14:09:48 +0200
  17610. -Subject: [PATCH] brcmfmac: Improve throughput by scheduling msbug flow worker.
  17611. -
  17612. -The tx flow worker in msgbuf gets scheduled at tx till a certain
  17613. -threshold has been reached. Then the tx completes will take over
  17614. -the scheduling. When amsdu and ampdu is used the frames are
  17615. -transferred wireless in a very bulky fashion, in combination
  17616. -with this scheduling algorithm and buffer limiters in the stack
  17617. -this can result in limited throughput. This change causes the
  17618. -flow worker to be scheduled more frequently from tx.
  17619. -
  17620. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  17621. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  17622. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17623. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  17624. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  17625. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17626. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17627. ----
  17628. -
  17629. ---- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  17630. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  17631. -@@ -249,8 +249,8 @@ void brcmf_flowring_delete(struct brcmf_
  17632. - }
  17633. -
  17634. -
  17635. --void brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  17636. -- struct sk_buff *skb)
  17637. -+u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  17638. -+ struct sk_buff *skb)
  17639. - {
  17640. - struct brcmf_flowring_ring *ring;
  17641. -
  17642. -@@ -271,6 +271,7 @@ void brcmf_flowring_enqueue(struct brcmf
  17643. - if (skb_queue_len(&ring->skblist) < BRCMF_FLOWRING_LOW)
  17644. - brcmf_flowring_block(flow, flowid, false);
  17645. - }
  17646. -+ return skb_queue_len(&ring->skblist);
  17647. - }
  17648. -
  17649. -
  17650. ---- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.h
  17651. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.h
  17652. -@@ -64,8 +64,8 @@ u32 brcmf_flowring_create(struct brcmf_f
  17653. - void brcmf_flowring_delete(struct brcmf_flowring *flow, u8 flowid);
  17654. - void brcmf_flowring_open(struct brcmf_flowring *flow, u8 flowid);
  17655. - u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u8 flowid);
  17656. --void brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  17657. -- struct sk_buff *skb);
  17658. -+u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  17659. -+ struct sk_buff *skb);
  17660. - struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u8 flowid);
  17661. - void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u8 flowid,
  17662. - struct sk_buff *skb);
  17663. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  17664. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  17665. -@@ -73,7 +73,7 @@
  17666. - #define BRCMF_MSGBUF_TX_FLUSH_CNT1 32
  17667. - #define BRCMF_MSGBUF_TX_FLUSH_CNT2 96
  17668. -
  17669. --#define BRCMF_MSGBUF_DELAY_TXWORKER_THRS 64
  17670. -+#define BRCMF_MSGBUF_DELAY_TXWORKER_THRS 96
  17671. - #define BRCMF_MSGBUF_TRICKLE_TXWORKER_THRS 32
  17672. -
  17673. - struct msgbuf_common_hdr {
  17674. -@@ -797,6 +797,8 @@ static int brcmf_msgbuf_txdata(struct br
  17675. - struct brcmf_flowring *flow = msgbuf->flow;
  17676. - struct ethhdr *eh = (struct ethhdr *)(skb->data);
  17677. - u32 flowid;
  17678. -+ u32 queue_count;
  17679. -+ bool force;
  17680. -
  17681. - flowid = brcmf_flowring_lookup(flow, eh->h_dest, skb->priority, ifidx);
  17682. - if (flowid == BRCMF_FLOWRING_INVALID_ID) {
  17683. -@@ -804,8 +806,9 @@ static int brcmf_msgbuf_txdata(struct br
  17684. - if (flowid == BRCMF_FLOWRING_INVALID_ID)
  17685. - return -ENOMEM;
  17686. - }
  17687. -- brcmf_flowring_enqueue(flow, flowid, skb);
  17688. -- brcmf_msgbuf_schedule_txdata(msgbuf, flowid, false);
  17689. -+ queue_count = brcmf_flowring_enqueue(flow, flowid, skb);
  17690. -+ force = ((queue_count % BRCMF_MSGBUF_TRICKLE_TXWORKER_THRS) == 0);
  17691. -+ brcmf_msgbuf_schedule_txdata(msgbuf, flowid, force);
  17692. -
  17693. - return 0;
  17694. - }
  17695. 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
  17696. deleted file mode 100644
  17697. index 61153c4..0000000
  17698. --- a/package/kernel/mac80211/patches/344-0003-brcmfmac-remove-pci-shared-structure-rev4-support.patch
  17699. +++ /dev/null
  17700. @@ -1,41 +0,0 @@
  17701. -From: Franky Lin <frankyl@broadcom.com>
  17702. -Date: Wed, 20 May 2015 14:09:49 +0200
  17703. -Subject: [PATCH] brcmfmac: remove pci shared structure rev4 support
  17704. -
  17705. -All pcie full dongle chips supported by fmac are using rev 5+ shared
  17706. -structure. This patch removes the rev4 related code.
  17707. -
  17708. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17709. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  17710. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  17711. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  17712. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17713. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17714. ----
  17715. -
  17716. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  17717. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  17718. -@@ -112,10 +112,9 @@ enum brcmf_pcie_state {
  17719. - BRCMF_PCIE_MB_INT_D2H3_DB0 | \
  17720. - BRCMF_PCIE_MB_INT_D2H3_DB1)
  17721. -
  17722. --#define BRCMF_PCIE_MIN_SHARED_VERSION 4
  17723. -+#define BRCMF_PCIE_MIN_SHARED_VERSION 5
  17724. - #define BRCMF_PCIE_MAX_SHARED_VERSION 5
  17725. - #define BRCMF_PCIE_SHARED_VERSION_MASK 0x00FF
  17726. --#define BRCMF_PCIE_SHARED_TXPUSH_SUPPORT 0x4000
  17727. -
  17728. - #define BRCMF_PCIE_FLAGS_HTOD_SPLIT 0x4000
  17729. - #define BRCMF_PCIE_FLAGS_DTOH_SPLIT 0x8000
  17730. -@@ -1280,11 +1279,6 @@ brcmf_pcie_init_share_ram_info(struct br
  17731. - brcmf_err("Unsupported PCIE version %d\n", version);
  17732. - return -EINVAL;
  17733. - }
  17734. -- if (shared->flags & BRCMF_PCIE_SHARED_TXPUSH_SUPPORT) {
  17735. -- brcmf_err("Unsupported legacy TX mode 0x%x\n",
  17736. -- shared->flags & BRCMF_PCIE_SHARED_TXPUSH_SUPPORT);
  17737. -- return -EINVAL;
  17738. -- }
  17739. -
  17740. - addr = sharedram_addr + BRCMF_SHARED_MAX_RXBUFPOST_OFFSET;
  17741. - shared->max_rxbufpost = brcmf_pcie_read_tcm16(devinfo, addr);
  17742. 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
  17743. deleted file mode 100644
  17744. index 8c8eebe..0000000
  17745. --- a/package/kernel/mac80211/patches/344-0004-brcmfmac-remove-dummy-cache-flush-invalidate-functio.patch
  17746. +++ /dev/null
  17747. @@ -1,120 +0,0 @@
  17748. -From: Franky Lin <frankyl@broadcom.com>
  17749. -Date: Wed, 20 May 2015 14:09:50 +0200
  17750. -Subject: [PATCH] brcmfmac: remove dummy cache flush/invalidate function
  17751. -
  17752. -brcmf_dma_flush and brcmf_dma_invalidate_cache are not necessary and
  17753. -have never been implemented.
  17754. -
  17755. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17756. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  17757. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  17758. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  17759. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17760. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17761. ----
  17762. -
  17763. ---- a/drivers/net/wireless/brcm80211/brcmfmac/commonring.c
  17764. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/commonring.c
  17765. -@@ -22,17 +22,6 @@
  17766. - #include "core.h"
  17767. - #include "commonring.h"
  17768. -
  17769. --
  17770. --/* dma flushing needs implementation for mips and arm platforms. Should
  17771. -- * be put in util. Note, this is not real flushing. It is virtual non
  17772. -- * cached memory. Only write buffers should have to be drained. Though
  17773. -- * this may be different depending on platform......
  17774. -- * SEE ALSO msgbuf.c
  17775. -- */
  17776. --#define brcmf_dma_flush(addr, len)
  17777. --#define brcmf_dma_invalidate_cache(addr, len)
  17778. --
  17779. --
  17780. - void brcmf_commonring_register_cb(struct brcmf_commonring *commonring,
  17781. - int (*cr_ring_bell)(void *ctx),
  17782. - int (*cr_update_rptr)(void *ctx),
  17783. -@@ -206,14 +195,9 @@ int brcmf_commonring_write_complete(stru
  17784. - address = commonring->buf_addr;
  17785. - address += (commonring->f_ptr * commonring->item_len);
  17786. - if (commonring->f_ptr > commonring->w_ptr) {
  17787. -- brcmf_dma_flush(address,
  17788. -- (commonring->depth - commonring->f_ptr) *
  17789. -- commonring->item_len);
  17790. - address = commonring->buf_addr;
  17791. - commonring->f_ptr = 0;
  17792. - }
  17793. -- brcmf_dma_flush(address, (commonring->w_ptr - commonring->f_ptr) *
  17794. -- commonring->item_len);
  17795. -
  17796. - commonring->f_ptr = commonring->w_ptr;
  17797. -
  17798. -@@ -258,8 +242,6 @@ void *brcmf_commonring_get_read_ptr(stru
  17799. - if (commonring->r_ptr == commonring->depth)
  17800. - commonring->r_ptr = 0;
  17801. -
  17802. -- brcmf_dma_invalidate_cache(ret_addr, *n_ items * commonring->item_len);
  17803. --
  17804. - return ret_addr;
  17805. - }
  17806. -
  17807. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  17808. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  17809. -@@ -278,16 +278,6 @@ struct brcmf_msgbuf_pktids {
  17810. - struct brcmf_msgbuf_pktid *array;
  17811. - };
  17812. -
  17813. --
  17814. --/* dma flushing needs implementation for mips and arm platforms. Should
  17815. -- * be put in util. Note, this is not real flushing. It is virtual non
  17816. -- * cached memory. Only write buffers should have to be drained. Though
  17817. -- * this may be different depending on platform......
  17818. -- */
  17819. --#define brcmf_dma_flush(addr, len)
  17820. --#define brcmf_dma_invalidate_cache(addr, len)
  17821. --
  17822. --
  17823. - static void brcmf_msgbuf_rxbuf_ioctlresp_post(struct brcmf_msgbuf *msgbuf);
  17824. -
  17825. -
  17826. -@@ -462,7 +452,6 @@ static int brcmf_msgbuf_tx_ioctl(struct
  17827. - memcpy(msgbuf->ioctbuf, buf, buf_len);
  17828. - else
  17829. - memset(msgbuf->ioctbuf, 0, buf_len);
  17830. -- brcmf_dma_flush(ioctl_buf, buf_len);
  17831. -
  17832. - err = brcmf_commonring_write_complete(commonring);
  17833. - brcmf_commonring_unlock(commonring);
  17834. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  17835. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  17836. -@@ -276,15 +276,6 @@ static const u32 brcmf_ring_itemsize[BRC
  17837. - };
  17838. -
  17839. -
  17840. --/* dma flushing needs implementation for mips and arm platforms. Should
  17841. -- * be put in util. Note, this is not real flushing. It is virtual non
  17842. -- * cached memory. Only write buffers should have to be drained. Though
  17843. -- * this may be different depending on platform......
  17844. -- */
  17845. --#define brcmf_dma_flush(addr, len)
  17846. --#define brcmf_dma_invalidate_cache(addr, len)
  17847. --
  17848. --
  17849. - static u32
  17850. - brcmf_pcie_read_reg32(struct brcmf_pciedev_info *devinfo, u32 reg_offset)
  17851. - {
  17852. -@@ -1174,7 +1165,6 @@ static int brcmf_pcie_init_scratchbuffer
  17853. - goto fail;
  17854. -
  17855. - memset(devinfo->shared.scratch, 0, BRCMF_DMA_D2H_SCRATCH_BUF_LEN);
  17856. -- brcmf_dma_flush(devinfo->shared.scratch, BRCMF_DMA_D2H_SCRATCH_BUF_LEN);
  17857. -
  17858. - addr = devinfo->shared.tcm_base_address +
  17859. - BRCMF_SHARED_DMA_SCRATCH_ADDR_OFFSET;
  17860. -@@ -1192,7 +1182,6 @@ static int brcmf_pcie_init_scratchbuffer
  17861. - goto fail;
  17862. -
  17863. - memset(devinfo->shared.ringupd, 0, BRCMF_DMA_D2H_RINGUPD_BUF_LEN);
  17864. -- brcmf_dma_flush(devinfo->shared.ringupd, BRCMF_DMA_D2H_RINGUPD_BUF_LEN);
  17865. -
  17866. - addr = devinfo->shared.tcm_base_address +
  17867. - BRCMF_SHARED_DMA_RINGUPD_ADDR_OFFSET;
  17868. 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
  17869. deleted file mode 100644
  17870. index 2f50abd..0000000
  17871. --- a/package/kernel/mac80211/patches/344-0005-brcmfmac-add-support-for-dma-indices-feature.patch
  17872. +++ /dev/null
  17873. @@ -1,270 +0,0 @@
  17874. -From: Franky Lin <frankyl@broadcom.com>
  17875. -Date: Wed, 20 May 2015 14:09:51 +0200
  17876. -Subject: [PATCH] brcmfmac: add support for dma indices feature
  17877. -
  17878. -PCIe full dongle firmware can support a dma indices feature with which
  17879. -firmware can update/fetch the read/write indices of message buffer
  17880. -rings on both host to dongle and dongle to host directions. The support is
  17881. -announced by firmware through shared flags.
  17882. -
  17883. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  17884. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17885. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  17886. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17887. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17888. ----
  17889. -
  17890. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  17891. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  17892. -@@ -115,6 +115,8 @@ enum brcmf_pcie_state {
  17893. - #define BRCMF_PCIE_MIN_SHARED_VERSION 5
  17894. - #define BRCMF_PCIE_MAX_SHARED_VERSION 5
  17895. - #define BRCMF_PCIE_SHARED_VERSION_MASK 0x00FF
  17896. -+#define BRCMF_PCIE_SHARED_DMA_INDEX 0x10000
  17897. -+#define BRCMF_PCIE_SHARED_DMA_2B_IDX 0x100000
  17898. -
  17899. - #define BRCMF_PCIE_FLAGS_HTOD_SPLIT 0x4000
  17900. - #define BRCMF_PCIE_FLAGS_DTOH_SPLIT 0x8000
  17901. -@@ -146,6 +148,10 @@ enum brcmf_pcie_state {
  17902. - #define BRCMF_SHARED_RING_H2D_R_IDX_PTR_OFFSET 8
  17903. - #define BRCMF_SHARED_RING_D2H_W_IDX_PTR_OFFSET 12
  17904. - #define BRCMF_SHARED_RING_D2H_R_IDX_PTR_OFFSET 16
  17905. -+#define BRCMF_SHARED_RING_H2D_WP_HADDR_OFFSET 20
  17906. -+#define BRCMF_SHARED_RING_H2D_RP_HADDR_OFFSET 28
  17907. -+#define BRCMF_SHARED_RING_D2H_WP_HADDR_OFFSET 36
  17908. -+#define BRCMF_SHARED_RING_D2H_RP_HADDR_OFFSET 44
  17909. - #define BRCMF_SHARED_RING_TCM_MEMLOC_OFFSET 0
  17910. - #define BRCMF_SHARED_RING_MAX_SUB_QUEUES 52
  17911. -
  17912. -@@ -247,6 +253,13 @@ struct brcmf_pciedev_info {
  17913. - bool mbdata_completed;
  17914. - bool irq_allocated;
  17915. - bool wowl_enabled;
  17916. -+ u8 dma_idx_sz;
  17917. -+ void *idxbuf;
  17918. -+ u32 idxbuf_sz;
  17919. -+ dma_addr_t idxbuf_dmahandle;
  17920. -+ u16 (*read_ptr)(struct brcmf_pciedev_info *devinfo, u32 mem_offset);
  17921. -+ void (*write_ptr)(struct brcmf_pciedev_info *devinfo, u32 mem_offset,
  17922. -+ u16 value);
  17923. - };
  17924. -
  17925. - struct brcmf_pcie_ringbuf {
  17926. -@@ -323,6 +336,25 @@ brcmf_pcie_write_tcm16(struct brcmf_pcie
  17927. - }
  17928. -
  17929. -
  17930. -+static u16
  17931. -+brcmf_pcie_read_idx(struct brcmf_pciedev_info *devinfo, u32 mem_offset)
  17932. -+{
  17933. -+ u16 *address = devinfo->idxbuf + mem_offset;
  17934. -+
  17935. -+ return (*(address));
  17936. -+}
  17937. -+
  17938. -+
  17939. -+static void
  17940. -+brcmf_pcie_write_idx(struct brcmf_pciedev_info *devinfo, u32 mem_offset,
  17941. -+ u16 value)
  17942. -+{
  17943. -+ u16 *address = devinfo->idxbuf + mem_offset;
  17944. -+
  17945. -+ *(address) = value;
  17946. -+}
  17947. -+
  17948. -+
  17949. - static u32
  17950. - brcmf_pcie_read_tcm32(struct brcmf_pciedev_info *devinfo, u32 mem_offset)
  17951. - {
  17952. -@@ -868,7 +900,7 @@ static int brcmf_pcie_ring_mb_write_rptr
  17953. - brcmf_dbg(PCIE, "W r_ptr %d (%d), ring %d\n", commonring->r_ptr,
  17954. - commonring->w_ptr, ring->id);
  17955. -
  17956. -- brcmf_pcie_write_tcm16(devinfo, ring->r_idx_addr, commonring->r_ptr);
  17957. -+ devinfo->write_ptr(devinfo, ring->r_idx_addr, commonring->r_ptr);
  17958. -
  17959. - return 0;
  17960. - }
  17961. -@@ -886,7 +918,7 @@ static int brcmf_pcie_ring_mb_write_wptr
  17962. - brcmf_dbg(PCIE, "W w_ptr %d (%d), ring %d\n", commonring->w_ptr,
  17963. - commonring->r_ptr, ring->id);
  17964. -
  17965. -- brcmf_pcie_write_tcm16(devinfo, ring->w_idx_addr, commonring->w_ptr);
  17966. -+ devinfo->write_ptr(devinfo, ring->w_idx_addr, commonring->w_ptr);
  17967. -
  17968. - return 0;
  17969. - }
  17970. -@@ -915,7 +947,7 @@ static int brcmf_pcie_ring_mb_update_rpt
  17971. - if (devinfo->state != BRCMFMAC_PCIE_STATE_UP)
  17972. - return -EIO;
  17973. -
  17974. -- commonring->r_ptr = brcmf_pcie_read_tcm16(devinfo, ring->r_idx_addr);
  17975. -+ commonring->r_ptr = devinfo->read_ptr(devinfo, ring->r_idx_addr);
  17976. -
  17977. - brcmf_dbg(PCIE, "R r_ptr %d (%d), ring %d\n", commonring->r_ptr,
  17978. - commonring->w_ptr, ring->id);
  17979. -@@ -933,7 +965,7 @@ static int brcmf_pcie_ring_mb_update_wpt
  17980. - if (devinfo->state != BRCMFMAC_PCIE_STATE_UP)
  17981. - return -EIO;
  17982. -
  17983. -- commonring->w_ptr = brcmf_pcie_read_tcm16(devinfo, ring->w_idx_addr);
  17984. -+ commonring->w_ptr = devinfo->read_ptr(devinfo, ring->w_idx_addr);
  17985. -
  17986. - brcmf_dbg(PCIE, "R w_ptr %d (%d), ring %d\n", commonring->w_ptr,
  17987. - commonring->r_ptr, ring->id);
  17988. -@@ -1038,6 +1070,13 @@ static void brcmf_pcie_release_ringbuffe
  17989. - }
  17990. - kfree(devinfo->shared.flowrings);
  17991. - devinfo->shared.flowrings = NULL;
  17992. -+ if (devinfo->idxbuf) {
  17993. -+ dma_free_coherent(&devinfo->pdev->dev,
  17994. -+ devinfo->idxbuf_sz,
  17995. -+ devinfo->idxbuf,
  17996. -+ devinfo->idxbuf_dmahandle);
  17997. -+ devinfo->idxbuf = NULL;
  17998. -+ }
  17999. - }
  18000. -
  18001. -
  18002. -@@ -1053,19 +1092,72 @@ static int brcmf_pcie_init_ringbuffers(s
  18003. - u32 addr;
  18004. - u32 ring_mem_ptr;
  18005. - u32 i;
  18006. -+ u64 address;
  18007. -+ u32 bufsz;
  18008. - u16 max_sub_queues;
  18009. -+ u8 idx_offset;
  18010. -
  18011. - ring_addr = devinfo->shared.ring_info_addr;
  18012. - brcmf_dbg(PCIE, "Base ring addr = 0x%08x\n", ring_addr);
  18013. -+ addr = ring_addr + BRCMF_SHARED_RING_MAX_SUB_QUEUES;
  18014. -+ max_sub_queues = brcmf_pcie_read_tcm16(devinfo, addr);
  18015. -
  18016. -- addr = ring_addr + BRCMF_SHARED_RING_D2H_W_IDX_PTR_OFFSET;
  18017. -- d2h_w_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  18018. -- addr = ring_addr + BRCMF_SHARED_RING_D2H_R_IDX_PTR_OFFSET;
  18019. -- d2h_r_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  18020. -- addr = ring_addr + BRCMF_SHARED_RING_H2D_W_IDX_PTR_OFFSET;
  18021. -- h2d_w_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  18022. -- addr = ring_addr + BRCMF_SHARED_RING_H2D_R_IDX_PTR_OFFSET;
  18023. -- h2d_r_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  18024. -+ if (devinfo->dma_idx_sz != 0) {
  18025. -+ bufsz = (BRCMF_NROF_D2H_COMMON_MSGRINGS + max_sub_queues) *
  18026. -+ devinfo->dma_idx_sz * 2;
  18027. -+ devinfo->idxbuf = dma_alloc_coherent(&devinfo->pdev->dev, bufsz,
  18028. -+ &devinfo->idxbuf_dmahandle,
  18029. -+ GFP_KERNEL);
  18030. -+ if (!devinfo->idxbuf)
  18031. -+ devinfo->dma_idx_sz = 0;
  18032. -+ }
  18033. -+
  18034. -+ if (devinfo->dma_idx_sz == 0) {
  18035. -+ addr = ring_addr + BRCMF_SHARED_RING_D2H_W_IDX_PTR_OFFSET;
  18036. -+ d2h_w_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  18037. -+ addr = ring_addr + BRCMF_SHARED_RING_D2H_R_IDX_PTR_OFFSET;
  18038. -+ d2h_r_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  18039. -+ addr = ring_addr + BRCMF_SHARED_RING_H2D_W_IDX_PTR_OFFSET;
  18040. -+ h2d_w_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  18041. -+ addr = ring_addr + BRCMF_SHARED_RING_H2D_R_IDX_PTR_OFFSET;
  18042. -+ h2d_r_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  18043. -+ idx_offset = sizeof(u32);
  18044. -+ devinfo->write_ptr = brcmf_pcie_write_tcm16;
  18045. -+ devinfo->read_ptr = brcmf_pcie_read_tcm16;
  18046. -+ brcmf_dbg(PCIE, "Using TCM indices\n");
  18047. -+ } else {
  18048. -+ memset(devinfo->idxbuf, 0, bufsz);
  18049. -+ devinfo->idxbuf_sz = bufsz;
  18050. -+ idx_offset = devinfo->dma_idx_sz;
  18051. -+ devinfo->write_ptr = brcmf_pcie_write_idx;
  18052. -+ devinfo->read_ptr = brcmf_pcie_read_idx;
  18053. -+
  18054. -+ h2d_w_idx_ptr = 0;
  18055. -+ addr = ring_addr + BRCMF_SHARED_RING_H2D_WP_HADDR_OFFSET;
  18056. -+ address = (u64)devinfo->idxbuf_dmahandle;
  18057. -+ brcmf_pcie_write_tcm32(devinfo, addr, address & 0xffffffff);
  18058. -+ brcmf_pcie_write_tcm32(devinfo, addr + 4, address >> 32);
  18059. -+
  18060. -+ h2d_r_idx_ptr = h2d_w_idx_ptr + max_sub_queues * idx_offset;
  18061. -+ addr = ring_addr + BRCMF_SHARED_RING_H2D_RP_HADDR_OFFSET;
  18062. -+ address += max_sub_queues * idx_offset;
  18063. -+ brcmf_pcie_write_tcm32(devinfo, addr, address & 0xffffffff);
  18064. -+ brcmf_pcie_write_tcm32(devinfo, addr + 4, address >> 32);
  18065. -+
  18066. -+ d2h_w_idx_ptr = h2d_r_idx_ptr + max_sub_queues * idx_offset;
  18067. -+ addr = ring_addr + BRCMF_SHARED_RING_D2H_WP_HADDR_OFFSET;
  18068. -+ address += max_sub_queues * idx_offset;
  18069. -+ brcmf_pcie_write_tcm32(devinfo, addr, address & 0xffffffff);
  18070. -+ brcmf_pcie_write_tcm32(devinfo, addr + 4, address >> 32);
  18071. -+
  18072. -+ d2h_r_idx_ptr = d2h_w_idx_ptr +
  18073. -+ BRCMF_NROF_D2H_COMMON_MSGRINGS * idx_offset;
  18074. -+ addr = ring_addr + BRCMF_SHARED_RING_D2H_RP_HADDR_OFFSET;
  18075. -+ address += BRCMF_NROF_D2H_COMMON_MSGRINGS * idx_offset;
  18076. -+ brcmf_pcie_write_tcm32(devinfo, addr, address & 0xffffffff);
  18077. -+ brcmf_pcie_write_tcm32(devinfo, addr + 4, address >> 32);
  18078. -+ brcmf_dbg(PCIE, "Using host memory indices\n");
  18079. -+ }
  18080. -
  18081. - addr = ring_addr + BRCMF_SHARED_RING_TCM_MEMLOC_OFFSET;
  18082. - ring_mem_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  18083. -@@ -1079,8 +1171,8 @@ static int brcmf_pcie_init_ringbuffers(s
  18084. - ring->id = i;
  18085. - devinfo->shared.commonrings[i] = ring;
  18086. -
  18087. -- h2d_w_idx_ptr += sizeof(u32);
  18088. -- h2d_r_idx_ptr += sizeof(u32);
  18089. -+ h2d_w_idx_ptr += idx_offset;
  18090. -+ h2d_r_idx_ptr += idx_offset;
  18091. - ring_mem_ptr += BRCMF_RING_MEM_SZ;
  18092. - }
  18093. -
  18094. -@@ -1094,13 +1186,11 @@ static int brcmf_pcie_init_ringbuffers(s
  18095. - ring->id = i;
  18096. - devinfo->shared.commonrings[i] = ring;
  18097. -
  18098. -- d2h_w_idx_ptr += sizeof(u32);
  18099. -- d2h_r_idx_ptr += sizeof(u32);
  18100. -+ d2h_w_idx_ptr += idx_offset;
  18101. -+ d2h_r_idx_ptr += idx_offset;
  18102. - ring_mem_ptr += BRCMF_RING_MEM_SZ;
  18103. - }
  18104. -
  18105. -- addr = ring_addr + BRCMF_SHARED_RING_MAX_SUB_QUEUES;
  18106. -- max_sub_queues = brcmf_pcie_read_tcm16(devinfo, addr);
  18107. - devinfo->shared.nrof_flowrings =
  18108. - max_sub_queues - BRCMF_NROF_H2D_COMMON_MSGRINGS;
  18109. - rings = kcalloc(devinfo->shared.nrof_flowrings, sizeof(*ring),
  18110. -@@ -1124,15 +1214,15 @@ static int brcmf_pcie_init_ringbuffers(s
  18111. - ring);
  18112. - ring->w_idx_addr = h2d_w_idx_ptr;
  18113. - ring->r_idx_addr = h2d_r_idx_ptr;
  18114. -- h2d_w_idx_ptr += sizeof(u32);
  18115. -- h2d_r_idx_ptr += sizeof(u32);
  18116. -+ h2d_w_idx_ptr += idx_offset;
  18117. -+ h2d_r_idx_ptr += idx_offset;
  18118. - }
  18119. - devinfo->shared.flowrings = rings;
  18120. -
  18121. - return 0;
  18122. -
  18123. - fail:
  18124. -- brcmf_err("Allocating commonring buffers failed\n");
  18125. -+ brcmf_err("Allocating ring buffers failed\n");
  18126. - brcmf_pcie_release_ringbuffers(devinfo);
  18127. - return -ENOMEM;
  18128. - }
  18129. -@@ -1269,6 +1359,14 @@ brcmf_pcie_init_share_ram_info(struct br
  18130. - return -EINVAL;
  18131. - }
  18132. -
  18133. -+ /* check firmware support dma indicies */
  18134. -+ if (shared->flags & BRCMF_PCIE_SHARED_DMA_INDEX) {
  18135. -+ if (shared->flags & BRCMF_PCIE_SHARED_DMA_2B_IDX)
  18136. -+ devinfo->dma_idx_sz = sizeof(u16);
  18137. -+ else
  18138. -+ devinfo->dma_idx_sz = sizeof(u32);
  18139. -+ }
  18140. -+
  18141. - addr = sharedram_addr + BRCMF_SHARED_MAX_RXBUFPOST_OFFSET;
  18142. - shared->max_rxbufpost = brcmf_pcie_read_tcm16(devinfo, addr);
  18143. - if (shared->max_rxbufpost == 0)
  18144. 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
  18145. deleted file mode 100644
  18146. index 28408d2..0000000
  18147. --- a/package/kernel/mac80211/patches/345-brcmfmac-avoid-null-pointer-access-when-brcmf_msgbuf.patch
  18148. +++ /dev/null
  18149. @@ -1,102 +0,0 @@
  18150. -From: Arend van Spriel <arend@broadcom.com>
  18151. -Date: Tue, 26 May 2015 13:19:46 +0200
  18152. -Subject: [PATCH] brcmfmac: avoid null pointer access when
  18153. - brcmf_msgbuf_get_pktid() fails
  18154. -
  18155. -The function brcmf_msgbuf_get_pktid() may return a NULL pointer so
  18156. -the callers should check the return pointer before accessing it to
  18157. -avoid the crash below (see [1]):
  18158. -
  18159. -brcmfmac: brcmf_msgbuf_get_pktid: Invalid packet id 273 (not in use)
  18160. -BUG: unable to handle kernel NULL pointer dereference at 0000000000000080
  18161. -IP: [<ffffffff8145b225>] skb_pull+0x5/0x50
  18162. -PGD 0
  18163. -Oops: 0000 [#1] PREEMPT SMP
  18164. -Modules linked in: pci_stub vboxpci(O) vboxnetflt(O) vboxnetadp(O) vboxdrv(O)
  18165. - snd_hda_codec_hdmi bnep mousedev hid_generic ushwmon msr ext4 crc16 mbcache
  18166. - jbd2 sd_mod uas usb_storage ahci libahci libata scsi_mod xhci_pci xhci_hcd
  18167. - usbcore usb_common
  18168. -CPU: 0 PID: 1661 Comm: irq/61-brcmf_pc Tainted: G O 4.0.1-MacbookPro-ARCH #1
  18169. -Hardware name: Apple Inc. MacBookPro12,1/Mac-E43C1C25D4880AD6,
  18170. - BIOS MBP121.88Z.0167.B02.1503241251 03/24/2015
  18171. -task: ffff880264203cc0 ti: ffff88025ffe4000 task.ti: ffff88025ffe4000
  18172. -RIP: 0010:[<ffffffff8145b225>] [<ffffffff8145b225>] skb_pull+0x5/0x50
  18173. -RSP: 0018:ffff88025ffe7d40 EFLAGS: 00010202
  18174. -RAX: 0000000000000000 RBX: ffff88008a33c000 RCX: 0000000000000044
  18175. -RDX: 0000000000000000 RSI: 000000000000004a RDI: 0000000000000000
  18176. -RBP: ffff88025ffe7da8 R08: 0000000000000096 R09: 000000000000004a
  18177. -R10: 0000000000000000 R11: 000000000000048e R12: ffff88025ff14f00
  18178. -R13: 0000000000000000 R14: ffff880263b48200 R15: ffff88008a33c000
  18179. -FS: 0000000000000000(0000) GS:ffff88026ec00000(0000) knlGS:0000000000000000
  18180. -CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  18181. -CR2: 0000000000000080 CR3: 000000000180b000 CR4: 00000000003407f0
  18182. -Stack:
  18183. - ffffffffa06aed74 ffff88025ffe7dc8 ffff880263b48270 ffff880263b48278
  18184. - 05ea88020000004a 0002ffff81014635 000000001720b2f6 ffff88026ec116c0
  18185. - ffff880263b48200 0000000000010000 ffff880263b4ae00 ffff880264203cc0
  18186. -Call Trace:
  18187. - [<ffffffffa06aed74>] ? brcmf_msgbuf_process_rx+0x404/0x480 [brcmfmac]
  18188. - [<ffffffff810cea60>] ? irq_finalize_oneshot.part.30+0xf0/0xf0
  18189. - [<ffffffffa06afb55>] brcmf_proto_msgbuf_rx_trigger+0x35/0xf0 [brcmfmac]
  18190. - [<ffffffffa06baf2a>] brcmf_pcie_isr_thread_v2+0x8a/0x130 [brcmfmac]
  18191. - [<ffffffff810cea80>] irq_thread_fn+0x20/0x50
  18192. - [<ffffffff810ceddf>] irq_thread+0x13f/0x170
  18193. - [<ffffffff810cebf0>] ? wake_threads_waitq+0x30/0x30
  18194. - [<ffffffff810ceca0>] ? irq_thread_dtor+0xb0/0xb0
  18195. - [<ffffffff81092a08>] kthread+0xd8/0xf0
  18196. - [<ffffffff81092930>] ? kthread_create_on_node+0x1c0/0x1c0
  18197. - [<ffffffff8156d898>] ret_from_fork+0x58/0x90
  18198. - [<ffffffff81092930>] ? kthread_create_on_node+0x1c0/0x1c0
  18199. -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
  18200. - f7 88 50 01 c3 66 0f 1f 84 00 00 00 00 00 0f 1f
  18201. -RIP [<ffffffff8145b225>] skb_pull+0x5/0x50
  18202. - RSP <ffff88025ffe7d40>
  18203. -CR2: 0000000000000080
  18204. ----[ end trace b074c0f90e7c997d ]---
  18205. -
  18206. -[1] http://mid.gmane.org/20150430193259.GA5630@googlemail.com
  18207. -
  18208. -Cc: <stable@vger.kernel.org> # v3.18, v3.19, v4.0, v4.1
  18209. -Reported-by: Michael Hornung <mhornung.linux@gmail.com>
  18210. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  18211. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  18212. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  18213. ----
  18214. -
  18215. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  18216. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  18217. -@@ -500,11 +500,9 @@ static int brcmf_msgbuf_query_dcmd(struc
  18218. - msgbuf->rx_pktids,
  18219. - msgbuf->ioctl_resp_pktid);
  18220. - if (msgbuf->ioctl_resp_ret_len != 0) {
  18221. -- if (!skb) {
  18222. -- brcmf_err("Invalid packet id idx recv'd %d\n",
  18223. -- msgbuf->ioctl_resp_pktid);
  18224. -+ if (!skb)
  18225. - return -EBADF;
  18226. -- }
  18227. -+
  18228. - memcpy(buf, skb->data, (len < msgbuf->ioctl_resp_ret_len) ?
  18229. - len : msgbuf->ioctl_resp_ret_len);
  18230. - }
  18231. -@@ -866,10 +864,8 @@ brcmf_msgbuf_process_txstatus(struct brc
  18232. - flowid -= BRCMF_NROF_H2D_COMMON_MSGRINGS;
  18233. - skb = brcmf_msgbuf_get_pktid(msgbuf->drvr->bus_if->dev,
  18234. - msgbuf->tx_pktids, idx);
  18235. -- if (!skb) {
  18236. -- brcmf_err("Invalid packet id idx recv'd %d\n", idx);
  18237. -+ if (!skb)
  18238. - return;
  18239. -- }
  18240. -
  18241. - set_bit(flowid, msgbuf->txstatus_done_map);
  18242. - commonring = msgbuf->flowrings[flowid];
  18243. -@@ -1148,6 +1144,8 @@ brcmf_msgbuf_process_rx_complete(struct
  18244. -
  18245. - skb = brcmf_msgbuf_get_pktid(msgbuf->drvr->bus_if->dev,
  18246. - msgbuf->rx_pktids, idx);
  18247. -+ if (!skb)
  18248. -+ return;
  18249. -
  18250. - if (data_offset)
  18251. - skb_pull(skb, data_offset);
  18252. 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
  18253. deleted file mode 100644
  18254. index f023034..0000000
  18255. --- a/package/kernel/mac80211/patches/346-brcmfmac-fix-invalid-access-to-struct-acpi_device-fi.patch
  18256. +++ /dev/null
  18257. @@ -1,63 +0,0 @@
  18258. -From: Arend van Spriel <arend@broadcom.com>
  18259. -Date: Wed, 27 May 2015 19:31:41 +0200
  18260. -Subject: [PATCH] brcmfmac: fix invalid access to struct acpi_device fields
  18261. -
  18262. -The fields of struct acpi_device are only known when CONFIG_ACPI is
  18263. -defined. Fix this by using a helper function. This will resolve the
  18264. -issue found in linux-next:
  18265. -
  18266. - ../brcmfmac/bcmsdh.c: In function 'brcmf_ops_sdio_probe':
  18267. - ../brcmfmac/bcmsdh.c:1139:7: error: dereferencing pointer to incomplete type
  18268. - adev->flags.power_manageable = 0;
  18269. - ^
  18270. -
  18271. -Fixes: f0992ace680c ("brcmfmac: prohibit ACPI power management ...")
  18272. -Cc: Fu, Zhonghui <zhonghui.fu@linux.intel.com>
  18273. -Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
  18274. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  18275. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18276. ----
  18277. -
  18278. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  18279. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  18280. -@@ -1117,6 +1117,18 @@ MODULE_DEVICE_TABLE(sdio, brcmf_sdmmc_id
  18281. - static struct brcmfmac_sdio_platform_data *brcmfmac_sdio_pdata;
  18282. -
  18283. -
  18284. -+static void brcmf_sdiod_acpi_set_power_manageable(struct device *dev,
  18285. -+ int val)
  18286. -+{
  18287. -+#if IS_ENABLED(CONFIG_ACPI)
  18288. -+ struct acpi_device *adev;
  18289. -+
  18290. -+ adev = ACPI_COMPANION(dev);
  18291. -+ if (adev)
  18292. -+ adev->flags.power_manageable = 0;
  18293. -+#endif
  18294. -+}
  18295. -+
  18296. - static int brcmf_ops_sdio_probe(struct sdio_func *func,
  18297. - const struct sdio_device_id *id)
  18298. - {
  18299. -@@ -1124,7 +1136,6 @@ static int brcmf_ops_sdio_probe(struct s
  18300. - struct brcmf_sdio_dev *sdiodev;
  18301. - struct brcmf_bus *bus_if;
  18302. - struct device *dev;
  18303. -- struct acpi_device *adev;
  18304. -
  18305. - brcmf_dbg(SDIO, "Enter\n");
  18306. - brcmf_dbg(SDIO, "Class=%x\n", func->class);
  18307. -@@ -1132,11 +1143,9 @@ static int brcmf_ops_sdio_probe(struct s
  18308. - brcmf_dbg(SDIO, "sdio device ID: 0x%04x\n", func->device);
  18309. - brcmf_dbg(SDIO, "Function#: %d\n", func->num);
  18310. -
  18311. -- /* prohibit ACPI power management for this device */
  18312. - dev = &func->dev;
  18313. -- adev = ACPI_COMPANION(dev);
  18314. -- if (adev)
  18315. -- adev->flags.power_manageable = 0;
  18316. -+ /* prohibit ACPI power management for this device */
  18317. -+ brcmf_sdiod_acpi_set_power_manageable(dev, 0);
  18318. -
  18319. - /* Consume func num 1 but dont do anything with it. */
  18320. - if (func->num == 1)
  18321. 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
  18322. deleted file mode 100644
  18323. index 2bfd44f..0000000
  18324. --- a/package/kernel/mac80211/patches/347-brcmfmac-simplify-check-stripping-v2-NVRAM.patch
  18325. +++ /dev/null
  18326. @@ -1,56 +0,0 @@
  18327. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  18328. -Date: Wed, 20 May 2015 09:34:21 +0200
  18329. -Subject: [PATCH] brcmfmac: simplify check stripping v2 NVRAM
  18330. -MIME-Version: 1.0
  18331. -Content-Type: text/plain; charset=UTF-8
  18332. -Content-Transfer-Encoding: 8bit
  18333. -
  18334. -Comparing NVRAM entry with a full filtering string is simpler than
  18335. -comparing it with a short prefix and then checking random chars at magic
  18336. -offsets. The cost of snprintf relatively low, we execute it just once.
  18337. -Tested on BCM43602 with NVRAM hacked to use V2 format.
  18338. -
  18339. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  18340. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18341. ----
  18342. -
  18343. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  18344. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  18345. -@@ -25,7 +25,7 @@
  18346. -
  18347. - #define BRCMF_FW_MAX_NVRAM_SIZE 64000
  18348. - #define BRCMF_FW_NVRAM_DEVPATH_LEN 19 /* devpath0=pcie/1/4/ */
  18349. --#define BRCMF_FW_NVRAM_PCIEDEV_LEN 9 /* pcie/1/4/ */
  18350. -+#define BRCMF_FW_NVRAM_PCIEDEV_LEN 10 /* pcie/1/4/ + \0 */
  18351. -
  18352. - char brcmf_firmware_path[BRCMF_FW_PATH_LEN];
  18353. - module_param_string(firmware_path, brcmf_firmware_path,
  18354. -@@ -297,6 +297,8 @@ fail:
  18355. - static void brcmf_fw_strip_multi_v2(struct nvram_parser *nvp, u16 domain_nr,
  18356. - u16 bus_nr)
  18357. - {
  18358. -+ char prefix[BRCMF_FW_NVRAM_PCIEDEV_LEN];
  18359. -+ size_t len;
  18360. - u32 i, j;
  18361. - u8 *nvram;
  18362. -
  18363. -@@ -308,14 +310,13 @@ static void brcmf_fw_strip_multi_v2(stru
  18364. - * Valid entries are of type pcie/X/Y/ where X = domain_nr and
  18365. - * Y = bus_nr.
  18366. - */
  18367. -+ snprintf(prefix, sizeof(prefix), "pcie/%d/%d/", domain_nr, bus_nr);
  18368. -+ len = strlen(prefix);
  18369. - i = 0;
  18370. - j = 0;
  18371. -- while (i < nvp->nvram_len - BRCMF_FW_NVRAM_PCIEDEV_LEN) {
  18372. -- if ((strncmp(&nvp->nvram[i], "pcie/", 5) == 0) &&
  18373. -- (nvp->nvram[i + 6] == '/') && (nvp->nvram[i + 8] == '/') &&
  18374. -- ((nvp->nvram[i + 5] - '0') == domain_nr) &&
  18375. -- ((nvp->nvram[i + 7] - '0') == bus_nr)) {
  18376. -- i += BRCMF_FW_NVRAM_PCIEDEV_LEN;
  18377. -+ while (i < nvp->nvram_len - len) {
  18378. -+ if (strncmp(&nvp->nvram[i], prefix, len) == 0) {
  18379. -+ i += len;
  18380. - while (nvp->nvram[i] != 0) {
  18381. - nvram[j] = nvp->nvram[i];
  18382. - i++;
  18383. 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
  18384. deleted file mode 100644
  18385. index 0e65114..0000000
  18386. --- a/package/kernel/mac80211/patches/348-brcmfmac-simplify-check-finding-NVRAM-v1-device-path.patch
  18387. +++ /dev/null
  18388. @@ -1,57 +0,0 @@
  18389. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  18390. -Date: Wed, 20 May 2015 11:01:08 +0200
  18391. -Subject: [PATCH] brcmfmac: simplify check finding NVRAM v1 device path
  18392. -MIME-Version: 1.0
  18393. -Content-Type: text/plain; charset=UTF-8
  18394. -Content-Transfer-Encoding: 8bit
  18395. -
  18396. -With a simple use of snprintf and small buffer we can compare NVRAM
  18397. -entry value with a full string. This way we avoid checking random chars
  18398. -at magic offsets.
  18399. -Tested on BCM43602 with NVRAM hacked to use v1 format.
  18400. -
  18401. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  18402. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18403. ----
  18404. -
  18405. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  18406. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  18407. -@@ -222,6 +222,10 @@ static int brcmf_init_nvram_parser(struc
  18408. - static void brcmf_fw_strip_multi_v1(struct nvram_parser *nvp, u16 domain_nr,
  18409. - u16 bus_nr)
  18410. - {
  18411. -+ /* Device path with a leading '=' key-value separator */
  18412. -+ char pcie_path[] = "=pcie/?/?";
  18413. -+ size_t pcie_len;
  18414. -+
  18415. - u32 i, j;
  18416. - bool found;
  18417. - u8 *nvram;
  18418. -@@ -238,6 +242,9 @@ static void brcmf_fw_strip_multi_v1(stru
  18419. - /* First search for the devpathX and see if it is the configuration
  18420. - * for domain_nr/bus_nr. Search complete nvp
  18421. - */
  18422. -+ snprintf(pcie_path, sizeof(pcie_path), "=pcie/%d/%d", domain_nr,
  18423. -+ bus_nr);
  18424. -+ pcie_len = strlen(pcie_path);
  18425. - found = false;
  18426. - i = 0;
  18427. - while (i < nvp->nvram_len - BRCMF_FW_NVRAM_DEVPATH_LEN) {
  18428. -@@ -245,13 +252,10 @@ static void brcmf_fw_strip_multi_v1(stru
  18429. - * Y = domain_nr, Z = bus_nr, X = virtual ID
  18430. - */
  18431. - if ((strncmp(&nvp->nvram[i], "devpath", 7) == 0) &&
  18432. -- (strncmp(&nvp->nvram[i + 8], "=pcie/", 6) == 0)) {
  18433. -- if (((nvp->nvram[i + 14] - '0') == domain_nr) &&
  18434. -- ((nvp->nvram[i + 16] - '0') == bus_nr)) {
  18435. -- id = nvp->nvram[i + 7] - '0';
  18436. -- found = true;
  18437. -- break;
  18438. -- }
  18439. -+ (strncmp(&nvp->nvram[i + 8], pcie_path, pcie_len) == 0)) {
  18440. -+ id = nvp->nvram[i + 7] - '0';
  18441. -+ found = true;
  18442. -+ break;
  18443. - }
  18444. - while (nvp->nvram[i] != 0)
  18445. - i++;
  18446. 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
  18447. deleted file mode 100644
  18448. index dc174e5..0000000
  18449. --- a/package/kernel/mac80211/patches/349-brcmfmac-treat-0-as-end-of-comment-when-parsing-NVRA.patch
  18450. +++ /dev/null
  18451. @@ -1,45 +0,0 @@
  18452. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  18453. -Date: Wed, 20 May 2015 13:59:54 +0200
  18454. -Subject: [PATCH] brcmfmac: treat \0 as end of comment when parsing NVRAM
  18455. -MIME-Version: 1.0
  18456. -Content-Type: text/plain; charset=UTF-8
  18457. -Content-Transfer-Encoding: 8bit
  18458. -
  18459. -This fixes brcmfmac dealing with NVRAM coming from platform e.g. from a
  18460. -flash MTD partition. In such cases entries are separated by \0 instead
  18461. -of \n which caused ignoring whole content after the first "comment".
  18462. -While platform NVRAM doesn't usually contain comments, we switch to
  18463. -COMMENT state after e.g. finding an unexpected char in key name.
  18464. -
  18465. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  18466. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18467. ----
  18468. -
  18469. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  18470. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  18471. -@@ -162,17 +162,20 @@ brcmf_nvram_handle_value(struct nvram_pa
  18472. - static enum nvram_parser_state
  18473. - brcmf_nvram_handle_comment(struct nvram_parser *nvp)
  18474. - {
  18475. -- char *eol, *sol;
  18476. -+ char *eoc, *sol;
  18477. -
  18478. - sol = (char *)&nvp->fwnv->data[nvp->pos];
  18479. -- eol = strchr(sol, '\n');
  18480. -- if (eol == NULL)
  18481. -- return END;
  18482. -+ eoc = strchr(sol, '\n');
  18483. -+ if (!eoc) {
  18484. -+ eoc = strchr(sol, '\0');
  18485. -+ if (!eoc)
  18486. -+ return END;
  18487. -+ }
  18488. -
  18489. - /* eat all moving to next line */
  18490. - nvp->line++;
  18491. - nvp->column = 1;
  18492. -- nvp->pos += (eol - sol) + 1;
  18493. -+ nvp->pos += (eoc - sol) + 1;
  18494. - return IDLE;
  18495. - }
  18496. -
  18497. 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
  18498. deleted file mode 100644
  18499. index 5700142..0000000
  18500. --- a/package/kernel/mac80211/patches/350-brcmfmac-allow-NVRAM-values-to-contain-spaces.patch
  18501. +++ /dev/null
  18502. @@ -1,50 +0,0 @@
  18503. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  18504. -Date: Sat, 23 May 2015 09:15:33 +0200
  18505. -Subject: [PATCH] brcmfmac: allow NVRAM values to contain spaces
  18506. -MIME-Version: 1.0
  18507. -Content-Type: text/plain; charset=UTF-8
  18508. -Content-Transfer-Encoding: 8bit
  18509. -
  18510. -Platform NVRAMs often contain values with spaces. Even if right now most
  18511. -firmware-supported entries are simple values, we shouldn't reject these
  18512. -with spaces. It was semi-confirmed by Broadcom in the early patch adding
  18513. -support for platform NVRAMs.
  18514. -
  18515. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  18516. -Acked-by: Arend van Spriel <arend@broadcom.com>
  18517. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18518. ----
  18519. -
  18520. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  18521. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  18522. -@@ -66,6 +66,12 @@ struct nvram_parser {
  18523. - bool multi_dev_v2;
  18524. - };
  18525. -
  18526. -+/**
  18527. -+ * is_nvram_char() - check if char is a valid one for NVRAM entry
  18528. -+ *
  18529. -+ * It accepts all printable ASCII chars except for '#' which opens a comment.
  18530. -+ * Please note that ' ' (space) while accepted is not a valid key name char.
  18531. -+ */
  18532. - static bool is_nvram_char(char c)
  18533. - {
  18534. - /* comment marker excluded */
  18535. -@@ -73,7 +79,7 @@ static bool is_nvram_char(char c)
  18536. - return false;
  18537. -
  18538. - /* key and value may have any other readable character */
  18539. -- return (c > 0x20 && c < 0x7f);
  18540. -+ return (c >= 0x20 && c < 0x7f);
  18541. - }
  18542. -
  18543. - static bool is_whitespace(char c)
  18544. -@@ -120,7 +126,7 @@ static enum nvram_parser_state brcmf_nvr
  18545. - nvp->multi_dev_v1 = true;
  18546. - if (strncmp(&nvp->fwnv->data[nvp->entry], "pcie/", 5) == 0)
  18547. - nvp->multi_dev_v2 = true;
  18548. -- } else if (!is_nvram_char(c)) {
  18549. -+ } else if (!is_nvram_char(c) || c == ' ') {
  18550. - brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n",
  18551. - nvp->line, nvp->column);
  18552. - return COMMENT;
  18553. 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
  18554. deleted file mode 100644
  18555. index 814b0d7..0000000
  18556. --- a/package/kernel/mac80211/patches/351-ath9k-fix-DMA-stop-sequence-for-AR9003.patch
  18557. +++ /dev/null
  18558. @@ -1,33 +0,0 @@
  18559. -From: Felix Fietkau <nbd@openwrt.org>
  18560. -Date: Tue, 2 Jun 2015 10:35:46 +0200
  18561. -Subject: [PATCH] ath9k: fix DMA stop sequence for AR9003+
  18562. -
  18563. -AR93xx and newer needs to stop rx before tx to avoid getting the DMA
  18564. -engine or MAC into a stuck state.
  18565. -This should reduce/fix the occurence of "Failed to stop Tx DMA" logspam.
  18566. -
  18567. -Cc: stable@vger.kernel.org
  18568. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  18569. ----
  18570. -
  18571. ---- a/drivers/net/wireless/ath/ath9k/main.c
  18572. -+++ b/drivers/net/wireless/ath/ath9k/main.c
  18573. -@@ -216,11 +216,13 @@ static bool ath_prepare_reset(struct ath
  18574. - ath_stop_ani(sc);
  18575. - ath9k_hw_disable_interrupts(ah);
  18576. -
  18577. -- if (!ath_drain_all_txq(sc))
  18578. -- ret = false;
  18579. --
  18580. -- if (!ath_stoprecv(sc))
  18581. -- ret = false;
  18582. -+ if (AR_SREV_9300_20_OR_LATER(ah)) {
  18583. -+ ret &= ath_stoprecv(sc);
  18584. -+ ret &= ath_drain_all_txq(sc);
  18585. -+ } else {
  18586. -+ ret &= ath_drain_all_txq(sc);
  18587. -+ ret &= ath_stoprecv(sc);
  18588. -+ }
  18589. -
  18590. - return ret;
  18591. - }
  18592. 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
  18593. deleted file mode 100644
  18594. index 7bbd57e..0000000
  18595. --- a/package/kernel/mac80211/patches/352-brcmfmac-support-NVRAMs-containing-pci-devpaths-inst.patch
  18596. +++ /dev/null
  18597. @@ -1,56 +0,0 @@
  18598. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  18599. -Date: Thu, 28 May 2015 14:19:21 +0200
  18600. -Subject: [PATCH] brcmfmac: support NVRAMs containing pci devpaths (instead of
  18601. - pcie)
  18602. -MIME-Version: 1.0
  18603. -Content-Type: text/plain; charset=UTF-8
  18604. -Content-Transfer-Encoding: 8bit
  18605. -
  18606. -Recently Broadcom added support for NVRAMs with entries for multiple
  18607. -PCIe devices. One of the supported formats is based on prefixes defined
  18608. -like: devpath0=pcie/1/4/ and entries like 0:foo=bar 0:baz=qux etc.
  18609. -
  18610. -Unfortunately there are also a bit older devices using different way of
  18611. -defining prefixes, e.g. SmartRG SR400ac (2 x BCM43602) with entries:
  18612. -devpath0=pci/1/1/
  18613. -devpath1=pci/2/1
  18614. -Broadcom stated this old format will never be used/supported by brcmfmac
  18615. -but given the simplicity of this patch I'll insist on supporting it.
  18616. -
  18617. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  18618. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18619. ----
  18620. -
  18621. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  18622. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  18623. -@@ -232,6 +232,8 @@ static void brcmf_fw_strip_multi_v1(stru
  18624. - u16 bus_nr)
  18625. - {
  18626. - /* Device path with a leading '=' key-value separator */
  18627. -+ char pci_path[] = "=pci/?/?";
  18628. -+ size_t pci_len;
  18629. - char pcie_path[] = "=pcie/?/?";
  18630. - size_t pcie_len;
  18631. -
  18632. -@@ -251,6 +253,9 @@ static void brcmf_fw_strip_multi_v1(stru
  18633. - /* First search for the devpathX and see if it is the configuration
  18634. - * for domain_nr/bus_nr. Search complete nvp
  18635. - */
  18636. -+ snprintf(pci_path, sizeof(pci_path), "=pci/%d/%d", domain_nr,
  18637. -+ bus_nr);
  18638. -+ pci_len = strlen(pci_path);
  18639. - snprintf(pcie_path, sizeof(pcie_path), "=pcie/%d/%d", domain_nr,
  18640. - bus_nr);
  18641. - pcie_len = strlen(pcie_path);
  18642. -@@ -260,8 +265,9 @@ static void brcmf_fw_strip_multi_v1(stru
  18643. - /* Format: devpathX=pcie/Y/Z/
  18644. - * Y = domain_nr, Z = bus_nr, X = virtual ID
  18645. - */
  18646. -- if ((strncmp(&nvp->nvram[i], "devpath", 7) == 0) &&
  18647. -- (strncmp(&nvp->nvram[i + 8], pcie_path, pcie_len) == 0)) {
  18648. -+ if (strncmp(&nvp->nvram[i], "devpath", 7) == 0 &&
  18649. -+ (!strncmp(&nvp->nvram[i + 8], pci_path, pci_len) ||
  18650. -+ !strncmp(&nvp->nvram[i + 8], pcie_path, pcie_len))) {
  18651. - id = nvp->nvram[i + 7] - '0';
  18652. - found = true;
  18653. - break;
  18654. 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
  18655. deleted file mode 100644
  18656. index 1eff6ed..0000000
  18657. --- a/package/kernel/mac80211/patches/353-brcmfmac-set-wiphy-perm_addr-to-hardware-MAC-address.patch
  18658. +++ /dev/null
  18659. @@ -1,23 +0,0 @@
  18660. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  18661. -Date: Sun, 31 May 2015 02:52:26 +0200
  18662. -Subject: [PATCH] brcmfmac: set wiphy perm_addr to hardware MAC address
  18663. -MIME-Version: 1.0
  18664. -Content-Type: text/plain; charset=UTF-8
  18665. -Content-Transfer-Encoding: 8bit
  18666. -
  18667. -This allows e.g. user space to use /sys/class/ieee80211/*/macaddress
  18668. -
  18669. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  18670. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18671. ----
  18672. -
  18673. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  18674. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  18675. -@@ -6070,6 +6070,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  18676. - brcmf_err("Could not allocate wiphy device\n");
  18677. - return NULL;
  18678. - }
  18679. -+ memcpy(wiphy->perm_addr, drvr->mac, ETH_ALEN);
  18680. - set_wiphy_dev(wiphy, busdev);
  18681. -
  18682. - cfg = wiphy_priv(wiphy);
  18683. 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
  18684. deleted file mode 100644
  18685. index c6e83dd..0000000
  18686. --- a/package/kernel/mac80211/patches/354-brcmfmac-use-direct-data-pointer-in-NVRAM-parser-str.patch
  18687. +++ /dev/null
  18688. @@ -1,144 +0,0 @@
  18689. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  18690. -Date: Thu, 4 Jun 2015 22:11:07 +0200
  18691. -Subject: [PATCH] brcmfmac: use direct data pointer in NVRAM parser struct
  18692. -MIME-Version: 1.0
  18693. -Content-Type: text/plain; charset=UTF-8
  18694. -Content-Transfer-Encoding: 8bit
  18695. -
  18696. -As we plan to add support for platform NVRAM we should store direct
  18697. -data pointer without the extra struct firmware layer. This will allow
  18698. -us to support other sources with the only requirement being u8 buffer.
  18699. -
  18700. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  18701. -Acked-by: Arend van Spriel <arend@broadcom.com>
  18702. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18703. ----
  18704. -
  18705. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  18706. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  18707. -@@ -43,7 +43,7 @@ enum nvram_parser_state {
  18708. - * struct nvram_parser - internal info for parser.
  18709. - *
  18710. - * @state: current parser state.
  18711. -- * @fwnv: input buffer being parsed.
  18712. -+ * @data: input buffer being parsed.
  18713. - * @nvram: output buffer with parse result.
  18714. - * @nvram_len: lenght of parse result.
  18715. - * @line: current line.
  18716. -@@ -55,7 +55,7 @@ enum nvram_parser_state {
  18717. - */
  18718. - struct nvram_parser {
  18719. - enum nvram_parser_state state;
  18720. -- const struct firmware *fwnv;
  18721. -+ const u8 *data;
  18722. - u8 *nvram;
  18723. - u32 nvram_len;
  18724. - u32 line;
  18725. -@@ -91,7 +91,7 @@ static enum nvram_parser_state brcmf_nvr
  18726. - {
  18727. - char c;
  18728. -
  18729. -- c = nvp->fwnv->data[nvp->pos];
  18730. -+ c = nvp->data[nvp->pos];
  18731. - if (c == '\n')
  18732. - return COMMENT;
  18733. - if (is_whitespace(c))
  18734. -@@ -115,16 +115,16 @@ static enum nvram_parser_state brcmf_nvr
  18735. - enum nvram_parser_state st = nvp->state;
  18736. - char c;
  18737. -
  18738. -- c = nvp->fwnv->data[nvp->pos];
  18739. -+ c = nvp->data[nvp->pos];
  18740. - if (c == '=') {
  18741. - /* ignore RAW1 by treating as comment */
  18742. -- if (strncmp(&nvp->fwnv->data[nvp->entry], "RAW1", 4) == 0)
  18743. -+ if (strncmp(&nvp->data[nvp->entry], "RAW1", 4) == 0)
  18744. - st = COMMENT;
  18745. - else
  18746. - st = VALUE;
  18747. -- if (strncmp(&nvp->fwnv->data[nvp->entry], "devpath", 7) == 0)
  18748. -+ if (strncmp(&nvp->data[nvp->entry], "devpath", 7) == 0)
  18749. - nvp->multi_dev_v1 = true;
  18750. -- if (strncmp(&nvp->fwnv->data[nvp->entry], "pcie/", 5) == 0)
  18751. -+ if (strncmp(&nvp->data[nvp->entry], "pcie/", 5) == 0)
  18752. - nvp->multi_dev_v2 = true;
  18753. - } else if (!is_nvram_char(c) || c == ' ') {
  18754. - brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n",
  18755. -@@ -145,11 +145,11 @@ brcmf_nvram_handle_value(struct nvram_pa
  18756. - char *ekv;
  18757. - u32 cplen;
  18758. -
  18759. -- c = nvp->fwnv->data[nvp->pos];
  18760. -+ c = nvp->data[nvp->pos];
  18761. - if (!is_nvram_char(c)) {
  18762. - /* key,value pair complete */
  18763. -- ekv = (u8 *)&nvp->fwnv->data[nvp->pos];
  18764. -- skv = (u8 *)&nvp->fwnv->data[nvp->entry];
  18765. -+ ekv = (u8 *)&nvp->data[nvp->pos];
  18766. -+ skv = (u8 *)&nvp->data[nvp->entry];
  18767. - cplen = ekv - skv;
  18768. - if (nvp->nvram_len + cplen + 1 >= BRCMF_FW_MAX_NVRAM_SIZE)
  18769. - return END;
  18770. -@@ -170,7 +170,7 @@ brcmf_nvram_handle_comment(struct nvram_
  18771. - {
  18772. - char *eoc, *sol;
  18773. -
  18774. -- sol = (char *)&nvp->fwnv->data[nvp->pos];
  18775. -+ sol = (char *)&nvp->data[nvp->pos];
  18776. - eoc = strchr(sol, '\n');
  18777. - if (!eoc) {
  18778. - eoc = strchr(sol, '\0');
  18779. -@@ -201,17 +201,17 @@ static enum nvram_parser_state
  18780. - };
  18781. -
  18782. - static int brcmf_init_nvram_parser(struct nvram_parser *nvp,
  18783. -- const struct firmware *nv)
  18784. -+ const u8 *data, size_t data_len)
  18785. - {
  18786. - size_t size;
  18787. -
  18788. - memset(nvp, 0, sizeof(*nvp));
  18789. -- nvp->fwnv = nv;
  18790. -+ nvp->data = data;
  18791. - /* Limit size to MAX_NVRAM_SIZE, some files contain lot of comment */
  18792. -- if (nv->size > BRCMF_FW_MAX_NVRAM_SIZE)
  18793. -+ if (data_len > BRCMF_FW_MAX_NVRAM_SIZE)
  18794. - size = BRCMF_FW_MAX_NVRAM_SIZE;
  18795. - else
  18796. -- size = nv->size;
  18797. -+ size = data_len;
  18798. - /* Alloc for extra 0 byte + roundup by 4 + length field */
  18799. - size += 1 + 3 + sizeof(u32);
  18800. - nvp->nvram = kzalloc(size, GFP_KERNEL);
  18801. -@@ -362,18 +362,18 @@ fail:
  18802. - * and converts newlines to NULs. Shortens buffer as needed and pads with NULs.
  18803. - * End of buffer is completed with token identifying length of buffer.
  18804. - */
  18805. --static void *brcmf_fw_nvram_strip(const struct firmware *nv, u32 *new_length,
  18806. -- u16 domain_nr, u16 bus_nr)
  18807. -+static void *brcmf_fw_nvram_strip(const u8 *data, size_t data_len,
  18808. -+ u32 *new_length, u16 domain_nr, u16 bus_nr)
  18809. - {
  18810. - struct nvram_parser nvp;
  18811. - u32 pad;
  18812. - u32 token;
  18813. - __le32 token_le;
  18814. -
  18815. -- if (brcmf_init_nvram_parser(&nvp, nv) < 0)
  18816. -+ if (brcmf_init_nvram_parser(&nvp, data, data_len) < 0)
  18817. - return NULL;
  18818. -
  18819. -- while (nvp.pos < nv->size) {
  18820. -+ while (nvp.pos < data_len) {
  18821. - nvp.state = nv_parser_states[nvp.state](&nvp);
  18822. - if (nvp.state == END)
  18823. - break;
  18824. -@@ -432,7 +432,7 @@ static void brcmf_fw_request_nvram_done(
  18825. - goto fail;
  18826. -
  18827. - if (fw) {
  18828. -- nvram = brcmf_fw_nvram_strip(fw, &nvram_length,
  18829. -+ nvram = brcmf_fw_nvram_strip(fw->data, fw->size, &nvram_length,
  18830. - fwctx->domain_nr, fwctx->bus_nr);
  18831. - release_firmware(fw);
  18832. - if (!nvram && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL))
  18833. 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
  18834. deleted file mode 100644
  18835. index 4ecef3b..0000000
  18836. --- a/package/kernel/mac80211/patches/355-b43-fix-support-for-14e4-4321-PCI-dev-with-BCM4321-c.patch
  18837. +++ /dev/null
  18838. @@ -1,32 +0,0 @@
  18839. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  18840. -Date: Sat, 6 Jun 2015 22:45:59 +0200
  18841. -Subject: [PATCH] b43: fix support for 14e4:4321 PCI dev with BCM4321 chipset
  18842. -MIME-Version: 1.0
  18843. -Content-Type: text/plain; charset=UTF-8
  18844. -Content-Transfer-Encoding: 8bit
  18845. -
  18846. -It seems Broadcom released two devices with conflicting device id. There
  18847. -are for sure 14e4:4321 PCI devices with BCM4321 (N-PHY) chipset, they
  18848. -can be found in routers, e.g. Netgear WNR834Bv2. However, according to
  18849. -Broadcom public sources 0x4321 is also used for 5 GHz BCM4306 (G-PHY).
  18850. -It's unsure if they meant PCI device id, or "virtual" id (from SPROM).
  18851. -To distinguish these devices lets check PHY type (G vs. N).
  18852. -
  18853. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  18854. -Cc: <stable@vger.kernel.org> # 3.16+
  18855. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18856. ----
  18857. -
  18858. ---- a/drivers/net/wireless/b43/main.c
  18859. -+++ b/drivers/net/wireless/b43/main.c
  18860. -@@ -5365,6 +5365,10 @@ static void b43_supported_bands(struct b
  18861. - *have_5ghz_phy = true;
  18862. - return;
  18863. - case 0x4321: /* BCM4306 */
  18864. -+ /* There are 14e4:4321 PCI devs with 2.4 GHz BCM4321 (N-PHY) */
  18865. -+ if (dev->phy.type != B43_PHYTYPE_G)
  18866. -+ break;
  18867. -+ /* fall through */
  18868. - case 0x4313: /* BCM4311 */
  18869. - case 0x431a: /* BCM4318 */
  18870. - case 0x432a: /* BCM4321 */
  18871. 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
  18872. deleted file mode 100644
  18873. index bddb15a..0000000
  18874. --- a/package/kernel/mac80211/patches/356-ath9k-force-rx_clear-when-disabling-rx.patch
  18875. +++ /dev/null
  18876. @@ -1,31 +0,0 @@
  18877. -From: Felix Fietkau <nbd@openwrt.org>
  18878. -Date: Sun, 7 Jun 2015 13:53:35 +0200
  18879. -Subject: [PATCH] ath9k: force rx_clear when disabling rx
  18880. -
  18881. -This makes stopping Rx more reliable and should reduce the frequency of
  18882. -Rx related DMA stop warnings
  18883. -
  18884. -Cc: stable@vger.kernel.org
  18885. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  18886. ----
  18887. -
  18888. ---- a/drivers/net/wireless/ath/ath9k/mac.c
  18889. -+++ b/drivers/net/wireless/ath/ath9k/mac.c
  18890. -@@ -677,13 +677,15 @@ void ath9k_hw_startpcureceive(struct ath
  18891. -
  18892. - ath9k_ani_reset(ah, is_scanning);
  18893. -
  18894. -- REG_CLR_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT));
  18895. -+ REG_CLR_BIT(ah, AR_DIAG_SW,
  18896. -+ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  18897. - }
  18898. - EXPORT_SYMBOL(ath9k_hw_startpcureceive);
  18899. -
  18900. - void ath9k_hw_abortpcurecv(struct ath_hw *ah)
  18901. - {
  18902. -- REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_ABORT | AR_DIAG_RX_DIS);
  18903. -+ REG_SET_BIT(ah, AR_DIAG_SW,
  18904. -+ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  18905. -
  18906. - ath9k_hw_disable_mib_counters(ah);
  18907. - }
  18908. 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
  18909. deleted file mode 100644
  18910. index 74df9f9..0000000
  18911. --- a/package/kernel/mac80211/patches/357-0001-brcmfmac-Update-msgbuf-read-pointer-quicker.patch
  18912. +++ /dev/null
  18913. @@ -1,109 +0,0 @@
  18914. -From: Hante Meuleman <meuleman@broadcom.com>
  18915. -Date: Mon, 8 Jun 2015 14:38:32 +0200
  18916. -Subject: [PATCH] brcmfmac: Update msgbuf read pointer quicker.
  18917. -
  18918. -On device to host data using msgbuf the read pointer gets updated
  18919. -once all data is processed. Updating this pointer more frequently
  18920. -allows the firmware to add more data quicker. This will result in
  18921. -slightly higher and more stable throughput on CPU bounded host
  18922. -processors.
  18923. -
  18924. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  18925. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  18926. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  18927. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  18928. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  18929. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18930. ----
  18931. -
  18932. ---- a/drivers/net/wireless/brcm80211/brcmfmac/commonring.c
  18933. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/commonring.c
  18934. -@@ -223,8 +223,6 @@ void brcmf_commonring_write_cancel(struc
  18935. - void *brcmf_commonring_get_read_ptr(struct brcmf_commonring *commonring,
  18936. - u16 *n_items)
  18937. - {
  18938. -- void *ret_addr;
  18939. --
  18940. - if (commonring->cr_update_wptr)
  18941. - commonring->cr_update_wptr(commonring->cr_ctx);
  18942. -
  18943. -@@ -235,19 +233,18 @@ void *brcmf_commonring_get_read_ptr(stru
  18944. - if (*n_items == 0)
  18945. - return NULL;
  18946. -
  18947. -- ret_addr = commonring->buf_addr +
  18948. -- (commonring->r_ptr * commonring->item_len);
  18949. --
  18950. -- commonring->r_ptr += *n_items;
  18951. -- if (commonring->r_ptr == commonring->depth)
  18952. -- commonring->r_ptr = 0;
  18953. --
  18954. -- return ret_addr;
  18955. -+ return commonring->buf_addr +
  18956. -+ (commonring->r_ptr * commonring->item_len);
  18957. - }
  18958. -
  18959. -
  18960. --int brcmf_commonring_read_complete(struct brcmf_commonring *commonring)
  18961. -+int brcmf_commonring_read_complete(struct brcmf_commonring *commonring,
  18962. -+ u16 n_items)
  18963. - {
  18964. -+ commonring->r_ptr += n_items;
  18965. -+ if (commonring->r_ptr == commonring->depth)
  18966. -+ commonring->r_ptr = 0;
  18967. -+
  18968. - if (commonring->cr_write_rptr)
  18969. - return commonring->cr_write_rptr(commonring->cr_ctx);
  18970. -
  18971. ---- a/drivers/net/wireless/brcm80211/brcmfmac/commonring.h
  18972. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/commonring.h
  18973. -@@ -62,7 +62,8 @@ void brcmf_commonring_write_cancel(struc
  18974. - u16 n_items);
  18975. - void *brcmf_commonring_get_read_ptr(struct brcmf_commonring *commonring,
  18976. - u16 *n_items);
  18977. --int brcmf_commonring_read_complete(struct brcmf_commonring *commonring);
  18978. -+int brcmf_commonring_read_complete(struct brcmf_commonring *commonring,
  18979. -+ u16 n_items);
  18980. -
  18981. - #define brcmf_commonring_n_items(commonring) (commonring->depth)
  18982. - #define brcmf_commonring_len_item(commonring) (commonring->item_len)
  18983. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  18984. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  18985. -@@ -75,6 +75,8 @@
  18986. -
  18987. - #define BRCMF_MSGBUF_DELAY_TXWORKER_THRS 96
  18988. - #define BRCMF_MSGBUF_TRICKLE_TXWORKER_THRS 32
  18989. -+#define BRCMF_MSGBUF_UPDATE_RX_PTR_THRS 48
  18990. -+
  18991. -
  18992. - struct msgbuf_common_hdr {
  18993. - u8 msgtype;
  18994. -@@ -1257,19 +1259,27 @@ static void brcmf_msgbuf_process_rx(stru
  18995. - {
  18996. - void *buf;
  18997. - u16 count;
  18998. -+ u16 processed;
  18999. -
  19000. - again:
  19001. - buf = brcmf_commonring_get_read_ptr(commonring, &count);
  19002. - if (buf == NULL)
  19003. - return;
  19004. -
  19005. -+ processed = 0;
  19006. - while (count) {
  19007. - brcmf_msgbuf_process_msgtype(msgbuf,
  19008. - buf + msgbuf->rx_dataoffset);
  19009. - buf += brcmf_commonring_len_item(commonring);
  19010. -+ processed++;
  19011. -+ if (processed == BRCMF_MSGBUF_UPDATE_RX_PTR_THRS) {
  19012. -+ brcmf_commonring_read_complete(commonring, processed);
  19013. -+ processed = 0;
  19014. -+ }
  19015. - count--;
  19016. - }
  19017. -- brcmf_commonring_read_complete(commonring);
  19018. -+ if (processed)
  19019. -+ brcmf_commonring_read_complete(commonring, processed);
  19020. -
  19021. - if (commonring->r_ptr == 0)
  19022. - goto again;
  19023. 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
  19024. deleted file mode 100644
  19025. index 9e5b486..0000000
  19026. --- a/package/kernel/mac80211/patches/357-0002-brcmfmac-remove-chipinfo-debugfs-entry.patch
  19027. +++ /dev/null
  19028. @@ -1,39 +0,0 @@
  19029. -From: Arend van Spriel <arend@broadcom.com>
  19030. -Date: Mon, 8 Jun 2015 14:38:33 +0200
  19031. -Subject: [PATCH] brcmfmac: remove chipinfo debugfs entry
  19032. -
  19033. -The information provided by chipinfo is also provided by the
  19034. -revinfo debugfs entry. Removing it from debugfs.
  19035. -
  19036. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19037. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19038. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19039. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19040. ----
  19041. -
  19042. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  19043. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  19044. -@@ -41,15 +41,6 @@ void brcmf_debugfs_exit(void)
  19045. - root_folder = NULL;
  19046. - }
  19047. -
  19048. --static int brcmf_debugfs_chipinfo_read(struct seq_file *seq, void *data)
  19049. --{
  19050. -- struct brcmf_bus *bus = dev_get_drvdata(seq->private);
  19051. --
  19052. -- seq_printf(seq, "chip: %x(%u) rev %u\n",
  19053. -- bus->chip, bus->chip, bus->chiprev);
  19054. -- return 0;
  19055. --}
  19056. --
  19057. - int brcmf_debugfs_attach(struct brcmf_pub *drvr)
  19058. - {
  19059. - struct device *dev = drvr->bus_if->dev;
  19060. -@@ -58,7 +49,6 @@ int brcmf_debugfs_attach(struct brcmf_pu
  19061. - return -ENODEV;
  19062. -
  19063. - drvr->dbgfs_dir = debugfs_create_dir(dev_name(dev), root_folder);
  19064. -- brcmf_debugfs_add_entry(drvr, "chipinfo", brcmf_debugfs_chipinfo_read);
  19065. -
  19066. - return PTR_ERR_OR_ZERO(drvr->dbgfs_dir);
  19067. - }
  19068. 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
  19069. deleted file mode 100644
  19070. index c38b2cd..0000000
  19071. --- a/package/kernel/mac80211/patches/357-0003-brcmfmac-remove-watchdog-reset-from-brcmf_pcie_busco.patch
  19072. +++ /dev/null
  19073. @@ -1,53 +0,0 @@
  19074. -From: Arend van Spriel <arend@broadcom.com>
  19075. -Date: Mon, 8 Jun 2015 14:38:34 +0200
  19076. -Subject: [PATCH] brcmfmac: remove watchdog reset from
  19077. - brcmf_pcie_buscoreprep()
  19078. -
  19079. -The watchdog reset as done in brcmf_pcie_buscoreprep() is not
  19080. -sufficient. It needs to modify PCIe core registers as well
  19081. -which is properly done by brcmf_pcie_reset_device() after the
  19082. -chip recognition is done. So the faulty watchdog reset can be
  19083. -removed as it was causing driver reload to fail and hang the
  19084. -system requiring a power-cycle. Instead the call to to the
  19085. -brcmf_pcie_reset_device() function is done twice in the unload.
  19086. -
  19087. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19088. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  19089. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  19090. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19091. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19092. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19093. ----
  19094. -
  19095. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  19096. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  19097. -@@ -1629,20 +1629,7 @@ static void brcmf_pcie_buscore_write32(v
  19098. -
  19099. - static int brcmf_pcie_buscoreprep(void *ctx)
  19100. - {
  19101. -- struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)ctx;
  19102. -- int err;
  19103. --
  19104. -- err = brcmf_pcie_get_resource(devinfo);
  19105. -- if (err == 0) {
  19106. -- /* Set CC watchdog to reset all the cores on the chip to bring
  19107. -- * back dongle to a sane state.
  19108. -- */
  19109. -- brcmf_pcie_buscore_write32(ctx, CORE_CC_REG(SI_ENUM_BASE,
  19110. -- watchdog), 4);
  19111. -- msleep(100);
  19112. -- }
  19113. --
  19114. -- return err;
  19115. -+ return brcmf_pcie_get_resource(ctx);
  19116. - }
  19117. -
  19118. -
  19119. -@@ -1824,6 +1811,7 @@ brcmf_pcie_remove(struct pci_dev *pdev)
  19120. - brcmf_pcie_intr_disable(devinfo);
  19121. -
  19122. - brcmf_detach(&pdev->dev);
  19123. -+ brcmf_pcie_reset_device(devinfo);
  19124. -
  19125. - kfree(bus->bus_priv.pcie);
  19126. - kfree(bus->msgbuf->flowrings);
  19127. 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
  19128. deleted file mode 100644
  19129. index 756fbb2..0000000
  19130. --- a/package/kernel/mac80211/patches/357-0004-brcmfmac-use-debugfs_create_devm_seqfile-helper-func.patch
  19131. +++ /dev/null
  19132. @@ -1,69 +0,0 @@
  19133. -From: Arend van Spriel <arend@broadcom.com>
  19134. -Date: Mon, 8 Jun 2015 14:38:35 +0200
  19135. -Subject: [PATCH] brcmfmac: use debugfs_create_devm_seqfile() helper
  19136. - function
  19137. -
  19138. -Some time ago the function debugfs_create_devm_seqfile() was
  19139. -introduced in debugfs. The caller simply needs to provide a
  19140. -device pointer and read function. The function brcmf_debugfs_add_entry()
  19141. -is now simply a wrapper only doing the work for CONFIG_BRCMDBG.
  19142. -
  19143. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19144. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  19145. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  19146. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19147. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19148. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19149. ----
  19150. -
  19151. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  19152. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  19153. -@@ -64,44 +64,12 @@ struct dentry *brcmf_debugfs_get_devdir(
  19154. - return drvr->dbgfs_dir;
  19155. - }
  19156. -
  19157. --struct brcmf_debugfs_entry {
  19158. -- int (*read)(struct seq_file *seq, void *data);
  19159. -- struct brcmf_pub *drvr;
  19160. --};
  19161. --
  19162. --static int brcmf_debugfs_entry_open(struct inode *inode, struct file *f)
  19163. --{
  19164. -- struct brcmf_debugfs_entry *entry = inode->i_private;
  19165. --
  19166. -- return single_open(f, entry->read, entry->drvr->bus_if->dev);
  19167. --}
  19168. --
  19169. --static const struct file_operations brcmf_debugfs_def_ops = {
  19170. -- .owner = THIS_MODULE,
  19171. -- .open = brcmf_debugfs_entry_open,
  19172. -- .release = single_release,
  19173. -- .read = seq_read,
  19174. -- .llseek = seq_lseek
  19175. --};
  19176. --
  19177. - int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn,
  19178. - int (*read_fn)(struct seq_file *seq, void *data))
  19179. - {
  19180. -- struct dentry *dentry = drvr->dbgfs_dir;
  19181. -- struct brcmf_debugfs_entry *entry;
  19182. --
  19183. -- if (IS_ERR_OR_NULL(dentry))
  19184. -- return -ENOENT;
  19185. --
  19186. -- entry = devm_kzalloc(drvr->bus_if->dev, sizeof(*entry), GFP_KERNEL);
  19187. -- if (!entry)
  19188. -- return -ENOMEM;
  19189. --
  19190. -- entry->read = read_fn;
  19191. -- entry->drvr = drvr;
  19192. --
  19193. -- dentry = debugfs_create_file(fn, S_IRUGO, dentry, entry,
  19194. -- &brcmf_debugfs_def_ops);
  19195. -+ struct dentry *e;
  19196. -
  19197. -- return PTR_ERR_OR_ZERO(dentry);
  19198. -+ e = debugfs_create_devm_seqfile(drvr->bus_if->dev, fn,
  19199. -+ drvr->dbgfs_dir, read_fn);
  19200. -+ return PTR_ERR_OR_ZERO(e);
  19201. - }
  19202. 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
  19203. deleted file mode 100644
  19204. index 2674efb..0000000
  19205. --- a/package/kernel/mac80211/patches/358-ath9k_hw-fix-device-ID-check-for-AR956x.patch
  19206. +++ /dev/null
  19207. @@ -1,20 +0,0 @@
  19208. -From: Felix Fietkau <nbd@openwrt.org>
  19209. -Date: Sun, 21 Jun 2015 19:45:59 +0200
  19210. -Subject: [PATCH] ath9k_hw: fix device ID check for AR956x
  19211. -
  19212. -Because of the missing return, the macVersion value was being
  19213. -overwritten with an invalid register read
  19214. -
  19215. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  19216. ----
  19217. -
  19218. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  19219. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  19220. -@@ -278,6 +278,7 @@ static void ath9k_hw_read_revisions(stru
  19221. - return;
  19222. - case AR9300_DEVID_QCA956X:
  19223. - ah->hw_version.macVersion = AR_SREV_VERSION_9561;
  19224. -+ return;
  19225. - }
  19226. -
  19227. - val = REG_READ(ah, AR_SREV) & AR_SREV_ID;
  19228. 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
  19229. deleted file mode 100644
  19230. index ff24a4a..0000000
  19231. --- a/package/kernel/mac80211/patches/359-0001-brcmfmac-Check-if-firmware-supports-p2p.patch
  19232. +++ /dev/null
  19233. @@ -1,42 +0,0 @@
  19234. -From: Pontus Fuchs <pontusf@broadcom.com>
  19235. -Date: Thu, 11 Jun 2015 00:12:17 +0200
  19236. -Subject: [PATCH] brcmfmac: Check if firmware supports p2p
  19237. -
  19238. -Add a feature flag to reflect the firmware's p2p capability.
  19239. -
  19240. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19241. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19242. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  19243. -Signed-off-by: Pontus Fuchs <pontusf@broadcom.com>
  19244. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19245. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19246. ----
  19247. -
  19248. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  19249. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  19250. -@@ -129,6 +129,7 @@ void brcmf_feat_attach(struct brcmf_pub
  19251. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_WOWL, "wowl");
  19252. - if (drvr->bus_if->chip != BRCM_CC_43362_CHIP_ID)
  19253. - brcmf_feat_iovar_int_set(ifp, BRCMF_FEAT_MBSS, "mbss", 0);
  19254. -+ brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_P2P, "p2p");
  19255. -
  19256. - /* set chip related quirks */
  19257. - switch (drvr->bus_if->chip) {
  19258. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  19259. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  19260. -@@ -23,12 +23,14 @@
  19261. - * MCHAN: multi-channel for concurrent P2P.
  19262. - * PNO: preferred network offload.
  19263. - * WOWL: Wake-On-WLAN.
  19264. -+ * P2P: peer-to-peer
  19265. - */
  19266. - #define BRCMF_FEAT_LIST \
  19267. - BRCMF_FEAT_DEF(MBSS) \
  19268. - BRCMF_FEAT_DEF(MCHAN) \
  19269. - BRCMF_FEAT_DEF(PNO) \
  19270. -- BRCMF_FEAT_DEF(WOWL)
  19271. -+ BRCMF_FEAT_DEF(WOWL) \
  19272. -+ BRCMF_FEAT_DEF(P2P)
  19273. - /*
  19274. - * Quirks:
  19275. - *
  19276. 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
  19277. deleted file mode 100644
  19278. index 3876ba0..0000000
  19279. --- a/package/kernel/mac80211/patches/359-0002-brcmfmac-Build-wiphy-mode-and-interface-combinations.patch
  19280. +++ /dev/null
  19281. @@ -1,198 +0,0 @@
  19282. -From: Pontus Fuchs <pontusf@broadcom.com>
  19283. -Date: Thu, 11 Jun 2015 00:12:18 +0200
  19284. -Subject: [PATCH] brcmfmac: Build wiphy mode and interface combinations
  19285. - dynamically
  19286. -
  19287. -Switch from using semi hard coded interface combinations. This makes
  19288. -it easier to announce what the firmware actually supports. This fixes
  19289. -the case where brcmfmac announces p2p but the firmware doesn't
  19290. -support it.
  19291. -
  19292. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19293. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19294. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  19295. -Signed-off-by: Pontus Fuchs <pontusf@broadcom.com>
  19296. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19297. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19298. ----
  19299. -
  19300. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19301. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19302. -@@ -52,8 +52,6 @@
  19303. - #define BRCMF_PNO_SCAN_COMPLETE 1
  19304. - #define BRCMF_PNO_SCAN_INCOMPLETE 0
  19305. -
  19306. --#define BRCMF_IFACE_MAX_CNT 3
  19307. --
  19308. - #define WPA_OUI "\x00\x50\xF2" /* WPA OUI */
  19309. - #define WPA_OUI_TYPE 1
  19310. - #define RSN_OUI "\x00\x0F\xAC" /* RSN OUI */
  19311. -@@ -5639,53 +5637,6 @@ static int brcmf_setup_wiphybands(struct
  19312. - return 0;
  19313. - }
  19314. -
  19315. --static const struct ieee80211_iface_limit brcmf_iface_limits_mbss[] = {
  19316. -- {
  19317. -- .max = 1,
  19318. -- .types = BIT(NL80211_IFTYPE_STATION) |
  19319. -- BIT(NL80211_IFTYPE_ADHOC)
  19320. -- },
  19321. -- {
  19322. -- .max = 4,
  19323. -- .types = BIT(NL80211_IFTYPE_AP)
  19324. -- },
  19325. -- {
  19326. -- .max = 1,
  19327. -- .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  19328. -- BIT(NL80211_IFTYPE_P2P_GO)
  19329. -- },
  19330. -- {
  19331. -- .max = 1,
  19332. -- .types = BIT(NL80211_IFTYPE_P2P_DEVICE)
  19333. -- }
  19334. --};
  19335. --
  19336. --static const struct ieee80211_iface_limit brcmf_iface_limits_sbss[] = {
  19337. -- {
  19338. -- .max = 2,
  19339. -- .types = BIT(NL80211_IFTYPE_STATION) |
  19340. -- BIT(NL80211_IFTYPE_ADHOC) |
  19341. -- BIT(NL80211_IFTYPE_AP)
  19342. -- },
  19343. -- {
  19344. -- .max = 1,
  19345. -- .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  19346. -- BIT(NL80211_IFTYPE_P2P_GO)
  19347. -- },
  19348. -- {
  19349. -- .max = 1,
  19350. -- .types = BIT(NL80211_IFTYPE_P2P_DEVICE)
  19351. -- }
  19352. --};
  19353. --static struct ieee80211_iface_combination brcmf_iface_combos[] = {
  19354. -- {
  19355. -- .max_interfaces = BRCMF_IFACE_MAX_CNT,
  19356. -- .num_different_channels = 1,
  19357. -- .n_limits = ARRAY_SIZE(brcmf_iface_limits_sbss),
  19358. -- .limits = brcmf_iface_limits_sbss,
  19359. -- }
  19360. --};
  19361. --
  19362. - static const struct ieee80211_txrx_stypes
  19363. - brcmf_txrx_stypes[NUM_NL80211_IFTYPES] = {
  19364. - [NL80211_IFTYPE_STATION] = {
  19365. -@@ -5715,6 +5666,67 @@ brcmf_txrx_stypes[NUM_NL80211_IFTYPES] =
  19366. - }
  19367. - };
  19368. -
  19369. -+static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp)
  19370. -+{
  19371. -+ struct ieee80211_iface_combination *combo = NULL;
  19372. -+ struct ieee80211_iface_limit *limits = NULL;
  19373. -+ int i = 0, max_iface_cnt;
  19374. -+
  19375. -+ combo = kzalloc(sizeof(*combo), GFP_KERNEL);
  19376. -+ if (!combo)
  19377. -+ goto err;
  19378. -+
  19379. -+ limits = kzalloc(sizeof(*limits) * 4, GFP_KERNEL);
  19380. -+ if (!limits)
  19381. -+ goto err;
  19382. -+
  19383. -+ wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  19384. -+ BIT(NL80211_IFTYPE_ADHOC) |
  19385. -+ BIT(NL80211_IFTYPE_AP);
  19386. -+
  19387. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  19388. -+ combo->num_different_channels = 2;
  19389. -+ else
  19390. -+ combo->num_different_channels = 1;
  19391. -+
  19392. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) {
  19393. -+ limits[i].max = 1;
  19394. -+ limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  19395. -+ limits[i].max = 4;
  19396. -+ limits[i++].types = BIT(NL80211_IFTYPE_AP);
  19397. -+ max_iface_cnt = 5;
  19398. -+ } else {
  19399. -+ limits[i].max = 2;
  19400. -+ limits[i++].types = BIT(NL80211_IFTYPE_STATION) |
  19401. -+ BIT(NL80211_IFTYPE_AP);
  19402. -+ max_iface_cnt = 2;
  19403. -+ }
  19404. -+
  19405. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P)) {
  19406. -+ wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) |
  19407. -+ BIT(NL80211_IFTYPE_P2P_GO) |
  19408. -+ BIT(NL80211_IFTYPE_P2P_DEVICE);
  19409. -+ limits[i].max = 1;
  19410. -+ limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  19411. -+ BIT(NL80211_IFTYPE_P2P_GO);
  19412. -+ limits[i].max = 1;
  19413. -+ limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  19414. -+ max_iface_cnt += 2;
  19415. -+ }
  19416. -+ combo->max_interfaces = max_iface_cnt;
  19417. -+ combo->limits = limits;
  19418. -+ combo->n_limits = i;
  19419. -+
  19420. -+ wiphy->iface_combinations = combo;
  19421. -+ wiphy->n_iface_combinations = 1;
  19422. -+ return 0;
  19423. -+
  19424. -+err:
  19425. -+ kfree(limits);
  19426. -+ kfree(combo);
  19427. -+ return -ENOMEM;
  19428. -+}
  19429. -+
  19430. - static void brcmf_wiphy_pno_params(struct wiphy *wiphy)
  19431. - {
  19432. - /* scheduled scan settings */
  19433. -@@ -5745,7 +5757,6 @@ static void brcmf_wiphy_wowl_params(stru
  19434. - static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
  19435. - {
  19436. - struct ieee80211_supported_band *band;
  19437. -- struct ieee80211_iface_combination ifc_combo;
  19438. - __le32 bandlist[3];
  19439. - u32 n_bands;
  19440. - int err, i;
  19441. -@@ -5753,24 +5764,11 @@ static int brcmf_setup_wiphy(struct wiph
  19442. - wiphy->max_scan_ssids = WL_NUM_SCAN_MAX;
  19443. - wiphy->max_scan_ie_len = BRCMF_SCAN_IE_LEN_MAX;
  19444. - wiphy->max_num_pmkids = WL_NUM_PMKIDS_MAX;
  19445. -- wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  19446. -- BIT(NL80211_IFTYPE_ADHOC) |
  19447. -- BIT(NL80211_IFTYPE_AP) |
  19448. -- BIT(NL80211_IFTYPE_P2P_CLIENT) |
  19449. -- BIT(NL80211_IFTYPE_P2P_GO) |
  19450. -- BIT(NL80211_IFTYPE_P2P_DEVICE);
  19451. -- /* need VSDB firmware feature for concurrent channels */
  19452. -- ifc_combo = brcmf_iface_combos[0];
  19453. -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  19454. -- ifc_combo.num_different_channels = 2;
  19455. -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) {
  19456. -- ifc_combo.n_limits = ARRAY_SIZE(brcmf_iface_limits_mbss),
  19457. -- ifc_combo.limits = brcmf_iface_limits_mbss;
  19458. -- }
  19459. -- wiphy->iface_combinations = kmemdup(&ifc_combo,
  19460. -- sizeof(ifc_combo),
  19461. -- GFP_KERNEL);
  19462. -- wiphy->n_iface_combinations = ARRAY_SIZE(brcmf_iface_combos);
  19463. -+
  19464. -+ err = brcmf_setup_ifmodes(wiphy, ifp);
  19465. -+ if (err)
  19466. -+ return err;
  19467. -+
  19468. - wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
  19469. - wiphy->cipher_suites = __wl_cipher_suites;
  19470. - wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites);
  19471. -@@ -6035,6 +6033,8 @@ static void brcmf_free_wiphy(struct wiph
  19472. - if (!wiphy)
  19473. - return;
  19474. -
  19475. -+ if (wiphy->iface_combinations)
  19476. -+ kfree(wiphy->iface_combinations->limits);
  19477. - kfree(wiphy->iface_combinations);
  19478. - if (wiphy->bands[IEEE80211_BAND_2GHZ]) {
  19479. - kfree(wiphy->bands[IEEE80211_BAND_2GHZ]->channels);
  19480. 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
  19481. deleted file mode 100644
  19482. index 7bd0686..0000000
  19483. --- a/package/kernel/mac80211/patches/359-0003-brcmfmac-rework-.get_station-callback.patch
  19484. +++ /dev/null
  19485. @@ -1,326 +0,0 @@
  19486. -From: Arend van Spriel <arend@broadcom.com>
  19487. -Date: Thu, 11 Jun 2015 00:12:19 +0200
  19488. -Subject: [PATCH] brcmfmac: rework .get_station() callback
  19489. -
  19490. -The .get_station() cfg80211 callback is used in several scenarios. In
  19491. -managed mode it can obtain information about the access-point and its
  19492. -BSS parameters. In managed mode it can also obtain information about
  19493. -TDLS peers. In AP mode it can obtain information about connected
  19494. -clients.
  19495. -
  19496. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19497. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  19498. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  19499. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19500. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19501. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19502. ----
  19503. -
  19504. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19505. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19506. -@@ -2395,27 +2395,80 @@ brcmf_cfg80211_reconfigure_wep(struct br
  19507. - brcmf_err("set wsec error (%d)\n", err);
  19508. - }
  19509. -
  19510. -+static void brcmf_convert_sta_flags(u32 fw_sta_flags, struct station_info *si)
  19511. -+{
  19512. -+ struct nl80211_sta_flag_update *sfu;
  19513. -+
  19514. -+ brcmf_dbg(TRACE, "flags %08x\n", fw_sta_flags);
  19515. -+ si->filled |= BIT(NL80211_STA_INFO_STA_FLAGS);
  19516. -+ sfu = &si->sta_flags;
  19517. -+ sfu->mask = BIT(NL80211_STA_FLAG_WME) |
  19518. -+ BIT(NL80211_STA_FLAG_AUTHENTICATED) |
  19519. -+ BIT(NL80211_STA_FLAG_ASSOCIATED) |
  19520. -+ BIT(NL80211_STA_FLAG_AUTHORIZED);
  19521. -+ if (fw_sta_flags & BRCMF_STA_WME)
  19522. -+ sfu->set |= BIT(NL80211_STA_FLAG_WME);
  19523. -+ if (fw_sta_flags & BRCMF_STA_AUTHE)
  19524. -+ sfu->set |= BIT(NL80211_STA_FLAG_AUTHENTICATED);
  19525. -+ if (fw_sta_flags & BRCMF_STA_ASSOC)
  19526. -+ sfu->set |= BIT(NL80211_STA_FLAG_ASSOCIATED);
  19527. -+ if (fw_sta_flags & BRCMF_STA_AUTHO)
  19528. -+ sfu->set |= BIT(NL80211_STA_FLAG_AUTHORIZED);
  19529. -+}
  19530. -+
  19531. -+static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si)
  19532. -+{
  19533. -+ struct {
  19534. -+ __le32 len;
  19535. -+ struct brcmf_bss_info_le bss_le;
  19536. -+ } *buf;
  19537. -+ u16 capability;
  19538. -+ int err;
  19539. -+
  19540. -+ buf = kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL);
  19541. -+ if (!buf)
  19542. -+ return;
  19543. -+
  19544. -+ buf->len = cpu_to_le32(WL_BSS_INFO_MAX);
  19545. -+ err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, buf,
  19546. -+ WL_BSS_INFO_MAX);
  19547. -+ if (err) {
  19548. -+ brcmf_err("Failed to get bss info (%d)\n", err);
  19549. -+ return;
  19550. -+ }
  19551. -+ si->filled |= BIT(NL80211_STA_INFO_BSS_PARAM);
  19552. -+ si->bss_param.beacon_interval = le16_to_cpu(buf->bss_le.beacon_period);
  19553. -+ si->bss_param.dtim_period = buf->bss_le.dtim_period;
  19554. -+ capability = le16_to_cpu(buf->bss_le.capability);
  19555. -+ if (capability & IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT)
  19556. -+ si->bss_param.flags |= BSS_PARAM_FLAGS_CTS_PROT;
  19557. -+ if (capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
  19558. -+ si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE;
  19559. -+ if (capability & WLAN_CAPABILITY_SHORT_SLOT_TIME)
  19560. -+ si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME;
  19561. -+}
  19562. -+
  19563. - static s32
  19564. - brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
  19565. - const u8 *mac, struct station_info *sinfo)
  19566. - {
  19567. - struct brcmf_if *ifp = netdev_priv(ndev);
  19568. -- struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
  19569. -- struct brcmf_scb_val_le scb_val;
  19570. -- int rssi;
  19571. -- s32 rate;
  19572. - s32 err = 0;
  19573. -- u8 *bssid = profile->bssid;
  19574. - struct brcmf_sta_info_le sta_info_le;
  19575. -- u32 beacon_period;
  19576. -- u32 dtim_period;
  19577. -+ u32 sta_flags;
  19578. -+ u32 is_tdls_peer;
  19579. -
  19580. - brcmf_dbg(TRACE, "Enter, MAC %pM\n", mac);
  19581. - if (!check_vif_up(ifp->vif))
  19582. - return -EIO;
  19583. -
  19584. -- if (brcmf_is_apmode(ifp->vif)) {
  19585. -- memcpy(&sta_info_le, mac, ETH_ALEN);
  19586. -+ memset(&sta_info_le, 0, sizeof(sta_info_le));
  19587. -+ memcpy(&sta_info_le, mac, ETH_ALEN);
  19588. -+ err = brcmf_fil_iovar_data_get(ifp, "tdls_sta_info",
  19589. -+ &sta_info_le,
  19590. -+ sizeof(sta_info_le));
  19591. -+ is_tdls_peer = !err;
  19592. -+ if (err) {
  19593. - err = brcmf_fil_iovar_data_get(ifp, "sta_info",
  19594. - &sta_info_le,
  19595. - sizeof(sta_info_le));
  19596. -@@ -2423,73 +2476,48 @@ brcmf_cfg80211_get_station(struct wiphy
  19597. - brcmf_err("GET STA INFO failed, %d\n", err);
  19598. - goto done;
  19599. - }
  19600. -- sinfo->filled = BIT(NL80211_STA_INFO_INACTIVE_TIME);
  19601. -- sinfo->inactive_time = le32_to_cpu(sta_info_le.idle) * 1000;
  19602. -- if (le32_to_cpu(sta_info_le.flags) & BRCMF_STA_ASSOC) {
  19603. -- sinfo->filled |= BIT(NL80211_STA_INFO_CONNECTED_TIME);
  19604. -- sinfo->connected_time = le32_to_cpu(sta_info_le.in);
  19605. -- }
  19606. -- brcmf_dbg(TRACE, "STA idle time : %d ms, connected time :%d sec\n",
  19607. -- sinfo->inactive_time, sinfo->connected_time);
  19608. -- } else if (ifp->vif->wdev.iftype == NL80211_IFTYPE_STATION) {
  19609. -- if (memcmp(mac, bssid, ETH_ALEN)) {
  19610. -- brcmf_err("Wrong Mac address cfg_mac-%pM wl_bssid-%pM\n",
  19611. -- mac, bssid);
  19612. -- err = -ENOENT;
  19613. -- goto done;
  19614. -- }
  19615. -- /* Report the current tx rate */
  19616. -- err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_RATE, &rate);
  19617. -- if (err) {
  19618. -- brcmf_err("Could not get rate (%d)\n", err);
  19619. -- goto done;
  19620. -- } else {
  19621. -+ }
  19622. -+ brcmf_dbg(TRACE, "version %d\n", le16_to_cpu(sta_info_le.ver));
  19623. -+ sinfo->filled = BIT(NL80211_STA_INFO_INACTIVE_TIME);
  19624. -+ sinfo->inactive_time = le32_to_cpu(sta_info_le.idle) * 1000;
  19625. -+ sta_flags = le32_to_cpu(sta_info_le.flags);
  19626. -+ brcmf_convert_sta_flags(sta_flags, sinfo);
  19627. -+ sinfo->sta_flags.mask |= BIT(NL80211_STA_FLAG_TDLS_PEER);
  19628. -+ if (is_tdls_peer)
  19629. -+ sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER);
  19630. -+ else
  19631. -+ sinfo->sta_flags.set &= ~BIT(NL80211_STA_FLAG_TDLS_PEER);
  19632. -+ if (sta_flags & BRCMF_STA_ASSOC) {
  19633. -+ sinfo->filled |= BIT(NL80211_STA_INFO_CONNECTED_TIME);
  19634. -+ sinfo->connected_time = le32_to_cpu(sta_info_le.in);
  19635. -+ brcmf_fill_bss_param(ifp, sinfo);
  19636. -+ }
  19637. -+ if (sta_flags & BRCMF_STA_SCBSTATS) {
  19638. -+ sinfo->filled |= BIT(NL80211_STA_INFO_TX_FAILED);
  19639. -+ sinfo->tx_failed = le32_to_cpu(sta_info_le.tx_failures);
  19640. -+ sinfo->filled |= BIT(NL80211_STA_INFO_TX_PACKETS);
  19641. -+ sinfo->tx_packets = le32_to_cpu(sta_info_le.tx_pkts);
  19642. -+ sinfo->tx_packets += le32_to_cpu(sta_info_le.tx_mcast_pkts);
  19643. -+ sinfo->filled |= BIT(NL80211_STA_INFO_RX_PACKETS);
  19644. -+ sinfo->rx_packets = le32_to_cpu(sta_info_le.rx_ucast_pkts);
  19645. -+ sinfo->rx_packets += le32_to_cpu(sta_info_le.rx_mcast_pkts);
  19646. -+ if (sinfo->tx_packets) {
  19647. - sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
  19648. -- sinfo->txrate.legacy = rate * 5;
  19649. -- brcmf_dbg(CONN, "Rate %d Mbps\n", rate / 2);
  19650. -+ sinfo->txrate.legacy = le32_to_cpu(sta_info_le.tx_rate);
  19651. -+ sinfo->txrate.legacy /= 100;
  19652. - }
  19653. --
  19654. -- if (test_bit(BRCMF_VIF_STATUS_CONNECTED,
  19655. -- &ifp->vif->sme_state)) {
  19656. -- memset(&scb_val, 0, sizeof(scb_val));
  19657. -- err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI,
  19658. -- &scb_val, sizeof(scb_val));
  19659. -- if (err) {
  19660. -- brcmf_err("Could not get rssi (%d)\n", err);
  19661. -- goto done;
  19662. -- } else {
  19663. -- rssi = le32_to_cpu(scb_val.val);
  19664. -- sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
  19665. -- sinfo->signal = rssi;
  19666. -- brcmf_dbg(CONN, "RSSI %d dBm\n", rssi);
  19667. -- }
  19668. -- err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_BCNPRD,
  19669. -- &beacon_period);
  19670. -- if (err) {
  19671. -- brcmf_err("Could not get beacon period (%d)\n",
  19672. -- err);
  19673. -- goto done;
  19674. -- } else {
  19675. -- sinfo->bss_param.beacon_interval =
  19676. -- beacon_period;
  19677. -- brcmf_dbg(CONN, "Beacon peroid %d\n",
  19678. -- beacon_period);
  19679. -- }
  19680. -- err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_DTIMPRD,
  19681. -- &dtim_period);
  19682. -- if (err) {
  19683. -- brcmf_err("Could not get DTIM period (%d)\n",
  19684. -- err);
  19685. -- goto done;
  19686. -- } else {
  19687. -- sinfo->bss_param.dtim_period = dtim_period;
  19688. -- brcmf_dbg(CONN, "DTIM peroid %d\n",
  19689. -- dtim_period);
  19690. -- }
  19691. -- sinfo->filled |= BIT(NL80211_STA_INFO_BSS_PARAM);
  19692. -+ if (sinfo->rx_packets) {
  19693. -+ sinfo->filled |= BIT(NL80211_STA_INFO_RX_BITRATE);
  19694. -+ sinfo->rxrate.legacy = le32_to_cpu(sta_info_le.rx_rate);
  19695. -+ sinfo->rxrate.legacy /= 100;
  19696. -+ }
  19697. -+ if (le16_to_cpu(sta_info_le.ver) >= 4) {
  19698. -+ sinfo->filled |= BIT(NL80211_STA_INFO_TX_BYTES);
  19699. -+ sinfo->tx_bytes = le64_to_cpu(sta_info_le.tx_tot_bytes);
  19700. -+ sinfo->filled |= BIT(NL80211_STA_INFO_RX_BYTES);
  19701. -+ sinfo->rx_bytes = le64_to_cpu(sta_info_le.rx_tot_bytes);
  19702. - }
  19703. -- } else
  19704. -- err = -EPERM;
  19705. -+ }
  19706. - done:
  19707. - brcmf_dbg(TRACE, "Exit\n");
  19708. - return err;
  19709. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  19710. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  19711. -@@ -32,7 +32,11 @@
  19712. - #define BRCMF_BSS_INFO_VERSION 109 /* curr ver of brcmf_bss_info_le struct */
  19713. - #define BRCMF_BSS_RSSI_ON_CHANNEL 0x0002
  19714. -
  19715. --#define BRCMF_STA_ASSOC 0x10 /* Associated */
  19716. -+#define BRCMF_STA_WME 0x00000002 /* WMM association */
  19717. -+#define BRCMF_STA_AUTHE 0x00000008 /* Authenticated */
  19718. -+#define BRCMF_STA_ASSOC 0x00000010 /* Associated */
  19719. -+#define BRCMF_STA_AUTHO 0x00000020 /* Authorized */
  19720. -+#define BRCMF_STA_SCBSTATS 0x00004000 /* Per STA debug stats */
  19721. -
  19722. - /* size of brcmf_scan_params not including variable length array */
  19723. - #define BRCMF_SCAN_PARAMS_FIXED_SIZE 64
  19724. -@@ -113,6 +117,7 @@
  19725. - #define BRCMF_WOWL_MAXPATTERNSIZE 128
  19726. -
  19727. - #define BRCMF_COUNTRY_BUF_SZ 4
  19728. -+#define BRCMF_ANT_MAX 4
  19729. -
  19730. - /* join preference types for join_pref iovar */
  19731. - enum brcmf_join_pref_types {
  19732. -@@ -456,25 +461,61 @@ struct brcmf_channel_info_le {
  19733. - };
  19734. -
  19735. - struct brcmf_sta_info_le {
  19736. -- __le16 ver; /* version of this struct */
  19737. -- __le16 len; /* length in bytes of this structure */
  19738. -- __le16 cap; /* sta's advertised capabilities */
  19739. -- __le32 flags; /* flags defined below */
  19740. -- __le32 idle; /* time since data pkt rx'd from sta */
  19741. -- u8 ea[ETH_ALEN]; /* Station address */
  19742. -- __le32 count; /* # rates in this set */
  19743. -- u8 rates[BRCMF_MAXRATES_IN_SET]; /* rates in 500kbps units */
  19744. -+ __le16 ver; /* version of this struct */
  19745. -+ __le16 len; /* length in bytes of this structure */
  19746. -+ __le16 cap; /* sta's advertised capabilities */
  19747. -+ __le32 flags; /* flags defined below */
  19748. -+ __le32 idle; /* time since data pkt rx'd from sta */
  19749. -+ u8 ea[ETH_ALEN]; /* Station address */
  19750. -+ __le32 count; /* # rates in this set */
  19751. -+ u8 rates[BRCMF_MAXRATES_IN_SET]; /* rates in 500kbps units */
  19752. - /* w/hi bit set if basic */
  19753. -- __le32 in; /* seconds elapsed since associated */
  19754. -- __le32 listen_interval_inms; /* Min Listen interval in ms for STA */
  19755. -- __le32 tx_pkts; /* # of packets transmitted */
  19756. -- __le32 tx_failures; /* # of packets failed */
  19757. -- __le32 rx_ucast_pkts; /* # of unicast packets received */
  19758. -- __le32 rx_mcast_pkts; /* # of multicast packets received */
  19759. -- __le32 tx_rate; /* Rate of last successful tx frame */
  19760. -- __le32 rx_rate; /* Rate of last successful rx frame */
  19761. -- __le32 rx_decrypt_succeeds; /* # of packet decrypted successfully */
  19762. -- __le32 rx_decrypt_failures; /* # of packet decrypted failed */
  19763. -+ __le32 in; /* seconds elapsed since associated */
  19764. -+ __le32 listen_interval_inms; /* Min Listen interval in ms for STA */
  19765. -+ __le32 tx_pkts; /* # of packets transmitted */
  19766. -+ __le32 tx_failures; /* # of packets failed */
  19767. -+ __le32 rx_ucast_pkts; /* # of unicast packets received */
  19768. -+ __le32 rx_mcast_pkts; /* # of multicast packets received */
  19769. -+ __le32 tx_rate; /* Rate of last successful tx frame */
  19770. -+ __le32 rx_rate; /* Rate of last successful rx frame */
  19771. -+ __le32 rx_decrypt_succeeds; /* # of packet decrypted successfully */
  19772. -+ __le32 rx_decrypt_failures; /* # of packet decrypted failed */
  19773. -+ __le32 tx_tot_pkts; /* # of tx pkts (ucast + mcast) */
  19774. -+ __le32 rx_tot_pkts; /* # of data packets recvd (uni + mcast) */
  19775. -+ __le32 tx_mcast_pkts; /* # of mcast pkts txed */
  19776. -+ __le64 tx_tot_bytes; /* data bytes txed (ucast + mcast) */
  19777. -+ __le64 rx_tot_bytes; /* data bytes recvd (ucast + mcast) */
  19778. -+ __le64 tx_ucast_bytes; /* data bytes txed (ucast) */
  19779. -+ __le64 tx_mcast_bytes; /* # data bytes txed (mcast) */
  19780. -+ __le64 rx_ucast_bytes; /* data bytes recvd (ucast) */
  19781. -+ __le64 rx_mcast_bytes; /* data bytes recvd (mcast) */
  19782. -+ s8 rssi[BRCMF_ANT_MAX]; /* per antenna rssi */
  19783. -+ s8 nf[BRCMF_ANT_MAX]; /* per antenna noise floor */
  19784. -+ __le16 aid; /* association ID */
  19785. -+ __le16 ht_capabilities; /* advertised ht caps */
  19786. -+ __le16 vht_flags; /* converted vht flags */
  19787. -+ __le32 tx_pkts_retry_cnt; /* # of frames where a retry was
  19788. -+ * exhausted.
  19789. -+ */
  19790. -+ __le32 tx_pkts_retry_exhausted; /* # of user frames where a retry
  19791. -+ * was exhausted
  19792. -+ */
  19793. -+ s8 rx_lastpkt_rssi[BRCMF_ANT_MAX]; /* Per antenna RSSI of last
  19794. -+ * received data frame.
  19795. -+ */
  19796. -+ /* TX WLAN retry/failure statistics:
  19797. -+ * Separated for host requested frames and locally generated frames.
  19798. -+ * Include unicast frame only where the retries/failures can be counted.
  19799. -+ */
  19800. -+ __le32 tx_pkts_total; /* # user frames sent successfully */
  19801. -+ __le32 tx_pkts_retries; /* # user frames retries */
  19802. -+ __le32 tx_pkts_fw_total; /* # FW generated sent successfully */
  19803. -+ __le32 tx_pkts_fw_retries; /* # retries for FW generated frames */
  19804. -+ __le32 tx_pkts_fw_retry_exhausted; /* # FW generated where a retry
  19805. -+ * was exhausted
  19806. -+ */
  19807. -+ __le32 rx_pkts_retried; /* # rx with retry bit set */
  19808. -+ __le32 tx_rate_fallback; /* lowest fallback TX rate */
  19809. - };
  19810. -
  19811. - struct brcmf_chanspec_list {
  19812. 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
  19813. deleted file mode 100644
  19814. index 302bc3e..0000000
  19815. --- a/package/kernel/mac80211/patches/359-0004-brcmfmac-have-sdio-return-EIO-when-device-communicat.patch
  19816. +++ /dev/null
  19817. @@ -1,56 +0,0 @@
  19818. -From: Arend van Spriel <arend@broadcom.com>
  19819. -Date: Thu, 11 Jun 2015 00:12:20 +0200
  19820. -Subject: [PATCH] brcmfmac: have sdio return -EIO when device communication
  19821. - is not possible
  19822. -
  19823. -The bus interface functions txctl and rxctl may be used while the device
  19824. -can not be accessed, eg. upon driver .remove() callback. This patch will
  19825. -immediately return -EIO when this is the case which speeds up the module
  19826. -unload.
  19827. -
  19828. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19829. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  19830. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19831. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19832. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19833. ----
  19834. -
  19835. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  19836. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  19837. -@@ -988,6 +988,7 @@ static void brcmf_sdiod_freezer_detach(s
  19838. -
  19839. - static int brcmf_sdiod_remove(struct brcmf_sdio_dev *sdiodev)
  19840. - {
  19841. -+ sdiodev->state = BRCMF_SDIOD_DOWN;
  19842. - if (sdiodev->bus) {
  19843. - brcmf_sdio_remove(sdiodev->bus);
  19844. - sdiodev->bus = NULL;
  19845. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  19846. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  19847. -@@ -2820,6 +2820,8 @@ static int brcmf_sdio_bus_txdata(struct
  19848. - struct brcmf_sdio *bus = sdiodev->bus;
  19849. -
  19850. - brcmf_dbg(TRACE, "Enter: pkt: data %p len %d\n", pkt->data, pkt->len);
  19851. -+ if (sdiodev->state != BRCMF_SDIOD_DATA)
  19852. -+ return -EIO;
  19853. -
  19854. - /* Add space for the header */
  19855. - skb_push(pkt, bus->tx_hdrlen);
  19856. -@@ -2948,6 +2950,8 @@ brcmf_sdio_bus_txctl(struct device *dev,
  19857. - int ret;
  19858. -
  19859. - brcmf_dbg(TRACE, "Enter\n");
  19860. -+ if (sdiodev->state != BRCMF_SDIOD_DATA)
  19861. -+ return -EIO;
  19862. -
  19863. - /* Send from dpc */
  19864. - bus->ctrl_frame_buf = msg;
  19865. -@@ -3238,6 +3242,8 @@ brcmf_sdio_bus_rxctl(struct device *dev,
  19866. - struct brcmf_sdio *bus = sdiodev->bus;
  19867. -
  19868. - brcmf_dbg(TRACE, "Enter\n");
  19869. -+ if (sdiodev->state != BRCMF_SDIOD_DATA)
  19870. -+ return -EIO;
  19871. -
  19872. - /* Wait until control frame is available */
  19873. - timeleft = brcmf_sdio_dcmd_resp_wait(bus, &bus->rxlen, &pending);
  19874. 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
  19875. deleted file mode 100644
  19876. index 34af6d2..0000000
  19877. --- a/package/kernel/mac80211/patches/359-0005-ath9k-make-DMA-stop-related-messages-debug-only.patch
  19878. +++ /dev/null
  19879. @@ -1,74 +0,0 @@
  19880. -From: Felix Fietkau <nbd@openwrt.org>
  19881. -Date: Thu, 2 Jul 2015 13:35:05 +0200
  19882. -Subject: [PATCH] ath9k: make DMA stop related messages debug-only
  19883. -
  19884. -A long time ago, ath9k had issues during reset where the DMA engine
  19885. -would stay active and could potentially corrupt memory.
  19886. -To debug those issues, the driver would print warnings whenever they
  19887. -occur.
  19888. -
  19889. -Nowadays, these issues are gone and the primary cause of these messages
  19890. -is if the MAC is stuck during reset or busy processing a long
  19891. -transmission. This is fairly harmless, yet these messages continue to
  19892. -worry users.
  19893. -
  19894. -To reduce the number of bogus bug reports, turn these messages into
  19895. -debug messages and count their occurence in the "reset" debugfs file.
  19896. -
  19897. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  19898. ----
  19899. -
  19900. ---- a/drivers/net/wireless/ath/ath9k/debug.c
  19901. -+++ b/drivers/net/wireless/ath/ath9k/debug.c
  19902. -@@ -765,6 +765,8 @@ static int read_file_reset(struct seq_fi
  19903. - [RESET_TYPE_BEACON_STUCK] = "Stuck Beacon",
  19904. - [RESET_TYPE_MCI] = "MCI Reset",
  19905. - [RESET_TYPE_CALIBRATION] = "Calibration error",
  19906. -+ [RESET_TX_DMA_ERROR] = "Tx DMA stop error",
  19907. -+ [RESET_RX_DMA_ERROR] = "Rx DMA stop error",
  19908. - };
  19909. - int i;
  19910. -
  19911. ---- a/drivers/net/wireless/ath/ath9k/debug.h
  19912. -+++ b/drivers/net/wireless/ath/ath9k/debug.h
  19913. -@@ -50,6 +50,8 @@ enum ath_reset_type {
  19914. - RESET_TYPE_BEACON_STUCK,
  19915. - RESET_TYPE_MCI,
  19916. - RESET_TYPE_CALIBRATION,
  19917. -+ RESET_TX_DMA_ERROR,
  19918. -+ RESET_RX_DMA_ERROR,
  19919. - __RESET_TYPE_MAX
  19920. - };
  19921. -
  19922. ---- a/drivers/net/wireless/ath/ath9k/recv.c
  19923. -+++ b/drivers/net/wireless/ath/ath9k/recv.c
  19924. -@@ -496,10 +496,9 @@ bool ath_stoprecv(struct ath_softc *sc)
  19925. -
  19926. - if (!(ah->ah_flags & AH_UNPLUGGED) &&
  19927. - unlikely(!stopped)) {
  19928. -- ath_err(ath9k_hw_common(sc->sc_ah),
  19929. -- "Could not stop RX, we could be "
  19930. -- "confusing the DMA engine when we start RX up\n");
  19931. -- ATH_DBG_WARN_ON_ONCE(!stopped);
  19932. -+ ath_dbg(ath9k_hw_common(sc->sc_ah), RESET,
  19933. -+ "Failed to stop Rx DMA\n");
  19934. -+ RESET_STAT_INC(sc, RESET_RX_DMA_ERROR);
  19935. - }
  19936. - return stopped && !reset;
  19937. - }
  19938. ---- a/drivers/net/wireless/ath/ath9k/xmit.c
  19939. -+++ b/drivers/net/wireless/ath/ath9k/xmit.c
  19940. -@@ -1896,8 +1896,11 @@ bool ath_drain_all_txq(struct ath_softc
  19941. - npend |= BIT(i);
  19942. - }
  19943. -
  19944. -- if (npend)
  19945. -- ath_err(common, "Failed to stop TX DMA, queues=0x%03x!\n", npend);
  19946. -+ if (npend) {
  19947. -+ RESET_STAT_INC(sc, RESET_TX_DMA_ERROR);
  19948. -+ ath_dbg(common, RESET,
  19949. -+ "Failed to stop TX DMA, queues=0x%03x!\n", npend);
  19950. -+ }
  19951. -
  19952. - for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
  19953. - if (!ATH_TXQ_SETUP(sc, i))
  19954. 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
  19955. deleted file mode 100644
  19956. index 06f2dce..0000000
  19957. --- a/package/kernel/mac80211/patches/359-0006-brcmfmac-free-ifp-for-non-netdev-interface-in-p2p-mo.patch
  19958. +++ /dev/null
  19959. @@ -1,44 +0,0 @@
  19960. -From: Arend van Spriel <arend@broadcom.com>
  19961. -Date: Thu, 11 Jun 2015 00:12:21 +0200
  19962. -Subject: [PATCH] brcmfmac: free ifp for non-netdev interface in p2p module
  19963. -
  19964. -Making it more clear by freeing the ifp in same place where the
  19965. -vif object is freed.
  19966. -
  19967. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19968. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  19969. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19970. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19971. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19972. ----
  19973. -
  19974. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  19975. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  19976. -@@ -867,8 +867,6 @@ static void brcmf_del_if(struct brcmf_pu
  19977. - }
  19978. - /* unregister will take care of freeing it */
  19979. - unregister_netdev(ifp->ndev);
  19980. -- } else {
  19981. -- kfree(ifp);
  19982. - }
  19983. - }
  19984. -
  19985. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  19986. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  19987. -@@ -2238,6 +2238,7 @@ static void brcmf_p2p_delete_p2pdev(stru
  19988. - {
  19989. - cfg80211_unregister_wdev(&vif->wdev);
  19990. - p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  19991. -+ kfree(vif->ifp);
  19992. - brcmf_free_vif(vif);
  19993. - }
  19994. -
  19995. -@@ -2361,6 +2362,8 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  19996. - break;
  19997. -
  19998. - case NL80211_IFTYPE_P2P_DEVICE:
  19999. -+ brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  20000. -+ brcmf_p2p_deinit_discovery(p2p);
  20001. - brcmf_p2p_delete_p2pdev(p2p, vif);
  20002. - return 0;
  20003. - default:
  20004. 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
  20005. deleted file mode 100644
  20006. index 0a6e093..0000000
  20007. --- a/package/kernel/mac80211/patches/359-0007-brcmfmac-move-p2p-attach-detach-functions.patch
  20008. +++ /dev/null
  20009. @@ -1,225 +0,0 @@
  20010. -From: Arend van Spriel <arend@broadcom.com>
  20011. -Date: Thu, 11 Jun 2015 00:12:22 +0200
  20012. -Subject: [PATCH] brcmfmac: move p2p attach/detach functions
  20013. -
  20014. -Moving two functions in p2p.c as is so next change will be
  20015. -easier to review.
  20016. -
  20017. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20018. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20019. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20020. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20021. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  20022. ----
  20023. -
  20024. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  20025. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  20026. -@@ -1908,105 +1908,6 @@ s32 brcmf_p2p_notify_rx_mgmt_p2p_probere
  20027. -
  20028. -
  20029. - /**
  20030. -- * brcmf_p2p_attach() - attach for P2P.
  20031. -- *
  20032. -- * @cfg: driver private data for cfg80211 interface.
  20033. -- */
  20034. --s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg)
  20035. --{
  20036. -- struct brcmf_if *pri_ifp;
  20037. -- struct brcmf_if *p2p_ifp;
  20038. -- struct brcmf_cfg80211_vif *p2p_vif;
  20039. -- struct brcmf_p2p_info *p2p;
  20040. -- struct brcmf_pub *drvr;
  20041. -- s32 bssidx;
  20042. -- s32 err = 0;
  20043. --
  20044. -- p2p = &cfg->p2p;
  20045. -- p2p->cfg = cfg;
  20046. --
  20047. -- drvr = cfg->pub;
  20048. --
  20049. -- pri_ifp = drvr->iflist[0];
  20050. -- p2p_ifp = drvr->iflist[1];
  20051. --
  20052. -- p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif = pri_ifp->vif;
  20053. --
  20054. -- if (p2p_ifp) {
  20055. -- p2p_vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_P2P_DEVICE,
  20056. -- false);
  20057. -- if (IS_ERR(p2p_vif)) {
  20058. -- brcmf_err("could not create discovery vif\n");
  20059. -- err = -ENOMEM;
  20060. -- goto exit;
  20061. -- }
  20062. --
  20063. -- p2p_vif->ifp = p2p_ifp;
  20064. -- p2p_ifp->vif = p2p_vif;
  20065. -- p2p_vif->wdev.netdev = p2p_ifp->ndev;
  20066. -- p2p_ifp->ndev->ieee80211_ptr = &p2p_vif->wdev;
  20067. -- SET_NETDEV_DEV(p2p_ifp->ndev, wiphy_dev(cfg->wiphy));
  20068. --
  20069. -- p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = p2p_vif;
  20070. --
  20071. -- brcmf_p2p_generate_bss_mac(p2p, NULL);
  20072. -- memcpy(p2p_ifp->mac_addr, p2p->dev_addr, ETH_ALEN);
  20073. -- brcmf_p2p_set_firmware(pri_ifp, p2p->dev_addr);
  20074. --
  20075. -- /* Initialize P2P Discovery in the firmware */
  20076. -- err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1);
  20077. -- if (err < 0) {
  20078. -- brcmf_err("set p2p_disc error\n");
  20079. -- brcmf_free_vif(p2p_vif);
  20080. -- goto exit;
  20081. -- }
  20082. -- /* obtain bsscfg index for P2P discovery */
  20083. -- err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bssidx);
  20084. -- if (err < 0) {
  20085. -- brcmf_err("retrieving discover bsscfg index failed\n");
  20086. -- brcmf_free_vif(p2p_vif);
  20087. -- goto exit;
  20088. -- }
  20089. -- /* Verify that firmware uses same bssidx as driver !! */
  20090. -- if (p2p_ifp->bssidx != bssidx) {
  20091. -- brcmf_err("Incorrect bssidx=%d, compared to p2p_ifp->bssidx=%d\n",
  20092. -- bssidx, p2p_ifp->bssidx);
  20093. -- brcmf_free_vif(p2p_vif);
  20094. -- goto exit;
  20095. -- }
  20096. --
  20097. -- init_completion(&p2p->send_af_done);
  20098. -- INIT_WORK(&p2p->afx_hdl.afx_work, brcmf_p2p_afx_handler);
  20099. -- init_completion(&p2p->afx_hdl.act_frm_scan);
  20100. -- init_completion(&p2p->wait_next_af);
  20101. -- }
  20102. --exit:
  20103. -- return err;
  20104. --}
  20105. --
  20106. --
  20107. --/**
  20108. -- * brcmf_p2p_detach() - detach P2P.
  20109. -- *
  20110. -- * @p2p: P2P specific data.
  20111. -- */
  20112. --void brcmf_p2p_detach(struct brcmf_p2p_info *p2p)
  20113. --{
  20114. -- struct brcmf_cfg80211_vif *vif;
  20115. --
  20116. -- vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
  20117. -- if (vif != NULL) {
  20118. -- brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  20119. -- brcmf_p2p_deinit_discovery(p2p);
  20120. -- /* remove discovery interface */
  20121. -- brcmf_free_vif(vif);
  20122. -- p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  20123. -- }
  20124. -- /* just set it all to zero */
  20125. -- memset(p2p, 0, sizeof(*p2p));
  20126. --}
  20127. --
  20128. --/**
  20129. - * brcmf_p2p_get_current_chanspec() - Get current operation channel.
  20130. - *
  20131. - * @p2p: P2P specific data.
  20132. -@@ -2425,3 +2326,102 @@ void brcmf_p2p_stop_device(struct wiphy
  20133. - clear_bit(BRCMF_VIF_STATUS_READY, &vif->sme_state);
  20134. - mutex_unlock(&cfg->usr_sync);
  20135. - }
  20136. -+
  20137. -+/**
  20138. -+ * brcmf_p2p_attach() - attach for P2P.
  20139. -+ *
  20140. -+ * @cfg: driver private data for cfg80211 interface.
  20141. -+ */
  20142. -+s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg)
  20143. -+{
  20144. -+ struct brcmf_if *pri_ifp;
  20145. -+ struct brcmf_if *p2p_ifp;
  20146. -+ struct brcmf_cfg80211_vif *p2p_vif;
  20147. -+ struct brcmf_p2p_info *p2p;
  20148. -+ struct brcmf_pub *drvr;
  20149. -+ s32 bssidx;
  20150. -+ s32 err = 0;
  20151. -+
  20152. -+ p2p = &cfg->p2p;
  20153. -+ p2p->cfg = cfg;
  20154. -+
  20155. -+ drvr = cfg->pub;
  20156. -+
  20157. -+ pri_ifp = drvr->iflist[0];
  20158. -+ p2p_ifp = drvr->iflist[1];
  20159. -+
  20160. -+ p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif = pri_ifp->vif;
  20161. -+
  20162. -+ if (p2p_ifp) {
  20163. -+ p2p_vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_P2P_DEVICE,
  20164. -+ false);
  20165. -+ if (IS_ERR(p2p_vif)) {
  20166. -+ brcmf_err("could not create discovery vif\n");
  20167. -+ err = -ENOMEM;
  20168. -+ goto exit;
  20169. -+ }
  20170. -+
  20171. -+ p2p_vif->ifp = p2p_ifp;
  20172. -+ p2p_ifp->vif = p2p_vif;
  20173. -+ p2p_vif->wdev.netdev = p2p_ifp->ndev;
  20174. -+ p2p_ifp->ndev->ieee80211_ptr = &p2p_vif->wdev;
  20175. -+ SET_NETDEV_DEV(p2p_ifp->ndev, wiphy_dev(cfg->wiphy));
  20176. -+
  20177. -+ p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = p2p_vif;
  20178. -+
  20179. -+ brcmf_p2p_generate_bss_mac(p2p, NULL);
  20180. -+ memcpy(p2p_ifp->mac_addr, p2p->dev_addr, ETH_ALEN);
  20181. -+ brcmf_p2p_set_firmware(pri_ifp, p2p->dev_addr);
  20182. -+
  20183. -+ /* Initialize P2P Discovery in the firmware */
  20184. -+ err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1);
  20185. -+ if (err < 0) {
  20186. -+ brcmf_err("set p2p_disc error\n");
  20187. -+ brcmf_free_vif(p2p_vif);
  20188. -+ goto exit;
  20189. -+ }
  20190. -+ /* obtain bsscfg index for P2P discovery */
  20191. -+ err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bssidx);
  20192. -+ if (err < 0) {
  20193. -+ brcmf_err("retrieving discover bsscfg index failed\n");
  20194. -+ brcmf_free_vif(p2p_vif);
  20195. -+ goto exit;
  20196. -+ }
  20197. -+ /* Verify that firmware uses same bssidx as driver !! */
  20198. -+ if (p2p_ifp->bssidx != bssidx) {
  20199. -+ brcmf_err("Incorrect bssidx=%d, compared to p2p_ifp->bssidx=%d\n",
  20200. -+ bssidx, p2p_ifp->bssidx);
  20201. -+ brcmf_free_vif(p2p_vif);
  20202. -+ goto exit;
  20203. -+ }
  20204. -+
  20205. -+ init_completion(&p2p->send_af_done);
  20206. -+ INIT_WORK(&p2p->afx_hdl.afx_work, brcmf_p2p_afx_handler);
  20207. -+ init_completion(&p2p->afx_hdl.act_frm_scan);
  20208. -+ init_completion(&p2p->wait_next_af);
  20209. -+ }
  20210. -+exit:
  20211. -+ return err;
  20212. -+}
  20213. -+
  20214. -+/**
  20215. -+ * brcmf_p2p_detach() - detach P2P.
  20216. -+ *
  20217. -+ * @p2p: P2P specific data.
  20218. -+ */
  20219. -+void brcmf_p2p_detach(struct brcmf_p2p_info *p2p)
  20220. -+{
  20221. -+ struct brcmf_cfg80211_vif *vif;
  20222. -+
  20223. -+ vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
  20224. -+ if (vif != NULL) {
  20225. -+ brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  20226. -+ brcmf_p2p_deinit_discovery(p2p);
  20227. -+ /* remove discovery interface */
  20228. -+ brcmf_free_vif(vif);
  20229. -+ p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  20230. -+ }
  20231. -+ /* just set it all to zero */
  20232. -+ memset(p2p, 0, sizeof(*p2p));
  20233. -+}
  20234. -+
  20235. 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
  20236. deleted file mode 100644
  20237. index 72e8eed..0000000
  20238. --- a/package/kernel/mac80211/patches/359-0008-brcmfmac-assure-p2pdev-is-unregistered-upon-driver-u.patch
  20239. +++ /dev/null
  20240. @@ -1,63 +0,0 @@
  20241. -From: Arend van Spriel <arend@broadcom.com>
  20242. -Date: Thu, 11 Jun 2015 00:12:23 +0200
  20243. -Subject: [PATCH] brcmfmac: assure p2pdev is unregistered upon driver
  20244. - unload
  20245. -
  20246. -When unloading the driver with a p2pdev interface it resulted in
  20247. -a warning upon calling wiphy_unregister() and subsequently a crash
  20248. -in the driver. This patch assures the p2pdev is unregistered calling
  20249. -unregister_wdev() before doing the wiphy_unregister().
  20250. -
  20251. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20252. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20253. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20254. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20255. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  20256. ----
  20257. -
  20258. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  20259. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  20260. -@@ -6206,10 +6206,8 @@ void brcmf_cfg80211_detach(struct brcmf_
  20261. - if (!cfg)
  20262. - return;
  20263. -
  20264. -- WARN_ON(!list_empty(&cfg->vif_list));
  20265. -- wiphy_unregister(cfg->wiphy);
  20266. - brcmf_btcoex_detach(cfg);
  20267. -- brcmf_p2p_detach(&cfg->p2p);
  20268. -+ wiphy_unregister(cfg->wiphy);
  20269. - wl_deinit_priv(cfg);
  20270. - brcmf_free_wiphy(cfg->wiphy);
  20271. - }
  20272. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20273. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20274. -@@ -1098,6 +1098,7 @@ void brcmf_detach(struct device *dev)
  20275. -
  20276. - /* stop firmware event handling */
  20277. - brcmf_fweh_detach(drvr);
  20278. -+ brcmf_p2p_detach(&drvr->config->p2p);
  20279. -
  20280. - brcmf_bus_change_state(bus_if, BRCMF_BUS_DOWN);
  20281. -
  20282. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  20283. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  20284. -@@ -16,6 +16,7 @@
  20285. - #include <linux/slab.h>
  20286. - #include <linux/netdevice.h>
  20287. - #include <linux/etherdevice.h>
  20288. -+#include <linux/rtnetlink.h>
  20289. - #include <net/cfg80211.h>
  20290. -
  20291. - #include <brcmu_wifi.h>
  20292. -@@ -2418,8 +2419,9 @@ void brcmf_p2p_detach(struct brcmf_p2p_i
  20293. - brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  20294. - brcmf_p2p_deinit_discovery(p2p);
  20295. - /* remove discovery interface */
  20296. -- brcmf_free_vif(vif);
  20297. -- p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  20298. -+ rtnl_lock();
  20299. -+ brcmf_p2p_delete_p2pdev(p2p, vif);
  20300. -+ rtnl_unlock();
  20301. - }
  20302. - /* just set it all to zero */
  20303. - memset(p2p, 0, sizeof(*p2p));
  20304. 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
  20305. deleted file mode 100644
  20306. index 179c77e..0000000
  20307. --- a/package/kernel/mac80211/patches/360-0001-brcmfmac-fix-double-free-of-p2pdev-interface.patch
  20308. +++ /dev/null
  20309. @@ -1,27 +0,0 @@
  20310. -From: Arend van Spriel <arend@broadcom.com>
  20311. -Date: Mon, 15 Jun 2015 22:48:38 +0200
  20312. -Subject: [PATCH] brcmfmac: fix double free of p2pdev interface
  20313. -
  20314. -When freeing the driver ifp pointer it should also be removed from
  20315. -the driver interface list, which is what brcmf_remove_interface()
  20316. -does. Otherwise, the ifp pointer will be freed twice triggering
  20317. -a kernel oops.
  20318. -
  20319. -Fixes: f37d69a4babc ("brcmfmac: free ifp for non-netdev interface in p2p module")
  20320. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20321. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20322. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20323. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  20324. ----
  20325. -
  20326. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  20327. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  20328. -@@ -2140,7 +2140,7 @@ static void brcmf_p2p_delete_p2pdev(stru
  20329. - {
  20330. - cfg80211_unregister_wdev(&vif->wdev);
  20331. - p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  20332. -- kfree(vif->ifp);
  20333. -+ brcmf_remove_interface(vif->ifp->drvr, vif->ifp->bssidx);
  20334. - brcmf_free_vif(vif);
  20335. - }
  20336. -
  20337. 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
  20338. deleted file mode 100644
  20339. index e4f88b5..0000000
  20340. --- a/package/kernel/mac80211/patches/360-0002-brcmfmac-make-brcmf_p2p_detach-call-conditional.patch
  20341. +++ /dev/null
  20342. @@ -1,29 +0,0 @@
  20343. -From: Arend van Spriel <arend@broadcom.com>
  20344. -Date: Mon, 15 Jun 2015 22:48:39 +0200
  20345. -Subject: [PATCH] brcmfmac: make brcmf_p2p_detach() call conditional
  20346. -
  20347. -During verification of error handling in brcmf_cfg80211_attach() a
  20348. -null pointer dereference occurred upon calling brcmf_p2p_detach()
  20349. -from brcmf_detach(). This should only be called when the
  20350. -brcmf_cfg80211_attach() has succeeded.
  20351. -
  20352. -Fixes: f7a40873d2fa ("brcmfmac: assure p2pdev is unregistered upon driver unload")
  20353. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20354. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20355. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20356. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20357. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  20358. ----
  20359. -
  20360. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20361. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20362. -@@ -1098,7 +1098,8 @@ void brcmf_detach(struct device *dev)
  20363. -
  20364. - /* stop firmware event handling */
  20365. - brcmf_fweh_detach(drvr);
  20366. -- brcmf_p2p_detach(&drvr->config->p2p);
  20367. -+ if (drvr->config)
  20368. -+ brcmf_p2p_detach(&drvr->config->p2p);
  20369. -
  20370. - brcmf_bus_change_state(bus_if, BRCMF_BUS_DOWN);
  20371. -
  20372. 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
  20373. deleted file mode 100644
  20374. index 0a81237..0000000
  20375. --- a/package/kernel/mac80211/patches/361-brcmfmac-set-wiphy-s-addresses-to-provide-valid-MACs.patch
  20376. +++ /dev/null
  20377. @@ -1,67 +0,0 @@
  20378. -From: Rafa? Mi?ecki <zajec5@gmail.com>
  20379. -Date: Thu, 9 Jul 2015 17:07:08 +0200
  20380. -Subject: [PATCH] brcmfmac: set wiphy's addresses to provide valid MACs
  20381. -
  20382. -Broadcom's firmware requires every BSS to use MAC address with unique
  20383. -last few bits. The amount of bits may depend on a particular firmware,
  20384. -it was verified to be 2 for BCM43602 one.
  20385. -If this condition won't be fulfilled firmware will reject such MAC:
  20386. -brcmfmac: _brcmf_set_mac_address: Setting cur_etheraddr failed, -52
  20387. -
  20388. -We don't want to simply set addr_mask as it would also disallow using
  20389. -locally administrated bit. Instead let's build a list of addresses
  20390. -manually enabling 0x2 bit for extra interfaces.
  20391. -
  20392. -Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
  20393. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  20394. ----
  20395. -
  20396. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  20397. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  20398. -@@ -5784,6 +5784,7 @@ static void brcmf_wiphy_wowl_params(stru
  20399. -
  20400. - static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
  20401. - {
  20402. -+ struct brcmf_pub *drvr = ifp->drvr;
  20403. - struct ieee80211_supported_band *band;
  20404. - __le32 bandlist[3];
  20405. - u32 n_bands;
  20406. -@@ -5797,6 +5798,19 @@ static int brcmf_setup_wiphy(struct wiph
  20407. - if (err)
  20408. - return err;
  20409. -
  20410. -+ for (i = 0; i < wiphy->iface_combinations->max_interfaces &&
  20411. -+ i < ARRAY_SIZE(drvr->addresses); i++) {
  20412. -+ u8 *addr = drvr->addresses[i].addr;
  20413. -+
  20414. -+ memcpy(addr, drvr->mac, ETH_ALEN);
  20415. -+ if (i) {
  20416. -+ addr[0] |= BIT(1);
  20417. -+ addr[ETH_ALEN - 1] ^= i;
  20418. -+ }
  20419. -+ }
  20420. -+ wiphy->addresses = drvr->addresses;
  20421. -+ wiphy->n_addresses = i;
  20422. -+
  20423. - wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
  20424. - wiphy->cipher_suites = __wl_cipher_suites;
  20425. - wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites);
  20426. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20427. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20428. -@@ -21,6 +21,7 @@
  20429. - #ifndef BRCMFMAC_CORE_H
  20430. - #define BRCMFMAC_CORE_H
  20431. -
  20432. -+#include <net/cfg80211.h>
  20433. - #include "fweh.h"
  20434. -
  20435. - #define TOE_TX_CSUM_OL 0x00000001
  20436. -@@ -118,6 +119,8 @@ struct brcmf_pub {
  20437. - /* Multicast data packets sent to dongle */
  20438. - unsigned long tx_multicast;
  20439. -
  20440. -+ struct mac_address addresses[BRCMF_MAX_IFS];
  20441. -+
  20442. - struct brcmf_if *iflist[BRCMF_MAX_IFS];
  20443. -
  20444. - struct mutex proto_block;
  20445. 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
  20446. deleted file mode 100644
  20447. index e44f121..0000000
  20448. --- a/package/kernel/mac80211/patches/362-brcmfmac-dhd_sdio.c-use-existing-atomic_or-primitive.patch
  20449. +++ /dev/null
  20450. @@ -1,45 +0,0 @@
  20451. -From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
  20452. -Date: Thu, 9 Jul 2015 13:43:18 +0530
  20453. -Subject: [PATCH] brcmfmac: dhd_sdio.c: use existing atomic_or primitive
  20454. -
  20455. -There's already a generic implementation so use that instead.
  20456. -
  20457. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  20458. ----
  20459. -
  20460. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  20461. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  20462. -@@ -2564,15 +2564,6 @@ static inline void brcmf_sdio_clrintr(st
  20463. - }
  20464. - }
  20465. -
  20466. --static void atomic_orr(int val, atomic_t *v)
  20467. --{
  20468. -- int old_val;
  20469. --
  20470. -- old_val = atomic_read(v);
  20471. -- while (atomic_cmpxchg(v, old_val, val | old_val) != old_val)
  20472. -- old_val = atomic_read(v);
  20473. --}
  20474. --
  20475. - static int brcmf_sdio_intr_rstatus(struct brcmf_sdio *bus)
  20476. - {
  20477. - struct brcmf_core *buscore;
  20478. -@@ -2595,7 +2586,7 @@ static int brcmf_sdio_intr_rstatus(struc
  20479. - if (val) {
  20480. - brcmf_sdiod_regwl(bus->sdiodev, addr, val, &ret);
  20481. - bus->sdcnt.f1regdata++;
  20482. -- atomic_orr(val, &bus->intstatus);
  20483. -+ atomic_or(val, &bus->intstatus);
  20484. - }
  20485. -
  20486. - return ret;
  20487. -@@ -2712,7 +2703,7 @@ static void brcmf_sdio_dpc(struct brcmf_
  20488. -
  20489. - /* Keep still-pending events for next scheduling */
  20490. - if (intstatus)
  20491. -- atomic_orr(intstatus, &bus->intstatus);
  20492. -+ atomic_or(intstatus, &bus->intstatus);
  20493. -
  20494. - brcmf_sdio_clrintr(bus);
  20495. -
  20496. 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
  20497. deleted file mode 100644
  20498. index 76ca143..0000000
  20499. --- a/package/kernel/mac80211/patches/363-0001-brcmfmac-check-all-combinations-when-setting-wiphy-s.patch
  20500. +++ /dev/null
  20501. @@ -1,46 +0,0 @@
  20502. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  20503. -Date: Thu, 20 Aug 2015 00:16:42 +0200
  20504. -Subject: [PATCH] brcmfmac: check all combinations when setting wiphy's
  20505. - addresses
  20506. -MIME-Version: 1.0
  20507. -Content-Type: text/plain; charset=UTF-8
  20508. -Content-Transfer-Encoding: 8bit
  20509. -
  20510. -Broadcom is working on better reflection of interface combinations. With
  20511. -upcoming patches we may have 1st combination supporting less interfaces
  20512. -than others.
  20513. -To don't run out of addresses check all combinations to find the one
  20514. -with the greatest max_interfaces value.
  20515. -
  20516. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  20517. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  20518. ----
  20519. -
  20520. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  20521. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  20522. -@@ -5785,7 +5785,9 @@ static void brcmf_wiphy_wowl_params(stru
  20523. - static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
  20524. - {
  20525. - struct brcmf_pub *drvr = ifp->drvr;
  20526. -+ const struct ieee80211_iface_combination *combo;
  20527. - struct ieee80211_supported_band *band;
  20528. -+ u16 max_interfaces = 0;
  20529. - __le32 bandlist[3];
  20530. - u32 n_bands;
  20531. - int err, i;
  20532. -@@ -5798,8 +5800,13 @@ static int brcmf_setup_wiphy(struct wiph
  20533. - if (err)
  20534. - return err;
  20535. -
  20536. -- for (i = 0; i < wiphy->iface_combinations->max_interfaces &&
  20537. -- i < ARRAY_SIZE(drvr->addresses); i++) {
  20538. -+ for (i = 0, combo = wiphy->iface_combinations;
  20539. -+ i < wiphy->n_iface_combinations; i++, combo++) {
  20540. -+ max_interfaces = max(max_interfaces, combo->max_interfaces);
  20541. -+ }
  20542. -+
  20543. -+ for (i = 0; i < max_interfaces && i < ARRAY_SIZE(drvr->addresses);
  20544. -+ i++) {
  20545. - u8 *addr = drvr->addresses[i].addr;
  20546. -
  20547. - memcpy(addr, drvr->mac, ETH_ALEN);
  20548. 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
  20549. deleted file mode 100644
  20550. index c4a0720..0000000
  20551. --- a/package/kernel/mac80211/patches/363-0002-brcmfmac-correct-interface-combination-info.patch
  20552. +++ /dev/null
  20553. @@ -1,204 +0,0 @@
  20554. -From: Arend van Spriel <arend@broadcom.com>
  20555. -Date: Thu, 20 Aug 2015 22:06:03 +0200
  20556. -Subject: [PATCH] brcmfmac: correct interface combination info
  20557. -
  20558. -The interface combination provided by brcmfmac did not truly reflect
  20559. -the combinations supported by driver and/or firmware.
  20560. -
  20561. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20562. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20563. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20564. -Reviewed-by: Pontus Fuchs <pontusf@broadcom.com>
  20565. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20566. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  20567. ----
  20568. -
  20569. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  20570. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  20571. -@@ -5694,63 +5694,132 @@ brcmf_txrx_stypes[NUM_NL80211_IFTYPES] =
  20572. - }
  20573. - };
  20574. -
  20575. -+/**
  20576. -+ * brcmf_setup_ifmodes() - determine interface modes and combinations.
  20577. -+ *
  20578. -+ * @wiphy: wiphy object.
  20579. -+ * @ifp: interface object needed for feat module api.
  20580. -+ *
  20581. -+ * The interface modes and combinations are determined dynamically here
  20582. -+ * based on firmware functionality.
  20583. -+ *
  20584. -+ * no p2p and no mbss:
  20585. -+ *
  20586. -+ * #STA <= 1, #AP <= 1, channels = 1, 2 total
  20587. -+ *
  20588. -+ * no p2p and mbss:
  20589. -+ *
  20590. -+ * #STA <= 1, #AP <= 1, channels = 1, 2 total
  20591. -+ * #AP <= 4, matching BI, channels = 1, 4 total
  20592. -+ *
  20593. -+ * p2p, no mchan, and mbss:
  20594. -+ *
  20595. -+ * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 1, 3 total
  20596. -+ * #STA <= 1, #P2P-DEV <= 1, #AP <= 1, #P2P-CL <= 1, channels = 1, 4 total
  20597. -+ * #AP <= 4, matching BI, channels = 1, 4 total
  20598. -+ *
  20599. -+ * p2p, mchan, and mbss:
  20600. -+ *
  20601. -+ * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 2, 3 total
  20602. -+ * #STA <= 1, #P2P-DEV <= 1, #AP <= 1, #P2P-CL <= 1, channels = 1, 4 total
  20603. -+ * #AP <= 4, matching BI, channels = 1, 4 total
  20604. -+ */
  20605. - static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp)
  20606. - {
  20607. - struct ieee80211_iface_combination *combo = NULL;
  20608. -- struct ieee80211_iface_limit *limits = NULL;
  20609. -- int i = 0, max_iface_cnt;
  20610. -+ struct ieee80211_iface_limit *c0_limits = NULL;
  20611. -+ struct ieee80211_iface_limit *p2p_limits = NULL;
  20612. -+ struct ieee80211_iface_limit *mbss_limits = NULL;
  20613. -+ bool mbss, p2p;
  20614. -+ int i, c, n_combos;
  20615. -
  20616. -- combo = kzalloc(sizeof(*combo), GFP_KERNEL);
  20617. -+ mbss = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS);
  20618. -+ p2p = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P);
  20619. -+
  20620. -+ n_combos = 1 + !!p2p + !!mbss;
  20621. -+ combo = kcalloc(n_combos, sizeof(*combo), GFP_KERNEL);
  20622. - if (!combo)
  20623. - goto err;
  20624. -
  20625. -- limits = kzalloc(sizeof(*limits) * 4, GFP_KERNEL);
  20626. -- if (!limits)
  20627. -+ c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
  20628. -+ if (!c0_limits)
  20629. - goto err;
  20630. -
  20631. -+ if (p2p) {
  20632. -+ p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
  20633. -+ if (!p2p_limits)
  20634. -+ goto err;
  20635. -+ }
  20636. -+
  20637. -+ if (mbss) {
  20638. -+ mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
  20639. -+ if (!mbss_limits)
  20640. -+ goto err;
  20641. -+ }
  20642. -+
  20643. - wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  20644. - BIT(NL80211_IFTYPE_ADHOC) |
  20645. - BIT(NL80211_IFTYPE_AP);
  20646. -
  20647. -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  20648. -- combo->num_different_channels = 2;
  20649. -- else
  20650. -- combo->num_different_channels = 1;
  20651. --
  20652. -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) {
  20653. -- limits[i].max = 1;
  20654. -- limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  20655. -- limits[i].max = 4;
  20656. -- limits[i++].types = BIT(NL80211_IFTYPE_AP);
  20657. -- max_iface_cnt = 5;
  20658. -- } else {
  20659. -- limits[i].max = 2;
  20660. -- limits[i++].types = BIT(NL80211_IFTYPE_STATION) |
  20661. -- BIT(NL80211_IFTYPE_AP);
  20662. -- max_iface_cnt = 2;
  20663. -- }
  20664. --
  20665. -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P)) {
  20666. -+ c = 0;
  20667. -+ i = 0;
  20668. -+ combo[c].num_different_channels = 1;
  20669. -+ c0_limits[i].max = 1;
  20670. -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  20671. -+ if (p2p) {
  20672. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  20673. -+ combo[c].num_different_channels = 2;
  20674. - wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) |
  20675. - BIT(NL80211_IFTYPE_P2P_GO) |
  20676. - BIT(NL80211_IFTYPE_P2P_DEVICE);
  20677. -- limits[i].max = 1;
  20678. -- limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  20679. -- BIT(NL80211_IFTYPE_P2P_GO);
  20680. -- limits[i].max = 1;
  20681. -- limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  20682. -- max_iface_cnt += 2;
  20683. -- }
  20684. -- combo->max_interfaces = max_iface_cnt;
  20685. -- combo->limits = limits;
  20686. -- combo->n_limits = i;
  20687. -+ c0_limits[i].max = 1;
  20688. -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  20689. -+ c0_limits[i].max = 1;
  20690. -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  20691. -+ BIT(NL80211_IFTYPE_P2P_GO);
  20692. -+ } else {
  20693. -+ c0_limits[i].max = 1;
  20694. -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  20695. -+ }
  20696. -+ combo[c].max_interfaces = i;
  20697. -+ combo[c].n_limits = i;
  20698. -+ combo[c].limits = c0_limits;
  20699. -+
  20700. -+ if (p2p) {
  20701. -+ c++;
  20702. -+ i = 0;
  20703. -+ combo[c].num_different_channels = 1;
  20704. -+ p2p_limits[i].max = 1;
  20705. -+ p2p_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  20706. -+ p2p_limits[i].max = 1;
  20707. -+ p2p_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  20708. -+ p2p_limits[i].max = 1;
  20709. -+ p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT);
  20710. -+ p2p_limits[i].max = 1;
  20711. -+ p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  20712. -+ combo[c].max_interfaces = i;
  20713. -+ combo[c].n_limits = i;
  20714. -+ combo[c].limits = p2p_limits;
  20715. -+ }
  20716. -
  20717. -+ if (mbss) {
  20718. -+ c++;
  20719. -+ combo[c].beacon_int_infra_match = true;
  20720. -+ combo[c].num_different_channels = 1;
  20721. -+ mbss_limits[0].max = 4;
  20722. -+ mbss_limits[0].types = BIT(NL80211_IFTYPE_AP);
  20723. -+ combo[c].max_interfaces = 4;
  20724. -+ combo[c].n_limits = 1;
  20725. -+ combo[c].limits = mbss_limits;
  20726. -+ }
  20727. -+ wiphy->n_iface_combinations = n_combos;
  20728. - wiphy->iface_combinations = combo;
  20729. -- wiphy->n_iface_combinations = 1;
  20730. - return 0;
  20731. -
  20732. - err:
  20733. -- kfree(limits);
  20734. -+ kfree(c0_limits);
  20735. -+ kfree(p2p_limits);
  20736. -+ kfree(mbss_limits);
  20737. - kfree(combo);
  20738. - return -ENOMEM;
  20739. - }
  20740. -@@ -6079,11 +6148,15 @@ static void brcmf_cfg80211_reg_notifier(
  20741. -
  20742. - static void brcmf_free_wiphy(struct wiphy *wiphy)
  20743. - {
  20744. -+ int i;
  20745. -+
  20746. - if (!wiphy)
  20747. - return;
  20748. -
  20749. -- if (wiphy->iface_combinations)
  20750. -- kfree(wiphy->iface_combinations->limits);
  20751. -+ if (wiphy->iface_combinations) {
  20752. -+ for (i = 0; i < wiphy->n_iface_combinations; i++)
  20753. -+ kfree(wiphy->iface_combinations[i].limits);
  20754. -+ }
  20755. - kfree(wiphy->iface_combinations);
  20756. - if (wiphy->bands[IEEE80211_BAND_2GHZ]) {
  20757. - kfree(wiphy->bands[IEEE80211_BAND_2GHZ]->channels);
  20758. 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
  20759. deleted file mode 100644
  20760. index 9768ef2..0000000
  20761. --- a/package/kernel/mac80211/patches/363-0003-brcmfmac-add-debugfs-entry-for-msgbuf-statistics.patch
  20762. +++ /dev/null
  20763. @@ -1,87 +0,0 @@
  20764. -From: Franky Lin <frankyl@broadcom.com>
  20765. -Date: Thu, 20 Aug 2015 22:06:04 +0200
  20766. -Subject: [PATCH] brcmfmac: add debugfs entry for msgbuf statistics
  20767. -
  20768. -Expose ring buffer read/write pointers and other useful statistics
  20769. -through debugfs.
  20770. -
  20771. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  20772. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20773. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20774. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  20775. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20776. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  20777. ----
  20778. -
  20779. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  20780. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  20781. -@@ -1360,6 +1360,60 @@ void brcmf_msgbuf_delete_flowring(struct
  20782. - }
  20783. - }
  20784. -
  20785. -+#ifdef DEBUG
  20786. -+static int brcmf_msgbuf_stats_read(struct seq_file *seq, void *data)
  20787. -+{
  20788. -+ struct brcmf_bus *bus_if = dev_get_drvdata(seq->private);
  20789. -+ struct brcmf_pub *drvr = bus_if->drvr;
  20790. -+ struct brcmf_msgbuf *msgbuf = (struct brcmf_msgbuf *)drvr->proto->pd;
  20791. -+ struct brcmf_commonring *commonring;
  20792. -+ u16 i;
  20793. -+ struct brcmf_flowring_ring *ring;
  20794. -+ struct brcmf_flowring_hash *hash;
  20795. -+
  20796. -+ commonring = msgbuf->commonrings[BRCMF_H2D_MSGRING_CONTROL_SUBMIT];
  20797. -+ seq_printf(seq, "h2d_ctl_submit: rp %4u, wp %4u, depth %4u\n",
  20798. -+ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  20799. -+ commonring = msgbuf->commonrings[BRCMF_H2D_MSGRING_RXPOST_SUBMIT];
  20800. -+ seq_printf(seq, "h2d_rx_submit: rp %4u, wp %4u, depth %4u\n",
  20801. -+ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  20802. -+ commonring = msgbuf->commonrings[BRCMF_D2H_MSGRING_CONTROL_COMPLETE];
  20803. -+ seq_printf(seq, "d2h_ctl_cmplt: rp %4u, wp %4u, depth %4u\n",
  20804. -+ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  20805. -+ commonring = msgbuf->commonrings[BRCMF_D2H_MSGRING_TX_COMPLETE];
  20806. -+ seq_printf(seq, "d2h_tx_cmplt: rp %4u, wp %4u, depth %4u\n",
  20807. -+ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  20808. -+ commonring = msgbuf->commonrings[BRCMF_D2H_MSGRING_RX_COMPLETE];
  20809. -+ seq_printf(seq, "d2h_rx_cmplt: rp %4u, wp %4u, depth %4u\n",
  20810. -+ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  20811. -+
  20812. -+ seq_printf(seq, "\nh2d_flowrings: depth %u\n",
  20813. -+ BRCMF_H2D_TXFLOWRING_MAX_ITEM);
  20814. -+ seq_puts(seq, "Active flowrings:\n");
  20815. -+ hash = msgbuf->flow->hash;
  20816. -+ for (i = 0; i < msgbuf->flow->nrofrings; i++) {
  20817. -+ if (!msgbuf->flow->rings[i])
  20818. -+ continue;
  20819. -+ ring = msgbuf->flow->rings[i];
  20820. -+ if (ring->status != RING_OPEN)
  20821. -+ continue;
  20822. -+ commonring = msgbuf->flowrings[i];
  20823. -+ hash = &msgbuf->flow->hash[ring->hash_id];
  20824. -+ seq_printf(seq, "id %3u: rp %4u, wp %4u, qlen %4u, blocked %u\n"
  20825. -+ " ifidx %u, fifo %u, da %pM\n",
  20826. -+ i, commonring->r_ptr, commonring->w_ptr,
  20827. -+ skb_queue_len(&ring->skblist), ring->blocked,
  20828. -+ hash->ifidx, hash->fifo, hash->mac);
  20829. -+ }
  20830. -+
  20831. -+ return 0;
  20832. -+}
  20833. -+#else
  20834. -+static int brcmf_msgbuf_stats_read(struct seq_file *seq, void *data)
  20835. -+{
  20836. -+ return 0;
  20837. -+}
  20838. -+#endif
  20839. -
  20840. - int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr)
  20841. - {
  20842. -@@ -1460,6 +1514,8 @@ int brcmf_proto_msgbuf_attach(struct brc
  20843. - spin_lock_init(&msgbuf->flowring_work_lock);
  20844. - INIT_LIST_HEAD(&msgbuf->work_queue);
  20845. -
  20846. -+ brcmf_debugfs_add_entry(drvr, "msgbuf_stats", brcmf_msgbuf_stats_read);
  20847. -+
  20848. - return 0;
  20849. -
  20850. - fail:
  20851. 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
  20852. deleted file mode 100644
  20853. index 2b84cf9..0000000
  20854. --- a/package/kernel/mac80211/patches/363-0004-brcmfmac-make-use-of-cfg80211_check_combinations.patch
  20855. +++ /dev/null
  20856. @@ -1,83 +0,0 @@
  20857. -From: Arend van Spriel <arend@broadcom.com>
  20858. -Date: Thu, 20 Aug 2015 22:06:05 +0200
  20859. -Subject: [PATCH] brcmfmac: make use of cfg80211_check_combinations()
  20860. -
  20861. -Use cfg80211_check_combinations() so we can bail out early when an
  20862. -interface add or change results in an invalid combination.
  20863. -
  20864. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20865. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20866. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20867. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20868. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  20869. ----
  20870. -
  20871. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  20872. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  20873. -@@ -469,6 +469,36 @@ brcmf_find_wpsie(const u8 *parse, u32 le
  20874. - return NULL;
  20875. - }
  20876. -
  20877. -+static int brcmf_vif_change_validate(struct brcmf_cfg80211_info *cfg,
  20878. -+ struct brcmf_cfg80211_vif *vif,
  20879. -+ enum nl80211_iftype new_type)
  20880. -+{
  20881. -+ int iftype_num[NUM_NL80211_IFTYPES];
  20882. -+ struct brcmf_cfg80211_vif *pos;
  20883. -+
  20884. -+ memset(&iftype_num[0], 0, sizeof(iftype_num));
  20885. -+ list_for_each_entry(pos, &cfg->vif_list, list)
  20886. -+ if (pos == vif)
  20887. -+ iftype_num[new_type]++;
  20888. -+ else
  20889. -+ iftype_num[pos->wdev.iftype]++;
  20890. -+
  20891. -+ return cfg80211_check_combinations(cfg->wiphy, 1, 0, iftype_num);
  20892. -+}
  20893. -+
  20894. -+static int brcmf_vif_add_validate(struct brcmf_cfg80211_info *cfg,
  20895. -+ enum nl80211_iftype new_type)
  20896. -+{
  20897. -+ int iftype_num[NUM_NL80211_IFTYPES];
  20898. -+ struct brcmf_cfg80211_vif *pos;
  20899. -+
  20900. -+ memset(&iftype_num[0], 0, sizeof(iftype_num));
  20901. -+ list_for_each_entry(pos, &cfg->vif_list, list)
  20902. -+ iftype_num[pos->wdev.iftype]++;
  20903. -+
  20904. -+ iftype_num[new_type]++;
  20905. -+ return cfg80211_check_combinations(cfg->wiphy, 1, 0, iftype_num);
  20906. -+}
  20907. -
  20908. - static void convert_key_from_CPU(struct brcmf_wsec_key *key,
  20909. - struct brcmf_wsec_key_le *key_le)
  20910. -@@ -662,8 +692,14 @@ static struct wireless_dev *brcmf_cfg802
  20911. - struct vif_params *params)
  20912. - {
  20913. - struct wireless_dev *wdev;
  20914. -+ int err;
  20915. -
  20916. - brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
  20917. -+ err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
  20918. -+ if (err) {
  20919. -+ brcmf_err("iface validation failed: err=%d\n", err);
  20920. -+ return ERR_PTR(err);
  20921. -+ }
  20922. - switch (type) {
  20923. - case NL80211_IFTYPE_ADHOC:
  20924. - case NL80211_IFTYPE_STATION:
  20925. -@@ -822,8 +858,12 @@ brcmf_cfg80211_change_iface(struct wiphy
  20926. - s32 ap = 0;
  20927. - s32 err = 0;
  20928. -
  20929. -- brcmf_dbg(TRACE, "Enter, ndev=%p, type=%d\n", ndev, type);
  20930. --
  20931. -+ brcmf_dbg(TRACE, "Enter, idx=%d, type=%d\n", ifp->bssidx, type);
  20932. -+ err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type);
  20933. -+ if (err) {
  20934. -+ brcmf_err("iface validation failed: err=%d\n", err);
  20935. -+ return err;
  20936. -+ }
  20937. - switch (type) {
  20938. - case NL80211_IFTYPE_MONITOR:
  20939. - case NL80211_IFTYPE_WDS:
  20940. 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
  20941. deleted file mode 100644
  20942. index 2d5f7b9..0000000
  20943. --- a/package/kernel/mac80211/patches/363-0005-brcmfmac-block-the-correct-flowring-when-backup-queu.patch
  20944. +++ /dev/null
  20945. @@ -1,48 +0,0 @@
  20946. -From: Franky Lin <frankyl@broadcom.com>
  20947. -Date: Thu, 20 Aug 2015 22:06:06 +0200
  20948. -Subject: [PATCH] brcmfmac: block the correct flowring when backup queue
  20949. - overflow
  20950. -
  20951. -brcmf_flowring_block blocks the last active flowring under the same
  20952. -interface instead of the one provided by caller. This could lead to a
  20953. -dead lock of netif stop if there are more than one flowring under the
  20954. -interface and the traffic is high enough so brcmf_flowring_enqueue can
  20955. -not unblock the ring right away.
  20956. -
  20957. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20958. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20959. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  20960. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20961. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  20962. ----
  20963. -
  20964. ---- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  20965. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  20966. -@@ -194,11 +194,15 @@ static void brcmf_flowring_block(struct
  20967. - spin_lock_irqsave(&flow->block_lock, flags);
  20968. -
  20969. - ring = flow->rings[flowid];
  20970. -+ if (ring->blocked == blocked) {
  20971. -+ spin_unlock_irqrestore(&flow->block_lock, flags);
  20972. -+ return;
  20973. -+ }
  20974. - ifidx = brcmf_flowring_ifidx_get(flow, flowid);
  20975. -
  20976. - currently_blocked = false;
  20977. - for (i = 0; i < flow->nrofrings; i++) {
  20978. -- if (flow->rings[i]) {
  20979. -+ if ((flow->rings[i]) && (i != flowid)) {
  20980. - ring = flow->rings[i];
  20981. - if ((ring->status == RING_OPEN) &&
  20982. - (brcmf_flowring_ifidx_get(flow, i) == ifidx)) {
  20983. -@@ -209,8 +213,8 @@ static void brcmf_flowring_block(struct
  20984. - }
  20985. - }
  20986. - }
  20987. -- ring->blocked = blocked;
  20988. -- if (currently_blocked == blocked) {
  20989. -+ flow->rings[flowid]->blocked = blocked;
  20990. -+ if (currently_blocked) {
  20991. - spin_unlock_irqrestore(&flow->block_lock, flags);
  20992. - return;
  20993. - }
  20994. 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
  20995. deleted file mode 100644
  20996. index 7378401..0000000
  20997. --- a/package/kernel/mac80211/patches/363-0006-brcmfmac-bump-highest-event-number-for-4339-firmware.patch
  20998. +++ /dev/null
  20999. @@ -1,52 +0,0 @@
  21000. -From: Arend van Spriel <arend@broadcom.com>
  21001. -Date: Thu, 20 Aug 2015 22:06:07 +0200
  21002. -Subject: [PATCH] brcmfmac: bump highest event number for 4339 firmware
  21003. -
  21004. -The event mask length is determined by the highest event number
  21005. -that is specified in the driver. When this length is shorter than
  21006. -firmware expects setting event mask will fail and device becomes
  21007. -pretty useless. This issue was reported with bcm4339 firmware that
  21008. -was recently released.
  21009. -
  21010. -Reported-by: Pontus Fuchs <pontusf@broadcom.com>
  21011. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  21012. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  21013. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  21014. -Reviewed-by: Pontus Fuchs <pontusf@broadcom.com>
  21015. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  21016. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  21017. ----
  21018. -
  21019. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  21020. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  21021. -@@ -85,7 +85,6 @@ struct brcmf_event;
  21022. - BRCMF_ENUM_DEF(IF, 54) \
  21023. - BRCMF_ENUM_DEF(P2P_DISC_LISTEN_COMPLETE, 55) \
  21024. - BRCMF_ENUM_DEF(RSSI, 56) \
  21025. -- BRCMF_ENUM_DEF(PFN_SCAN_COMPLETE, 57) \
  21026. - BRCMF_ENUM_DEF(EXTLOG_MSG, 58) \
  21027. - BRCMF_ENUM_DEF(ACTION_FRAME, 59) \
  21028. - BRCMF_ENUM_DEF(ACTION_FRAME_COMPLETE, 60) \
  21029. -@@ -103,8 +102,7 @@ struct brcmf_event;
  21030. - BRCMF_ENUM_DEF(FIFO_CREDIT_MAP, 74) \
  21031. - BRCMF_ENUM_DEF(ACTION_FRAME_RX, 75) \
  21032. - BRCMF_ENUM_DEF(TDLS_PEER_EVENT, 92) \
  21033. -- BRCMF_ENUM_DEF(BCMC_CREDIT_SUPPORT, 127) \
  21034. -- BRCMF_ENUM_DEF(PSTA_PRIMARY_INTF_IND, 128)
  21035. -+ BRCMF_ENUM_DEF(BCMC_CREDIT_SUPPORT, 127)
  21036. -
  21037. - #define BRCMF_ENUM_DEF(id, val) \
  21038. - BRCMF_E_##id = (val),
  21039. -@@ -112,7 +110,11 @@ struct brcmf_event;
  21040. - /* firmware event codes sent by the dongle */
  21041. - enum brcmf_fweh_event_code {
  21042. - BRCMF_FWEH_EVENT_ENUM_DEFLIST
  21043. -- BRCMF_E_LAST
  21044. -+ /* this determines event mask length which must match
  21045. -+ * minimum length check in device firmware so it is
  21046. -+ * hard-coded here.
  21047. -+ */
  21048. -+ BRCMF_E_LAST = 139
  21049. - };
  21050. - #undef BRCMF_ENUM_DEF
  21051. -
  21052. 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
  21053. deleted file mode 100644
  21054. index 97444b3..0000000
  21055. --- a/package/kernel/mac80211/patches/365-0001-brcmfmac-consolidate-ifp-lookup-in-driver-core.patch
  21056. +++ /dev/null
  21057. @@ -1,138 +0,0 @@
  21058. -From: Arend van Spriel <arend@broadcom.com>
  21059. -Date: Wed, 26 Aug 2015 22:14:53 +0200
  21060. -Subject: [PATCH] brcmfmac: consolidate ifp lookup in driver core
  21061. -
  21062. -In rx path the firmware provide an interface index which is used to
  21063. -map to a struct brcmf_if instance. However, this involves some trick
  21064. -that is done in two places. This is changed by having driver core
  21065. -providing brcmf_get_ifp() function.
  21066. -
  21067. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  21068. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  21069. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  21070. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  21071. ----
  21072. -
  21073. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  21074. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  21075. -@@ -276,6 +276,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  21076. - struct sk_buff *pktbuf)
  21077. - {
  21078. - struct brcmf_proto_bcdc_header *h;
  21079. -+ struct brcmf_if *ifp;
  21080. -
  21081. - brcmf_dbg(BCDC, "Enter\n");
  21082. -
  21083. -@@ -289,30 +290,21 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  21084. - trace_brcmf_bcdchdr(pktbuf->data);
  21085. - h = (struct brcmf_proto_bcdc_header *)(pktbuf->data);
  21086. -
  21087. -- *ifidx = BCDC_GET_IF_IDX(h);
  21088. -- if (*ifidx >= BRCMF_MAX_IFS) {
  21089. -- brcmf_err("rx data ifnum out of range (%d)\n", *ifidx);
  21090. -+ ifp = brcmf_get_ifp(drvr, BCDC_GET_IF_IDX(h));
  21091. -+ if (IS_ERR_OR_NULL(ifp)) {
  21092. -+ brcmf_dbg(INFO, "no matching ifp found\n");
  21093. - return -EBADE;
  21094. - }
  21095. -- /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  21096. -- * events this is easy because it contains the bssidx which maps
  21097. -- * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  21098. -- * bssidx 1 is used for p2p0 and no data can be received or
  21099. -- * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  21100. -- */
  21101. -- if (*ifidx)
  21102. -- (*ifidx)++;
  21103. --
  21104. - if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) !=
  21105. - BCDC_PROTO_VER) {
  21106. - brcmf_err("%s: non-BCDC packet received, flags 0x%x\n",
  21107. -- brcmf_ifname(drvr, *ifidx), h->flags);
  21108. -+ brcmf_ifname(drvr, ifp->ifidx), h->flags);
  21109. - return -EBADE;
  21110. - }
  21111. -
  21112. - if (h->flags & BCDC_FLAG_SUM_GOOD) {
  21113. - brcmf_dbg(BCDC, "%s: BDC rcv, good checksum, flags 0x%x\n",
  21114. -- brcmf_ifname(drvr, *ifidx), h->flags);
  21115. -+ brcmf_ifname(drvr, ifp->ifidx), h->flags);
  21116. - pktbuf->ip_summed = CHECKSUM_UNNECESSARY;
  21117. - }
  21118. -
  21119. -@@ -320,12 +312,15 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  21120. -
  21121. - skb_pull(pktbuf, BCDC_HEADER_LEN);
  21122. - if (do_fws)
  21123. -- brcmf_fws_hdrpull(drvr, *ifidx, h->data_offset << 2, pktbuf);
  21124. -+ brcmf_fws_hdrpull(drvr, ifp->ifidx, h->data_offset << 2,
  21125. -+ pktbuf);
  21126. - else
  21127. - skb_pull(pktbuf, h->data_offset << 2);
  21128. -
  21129. - if (pktbuf->len == 0)
  21130. - return -ENODATA;
  21131. -+
  21132. -+ *ifidx = ifp->ifidx;
  21133. - return 0;
  21134. - }
  21135. -
  21136. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  21137. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  21138. -@@ -83,6 +83,25 @@ char *brcmf_ifname(struct brcmf_pub *drv
  21139. - return "<if_none>";
  21140. - }
  21141. -
  21142. -+struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx)
  21143. -+{
  21144. -+ if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  21145. -+ brcmf_err("ifidx %d out of range\n", ifidx);
  21146. -+ return ERR_PTR(-ERANGE);
  21147. -+ }
  21148. -+
  21149. -+ /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  21150. -+ * events this is easy because it contains the bssidx which maps
  21151. -+ * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  21152. -+ * bssidx 1 is used for p2p0 and no data can be received or
  21153. -+ * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  21154. -+ */
  21155. -+ if (ifidx)
  21156. -+ ifidx++;
  21157. -+
  21158. -+ return drvr->iflist[ifidx];
  21159. -+}
  21160. -+
  21161. - static void _brcmf_set_multicast_list(struct work_struct *work)
  21162. - {
  21163. - struct brcmf_if *ifp;
  21164. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  21165. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  21166. -@@ -202,7 +202,7 @@ int brcmf_netdev_wait_pend8021x(struct b
  21167. -
  21168. - /* Return pointer to interface name */
  21169. - char *brcmf_ifname(struct brcmf_pub *drvr, int idx);
  21170. --
  21171. -+struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  21172. - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  21173. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  21174. - char *name, u8 *mac_addr);
  21175. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  21176. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  21177. -@@ -1081,16 +1081,8 @@ brcmf_msgbuf_rx_skb(struct brcmf_msgbuf
  21178. - {
  21179. - struct brcmf_if *ifp;
  21180. -
  21181. -- /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  21182. -- * events this is easy because it contains the bssidx which maps
  21183. -- * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  21184. -- * bssidx 1 is used for p2p0 and no data can be received or
  21185. -- * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  21186. -- */
  21187. -- if (ifidx)
  21188. -- (ifidx)++;
  21189. -- ifp = msgbuf->drvr->iflist[ifidx];
  21190. -- if (!ifp || !ifp->ndev) {
  21191. -+ ifp = brcmf_get_ifp(msgbuf->drvr, ifidx);
  21192. -+ if (IS_ERR_OR_NULL(ifp) || !ifp->ndev) {
  21193. - brcmf_err("Received pkt for invalid ifidx %d\n", ifidx);
  21194. - brcmu_pkt_buf_free_skb(skb);
  21195. - return;
  21196. 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
  21197. deleted file mode 100644
  21198. index 632714c..0000000
  21199. --- a/package/kernel/mac80211/patches/365-0002-brcmfmac-make-brcmf_proto_hdrpull-return-struct-brcm.patch
  21200. +++ /dev/null
  21201. @@ -1,222 +0,0 @@
  21202. -From: Arend van Spriel <arend@broadcom.com>
  21203. -Date: Wed, 26 Aug 2015 22:14:54 +0200
  21204. -Subject: [PATCH] brcmfmac: make brcmf_proto_hdrpull() return struct
  21205. - brcmf_if instance
  21206. -
  21207. -Avoid spreading the ifidx in the driver, but have it return the
  21208. -struct brcmf_if instance.
  21209. -
  21210. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  21211. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  21212. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  21213. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  21214. ----
  21215. -
  21216. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  21217. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  21218. -@@ -272,11 +272,11 @@ brcmf_proto_bcdc_hdrpush(struct brcmf_pu
  21219. - }
  21220. -
  21221. - static int
  21222. --brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool do_fws, u8 *ifidx,
  21223. -- struct sk_buff *pktbuf)
  21224. -+brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool do_fws,
  21225. -+ struct sk_buff *pktbuf, struct brcmf_if **ifp)
  21226. - {
  21227. - struct brcmf_proto_bcdc_header *h;
  21228. -- struct brcmf_if *ifp;
  21229. -+ struct brcmf_if *tmp_if;
  21230. -
  21231. - brcmf_dbg(BCDC, "Enter\n");
  21232. -
  21233. -@@ -290,21 +290,21 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  21234. - trace_brcmf_bcdchdr(pktbuf->data);
  21235. - h = (struct brcmf_proto_bcdc_header *)(pktbuf->data);
  21236. -
  21237. -- ifp = brcmf_get_ifp(drvr, BCDC_GET_IF_IDX(h));
  21238. -- if (IS_ERR_OR_NULL(ifp)) {
  21239. -+ tmp_if = brcmf_get_ifp(drvr, BCDC_GET_IF_IDX(h));
  21240. -+ if (!tmp_if) {
  21241. - brcmf_dbg(INFO, "no matching ifp found\n");
  21242. - return -EBADE;
  21243. - }
  21244. - if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) !=
  21245. - BCDC_PROTO_VER) {
  21246. - brcmf_err("%s: non-BCDC packet received, flags 0x%x\n",
  21247. -- brcmf_ifname(drvr, ifp->ifidx), h->flags);
  21248. -+ brcmf_ifname(drvr, tmp_if->ifidx), h->flags);
  21249. - return -EBADE;
  21250. - }
  21251. -
  21252. - if (h->flags & BCDC_FLAG_SUM_GOOD) {
  21253. - brcmf_dbg(BCDC, "%s: BDC rcv, good checksum, flags 0x%x\n",
  21254. -- brcmf_ifname(drvr, ifp->ifidx), h->flags);
  21255. -+ brcmf_ifname(drvr, tmp_if->ifidx), h->flags);
  21256. - pktbuf->ip_summed = CHECKSUM_UNNECESSARY;
  21257. - }
  21258. -
  21259. -@@ -312,7 +312,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  21260. -
  21261. - skb_pull(pktbuf, BCDC_HEADER_LEN);
  21262. - if (do_fws)
  21263. -- brcmf_fws_hdrpull(drvr, ifp->ifidx, h->data_offset << 2,
  21264. -+ brcmf_fws_hdrpull(drvr, tmp_if->ifidx, h->data_offset << 2,
  21265. - pktbuf);
  21266. - else
  21267. - skb_pull(pktbuf, h->data_offset << 2);
  21268. -@@ -320,7 +320,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  21269. - if (pktbuf->len == 0)
  21270. - return -ENODATA;
  21271. -
  21272. -- *ifidx = ifp->ifidx;
  21273. -+ *ifp = tmp_if;
  21274. - return 0;
  21275. - }
  21276. -
  21277. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  21278. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  21279. -@@ -87,7 +87,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
  21280. - {
  21281. - if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  21282. - brcmf_err("ifidx %d out of range\n", ifidx);
  21283. -- return ERR_PTR(-ERANGE);
  21284. -+ return NULL;
  21285. - }
  21286. -
  21287. - /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  21288. -@@ -539,17 +539,15 @@ void brcmf_rx_frame(struct device *dev,
  21289. - struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  21290. - struct brcmf_pub *drvr = bus_if->drvr;
  21291. - struct brcmf_skb_reorder_data *rd;
  21292. -- u8 ifidx;
  21293. - int ret;
  21294. -
  21295. - brcmf_dbg(DATA, "Enter: %s: rxp=%p\n", dev_name(dev), skb);
  21296. -
  21297. - /* process and remove protocol-specific header */
  21298. -- ret = brcmf_proto_hdrpull(drvr, true, &ifidx, skb);
  21299. -- ifp = drvr->iflist[ifidx];
  21300. -+ ret = brcmf_proto_hdrpull(drvr, true, skb, &ifp);
  21301. -
  21302. - if (ret || !ifp || !ifp->ndev) {
  21303. -- if ((ret != -ENODATA) && ifp)
  21304. -+ if (ret != -ENODATA && ifp)
  21305. - ifp->stats.rx_errors++;
  21306. - brcmu_pkt_buf_free_skb(skb);
  21307. - return;
  21308. -@@ -592,17 +590,17 @@ void brcmf_txcomplete(struct device *dev
  21309. - {
  21310. - struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  21311. - struct brcmf_pub *drvr = bus_if->drvr;
  21312. -- u8 ifidx;
  21313. -+ struct brcmf_if *ifp;
  21314. -
  21315. - /* await txstatus signal for firmware if active */
  21316. - if (brcmf_fws_fc_active(drvr->fws)) {
  21317. - if (!success)
  21318. - brcmf_fws_bustxfail(drvr->fws, txp);
  21319. - } else {
  21320. -- if (brcmf_proto_hdrpull(drvr, false, &ifidx, txp))
  21321. -+ if (brcmf_proto_hdrpull(drvr, false, txp, &ifp))
  21322. - brcmu_pkt_buf_free_skb(txp);
  21323. - else
  21324. -- brcmf_txfinalize(drvr, txp, ifidx, success);
  21325. -+ brcmf_txfinalize(drvr, txp, ifp->ifidx, success);
  21326. - }
  21327. - }
  21328. -
  21329. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  21330. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  21331. -@@ -1448,7 +1448,7 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  21332. - struct sk_buff *skb;
  21333. - struct brcmf_skbuff_cb *skcb;
  21334. - struct brcmf_fws_mac_descriptor *entry = NULL;
  21335. -- u8 ifidx;
  21336. -+ struct brcmf_if *ifp;
  21337. -
  21338. - brcmf_dbg(DATA, "flags %d\n", flags);
  21339. -
  21340. -@@ -1497,15 +1497,16 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  21341. - }
  21342. - brcmf_fws_macdesc_return_req_credit(skb);
  21343. -
  21344. -- if (brcmf_proto_hdrpull(fws->drvr, false, &ifidx, skb)) {
  21345. -+ ret = brcmf_proto_hdrpull(fws->drvr, false, skb, &ifp);
  21346. -+ if (ret) {
  21347. - brcmu_pkt_buf_free_skb(skb);
  21348. - return -EINVAL;
  21349. - }
  21350. - if (!remove_from_hanger)
  21351. -- ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifidx,
  21352. -+ ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
  21353. - genbit, seq);
  21354. - if (remove_from_hanger || ret)
  21355. -- brcmf_txfinalize(fws->drvr, skb, ifidx, true);
  21356. -+ brcmf_txfinalize(fws->drvr, skb, ifp->ifidx, true);
  21357. -
  21358. - return 0;
  21359. - }
  21360. -@@ -1848,7 +1849,7 @@ static int brcmf_fws_commit_skb(struct b
  21361. - entry->transit_count--;
  21362. - if (entry->suppressed)
  21363. - entry->suppr_transit_count--;
  21364. -- brcmf_proto_hdrpull(fws->drvr, false, &ifidx, skb);
  21365. -+ (void)brcmf_proto_hdrpull(fws->drvr, false, skb, NULL);
  21366. - goto rollback;
  21367. - }
  21368. -
  21369. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  21370. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  21371. -@@ -522,7 +522,7 @@ static int brcmf_msgbuf_set_dcmd(struct
  21372. -
  21373. -
  21374. - static int brcmf_msgbuf_hdrpull(struct brcmf_pub *drvr, bool do_fws,
  21375. -- u8 *ifidx, struct sk_buff *skb)
  21376. -+ struct sk_buff *skb, struct brcmf_if **ifp)
  21377. - {
  21378. - return -ENODEV;
  21379. - }
  21380. -@@ -1082,7 +1082,7 @@ brcmf_msgbuf_rx_skb(struct brcmf_msgbuf
  21381. - struct brcmf_if *ifp;
  21382. -
  21383. - ifp = brcmf_get_ifp(msgbuf->drvr, ifidx);
  21384. -- if (IS_ERR_OR_NULL(ifp) || !ifp->ndev) {
  21385. -+ if (!ifp || !ifp->ndev) {
  21386. - brcmf_err("Received pkt for invalid ifidx %d\n", ifidx);
  21387. - brcmu_pkt_buf_free_skb(skb);
  21388. - return;
  21389. ---- a/drivers/net/wireless/brcm80211/brcmfmac/proto.h
  21390. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/proto.h
  21391. -@@ -24,8 +24,8 @@ enum proto_addr_mode {
  21392. -
  21393. -
  21394. - struct brcmf_proto {
  21395. -- int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws, u8 *ifidx,
  21396. -- struct sk_buff *skb);
  21397. -+ int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws,
  21398. -+ struct sk_buff *skb, struct brcmf_if **ifp);
  21399. - int (*query_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd,
  21400. - void *buf, uint len);
  21401. - int (*set_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd, void *buf,
  21402. -@@ -46,9 +46,19 @@ int brcmf_proto_attach(struct brcmf_pub
  21403. - void brcmf_proto_detach(struct brcmf_pub *drvr);
  21404. -
  21405. - static inline int brcmf_proto_hdrpull(struct brcmf_pub *drvr, bool do_fws,
  21406. -- u8 *ifidx, struct sk_buff *skb)
  21407. -+ struct sk_buff *skb,
  21408. -+ struct brcmf_if **ifp)
  21409. - {
  21410. -- return drvr->proto->hdrpull(drvr, do_fws, ifidx, skb);
  21411. -+ struct brcmf_if *tmp = NULL;
  21412. -+
  21413. -+ /* assure protocol is always called with
  21414. -+ * non-null initialized pointer.
  21415. -+ */
  21416. -+ if (ifp)
  21417. -+ *ifp = NULL;
  21418. -+ else
  21419. -+ ifp = &tmp;
  21420. -+ return drvr->proto->hdrpull(drvr, do_fws, skb, ifp);
  21421. - }
  21422. - static inline int brcmf_proto_query_dcmd(struct brcmf_pub *drvr, int ifidx,
  21423. - uint cmd, void *buf, uint len)
  21424. 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
  21425. deleted file mode 100644
  21426. index 2d15a77..0000000
  21427. --- a/package/kernel/mac80211/patches/365-0003-brcmfmac-change-parameters-for-brcmf_remove_interfac.patch
  21428. +++ /dev/null
  21429. @@ -1,87 +0,0 @@
  21430. -From: Arend van Spriel <arend@broadcom.com>
  21431. -Date: Wed, 26 Aug 2015 22:14:55 +0200
  21432. -Subject: [PATCH] brcmfmac: change parameters for
  21433. - brcmf_remove_interface()
  21434. -
  21435. -Just pass the interface to be removed, ie. the struct brcmf_if instance.
  21436. -
  21437. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  21438. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  21439. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  21440. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  21441. ----
  21442. -
  21443. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  21444. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  21445. -@@ -4982,7 +4982,7 @@ brcmf_notify_connect_status_ap(struct br
  21446. - brcmf_dbg(CONN, "AP mode link down\n");
  21447. - complete(&cfg->vif_disabled);
  21448. - if (ifp->vif->mbss)
  21449. -- brcmf_remove_interface(ifp->drvr, ifp->bssidx);
  21450. -+ brcmf_remove_interface(ifp);
  21451. - return 0;
  21452. - }
  21453. -
  21454. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  21455. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  21456. -@@ -887,12 +887,13 @@ static void brcmf_del_if(struct brcmf_pu
  21457. - }
  21458. - }
  21459. -
  21460. --void brcmf_remove_interface(struct brcmf_pub *drvr, u32 bssidx)
  21461. -+void brcmf_remove_interface(struct brcmf_if *ifp)
  21462. - {
  21463. -- if (drvr->iflist[bssidx]) {
  21464. -- brcmf_fws_del_interface(drvr->iflist[bssidx]);
  21465. -- brcmf_del_if(drvr, bssidx);
  21466. -- }
  21467. -+ if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bssidx] != ifp))
  21468. -+ return;
  21469. -+
  21470. -+ brcmf_fws_del_interface(ifp);
  21471. -+ brcmf_del_if(ifp->drvr, ifp->bssidx);
  21472. - }
  21473. -
  21474. - int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr)
  21475. -@@ -1122,7 +1123,7 @@ void brcmf_detach(struct device *dev)
  21476. -
  21477. - /* make sure primary interface removed last */
  21478. - for (i = BRCMF_MAX_IFS-1; i > -1; i--)
  21479. -- brcmf_remove_interface(drvr, i);
  21480. -+ brcmf_remove_interface(drvr->iflist[i]);
  21481. -
  21482. - brcmf_cfg80211_detach(drvr->config);
  21483. -
  21484. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  21485. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  21486. -@@ -206,7 +206,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
  21487. - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  21488. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  21489. - char *name, u8 *mac_addr);
  21490. --void brcmf_remove_interface(struct brcmf_pub *drvr, u32 bssidx);
  21491. -+void brcmf_remove_interface(struct brcmf_if *ifp);
  21492. - int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  21493. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  21494. - enum brcmf_netif_stop_reason reason, bool state);
  21495. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  21496. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  21497. -@@ -222,7 +222,7 @@ static void brcmf_fweh_handle_if_event(s
  21498. - err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
  21499. -
  21500. - if (ifp && ifevent->action == BRCMF_E_IF_DEL)
  21501. -- brcmf_remove_interface(drvr, ifevent->bssidx);
  21502. -+ brcmf_remove_interface(ifp);
  21503. - }
  21504. -
  21505. - /**
  21506. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  21507. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  21508. -@@ -2140,7 +2140,7 @@ static void brcmf_p2p_delete_p2pdev(stru
  21509. - {
  21510. - cfg80211_unregister_wdev(&vif->wdev);
  21511. - p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  21512. -- brcmf_remove_interface(vif->ifp->drvr, vif->ifp->bssidx);
  21513. -+ brcmf_remove_interface(vif->ifp);
  21514. - brcmf_free_vif(vif);
  21515. - }
  21516. -
  21517. 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
  21518. deleted file mode 100644
  21519. index 2b61f4e..0000000
  21520. --- a/package/kernel/mac80211/patches/365-0004-brcmfmac-only-call-brcmf_cfg80211_detach-when-attach.patch
  21521. +++ /dev/null
  21522. @@ -1,92 +0,0 @@
  21523. -From: Arend van Spriel <arend@broadcom.com>
  21524. -Date: Wed, 26 Aug 2015 22:14:56 +0200
  21525. -Subject: [PATCH] brcmfmac: only call brcmf_cfg80211_detach() when attach
  21526. - was successful
  21527. -
  21528. -In brcmf_bus_start() the function brcmf_cfg80211_attach() is called which
  21529. -may fail. If this happens we should not call brcmf_cfg80211_detach() in
  21530. -the failure path as it will result in NULL pointer dereference:
  21531. -
  21532. - brcmf_fweh_activate_events: Set event_msgs error (-5)
  21533. - brcmf_bus_start: failed: -5
  21534. - brcmf_sdio_firmware_callback: dongle is not responding
  21535. - BUG: unable to handle kernel NULL pointer dereference at 0000000000000068
  21536. - IP: [<ffffffff811e8f08>] kernfs_find_ns+0x18/0xd0
  21537. - PGD 0
  21538. - Oops: 0000 [#1] SMP
  21539. - Modules linked in: brcmfmac(O) brcmutil(O) cfg80211 auth_rpcgss
  21540. - CPU: 1 PID: 45 Comm: kworker/1:1 Tainted: G O
  21541. - Hardware name: Dell Inc. Latitude E6410/07XJP9, BIOS A07 02/15/2011
  21542. - Workqueue: events request_firmware_work_func
  21543. - task: ffff880036c09ac0 ti: ffff880036dd4000 task.ti: ffff880036dd4000
  21544. - RIP: 0010:[<ffffffff811e8f08>] [<ffffffff811e8f08>] kernfs_find_ns+0x18/0xd0
  21545. - RSP: 0018:ffff880036dd7a28 EFLAGS: 00010246
  21546. - RAX: ffff880036c09ac0 RBX: 0000000000000000 RCX: 000000007fffffff
  21547. - RDX: 0000000000000000 RSI: ffffffff816578b9 RDI: 0000000000000000
  21548. - RBP: ffff880036dd7a48 R08: 0000000000000000 R09: ffff880036c0b340
  21549. - R10: 00000000000002ec R11: ffff880036dd7b08 R12: ffffffff816578b9
  21550. - R13: 0000000000000000 R14: ffffffff816578b9 R15: ffff8800c6c87000
  21551. - FS: 0000000000000000(0000) GS:ffff88012bc40000(0000) knlGS:0000000000000000
  21552. - CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
  21553. - CR2: 0000000000000068 CR3: 0000000001a0b000 CR4: 00000000000006e0
  21554. - Stack:
  21555. - 0000000000000000 ffffffff816578b9 0000000000000000 ffff8800c0d003c8
  21556. - ffff880036dd7a78 ffffffff811e8ff5 0000000ffffffff1 ffffffff81a9b060
  21557. - ffff8800c789f880 ffff8800c0d00000 ffff880036dd7a98 ffffffff811ebe0d
  21558. - Call Trace:
  21559. - [<ffffffff811e8ff5>] kernfs_find_and_get_ns+0x35/0x60
  21560. - [<ffffffff811ebe0d>] sysfs_unmerge_group+0x1d/0x60
  21561. - [<ffffffff81404ef2>] dpm_sysfs_remove+0x22/0x60
  21562. - [<ffffffff813f9db9>] device_del+0x49/0x240
  21563. - [<ffffffff815da768>] rfkill_unregister+0x58/0xc0
  21564. - [<ffffffffa06bd91b>] wiphy_unregister+0xab/0x2f0 [cfg80211]
  21565. - [<ffffffffa0742fe3>] brcmf_cfg80211_detach+0x23/0x50 [brcmfmac]
  21566. - [<ffffffffa074d986>] brcmf_detach+0x86/0xe0 [brcmfmac]
  21567. - [<ffffffffa0757de8>] brcmf_sdio_remove+0x48/0x120 [brcmfmac]
  21568. - [<ffffffffa0758ed9>] brcmf_sdiod_remove+0x29/0xd0 [brcmfmac]
  21569. - [<ffffffffa0759031>] brcmf_ops_sdio_remove+0xb1/0x110 [brcmfmac]
  21570. - [<ffffffffa001c267>] sdio_bus_remove+0x37/0x100 [mmc_core]
  21571. - [<ffffffff813fe026>] __device_release_driver+0x96/0x130
  21572. - [<ffffffff813fe0e3>] device_release_driver+0x23/0x30
  21573. - [<ffffffffa0754bc8>] brcmf_sdio_firmware_callback+0x2a8/0x5d0 [brcmfmac]
  21574. - [<ffffffffa074deaf>] brcmf_fw_request_nvram_done+0x15f/0x5e0 [brcmfmac]
  21575. - [<ffffffff8140142f>] ? devres_add+0x3f/0x50
  21576. - [<ffffffff810642b5>] ? usermodehelper_read_unlock+0x15/0x20
  21577. - [<ffffffff81400000>] ? platform_match+0x70/0xa0
  21578. - [<ffffffff8140f400>] request_firmware_work_func+0x30/0x60
  21579. - [<ffffffff8106828c>] process_one_work+0x14c/0x3d0
  21580. - [<ffffffff8106862a>] worker_thread+0x11a/0x450
  21581. - [<ffffffff81068510>] ? process_one_work+0x3d0/0x3d0
  21582. - [<ffffffff8106d692>] kthread+0xd2/0xf0
  21583. - [<ffffffff8106d5c0>] ? kthread_create_on_node+0x180/0x180
  21584. - [<ffffffff815ed35f>] ret_from_fork+0x3f/0x70
  21585. - [<ffffffff8106d5c0>] ? kthread_create_on_node+0x180/0x180
  21586. - Code: e9 40 fe ff ff 48 89 d8 eb 87 66 0f 1f 84 00 00 00 00 00 66 66 66 66
  21587. - 90 55 48 89 e5 41 56 49 89 f6 41 55 49 89 d5 31 d2 41 54 53 <0f> b7
  21588. - 47 68 48 8b 5f 48 66 c1 e8 05 83 e0 01 4d 85 ed 0f b6 c8
  21589. - RIP [<ffffffff811e8f08>] kernfs_find_ns+0x18/0xd0
  21590. - RSP <ffff880036dd7a28>
  21591. - CR2: 0000000000000068
  21592. - ---[ end trace 87d6ec0d3fe46740 ]---
  21593. -
  21594. -Reported-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  21595. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  21596. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  21597. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  21598. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  21599. ----
  21600. -
  21601. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  21602. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  21603. -@@ -1049,7 +1049,10 @@ int brcmf_bus_start(struct device *dev)
  21604. - fail:
  21605. - if (ret < 0) {
  21606. - brcmf_err("failed: %d\n", ret);
  21607. -- brcmf_cfg80211_detach(drvr->config);
  21608. -+ if (drvr->config) {
  21609. -+ brcmf_cfg80211_detach(drvr->config);
  21610. -+ drvr->config = NULL;
  21611. -+ }
  21612. - if (drvr->fws) {
  21613. - brcmf_fws_del_interface(ifp);
  21614. - brcmf_fws_deinit(drvr);
  21615. 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
  21616. deleted file mode 100644
  21617. index 868b0a8..0000000
  21618. --- a/package/kernel/mac80211/patches/365-0005-brcmfmac-correct-detection-of-p2pdev-interface-event.patch
  21619. +++ /dev/null
  21620. @@ -1,105 +0,0 @@
  21621. -From: Arend van Spriel <arend@broadcom.com>
  21622. -Date: Wed, 26 Aug 2015 22:14:57 +0200
  21623. -Subject: [PATCH] brcmfmac: correct detection of p2pdev interface event
  21624. -
  21625. -The p2pdev interface is setup in firmware resulting in a interface
  21626. -event. This event has role and no-if flag. When role is p2p client
  21627. -and no-if flag is set it indicates that this is the p2pdev interface.
  21628. -This info is used in handling the event and adding interface in the
  21629. -driver.
  21630. -
  21631. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  21632. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  21633. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  21634. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  21635. ----
  21636. -
  21637. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  21638. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  21639. -@@ -795,7 +795,7 @@ fail:
  21640. - }
  21641. -
  21642. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  21643. -- char *name, u8 *mac_addr)
  21644. -+ bool is_p2pdev, char *name, u8 *mac_addr)
  21645. - {
  21646. - struct brcmf_if *ifp;
  21647. - struct net_device *ndev;
  21648. -@@ -821,7 +821,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  21649. - }
  21650. - }
  21651. -
  21652. -- if (!brcmf_p2p_enable && bssidx == 1) {
  21653. -+ if (!brcmf_p2p_enable && is_p2pdev) {
  21654. - /* this is P2P_DEVICE interface */
  21655. - brcmf_dbg(INFO, "allocate non-netdev interface\n");
  21656. - ifp = kzalloc(sizeof(*ifp), GFP_KERNEL);
  21657. -@@ -999,12 +999,12 @@ int brcmf_bus_start(struct device *dev)
  21658. - brcmf_dbg(TRACE, "\n");
  21659. -
  21660. - /* add primary networking interface */
  21661. -- ifp = brcmf_add_if(drvr, 0, 0, "wlan%d", NULL);
  21662. -+ ifp = brcmf_add_if(drvr, 0, 0, false, "wlan%d", NULL);
  21663. - if (IS_ERR(ifp))
  21664. - return PTR_ERR(ifp);
  21665. -
  21666. - if (brcmf_p2p_enable)
  21667. -- p2p_ifp = brcmf_add_if(drvr, 1, 0, "p2p%d", NULL);
  21668. -+ p2p_ifp = brcmf_add_if(drvr, 1, 0, false, "p2p%d", NULL);
  21669. - else
  21670. - p2p_ifp = NULL;
  21671. - if (IS_ERR(p2p_ifp))
  21672. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  21673. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  21674. -@@ -205,7 +205,7 @@ char *brcmf_ifname(struct brcmf_pub *drv
  21675. - struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  21676. - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  21677. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  21678. -- char *name, u8 *mac_addr);
  21679. -+ bool is_p2pdev, char *name, u8 *mac_addr);
  21680. - void brcmf_remove_interface(struct brcmf_if *ifp);
  21681. - int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  21682. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  21683. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  21684. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  21685. -@@ -179,6 +179,7 @@ static void brcmf_fweh_handle_if_event(s
  21686. - {
  21687. - struct brcmf_if_event *ifevent = data;
  21688. - struct brcmf_if *ifp;
  21689. -+ bool is_p2pdev;
  21690. - int err = 0;
  21691. -
  21692. - brcmf_dbg(EVENT, "action: %u idx: %u bsscfg: %u flags: %u role: %u\n",
  21693. -@@ -186,18 +187,16 @@ static void brcmf_fweh_handle_if_event(s
  21694. - ifevent->flags, ifevent->role);
  21695. -
  21696. - /* The P2P Device interface event must not be ignored
  21697. -- * contrary to what firmware tells us. The only way to
  21698. -- * distinguish the P2P Device is by looking at the ifidx
  21699. -- * and bssidx received.
  21700. -+ * contrary to what firmware tells us.
  21701. - */
  21702. -- if (!(ifevent->ifidx == 0 && ifevent->bssidx == 1) &&
  21703. -- (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) {
  21704. -+ is_p2pdev = (ifevent->flags & BRCMF_E_IF_FLAG_NOIF) &&
  21705. -+ ifevent->role == BRCMF_E_IF_ROLE_P2P_CLIENT;
  21706. -+ if (!is_p2pdev && (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) {
  21707. - brcmf_dbg(EVENT, "event can be ignored\n");
  21708. - return;
  21709. - }
  21710. - if (ifevent->ifidx >= BRCMF_MAX_IFS) {
  21711. -- brcmf_err("invalid interface index: %u\n",
  21712. -- ifevent->ifidx);
  21713. -+ brcmf_err("invalid interface index: %u\n", ifevent->ifidx);
  21714. - return;
  21715. - }
  21716. -
  21717. -@@ -207,7 +206,7 @@ static void brcmf_fweh_handle_if_event(s
  21718. - brcmf_dbg(EVENT, "adding %s (%pM)\n", emsg->ifname,
  21719. - emsg->addr);
  21720. - ifp = brcmf_add_if(drvr, ifevent->bssidx, ifevent->ifidx,
  21721. -- emsg->ifname, emsg->addr);
  21722. -+ is_p2pdev, emsg->ifname, emsg->addr);
  21723. - if (IS_ERR(ifp))
  21724. - return;
  21725. - brcmf_fws_add_interface(ifp);
  21726. 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
  21727. deleted file mode 100644
  21728. index aebbfa6..0000000
  21729. --- a/package/kernel/mac80211/patches/365-0006-brcmfmac-use-brcmf_get_ifp-to-map-ifidx-to-struct-br.patch
  21730. +++ /dev/null
  21731. @@ -1,126 +0,0 @@
  21732. -From: Arend van Spriel <arend@broadcom.com>
  21733. -Date: Wed, 26 Aug 2015 22:14:58 +0200
  21734. -Subject: [PATCH] brcmfmac: use brcmf_get_ifp() to map ifidx to struct
  21735. - brcmf_if instance
  21736. -
  21737. -The knowledge on how to map the interface index to a struct brcmf_if
  21738. -instance is in brcmf_get_ifp() so use that function when only the
  21739. -interface index is known instead of accessing brcmf_pub::iflist
  21740. -directly.
  21741. -
  21742. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  21743. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  21744. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  21745. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  21746. ----
  21747. -
  21748. ---- a/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c
  21749. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c
  21750. -@@ -149,7 +149,7 @@ static s32 brcmf_btcoex_params_read(stru
  21751. - static void brcmf_btcoex_boost_wifi(struct brcmf_btcoex_info *btci,
  21752. - bool trump_sco)
  21753. - {
  21754. -- struct brcmf_if *ifp = btci->cfg->pub->iflist[0];
  21755. -+ struct brcmf_if *ifp = brcmf_get_ifp(btci->cfg->pub, 0);
  21756. -
  21757. - if (trump_sco && !btci->saved_regs_part2) {
  21758. - /* this should reduce eSCO agressive
  21759. -@@ -468,7 +468,7 @@ int brcmf_btcoex_set_mode(struct brcmf_c
  21760. - {
  21761. - struct brcmf_cfg80211_info *cfg = wiphy_priv(vif->wdev.wiphy);
  21762. - struct brcmf_btcoex_info *btci = cfg->btcoex;
  21763. -- struct brcmf_if *ifp = cfg->pub->iflist[0];
  21764. -+ struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
  21765. -
  21766. - switch (mode) {
  21767. - case BRCMF_BTCOEX_DISABLED:
  21768. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  21769. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  21770. -@@ -6212,7 +6212,7 @@ static void brcmf_free_wiphy(struct wiph
  21771. - struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
  21772. - struct device *busdev)
  21773. - {
  21774. -- struct net_device *ndev = drvr->iflist[0]->ndev;
  21775. -+ struct net_device *ndev = brcmf_get_ifp(drvr, 0)->ndev;
  21776. - struct brcmf_cfg80211_info *cfg;
  21777. - struct wiphy *wiphy;
  21778. - struct brcmf_cfg80211_vif *vif;
  21779. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  21780. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  21781. -@@ -121,7 +121,7 @@ static void brcmf_feat_iovar_int_set(str
  21782. -
  21783. - void brcmf_feat_attach(struct brcmf_pub *drvr)
  21784. - {
  21785. -- struct brcmf_if *ifp = drvr->iflist[0];
  21786. -+ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
  21787. -
  21788. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_MCHAN, "mchan");
  21789. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_PNO, "pfn");
  21790. ---- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  21791. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  21792. -@@ -221,7 +221,7 @@ static void brcmf_flowring_block(struct
  21793. -
  21794. - bus_if = dev_get_drvdata(flow->dev);
  21795. - drvr = bus_if->drvr;
  21796. -- ifp = drvr->iflist[ifidx];
  21797. -+ ifp = brcmf_get_ifp(drvr, ifidx);
  21798. - brcmf_txflowblock_if(ifp, BRCMF_NETIF_STOP_REASON_FLOW, blocked);
  21799. -
  21800. - spin_unlock_irqrestore(&flow->block_lock, flags);
  21801. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  21802. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  21803. -@@ -334,7 +334,7 @@ void brcmf_fweh_attach(struct brcmf_pub
  21804. - void brcmf_fweh_detach(struct brcmf_pub *drvr)
  21805. - {
  21806. - struct brcmf_fweh_info *fweh = &drvr->fweh;
  21807. -- struct brcmf_if *ifp = drvr->iflist[0];
  21808. -+ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
  21809. - s8 eventmask[BRCMF_EVENTING_MASK_LEN];
  21810. -
  21811. - if (ifp) {
  21812. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  21813. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  21814. -@@ -972,7 +972,7 @@ static void
  21815. - brcmf_fws_flow_control_check(struct brcmf_fws_info *fws, struct pktq *pq,
  21816. - u8 if_id)
  21817. - {
  21818. -- struct brcmf_if *ifp = fws->drvr->iflist[!if_id ? 0 : if_id + 1];
  21819. -+ struct brcmf_if *ifp = brcmf_get_ifp(fws->drvr, if_id);
  21820. -
  21821. - if (WARN_ON(!ifp))
  21822. - return;
  21823. -@@ -2118,6 +2118,7 @@ static int brcmf_debugfs_fws_stats_read(
  21824. - int brcmf_fws_init(struct brcmf_pub *drvr)
  21825. - {
  21826. - struct brcmf_fws_info *fws;
  21827. -+ struct brcmf_if *ifp;
  21828. - u32 tlv = BRCMF_FWS_FLAGS_RSSI_SIGNALS;
  21829. - int rc;
  21830. - u32 mode;
  21831. -@@ -2177,21 +2178,22 @@ int brcmf_fws_init(struct brcmf_pub *drv
  21832. - * continue. Set mode back to none indicating not enabled.
  21833. - */
  21834. - fws->fw_signals = true;
  21835. -- if (brcmf_fil_iovar_int_set(drvr->iflist[0], "tlv", tlv)) {
  21836. -+ ifp = brcmf_get_ifp(drvr, 0);
  21837. -+ if (brcmf_fil_iovar_int_set(ifp, "tlv", tlv)) {
  21838. - brcmf_err("failed to set bdcv2 tlv signaling\n");
  21839. - fws->fcmode = BRCMF_FWS_FCMODE_NONE;
  21840. - fws->fw_signals = false;
  21841. - }
  21842. -
  21843. -- if (brcmf_fil_iovar_int_set(drvr->iflist[0], "ampdu_hostreorder", 1))
  21844. -+ if (brcmf_fil_iovar_int_set(ifp, "ampdu_hostreorder", 1))
  21845. - brcmf_dbg(INFO, "enabling AMPDU host-reorder failed\n");
  21846. -
  21847. - /* Enable seq number reuse, if supported */
  21848. -- if (brcmf_fil_iovar_int_get(drvr->iflist[0], "wlfc_mode", &mode) == 0) {
  21849. -+ if (brcmf_fil_iovar_int_get(ifp, "wlfc_mode", &mode) == 0) {
  21850. - if (BRCMF_FWS_MODE_GET_REUSESEQ(mode)) {
  21851. - mode = 0;
  21852. - BRCMF_FWS_MODE_SET_REUSESEQ(mode, 1);
  21853. -- if (brcmf_fil_iovar_int_set(drvr->iflist[0],
  21854. -+ if (brcmf_fil_iovar_int_set(ifp,
  21855. - "wlfc_mode", mode) == 0) {
  21856. - BRCMF_FWS_MODE_SET_REUSESEQ(fws->mode, 1);
  21857. - }
  21858. 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
  21859. deleted file mode 100644
  21860. index 23a7b6f..0000000
  21861. --- a/package/kernel/mac80211/patches/365-0007-brcmfmac-pass-struct-brcmf_if-instance-in-brcmf_txfi.patch
  21862. +++ /dev/null
  21863. @@ -1,122 +0,0 @@
  21864. -From: Arend van Spriel <arend@broadcom.com>
  21865. -Date: Wed, 26 Aug 2015 22:14:59 +0200
  21866. -Subject: [PATCH] brcmfmac: pass struct brcmf_if instance in
  21867. - brcmf_txfinalize()
  21868. -
  21869. -Most call sites of brcmf_txfinalize already have struct brcmf_if
  21870. -instance so pass that to brcmf_txfinalize() as the function
  21871. -needs it anyway.
  21872. -
  21873. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  21874. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  21875. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  21876. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  21877. ----
  21878. -
  21879. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  21880. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  21881. -@@ -560,17 +560,11 @@ void brcmf_rx_frame(struct device *dev,
  21882. - brcmf_netif_rx(ifp, skb);
  21883. - }
  21884. -
  21885. --void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, u8 ifidx,
  21886. -- bool success)
  21887. -+void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success)
  21888. - {
  21889. -- struct brcmf_if *ifp;
  21890. - struct ethhdr *eh;
  21891. - u16 type;
  21892. -
  21893. -- ifp = drvr->iflist[ifidx];
  21894. -- if (!ifp)
  21895. -- goto done;
  21896. --
  21897. - eh = (struct ethhdr *)(txp->data);
  21898. - type = ntohs(eh->h_proto);
  21899. -
  21900. -@@ -582,7 +576,7 @@ void brcmf_txfinalize(struct brcmf_pub *
  21901. -
  21902. - if (!success)
  21903. - ifp->stats.tx_errors++;
  21904. --done:
  21905. -+
  21906. - brcmu_pkt_buf_free_skb(txp);
  21907. - }
  21908. -
  21909. -@@ -600,7 +594,7 @@ void brcmf_txcomplete(struct device *dev
  21910. - if (brcmf_proto_hdrpull(drvr, false, txp, &ifp))
  21911. - brcmu_pkt_buf_free_skb(txp);
  21912. - else
  21913. -- brcmf_txfinalize(drvr, txp, ifp->ifidx, success);
  21914. -+ brcmf_txfinalize(ifp, txp, success);
  21915. - }
  21916. - }
  21917. -
  21918. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  21919. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  21920. -@@ -210,8 +210,7 @@ void brcmf_remove_interface(struct brcmf
  21921. - int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  21922. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  21923. - enum brcmf_netif_stop_reason reason, bool state);
  21924. --void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, u8 ifidx,
  21925. -- bool success);
  21926. -+void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  21927. - void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);
  21928. -
  21929. - /* Sets dongle media info (drv_version, mac address). */
  21930. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  21931. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  21932. -@@ -1506,7 +1506,7 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  21933. - ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
  21934. - genbit, seq);
  21935. - if (remove_from_hanger || ret)
  21936. -- brcmf_txfinalize(fws->drvr, skb, ifp->ifidx, true);
  21937. -+ brcmf_txfinalize(ifp, skb, true);
  21938. -
  21939. - return 0;
  21940. - }
  21941. -@@ -1905,7 +1905,7 @@ int brcmf_fws_process_skb(struct brcmf_i
  21942. - if (fws->avoid_queueing) {
  21943. - rc = brcmf_proto_txdata(drvr, ifp->ifidx, 0, skb);
  21944. - if (rc < 0)
  21945. -- brcmf_txfinalize(drvr, skb, ifp->ifidx, false);
  21946. -+ brcmf_txfinalize(ifp, skb, false);
  21947. - return rc;
  21948. - }
  21949. -
  21950. -@@ -1929,7 +1929,7 @@ int brcmf_fws_process_skb(struct brcmf_i
  21951. - brcmf_fws_schedule_deq(fws);
  21952. - } else {
  21953. - brcmf_err("drop skb: no hanger slot\n");
  21954. -- brcmf_txfinalize(drvr, skb, ifp->ifidx, false);
  21955. -+ brcmf_txfinalize(ifp, skb, false);
  21956. - rc = -ENOMEM;
  21957. - }
  21958. - brcmf_fws_unlock(fws);
  21959. -@@ -2009,8 +2009,9 @@ static void brcmf_fws_dequeue_worker(str
  21960. - ret = brcmf_proto_txdata(drvr, ifidx, 0, skb);
  21961. - brcmf_fws_lock(fws);
  21962. - if (ret < 0)
  21963. -- brcmf_txfinalize(drvr, skb, ifidx,
  21964. -- false);
  21965. -+ brcmf_txfinalize(brcmf_get_ifp(drvr,
  21966. -+ ifidx),
  21967. -+ skb, false);
  21968. - if (fws->bus_flow_blocked)
  21969. - break;
  21970. - }
  21971. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  21972. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  21973. -@@ -873,7 +873,11 @@ brcmf_msgbuf_process_txstatus(struct brc
  21974. - commonring = msgbuf->flowrings[flowid];
  21975. - atomic_dec(&commonring->outstanding_tx);
  21976. -
  21977. -- brcmf_txfinalize(msgbuf->drvr, skb, tx_status->msg.ifidx, true);
  21978. -+ /* Hante: i believe this was a bug as tx_status->msg.ifidx was used
  21979. -+ * in brcmf_txfinalize as index in drvr->iflist. Can you confirm/deny?
  21980. -+ */
  21981. -+ brcmf_txfinalize(brcmf_get_ifp(msgbuf->drvr, tx_status->msg.ifidx),
  21982. -+ skb, true);
  21983. - }
  21984. -
  21985. -
  21986. 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
  21987. deleted file mode 100644
  21988. index 8ddc0a6..0000000
  21989. --- a/package/kernel/mac80211/patches/365-0008-brcmfmac-add-mapping-for-interface-index-to-bsscfg-i.patch
  21990. +++ /dev/null
  21991. @@ -1,92 +0,0 @@
  21992. -From: Arend van Spriel <arend@broadcom.com>
  21993. -Date: Wed, 26 Aug 2015 22:15:00 +0200
  21994. -Subject: [PATCH] brcmfmac: add mapping for interface index to bsscfg
  21995. - index
  21996. -
  21997. -Because the P2P Device interface in firmware uses the same interface
  21998. -index as the primary interface we use the bsscfg index as index in the
  21999. -struct brcmf_pub::iflist. However, in the data path we get the interface
  22000. -index and not the bsscfg index. So we need a mapping of interface index
  22001. -to bsscfg index, which can be determined upon handle adding the interface.
  22002. -
  22003. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  22004. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  22005. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  22006. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  22007. ----
  22008. -
  22009. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  22010. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  22011. -@@ -85,21 +85,20 @@ char *brcmf_ifname(struct brcmf_pub *drv
  22012. -
  22013. - struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx)
  22014. - {
  22015. -+ struct brcmf_if *ifp;
  22016. -+ s32 bssidx;
  22017. -+
  22018. - if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  22019. - brcmf_err("ifidx %d out of range\n", ifidx);
  22020. - return NULL;
  22021. - }
  22022. -
  22023. -- /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  22024. -- * events this is easy because it contains the bssidx which maps
  22025. -- * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  22026. -- * bssidx 1 is used for p2p0 and no data can be received or
  22027. -- * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  22028. -- */
  22029. -- if (ifidx)
  22030. -- ifidx++;
  22031. -+ ifp = NULL;
  22032. -+ bssidx = drvr->if2bss[ifidx];
  22033. -+ if (bssidx >= 0)
  22034. -+ ifp = drvr->iflist[bssidx];
  22035. -
  22036. -- return drvr->iflist[ifidx];
  22037. -+ return ifp;
  22038. - }
  22039. -
  22040. - static void _brcmf_set_multicast_list(struct work_struct *work)
  22041. -@@ -831,6 +830,8 @@ struct brcmf_if *brcmf_add_if(struct brc
  22042. -
  22043. - ifp = netdev_priv(ndev);
  22044. - ifp->ndev = ndev;
  22045. -+ /* store mapping ifidx to bssidx */
  22046. -+ drvr->if2bss[ifidx] = bssidx;
  22047. - }
  22048. -
  22049. - ifp->drvr = drvr;
  22050. -@@ -855,6 +856,7 @@ static void brcmf_del_if(struct brcmf_pu
  22051. - struct brcmf_if *ifp;
  22052. -
  22053. - ifp = drvr->iflist[bssidx];
  22054. -+ drvr->if2bss[ifp->ifidx] = -1;
  22055. - drvr->iflist[bssidx] = NULL;
  22056. - if (!ifp) {
  22057. - brcmf_err("Null interface, idx=%d\n", bssidx);
  22058. -@@ -862,6 +864,7 @@ static void brcmf_del_if(struct brcmf_pu
  22059. - }
  22060. - brcmf_dbg(TRACE, "Enter, idx=%d, ifidx=%d\n", bssidx, ifp->ifidx);
  22061. - if (ifp->ndev) {
  22062. -+ drvr->if2bss[ifp->ifidx] = -1;
  22063. - if (bssidx == 0) {
  22064. - if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) {
  22065. - rtnl_lock();
  22066. -@@ -926,6 +929,7 @@ int brcmf_attach(struct device *dev)
  22067. - if (!drvr)
  22068. - return -ENOMEM;
  22069. -
  22070. -+ memset(drvr->if2bss, 0xFF, sizeof(drvr->if2bss));
  22071. - mutex_init(&drvr->proto_block);
  22072. -
  22073. - /* Link to bus module */
  22074. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  22075. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  22076. -@@ -122,6 +122,7 @@ struct brcmf_pub {
  22077. - struct mac_address addresses[BRCMF_MAX_IFS];
  22078. -
  22079. - struct brcmf_if *iflist[BRCMF_MAX_IFS];
  22080. -+ s32 if2bss[BRCMF_MAX_IFS];
  22081. -
  22082. - struct mutex proto_block;
  22083. - unsigned char proto_buf[BRCMF_DCMD_MAXLEN];
  22084. 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
  22085. deleted file mode 100644
  22086. index a0a798b..0000000
  22087. --- a/package/kernel/mac80211/patches/365-0009-brcmfmac-add-dedicated-debug-level-for-firmware-cons.patch
  22088. +++ /dev/null
  22089. @@ -1,103 +0,0 @@
  22090. -From: Arend van Spriel <arend@broadcom.com>
  22091. -Date: Wed, 26 Aug 2015 22:15:01 +0200
  22092. -Subject: [PATCH] brcmfmac: add dedicated debug level for firmware
  22093. - console logging
  22094. -
  22095. -Both PCIe and SDIO devices have the possibility to log the firmware
  22096. -console output in kernel log. For PCIe it is logged when PCIE debug
  22097. -level is enabled. For SDIO it is logged when user specifies a non-zero
  22098. -console interval through debugfs. This patch tries to make it a
  22099. -bit more consistent. The firmware console output is only logged when
  22100. -FWCON debug level is enabled.
  22101. -
  22102. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  22103. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  22104. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  22105. -Reviewed-by: Pontus Fuchs <pontusf@broadcom.com>
  22106. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  22107. ----
  22108. -
  22109. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  22110. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  22111. -@@ -37,6 +37,7 @@
  22112. - #define BRCMF_SDIO_VAL 0x00020000
  22113. - #define BRCMF_MSGBUF_VAL 0x00040000
  22114. - #define BRCMF_PCIE_VAL 0x00080000
  22115. -+#define BRCMF_FWCON_VAL 0x00100000
  22116. -
  22117. - /* set default print format */
  22118. - #undef pr_fmt
  22119. -@@ -78,6 +79,7 @@ do { \
  22120. - #define BRCMF_GLOM_ON() (brcmf_msg_level & BRCMF_GLOM_VAL)
  22121. - #define BRCMF_EVENT_ON() (brcmf_msg_level & BRCMF_EVENT_VAL)
  22122. - #define BRCMF_FIL_ON() (brcmf_msg_level & BRCMF_FIL_VAL)
  22123. -+#define BRCMF_FWCON_ON() (brcmf_msg_level & BRCMF_FWCON_VAL)
  22124. -
  22125. - #else /* defined(DEBUG) || defined(CPTCFG_BRCM_TRACING) */
  22126. -
  22127. -@@ -90,6 +92,7 @@ do { \
  22128. - #define BRCMF_GLOM_ON() 0
  22129. - #define BRCMF_EVENT_ON() 0
  22130. - #define BRCMF_FIL_ON() 0
  22131. -+#define BRCMF_FWCON_ON() 0
  22132. -
  22133. - #endif /* defined(DEBUG) || defined(CPTCFG_BRCM_TRACING) */
  22134. -
  22135. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  22136. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  22137. -@@ -644,7 +644,7 @@ static void brcmf_pcie_bus_console_init(
  22138. - addr = console->base_addr + BRCMF_CONSOLE_BUFSIZE_OFFSET;
  22139. - console->bufsize = brcmf_pcie_read_tcm32(devinfo, addr);
  22140. -
  22141. -- brcmf_dbg(PCIE, "Console: base %x, buf %x, size %d\n",
  22142. -+ brcmf_dbg(FWCON, "Console: base %x, buf %x, size %d\n",
  22143. - console->base_addr, console->buf_addr, console->bufsize);
  22144. - }
  22145. -
  22146. -@@ -656,6 +656,9 @@ static void brcmf_pcie_bus_console_read(
  22147. - u8 ch;
  22148. - u32 newidx;
  22149. -
  22150. -+ if (!BRCMF_FWCON_ON())
  22151. -+ return;
  22152. -+
  22153. - console = &devinfo->shared.console;
  22154. - addr = console->base_addr + BRCMF_CONSOLE_WRITEIDX_OFFSET;
  22155. - newidx = brcmf_pcie_read_tcm32(devinfo, addr);
  22156. -@@ -677,7 +680,7 @@ static void brcmf_pcie_bus_console_read(
  22157. - }
  22158. - if (ch == '\n') {
  22159. - console->log_str[console->log_idx] = 0;
  22160. -- brcmf_dbg(PCIE, "CONSOLE: %s", console->log_str);
  22161. -+ pr_debug("CONSOLE: %s", console->log_str);
  22162. - console->log_idx = 0;
  22163. - }
  22164. - }
  22165. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  22166. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  22167. -@@ -123,6 +123,7 @@ struct rte_console {
  22168. -
  22169. - #define BRCMF_FIRSTREAD (1 << 6)
  22170. -
  22171. -+#define BRCMF_CONSOLE 10 /* watchdog interval to poll console */
  22172. -
  22173. - /* SBSDIO_DEVICE_CTL */
  22174. -
  22175. -@@ -3204,6 +3205,8 @@ static void brcmf_sdio_debugfs_create(st
  22176. - if (IS_ERR_OR_NULL(dentry))
  22177. - return;
  22178. -
  22179. -+ bus->console_interval = BRCMF_CONSOLE;
  22180. -+
  22181. - brcmf_debugfs_add_entry(drvr, "forensics", brcmf_sdio_forensic_read);
  22182. - brcmf_debugfs_add_entry(drvr, "counters",
  22183. - brcmf_debugfs_sdio_count_read);
  22184. -@@ -3613,7 +3616,7 @@ static void brcmf_sdio_bus_watchdog(stru
  22185. - }
  22186. - #ifdef DEBUG
  22187. - /* Poll for console output periodically */
  22188. -- if (bus->sdiodev->state == BRCMF_SDIOD_DATA &&
  22189. -+ if (bus->sdiodev->state == BRCMF_SDIOD_DATA && BRCMF_FWCON_ON() &&
  22190. - bus->console_interval != 0) {
  22191. - bus->console.count += BRCMF_WD_POLL_MS;
  22192. - if (bus->console.count >= bus->console_interval) {
  22193. 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
  22194. deleted file mode 100644
  22195. index 53e7ede..0000000
  22196. --- a/package/kernel/mac80211/patches/365-0010-brcmfmac-remove-ifidx-parameter-from-brcmf_fws_txsta.patch
  22197. +++ /dev/null
  22198. @@ -1,34 +0,0 @@
  22199. -From: Arend van Spriel <arend@broadcom.com>
  22200. -Date: Wed, 26 Aug 2015 22:15:02 +0200
  22201. -Subject: [PATCH] brcmfmac: remove ifidx parameter from
  22202. - brcmf_fws_txstatus_suppressed()
  22203. -
  22204. -The brcmf_fws_txstatus_suppressed() function prototype specifies an
  22205. -ifidx parameter which is not used within the function implementation.
  22206. -
  22207. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  22208. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  22209. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  22210. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  22211. ----
  22212. -
  22213. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  22214. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  22215. -@@ -1398,7 +1398,7 @@ done:
  22216. - }
  22217. -
  22218. - static int brcmf_fws_txstatus_suppressed(struct brcmf_fws_info *fws, int fifo,
  22219. -- struct sk_buff *skb, u8 ifidx,
  22220. -+ struct sk_buff *skb,
  22221. - u32 genbit, u16 seq)
  22222. - {
  22223. - struct brcmf_fws_mac_descriptor *entry = brcmf_skbcb(skb)->mac;
  22224. -@@ -1503,7 +1503,7 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  22225. - return -EINVAL;
  22226. - }
  22227. - if (!remove_from_hanger)
  22228. -- ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
  22229. -+ ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb,
  22230. - genbit, seq);
  22231. - if (remove_from_hanger || ret)
  22232. - brcmf_txfinalize(ifp, skb, true);
  22233. 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
  22234. deleted file mode 100644
  22235. index bb05235..0000000
  22236. --- a/package/kernel/mac80211/patches/365-0011-brcmfmac-change-prototype-for-brcmf_fws_hdrpull.patch
  22237. +++ /dev/null
  22238. @@ -1,97 +0,0 @@
  22239. -From: Arend van Spriel <arend@broadcom.com>
  22240. -Date: Wed, 26 Aug 2015 22:15:03 +0200
  22241. -Subject: [PATCH] brcmfmac: change prototype for brcmf_fws_hdrpull()
  22242. -
  22243. -Instead of passing ifidx and drvr just pass struct brcmf_if pointer
  22244. -which holds both parameters.
  22245. -
  22246. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  22247. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  22248. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  22249. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  22250. ----
  22251. -
  22252. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  22253. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  22254. -@@ -312,8 +312,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  22255. -
  22256. - skb_pull(pktbuf, BCDC_HEADER_LEN);
  22257. - if (do_fws)
  22258. -- brcmf_fws_hdrpull(drvr, tmp_if->ifidx, h->data_offset << 2,
  22259. -- pktbuf);
  22260. -+ brcmf_fws_hdrpull(tmp_if, h->data_offset << 2, pktbuf);
  22261. - else
  22262. - skb_pull(pktbuf, h->data_offset << 2);
  22263. -
  22264. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  22265. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  22266. -@@ -1616,11 +1616,10 @@ static int brcmf_fws_notify_bcmc_credit_
  22267. - return 0;
  22268. - }
  22269. -
  22270. --int brcmf_fws_hdrpull(struct brcmf_pub *drvr, int ifidx, s16 signal_len,
  22271. -- struct sk_buff *skb)
  22272. -+void brcmf_fws_hdrpull(struct brcmf_if *ifp, s16 siglen, struct sk_buff *skb)
  22273. - {
  22274. - struct brcmf_skb_reorder_data *rd;
  22275. -- struct brcmf_fws_info *fws = drvr->fws;
  22276. -+ struct brcmf_fws_info *fws = ifp->drvr->fws;
  22277. - u8 *signal_data;
  22278. - s16 data_len;
  22279. - u8 type;
  22280. -@@ -1630,20 +1629,20 @@ int brcmf_fws_hdrpull(struct brcmf_pub *
  22281. - s32 err;
  22282. -
  22283. - brcmf_dbg(HDRS, "enter: ifidx %d, skblen %u, sig %d\n",
  22284. -- ifidx, skb->len, signal_len);
  22285. -+ ifp->ifidx, skb->len, siglen);
  22286. -
  22287. -- WARN_ON(signal_len > skb->len);
  22288. -+ WARN_ON(siglen > skb->len);
  22289. -
  22290. -- if (!signal_len)
  22291. -- return 0;
  22292. -+ if (!siglen)
  22293. -+ return;
  22294. - /* if flow control disabled, skip to packet data and leave */
  22295. - if ((!fws) || (!fws->fw_signals)) {
  22296. -- skb_pull(skb, signal_len);
  22297. -- return 0;
  22298. -+ skb_pull(skb, siglen);
  22299. -+ return;
  22300. - }
  22301. -
  22302. - fws->stats.header_pulls++;
  22303. -- data_len = signal_len;
  22304. -+ data_len = siglen;
  22305. - signal_data = skb->data;
  22306. -
  22307. - status = BRCMF_FWS_RET_OK_NOSCHEDULE;
  22308. -@@ -1731,14 +1730,12 @@ int brcmf_fws_hdrpull(struct brcmf_pub *
  22309. - /* signalling processing result does
  22310. - * not affect the actual ethernet packet.
  22311. - */
  22312. -- skb_pull(skb, signal_len);
  22313. -+ skb_pull(skb, siglen);
  22314. -
  22315. - /* this may be a signal-only packet
  22316. - */
  22317. - if (skb->len == 0)
  22318. - fws->stats.header_only_pkt++;
  22319. --
  22320. -- return 0;
  22321. - }
  22322. -
  22323. - static u8 brcmf_fws_precommit_skb(struct brcmf_fws_info *fws, int fifo,
  22324. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.h
  22325. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.h
  22326. -@@ -21,8 +21,7 @@
  22327. - int brcmf_fws_init(struct brcmf_pub *drvr);
  22328. - void brcmf_fws_deinit(struct brcmf_pub *drvr);
  22329. - bool brcmf_fws_fc_active(struct brcmf_fws_info *fws);
  22330. --int brcmf_fws_hdrpull(struct brcmf_pub *drvr, int ifidx, s16 signal_len,
  22331. -- struct sk_buff *skb);
  22332. -+void brcmf_fws_hdrpull(struct brcmf_if *ifp, s16 siglen, struct sk_buff *skb);
  22333. - int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb);
  22334. -
  22335. - void brcmf_fws_reset_interface(struct brcmf_if *ifp);
  22336. 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
  22337. deleted file mode 100644
  22338. index ba92c67..0000000
  22339. --- a/package/kernel/mac80211/patches/365-0012-brcmfmac-introduce-brcmf_net_detach-function.patch
  22340. +++ /dev/null
  22341. @@ -1,99 +0,0 @@
  22342. -From: Arend van Spriel <arend@broadcom.com>
  22343. -Date: Wed, 26 Aug 2015 22:15:04 +0200
  22344. -Subject: [PATCH] brcmfmac: introduce brcmf_net_detach() function
  22345. -
  22346. -In case of error during brcmf_bus_start() the network interfaces were
  22347. -freed using free_netdev(). However, the interfaces may have additional
  22348. -memory allocated which is not freed. The netdev has destructor set to
  22349. -brcmf_cfg80211_free_netdev() which frees the additional memory if
  22350. -allocated and call free_netdev(). The brcmf_net_detach() either calls
  22351. -brcmf_cfg80211_free_netdev() directly or uses unregister_netdev() when
  22352. -struct net_device::reg_state indicates the netdev was registered.
  22353. -
  22354. -Reported-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  22355. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  22356. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  22357. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  22358. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  22359. ----
  22360. -
  22361. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  22362. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  22363. -@@ -4746,7 +4746,8 @@ void brcmf_cfg80211_free_netdev(struct n
  22364. - ifp = netdev_priv(ndev);
  22365. - vif = ifp->vif;
  22366. -
  22367. -- brcmf_free_vif(vif);
  22368. -+ if (vif)
  22369. -+ brcmf_free_vif(vif);
  22370. - free_netdev(ndev);
  22371. - }
  22372. -
  22373. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  22374. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  22375. -@@ -718,8 +718,6 @@ int brcmf_net_attach(struct brcmf_if *if
  22376. - }
  22377. -
  22378. - brcmf_dbg(INFO, "%s: Broadcom Dongle Host Driver\n", ndev->name);
  22379. --
  22380. -- ndev->destructor = brcmf_cfg80211_free_netdev;
  22381. - return 0;
  22382. -
  22383. - fail:
  22384. -@@ -729,6 +727,14 @@ fail:
  22385. - return -EBADE;
  22386. - }
  22387. -
  22388. -+static void brcmf_net_detach(struct net_device *ndev)
  22389. -+{
  22390. -+ if (ndev->reg_state == NETREG_REGISTERED)
  22391. -+ unregister_netdev(ndev);
  22392. -+ else
  22393. -+ brcmf_cfg80211_free_netdev(ndev);
  22394. -+}
  22395. -+
  22396. - static int brcmf_net_p2p_open(struct net_device *ndev)
  22397. - {
  22398. - brcmf_dbg(TRACE, "Enter\n");
  22399. -@@ -805,8 +811,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  22400. - ifp->ndev->name);
  22401. - if (ifidx) {
  22402. - netif_stop_queue(ifp->ndev);
  22403. -- unregister_netdev(ifp->ndev);
  22404. -- free_netdev(ifp->ndev);
  22405. -+ brcmf_net_detach(ifp->ndev);
  22406. - drvr->iflist[bssidx] = NULL;
  22407. - } else {
  22408. - brcmf_err("ignore IF event\n");
  22409. -@@ -828,6 +833,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  22410. - if (!ndev)
  22411. - return ERR_PTR(-ENOMEM);
  22412. -
  22413. -+ ndev->destructor = brcmf_cfg80211_free_netdev;
  22414. - ifp = netdev_priv(ndev);
  22415. - ifp->ndev = ndev;
  22416. - /* store mapping ifidx to bssidx */
  22417. -@@ -879,8 +885,7 @@ static void brcmf_del_if(struct brcmf_pu
  22418. - cancel_work_sync(&ifp->setmacaddr_work);
  22419. - cancel_work_sync(&ifp->multicast_work);
  22420. - }
  22421. -- /* unregister will take care of freeing it */
  22422. -- unregister_netdev(ifp->ndev);
  22423. -+ brcmf_net_detach(ifp->ndev);
  22424. - }
  22425. - }
  22426. -
  22427. -@@ -1056,11 +1061,11 @@ fail:
  22428. - brcmf_fws_deinit(drvr);
  22429. - }
  22430. - if (drvr->iflist[0]) {
  22431. -- free_netdev(ifp->ndev);
  22432. -+ brcmf_net_detach(ifp->ndev);
  22433. - drvr->iflist[0] = NULL;
  22434. - }
  22435. - if (p2p_ifp) {
  22436. -- free_netdev(p2p_ifp->ndev);
  22437. -+ brcmf_net_detach(p2p_ifp->ndev);
  22438. - drvr->iflist[1] = NULL;
  22439. - }
  22440. - return ret;
  22441. 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
  22442. deleted file mode 100644
  22443. index 5a7e447..0000000
  22444. --- a/package/kernel/mac80211/patches/366-brcmfmac-Reset-PCIE-devices-after-recognition.patch
  22445. +++ /dev/null
  22446. @@ -1,193 +0,0 @@
  22447. -From: Hante Meuleman <meuleman@broadcom.com>
  22448. -Date: Thu, 27 Aug 2015 16:14:06 +0200
  22449. -Subject: [PATCH] brcmfmac: Reset PCIE devices after recognition.
  22450. -
  22451. -When PCIE type devices are being FW reloaded without being properly
  22452. -reset then the device ends up in a locked state, requiring the
  22453. -device to be completely powered down. This patch adds a reset
  22454. -through watchdog at the moment the device (cores) has been
  22455. -recognized. This will solve warm reboot issues.
  22456. -
  22457. -Cc: Rafal Milecki <zajec5@gmail.com>
  22458. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  22459. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  22460. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  22461. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  22462. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  22463. ----
  22464. -
  22465. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  22466. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  22467. -@@ -101,6 +101,9 @@
  22468. - /* ARM Cortex M3 core, ID 0x82a */
  22469. - #define BCM4329_CORE_ARM_BASE 0x18002000
  22470. -
  22471. -+/* Max possibly supported memory size (limited by IO mapped memory) */
  22472. -+#define BRCMF_CHIP_MAX_MEMSIZE (4 * 1024 * 1024)
  22473. -+
  22474. - #define CORE_SB(base, field) \
  22475. - (base + SBCONFIGOFF + offsetof(struct sbconfig, field))
  22476. - #define SBCOREREV(sbidh) \
  22477. -@@ -687,6 +690,12 @@ static int brcmf_chip_get_raminfo(struct
  22478. - brcmf_err("RAM size is undetermined\n");
  22479. - return -ENOMEM;
  22480. - }
  22481. -+
  22482. -+ if (ci->pub.ramsize > BRCMF_CHIP_MAX_MEMSIZE) {
  22483. -+ brcmf_err("RAM size is incorrect\n");
  22484. -+ return -ENOMEM;
  22485. -+ }
  22486. -+
  22487. - return 0;
  22488. - }
  22489. -
  22490. -@@ -899,6 +908,15 @@ static int brcmf_chip_recognition(struct
  22491. -
  22492. - /* assure chip is passive for core access */
  22493. - brcmf_chip_set_passive(&ci->pub);
  22494. -+
  22495. -+ /* Call bus specific reset function now. Cores have been determined
  22496. -+ * but further access may require a chip specific reset at this point.
  22497. -+ */
  22498. -+ if (ci->ops->reset) {
  22499. -+ ci->ops->reset(ci->ctx, &ci->pub);
  22500. -+ brcmf_chip_set_passive(&ci->pub);
  22501. -+ }
  22502. -+
  22503. - return brcmf_chip_get_raminfo(ci);
  22504. - }
  22505. -
  22506. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  22507. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  22508. -@@ -73,6 +73,7 @@ struct brcmf_buscore_ops {
  22509. - u32 (*read32)(void *ctx, u32 addr);
  22510. - void (*write32)(void *ctx, u32 addr, u32 value);
  22511. - int (*prepare)(void *ctx);
  22512. -+ int (*reset)(void *ctx, struct brcmf_chip *chip);
  22513. - int (*setup)(void *ctx, struct brcmf_chip *chip);
  22514. - void (*activate)(void *ctx, struct brcmf_chip *chip, u32 rstvec);
  22515. - };
  22516. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  22517. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  22518. -@@ -74,6 +74,8 @@ enum brcmf_pcie_state {
  22519. - #define BRCMF_PCIE_REG_INTMASK 0x94
  22520. - #define BRCMF_PCIE_REG_SBMBX 0x98
  22521. -
  22522. -+#define BRCMF_PCIE_REG_LINK_STATUS_CTRL 0xBC
  22523. -+
  22524. - #define BRCMF_PCIE_PCIE2REG_INTMASK 0x24
  22525. - #define BRCMF_PCIE_PCIE2REG_MAILBOXINT 0x48
  22526. - #define BRCMF_PCIE_PCIE2REG_MAILBOXMASK 0x4C
  22527. -@@ -466,6 +468,7 @@ brcmf_pcie_select_core(struct brcmf_pcie
  22528. -
  22529. - static void brcmf_pcie_reset_device(struct brcmf_pciedev_info *devinfo)
  22530. - {
  22531. -+ struct brcmf_core *core;
  22532. - u16 cfg_offset[] = { BRCMF_PCIE_CFGREG_STATUS_CMD,
  22533. - BRCMF_PCIE_CFGREG_PM_CSR,
  22534. - BRCMF_PCIE_CFGREG_MSI_CAP,
  22535. -@@ -484,32 +487,38 @@ static void brcmf_pcie_reset_device(stru
  22536. - if (!devinfo->ci)
  22537. - return;
  22538. -
  22539. -+ /* Disable ASPM */
  22540. - brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  22541. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  22542. -- BRCMF_PCIE_CFGREG_LINK_STATUS_CTRL);
  22543. -- lsc = brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA);
  22544. -+ pci_read_config_dword(devinfo->pdev, BRCMF_PCIE_REG_LINK_STATUS_CTRL,
  22545. -+ &lsc);
  22546. - val = lsc & (~BRCMF_PCIE_LINK_STATUS_CTRL_ASPM_ENAB);
  22547. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA, val);
  22548. -+ pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_LINK_STATUS_CTRL,
  22549. -+ val);
  22550. -
  22551. -+ /* Watchdog reset */
  22552. - brcmf_pcie_select_core(devinfo, BCMA_CORE_CHIPCOMMON);
  22553. - WRITECC32(devinfo, watchdog, 4);
  22554. - msleep(100);
  22555. -
  22556. -+ /* Restore ASPM */
  22557. - brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  22558. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  22559. -- BRCMF_PCIE_CFGREG_LINK_STATUS_CTRL);
  22560. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA, lsc);
  22561. -+ pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_LINK_STATUS_CTRL,
  22562. -+ lsc);
  22563. -
  22564. -- brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  22565. -- for (i = 0; i < ARRAY_SIZE(cfg_offset); i++) {
  22566. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  22567. -- cfg_offset[i]);
  22568. -- val = brcmf_pcie_read_reg32(devinfo,
  22569. -- BRCMF_PCIE_PCIE2REG_CONFIGDATA);
  22570. -- brcmf_dbg(PCIE, "config offset 0x%04x, value 0x%04x\n",
  22571. -- cfg_offset[i], val);
  22572. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA,
  22573. -- val);
  22574. -+ core = brcmf_chip_get_core(devinfo->ci, BCMA_CORE_PCIE2);
  22575. -+ if (core->rev <= 13) {
  22576. -+ for (i = 0; i < ARRAY_SIZE(cfg_offset); i++) {
  22577. -+ brcmf_pcie_write_reg32(devinfo,
  22578. -+ BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  22579. -+ cfg_offset[i]);
  22580. -+ val = brcmf_pcie_read_reg32(devinfo,
  22581. -+ BRCMF_PCIE_PCIE2REG_CONFIGDATA);
  22582. -+ brcmf_dbg(PCIE, "config offset 0x%04x, value 0x%04x\n",
  22583. -+ cfg_offset[i], val);
  22584. -+ brcmf_pcie_write_reg32(devinfo,
  22585. -+ BRCMF_PCIE_PCIE2REG_CONFIGDATA,
  22586. -+ val);
  22587. -+ }
  22588. - }
  22589. - }
  22590. -
  22591. -@@ -519,8 +528,6 @@ static void brcmf_pcie_attach(struct brc
  22592. - u32 config;
  22593. -
  22594. - brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  22595. -- if (brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_INTMASK) != 0)
  22596. -- brcmf_pcie_reset_device(devinfo);
  22597. - /* BAR1 window may not be sized properly */
  22598. - brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  22599. - brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR, 0x4e0);
  22600. -@@ -1636,6 +1643,23 @@ static int brcmf_pcie_buscoreprep(void *
  22601. - }
  22602. -
  22603. -
  22604. -+static int brcmf_pcie_buscore_reset(void *ctx, struct brcmf_chip *chip)
  22605. -+{
  22606. -+ struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)ctx;
  22607. -+ u32 val;
  22608. -+
  22609. -+ devinfo->ci = chip;
  22610. -+ brcmf_pcie_reset_device(devinfo);
  22611. -+
  22612. -+ val = brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT);
  22613. -+ if (val != 0xffffffff)
  22614. -+ brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT,
  22615. -+ val);
  22616. -+
  22617. -+ return 0;
  22618. -+}
  22619. -+
  22620. -+
  22621. - static void brcmf_pcie_buscore_activate(void *ctx, struct brcmf_chip *chip,
  22622. - u32 rstvec)
  22623. - {
  22624. -@@ -1647,6 +1671,7 @@ static void brcmf_pcie_buscore_activate(
  22625. -
  22626. - static const struct brcmf_buscore_ops brcmf_pcie_buscore_ops = {
  22627. - .prepare = brcmf_pcie_buscoreprep,
  22628. -+ .reset = brcmf_pcie_buscore_reset,
  22629. - .activate = brcmf_pcie_buscore_activate,
  22630. - .read32 = brcmf_pcie_buscore_read32,
  22631. - .write32 = brcmf_pcie_buscore_write32,
  22632. -@@ -1814,7 +1839,6 @@ brcmf_pcie_remove(struct pci_dev *pdev)
  22633. - brcmf_pcie_intr_disable(devinfo);
  22634. -
  22635. - brcmf_detach(&pdev->dev);
  22636. -- brcmf_pcie_reset_device(devinfo);
  22637. -
  22638. - kfree(bus->bus_priv.pcie);
  22639. - kfree(bus->msgbuf->flowrings);
  22640. 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
  22641. deleted file mode 100644
  22642. index f7b3e40..0000000
  22643. --- a/package/kernel/mac80211/patches/367-ath10k-fix-DMA-related-firmware-crashes-on-multiple-.patch
  22644. +++ /dev/null
  22645. @@ -1,24 +0,0 @@
  22646. -From: Felix Fietkau <nbd@openwrt.org>
  22647. -Date: Sun, 13 Sep 2015 22:26:10 +0200
  22648. -Subject: [PATCH] ath10k: fix DMA related firmware crashes on multiple devices
  22649. -
  22650. -Some platforms really don't like DMA bursts of 256 bytes, and this
  22651. -causes the firmware to crash when sending beacons.
  22652. -Also, changing this based on the firmware version does not seem to make
  22653. -much sense, so use 128 bytes for all versions.
  22654. -
  22655. -Cc: stable@vger.kernel.org
  22656. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  22657. ----
  22658. -
  22659. ---- a/drivers/net/wireless/ath/ath10k/hw.h
  22660. -+++ b/drivers/net/wireless/ath/ath10k/hw.h
  22661. -@@ -253,7 +253,7 @@ struct ath10k_pktlog_hdr {
  22662. - #define TARGET_10X_MAX_FRAG_ENTRIES 0
  22663. -
  22664. - /* 10.2 parameters */
  22665. --#define TARGET_10_2_DMA_BURST_SIZE 1
  22666. -+#define TARGET_10_2_DMA_BURST_SIZE 0
  22667. -
  22668. - /* Target specific defines for WMI-TLV firmware */
  22669. - #define TARGET_TLV_NUM_VDEVS 3
  22670. 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
  22671. deleted file mode 100644
  22672. index c420d20..0000000
  22673. --- a/package/kernel/mac80211/patches/368-ath9k-declare-required-extra-tx-headroom.patch
  22674. +++ /dev/null
  22675. @@ -1,22 +0,0 @@
  22676. -From: Felix Fietkau <nbd@openwrt.org>
  22677. -Date: Thu, 24 Sep 2015 16:57:37 +0200
  22678. -Subject: [PATCH] ath9k: declare required extra tx headroom
  22679. -
  22680. -ath9k inserts padding between the 802.11 header and the data area (to
  22681. -align it). Since it didn't declare this extra required headroom, this
  22682. -led to some nasty issues like randomly dropped packets in some setups.
  22683. -
  22684. -Cc: stable@vger.kernel.org
  22685. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  22686. ----
  22687. -
  22688. ---- a/drivers/net/wireless/ath/ath9k/init.c
  22689. -+++ b/drivers/net/wireless/ath/ath9k/init.c
  22690. -@@ -867,6 +867,7 @@ static void ath9k_set_hw_capab(struct at
  22691. - hw->max_rate_tries = 10;
  22692. - hw->sta_data_size = sizeof(struct ath_node);
  22693. - hw->vif_data_size = sizeof(struct ath_vif);
  22694. -+ hw->extra_tx_headroom = 4;
  22695. -
  22696. - hw->wiphy->available_antennas_rx = BIT(ah->caps.max_rxchains) - 1;
  22697. - hw->wiphy->available_antennas_tx = BIT(ah->caps.max_txchains) - 1;
  22698. 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
  22699. deleted file mode 100644
  22700. index 1478efa..0000000
  22701. --- a/package/kernel/mac80211/patches/369-mac80211-initialize-tid-field-in-struct-ieee80211_tx.patch
  22702. +++ /dev/null
  22703. @@ -1,21 +0,0 @@
  22704. -From: Felix Fietkau <nbd@openwrt.org>
  22705. -Date: Mon, 5 Oct 2015 17:41:25 +0200
  22706. -Subject: [PATCH] mac80211: initialize tid field in struct ieee80211_txq
  22707. -
  22708. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  22709. ----
  22710. -
  22711. ---- a/net/mac80211/util.c
  22712. -+++ b/net/mac80211/util.c
  22713. -@@ -3323,9 +3323,11 @@ void ieee80211_init_tx_queue(struct ieee
  22714. - if (sta) {
  22715. - txqi->txq.sta = &sta->sta;
  22716. - sta->sta.txq[tid] = &txqi->txq;
  22717. -+ txqi->txq.tid = tid;
  22718. - txqi->txq.ac = ieee802_1d_to_ac[tid & 7];
  22719. - } else {
  22720. - sdata->vif.txq = &txqi->txq;
  22721. -+ txqi->txq.tid = 0;
  22722. - txqi->txq.ac = IEEE80211_AC_BE;
  22723. - }
  22724. - }
  22725. 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
  22726. deleted file mode 100644
  22727. index bcd1031..0000000
  22728. --- a/package/kernel/mac80211/patches/370-0001-brcmfmac-Fix-exception-handling.patch
  22729. +++ /dev/null
  22730. @@ -1,24 +0,0 @@
  22731. -From: Hante Meuleman <meuleman@broadcom.com>
  22732. -Date: Fri, 18 Sep 2015 22:08:04 +0200
  22733. -Subject: [PATCH] brcmfmac: Fix exception handling.
  22734. -
  22735. -In some exception situations the ifp->vif was not properly assigned
  22736. -which could result in crash.
  22737. -
  22738. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  22739. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  22740. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  22741. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  22742. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  22743. ----
  22744. -
  22745. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  22746. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  22747. -@@ -6331,6 +6331,7 @@ wiphy_unreg_out:
  22748. - priv_out:
  22749. - wl_deinit_priv(cfg);
  22750. - brcmf_free_vif(vif);
  22751. -+ ifp->vif = NULL;
  22752. - wiphy_out:
  22753. - brcmf_free_wiphy(wiphy);
  22754. - return NULL;
  22755. 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
  22756. deleted file mode 100644
  22757. index f4ab77b..0000000
  22758. --- a/package/kernel/mac80211/patches/370-0002-brcmfmac-Add-support-for-the-BCM4350-PCIE-device.patch
  22759. +++ /dev/null
  22760. @@ -1,81 +0,0 @@
  22761. -From: Hante Meuleman <meuleman@broadcom.com>
  22762. -Date: Fri, 18 Sep 2015 22:08:05 +0200
  22763. -Subject: [PATCH] brcmfmac: Add support for the BCM4350 PCIE device.
  22764. -
  22765. -This patch adds support fo the BRCM4350 2x2 11ac PCIE device.
  22766. -
  22767. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  22768. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  22769. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  22770. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  22771. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  22772. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  22773. ----
  22774. -
  22775. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  22776. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  22777. -@@ -647,6 +647,7 @@ static u32 brcmf_chip_tcm_rambase(struct
  22778. - return 0x198000;
  22779. - case BRCM_CC_4335_CHIP_ID:
  22780. - case BRCM_CC_4339_CHIP_ID:
  22781. -+ case BRCM_CC_4350_CHIP_ID:
  22782. - case BRCM_CC_4354_CHIP_ID:
  22783. - case BRCM_CC_4356_CHIP_ID:
  22784. - case BRCM_CC_43567_CHIP_ID:
  22785. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  22786. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  22787. -@@ -47,6 +47,8 @@ enum brcmf_pcie_state {
  22788. -
  22789. - #define BRCMF_PCIE_43602_FW_NAME "brcm/brcmfmac43602-pcie.bin"
  22790. - #define BRCMF_PCIE_43602_NVRAM_NAME "brcm/brcmfmac43602-pcie.txt"
  22791. -+#define BRCMF_PCIE_4350_FW_NAME "brcm/brcmfmac4350-pcie.bin"
  22792. -+#define BRCMF_PCIE_4350_NVRAM_NAME "brcm/brcmfmac4350-pcie.txt"
  22793. - #define BRCMF_PCIE_4356_FW_NAME "brcm/brcmfmac4356-pcie.bin"
  22794. - #define BRCMF_PCIE_4356_NVRAM_NAME "brcm/brcmfmac4356-pcie.txt"
  22795. - #define BRCMF_PCIE_43570_FW_NAME "brcm/brcmfmac43570-pcie.bin"
  22796. -@@ -194,6 +196,8 @@ enum brcmf_pcie_state {
  22797. -
  22798. - MODULE_FIRMWARE(BRCMF_PCIE_43602_FW_NAME);
  22799. - MODULE_FIRMWARE(BRCMF_PCIE_43602_NVRAM_NAME);
  22800. -+MODULE_FIRMWARE(BRCMF_PCIE_4350_FW_NAME);
  22801. -+MODULE_FIRMWARE(BRCMF_PCIE_4350_NVRAM_NAME);
  22802. - MODULE_FIRMWARE(BRCMF_PCIE_4356_FW_NAME);
  22803. - MODULE_FIRMWARE(BRCMF_PCIE_4356_NVRAM_NAME);
  22804. - MODULE_FIRMWARE(BRCMF_PCIE_43570_FW_NAME);
  22805. -@@ -1418,6 +1422,10 @@ static int brcmf_pcie_get_fwnames(struct
  22806. - fw_name = BRCMF_PCIE_43602_FW_NAME;
  22807. - nvram_name = BRCMF_PCIE_43602_NVRAM_NAME;
  22808. - break;
  22809. -+ case BRCM_CC_4350_CHIP_ID:
  22810. -+ fw_name = BRCMF_PCIE_4350_FW_NAME;
  22811. -+ nvram_name = BRCMF_PCIE_4350_NVRAM_NAME;
  22812. -+ break;
  22813. - case BRCM_CC_4356_CHIP_ID:
  22814. - fw_name = BRCMF_PCIE_4356_FW_NAME;
  22815. - nvram_name = BRCMF_PCIE_4356_NVRAM_NAME;
  22816. -@@ -1956,6 +1964,7 @@ cleanup:
  22817. - PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 }
  22818. -
  22819. - static struct pci_device_id brcmf_pcie_devid_table[] = {
  22820. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4350_DEVICE_ID),
  22821. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4356_DEVICE_ID),
  22822. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43567_DEVICE_ID),
  22823. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43570_DEVICE_ID),
  22824. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  22825. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  22826. -@@ -39,6 +39,7 @@
  22827. - #define BRCM_CC_4339_CHIP_ID 0x4339
  22828. - #define BRCM_CC_43430_CHIP_ID 43430
  22829. - #define BRCM_CC_4345_CHIP_ID 0x4345
  22830. -+#define BRCM_CC_4350_CHIP_ID 0x4350
  22831. - #define BRCM_CC_4354_CHIP_ID 0x4354
  22832. - #define BRCM_CC_4356_CHIP_ID 0x4356
  22833. - #define BRCM_CC_43566_CHIP_ID 43566
  22834. -@@ -56,6 +57,7 @@
  22835. - #define BRCM_USB_BCMFW_DEVICE_ID 0x0bdc
  22836. -
  22837. - /* PCIE Device IDs */
  22838. -+#define BRCM_PCIE_4350_DEVICE_ID 0x43a3
  22839. - #define BRCM_PCIE_4354_DEVICE_ID 0x43df
  22840. - #define BRCM_PCIE_4356_DEVICE_ID 0x43ec
  22841. - #define BRCM_PCIE_43567_DEVICE_ID 0x43d3
  22842. 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
  22843. deleted file mode 100644
  22844. index 62fdd8d..0000000
  22845. --- a/package/kernel/mac80211/patches/370-0003-brcmfmac-Fix-set-and-get-tx-power-functions.patch
  22846. +++ /dev/null
  22847. @@ -1,218 +0,0 @@
  22848. -From: Hante Meuleman <meuleman@broadcom.com>
  22849. -Date: Fri, 18 Sep 2015 22:08:06 +0200
  22850. -Subject: [PATCH] brcmfmac: Fix set and get tx-power functions.
  22851. -
  22852. -Implementation of tx-power (get and set) related functions are
  22853. -still assuming mW interface. This is wrong as functions use dbm
  22854. -(or mbm) nowadays. As a result a tx power configuration could
  22855. -result in wrong power configuration.
  22856. -
  22857. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  22858. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  22859. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  22860. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  22861. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  22862. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  22863. ----
  22864. -
  22865. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  22866. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  22867. -@@ -236,89 +236,6 @@ static int brcmf_roamoff;
  22868. - module_param_named(roamoff, brcmf_roamoff, int, S_IRUSR);
  22869. - MODULE_PARM_DESC(roamoff, "do not use internal roaming engine");
  22870. -
  22871. --/* Quarter dBm units to mW
  22872. -- * Table starts at QDBM_OFFSET, so the first entry is mW for qdBm=153
  22873. -- * Table is offset so the last entry is largest mW value that fits in
  22874. -- * a u16.
  22875. -- */
  22876. --
  22877. --#define QDBM_OFFSET 153 /* Offset for first entry */
  22878. --#define QDBM_TABLE_LEN 40 /* Table size */
  22879. --
  22880. --/* Smallest mW value that will round up to the first table entry, QDBM_OFFSET.
  22881. -- * Value is ( mW(QDBM_OFFSET - 1) + mW(QDBM_OFFSET) ) / 2
  22882. -- */
  22883. --#define QDBM_TABLE_LOW_BOUND 6493 /* Low bound */
  22884. --
  22885. --/* Largest mW value that will round down to the last table entry,
  22886. -- * QDBM_OFFSET + QDBM_TABLE_LEN-1.
  22887. -- * Value is ( mW(QDBM_OFFSET + QDBM_TABLE_LEN - 1) +
  22888. -- * mW(QDBM_OFFSET + QDBM_TABLE_LEN) ) / 2.
  22889. -- */
  22890. --#define QDBM_TABLE_HIGH_BOUND 64938 /* High bound */
  22891. --
  22892. --static const u16 nqdBm_to_mW_map[QDBM_TABLE_LEN] = {
  22893. --/* qdBm: +0 +1 +2 +3 +4 +5 +6 +7 */
  22894. --/* 153: */ 6683, 7079, 7499, 7943, 8414, 8913, 9441, 10000,
  22895. --/* 161: */ 10593, 11220, 11885, 12589, 13335, 14125, 14962, 15849,
  22896. --/* 169: */ 16788, 17783, 18836, 19953, 21135, 22387, 23714, 25119,
  22897. --/* 177: */ 26607, 28184, 29854, 31623, 33497, 35481, 37584, 39811,
  22898. --/* 185: */ 42170, 44668, 47315, 50119, 53088, 56234, 59566, 63096
  22899. --};
  22900. --
  22901. --static u16 brcmf_qdbm_to_mw(u8 qdbm)
  22902. --{
  22903. -- uint factor = 1;
  22904. -- int idx = qdbm - QDBM_OFFSET;
  22905. --
  22906. -- if (idx >= QDBM_TABLE_LEN)
  22907. -- /* clamp to max u16 mW value */
  22908. -- return 0xFFFF;
  22909. --
  22910. -- /* scale the qdBm index up to the range of the table 0-40
  22911. -- * where an offset of 40 qdBm equals a factor of 10 mW.
  22912. -- */
  22913. -- while (idx < 0) {
  22914. -- idx += 40;
  22915. -- factor *= 10;
  22916. -- }
  22917. --
  22918. -- /* return the mW value scaled down to the correct factor of 10,
  22919. -- * adding in factor/2 to get proper rounding.
  22920. -- */
  22921. -- return (nqdBm_to_mW_map[idx] + factor / 2) / factor;
  22922. --}
  22923. --
  22924. --static u8 brcmf_mw_to_qdbm(u16 mw)
  22925. --{
  22926. -- u8 qdbm;
  22927. -- int offset;
  22928. -- uint mw_uint = mw;
  22929. -- uint boundary;
  22930. --
  22931. -- /* handle boundary case */
  22932. -- if (mw_uint <= 1)
  22933. -- return 0;
  22934. --
  22935. -- offset = QDBM_OFFSET;
  22936. --
  22937. -- /* move mw into the range of the table */
  22938. -- while (mw_uint < QDBM_TABLE_LOW_BOUND) {
  22939. -- mw_uint *= 10;
  22940. -- offset -= 40;
  22941. -- }
  22942. --
  22943. -- for (qdbm = 0; qdbm < QDBM_TABLE_LEN - 1; qdbm++) {
  22944. -- boundary = nqdBm_to_mW_map[qdbm] + (nqdBm_to_mW_map[qdbm + 1] -
  22945. -- nqdBm_to_mW_map[qdbm]) / 2;
  22946. -- if (mw_uint < boundary)
  22947. -- break;
  22948. -- }
  22949. --
  22950. -- qdbm += (u8) offset;
  22951. --
  22952. -- return qdbm;
  22953. --}
  22954. -
  22955. - static u16 chandef_to_chanspec(struct brcmu_d11inf *d11inf,
  22956. - struct cfg80211_chan_def *ch)
  22957. -@@ -2016,16 +1933,14 @@ static s32
  22958. - brcmf_cfg80211_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
  22959. - enum nl80211_tx_power_setting type, s32 mbm)
  22960. - {
  22961. --
  22962. - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  22963. - struct net_device *ndev = cfg_to_ndev(cfg);
  22964. - struct brcmf_if *ifp = netdev_priv(ndev);
  22965. -- u16 txpwrmw;
  22966. -- s32 err = 0;
  22967. -- s32 disable = 0;
  22968. -- s32 dbm = MBM_TO_DBM(mbm);
  22969. -+ s32 err;
  22970. -+ s32 disable;
  22971. -+ u32 qdbm = 127;
  22972. -
  22973. -- brcmf_dbg(TRACE, "Enter\n");
  22974. -+ brcmf_dbg(TRACE, "Enter %d %d\n", type, mbm);
  22975. - if (!check_vif_up(ifp->vif))
  22976. - return -EIO;
  22977. -
  22978. -@@ -2034,12 +1949,20 @@ brcmf_cfg80211_set_tx_power(struct wiphy
  22979. - break;
  22980. - case NL80211_TX_POWER_LIMITED:
  22981. - case NL80211_TX_POWER_FIXED:
  22982. -- if (dbm < 0) {
  22983. -+ if (mbm < 0) {
  22984. - brcmf_err("TX_POWER_FIXED - dbm is negative\n");
  22985. - err = -EINVAL;
  22986. - goto done;
  22987. - }
  22988. -+ qdbm = MBM_TO_DBM(4 * mbm);
  22989. -+ if (qdbm > 127)
  22990. -+ qdbm = 127;
  22991. -+ qdbm |= WL_TXPWR_OVERRIDE;
  22992. - break;
  22993. -+ default:
  22994. -+ brcmf_err("Unsupported type %d\n", type);
  22995. -+ err = -EINVAL;
  22996. -+ goto done;
  22997. - }
  22998. - /* Make sure radio is off or on as far as software is concerned */
  22999. - disable = WL_RADIO_SW_DISABLE << 16;
  23000. -@@ -2047,52 +1970,44 @@ brcmf_cfg80211_set_tx_power(struct wiphy
  23001. - if (err)
  23002. - brcmf_err("WLC_SET_RADIO error (%d)\n", err);
  23003. -
  23004. -- if (dbm > 0xffff)
  23005. -- txpwrmw = 0xffff;
  23006. -- else
  23007. -- txpwrmw = (u16) dbm;
  23008. -- err = brcmf_fil_iovar_int_set(ifp, "qtxpower",
  23009. -- (s32)brcmf_mw_to_qdbm(txpwrmw));
  23010. -+ err = brcmf_fil_iovar_int_set(ifp, "qtxpower", qdbm);
  23011. - if (err)
  23012. - brcmf_err("qtxpower error (%d)\n", err);
  23013. -- cfg->conf->tx_power = dbm;
  23014. -
  23015. - done:
  23016. -- brcmf_dbg(TRACE, "Exit\n");
  23017. -+ brcmf_dbg(TRACE, "Exit %d (qdbm)\n", qdbm & ~WL_TXPWR_OVERRIDE);
  23018. - return err;
  23019. - }
  23020. -
  23021. --static s32 brcmf_cfg80211_get_tx_power(struct wiphy *wiphy,
  23022. -- struct wireless_dev *wdev,
  23023. -- s32 *dbm)
  23024. -+static s32
  23025. -+brcmf_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
  23026. -+ s32 *dbm)
  23027. - {
  23028. - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  23029. -- struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg));
  23030. -- s32 txpwrdbm;
  23031. -- u8 result;
  23032. -- s32 err = 0;
  23033. -+ struct net_device *ndev = cfg_to_ndev(cfg);
  23034. -+ struct brcmf_if *ifp = netdev_priv(ndev);
  23035. -+ s32 qdbm = 0;
  23036. -+ s32 err;
  23037. -
  23038. - brcmf_dbg(TRACE, "Enter\n");
  23039. - if (!check_vif_up(ifp->vif))
  23040. - return -EIO;
  23041. -
  23042. -- err = brcmf_fil_iovar_int_get(ifp, "qtxpower", &txpwrdbm);
  23043. -+ err = brcmf_fil_iovar_int_get(ifp, "qtxpower", &qdbm);
  23044. - if (err) {
  23045. - brcmf_err("error (%d)\n", err);
  23046. - goto done;
  23047. - }
  23048. --
  23049. -- result = (u8) (txpwrdbm & ~WL_TXPWR_OVERRIDE);
  23050. -- *dbm = (s32) brcmf_qdbm_to_mw(result);
  23051. -+ *dbm = (qdbm & ~WL_TXPWR_OVERRIDE) / 4;
  23052. -
  23053. - done:
  23054. -- brcmf_dbg(TRACE, "Exit\n");
  23055. -+ brcmf_dbg(TRACE, "Exit (0x%x %d)\n", qdbm, *dbm);
  23056. - return err;
  23057. - }
  23058. -
  23059. - static s32
  23060. - brcmf_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *ndev,
  23061. -- u8 key_idx, bool unicast, bool multicast)
  23062. -+ u8 key_idx, bool unicast, bool multicast)
  23063. - {
  23064. - struct brcmf_if *ifp = netdev_priv(ndev);
  23065. - u32 index;
  23066. 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
  23067. deleted file mode 100644
  23068. index c51365f..0000000
  23069. --- a/package/kernel/mac80211/patches/370-0004-brcmfmac-Only-assign-primary-netdev-to-if2bss-array.patch
  23070. +++ /dev/null
  23071. @@ -1,73 +0,0 @@
  23072. -From: Hante Meuleman <meuleman@broadcom.com>
  23073. -Date: Fri, 18 Sep 2015 22:08:07 +0200
  23074. -Subject: [PATCH] brcmfmac: Only assign primary netdev to if2bss array.
  23075. -
  23076. -The if2bss allows for translation of ifidx to bssidx which has a 1:n
  23077. -relation. Therefor only the first (primary) netdev should be
  23078. -assigned in this array. This fixes the p2pon=1 module param usage.
  23079. -
  23080. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  23081. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  23082. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  23083. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  23084. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  23085. ----
  23086. -
  23087. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  23088. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  23089. -@@ -53,6 +53,8 @@ MODULE_LICENSE("Dual BSD/GPL");
  23090. - #define BRCMF_RXREORDER_EXPIDX_VALID 0x08
  23091. - #define BRCMF_RXREORDER_NEW_HOLE 0x10
  23092. -
  23093. -+#define BRCMF_BSSIDX_INVALID -1
  23094. -+
  23095. - /* Error bits */
  23096. - int brcmf_msg_level;
  23097. - module_param_named(debug, brcmf_msg_level, int, S_IRUSR | S_IWUSR);
  23098. -@@ -837,7 +839,8 @@ struct brcmf_if *brcmf_add_if(struct brc
  23099. - ifp = netdev_priv(ndev);
  23100. - ifp->ndev = ndev;
  23101. - /* store mapping ifidx to bssidx */
  23102. -- drvr->if2bss[ifidx] = bssidx;
  23103. -+ if (drvr->if2bss[ifidx] == BRCMF_BSSIDX_INVALID)
  23104. -+ drvr->if2bss[ifidx] = bssidx;
  23105. - }
  23106. -
  23107. - ifp->drvr = drvr;
  23108. -@@ -862,15 +865,15 @@ static void brcmf_del_if(struct brcmf_pu
  23109. - struct brcmf_if *ifp;
  23110. -
  23111. - ifp = drvr->iflist[bssidx];
  23112. -- drvr->if2bss[ifp->ifidx] = -1;
  23113. - drvr->iflist[bssidx] = NULL;
  23114. - if (!ifp) {
  23115. - brcmf_err("Null interface, idx=%d\n", bssidx);
  23116. - return;
  23117. - }
  23118. - brcmf_dbg(TRACE, "Enter, idx=%d, ifidx=%d\n", bssidx, ifp->ifidx);
  23119. -+ if (drvr->if2bss[ifp->ifidx] == bssidx)
  23120. -+ drvr->if2bss[ifp->ifidx] = BRCMF_BSSIDX_INVALID;
  23121. - if (ifp->ndev) {
  23122. -- drvr->if2bss[ifp->ifidx] = -1;
  23123. - if (bssidx == 0) {
  23124. - if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) {
  23125. - rtnl_lock();
  23126. -@@ -926,6 +929,7 @@ int brcmf_attach(struct device *dev)
  23127. - {
  23128. - struct brcmf_pub *drvr = NULL;
  23129. - int ret = 0;
  23130. -+ int i;
  23131. -
  23132. - brcmf_dbg(TRACE, "Enter\n");
  23133. -
  23134. -@@ -934,7 +938,9 @@ int brcmf_attach(struct device *dev)
  23135. - if (!drvr)
  23136. - return -ENOMEM;
  23137. -
  23138. -- memset(drvr->if2bss, 0xFF, sizeof(drvr->if2bss));
  23139. -+ for (i = 0; i < ARRAY_SIZE(drvr->if2bss); i++)
  23140. -+ drvr->if2bss[i] = BRCMF_BSSIDX_INVALID;
  23141. -+
  23142. - mutex_init(&drvr->proto_block);
  23143. -
  23144. - /* Link to bus module */
  23145. 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
  23146. deleted file mode 100644
  23147. index 3c1058d..0000000
  23148. --- a/package/kernel/mac80211/patches/370-0005-brcmfmac-Inform-p2p-module-about-p2pon-through-API.patch
  23149. +++ /dev/null
  23150. @@ -1,113 +0,0 @@
  23151. -From: Hante Meuleman <meuleman@broadcom.com>
  23152. -Date: Fri, 18 Sep 2015 22:08:08 +0200
  23153. -Subject: [PATCH] brcmfmac: Inform p2p module about p2pon through API
  23154. -
  23155. -When the p2pon module param is used then p2p attach will initialize
  23156. -p2p device iface in the firmware, but it is doing that by checking
  23157. -data. It is cleaner to pass the p2pon information to p2p by API.
  23158. -This information is also needed for other patch.
  23159. -
  23160. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  23161. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  23162. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  23163. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  23164. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  23165. ----
  23166. -
  23167. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  23168. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  23169. -@@ -6126,7 +6126,8 @@ static void brcmf_free_wiphy(struct wiph
  23170. - }
  23171. -
  23172. - struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
  23173. -- struct device *busdev)
  23174. -+ struct device *busdev,
  23175. -+ bool p2pdev_forced)
  23176. - {
  23177. - struct net_device *ndev = brcmf_get_ifp(drvr, 0)->ndev;
  23178. - struct brcmf_cfg80211_info *cfg;
  23179. -@@ -6218,7 +6219,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  23180. - *cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
  23181. - }
  23182. -
  23183. -- err = brcmf_p2p_attach(cfg);
  23184. -+ err = brcmf_p2p_attach(cfg, p2pdev_forced);
  23185. - if (err) {
  23186. - brcmf_err("P2P initilisation failed (%d)\n", err);
  23187. - goto wiphy_unreg_out;
  23188. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  23189. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  23190. -@@ -469,7 +469,8 @@ brcmf_cfg80211_connect_info *cfg_to_conn
  23191. - }
  23192. -
  23193. - struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
  23194. -- struct device *busdev);
  23195. -+ struct device *busdev,
  23196. -+ bool p2pdev_forced);
  23197. - void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg);
  23198. - s32 brcmf_cfg80211_up(struct net_device *ndev);
  23199. - s32 brcmf_cfg80211_down(struct net_device *ndev);
  23200. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  23201. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  23202. -@@ -1044,7 +1044,8 @@ int brcmf_bus_start(struct device *dev)
  23203. -
  23204. - brcmf_fws_add_interface(ifp);
  23205. -
  23206. -- drvr->config = brcmf_cfg80211_attach(drvr, bus_if->dev);
  23207. -+ drvr->config = brcmf_cfg80211_attach(drvr, bus_if->dev,
  23208. -+ brcmf_p2p_enable);
  23209. - if (drvr->config == NULL) {
  23210. - ret = -ENOMEM;
  23211. - goto fail;
  23212. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  23213. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  23214. -@@ -2333,7 +2333,7 @@ void brcmf_p2p_stop_device(struct wiphy
  23215. - *
  23216. - * @cfg: driver private data for cfg80211 interface.
  23217. - */
  23218. --s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg)
  23219. -+s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced)
  23220. - {
  23221. - struct brcmf_if *pri_ifp;
  23222. - struct brcmf_if *p2p_ifp;
  23223. -@@ -2348,11 +2348,15 @@ s32 brcmf_p2p_attach(struct brcmf_cfg802
  23224. -
  23225. - drvr = cfg->pub;
  23226. -
  23227. -- pri_ifp = drvr->iflist[0];
  23228. -- p2p_ifp = drvr->iflist[1];
  23229. --
  23230. -+ pri_ifp = brcmf_get_ifp(drvr, 0);
  23231. - p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif = pri_ifp->vif;
  23232. -
  23233. -+ if (p2pdev_forced) {
  23234. -+ p2p_ifp = drvr->iflist[1];
  23235. -+ } else {
  23236. -+ p2p_ifp = NULL;
  23237. -+ p2p->p2pdev_dynamically = true;
  23238. -+ }
  23239. - if (p2p_ifp) {
  23240. - p2p_vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_P2P_DEVICE,
  23241. - false);
  23242. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.h
  23243. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.h
  23244. -@@ -124,6 +124,7 @@ struct afx_hdl {
  23245. - * @wait_next_af: thread synchronizing struct.
  23246. - * @gon_req_action: about to send go negotiation requets frame.
  23247. - * @block_gon_req_tx: drop tx go negotiation requets frame.
  23248. -+ * @p2pdev_dynamically: is p2p device if created by module param or supplicant.
  23249. - */
  23250. - struct brcmf_p2p_info {
  23251. - struct brcmf_cfg80211_info *cfg;
  23252. -@@ -144,9 +145,10 @@ struct brcmf_p2p_info {
  23253. - struct completion wait_next_af;
  23254. - bool gon_req_action;
  23255. - bool block_gon_req_tx;
  23256. -+ bool p2pdev_dynamically;
  23257. - };
  23258. -
  23259. --s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg);
  23260. -+s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced);
  23261. - void brcmf_p2p_detach(struct brcmf_p2p_info *p2p);
  23262. - struct wireless_dev *brcmf_p2p_add_vif(struct wiphy *wiphy, const char *name,
  23263. - enum nl80211_iftype type, u32 *flags,
  23264. 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
  23265. deleted file mode 100644
  23266. index 66b2117..0000000
  23267. --- a/package/kernel/mac80211/patches/370-0006-brcmfmac-Fix-bug-in-flowring-management.patch
  23268. +++ /dev/null
  23269. @@ -1,26 +0,0 @@
  23270. -From: Hante Meuleman <meuleman@broadcom.com>
  23271. -Date: Fri, 18 Sep 2015 22:08:09 +0200
  23272. -Subject: [PATCH] brcmfmac: Fix bug in flowring management.
  23273. -
  23274. -The hash index stored in the flowrings is of type u16 but gets
  23275. -stored in u8. This can result in incorrect indexing and possibly
  23276. -result in crashes. This patch fixes the type.
  23277. -
  23278. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  23279. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  23280. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  23281. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  23282. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  23283. ----
  23284. -
  23285. ---- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.h
  23286. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.h
  23287. -@@ -34,7 +34,7 @@ enum ring_status {
  23288. - };
  23289. -
  23290. - struct brcmf_flowring_ring {
  23291. -- u8 hash_id;
  23292. -+ u16 hash_id;
  23293. - bool blocked;
  23294. - enum ring_status status;
  23295. - struct sk_buff_head skblist;
  23296. 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
  23297. deleted file mode 100644
  23298. index c143c3b..0000000
  23299. --- a/package/kernel/mac80211/patches/370-0007-brcmfmac-Make-p2pon-module-param-always-available.patch
  23300. +++ /dev/null
  23301. @@ -1,29 +0,0 @@
  23302. -From: Hante Meuleman <meuleman@broadcom.com>
  23303. -Date: Fri, 18 Sep 2015 22:08:10 +0200
  23304. -Subject: [PATCH] brcmfmac: Make p2pon module param always available.
  23305. -
  23306. -p2pon module param is currently under define BRCMDBG. Though it is
  23307. -a needed option for older versions of the wpa_supplicant which do not
  23308. -support the P2P_DEVICE interface.
  23309. -
  23310. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  23311. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  23312. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  23313. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  23314. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  23315. ----
  23316. -
  23317. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  23318. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  23319. -@@ -62,10 +62,8 @@ MODULE_PARM_DESC(debug, "level of debug
  23320. -
  23321. - /* P2P0 enable */
  23322. - static int brcmf_p2p_enable;
  23323. --#ifdef CPTCFG_BRCMDBG
  23324. - module_param_named(p2pon, brcmf_p2p_enable, int, 0);
  23325. --MODULE_PARM_DESC(p2pon, "enable p2p management functionality");
  23326. --#endif
  23327. -+MODULE_PARM_DESC(p2pon, "enable legacy p2p management functionality");
  23328. -
  23329. - char *brcmf_ifname(struct brcmf_pub *drvr, int ifidx)
  23330. - {
  23331. 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
  23332. deleted file mode 100644
  23333. index 15ac2d9..0000000
  23334. --- a/package/kernel/mac80211/patches/370-0008-brcmfmac-Workaround-in-change-vif-for-wpa_supplicant.patch
  23335. +++ /dev/null
  23336. @@ -1,76 +0,0 @@
  23337. -From: Hante Meuleman <meuleman@broadcom.com>
  23338. -Date: Fri, 18 Sep 2015 22:08:11 +0200
  23339. -Subject: [PATCH] brcmfmac: Workaround in change vif for wpa_supplicant
  23340. - support.
  23341. -
  23342. -Different wpa_supplicants have different behavior and expectations
  23343. -regarding the change_virtual_intf behavior. This patch implements
  23344. -a workaround for the different versions and possible brcmfmac
  23345. -configuration.
  23346. -
  23347. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  23348. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  23349. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  23350. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  23351. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  23352. ----
  23353. -
  23354. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  23355. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  23356. -@@ -776,6 +776,37 @@ brcmf_cfg80211_change_iface(struct wiphy
  23357. - s32 err = 0;
  23358. -
  23359. - brcmf_dbg(TRACE, "Enter, idx=%d, type=%d\n", ifp->bssidx, type);
  23360. -+
  23361. -+ /* WAR: There are a number of p2p interface related problems which
  23362. -+ * need to be handled initially (before doing the validate).
  23363. -+ * wpa_supplicant tends to do iface changes on p2p device/client/go
  23364. -+ * which are not always possible/allowed. However we need to return
  23365. -+ * OK otherwise the wpa_supplicant wont start. The situation differs
  23366. -+ * on configuration and setup (p2pon=1 module param). The first check
  23367. -+ * is to see if the request is a change to station for p2p iface.
  23368. -+ */
  23369. -+ if ((type == NL80211_IFTYPE_STATION) &&
  23370. -+ ((vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT) ||
  23371. -+ (vif->wdev.iftype == NL80211_IFTYPE_P2P_GO) ||
  23372. -+ (vif->wdev.iftype == NL80211_IFTYPE_P2P_DEVICE))) {
  23373. -+ brcmf_dbg(TRACE, "Ignoring cmd for p2p if\n");
  23374. -+ /* Now depending on whether module param p2pon=1 was used the
  23375. -+ * response needs to be either 0 or EOPNOTSUPP. The reason is
  23376. -+ * that if p2pon=1 is used, but a newer supplicant is used then
  23377. -+ * we should return an error, as this combination wont work.
  23378. -+ * In other situations 0 is returned and supplicant will start
  23379. -+ * normally. It will give a trace in cfg80211, but it is the
  23380. -+ * only way to get it working. Unfortunately this will result
  23381. -+ * in situation where we wont support new supplicant in
  23382. -+ * combination with module param p2pon=1, but that is the way
  23383. -+ * it is. If the user tries this then unloading of driver might
  23384. -+ * fail/lock.
  23385. -+ */
  23386. -+ if (cfg->p2p.p2pdev_dynamically)
  23387. -+ return -EOPNOTSUPP;
  23388. -+ else
  23389. -+ return 0;
  23390. -+ }
  23391. - err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type);
  23392. - if (err) {
  23393. - brcmf_err("iface validation failed: err=%d\n", err);
  23394. -@@ -791,18 +822,6 @@ brcmf_cfg80211_change_iface(struct wiphy
  23395. - infra = 0;
  23396. - break;
  23397. - case NL80211_IFTYPE_STATION:
  23398. -- /* Ignore change for p2p IF. Unclear why supplicant does this */
  23399. -- if ((vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT) ||
  23400. -- (vif->wdev.iftype == NL80211_IFTYPE_P2P_GO)) {
  23401. -- brcmf_dbg(TRACE, "Ignoring cmd for p2p if\n");
  23402. -- /* WAR: It is unexpected to get a change of VIF for P2P
  23403. -- * IF, but it happens. The request can not be handled
  23404. -- * but returning EPERM causes a crash. Returning 0
  23405. -- * without setting ieee80211_ptr->iftype causes trace
  23406. -- * (WARN_ON) but it works with wpa_supplicant
  23407. -- */
  23408. -- return 0;
  23409. -- }
  23410. - infra = 1;
  23411. - break;
  23412. - case NL80211_IFTYPE_AP:
  23413. 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
  23414. deleted file mode 100644
  23415. index 1988b5c..0000000
  23416. --- a/package/kernel/mac80211/patches/370-0009-brcmfmac-Deleting-of-p2p-device-is-leaking-memory.patch
  23417. +++ /dev/null
  23418. @@ -1,124 +0,0 @@
  23419. -From: Hante Meuleman <meuleman@broadcom.com>
  23420. -Date: Fri, 18 Sep 2015 22:08:12 +0200
  23421. -Subject: [PATCH] brcmfmac: Deleting of p2p device is leaking memory.
  23422. -
  23423. -When a p2p device gets deleted, the memory for the vif is not being
  23424. -released. This is solved by reorganizing the cleanup path and
  23425. -properly freeing the memory.
  23426. -
  23427. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  23428. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  23429. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  23430. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  23431. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  23432. ----
  23433. -
  23434. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  23435. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  23436. -@@ -887,6 +887,16 @@ static void brcmf_del_if(struct brcmf_pu
  23437. - cancel_work_sync(&ifp->multicast_work);
  23438. - }
  23439. - brcmf_net_detach(ifp->ndev);
  23440. -+ } else {
  23441. -+ /* Only p2p device interfaces which get dynamically created
  23442. -+ * end up here. In this case the p2p module should be informed
  23443. -+ * about the removal of the interface within the firmware. If
  23444. -+ * not then p2p commands towards the firmware will cause some
  23445. -+ * serious troublesome side effects. The p2p module will clean
  23446. -+ * up the ifp if needed.
  23447. -+ */
  23448. -+ brcmf_p2p_ifp_removed(ifp);
  23449. -+ kfree(ifp);
  23450. - }
  23451. - }
  23452. -
  23453. -@@ -894,7 +904,8 @@ void brcmf_remove_interface(struct brcmf
  23454. - {
  23455. - if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bssidx] != ifp))
  23456. - return;
  23457. --
  23458. -+ brcmf_dbg(TRACE, "Enter, bssidx=%d, ifidx=%d\n", ifp->bssidx,
  23459. -+ ifp->ifidx);
  23460. - brcmf_fws_del_interface(ifp);
  23461. - brcmf_del_if(ifp->drvr, ifp->bssidx);
  23462. - }
  23463. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  23464. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  23465. -@@ -2131,20 +2131,6 @@ fail:
  23466. - }
  23467. -
  23468. - /**
  23469. -- * brcmf_p2p_delete_p2pdev() - delete P2P_DEVICE virtual interface.
  23470. -- *
  23471. -- * @vif: virtual interface object to delete.
  23472. -- */
  23473. --static void brcmf_p2p_delete_p2pdev(struct brcmf_p2p_info *p2p,
  23474. -- struct brcmf_cfg80211_vif *vif)
  23475. --{
  23476. -- cfg80211_unregister_wdev(&vif->wdev);
  23477. -- p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  23478. -- brcmf_remove_interface(vif->ifp);
  23479. -- brcmf_free_vif(vif);
  23480. --}
  23481. --
  23482. --/**
  23483. - * brcmf_p2p_add_vif() - create a new P2P virtual interface.
  23484. - *
  23485. - * @wiphy: wiphy device of new interface.
  23486. -@@ -2264,9 +2250,11 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  23487. - break;
  23488. -
  23489. - case NL80211_IFTYPE_P2P_DEVICE:
  23490. -+ if (!p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif)
  23491. -+ return 0;
  23492. - brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  23493. - brcmf_p2p_deinit_discovery(p2p);
  23494. -- brcmf_p2p_delete_p2pdev(p2p, vif);
  23495. -+ brcmf_remove_interface(vif->ifp);
  23496. - return 0;
  23497. - default:
  23498. - return -ENOTSUPP;
  23499. -@@ -2298,6 +2286,21 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  23500. - return err;
  23501. - }
  23502. -
  23503. -+void brcmf_p2p_ifp_removed(struct brcmf_if *ifp)
  23504. -+{
  23505. -+ struct brcmf_cfg80211_info *cfg;
  23506. -+ struct brcmf_cfg80211_vif *vif;
  23507. -+
  23508. -+ brcmf_dbg(INFO, "P2P: device interface removed\n");
  23509. -+ vif = ifp->vif;
  23510. -+ cfg = wdev_to_cfg(&vif->wdev);
  23511. -+ cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  23512. -+ rtnl_lock();
  23513. -+ cfg80211_unregister_wdev(&vif->wdev);
  23514. -+ rtnl_unlock();
  23515. -+ brcmf_free_vif(vif);
  23516. -+}
  23517. -+
  23518. - int brcmf_p2p_start_device(struct wiphy *wiphy, struct wireless_dev *wdev)
  23519. - {
  23520. - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  23521. -@@ -2422,10 +2425,7 @@ void brcmf_p2p_detach(struct brcmf_p2p_i
  23522. - if (vif != NULL) {
  23523. - brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  23524. - brcmf_p2p_deinit_discovery(p2p);
  23525. -- /* remove discovery interface */
  23526. -- rtnl_lock();
  23527. -- brcmf_p2p_delete_p2pdev(p2p, vif);
  23528. -- rtnl_unlock();
  23529. -+ brcmf_remove_interface(vif->ifp);
  23530. - }
  23531. - /* just set it all to zero */
  23532. - memset(p2p, 0, sizeof(*p2p));
  23533. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.h
  23534. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.h
  23535. -@@ -156,6 +156,7 @@ struct wireless_dev *brcmf_p2p_add_vif(s
  23536. - int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev);
  23537. - int brcmf_p2p_ifchange(struct brcmf_cfg80211_info *cfg,
  23538. - enum brcmf_fil_p2p_if_types if_type);
  23539. -+void brcmf_p2p_ifp_removed(struct brcmf_if *ifp);
  23540. - int brcmf_p2p_start_device(struct wiphy *wiphy, struct wireless_dev *wdev);
  23541. - void brcmf_p2p_stop_device(struct wiphy *wiphy, struct wireless_dev *wdev);
  23542. - int brcmf_p2p_scan_prep(struct wiphy *wiphy,
  23543. 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
  23544. deleted file mode 100644
  23545. index 5225c9e..0000000
  23546. --- a/package/kernel/mac80211/patches/370-0010-brcmfmac-Only-handle-p2p_stop_device-if-vif-is-valid.patch
  23547. +++ /dev/null
  23548. @@ -1,40 +0,0 @@
  23549. -From: Hante Meuleman <meuleman@broadcom.com>
  23550. -Date: Fri, 18 Sep 2015 22:08:13 +0200
  23551. -Subject: [PATCH] brcmfmac: Only handle p2p_stop_device if vif is valid
  23552. -
  23553. -In some situations it is possible that vif has been removed while
  23554. -cfg80211 invokes the p2p_stop_device handler. This will result in
  23555. -crash.
  23556. -
  23557. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  23558. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  23559. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  23560. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  23561. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  23562. ----
  23563. -
  23564. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  23565. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  23566. -@@ -2324,11 +2324,17 @@ void brcmf_p2p_stop_device(struct wiphy
  23567. - struct brcmf_cfg80211_vif *vif;
  23568. -
  23569. - vif = container_of(wdev, struct brcmf_cfg80211_vif, wdev);
  23570. -- mutex_lock(&cfg->usr_sync);
  23571. -- (void)brcmf_p2p_deinit_discovery(p2p);
  23572. -- brcmf_abort_scanning(cfg);
  23573. -- clear_bit(BRCMF_VIF_STATUS_READY, &vif->sme_state);
  23574. -- mutex_unlock(&cfg->usr_sync);
  23575. -+ /* This call can be result of the unregister_wdev call. In that case
  23576. -+ * we dont want to do anything anymore. Just return. The config vif
  23577. -+ * will have been cleared at this point.
  23578. -+ */
  23579. -+ if (p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif == vif) {
  23580. -+ mutex_lock(&cfg->usr_sync);
  23581. -+ (void)brcmf_p2p_deinit_discovery(p2p);
  23582. -+ brcmf_abort_scanning(cfg);
  23583. -+ clear_bit(BRCMF_VIF_STATUS_READY, &vif->sme_state);
  23584. -+ mutex_unlock(&cfg->usr_sync);
  23585. -+ }
  23586. - }
  23587. -
  23588. - /**
  23589. 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
  23590. deleted file mode 100644
  23591. index e2f24e8..0000000
  23592. --- a/package/kernel/mac80211/patches/370-0011-brcmfmac-Fix-p2p-bug-for-older-firmwares.patch
  23593. +++ /dev/null
  23594. @@ -1,35 +0,0 @@
  23595. -From: Hante Meuleman <meuleman@broadcom.com>
  23596. -Date: Fri, 18 Sep 2015 22:08:14 +0200
  23597. -Subject: [PATCH] brcmfmac: Fix p2p bug for older firmwares.
  23598. -
  23599. -Some devices with older firmwares are reporting new p2p device
  23600. -interface with the wrong type. Accept this type to get p2p
  23601. -working for these devices.
  23602. -
  23603. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  23604. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  23605. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  23606. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  23607. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  23608. ----
  23609. -
  23610. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  23611. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  23612. -@@ -186,11 +186,13 @@ static void brcmf_fweh_handle_if_event(s
  23613. - ifevent->action, ifevent->ifidx, ifevent->bssidx,
  23614. - ifevent->flags, ifevent->role);
  23615. -
  23616. -- /* The P2P Device interface event must not be ignored
  23617. -- * contrary to what firmware tells us.
  23618. -+ /* The P2P Device interface event must not be ignored contrary to what
  23619. -+ * firmware tells us. Older firmware uses p2p noif, with sta role.
  23620. -+ * This should be accepted.
  23621. - */
  23622. -- is_p2pdev = (ifevent->flags & BRCMF_E_IF_FLAG_NOIF) &&
  23623. -- ifevent->role == BRCMF_E_IF_ROLE_P2P_CLIENT;
  23624. -+ is_p2pdev = ((ifevent->flags & BRCMF_E_IF_FLAG_NOIF) &&
  23625. -+ (ifevent->role == BRCMF_E_IF_ROLE_P2P_CLIENT ||
  23626. -+ ifevent->role == BRCMF_E_IF_ROLE_STA));
  23627. - if (!is_p2pdev && (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) {
  23628. - brcmf_dbg(EVENT, "event can be ignored\n");
  23629. - return;
  23630. 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
  23631. deleted file mode 100644
  23632. index 52c787f..0000000
  23633. --- a/package/kernel/mac80211/patches/370-0012-brcmfmac-Add-module-parameter-to-disable-features.patch
  23634. +++ /dev/null
  23635. @@ -1,54 +0,0 @@
  23636. -From: Hante Meuleman <meuleman@broadcom.com>
  23637. -Date: Fri, 18 Sep 2015 22:08:15 +0200
  23638. -Subject: [PATCH] brcmfmac: Add module parameter to disable features.
  23639. -
  23640. -For debugging purpose it is very handy to be able to disable
  23641. -features. It has happened a few times that new features turned
  23642. -out not always being properly detected for all devices/firmwares.
  23643. -Making it possible to disable the feature with a module parameter
  23644. -will make testing/debugging easier.
  23645. -
  23646. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  23647. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  23648. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  23649. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  23650. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  23651. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  23652. ----
  23653. -
  23654. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  23655. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  23656. -@@ -15,6 +15,7 @@
  23657. - */
  23658. -
  23659. - #include <linux/netdevice.h>
  23660. -+#include <linux/module.h>
  23661. -
  23662. - #include <brcm_hw_ids.h>
  23663. - #include "core.h"
  23664. -@@ -23,6 +24,12 @@
  23665. - #include "fwil.h"
  23666. - #include "feature.h"
  23667. -
  23668. -+
  23669. -+/* Module param feature_disable (global for all devices) */
  23670. -+static int brcmf_feature_disable;
  23671. -+module_param_named(feature_disable, brcmf_feature_disable, int, 0);
  23672. -+MODULE_PARM_DESC(feature_disable, "Disable features");
  23673. -+
  23674. - /*
  23675. - * expand feature list to array of feature strings.
  23676. - */
  23677. -@@ -131,6 +138,12 @@ void brcmf_feat_attach(struct brcmf_pub
  23678. - brcmf_feat_iovar_int_set(ifp, BRCMF_FEAT_MBSS, "mbss", 0);
  23679. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_P2P, "p2p");
  23680. -
  23681. -+ if (brcmf_feature_disable) {
  23682. -+ brcmf_dbg(INFO, "Features: 0x%02x, disable: 0x%02x\n",
  23683. -+ ifp->drvr->feat_flags, brcmf_feature_disable);
  23684. -+ ifp->drvr->feat_flags &= ~brcmf_feature_disable;
  23685. -+ }
  23686. -+
  23687. - /* set chip related quirks */
  23688. - switch (drvr->bus_if->chip) {
  23689. - case BRCM_CC_43236_CHIP_ID:
  23690. 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
  23691. deleted file mode 100644
  23692. index 58a638a..0000000
  23693. --- a/package/kernel/mac80211/patches/370-0013-brcmfmac-Fix-race-condition-bug-when-deleting-p2p-in.patch
  23694. +++ /dev/null
  23695. @@ -1,80 +0,0 @@
  23696. -From: Hante Meuleman <meuleman@broadcom.com>
  23697. -Date: Fri, 18 Sep 2015 22:08:16 +0200
  23698. -Subject: [PATCH] brcmfmac: Fix race condition bug when deleting p2p interface.
  23699. -
  23700. -When p2p device interface gets deleted by deinitialising discovery
  23701. -it will result in an event which removes the interface, but that is
  23702. -also done by delete p2p interface code. This results in race
  23703. -condition which sometimes results in lockup/crash. With this patch
  23704. -the delete device interface will wait for the event (with timeout)
  23705. -removing the possible race condition. Also on the stop device call
  23706. -from cfg80211 the deinitialisation of the discovery device should
  23707. -be avoided as it can result in a similar situation.
  23708. -
  23709. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  23710. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  23711. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  23712. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  23713. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  23714. ----
  23715. -
  23716. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  23717. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  23718. -@@ -2238,6 +2238,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  23719. - brcmf_dbg(TRACE, "delete P2P vif\n");
  23720. - vif = container_of(wdev, struct brcmf_cfg80211_vif, wdev);
  23721. -
  23722. -+ brcmf_cfg80211_arm_vif_event(cfg, vif);
  23723. - switch (vif->wdev.iftype) {
  23724. - case NL80211_IFTYPE_P2P_CLIENT:
  23725. - if (test_bit(BRCMF_VIF_STATUS_DISCONNECTING, &vif->sme_state))
  23726. -@@ -2254,8 +2255,6 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  23727. - return 0;
  23728. - brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  23729. - brcmf_p2p_deinit_discovery(p2p);
  23730. -- brcmf_remove_interface(vif->ifp);
  23731. -- return 0;
  23732. - default:
  23733. - return -ENOTSUPP;
  23734. - }
  23735. -@@ -2267,10 +2266,11 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  23736. - wait_for_completion_timeout(&cfg->vif_disabled,
  23737. - msecs_to_jiffies(500));
  23738. -
  23739. -- brcmf_vif_clear_mgmt_ies(vif);
  23740. --
  23741. -- brcmf_cfg80211_arm_vif_event(cfg, vif);
  23742. -- err = brcmf_p2p_release_p2p_if(vif);
  23743. -+ err = 0;
  23744. -+ if (vif->wdev.iftype != NL80211_IFTYPE_P2P_DEVICE) {
  23745. -+ brcmf_vif_clear_mgmt_ies(vif);
  23746. -+ err = brcmf_p2p_release_p2p_if(vif);
  23747. -+ }
  23748. - if (!err) {
  23749. - /* wait for firmware event */
  23750. - err = brcmf_cfg80211_wait_vif_event_timeout(cfg, BRCMF_E_IF_DEL,
  23751. -@@ -2280,8 +2280,12 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  23752. - else
  23753. - err = 0;
  23754. - }
  23755. -+ if (err)
  23756. -+ brcmf_remove_interface(vif->ifp);
  23757. -+
  23758. - brcmf_cfg80211_arm_vif_event(cfg, NULL);
  23759. -- p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif = NULL;
  23760. -+ if (vif->wdev.iftype != NL80211_IFTYPE_P2P_DEVICE)
  23761. -+ p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif = NULL;
  23762. -
  23763. - return err;
  23764. - }
  23765. -@@ -2330,7 +2334,9 @@ void brcmf_p2p_stop_device(struct wiphy
  23766. - */
  23767. - if (p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif == vif) {
  23768. - mutex_lock(&cfg->usr_sync);
  23769. -- (void)brcmf_p2p_deinit_discovery(p2p);
  23770. -+ /* Set the discovery state to SCAN */
  23771. -+ (void)brcmf_p2p_set_discover_state(vif->ifp,
  23772. -+ WL_P2P_DISC_ST_SCAN, 0, 0);
  23773. - brcmf_abort_scanning(cfg);
  23774. - clear_bit(BRCMF_VIF_STATUS_READY, &vif->sme_state);
  23775. - mutex_unlock(&cfg->usr_sync);
  23776. 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
  23777. deleted file mode 100644
  23778. index d0bbf2a..0000000
  23779. --- a/package/kernel/mac80211/patches/370-0014-brcmfmac-Add-support-for-the-BCM4365-and-BCM4366-PCI.patch
  23780. +++ /dev/null
  23781. @@ -1,277 +0,0 @@
  23782. -From: Hante Meuleman <meuleman@broadcom.com>
  23783. -Date: Fri, 18 Sep 2015 22:08:17 +0200
  23784. -Subject: [PATCH] brcmfmac: Add support for the BCM4365 and BCM4366 PCIE
  23785. - devices.
  23786. -
  23787. -This patch adds support for the BCM4365 and BCM4366 11ac Wave2
  23788. -PCIE devices.
  23789. -
  23790. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  23791. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  23792. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  23793. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  23794. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  23795. ----
  23796. -
  23797. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  23798. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  23799. -@@ -208,6 +208,7 @@ struct sbsocramregs {
  23800. - };
  23801. -
  23802. - #define SOCRAMREGOFFS(_f) offsetof(struct sbsocramregs, _f)
  23803. -+#define SYSMEMREGOFFS(_f) offsetof(struct sbsocramregs, _f)
  23804. -
  23805. - #define ARMCR4_CAP (0x04)
  23806. - #define ARMCR4_BANKIDX (0x40)
  23807. -@@ -516,6 +517,9 @@ static int brcmf_chip_cores_check(struct
  23808. - case BCMA_CORE_ARM_CR4:
  23809. - cpu_found = true;
  23810. - break;
  23811. -+ case BCMA_CORE_ARM_CA7:
  23812. -+ cpu_found = true;
  23813. -+ break;
  23814. - default:
  23815. - break;
  23816. - }
  23817. -@@ -614,6 +618,29 @@ static void brcmf_chip_socram_ramsize(st
  23818. - }
  23819. - }
  23820. -
  23821. -+/** Return the SYS MEM size */
  23822. -+static u32 brcmf_chip_sysmem_ramsize(struct brcmf_core_priv *sysmem)
  23823. -+{
  23824. -+ u32 memsize = 0;
  23825. -+ u32 coreinfo;
  23826. -+ u32 idx;
  23827. -+ u32 nb;
  23828. -+ u32 banksize;
  23829. -+
  23830. -+ if (!brcmf_chip_iscoreup(&sysmem->pub))
  23831. -+ brcmf_chip_resetcore(&sysmem->pub, 0, 0, 0);
  23832. -+
  23833. -+ coreinfo = brcmf_chip_core_read32(sysmem, SYSMEMREGOFFS(coreinfo));
  23834. -+ nb = (coreinfo & SRCI_SRNB_MASK) >> SRCI_SRNB_SHIFT;
  23835. -+
  23836. -+ for (idx = 0; idx < nb; idx++) {
  23837. -+ brcmf_chip_socram_banksize(sysmem, idx, &banksize);
  23838. -+ memsize += banksize;
  23839. -+ }
  23840. -+
  23841. -+ return memsize;
  23842. -+}
  23843. -+
  23844. - /** Return the TCM-RAM size of the ARMCR4 core. */
  23845. - static u32 brcmf_chip_tcm_ramsize(struct brcmf_core_priv *cr4)
  23846. - {
  23847. -@@ -656,6 +683,9 @@ static u32 brcmf_chip_tcm_rambase(struct
  23848. - case BRCM_CC_4358_CHIP_ID:
  23849. - case BRCM_CC_43602_CHIP_ID:
  23850. - return 0x180000;
  23851. -+ case BRCM_CC_4365_CHIP_ID:
  23852. -+ case BRCM_CC_4366_CHIP_ID:
  23853. -+ return 0x200000;
  23854. - default:
  23855. - brcmf_err("unknown chip: %s\n", ci->pub.name);
  23856. - break;
  23857. -@@ -678,10 +708,28 @@ static int brcmf_chip_get_raminfo(struct
  23858. - return -EINVAL;
  23859. - }
  23860. - } else {
  23861. -- mem = brcmf_chip_get_core(&ci->pub, BCMA_CORE_INTERNAL_MEM);
  23862. -- mem_core = container_of(mem, struct brcmf_core_priv, pub);
  23863. -- brcmf_chip_socram_ramsize(mem_core, &ci->pub.ramsize,
  23864. -- &ci->pub.srsize);
  23865. -+ mem = brcmf_chip_get_core(&ci->pub, BCMA_CORE_SYS_MEM);
  23866. -+ if (mem) {
  23867. -+ mem_core = container_of(mem, struct brcmf_core_priv,
  23868. -+ pub);
  23869. -+ ci->pub.ramsize = brcmf_chip_sysmem_ramsize(mem_core);
  23870. -+ ci->pub.rambase = brcmf_chip_tcm_rambase(ci);
  23871. -+ if (!ci->pub.rambase) {
  23872. -+ brcmf_err("RAM base not provided with ARM CA7 core\n");
  23873. -+ return -EINVAL;
  23874. -+ }
  23875. -+ } else {
  23876. -+ mem = brcmf_chip_get_core(&ci->pub,
  23877. -+ BCMA_CORE_INTERNAL_MEM);
  23878. -+ if (!mem) {
  23879. -+ brcmf_err("No memory cores found\n");
  23880. -+ return -ENOMEM;
  23881. -+ }
  23882. -+ mem_core = container_of(mem, struct brcmf_core_priv,
  23883. -+ pub);
  23884. -+ brcmf_chip_socram_ramsize(mem_core, &ci->pub.ramsize,
  23885. -+ &ci->pub.srsize);
  23886. -+ }
  23887. - }
  23888. - brcmf_dbg(INFO, "RAM: base=0x%x size=%d (0x%x) sr=%d (0x%x)\n",
  23889. - ci->pub.rambase, ci->pub.ramsize, ci->pub.ramsize,
  23890. -@@ -924,7 +972,7 @@ static int brcmf_chip_recognition(struct
  23891. - static void brcmf_chip_disable_arm(struct brcmf_chip_priv *chip, u16 id)
  23892. - {
  23893. - struct brcmf_core *core;
  23894. -- struct brcmf_core_priv *cr4;
  23895. -+ struct brcmf_core_priv *cpu;
  23896. - u32 val;
  23897. -
  23898. -
  23899. -@@ -937,10 +985,11 @@ static void brcmf_chip_disable_arm(struc
  23900. - brcmf_chip_coredisable(core, 0, 0);
  23901. - break;
  23902. - case BCMA_CORE_ARM_CR4:
  23903. -- cr4 = container_of(core, struct brcmf_core_priv, pub);
  23904. -+ case BCMA_CORE_ARM_CA7:
  23905. -+ cpu = container_of(core, struct brcmf_core_priv, pub);
  23906. -
  23907. - /* clear all IOCTL bits except HALT bit */
  23908. -- val = chip->ops->read32(chip->ctx, cr4->wrapbase + BCMA_IOCTL);
  23909. -+ val = chip->ops->read32(chip->ctx, cpu->wrapbase + BCMA_IOCTL);
  23910. - val &= ARMCR4_BCMA_IOCTL_CPUHALT;
  23911. - brcmf_chip_resetcore(core, val, ARMCR4_BCMA_IOCTL_CPUHALT,
  23912. - ARMCR4_BCMA_IOCTL_CPUHALT);
  23913. -@@ -1162,6 +1211,33 @@ static bool brcmf_chip_cr4_set_active(st
  23914. - return true;
  23915. - }
  23916. -
  23917. -+static inline void
  23918. -+brcmf_chip_ca7_set_passive(struct brcmf_chip_priv *chip)
  23919. -+{
  23920. -+ struct brcmf_core *core;
  23921. -+
  23922. -+ brcmf_chip_disable_arm(chip, BCMA_CORE_ARM_CA7);
  23923. -+
  23924. -+ core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_80211);
  23925. -+ brcmf_chip_resetcore(core, D11_BCMA_IOCTL_PHYRESET |
  23926. -+ D11_BCMA_IOCTL_PHYCLOCKEN,
  23927. -+ D11_BCMA_IOCTL_PHYCLOCKEN,
  23928. -+ D11_BCMA_IOCTL_PHYCLOCKEN);
  23929. -+}
  23930. -+
  23931. -+static bool brcmf_chip_ca7_set_active(struct brcmf_chip_priv *chip, u32 rstvec)
  23932. -+{
  23933. -+ struct brcmf_core *core;
  23934. -+
  23935. -+ chip->ops->activate(chip->ctx, &chip->pub, rstvec);
  23936. -+
  23937. -+ /* restore ARM */
  23938. -+ core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_ARM_CA7);
  23939. -+ brcmf_chip_resetcore(core, ARMCR4_BCMA_IOCTL_CPUHALT, 0, 0);
  23940. -+
  23941. -+ return true;
  23942. -+}
  23943. -+
  23944. - void brcmf_chip_set_passive(struct brcmf_chip *pub)
  23945. - {
  23946. - struct brcmf_chip_priv *chip;
  23947. -@@ -1175,8 +1251,16 @@ void brcmf_chip_set_passive(struct brcmf
  23948. - brcmf_chip_cr4_set_passive(chip);
  23949. - return;
  23950. - }
  23951. --
  23952. -- brcmf_chip_cm3_set_passive(chip);
  23953. -+ arm = brcmf_chip_get_core(pub, BCMA_CORE_ARM_CA7);
  23954. -+ if (arm) {
  23955. -+ brcmf_chip_ca7_set_passive(chip);
  23956. -+ return;
  23957. -+ }
  23958. -+ arm = brcmf_chip_get_core(pub, BCMA_CORE_ARM_CM3);
  23959. -+ if (arm) {
  23960. -+ brcmf_chip_cm3_set_passive(chip);
  23961. -+ return;
  23962. -+ }
  23963. - }
  23964. -
  23965. - bool brcmf_chip_set_active(struct brcmf_chip *pub, u32 rstvec)
  23966. -@@ -1190,8 +1274,14 @@ bool brcmf_chip_set_active(struct brcmf_
  23967. - arm = brcmf_chip_get_core(pub, BCMA_CORE_ARM_CR4);
  23968. - if (arm)
  23969. - return brcmf_chip_cr4_set_active(chip, rstvec);
  23970. -+ arm = brcmf_chip_get_core(pub, BCMA_CORE_ARM_CA7);
  23971. -+ if (arm)
  23972. -+ return brcmf_chip_ca7_set_active(chip, rstvec);
  23973. -+ arm = brcmf_chip_get_core(pub, BCMA_CORE_ARM_CM3);
  23974. -+ if (arm)
  23975. -+ return brcmf_chip_cm3_set_active(chip);
  23976. -
  23977. -- return brcmf_chip_cm3_set_active(chip);
  23978. -+ return false;
  23979. - }
  23980. -
  23981. - bool brcmf_chip_sr_capable(struct brcmf_chip *pub)
  23982. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  23983. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  23984. -@@ -55,6 +55,10 @@ enum brcmf_pcie_state {
  23985. - #define BRCMF_PCIE_43570_NVRAM_NAME "brcm/brcmfmac43570-pcie.txt"
  23986. - #define BRCMF_PCIE_4358_FW_NAME "brcm/brcmfmac4358-pcie.bin"
  23987. - #define BRCMF_PCIE_4358_NVRAM_NAME "brcm/brcmfmac4358-pcie.txt"
  23988. -+#define BRCMF_PCIE_4365_FW_NAME "brcm/brcmfmac4365b-pcie.bin"
  23989. -+#define BRCMF_PCIE_4365_NVRAM_NAME "brcm/brcmfmac4365b-pcie.txt"
  23990. -+#define BRCMF_PCIE_4366_FW_NAME "brcm/brcmfmac4366b-pcie.bin"
  23991. -+#define BRCMF_PCIE_4366_NVRAM_NAME "brcm/brcmfmac4366b-pcie.txt"
  23992. -
  23993. - #define BRCMF_PCIE_FW_UP_TIMEOUT 2000 /* msec */
  23994. -
  23995. -@@ -204,6 +208,10 @@ MODULE_FIRMWARE(BRCMF_PCIE_43570_FW_NAME
  23996. - MODULE_FIRMWARE(BRCMF_PCIE_43570_NVRAM_NAME);
  23997. - MODULE_FIRMWARE(BRCMF_PCIE_4358_FW_NAME);
  23998. - MODULE_FIRMWARE(BRCMF_PCIE_4358_NVRAM_NAME);
  23999. -+MODULE_FIRMWARE(BRCMF_PCIE_4365_FW_NAME);
  24000. -+MODULE_FIRMWARE(BRCMF_PCIE_4365_NVRAM_NAME);
  24001. -+MODULE_FIRMWARE(BRCMF_PCIE_4366_FW_NAME);
  24002. -+MODULE_FIRMWARE(BRCMF_PCIE_4366_NVRAM_NAME);
  24003. -
  24004. -
  24005. - struct brcmf_pcie_console {
  24006. -@@ -1440,6 +1448,14 @@ static int brcmf_pcie_get_fwnames(struct
  24007. - fw_name = BRCMF_PCIE_4358_FW_NAME;
  24008. - nvram_name = BRCMF_PCIE_4358_NVRAM_NAME;
  24009. - break;
  24010. -+ case BRCM_CC_4365_CHIP_ID:
  24011. -+ fw_name = BRCMF_PCIE_4365_FW_NAME;
  24012. -+ nvram_name = BRCMF_PCIE_4365_NVRAM_NAME;
  24013. -+ break;
  24014. -+ case BRCM_CC_4366_CHIP_ID:
  24015. -+ fw_name = BRCMF_PCIE_4366_FW_NAME;
  24016. -+ nvram_name = BRCMF_PCIE_4366_NVRAM_NAME;
  24017. -+ break;
  24018. - default:
  24019. - brcmf_err("Unsupported chip 0x%04x\n", devinfo->ci->chip);
  24020. - return -ENODEV;
  24021. -@@ -1973,6 +1989,12 @@ static struct pci_device_id brcmf_pcie_d
  24022. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_2G_DEVICE_ID),
  24023. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_5G_DEVICE_ID),
  24024. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_RAW_DEVICE_ID),
  24025. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_DEVICE_ID),
  24026. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_2G_DEVICE_ID),
  24027. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_5G_DEVICE_ID),
  24028. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_DEVICE_ID),
  24029. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_2G_DEVICE_ID),
  24030. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_5G_DEVICE_ID),
  24031. - { /* end: all zeroes */ }
  24032. - };
  24033. -
  24034. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  24035. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  24036. -@@ -48,6 +48,8 @@
  24037. - #define BRCM_CC_43570_CHIP_ID 43570
  24038. - #define BRCM_CC_4358_CHIP_ID 0x4358
  24039. - #define BRCM_CC_43602_CHIP_ID 43602
  24040. -+#define BRCM_CC_4365_CHIP_ID 0x4365
  24041. -+#define BRCM_CC_4366_CHIP_ID 0x4366
  24042. -
  24043. - /* USB Device IDs */
  24044. - #define BRCM_USB_43143_DEVICE_ID 0xbd1e
  24045. -@@ -67,6 +69,13 @@
  24046. - #define BRCM_PCIE_43602_2G_DEVICE_ID 0x43bb
  24047. - #define BRCM_PCIE_43602_5G_DEVICE_ID 0x43bc
  24048. - #define BRCM_PCIE_43602_RAW_DEVICE_ID 43602
  24049. -+#define BRCM_PCIE_4365_DEVICE_ID 0x43ca
  24050. -+#define BRCM_PCIE_4365_2G_DEVICE_ID 0x43cb
  24051. -+#define BRCM_PCIE_4365_5G_DEVICE_ID 0x43cc
  24052. -+#define BRCM_PCIE_4366_DEVICE_ID 0x43c3
  24053. -+#define BRCM_PCIE_4366_2G_DEVICE_ID 0x43c4
  24054. -+#define BRCM_PCIE_4366_5G_DEVICE_ID 0x43c5
  24055. -+
  24056. -
  24057. - /* brcmsmac IDs */
  24058. - #define BCM4313_D11N2G_ID 0x4727 /* 4313 802.11n 2.4G device */
  24059. 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
  24060. deleted file mode 100644
  24061. index d33c803..0000000
  24062. --- a/package/kernel/mac80211/patches/370-0015-brcmfmac-Fix-TDLS-setup-by-properly-handling-p2p-noi.patch
  24063. +++ /dev/null
  24064. @@ -1,120 +0,0 @@
  24065. -From: Hante Meuleman <meuleman@broadcom.com>
  24066. -Date: Fri, 18 Sep 2015 22:08:18 +0200
  24067. -Subject: [PATCH] brcmfmac: Fix TDLS setup by properly handling p2p noif.
  24068. -
  24069. -There is a workaround needed for p2p device setup which breaks tdls
  24070. -functionality. This patch fixes that by properly signalling fweh that
  24071. -p2p device setup is ongoing.
  24072. -
  24073. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  24074. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  24075. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  24076. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  24077. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  24078. ----
  24079. -
  24080. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  24081. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  24082. -@@ -188,11 +188,13 @@ static void brcmf_fweh_handle_if_event(s
  24083. -
  24084. - /* The P2P Device interface event must not be ignored contrary to what
  24085. - * firmware tells us. Older firmware uses p2p noif, with sta role.
  24086. -- * This should be accepted.
  24087. -+ * This should be accepted when p2pdev_setup is ongoing. TDLS setup will
  24088. -+ * use the same ifevent and should be ignored.
  24089. - */
  24090. - is_p2pdev = ((ifevent->flags & BRCMF_E_IF_FLAG_NOIF) &&
  24091. - (ifevent->role == BRCMF_E_IF_ROLE_P2P_CLIENT ||
  24092. -- ifevent->role == BRCMF_E_IF_ROLE_STA));
  24093. -+ ((ifevent->role == BRCMF_E_IF_ROLE_STA) &&
  24094. -+ (drvr->fweh.p2pdev_setup_ongoing))));
  24095. - if (!is_p2pdev && (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) {
  24096. - brcmf_dbg(EVENT, "event can be ignored\n");
  24097. - return;
  24098. -@@ -316,6 +318,17 @@ event_free:
  24099. - }
  24100. -
  24101. - /**
  24102. -+ * brcmf_fweh_p2pdev_setup() - P2P device setup ongoing (or not).
  24103. -+ *
  24104. -+ * @ifp: ifp on which setup is taking place or finished.
  24105. -+ * @ongoing: p2p device setup in progress (or not).
  24106. -+ */
  24107. -+void brcmf_fweh_p2pdev_setup(struct brcmf_if *ifp, bool ongoing)
  24108. -+{
  24109. -+ ifp->drvr->fweh.p2pdev_setup_ongoing = ongoing;
  24110. -+}
  24111. -+
  24112. -+/**
  24113. - * brcmf_fweh_attach() - initialize firmware event handling.
  24114. - *
  24115. - * @drvr: driver information object.
  24116. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  24117. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  24118. -@@ -230,12 +230,14 @@ typedef int (*brcmf_fweh_handler_t)(stru
  24119. - /**
  24120. - * struct brcmf_fweh_info - firmware event handling information.
  24121. - *
  24122. -+ * @p2pdev_setup_ongoing: P2P device creation in progress.
  24123. - * @event_work: event worker.
  24124. - * @evt_q_lock: lock for event queue protection.
  24125. - * @event_q: event queue.
  24126. - * @evt_handler: registered event handlers.
  24127. - */
  24128. - struct brcmf_fweh_info {
  24129. -+ bool p2pdev_setup_ongoing;
  24130. - struct work_struct event_work;
  24131. - spinlock_t evt_q_lock;
  24132. - struct list_head event_q;
  24133. -@@ -255,6 +257,7 @@ void brcmf_fweh_unregister(struct brcmf_
  24134. - int brcmf_fweh_activate_events(struct brcmf_if *ifp);
  24135. - void brcmf_fweh_process_event(struct brcmf_pub *drvr,
  24136. - struct brcmf_event *event_packet);
  24137. -+void brcmf_fweh_p2pdev_setup(struct brcmf_if *ifp, bool ongoing);
  24138. -
  24139. - static inline void brcmf_fweh_process_skb(struct brcmf_pub *drvr,
  24140. - struct sk_buff *skb)
  24141. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  24142. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  24143. -@@ -2084,11 +2084,13 @@ static struct wireless_dev *brcmf_p2p_cr
  24144. - brcmf_p2p_set_firmware(pri_ifp, p2p->dev_addr);
  24145. -
  24146. - brcmf_cfg80211_arm_vif_event(p2p->cfg, p2p_vif);
  24147. -+ brcmf_fweh_p2pdev_setup(pri_ifp, true);
  24148. -
  24149. - /* Initialize P2P Discovery in the firmware */
  24150. - err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1);
  24151. - if (err < 0) {
  24152. - brcmf_err("set p2p_disc error\n");
  24153. -+ brcmf_fweh_p2pdev_setup(pri_ifp, false);
  24154. - brcmf_cfg80211_arm_vif_event(p2p->cfg, NULL);
  24155. - goto fail;
  24156. - }
  24157. -@@ -2097,6 +2099,7 @@ static struct wireless_dev *brcmf_p2p_cr
  24158. - err = brcmf_cfg80211_wait_vif_event_timeout(p2p->cfg, BRCMF_E_IF_ADD,
  24159. - msecs_to_jiffies(1500));
  24160. - brcmf_cfg80211_arm_vif_event(p2p->cfg, NULL);
  24161. -+ brcmf_fweh_p2pdev_setup(pri_ifp, false);
  24162. - if (!err) {
  24163. - brcmf_err("timeout occurred\n");
  24164. - err = -EIO;
  24165. -@@ -2393,6 +2396,8 @@ s32 brcmf_p2p_attach(struct brcmf_cfg802
  24166. - memcpy(p2p_ifp->mac_addr, p2p->dev_addr, ETH_ALEN);
  24167. - brcmf_p2p_set_firmware(pri_ifp, p2p->dev_addr);
  24168. -
  24169. -+ brcmf_fweh_p2pdev_setup(pri_ifp, true);
  24170. -+
  24171. - /* Initialize P2P Discovery in the firmware */
  24172. - err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1);
  24173. - if (err < 0) {
  24174. -@@ -2419,8 +2424,9 @@ s32 brcmf_p2p_attach(struct brcmf_cfg802
  24175. - INIT_WORK(&p2p->afx_hdl.afx_work, brcmf_p2p_afx_handler);
  24176. - init_completion(&p2p->afx_hdl.act_frm_scan);
  24177. - init_completion(&p2p->wait_next_af);
  24178. -- }
  24179. - exit:
  24180. -+ brcmf_fweh_p2pdev_setup(pri_ifp, false);
  24181. -+ }
  24182. - return err;
  24183. - }
  24184. -
  24185. 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
  24186. deleted file mode 100644
  24187. index b880078..0000000
  24188. --- a/package/kernel/mac80211/patches/370-0016-brcmfmac-Accept-events-when-TDLS-is-used-in-combinat.patch
  24189. +++ /dev/null
  24190. @@ -1,29 +0,0 @@
  24191. -From: Hante Meuleman <meuleman@broadcom.com>
  24192. -Date: Fri, 18 Sep 2015 22:08:19 +0200
  24193. -Subject: [PATCH] brcmfmac: Accept events when TDLS is used in combination with
  24194. - p2p.
  24195. -
  24196. -TDLS events are mapped back to primary interface but when p2p is in
  24197. -use then this fails because the check was incorrect by checking
  24198. -bsscfg number. Which can be different when a p2p device has been
  24199. -created.
  24200. -
  24201. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  24202. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  24203. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  24204. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  24205. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  24206. ----
  24207. -
  24208. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  24209. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  24210. -@@ -300,8 +300,7 @@ static void brcmf_fweh_event_worker(stru
  24211. - goto event_free;
  24212. - }
  24213. -
  24214. -- if ((event->code == BRCMF_E_TDLS_PEER_EVENT) &&
  24215. -- (emsg.bsscfgidx == 1))
  24216. -+ if (event->code == BRCMF_E_TDLS_PEER_EVENT)
  24217. - ifp = drvr->iflist[0];
  24218. - else
  24219. - ifp = drvr->iflist[emsg.bsscfgidx];
  24220. 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
  24221. deleted file mode 100644
  24222. index 9311a9d..0000000
  24223. --- a/package/kernel/mac80211/patches/371-brcmfmac-include-linux-atomic.h.patch
  24224. +++ /dev/null
  24225. @@ -1,23 +0,0 @@
  24226. -From: Hauke Mehrtens <hauke@hauke-m.de>
  24227. -Date: Sat, 19 Sep 2015 12:47:20 +0200
  24228. -Subject: [PATCH] brcmfmac: include linux/atomic.h
  24229. -
  24230. -brcmfmac uses atomic_or() and other atomic_* functions, but does not
  24231. -include linux/atomic.h. This file gets included by some other header
  24232. -file so this normally does not cause problems.
  24233. -
  24234. -Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  24235. -Acked-by: Arend van Spriel <arend@broadcom.com>
  24236. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  24237. ----
  24238. -
  24239. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  24240. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  24241. -@@ -15,6 +15,7 @@
  24242. - */
  24243. -
  24244. - #include <linux/types.h>
  24245. -+#include <linux/atomic.h>
  24246. - #include <linux/kernel.h>
  24247. - #include <linux/kthread.h>
  24248. - #include <linux/printk.h>
  24249. 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
  24250. deleted file mode 100644
  24251. index cf3f278..0000000
  24252. --- a/package/kernel/mac80211/patches/372-0001-brcmfmac-expose-device-memory-to-devcoredump-subsyst.patch
  24253. +++ /dev/null
  24254. @@ -1,347 +0,0 @@
  24255. -From: Arend van Spriel <arend@broadcom.com>
  24256. -Date: Thu, 8 Oct 2015 20:33:11 +0200
  24257. -Subject: [PATCH] brcmfmac: expose device memory to devcoredump subsystem
  24258. -
  24259. -Upon PSM watchdog event received from firmware the driver will obtain
  24260. -a memory snapshot of the device and expose it to user-space through
  24261. -the devcoredump framework. This will trigger a uevent.
  24262. -
  24263. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  24264. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  24265. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  24266. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  24267. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  24268. ----
  24269. -
  24270. ---- a/drivers/net/wireless/brcm80211/Kconfig
  24271. -+++ b/drivers/net/wireless/brcm80211/Kconfig
  24272. -@@ -85,5 +85,6 @@ config BRCM_TRACING
  24273. - config BRCMDBG
  24274. - bool "Broadcom driver debug functions"
  24275. - depends on BRCMSMAC || BRCMFMAC
  24276. -+ select WANT_DEV_COREDUMP
  24277. - ---help---
  24278. - Selecting this enables additional code for debug purposes.
  24279. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bus.h
  24280. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bus.h
  24281. -@@ -65,6 +65,8 @@ struct brcmf_bus_dcmd {
  24282. - * @rxctl: receive a control response message from dongle.
  24283. - * @gettxq: obtain a reference of bus transmit queue (optional).
  24284. - * @wowl_config: specify if dongle is configured for wowl when going to suspend
  24285. -+ * @get_ramsize: obtain size of device memory.
  24286. -+ * @get_memdump: obtain device memory dump in provided buffer.
  24287. - *
  24288. - * This structure provides an abstract interface towards the
  24289. - * bus specific driver. For control messages to common driver
  24290. -@@ -79,6 +81,8 @@ struct brcmf_bus_ops {
  24291. - int (*rxctl)(struct device *dev, unsigned char *msg, uint len);
  24292. - struct pktq * (*gettxq)(struct device *dev);
  24293. - void (*wowl_config)(struct device *dev, bool enabled);
  24294. -+ size_t (*get_ramsize)(struct device *dev);
  24295. -+ int (*get_memdump)(struct device *dev, void *data, size_t len);
  24296. - };
  24297. -
  24298. -
  24299. -@@ -185,6 +189,23 @@ void brcmf_bus_wowl_config(struct brcmf_
  24300. - bus->ops->wowl_config(bus->dev, enabled);
  24301. - }
  24302. -
  24303. -+static inline size_t brcmf_bus_get_ramsize(struct brcmf_bus *bus)
  24304. -+{
  24305. -+ if (!bus->ops->get_ramsize)
  24306. -+ return 0;
  24307. -+
  24308. -+ return bus->ops->get_ramsize(bus->dev);
  24309. -+}
  24310. -+
  24311. -+static inline
  24312. -+int brcmf_bus_get_memdump(struct brcmf_bus *bus, void *data, size_t len)
  24313. -+{
  24314. -+ if (!bus->ops->get_memdump)
  24315. -+ return -EOPNOTSUPP;
  24316. -+
  24317. -+ return bus->ops->get_memdump(bus->dev, data, len);
  24318. -+}
  24319. -+
  24320. - /*
  24321. - * interface functions from common layer
  24322. - */
  24323. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  24324. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  24325. -@@ -957,8 +957,8 @@ int brcmf_attach(struct device *dev)
  24326. - drvr->bus_if = dev_get_drvdata(dev);
  24327. - drvr->bus_if->drvr = drvr;
  24328. -
  24329. -- /* create device debugfs folder */
  24330. -- brcmf_debugfs_attach(drvr);
  24331. -+ /* attach debug facilities */
  24332. -+ brcmf_debug_attach(drvr);
  24333. -
  24334. - /* Attach and link in the protocol */
  24335. - ret = brcmf_proto_attach(drvr);
  24336. -@@ -1155,7 +1155,7 @@ void brcmf_detach(struct device *dev)
  24337. -
  24338. - brcmf_proto_detach(drvr);
  24339. -
  24340. -- brcmf_debugfs_detach(drvr);
  24341. -+ brcmf_debug_detach(drvr);
  24342. - bus_if->drvr = NULL;
  24343. - kfree(drvr);
  24344. - }
  24345. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  24346. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  24347. -@@ -16,15 +16,45 @@
  24348. - #include <linux/debugfs.h>
  24349. - #include <linux/netdevice.h>
  24350. - #include <linux/module.h>
  24351. -+#include <linux/devcoredump.h>
  24352. -
  24353. - #include <brcmu_wifi.h>
  24354. - #include <brcmu_utils.h>
  24355. - #include "core.h"
  24356. - #include "bus.h"
  24357. -+#include "fweh.h"
  24358. - #include "debug.h"
  24359. -
  24360. - static struct dentry *root_folder;
  24361. -
  24362. -+static int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data,
  24363. -+ size_t len)
  24364. -+{
  24365. -+ void *dump;
  24366. -+ size_t ramsize;
  24367. -+
  24368. -+ ramsize = brcmf_bus_get_ramsize(bus);
  24369. -+ if (ramsize) {
  24370. -+ dump = vzalloc(len + ramsize);
  24371. -+ if (!dump)
  24372. -+ return -ENOMEM;
  24373. -+ memcpy(dump, data, len);
  24374. -+ brcmf_bus_get_memdump(bus, dump + len, ramsize);
  24375. -+ dev_coredumpv(bus->dev, dump, len + ramsize, GFP_KERNEL);
  24376. -+ }
  24377. -+ return 0;
  24378. -+}
  24379. -+
  24380. -+static int brcmf_debug_psm_watchdog_notify(struct brcmf_if *ifp,
  24381. -+ const struct brcmf_event_msg *evtmsg,
  24382. -+ void *data)
  24383. -+{
  24384. -+ brcmf_dbg(TRACE, "enter: idx=%d\n", ifp->bssidx);
  24385. -+
  24386. -+ return brcmf_debug_create_memdump(ifp->drvr->bus_if, data,
  24387. -+ evtmsg->datalen);
  24388. -+}
  24389. -+
  24390. - void brcmf_debugfs_init(void)
  24391. - {
  24392. - root_folder = debugfs_create_dir(KBUILD_MODNAME, NULL);
  24393. -@@ -41,7 +71,7 @@ void brcmf_debugfs_exit(void)
  24394. - root_folder = NULL;
  24395. - }
  24396. -
  24397. --int brcmf_debugfs_attach(struct brcmf_pub *drvr)
  24398. -+int brcmf_debug_attach(struct brcmf_pub *drvr)
  24399. - {
  24400. - struct device *dev = drvr->bus_if->dev;
  24401. -
  24402. -@@ -49,12 +79,18 @@ int brcmf_debugfs_attach(struct brcmf_pu
  24403. - return -ENODEV;
  24404. -
  24405. - drvr->dbgfs_dir = debugfs_create_dir(dev_name(dev), root_folder);
  24406. -+ if (IS_ERR(drvr->dbgfs_dir))
  24407. -+ return PTR_ERR(drvr->dbgfs_dir);
  24408. -
  24409. -- return PTR_ERR_OR_ZERO(drvr->dbgfs_dir);
  24410. -+
  24411. -+ return brcmf_fweh_register(drvr, BRCMF_E_PSM_WATCHDOG,
  24412. -+ brcmf_debug_psm_watchdog_notify);
  24413. - }
  24414. -
  24415. --void brcmf_debugfs_detach(struct brcmf_pub *drvr)
  24416. -+void brcmf_debug_detach(struct brcmf_pub *drvr)
  24417. - {
  24418. -+ brcmf_fweh_unregister(drvr, BRCMF_E_PSM_WATCHDOG);
  24419. -+
  24420. - if (!IS_ERR_OR_NULL(drvr->dbgfs_dir))
  24421. - debugfs_remove_recursive(drvr->dbgfs_dir);
  24422. - }
  24423. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  24424. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  24425. -@@ -109,8 +109,8 @@ struct brcmf_pub;
  24426. - #ifdef DEBUG
  24427. - void brcmf_debugfs_init(void);
  24428. - void brcmf_debugfs_exit(void);
  24429. --int brcmf_debugfs_attach(struct brcmf_pub *drvr);
  24430. --void brcmf_debugfs_detach(struct brcmf_pub *drvr);
  24431. -+int brcmf_debug_attach(struct brcmf_pub *drvr);
  24432. -+void brcmf_debug_detach(struct brcmf_pub *drvr);
  24433. - struct dentry *brcmf_debugfs_get_devdir(struct brcmf_pub *drvr);
  24434. - int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn,
  24435. - int (*read_fn)(struct seq_file *seq, void *data));
  24436. -@@ -121,11 +121,11 @@ static inline void brcmf_debugfs_init(vo
  24437. - static inline void brcmf_debugfs_exit(void)
  24438. - {
  24439. - }
  24440. --static inline int brcmf_debugfs_attach(struct brcmf_pub *drvr)
  24441. -+static inline int brcmf_debug_attach(struct brcmf_pub *drvr)
  24442. - {
  24443. - return 0;
  24444. - }
  24445. --static inline void brcmf_debugfs_detach(struct brcmf_pub *drvr)
  24446. -+static inline void brcmf_debug_detach(struct brcmf_pub *drvr)
  24447. - {
  24448. - }
  24449. - static inline
  24450. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  24451. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  24452. -@@ -448,6 +448,47 @@ brcmf_pcie_copy_mem_todev(struct brcmf_p
  24453. - }
  24454. -
  24455. -
  24456. -+static void
  24457. -+brcmf_pcie_copy_dev_tomem(struct brcmf_pciedev_info *devinfo, u32 mem_offset,
  24458. -+ void *dstaddr, u32 len)
  24459. -+{
  24460. -+ void __iomem *address = devinfo->tcm + mem_offset;
  24461. -+ __le32 *dst32;
  24462. -+ __le16 *dst16;
  24463. -+ u8 *dst8;
  24464. -+
  24465. -+ if (((ulong)address & 4) || ((ulong)dstaddr & 4) || (len & 4)) {
  24466. -+ if (((ulong)address & 2) || ((ulong)dstaddr & 2) || (len & 2)) {
  24467. -+ dst8 = (u8 *)dstaddr;
  24468. -+ while (len) {
  24469. -+ *dst8 = ioread8(address);
  24470. -+ address++;
  24471. -+ dst8++;
  24472. -+ len--;
  24473. -+ }
  24474. -+ } else {
  24475. -+ len = len / 2;
  24476. -+ dst16 = (__le16 *)dstaddr;
  24477. -+ while (len) {
  24478. -+ *dst16 = cpu_to_le16(ioread16(address));
  24479. -+ address += 2;
  24480. -+ dst16++;
  24481. -+ len--;
  24482. -+ }
  24483. -+ }
  24484. -+ } else {
  24485. -+ len = len / 4;
  24486. -+ dst32 = (__le32 *)dstaddr;
  24487. -+ while (len) {
  24488. -+ *dst32 = cpu_to_le32(ioread32(address));
  24489. -+ address += 4;
  24490. -+ dst32++;
  24491. -+ len--;
  24492. -+ }
  24493. -+ }
  24494. -+}
  24495. -+
  24496. -+
  24497. - #define WRITECC32(devinfo, reg, value) brcmf_pcie_write_reg32(devinfo, \
  24498. - CHIPCREGOFFS(reg), value)
  24499. -
  24500. -@@ -1352,12 +1393,36 @@ static void brcmf_pcie_wowl_config(struc
  24501. - }
  24502. -
  24503. -
  24504. -+static size_t brcmf_pcie_get_ramsize(struct device *dev)
  24505. -+{
  24506. -+ struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  24507. -+ struct brcmf_pciedev *buspub = bus_if->bus_priv.pcie;
  24508. -+ struct brcmf_pciedev_info *devinfo = buspub->devinfo;
  24509. -+
  24510. -+ return devinfo->ci->ramsize - devinfo->ci->srsize;
  24511. -+}
  24512. -+
  24513. -+
  24514. -+static int brcmf_pcie_get_memdump(struct device *dev, void *data, size_t len)
  24515. -+{
  24516. -+ struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  24517. -+ struct brcmf_pciedev *buspub = bus_if->bus_priv.pcie;
  24518. -+ struct brcmf_pciedev_info *devinfo = buspub->devinfo;
  24519. -+
  24520. -+ brcmf_dbg(PCIE, "dump at 0x%08X: len=%zu\n", devinfo->ci->rambase, len);
  24521. -+ brcmf_pcie_copy_dev_tomem(devinfo, devinfo->ci->rambase, data, len);
  24522. -+ return 0;
  24523. -+}
  24524. -+
  24525. -+
  24526. - static struct brcmf_bus_ops brcmf_pcie_bus_ops = {
  24527. - .txdata = brcmf_pcie_tx,
  24528. - .stop = brcmf_pcie_down,
  24529. - .txctl = brcmf_pcie_tx_ctlpkt,
  24530. - .rxctl = brcmf_pcie_rx_ctlpkt,
  24531. - .wowl_config = brcmf_pcie_wowl_config,
  24532. -+ .get_ramsize = brcmf_pcie_get_ramsize,
  24533. -+ .get_memdump = brcmf_pcie_get_memdump,
  24534. - };
  24535. -
  24536. -
  24537. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  24538. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  24539. -@@ -3539,6 +3539,51 @@ done:
  24540. - return err;
  24541. - }
  24542. -
  24543. -+static size_t brcmf_sdio_bus_get_ramsize(struct device *dev)
  24544. -+{
  24545. -+ struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  24546. -+ struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
  24547. -+ struct brcmf_sdio *bus = sdiodev->bus;
  24548. -+
  24549. -+ return bus->ci->ramsize - bus->ci->srsize;
  24550. -+}
  24551. -+
  24552. -+static int brcmf_sdio_bus_get_memdump(struct device *dev, void *data,
  24553. -+ size_t mem_size)
  24554. -+{
  24555. -+ struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  24556. -+ struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
  24557. -+ struct brcmf_sdio *bus = sdiodev->bus;
  24558. -+ int err;
  24559. -+ int address;
  24560. -+ int offset;
  24561. -+ int len;
  24562. -+
  24563. -+ brcmf_dbg(INFO, "dump at 0x%08x: size=%zu\n", bus->ci->rambase,
  24564. -+ mem_size);
  24565. -+
  24566. -+ address = bus->ci->rambase;
  24567. -+ offset = err = 0;
  24568. -+ sdio_claim_host(sdiodev->func[1]);
  24569. -+ while (offset < mem_size) {
  24570. -+ len = ((offset + MEMBLOCK) < mem_size) ? MEMBLOCK :
  24571. -+ mem_size - offset;
  24572. -+ err = brcmf_sdiod_ramrw(sdiodev, false, address, data, len);
  24573. -+ if (err) {
  24574. -+ brcmf_err("error %d on reading %d membytes at 0x%08x\n",
  24575. -+ err, len, address);
  24576. -+ goto done;
  24577. -+ }
  24578. -+ data += len;
  24579. -+ offset += len;
  24580. -+ address += len;
  24581. -+ }
  24582. -+
  24583. -+done:
  24584. -+ sdio_release_host(sdiodev->func[1]);
  24585. -+ return err;
  24586. -+}
  24587. -+
  24588. - void brcmf_sdio_trigger_dpc(struct brcmf_sdio *bus)
  24589. - {
  24590. - if (!bus->dpc_triggered) {
  24591. -@@ -3987,7 +4032,9 @@ static struct brcmf_bus_ops brcmf_sdio_b
  24592. - .txctl = brcmf_sdio_bus_txctl,
  24593. - .rxctl = brcmf_sdio_bus_rxctl,
  24594. - .gettxq = brcmf_sdio_bus_gettxq,
  24595. -- .wowl_config = brcmf_sdio_wowl_config
  24596. -+ .wowl_config = brcmf_sdio_wowl_config,
  24597. -+ .get_ramsize = brcmf_sdio_bus_get_ramsize,
  24598. -+ .get_memdump = brcmf_sdio_bus_get_memdump,
  24599. - };
  24600. -
  24601. - static void brcmf_sdio_firmware_callback(struct device *dev,
  24602. 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
  24603. deleted file mode 100644
  24604. index 5b82bca..0000000
  24605. --- a/package/kernel/mac80211/patches/372-0002-brcmfmac-Fix-race-condition-between-USB-probe-load-a.patch
  24606. +++ /dev/null
  24607. @@ -1,108 +0,0 @@
  24608. -From: Hante Meuleman <meuleman@broadcom.com>
  24609. -Date: Thu, 8 Oct 2015 20:33:12 +0200
  24610. -Subject: [PATCH] brcmfmac: Fix race condition between USB probe/load and
  24611. - disconnect.
  24612. -
  24613. -When a USB device gets disconnected due to for example removal
  24614. -then it is possible that it is still in the loading phase due to
  24615. -the asynchronous load routines. These routines can then possible
  24616. -access memory which has been freed. Fix this by mutex locking the
  24617. -device init phase.
  24618. -
  24619. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  24620. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  24621. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  24622. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  24623. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  24624. ----
  24625. -
  24626. ---- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  24627. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  24628. -@@ -144,6 +144,7 @@ struct brcmf_usbdev_info {
  24629. -
  24630. - struct usb_device *usbdev;
  24631. - struct device *dev;
  24632. -+ struct mutex dev_init_lock;
  24633. -
  24634. - int ctl_in_pipe, ctl_out_pipe;
  24635. - struct urb *ctl_urb; /* URB for control endpoint */
  24636. -@@ -1204,6 +1205,8 @@ static void brcmf_usb_probe_phase2(struc
  24637. - int ret;
  24638. -
  24639. - brcmf_dbg(USB, "Start fw downloading\n");
  24640. -+
  24641. -+ devinfo = bus->bus_priv.usb->devinfo;
  24642. - ret = check_file(fw->data);
  24643. - if (ret < 0) {
  24644. - brcmf_err("invalid firmware\n");
  24645. -@@ -1211,7 +1214,6 @@ static void brcmf_usb_probe_phase2(struc
  24646. - goto error;
  24647. - }
  24648. -
  24649. -- devinfo = bus->bus_priv.usb->devinfo;
  24650. - devinfo->image = fw->data;
  24651. - devinfo->image_len = fw->size;
  24652. -
  24653. -@@ -1224,9 +1226,11 @@ static void brcmf_usb_probe_phase2(struc
  24654. - if (ret)
  24655. - goto error;
  24656. -
  24657. -+ mutex_unlock(&devinfo->dev_init_lock);
  24658. - return;
  24659. - error:
  24660. - brcmf_dbg(TRACE, "failed: dev=%s, err=%d\n", dev_name(dev), ret);
  24661. -+ mutex_unlock(&devinfo->dev_init_lock);
  24662. - device_release_driver(dev);
  24663. - }
  24664. -
  24665. -@@ -1264,6 +1268,7 @@ static int brcmf_usb_probe_cb(struct brc
  24666. - if (ret)
  24667. - goto fail;
  24668. - /* we are done */
  24669. -+ mutex_unlock(&devinfo->dev_init_lock);
  24670. - return 0;
  24671. - }
  24672. - bus->chip = bus_pub->devid;
  24673. -@@ -1317,6 +1322,12 @@ brcmf_usb_probe(struct usb_interface *in
  24674. -
  24675. - devinfo->usbdev = usb;
  24676. - devinfo->dev = &usb->dev;
  24677. -+ /* Take an init lock, to protect for disconnect while still loading.
  24678. -+ * Necessary because of the asynchronous firmware load construction
  24679. -+ */
  24680. -+ mutex_init(&devinfo->dev_init_lock);
  24681. -+ mutex_lock(&devinfo->dev_init_lock);
  24682. -+
  24683. - usb_set_intfdata(intf, devinfo);
  24684. -
  24685. - /* Check that the device supports only one configuration */
  24686. -@@ -1391,6 +1402,7 @@ brcmf_usb_probe(struct usb_interface *in
  24687. - return 0;
  24688. -
  24689. - fail:
  24690. -+ mutex_unlock(&devinfo->dev_init_lock);
  24691. - kfree(devinfo);
  24692. - usb_set_intfdata(intf, NULL);
  24693. - return ret;
  24694. -@@ -1403,8 +1415,19 @@ brcmf_usb_disconnect(struct usb_interfac
  24695. -
  24696. - brcmf_dbg(USB, "Enter\n");
  24697. - devinfo = (struct brcmf_usbdev_info *)usb_get_intfdata(intf);
  24698. -- brcmf_usb_disconnect_cb(devinfo);
  24699. -- kfree(devinfo);
  24700. -+
  24701. -+ if (devinfo) {
  24702. -+ mutex_lock(&devinfo->dev_init_lock);
  24703. -+ /* Make sure that devinfo still exists. Firmware probe routines
  24704. -+ * may have released the device and cleared the intfdata.
  24705. -+ */
  24706. -+ if (!usb_get_intfdata(intf))
  24707. -+ goto done;
  24708. -+
  24709. -+ brcmf_usb_disconnect_cb(devinfo);
  24710. -+ kfree(devinfo);
  24711. -+ }
  24712. -+done:
  24713. - brcmf_dbg(USB, "Exit\n");
  24714. - }
  24715. -
  24716. 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
  24717. deleted file mode 100644
  24718. index f877c23..0000000
  24719. --- a/package/kernel/mac80211/patches/372-0003-brcmfmac-rename-firmware_path-to-alternative_fw_path.patch
  24720. +++ /dev/null
  24721. @@ -1,28 +0,0 @@
  24722. -From: Franky Lin <frankyl@broadcom.com>
  24723. -Date: Thu, 8 Oct 2015 20:33:13 +0200
  24724. -Subject: [PATCH] brcmfmac: rename firmware_path to alternative_fw_path
  24725. -
  24726. -In brcmfmac the module parameter "firmware_path" is used as an
  24727. -alternative relative path under the search path used by firmware_class
  24728. -or ueventhelper. Rename the parameter to alternative_fw_path to avoid
  24729. -confusion.
  24730. -
  24731. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  24732. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  24733. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  24734. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  24735. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  24736. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  24737. ----
  24738. -
  24739. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  24740. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  24741. -@@ -28,7 +28,7 @@
  24742. - #define BRCMF_FW_NVRAM_PCIEDEV_LEN 10 /* pcie/1/4/ + \0 */
  24743. -
  24744. - char brcmf_firmware_path[BRCMF_FW_PATH_LEN];
  24745. --module_param_string(firmware_path, brcmf_firmware_path,
  24746. -+module_param_string(alternative_fw_path, brcmf_firmware_path,
  24747. - BRCMF_FW_PATH_LEN, 0440);
  24748. -
  24749. - enum nvram_parser_state {
  24750. 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
  24751. deleted file mode 100644
  24752. index 0bfd9ef..0000000
  24753. --- a/package/kernel/mac80211/patches/372-0004-brcmfmac-remove-conversational-comment.patch
  24754. +++ /dev/null
  24755. @@ -1,25 +0,0 @@
  24756. -From: Arend van Spriel <arend@broadcom.com>
  24757. -Date: Thu, 8 Oct 2015 20:33:14 +0200
  24758. -Subject: [PATCH] brcmfmac: remove conversational comment
  24759. -
  24760. -Removing a comment that was only useful during the review of
  24761. -the change that introduced it and which should never have been
  24762. -submitted.
  24763. -
  24764. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  24765. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  24766. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  24767. ----
  24768. -
  24769. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  24770. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  24771. -@@ -873,9 +873,6 @@ brcmf_msgbuf_process_txstatus(struct brc
  24772. - commonring = msgbuf->flowrings[flowid];
  24773. - atomic_dec(&commonring->outstanding_tx);
  24774. -
  24775. -- /* Hante: i believe this was a bug as tx_status->msg.ifidx was used
  24776. -- * in brcmf_txfinalize as index in drvr->iflist. Can you confirm/deny?
  24777. -- */
  24778. - brcmf_txfinalize(brcmf_get_ifp(msgbuf->drvr, tx_status->msg.ifidx),
  24779. - skb, true);
  24780. - }
  24781. 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
  24782. deleted file mode 100644
  24783. index 3ffada8..0000000
  24784. --- a/package/kernel/mac80211/patches/372-0005-brcmfmac-Rework-p2p-attach-use-single-method-for-p2p.patch
  24785. +++ /dev/null
  24786. @@ -1,226 +0,0 @@
  24787. -From: Hante Meuleman <meuleman@broadcom.com>
  24788. -Date: Thu, 8 Oct 2015 20:33:15 +0200
  24789. -Subject: [PATCH] brcmfmac: Rework p2p attach, use single method for p2p dev
  24790. - creation.
  24791. -
  24792. -When module param p2pon is used a p2p device is created at init.
  24793. -This patch reworks how this is done by using the same method as
  24794. -for a dynamically (by user space) created p2p device.
  24795. -
  24796. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  24797. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  24798. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  24799. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  24800. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  24801. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  24802. ----
  24803. -
  24804. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  24805. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  24806. -@@ -6237,6 +6237,17 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  24807. - else
  24808. - *cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
  24809. - }
  24810. -+ /* p2p might require that "if-events" get processed by fweh. So
  24811. -+ * activate the already registered event handlers now and activate
  24812. -+ * the rest when initialization has completed. drvr->config needs to
  24813. -+ * be assigned before activating events.
  24814. -+ */
  24815. -+ drvr->config = cfg;
  24816. -+ err = brcmf_fweh_activate_events(ifp);
  24817. -+ if (err) {
  24818. -+ brcmf_err("FWEH activation failed (%d)\n", err);
  24819. -+ goto wiphy_unreg_out;
  24820. -+ }
  24821. -
  24822. - err = brcmf_p2p_attach(cfg, p2pdev_forced);
  24823. - if (err) {
  24824. -@@ -6259,6 +6270,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  24825. - brcmf_notify_tdls_peer_event);
  24826. - }
  24827. -
  24828. -+ /* (re-) activate FWEH event handling */
  24829. -+ err = brcmf_fweh_activate_events(ifp);
  24830. -+ if (err) {
  24831. -+ brcmf_err("FWEH activation failed (%d)\n", err);
  24832. -+ goto wiphy_unreg_out;
  24833. -+ }
  24834. -+
  24835. - return cfg;
  24836. -
  24837. - wiphy_unreg_out:
  24838. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  24839. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  24840. -@@ -828,8 +828,8 @@ struct brcmf_if *brcmf_add_if(struct brc
  24841. - } else {
  24842. - brcmf_dbg(INFO, "allocate netdev interface\n");
  24843. - /* Allocate netdev, including space for private structure */
  24844. -- ndev = alloc_netdev(sizeof(*ifp), name, NET_NAME_UNKNOWN,
  24845. -- ether_setup);
  24846. -+ ndev = alloc_netdev(sizeof(*ifp), is_p2pdev ? "p2p%d" : name,
  24847. -+ NET_NAME_UNKNOWN, ether_setup);
  24848. - if (!ndev)
  24849. - return ERR_PTR(-ENOMEM);
  24850. -
  24851. -@@ -1021,12 +1021,7 @@ int brcmf_bus_start(struct device *dev)
  24852. - if (IS_ERR(ifp))
  24853. - return PTR_ERR(ifp);
  24854. -
  24855. -- if (brcmf_p2p_enable)
  24856. -- p2p_ifp = brcmf_add_if(drvr, 1, 0, false, "p2p%d", NULL);
  24857. -- else
  24858. -- p2p_ifp = NULL;
  24859. -- if (IS_ERR(p2p_ifp))
  24860. -- p2p_ifp = NULL;
  24861. -+ p2p_ifp = NULL;
  24862. -
  24863. - /* signal bus ready */
  24864. - brcmf_bus_change_state(bus_if, BRCMF_BUS_UP);
  24865. -@@ -1060,11 +1055,13 @@ int brcmf_bus_start(struct device *dev)
  24866. - goto fail;
  24867. - }
  24868. -
  24869. -- ret = brcmf_fweh_activate_events(ifp);
  24870. -- if (ret < 0)
  24871. -- goto fail;
  24872. --
  24873. - ret = brcmf_net_attach(ifp, false);
  24874. -+
  24875. -+ if ((!ret) && (brcmf_p2p_enable)) {
  24876. -+ p2p_ifp = drvr->iflist[1];
  24877. -+ if (p2p_ifp)
  24878. -+ ret = brcmf_net_p2p_attach(p2p_ifp);
  24879. -+ }
  24880. - fail:
  24881. - if (ret < 0) {
  24882. - brcmf_err("failed: %d\n", ret);
  24883. -@@ -1076,20 +1073,12 @@ fail:
  24884. - brcmf_fws_del_interface(ifp);
  24885. - brcmf_fws_deinit(drvr);
  24886. - }
  24887. -- if (drvr->iflist[0]) {
  24888. -+ if (ifp)
  24889. - brcmf_net_detach(ifp->ndev);
  24890. -- drvr->iflist[0] = NULL;
  24891. -- }
  24892. -- if (p2p_ifp) {
  24893. -+ if (p2p_ifp)
  24894. - brcmf_net_detach(p2p_ifp->ndev);
  24895. -- drvr->iflist[1] = NULL;
  24896. -- }
  24897. - return ret;
  24898. - }
  24899. -- if ((brcmf_p2p_enable) && (p2p_ifp))
  24900. -- if (brcmf_net_p2p_attach(p2p_ifp) < 0)
  24901. -- brcmf_p2p_enable = 0;
  24902. --
  24903. - return 0;
  24904. - }
  24905. -
  24906. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  24907. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  24908. -@@ -213,7 +213,8 @@ static void brcmf_fweh_handle_if_event(s
  24909. - is_p2pdev, emsg->ifname, emsg->addr);
  24910. - if (IS_ERR(ifp))
  24911. - return;
  24912. -- brcmf_fws_add_interface(ifp);
  24913. -+ if (!is_p2pdev)
  24914. -+ brcmf_fws_add_interface(ifp);
  24915. - if (!drvr->fweh.evt_handler[BRCMF_E_IF])
  24916. - if (brcmf_net_attach(ifp, false) < 0)
  24917. - return;
  24918. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  24919. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  24920. -@@ -2350,83 +2350,30 @@ void brcmf_p2p_stop_device(struct wiphy
  24921. - * brcmf_p2p_attach() - attach for P2P.
  24922. - *
  24923. - * @cfg: driver private data for cfg80211 interface.
  24924. -+ * @p2pdev_forced: create p2p device interface at attach.
  24925. - */
  24926. - s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced)
  24927. - {
  24928. -- struct brcmf_if *pri_ifp;
  24929. -- struct brcmf_if *p2p_ifp;
  24930. -- struct brcmf_cfg80211_vif *p2p_vif;
  24931. - struct brcmf_p2p_info *p2p;
  24932. -- struct brcmf_pub *drvr;
  24933. -- s32 bssidx;
  24934. -+ struct brcmf_if *pri_ifp;
  24935. - s32 err = 0;
  24936. -+ void *err_ptr;
  24937. -
  24938. - p2p = &cfg->p2p;
  24939. - p2p->cfg = cfg;
  24940. -
  24941. -- drvr = cfg->pub;
  24942. --
  24943. -- pri_ifp = brcmf_get_ifp(drvr, 0);
  24944. -+ pri_ifp = brcmf_get_ifp(cfg->pub, 0);
  24945. - p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif = pri_ifp->vif;
  24946. -
  24947. - if (p2pdev_forced) {
  24948. -- p2p_ifp = drvr->iflist[1];
  24949. -+ err_ptr = brcmf_p2p_create_p2pdev(p2p, NULL, NULL);
  24950. -+ if (IS_ERR(err_ptr)) {
  24951. -+ brcmf_err("P2P device creation failed.\n");
  24952. -+ err = PTR_ERR(err_ptr);
  24953. -+ }
  24954. - } else {
  24955. -- p2p_ifp = NULL;
  24956. - p2p->p2pdev_dynamically = true;
  24957. - }
  24958. -- if (p2p_ifp) {
  24959. -- p2p_vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_P2P_DEVICE,
  24960. -- false);
  24961. -- if (IS_ERR(p2p_vif)) {
  24962. -- brcmf_err("could not create discovery vif\n");
  24963. -- err = -ENOMEM;
  24964. -- goto exit;
  24965. -- }
  24966. --
  24967. -- p2p_vif->ifp = p2p_ifp;
  24968. -- p2p_ifp->vif = p2p_vif;
  24969. -- p2p_vif->wdev.netdev = p2p_ifp->ndev;
  24970. -- p2p_ifp->ndev->ieee80211_ptr = &p2p_vif->wdev;
  24971. -- SET_NETDEV_DEV(p2p_ifp->ndev, wiphy_dev(cfg->wiphy));
  24972. --
  24973. -- p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = p2p_vif;
  24974. --
  24975. -- brcmf_p2p_generate_bss_mac(p2p, NULL);
  24976. -- memcpy(p2p_ifp->mac_addr, p2p->dev_addr, ETH_ALEN);
  24977. -- brcmf_p2p_set_firmware(pri_ifp, p2p->dev_addr);
  24978. --
  24979. -- brcmf_fweh_p2pdev_setup(pri_ifp, true);
  24980. --
  24981. -- /* Initialize P2P Discovery in the firmware */
  24982. -- err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1);
  24983. -- if (err < 0) {
  24984. -- brcmf_err("set p2p_disc error\n");
  24985. -- brcmf_free_vif(p2p_vif);
  24986. -- goto exit;
  24987. -- }
  24988. -- /* obtain bsscfg index for P2P discovery */
  24989. -- err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bssidx);
  24990. -- if (err < 0) {
  24991. -- brcmf_err("retrieving discover bsscfg index failed\n");
  24992. -- brcmf_free_vif(p2p_vif);
  24993. -- goto exit;
  24994. -- }
  24995. -- /* Verify that firmware uses same bssidx as driver !! */
  24996. -- if (p2p_ifp->bssidx != bssidx) {
  24997. -- brcmf_err("Incorrect bssidx=%d, compared to p2p_ifp->bssidx=%d\n",
  24998. -- bssidx, p2p_ifp->bssidx);
  24999. -- brcmf_free_vif(p2p_vif);
  25000. -- goto exit;
  25001. -- }
  25002. --
  25003. -- init_completion(&p2p->send_af_done);
  25004. -- INIT_WORK(&p2p->afx_hdl.afx_work, brcmf_p2p_afx_handler);
  25005. -- init_completion(&p2p->afx_hdl.act_frm_scan);
  25006. -- init_completion(&p2p->wait_next_af);
  25007. --exit:
  25008. -- brcmf_fweh_p2pdev_setup(pri_ifp, false);
  25009. -- }
  25010. - return err;
  25011. - }
  25012. -
  25013. 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
  25014. deleted file mode 100644
  25015. index 0abcf1e..0000000
  25016. --- a/package/kernel/mac80211/patches/372-0006-brcmfmac-Fix-station-info-rate-information.patch
  25017. +++ /dev/null
  25018. @@ -1,36 +0,0 @@
  25019. -From: Hante Meuleman <meuleman@broadcom.com>
  25020. -Date: Thu, 8 Oct 2015 20:33:16 +0200
  25021. -Subject: [PATCH] brcmfmac: Fix station info rate information.
  25022. -
  25023. -Txrate and rxrate in get_station got assigned first with value
  25024. -in kbps and then divided by 100 to get it in 100kbps unit. The
  25025. -problem with that is that type of rate is u16 which resulted
  25026. -in incorrect values for high data rate values.
  25027. -
  25028. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  25029. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  25030. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  25031. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  25032. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  25033. ----
  25034. -
  25035. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  25036. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  25037. -@@ -2477,13 +2477,13 @@ brcmf_cfg80211_get_station(struct wiphy
  25038. - sinfo->rx_packets += le32_to_cpu(sta_info_le.rx_mcast_pkts);
  25039. - if (sinfo->tx_packets) {
  25040. - sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
  25041. -- sinfo->txrate.legacy = le32_to_cpu(sta_info_le.tx_rate);
  25042. -- sinfo->txrate.legacy /= 100;
  25043. -+ sinfo->txrate.legacy =
  25044. -+ le32_to_cpu(sta_info_le.tx_rate) / 100;
  25045. - }
  25046. - if (sinfo->rx_packets) {
  25047. - sinfo->filled |= BIT(NL80211_STA_INFO_RX_BITRATE);
  25048. -- sinfo->rxrate.legacy = le32_to_cpu(sta_info_le.rx_rate);
  25049. -- sinfo->rxrate.legacy /= 100;
  25050. -+ sinfo->rxrate.legacy =
  25051. -+ le32_to_cpu(sta_info_le.rx_rate) / 100;
  25052. - }
  25053. - if (le16_to_cpu(sta_info_le.ver) >= 4) {
  25054. - sinfo->filled |= BIT(NL80211_STA_INFO_TX_BYTES);
  25055. 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
  25056. deleted file mode 100644
  25057. index bb03d67..0000000
  25058. --- a/package/kernel/mac80211/patches/372-0007-brcmfmac-Add-RSSI-information-to-get_station.patch
  25059. +++ /dev/null
  25060. @@ -1,50 +0,0 @@
  25061. -From: Hante Meuleman <meuleman@broadcom.com>
  25062. -Date: Thu, 8 Oct 2015 20:33:17 +0200
  25063. -Subject: [PATCH] brcmfmac: Add RSSI information to get_station.
  25064. -
  25065. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  25066. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  25067. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  25068. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  25069. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  25070. ----
  25071. -
  25072. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  25073. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  25074. -@@ -2431,6 +2431,9 @@ brcmf_cfg80211_get_station(struct wiphy
  25075. - struct brcmf_sta_info_le sta_info_le;
  25076. - u32 sta_flags;
  25077. - u32 is_tdls_peer;
  25078. -+ s32 total_rssi;
  25079. -+ s32 count_rssi;
  25080. -+ u32 i;
  25081. -
  25082. - brcmf_dbg(TRACE, "Enter, MAC %pM\n", mac);
  25083. - if (!check_vif_up(ifp->vif))
  25084. -@@ -2491,6 +2494,26 @@ brcmf_cfg80211_get_station(struct wiphy
  25085. - sinfo->filled |= BIT(NL80211_STA_INFO_RX_BYTES);
  25086. - sinfo->rx_bytes = le64_to_cpu(sta_info_le.rx_tot_bytes);
  25087. - }
  25088. -+ total_rssi = 0;
  25089. -+ count_rssi = 0;
  25090. -+ for (i = 0; i < BRCMF_ANT_MAX; i++) {
  25091. -+ if (sta_info_le.rssi[i]) {
  25092. -+ sinfo->chain_signal_avg[count_rssi] =
  25093. -+ sta_info_le.rssi[i];
  25094. -+ sinfo->chain_signal[count_rssi] =
  25095. -+ sta_info_le.rssi[i];
  25096. -+ total_rssi += sta_info_le.rssi[i];
  25097. -+ count_rssi++;
  25098. -+ }
  25099. -+ }
  25100. -+ if (count_rssi) {
  25101. -+ sinfo->filled |= BIT(NL80211_STA_INFO_CHAIN_SIGNAL);
  25102. -+ sinfo->chains = count_rssi;
  25103. -+
  25104. -+ sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
  25105. -+ total_rssi /= count_rssi;
  25106. -+ sinfo->signal = total_rssi;
  25107. -+ }
  25108. - }
  25109. - done:
  25110. - brcmf_dbg(TRACE, "Exit\n");
  25111. 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
  25112. deleted file mode 100644
  25113. index a6bafd2..0000000
  25114. --- a/package/kernel/mac80211/patches/372-0008-brcmfmac-Add-dump_station-support-to-cfg80221-ops.patch
  25115. +++ /dev/null
  25116. @@ -1,107 +0,0 @@
  25117. -From: Hante Meuleman <meuleman@broadcom.com>
  25118. -Date: Thu, 8 Oct 2015 20:33:18 +0200
  25119. -Subject: [PATCH] brcmfmac: Add dump_station support to cfg80221 ops.
  25120. -
  25121. -With this feature it becomes possible to request a station
  25122. -assoc list.
  25123. -
  25124. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  25125. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  25126. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  25127. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  25128. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  25129. ----
  25130. -
  25131. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  25132. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  25133. -@@ -2520,6 +2520,35 @@ done:
  25134. - return err;
  25135. - }
  25136. -
  25137. -+static int
  25138. -+brcmf_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *ndev,
  25139. -+ int idx, u8 *mac, struct station_info *sinfo)
  25140. -+{
  25141. -+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  25142. -+ struct brcmf_if *ifp = netdev_priv(ndev);
  25143. -+ s32 err;
  25144. -+
  25145. -+ brcmf_dbg(TRACE, "Enter, idx %d\n", idx);
  25146. -+
  25147. -+ if (idx == 0) {
  25148. -+ cfg->assoclist.count = cpu_to_le32(BRCMF_MAX_ASSOCLIST);
  25149. -+ err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_ASSOCLIST,
  25150. -+ &cfg->assoclist,
  25151. -+ sizeof(cfg->assoclist));
  25152. -+ if (err) {
  25153. -+ brcmf_err("BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n",
  25154. -+ err);
  25155. -+ cfg->assoclist.count = 0;
  25156. -+ return -EOPNOTSUPP;
  25157. -+ }
  25158. -+ }
  25159. -+ if (idx < le32_to_cpu(cfg->assoclist.count)) {
  25160. -+ memcpy(mac, cfg->assoclist.mac[idx], ETH_ALEN);
  25161. -+ return brcmf_cfg80211_get_station(wiphy, ndev, mac, sinfo);
  25162. -+ }
  25163. -+ return -ENOENT;
  25164. -+}
  25165. -+
  25166. - static s32
  25167. - brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev,
  25168. - bool enabled, s32 timeout)
  25169. -@@ -4619,6 +4648,7 @@ static struct cfg80211_ops wl_cfg80211_o
  25170. - .join_ibss = brcmf_cfg80211_join_ibss,
  25171. - .leave_ibss = brcmf_cfg80211_leave_ibss,
  25172. - .get_station = brcmf_cfg80211_get_station,
  25173. -+ .dump_station = brcmf_cfg80211_dump_station,
  25174. - .set_tx_power = brcmf_cfg80211_set_tx_power,
  25175. - .get_tx_power = brcmf_cfg80211_get_tx_power,
  25176. - .add_key = brcmf_cfg80211_add_key,
  25177. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  25178. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  25179. -@@ -407,6 +407,7 @@ struct brcmf_cfg80211_info {
  25180. - struct brcmu_d11inf d11inf;
  25181. - bool wowl_enabled;
  25182. - u32 pre_wowl_pmmode;
  25183. -+ struct brcmf_assoclist_le assoclist;
  25184. - };
  25185. -
  25186. - /**
  25187. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwil.h
  25188. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil.h
  25189. -@@ -72,6 +72,7 @@
  25190. - #define BRCMF_C_GET_BSS_INFO 136
  25191. - #define BRCMF_C_GET_BANDLIST 140
  25192. - #define BRCMF_C_SET_SCB_TIMEOUT 158
  25193. -+#define BRCMF_C_GET_ASSOCLIST 159
  25194. - #define BRCMF_C_GET_PHYLIST 180
  25195. - #define BRCMF_C_SET_SCAN_CHANNEL_TIME 185
  25196. - #define BRCMF_C_SET_SCAN_UNASSOC_TIME 187
  25197. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  25198. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  25199. -@@ -119,6 +119,8 @@
  25200. - #define BRCMF_COUNTRY_BUF_SZ 4
  25201. - #define BRCMF_ANT_MAX 4
  25202. -
  25203. -+#define BRCMF_MAX_ASSOCLIST 128
  25204. -+
  25205. - /* join preference types for join_pref iovar */
  25206. - enum brcmf_join_pref_types {
  25207. - BRCMF_JOIN_PREF_RSSI = 1,
  25208. -@@ -621,4 +623,15 @@ struct brcmf_rev_info_le {
  25209. - __le32 nvramrev;
  25210. - };
  25211. -
  25212. -+/**
  25213. -+ * struct brcmf_assoclist_le - request assoc list.
  25214. -+ *
  25215. -+ * @count: indicates number of stations.
  25216. -+ * @mac: MAC addresses of stations.
  25217. -+ */
  25218. -+struct brcmf_assoclist_le {
  25219. -+ __le32 count;
  25220. -+ u8 mac[BRCMF_MAX_ASSOCLIST][ETH_ALEN];
  25221. -+};
  25222. -+
  25223. - #endif /* FWIL_TYPES_H_ */
  25224. 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
  25225. deleted file mode 100644
  25226. index dc54904..0000000
  25227. --- a/package/kernel/mac80211/patches/372-0009-brcmfmac-Move-brcmf_c_preinit_dcmds-prototype-to-cor.patch
  25228. +++ /dev/null
  25229. @@ -1,42 +0,0 @@
  25230. -From: Hante Meuleman <meuleman@broadcom.com>
  25231. -Date: Thu, 8 Oct 2015 20:33:19 +0200
  25232. -Subject: [PATCH] brcmfmac: Move brcmf_c_preinit_dcmds prototype to correct
  25233. - file.
  25234. -
  25235. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  25236. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  25237. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  25238. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  25239. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  25240. ----
  25241. -
  25242. ---- a/drivers/net/wireless/brcm80211/brcmfmac/common.h
  25243. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/common.h
  25244. -@@ -17,4 +17,7 @@
  25245. -
  25246. - extern const u8 ALLFFMAC[ETH_ALEN];
  25247. -
  25248. -+/* Sets dongle media info (drv_version, mac address). */
  25249. -+int brcmf_c_preinit_dcmds(struct brcmf_if *ifp);
  25250. -+
  25251. - #endif /* BRCMFMAC_COMMON_H */
  25252. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  25253. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  25254. -@@ -33,6 +33,7 @@
  25255. - #include "feature.h"
  25256. - #include "proto.h"
  25257. - #include "pcie.h"
  25258. -+#include "common.h"
  25259. -
  25260. - MODULE_AUTHOR("Broadcom Corporation");
  25261. - MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver.");
  25262. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  25263. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  25264. -@@ -214,7 +214,4 @@ void brcmf_txflowblock_if(struct brcmf_i
  25265. - void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  25266. - void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);
  25267. -
  25268. --/* Sets dongle media info (drv_version, mac address). */
  25269. --int brcmf_c_preinit_dcmds(struct brcmf_if *ifp);
  25270. --
  25271. - #endif /* BRCMFMAC_CORE_H */
  25272. 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
  25273. deleted file mode 100644
  25274. index c6a7363..0000000
  25275. --- a/package/kernel/mac80211/patches/372-0010-brcmfmac-Remove-unused-state-AP-creating.patch
  25276. +++ /dev/null
  25277. @@ -1,55 +0,0 @@
  25278. -From: Hante Meuleman <meuleman@broadcom.com>
  25279. -Date: Thu, 8 Oct 2015 20:33:20 +0200
  25280. -Subject: [PATCH] brcmfmac: Remove unused state AP creating.
  25281. -
  25282. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  25283. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  25284. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  25285. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  25286. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  25287. ----
  25288. -
  25289. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  25290. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  25291. -@@ -839,7 +839,6 @@ brcmf_cfg80211_change_iface(struct wiphy
  25292. - err = brcmf_p2p_ifchange(cfg, BRCMF_FIL_P2P_IF_GO);
  25293. - }
  25294. - if (!err) {
  25295. -- set_bit(BRCMF_VIF_STATUS_AP_CREATING, &vif->sme_state);
  25296. - brcmf_dbg(INFO, "IF Type = AP\n");
  25297. - }
  25298. - } else {
  25299. -@@ -4250,7 +4249,6 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  25300. -
  25301. - brcmf_dbg(TRACE, "GO mode configuration complete\n");
  25302. - }
  25303. -- clear_bit(BRCMF_VIF_STATUS_AP_CREATING, &ifp->vif->sme_state);
  25304. - set_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state);
  25305. -
  25306. - exit:
  25307. -@@ -4315,7 +4313,6 @@ static int brcmf_cfg80211_stop_ap(struct
  25308. - }
  25309. - brcmf_set_mpc(ifp, 1);
  25310. - brcmf_configure_arp_offload(ifp, true);
  25311. -- set_bit(BRCMF_VIF_STATUS_AP_CREATING, &ifp->vif->sme_state);
  25312. - clear_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state);
  25313. -
  25314. - return err;
  25315. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  25316. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  25317. -@@ -143,7 +143,6 @@ struct brcmf_cfg80211_profile {
  25318. - * @BRCMF_VIF_STATUS_CONNECTING: connect/join in progress.
  25319. - * @BRCMF_VIF_STATUS_CONNECTED: connected/joined succesfully.
  25320. - * @BRCMF_VIF_STATUS_DISCONNECTING: disconnect/disable in progress.
  25321. -- * @BRCMF_VIF_STATUS_AP_CREATING: interface configured for AP operation.
  25322. - * @BRCMF_VIF_STATUS_AP_CREATED: AP operation started.
  25323. - */
  25324. - enum brcmf_vif_status {
  25325. -@@ -151,7 +150,6 @@ enum brcmf_vif_status {
  25326. - BRCMF_VIF_STATUS_CONNECTING,
  25327. - BRCMF_VIF_STATUS_CONNECTED,
  25328. - BRCMF_VIF_STATUS_DISCONNECTING,
  25329. -- BRCMF_VIF_STATUS_AP_CREATING,
  25330. - BRCMF_VIF_STATUS_AP_CREATED
  25331. - };
  25332. -
  25333. 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
  25334. deleted file mode 100644
  25335. index c0948de..0000000
  25336. --- a/package/kernel/mac80211/patches/372-0011-brcmfmac-Properly-set-carrier-state-of-netdev.patch
  25337. +++ /dev/null
  25338. @@ -1,122 +0,0 @@
  25339. -From: Hante Meuleman <meuleman@broadcom.com>
  25340. -Date: Thu, 8 Oct 2015 20:33:21 +0200
  25341. -Subject: [PATCH] brcmfmac: Properly set carrier state of netdev.
  25342. -
  25343. -Use the netif_carrier api to correctly set carrier state on the
  25344. -different modes.
  25345. -
  25346. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  25347. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  25348. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  25349. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  25350. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  25351. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  25352. ----
  25353. -
  25354. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  25355. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  25356. -@@ -4250,6 +4250,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  25357. - brcmf_dbg(TRACE, "GO mode configuration complete\n");
  25358. - }
  25359. - set_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state);
  25360. -+ brcmf_net_setcarrier(ifp, true);
  25361. -
  25362. - exit:
  25363. - if ((err) && (!mbss)) {
  25364. -@@ -4314,6 +4315,7 @@ static int brcmf_cfg80211_stop_ap(struct
  25365. - brcmf_set_mpc(ifp, 1);
  25366. - brcmf_configure_arp_offload(ifp, true);
  25367. - clear_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state);
  25368. -+ brcmf_net_setcarrier(ifp, false);
  25369. -
  25370. - return err;
  25371. - }
  25372. -@@ -5023,6 +5025,7 @@ brcmf_notify_connect_status(struct brcmf
  25373. - &ifp->vif->sme_state);
  25374. - } else
  25375. - brcmf_bss_connect_done(cfg, ndev, e, true);
  25376. -+ brcmf_net_setcarrier(ifp, true);
  25377. - } else if (brcmf_is_linkdown(e)) {
  25378. - brcmf_dbg(CONN, "Linkdown\n");
  25379. - if (!brcmf_is_ibssmode(ifp->vif)) {
  25380. -@@ -5032,6 +5035,7 @@ brcmf_notify_connect_status(struct brcmf
  25381. - brcmf_init_prof(ndev_to_prof(ndev));
  25382. - if (ndev != cfg_to_ndev(cfg))
  25383. - complete(&cfg->vif_disabled);
  25384. -+ brcmf_net_setcarrier(ifp, false);
  25385. - } else if (brcmf_is_nonetwork(cfg, e)) {
  25386. - if (brcmf_is_ibssmode(ifp->vif))
  25387. - clear_bit(BRCMF_VIF_STATUS_CONNECTING,
  25388. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  25389. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  25390. -@@ -635,8 +635,7 @@ static int brcmf_netdev_stop(struct net_
  25391. -
  25392. - brcmf_cfg80211_down(ndev);
  25393. -
  25394. -- /* Set state and stop OS transmissions */
  25395. -- netif_stop_queue(ndev);
  25396. -+ brcmf_net_setcarrier(ifp, false);
  25397. -
  25398. - return 0;
  25399. - }
  25400. -@@ -670,8 +669,8 @@ static int brcmf_netdev_open(struct net_
  25401. - return -EIO;
  25402. - }
  25403. -
  25404. -- /* Allow transmit calls */
  25405. -- netif_start_queue(ndev);
  25406. -+ /* Clear, carrier, set when connected or AP mode. */
  25407. -+ netif_carrier_off(ndev);
  25408. - return 0;
  25409. - }
  25410. -
  25411. -@@ -736,6 +735,24 @@ static void brcmf_net_detach(struct net_
  25412. - brcmf_cfg80211_free_netdev(ndev);
  25413. - }
  25414. -
  25415. -+void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on)
  25416. -+{
  25417. -+ struct net_device *ndev;
  25418. -+
  25419. -+ brcmf_dbg(TRACE, "Enter, idx=%d carrier=%d\n", ifp->bssidx, on);
  25420. -+
  25421. -+ ndev = ifp->ndev;
  25422. -+ brcmf_txflowblock_if(ifp, BRCMF_NETIF_STOP_REASON_DISCONNECTED, !on);
  25423. -+ if (on) {
  25424. -+ if (!netif_carrier_ok(ndev))
  25425. -+ netif_carrier_on(ndev);
  25426. -+
  25427. -+ } else {
  25428. -+ if (netif_carrier_ok(ndev))
  25429. -+ netif_carrier_off(ndev);
  25430. -+ }
  25431. -+}
  25432. -+
  25433. - static int brcmf_net_p2p_open(struct net_device *ndev)
  25434. - {
  25435. - brcmf_dbg(TRACE, "Enter\n");
  25436. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  25437. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  25438. -@@ -154,10 +154,13 @@ struct brcmf_fws_mac_descriptor;
  25439. - * netif stopped due to firmware signalling flow control.
  25440. - * @BRCMF_NETIF_STOP_REASON_FLOW:
  25441. - * netif stopped due to flowring full.
  25442. -+ * @BRCMF_NETIF_STOP_REASON_DISCONNECTED:
  25443. -+ * netif stopped due to not being connected (STA mode).
  25444. - */
  25445. - enum brcmf_netif_stop_reason {
  25446. -- BRCMF_NETIF_STOP_REASON_FWS_FC = 1,
  25447. -- BRCMF_NETIF_STOP_REASON_FLOW = 2
  25448. -+ BRCMF_NETIF_STOP_REASON_FWS_FC = BIT(0),
  25449. -+ BRCMF_NETIF_STOP_REASON_FLOW = BIT(1),
  25450. -+ BRCMF_NETIF_STOP_REASON_DISCONNECTED = BIT(2)
  25451. - };
  25452. -
  25453. - /**
  25454. -@@ -213,5 +216,6 @@ void brcmf_txflowblock_if(struct brcmf_i
  25455. - enum brcmf_netif_stop_reason reason, bool state);
  25456. - void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  25457. - void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);
  25458. -+void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on);
  25459. -
  25460. - #endif /* BRCMFMAC_CORE_H */
  25461. 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
  25462. deleted file mode 100644
  25463. index ea6fad1..0000000
  25464. --- a/package/kernel/mac80211/patches/373-brcm80211-Add-support-for-brcm4371.patch
  25465. +++ /dev/null
  25466. @@ -1,78 +0,0 @@
  25467. -From: Eric Caruso <ejcaruso@google.com>
  25468. -Date: Wed, 14 Oct 2015 12:34:11 -0700
  25469. -Subject: [PATCH] brcm80211: Add support for brcm4371
  25470. -
  25471. -This is a new Broadcom chip and we should be able to recognize it.
  25472. -
  25473. -Signed-off-by: Eric Caruso <ejcaruso@google.com>
  25474. -Acked-by: Arend van Spriel <arend@broadcom.com>
  25475. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  25476. ----
  25477. -
  25478. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  25479. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  25480. -@@ -682,6 +682,7 @@ static u32 brcmf_chip_tcm_rambase(struct
  25481. - case BRCM_CC_43570_CHIP_ID:
  25482. - case BRCM_CC_4358_CHIP_ID:
  25483. - case BRCM_CC_43602_CHIP_ID:
  25484. -+ case BRCM_CC_4371_CHIP_ID:
  25485. - return 0x180000;
  25486. - case BRCM_CC_4365_CHIP_ID:
  25487. - case BRCM_CC_4366_CHIP_ID:
  25488. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  25489. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  25490. -@@ -59,6 +59,8 @@ enum brcmf_pcie_state {
  25491. - #define BRCMF_PCIE_4365_NVRAM_NAME "brcm/brcmfmac4365b-pcie.txt"
  25492. - #define BRCMF_PCIE_4366_FW_NAME "brcm/brcmfmac4366b-pcie.bin"
  25493. - #define BRCMF_PCIE_4366_NVRAM_NAME "brcm/brcmfmac4366b-pcie.txt"
  25494. -+#define BRCMF_PCIE_4371_FW_NAME "brcm/brcmfmac4371-pcie.bin"
  25495. -+#define BRCMF_PCIE_4371_NVRAM_NAME "brcm/brcmfmac4371-pcie.txt"
  25496. -
  25497. - #define BRCMF_PCIE_FW_UP_TIMEOUT 2000 /* msec */
  25498. -
  25499. -@@ -212,6 +214,8 @@ MODULE_FIRMWARE(BRCMF_PCIE_4365_FW_NAME)
  25500. - MODULE_FIRMWARE(BRCMF_PCIE_4365_NVRAM_NAME);
  25501. - MODULE_FIRMWARE(BRCMF_PCIE_4366_FW_NAME);
  25502. - MODULE_FIRMWARE(BRCMF_PCIE_4366_NVRAM_NAME);
  25503. -+MODULE_FIRMWARE(BRCMF_PCIE_4371_FW_NAME);
  25504. -+MODULE_FIRMWARE(BRCMF_PCIE_4371_NVRAM_NAME);
  25505. -
  25506. -
  25507. - struct brcmf_pcie_console {
  25508. -@@ -1521,6 +1525,10 @@ static int brcmf_pcie_get_fwnames(struct
  25509. - fw_name = BRCMF_PCIE_4366_FW_NAME;
  25510. - nvram_name = BRCMF_PCIE_4366_NVRAM_NAME;
  25511. - break;
  25512. -+ case BRCM_CC_4371_CHIP_ID:
  25513. -+ fw_name = BRCMF_PCIE_4371_FW_NAME;
  25514. -+ nvram_name = BRCMF_PCIE_4371_NVRAM_NAME;
  25515. -+ break;
  25516. - default:
  25517. - brcmf_err("Unsupported chip 0x%04x\n", devinfo->ci->chip);
  25518. - return -ENODEV;
  25519. -@@ -2060,6 +2068,7 @@ static struct pci_device_id brcmf_pcie_d
  25520. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_DEVICE_ID),
  25521. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_2G_DEVICE_ID),
  25522. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_5G_DEVICE_ID),
  25523. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4371_DEVICE_ID),
  25524. - { /* end: all zeroes */ }
  25525. - };
  25526. -
  25527. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  25528. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  25529. -@@ -50,6 +50,7 @@
  25530. - #define BRCM_CC_43602_CHIP_ID 43602
  25531. - #define BRCM_CC_4365_CHIP_ID 0x4365
  25532. - #define BRCM_CC_4366_CHIP_ID 0x4366
  25533. -+#define BRCM_CC_4371_CHIP_ID 0x4371
  25534. -
  25535. - /* USB Device IDs */
  25536. - #define BRCM_USB_43143_DEVICE_ID 0xbd1e
  25537. -@@ -75,6 +76,7 @@
  25538. - #define BRCM_PCIE_4366_DEVICE_ID 0x43c3
  25539. - #define BRCM_PCIE_4366_2G_DEVICE_ID 0x43c4
  25540. - #define BRCM_PCIE_4366_5G_DEVICE_ID 0x43c5
  25541. -+#define BRCM_PCIE_4371_DEVICE_ID 0x440d
  25542. -
  25543. -
  25544. - /* brcmsmac IDs */
  25545. 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
  25546. deleted file mode 100644
  25547. index 221bae6..0000000
  25548. --- a/package/kernel/mac80211/patches/374-0001-brcmfmac-Add-support-for-the-BCM4359-11ac-RSDB-PCIE-.patch
  25549. +++ /dev/null
  25550. @@ -1,78 +0,0 @@
  25551. -From: Hante Meuleman <meuleman@broadcom.com>
  25552. -Date: Thu, 29 Oct 2015 20:33:11 +0100
  25553. -Subject: [PATCH] brcmfmac: Add support for the BCM4359 11ac RSDB PCIE device.
  25554. -
  25555. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  25556. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  25557. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  25558. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  25559. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  25560. ----
  25561. -
  25562. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  25563. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  25564. -@@ -681,6 +681,7 @@ static u32 brcmf_chip_tcm_rambase(struct
  25565. - case BRCM_CC_43569_CHIP_ID:
  25566. - case BRCM_CC_43570_CHIP_ID:
  25567. - case BRCM_CC_4358_CHIP_ID:
  25568. -+ case BRCM_CC_4359_CHIP_ID:
  25569. - case BRCM_CC_43602_CHIP_ID:
  25570. - case BRCM_CC_4371_CHIP_ID:
  25571. - return 0x180000;
  25572. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  25573. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  25574. -@@ -55,6 +55,8 @@ enum brcmf_pcie_state {
  25575. - #define BRCMF_PCIE_43570_NVRAM_NAME "brcm/brcmfmac43570-pcie.txt"
  25576. - #define BRCMF_PCIE_4358_FW_NAME "brcm/brcmfmac4358-pcie.bin"
  25577. - #define BRCMF_PCIE_4358_NVRAM_NAME "brcm/brcmfmac4358-pcie.txt"
  25578. -+#define BRCMF_PCIE_4359_FW_NAME "brcm/brcmfmac4359-pcie.bin"
  25579. -+#define BRCMF_PCIE_4359_NVRAM_NAME "brcm/brcmfmac4359-pcie.txt"
  25580. - #define BRCMF_PCIE_4365_FW_NAME "brcm/brcmfmac4365b-pcie.bin"
  25581. - #define BRCMF_PCIE_4365_NVRAM_NAME "brcm/brcmfmac4365b-pcie.txt"
  25582. - #define BRCMF_PCIE_4366_FW_NAME "brcm/brcmfmac4366b-pcie.bin"
  25583. -@@ -210,6 +212,8 @@ MODULE_FIRMWARE(BRCMF_PCIE_43570_FW_NAME
  25584. - MODULE_FIRMWARE(BRCMF_PCIE_43570_NVRAM_NAME);
  25585. - MODULE_FIRMWARE(BRCMF_PCIE_4358_FW_NAME);
  25586. - MODULE_FIRMWARE(BRCMF_PCIE_4358_NVRAM_NAME);
  25587. -+MODULE_FIRMWARE(BRCMF_PCIE_4359_FW_NAME);
  25588. -+MODULE_FIRMWARE(BRCMF_PCIE_4359_NVRAM_NAME);
  25589. - MODULE_FIRMWARE(BRCMF_PCIE_4365_FW_NAME);
  25590. - MODULE_FIRMWARE(BRCMF_PCIE_4365_NVRAM_NAME);
  25591. - MODULE_FIRMWARE(BRCMF_PCIE_4366_FW_NAME);
  25592. -@@ -1517,6 +1521,10 @@ static int brcmf_pcie_get_fwnames(struct
  25593. - fw_name = BRCMF_PCIE_4358_FW_NAME;
  25594. - nvram_name = BRCMF_PCIE_4358_NVRAM_NAME;
  25595. - break;
  25596. -+ case BRCM_CC_4359_CHIP_ID:
  25597. -+ fw_name = BRCMF_PCIE_4359_FW_NAME;
  25598. -+ nvram_name = BRCMF_PCIE_4359_NVRAM_NAME;
  25599. -+ break;
  25600. - case BRCM_CC_4365_CHIP_ID:
  25601. - fw_name = BRCMF_PCIE_4365_FW_NAME;
  25602. - nvram_name = BRCMF_PCIE_4365_NVRAM_NAME;
  25603. -@@ -2058,6 +2066,7 @@ static struct pci_device_id brcmf_pcie_d
  25604. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43567_DEVICE_ID),
  25605. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43570_DEVICE_ID),
  25606. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4358_DEVICE_ID),
  25607. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4359_DEVICE_ID),
  25608. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_DEVICE_ID),
  25609. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_2G_DEVICE_ID),
  25610. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_5G_DEVICE_ID),
  25611. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  25612. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  25613. -@@ -47,6 +47,7 @@
  25614. - #define BRCM_CC_43569_CHIP_ID 43569
  25615. - #define BRCM_CC_43570_CHIP_ID 43570
  25616. - #define BRCM_CC_4358_CHIP_ID 0x4358
  25617. -+#define BRCM_CC_4359_CHIP_ID 0x4359
  25618. - #define BRCM_CC_43602_CHIP_ID 43602
  25619. - #define BRCM_CC_4365_CHIP_ID 0x4365
  25620. - #define BRCM_CC_4366_CHIP_ID 0x4366
  25621. -@@ -66,6 +67,7 @@
  25622. - #define BRCM_PCIE_43567_DEVICE_ID 0x43d3
  25623. - #define BRCM_PCIE_43570_DEVICE_ID 0x43d9
  25624. - #define BRCM_PCIE_4358_DEVICE_ID 0x43e9
  25625. -+#define BRCM_PCIE_4359_DEVICE_ID 0x43ef
  25626. - #define BRCM_PCIE_43602_DEVICE_ID 0x43ba
  25627. - #define BRCM_PCIE_43602_2G_DEVICE_ID 0x43bb
  25628. - #define BRCM_PCIE_43602_5G_DEVICE_ID 0x43bc
  25629. 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
  25630. deleted file mode 100644
  25631. index 331896b..0000000
  25632. --- a/package/kernel/mac80211/patches/374-0002-brcmfmac-Simplify-and-fix-usage-of-brcmf_ifname.patch
  25633. +++ /dev/null
  25634. @@ -1,110 +0,0 @@
  25635. -From: Hante Meuleman <meuleman@broadcom.com>
  25636. -Date: Thu, 29 Oct 2015 20:33:12 +0100
  25637. -Subject: [PATCH] brcmfmac: Simplify and fix usage of brcmf_ifname.
  25638. -
  25639. -brcmf_ifname is a debug function to return a name related to an ifp,
  25640. -but is using a rather complex implementation. It was also used
  25641. -wrongly from bcdc as it did not use the bsscfgidx as it was supposed
  25642. -to, but bssidx. This patch fixes that bug and simplifies
  25643. -brcmf_ifname.
  25644. -
  25645. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  25646. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  25647. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  25648. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  25649. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  25650. ----
  25651. -
  25652. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  25653. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  25654. -@@ -187,7 +187,8 @@ retry:
  25655. - goto retry;
  25656. - if (id != bcdc->reqid) {
  25657. - brcmf_err("%s: unexpected request id %d (expected %d)\n",
  25658. -- brcmf_ifname(drvr, ifidx), id, bcdc->reqid);
  25659. -+ brcmf_ifname(brcmf_get_ifp(drvr, ifidx)), id,
  25660. -+ bcdc->reqid);
  25661. - ret = -EINVAL;
  25662. - goto done;
  25663. - }
  25664. -@@ -234,7 +235,8 @@ brcmf_proto_bcdc_set_dcmd(struct brcmf_p
  25665. -
  25666. - if (id != bcdc->reqid) {
  25667. - brcmf_err("%s: unexpected request id %d (expected %d)\n",
  25668. -- brcmf_ifname(drvr, ifidx), id, bcdc->reqid);
  25669. -+ brcmf_ifname(brcmf_get_ifp(drvr, ifidx)), id,
  25670. -+ bcdc->reqid);
  25671. - ret = -EINVAL;
  25672. - goto done;
  25673. - }
  25674. -@@ -298,13 +300,13 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  25675. - if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) !=
  25676. - BCDC_PROTO_VER) {
  25677. - brcmf_err("%s: non-BCDC packet received, flags 0x%x\n",
  25678. -- brcmf_ifname(drvr, tmp_if->ifidx), h->flags);
  25679. -+ brcmf_ifname(tmp_if), h->flags);
  25680. - return -EBADE;
  25681. - }
  25682. -
  25683. - if (h->flags & BCDC_FLAG_SUM_GOOD) {
  25684. - brcmf_dbg(BCDC, "%s: BDC rcv, good checksum, flags 0x%x\n",
  25685. -- brcmf_ifname(drvr, tmp_if->ifidx), h->flags);
  25686. -+ brcmf_ifname(tmp_if), h->flags);
  25687. - pktbuf->ip_summed = CHECKSUM_UNNECESSARY;
  25688. - }
  25689. -
  25690. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  25691. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  25692. -@@ -66,20 +66,13 @@ static int brcmf_p2p_enable;
  25693. - module_param_named(p2pon, brcmf_p2p_enable, int, 0);
  25694. - MODULE_PARM_DESC(p2pon, "enable legacy p2p management functionality");
  25695. -
  25696. --char *brcmf_ifname(struct brcmf_pub *drvr, int ifidx)
  25697. -+char *brcmf_ifname(struct brcmf_if *ifp)
  25698. - {
  25699. -- if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  25700. -- brcmf_err("ifidx %d out of range\n", ifidx);
  25701. -- return "<if_bad>";
  25702. -- }
  25703. --
  25704. -- if (drvr->iflist[ifidx] == NULL) {
  25705. -- brcmf_err("null i/f %d\n", ifidx);
  25706. -+ if (!ifp)
  25707. - return "<if_null>";
  25708. -- }
  25709. -
  25710. -- if (drvr->iflist[ifidx]->ndev)
  25711. -- return drvr->iflist[ifidx]->ndev->name;
  25712. -+ if (ifp->ndev)
  25713. -+ return ifp->ndev->name;
  25714. -
  25715. - return "<if_none>";
  25716. - }
  25717. -@@ -237,14 +230,14 @@ static netdev_tx_t brcmf_netdev_start_xm
  25718. - struct sk_buff *skb2;
  25719. -
  25720. - brcmf_dbg(INFO, "%s: insufficient headroom\n",
  25721. -- brcmf_ifname(drvr, ifp->bssidx));
  25722. -+ brcmf_ifname(ifp));
  25723. - drvr->bus_if->tx_realloc++;
  25724. - skb2 = skb_realloc_headroom(skb, drvr->hdrlen);
  25725. - dev_kfree_skb(skb);
  25726. - skb = skb2;
  25727. - if (skb == NULL) {
  25728. - brcmf_err("%s: skb_realloc_headroom failed\n",
  25729. -- brcmf_ifname(drvr, ifp->bssidx));
  25730. -+ brcmf_ifname(ifp));
  25731. - ret = -ENOMEM;
  25732. - goto done;
  25733. - }
  25734. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  25735. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  25736. -@@ -205,7 +205,7 @@ struct brcmf_skb_reorder_data {
  25737. - int brcmf_netdev_wait_pend8021x(struct brcmf_if *ifp);
  25738. -
  25739. - /* Return pointer to interface name */
  25740. --char *brcmf_ifname(struct brcmf_pub *drvr, int idx);
  25741. -+char *brcmf_ifname(struct brcmf_if *ifp);
  25742. - struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  25743. - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  25744. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  25745. 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
  25746. deleted file mode 100644
  25747. index 4d60521..0000000
  25748. --- a/package/kernel/mac80211/patches/374-0003-brcmfmac-Remove-unnecessary-check-from-start_xmit.patch
  25749. +++ /dev/null
  25750. @@ -1,32 +0,0 @@
  25751. -From: Hante Meuleman <meuleman@broadcom.com>
  25752. -Date: Thu, 29 Oct 2015 20:33:13 +0100
  25753. -Subject: [PATCH] brcmfmac: Remove unnecessary check from start_xmit.
  25754. -
  25755. -The brcmf_netdev_start_xmit checks if the ndev is still valid by
  25756. -checking if it still exists in database. This check is not needed
  25757. -and therefor removed.
  25758. -
  25759. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  25760. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  25761. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  25762. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  25763. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  25764. ----
  25765. -
  25766. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  25767. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  25768. -@@ -217,14 +217,6 @@ static netdev_tx_t brcmf_netdev_start_xm
  25769. - goto done;
  25770. - }
  25771. -
  25772. -- if (!drvr->iflist[ifp->bssidx]) {
  25773. -- brcmf_err("bad ifidx %d\n", ifp->bssidx);
  25774. -- netif_stop_queue(ndev);
  25775. -- dev_kfree_skb(skb);
  25776. -- ret = -ENODEV;
  25777. -- goto done;
  25778. -- }
  25779. --
  25780. - /* Make sure there's enough room for any header */
  25781. - if (skb_headroom(skb) < drvr->hdrlen) {
  25782. - struct sk_buff *skb2;
  25783. 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
  25784. deleted file mode 100644
  25785. index 5030297..0000000
  25786. --- a/package/kernel/mac80211/patches/374-0004-brcmfmac-Remove-unncessary-variable-irq_requested.patch
  25787. +++ /dev/null
  25788. @@ -1,49 +0,0 @@
  25789. -From: Hante Meuleman <meuleman@broadcom.com>
  25790. -Date: Thu, 29 Oct 2015 20:33:14 +0100
  25791. -Subject: [PATCH] brcmfmac: Remove unncessary variable irq_requested.
  25792. -
  25793. -The variable irq_requested is unneeded as the functionality
  25794. -it is providing, is also provided by the variable irq_allocated.
  25795. -
  25796. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  25797. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  25798. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  25799. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  25800. ----
  25801. -
  25802. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  25803. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  25804. -@@ -257,7 +257,6 @@ struct brcmf_pcie_core_info {
  25805. - struct brcmf_pciedev_info {
  25806. - enum brcmf_pcie_state state;
  25807. - bool in_irq;
  25808. -- bool irq_requested;
  25809. - struct pci_dev *pdev;
  25810. - char fw_name[BRCMF_FW_PATH_LEN + BRCMF_FW_NAME_LEN];
  25811. - char nvram_name[BRCMF_FW_PATH_LEN + BRCMF_FW_NAME_LEN];
  25812. -@@ -889,7 +888,6 @@ static int brcmf_pcie_request_irq(struct
  25813. -
  25814. - brcmf_dbg(PCIE, "Enter\n");
  25815. - /* is it a v1 or v2 implementation */
  25816. -- devinfo->irq_requested = false;
  25817. - pci_enable_msi(pdev);
  25818. - if (devinfo->generic_corerev == BRCMF_PCIE_GENREV1) {
  25819. - if (request_threaded_irq(pdev->irq,
  25820. -@@ -912,7 +910,6 @@ static int brcmf_pcie_request_irq(struct
  25821. - return -EIO;
  25822. - }
  25823. - }
  25824. -- devinfo->irq_requested = true;
  25825. - devinfo->irq_allocated = true;
  25826. - return 0;
  25827. - }
  25828. -@@ -930,9 +927,6 @@ static void brcmf_pcie_release_irq(struc
  25829. - pdev = devinfo->pdev;
  25830. -
  25831. - brcmf_pcie_intr_disable(devinfo);
  25832. -- if (!devinfo->irq_requested)
  25833. -- return;
  25834. -- devinfo->irq_requested = false;
  25835. - free_irq(pdev->irq, devinfo);
  25836. - pci_disable_msi(pdev);
  25837. -
  25838. 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
  25839. deleted file mode 100644
  25840. index f2afb90..0000000
  25841. --- a/package/kernel/mac80211/patches/374-0005-brcmfmac-Disable-runtime-pm-for-USB.patch
  25842. +++ /dev/null
  25843. @@ -1,26 +0,0 @@
  25844. -From: Hante Meuleman <meuleman@broadcom.com>
  25845. -Date: Thu, 29 Oct 2015 20:33:15 +0100
  25846. -Subject: [PATCH] brcmfmac: Disable runtime pm for USB.
  25847. -
  25848. -Currently runtime pm is enabled for USB, but it is not properly
  25849. -supported by driver. This patch disables the runtime PM support
  25850. -completely for USB, as it currently can result in problems on
  25851. -some systems.
  25852. -
  25853. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  25854. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  25855. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  25856. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  25857. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  25858. ----
  25859. -
  25860. ---- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  25861. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  25862. -@@ -1504,7 +1504,6 @@ static struct usb_driver brcmf_usbdrvr =
  25863. - .suspend = brcmf_usb_suspend,
  25864. - .resume = brcmf_usb_resume,
  25865. - .reset_resume = brcmf_usb_reset_resume,
  25866. -- .supports_autosuspend = 1,
  25867. - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
  25868. - .disable_hub_initiated_lpm = 1,
  25869. - #endif
  25870. 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
  25871. deleted file mode 100644
  25872. index 78a95c5..0000000
  25873. --- a/package/kernel/mac80211/patches/374-0006-brcmfmac-Add-RSDB-support.patch
  25874. +++ /dev/null
  25875. @@ -1,65 +0,0 @@
  25876. -From: Hante Meuleman <meuleman@broadcom.com>
  25877. -Date: Thu, 29 Oct 2015 20:33:16 +0100
  25878. -Subject: [PATCH] brcmfmac: Add RSDB support.
  25879. -
  25880. -Broadcom devices with a single 802.11 core can work on two band
  25881. -concurrently using VSDB feature, ie. Virtual Simultaneous Dual-Band.
  25882. -For devices that are fitted with two 802.11 cores and RF paths the
  25883. -driver should support a firmware feature called RSDB, which stands
  25884. -for Real Simultaneous Dual-Band. RSDB works almost autonomously in
  25885. -firmware except for AP config. When the device supports RSDB then
  25886. -the interface should not be brought down when configuring it,
  25887. -otherwise the link (if configured) on the other interface will be
  25888. -lost.
  25889. -
  25890. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  25891. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  25892. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  25893. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  25894. -[kvalo@codeaurora.org: changed the commit log based on discussion]
  25895. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  25896. ----
  25897. -
  25898. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  25899. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  25900. -@@ -4182,7 +4182,9 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  25901. - }
  25902. - }
  25903. -
  25904. -- if (dev_role == NL80211_IFTYPE_AP) {
  25905. -+ if ((dev_role == NL80211_IFTYPE_AP) &&
  25906. -+ ((ifp->ifidx == 0) ||
  25907. -+ !brcmf_feat_is_enabled(ifp, BRCMF_FEAT_RSDB))) {
  25908. - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
  25909. - if (err < 0) {
  25910. - brcmf_err("BRCMF_C_DOWN error %d\n", err);
  25911. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  25912. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  25913. -@@ -137,6 +137,7 @@ void brcmf_feat_attach(struct brcmf_pub
  25914. - if (drvr->bus_if->chip != BRCM_CC_43362_CHIP_ID)
  25915. - brcmf_feat_iovar_int_set(ifp, BRCMF_FEAT_MBSS, "mbss", 0);
  25916. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_P2P, "p2p");
  25917. -+ brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_RSDB, "rsdb_mode");
  25918. -
  25919. - if (brcmf_feature_disable) {
  25920. - brcmf_dbg(INFO, "Features: 0x%02x, disable: 0x%02x\n",
  25921. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  25922. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  25923. -@@ -24,13 +24,16 @@
  25924. - * PNO: preferred network offload.
  25925. - * WOWL: Wake-On-WLAN.
  25926. - * P2P: peer-to-peer
  25927. -+ * RSDB: Real Simultaneous Dual Band
  25928. - */
  25929. - #define BRCMF_FEAT_LIST \
  25930. - BRCMF_FEAT_DEF(MBSS) \
  25931. - BRCMF_FEAT_DEF(MCHAN) \
  25932. - BRCMF_FEAT_DEF(PNO) \
  25933. - BRCMF_FEAT_DEF(WOWL) \
  25934. -- BRCMF_FEAT_DEF(P2P)
  25935. -+ BRCMF_FEAT_DEF(P2P) \
  25936. -+ BRCMF_FEAT_DEF(RSDB)
  25937. -+
  25938. - /*
  25939. - * Quirks:
  25940. - *
  25941. 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
  25942. deleted file mode 100644
  25943. index d1e7264..0000000
  25944. --- a/package/kernel/mac80211/patches/374-0007-brcmfmac-Use-consistent-naming-for-bsscfgidx.patch
  25945. +++ /dev/null
  25946. @@ -1,533 +0,0 @@
  25947. -From: Hante Meuleman <meuleman@broadcom.com>
  25948. -Date: Thu, 29 Oct 2015 20:33:17 +0100
  25949. -Subject: [PATCH] brcmfmac: Use consistent naming for bsscfgidx.
  25950. -
  25951. -The variable bsscfgidx is used in different places with different
  25952. -names, e.g. bsscfg, bssidx, bsscfg_idx. This patch cleans this up
  25953. -by using bsscfgidx everywhere.
  25954. -
  25955. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  25956. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  25957. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  25958. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  25959. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  25960. ----
  25961. -
  25962. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  25963. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  25964. -@@ -775,7 +775,8 @@ brcmf_cfg80211_change_iface(struct wiphy
  25965. - s32 ap = 0;
  25966. - s32 err = 0;
  25967. -
  25968. -- brcmf_dbg(TRACE, "Enter, idx=%d, type=%d\n", ifp->bssidx, type);
  25969. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, type=%d\n", ifp->bsscfgidx,
  25970. -+ type);
  25971. -
  25972. - /* WAR: There are a number of p2p interface related problems which
  25973. - * need to be handled initially (before doing the validate).
  25974. -@@ -2920,7 +2921,7 @@ brcmf_cfg80211_escan_handler(struct brcm
  25975. - status = e->status;
  25976. -
  25977. - if (!test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) {
  25978. -- brcmf_err("scan not ready, bssidx=%d\n", ifp->bssidx);
  25979. -+ brcmf_err("scan not ready, bsscfgidx=%d\n", ifp->bsscfgidx);
  25980. - return -EPERM;
  25981. - }
  25982. -
  25983. -@@ -3876,7 +3877,8 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
  25984. - ifp = vif->ifp;
  25985. - saved_ie = &vif->saved_ie;
  25986. -
  25987. -- brcmf_dbg(TRACE, "bssidx %d, pktflag : 0x%02X\n", ifp->bssidx, pktflag);
  25988. -+ brcmf_dbg(TRACE, "bsscfgidx %d, pktflag : 0x%02X\n", ifp->bsscfgidx,
  25989. -+ pktflag);
  25990. - iovar_ie_buf = kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL);
  25991. - if (!iovar_ie_buf)
  25992. - return -ENOMEM;
  25993. -@@ -4240,7 +4242,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  25994. - brcmf_err("setting ssid failed %d\n", err);
  25995. - goto exit;
  25996. - }
  25997. -- bss_enable.bsscfg_idx = cpu_to_le32(ifp->bssidx);
  25998. -+ bss_enable.bsscfgidx = cpu_to_le32(ifp->bsscfgidx);
  25999. - bss_enable.enable = cpu_to_le32(1);
  26000. - err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
  26001. - sizeof(bss_enable));
  26002. -@@ -4307,7 +4309,7 @@ static int brcmf_cfg80211_stop_ap(struct
  26003. - if (err < 0)
  26004. - brcmf_err("BRCMF_C_UP error %d\n", err);
  26005. - } else {
  26006. -- bss_enable.bsscfg_idx = cpu_to_le32(ifp->bssidx);
  26007. -+ bss_enable.bsscfgidx = cpu_to_le32(ifp->bsscfgidx);
  26008. - bss_enable.enable = cpu_to_le32(0);
  26009. - err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
  26010. - sizeof(bss_enable));
  26011. -@@ -5093,9 +5095,9 @@ static s32 brcmf_notify_vif_event(struct
  26012. - struct brcmf_cfg80211_vif_event *event = &cfg->vif_event;
  26013. - struct brcmf_cfg80211_vif *vif;
  26014. -
  26015. -- brcmf_dbg(TRACE, "Enter: action %u flags %u ifidx %u bsscfg %u\n",
  26016. -+ brcmf_dbg(TRACE, "Enter: action %u flags %u ifidx %u bsscfgidx %u\n",
  26017. - ifevent->action, ifevent->flags, ifevent->ifidx,
  26018. -- ifevent->bssidx);
  26019. -+ ifevent->bsscfgidx);
  26020. -
  26021. - mutex_lock(&event->vif_event_lock);
  26022. - event->action = ifevent->action;
  26023. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  26024. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  26025. -@@ -80,7 +80,7 @@ char *brcmf_ifname(struct brcmf_if *ifp)
  26026. - struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx)
  26027. - {
  26028. - struct brcmf_if *ifp;
  26029. -- s32 bssidx;
  26030. -+ s32 bsscfgidx;
  26031. -
  26032. - if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  26033. - brcmf_err("ifidx %d out of range\n", ifidx);
  26034. -@@ -88,9 +88,9 @@ struct brcmf_if *brcmf_get_ifp(struct br
  26035. - }
  26036. -
  26037. - ifp = NULL;
  26038. -- bssidx = drvr->if2bss[ifidx];
  26039. -- if (bssidx >= 0)
  26040. -- ifp = drvr->iflist[bssidx];
  26041. -+ bsscfgidx = drvr->if2bss[ifidx];
  26042. -+ if (bsscfgidx >= 0)
  26043. -+ ifp = drvr->iflist[bsscfgidx];
  26044. -
  26045. - return ifp;
  26046. - }
  26047. -@@ -108,7 +108,7 @@ static void _brcmf_set_multicast_list(st
  26048. -
  26049. - ifp = container_of(work, struct brcmf_if, multicast_work);
  26050. -
  26051. -- brcmf_dbg(TRACE, "Enter, idx=%d\n", ifp->bssidx);
  26052. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
  26053. -
  26054. - ndev = ifp->ndev;
  26055. -
  26056. -@@ -168,7 +168,7 @@ _brcmf_set_mac_address(struct work_struc
  26057. -
  26058. - ifp = container_of(work, struct brcmf_if, setmacaddr_work);
  26059. -
  26060. -- brcmf_dbg(TRACE, "Enter, idx=%d\n", ifp->bssidx);
  26061. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
  26062. -
  26063. - err = brcmf_fil_iovar_data_set(ifp, "cur_etheraddr", ifp->mac_addr,
  26064. - ETH_ALEN);
  26065. -@@ -206,7 +206,7 @@ static netdev_tx_t brcmf_netdev_start_xm
  26066. - struct brcmf_pub *drvr = ifp->drvr;
  26067. - struct ethhdr *eh = (struct ethhdr *)(skb->data);
  26068. -
  26069. -- brcmf_dbg(DATA, "Enter, idx=%d\n", ifp->bssidx);
  26070. -+ brcmf_dbg(DATA, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
  26071. -
  26072. - /* Can the device send data? */
  26073. - if (drvr->bus_if->state != BRCMF_BUS_UP) {
  26074. -@@ -267,8 +267,8 @@ void brcmf_txflowblock_if(struct brcmf_i
  26075. - if (!ifp || !ifp->ndev)
  26076. - return;
  26077. -
  26078. -- brcmf_dbg(TRACE, "enter: idx=%d stop=0x%X reason=%d state=%d\n",
  26079. -- ifp->bssidx, ifp->netif_stop, reason, state);
  26080. -+ brcmf_dbg(TRACE, "enter: bsscfgidx=%d stop=0x%X reason=%d state=%d\n",
  26081. -+ ifp->bsscfgidx, ifp->netif_stop, reason, state);
  26082. -
  26083. - spin_lock_irqsave(&ifp->netif_stop_lock, flags);
  26084. - if (state) {
  26085. -@@ -587,7 +587,7 @@ static struct net_device_stats *brcmf_ne
  26086. - {
  26087. - struct brcmf_if *ifp = netdev_priv(ndev);
  26088. -
  26089. -- brcmf_dbg(TRACE, "Enter, idx=%d\n", ifp->bssidx);
  26090. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
  26091. -
  26092. - return &ifp->stats;
  26093. - }
  26094. -@@ -616,7 +616,7 @@ static int brcmf_netdev_stop(struct net_
  26095. - {
  26096. - struct brcmf_if *ifp = netdev_priv(ndev);
  26097. -
  26098. -- brcmf_dbg(TRACE, "Enter, idx=%d\n", ifp->bssidx);
  26099. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
  26100. -
  26101. - brcmf_cfg80211_down(ndev);
  26102. -
  26103. -@@ -632,7 +632,7 @@ static int brcmf_netdev_open(struct net_
  26104. - struct brcmf_bus *bus_if = drvr->bus_if;
  26105. - u32 toe_ol;
  26106. -
  26107. -- brcmf_dbg(TRACE, "Enter, idx=%d\n", ifp->bssidx);
  26108. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
  26109. -
  26110. - /* If bus is not ready, can't continue */
  26111. - if (bus_if->state != BRCMF_BUS_UP) {
  26112. -@@ -674,7 +674,7 @@ int brcmf_net_attach(struct brcmf_if *if
  26113. - struct net_device *ndev;
  26114. - s32 err;
  26115. -
  26116. -- brcmf_dbg(TRACE, "Enter, idx=%d mac=%pM\n", ifp->bssidx,
  26117. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d mac=%pM\n", ifp->bsscfgidx,
  26118. - ifp->mac_addr);
  26119. - ndev = ifp->ndev;
  26120. -
  26121. -@@ -706,7 +706,7 @@ int brcmf_net_attach(struct brcmf_if *if
  26122. - return 0;
  26123. -
  26124. - fail:
  26125. -- drvr->iflist[ifp->bssidx] = NULL;
  26126. -+ drvr->iflist[ifp->bsscfgidx] = NULL;
  26127. - ndev->netdev_ops = NULL;
  26128. - free_netdev(ndev);
  26129. - return -EBADE;
  26130. -@@ -724,7 +724,8 @@ void brcmf_net_setcarrier(struct brcmf_i
  26131. - {
  26132. - struct net_device *ndev;
  26133. -
  26134. -- brcmf_dbg(TRACE, "Enter, idx=%d carrier=%d\n", ifp->bssidx, on);
  26135. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d carrier=%d\n", ifp->bsscfgidx,
  26136. -+ on);
  26137. -
  26138. - ndev = ifp->ndev;
  26139. - brcmf_txflowblock_if(ifp, BRCMF_NETIF_STOP_REASON_DISCONNECTED, !on);
  26140. -@@ -771,7 +772,7 @@ static int brcmf_net_p2p_attach(struct b
  26141. - {
  26142. - struct net_device *ndev;
  26143. -
  26144. -- brcmf_dbg(TRACE, "Enter, idx=%d mac=%pM\n", ifp->bssidx,
  26145. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d mac=%pM\n", ifp->bsscfgidx,
  26146. - ifp->mac_addr);
  26147. - ndev = ifp->ndev;
  26148. -
  26149. -@@ -790,21 +791,21 @@ static int brcmf_net_p2p_attach(struct b
  26150. - return 0;
  26151. -
  26152. - fail:
  26153. -- ifp->drvr->iflist[ifp->bssidx] = NULL;
  26154. -+ ifp->drvr->iflist[ifp->bsscfgidx] = NULL;
  26155. - ndev->netdev_ops = NULL;
  26156. - free_netdev(ndev);
  26157. - return -EBADE;
  26158. - }
  26159. -
  26160. --struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  26161. -+struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  26162. - bool is_p2pdev, char *name, u8 *mac_addr)
  26163. - {
  26164. - struct brcmf_if *ifp;
  26165. - struct net_device *ndev;
  26166. -
  26167. -- brcmf_dbg(TRACE, "Enter, idx=%d, ifidx=%d\n", bssidx, ifidx);
  26168. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", bsscfgidx, ifidx);
  26169. -
  26170. -- ifp = drvr->iflist[bssidx];
  26171. -+ ifp = drvr->iflist[bsscfgidx];
  26172. - /*
  26173. - * Delete the existing interface before overwriting it
  26174. - * in case we missed the BRCMF_E_IF_DEL event.
  26175. -@@ -815,7 +816,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  26176. - if (ifidx) {
  26177. - netif_stop_queue(ifp->ndev);
  26178. - brcmf_net_detach(ifp->ndev);
  26179. -- drvr->iflist[bssidx] = NULL;
  26180. -+ drvr->iflist[bsscfgidx] = NULL;
  26181. - } else {
  26182. - brcmf_err("ignore IF event\n");
  26183. - return ERR_PTR(-EINVAL);
  26184. -@@ -839,15 +840,15 @@ struct brcmf_if *brcmf_add_if(struct brc
  26185. - ndev->destructor = brcmf_cfg80211_free_netdev;
  26186. - ifp = netdev_priv(ndev);
  26187. - ifp->ndev = ndev;
  26188. -- /* store mapping ifidx to bssidx */
  26189. -+ /* store mapping ifidx to bsscfgidx */
  26190. - if (drvr->if2bss[ifidx] == BRCMF_BSSIDX_INVALID)
  26191. -- drvr->if2bss[ifidx] = bssidx;
  26192. -+ drvr->if2bss[ifidx] = bsscfgidx;
  26193. - }
  26194. -
  26195. - ifp->drvr = drvr;
  26196. -- drvr->iflist[bssidx] = ifp;
  26197. -+ drvr->iflist[bsscfgidx] = ifp;
  26198. - ifp->ifidx = ifidx;
  26199. -- ifp->bssidx = bssidx;
  26200. -+ ifp->bsscfgidx = bsscfgidx;
  26201. -
  26202. - init_waitqueue_head(&ifp->pend_8021x_wait);
  26203. - spin_lock_init(&ifp->netif_stop_lock);
  26204. -@@ -861,21 +862,22 @@ struct brcmf_if *brcmf_add_if(struct brc
  26205. - return ifp;
  26206. - }
  26207. -
  26208. --static void brcmf_del_if(struct brcmf_pub *drvr, s32 bssidx)
  26209. -+static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx)
  26210. - {
  26211. - struct brcmf_if *ifp;
  26212. -
  26213. -- ifp = drvr->iflist[bssidx];
  26214. -- drvr->iflist[bssidx] = NULL;
  26215. -+ ifp = drvr->iflist[bsscfgidx];
  26216. -+ drvr->iflist[bsscfgidx] = NULL;
  26217. - if (!ifp) {
  26218. -- brcmf_err("Null interface, idx=%d\n", bssidx);
  26219. -+ brcmf_err("Null interface, bsscfgidx=%d\n", bsscfgidx);
  26220. - return;
  26221. - }
  26222. -- brcmf_dbg(TRACE, "Enter, idx=%d, ifidx=%d\n", bssidx, ifp->ifidx);
  26223. -- if (drvr->if2bss[ifp->ifidx] == bssidx)
  26224. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", bsscfgidx,
  26225. -+ ifp->ifidx);
  26226. -+ if (drvr->if2bss[ifp->ifidx] == bsscfgidx)
  26227. - drvr->if2bss[ifp->ifidx] = BRCMF_BSSIDX_INVALID;
  26228. - if (ifp->ndev) {
  26229. -- if (bssidx == 0) {
  26230. -+ if (bsscfgidx == 0) {
  26231. - if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) {
  26232. - rtnl_lock();
  26233. - brcmf_netdev_stop(ifp->ndev);
  26234. -@@ -905,12 +907,12 @@ static void brcmf_del_if(struct brcmf_pu
  26235. -
  26236. - void brcmf_remove_interface(struct brcmf_if *ifp)
  26237. - {
  26238. -- if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bssidx] != ifp))
  26239. -+ if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bsscfgidx] != ifp))
  26240. - return;
  26241. -- brcmf_dbg(TRACE, "Enter, bssidx=%d, ifidx=%d\n", ifp->bssidx,
  26242. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", ifp->bsscfgidx,
  26243. - ifp->ifidx);
  26244. - brcmf_fws_del_interface(ifp);
  26245. -- brcmf_del_if(ifp->drvr, ifp->bssidx);
  26246. -+ brcmf_del_if(ifp->drvr, ifp->bsscfgidx);
  26247. - }
  26248. -
  26249. - int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr)
  26250. -@@ -925,10 +927,10 @@ int brcmf_get_next_free_bsscfgidx(struct
  26251. - highest = 2;
  26252. - for (ifidx = 0; ifidx < BRCMF_MAX_IFS; ifidx++) {
  26253. - if (drvr->iflist[ifidx]) {
  26254. -- if (drvr->iflist[ifidx]->bssidx == bsscfgidx)
  26255. -+ if (drvr->iflist[ifidx]->bsscfgidx == bsscfgidx)
  26256. - bsscfgidx = highest + 1;
  26257. -- else if (drvr->iflist[ifidx]->bssidx > highest)
  26258. -- highest = drvr->iflist[ifidx]->bssidx;
  26259. -+ else if (drvr->iflist[ifidx]->bsscfgidx > highest)
  26260. -+ highest = drvr->iflist[ifidx]->bsscfgidx;
  26261. - } else {
  26262. - available = true;
  26263. - }
  26264. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  26265. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  26266. -@@ -174,7 +174,7 @@ enum brcmf_netif_stop_reason {
  26267. - * @multicast_work: worker object for multicast provisioning.
  26268. - * @fws_desc: interface specific firmware-signalling descriptor.
  26269. - * @ifidx: interface index in device firmware.
  26270. -- * @bssidx: index of bss associated with this interface.
  26271. -+ * @bsscfgidx: index of bss associated with this interface.
  26272. - * @mac_addr: assigned mac address.
  26273. - * @netif_stop: bitmap indicates reason why netif queues are stopped.
  26274. - * @netif_stop_lock: spinlock for update netif_stop from multiple sources.
  26275. -@@ -190,7 +190,7 @@ struct brcmf_if {
  26276. - struct work_struct multicast_work;
  26277. - struct brcmf_fws_mac_descriptor *fws_desc;
  26278. - int ifidx;
  26279. -- s32 bssidx;
  26280. -+ s32 bsscfgidx;
  26281. - u8 mac_addr[ETH_ALEN];
  26282. - u8 netif_stop;
  26283. - spinlock_t netif_stop_lock;
  26284. -@@ -208,7 +208,7 @@ int brcmf_netdev_wait_pend8021x(struct b
  26285. - char *brcmf_ifname(struct brcmf_if *ifp);
  26286. - struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  26287. - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  26288. --struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  26289. -+struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  26290. - bool is_p2pdev, char *name, u8 *mac_addr);
  26291. - void brcmf_remove_interface(struct brcmf_if *ifp);
  26292. - int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  26293. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  26294. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  26295. -@@ -49,7 +49,7 @@ static int brcmf_debug_psm_watchdog_noti
  26296. - const struct brcmf_event_msg *evtmsg,
  26297. - void *data)
  26298. - {
  26299. -- brcmf_dbg(TRACE, "enter: idx=%d\n", ifp->bssidx);
  26300. -+ brcmf_dbg(TRACE, "enter: bsscfgidx=%d\n", ifp->bsscfgidx);
  26301. -
  26302. - return brcmf_debug_create_memdump(ifp->drvr->bus_if, data,
  26303. - evtmsg->datalen);
  26304. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  26305. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  26306. -@@ -182,8 +182,8 @@ static void brcmf_fweh_handle_if_event(s
  26307. - bool is_p2pdev;
  26308. - int err = 0;
  26309. -
  26310. -- brcmf_dbg(EVENT, "action: %u idx: %u bsscfg: %u flags: %u role: %u\n",
  26311. -- ifevent->action, ifevent->ifidx, ifevent->bssidx,
  26312. -+ brcmf_dbg(EVENT, "action: %u ifidx: %u bsscfgidx: %u flags: %u role: %u\n",
  26313. -+ ifevent->action, ifevent->ifidx, ifevent->bsscfgidx,
  26314. - ifevent->flags, ifevent->role);
  26315. -
  26316. - /* The P2P Device interface event must not be ignored contrary to what
  26317. -@@ -204,12 +204,12 @@ static void brcmf_fweh_handle_if_event(s
  26318. - return;
  26319. - }
  26320. -
  26321. -- ifp = drvr->iflist[ifevent->bssidx];
  26322. -+ ifp = drvr->iflist[ifevent->bsscfgidx];
  26323. -
  26324. - if (ifevent->action == BRCMF_E_IF_ADD) {
  26325. - brcmf_dbg(EVENT, "adding %s (%pM)\n", emsg->ifname,
  26326. - emsg->addr);
  26327. -- ifp = brcmf_add_if(drvr, ifevent->bssidx, ifevent->ifidx,
  26328. -+ ifp = brcmf_add_if(drvr, ifevent->bsscfgidx, ifevent->ifidx,
  26329. - is_p2pdev, emsg->ifname, emsg->addr);
  26330. - if (IS_ERR(ifp))
  26331. - return;
  26332. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  26333. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  26334. -@@ -219,7 +219,7 @@ struct brcmf_if_event {
  26335. - u8 ifidx;
  26336. - u8 action;
  26337. - u8 flags;
  26338. -- u8 bssidx;
  26339. -+ u8 bsscfgidx;
  26340. - u8 role;
  26341. - };
  26342. -
  26343. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwil.c
  26344. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil.c
  26345. -@@ -293,22 +293,22 @@ brcmf_fil_iovar_int_get(struct brcmf_if
  26346. - }
  26347. -
  26348. - static u32
  26349. --brcmf_create_bsscfg(s32 bssidx, char *name, char *data, u32 datalen, char *buf,
  26350. -- u32 buflen)
  26351. -+brcmf_create_bsscfg(s32 bsscfgidx, char *name, char *data, u32 datalen,
  26352. -+ char *buf, u32 buflen)
  26353. - {
  26354. - const s8 *prefix = "bsscfg:";
  26355. - s8 *p;
  26356. - u32 prefixlen;
  26357. - u32 namelen;
  26358. - u32 iolen;
  26359. -- __le32 bssidx_le;
  26360. -+ __le32 bsscfgidx_le;
  26361. -
  26362. -- if (bssidx == 0)
  26363. -+ if (bsscfgidx == 0)
  26364. - return brcmf_create_iovar(name, data, datalen, buf, buflen);
  26365. -
  26366. - prefixlen = strlen(prefix);
  26367. - namelen = strlen(name) + 1; /* lengh of iovar name + null */
  26368. -- iolen = prefixlen + namelen + sizeof(bssidx_le) + datalen;
  26369. -+ iolen = prefixlen + namelen + sizeof(bsscfgidx_le) + datalen;
  26370. -
  26371. - if (buflen < iolen) {
  26372. - brcmf_err("buffer is too short\n");
  26373. -@@ -326,9 +326,9 @@ brcmf_create_bsscfg(s32 bssidx, char *na
  26374. - p += namelen;
  26375. -
  26376. - /* bss config index as first data */
  26377. -- bssidx_le = cpu_to_le32(bssidx);
  26378. -- memcpy(p, &bssidx_le, sizeof(bssidx_le));
  26379. -- p += sizeof(bssidx_le);
  26380. -+ bsscfgidx_le = cpu_to_le32(bsscfgidx);
  26381. -+ memcpy(p, &bsscfgidx_le, sizeof(bsscfgidx_le));
  26382. -+ p += sizeof(bsscfgidx_le);
  26383. -
  26384. - /* parameter buffer follows */
  26385. - if (datalen)
  26386. -@@ -347,12 +347,12 @@ brcmf_fil_bsscfg_data_set(struct brcmf_i
  26387. -
  26388. - mutex_lock(&drvr->proto_block);
  26389. -
  26390. -- brcmf_dbg(FIL, "ifidx=%d, bssidx=%d, name=%s, len=%d\n", ifp->ifidx,
  26391. -- ifp->bssidx, name, len);
  26392. -+ brcmf_dbg(FIL, "ifidx=%d, bsscfgidx=%d, name=%s, len=%d\n", ifp->ifidx,
  26393. -+ ifp->bsscfgidx, name, len);
  26394. - brcmf_dbg_hex_dump(BRCMF_FIL_ON(), data,
  26395. - min_t(uint, len, MAX_HEX_DUMP_LEN), "data\n");
  26396. -
  26397. -- buflen = brcmf_create_bsscfg(ifp->bssidx, name, data, len,
  26398. -+ buflen = brcmf_create_bsscfg(ifp->bsscfgidx, name, data, len,
  26399. - drvr->proto_buf, sizeof(drvr->proto_buf));
  26400. - if (buflen) {
  26401. - err = brcmf_fil_cmd_data(ifp, BRCMF_C_SET_VAR, drvr->proto_buf,
  26402. -@@ -376,7 +376,7 @@ brcmf_fil_bsscfg_data_get(struct brcmf_i
  26403. -
  26404. - mutex_lock(&drvr->proto_block);
  26405. -
  26406. -- buflen = brcmf_create_bsscfg(ifp->bssidx, name, data, len,
  26407. -+ buflen = brcmf_create_bsscfg(ifp->bsscfgidx, name, data, len,
  26408. - drvr->proto_buf, sizeof(drvr->proto_buf));
  26409. - if (buflen) {
  26410. - err = brcmf_fil_cmd_data(ifp, BRCMF_C_GET_VAR, drvr->proto_buf,
  26411. -@@ -387,8 +387,8 @@ brcmf_fil_bsscfg_data_get(struct brcmf_i
  26412. - err = -EPERM;
  26413. - brcmf_err("Creating bsscfg failed\n");
  26414. - }
  26415. -- brcmf_dbg(FIL, "ifidx=%d, bssidx=%d, name=%s, len=%d\n", ifp->ifidx,
  26416. -- ifp->bssidx, name, len);
  26417. -+ brcmf_dbg(FIL, "ifidx=%d, bsscfgidx=%d, name=%s, len=%d\n", ifp->ifidx,
  26418. -+ ifp->bsscfgidx, name, len);
  26419. - brcmf_dbg_hex_dump(BRCMF_FIL_ON(), data,
  26420. - min_t(uint, len, MAX_HEX_DUMP_LEN), "data\n");
  26421. -
  26422. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  26423. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  26424. -@@ -170,7 +170,7 @@ struct brcmf_fil_af_params_le {
  26425. - };
  26426. -
  26427. - struct brcmf_fil_bss_enable_le {
  26428. -- __le32 bsscfg_idx;
  26429. -+ __le32 bsscfgidx;
  26430. - __le32 enable;
  26431. - };
  26432. -
  26433. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  26434. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  26435. -@@ -719,7 +719,7 @@ static void brcmf_fws_macdesc_init(struc
  26436. - desc->state = BRCMF_FWS_STATE_OPEN;
  26437. - desc->requested_credit = 0;
  26438. - desc->requested_packet = 0;
  26439. -- /* depending on use may need ifp->bssidx instead */
  26440. -+ /* depending on use may need ifp->bsscfgidx instead */
  26441. - desc->interface_id = ifidx;
  26442. - desc->ac_bitmap = 0xff; /* update this when handling APSD */
  26443. - if (addr)
  26444. -@@ -1938,7 +1938,7 @@ void brcmf_fws_reset_interface(struct br
  26445. - {
  26446. - struct brcmf_fws_mac_descriptor *entry = ifp->fws_desc;
  26447. -
  26448. -- brcmf_dbg(TRACE, "enter: idx=%d\n", ifp->bssidx);
  26449. -+ brcmf_dbg(TRACE, "enter: bsscfgidx=%d\n", ifp->bsscfgidx);
  26450. - if (!entry)
  26451. - return;
  26452. -
  26453. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  26454. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  26455. -@@ -2067,7 +2067,7 @@ static struct wireless_dev *brcmf_p2p_cr
  26456. - struct brcmf_if *p2p_ifp;
  26457. - struct brcmf_if *pri_ifp;
  26458. - int err;
  26459. -- u32 bssidx;
  26460. -+ u32 bsscfgidx;
  26461. -
  26462. - if (p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif)
  26463. - return ERR_PTR(-ENOSPC);
  26464. -@@ -2113,13 +2113,13 @@ static struct wireless_dev *brcmf_p2p_cr
  26465. - memcpy(&p2p_vif->wdev.address, p2p->dev_addr, sizeof(p2p->dev_addr));
  26466. -
  26467. - /* verify bsscfg index for P2P discovery */
  26468. -- err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bssidx);
  26469. -+ err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bsscfgidx);
  26470. - if (err < 0) {
  26471. - brcmf_err("retrieving discover bsscfg index failed\n");
  26472. - goto fail;
  26473. - }
  26474. -
  26475. -- WARN_ON(p2p_ifp->bssidx != bssidx);
  26476. -+ WARN_ON(p2p_ifp->bsscfgidx != bsscfgidx);
  26477. -
  26478. - init_completion(&p2p->send_af_done);
  26479. - INIT_WORK(&p2p->afx_hdl.afx_work, brcmf_p2p_afx_handler);
  26480. 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
  26481. deleted file mode 100644
  26482. index fb2b85e..0000000
  26483. --- a/package/kernel/mac80211/patches/374-0008-brcmfmac-Use-new-methods-for-pcie-Power-Management.patch
  26484. +++ /dev/null
  26485. @@ -1,163 +0,0 @@
  26486. -From: Hante Meuleman <meuleman@broadcom.com>
  26487. -Date: Thu, 29 Oct 2015 20:33:18 +0100
  26488. -Subject: [PATCH] brcmfmac: Use new methods for pcie Power Management.
  26489. -
  26490. -Currently the legacy methods suspend and resume are used for pcie
  26491. -devices. This is not the preferable method and is also causing
  26492. -issues with some setups when doing hibernate. Changing this to
  26493. -use the new PM methods.
  26494. -
  26495. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  26496. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  26497. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  26498. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  26499. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  26500. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  26501. ----
  26502. -
  26503. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  26504. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  26505. -@@ -1388,10 +1388,6 @@ static void brcmf_pcie_wowl_config(struc
  26506. -
  26507. - brcmf_dbg(PCIE, "Configuring WOWL, enabled=%d\n", enabled);
  26508. - devinfo->wowl_enabled = enabled;
  26509. -- if (enabled)
  26510. -- device_set_wakeup_enable(&devinfo->pdev->dev, true);
  26511. -- else
  26512. -- device_set_wakeup_enable(&devinfo->pdev->dev, false);
  26513. - }
  26514. -
  26515. -
  26516. -@@ -1961,15 +1957,14 @@ brcmf_pcie_remove(struct pci_dev *pdev)
  26517. - #ifdef CONFIG_PM
  26518. -
  26519. -
  26520. --static int brcmf_pcie_suspend(struct pci_dev *pdev, pm_message_t state)
  26521. -+static int brcmf_pcie_pm_enter_D3(struct device *dev)
  26522. - {
  26523. - struct brcmf_pciedev_info *devinfo;
  26524. - struct brcmf_bus *bus;
  26525. -- int err;
  26526. -
  26527. -- brcmf_dbg(PCIE, "Enter, state=%d, pdev=%p\n", state.event, pdev);
  26528. -+ brcmf_err("Enter\n");
  26529. -
  26530. -- bus = dev_get_drvdata(&pdev->dev);
  26531. -+ bus = dev_get_drvdata(dev);
  26532. - devinfo = bus->bus_priv.pcie->devinfo;
  26533. -
  26534. - brcmf_bus_change_state(bus, BRCMF_BUS_DOWN);
  26535. -@@ -1984,62 +1979,45 @@ static int brcmf_pcie_suspend(struct pci
  26536. - brcmf_err("Timeout on response for entering D3 substate\n");
  26537. - return -EIO;
  26538. - }
  26539. -- brcmf_pcie_send_mb_data(devinfo, BRCMF_H2D_HOST_D0_INFORM_IN_USE);
  26540. -
  26541. -- err = pci_save_state(pdev);
  26542. -- if (err)
  26543. -- brcmf_err("pci_save_state failed, err=%d\n", err);
  26544. -- if ((err) || (!devinfo->wowl_enabled)) {
  26545. -- brcmf_chip_detach(devinfo->ci);
  26546. -- devinfo->ci = NULL;
  26547. -- brcmf_pcie_remove(pdev);
  26548. -- return 0;
  26549. -- }
  26550. -+ devinfo->state = BRCMFMAC_PCIE_STATE_DOWN;
  26551. -
  26552. -- return pci_prepare_to_sleep(pdev);
  26553. -+ return 0;
  26554. - }
  26555. -
  26556. --static int brcmf_pcie_resume(struct pci_dev *pdev)
  26557. -+
  26558. -+static int brcmf_pcie_pm_leave_D3(struct device *dev)
  26559. - {
  26560. - struct brcmf_pciedev_info *devinfo;
  26561. - struct brcmf_bus *bus;
  26562. -+ struct pci_dev *pdev;
  26563. - int err;
  26564. -
  26565. -- bus = dev_get_drvdata(&pdev->dev);
  26566. -- brcmf_dbg(PCIE, "Enter, pdev=%p, bus=%p\n", pdev, bus);
  26567. -+ brcmf_err("Enter\n");
  26568. -
  26569. -- err = pci_set_power_state(pdev, PCI_D0);
  26570. -- if (err) {
  26571. -- brcmf_err("pci_set_power_state failed, err=%d\n", err);
  26572. -- goto cleanup;
  26573. -- }
  26574. -- pci_restore_state(pdev);
  26575. -- pci_enable_wake(pdev, PCI_D3hot, false);
  26576. -- pci_enable_wake(pdev, PCI_D3cold, false);
  26577. -+ bus = dev_get_drvdata(dev);
  26578. -+ devinfo = bus->bus_priv.pcie->devinfo;
  26579. -+ brcmf_dbg(PCIE, "Enter, dev=%p, bus=%p\n", dev, bus);
  26580. -
  26581. - /* Check if device is still up and running, if so we are ready */
  26582. -- if (bus) {
  26583. -- devinfo = bus->bus_priv.pcie->devinfo;
  26584. -- if (brcmf_pcie_read_reg32(devinfo,
  26585. -- BRCMF_PCIE_PCIE2REG_INTMASK) != 0) {
  26586. -- if (brcmf_pcie_send_mb_data(devinfo,
  26587. -- BRCMF_H2D_HOST_D0_INFORM))
  26588. -- goto cleanup;
  26589. -- brcmf_dbg(PCIE, "Hot resume, continue....\n");
  26590. -- brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  26591. -- brcmf_bus_change_state(bus, BRCMF_BUS_UP);
  26592. -- brcmf_pcie_intr_enable(devinfo);
  26593. -- return 0;
  26594. -- }
  26595. -+ if (brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_INTMASK) != 0) {
  26596. -+ brcmf_dbg(PCIE, "Try to wakeup device....\n");
  26597. -+ if (brcmf_pcie_send_mb_data(devinfo, BRCMF_H2D_HOST_D0_INFORM))
  26598. -+ goto cleanup;
  26599. -+ brcmf_dbg(PCIE, "Hot resume, continue....\n");
  26600. -+ devinfo->state = BRCMFMAC_PCIE_STATE_UP;
  26601. -+ brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  26602. -+ brcmf_bus_change_state(bus, BRCMF_BUS_UP);
  26603. -+ brcmf_pcie_intr_enable(devinfo);
  26604. -+ return 0;
  26605. - }
  26606. -
  26607. - cleanup:
  26608. -- if (bus) {
  26609. -- devinfo = bus->bus_priv.pcie->devinfo;
  26610. -- brcmf_chip_detach(devinfo->ci);
  26611. -- devinfo->ci = NULL;
  26612. -- brcmf_pcie_remove(pdev);
  26613. -- }
  26614. -+ brcmf_chip_detach(devinfo->ci);
  26615. -+ devinfo->ci = NULL;
  26616. -+ pdev = devinfo->pdev;
  26617. -+ brcmf_pcie_remove(pdev);
  26618. -+
  26619. - err = brcmf_pcie_probe(pdev, NULL);
  26620. - if (err)
  26621. - brcmf_err("probe after resume failed, err=%d\n", err);
  26622. -@@ -2048,6 +2026,14 @@ cleanup:
  26623. - }
  26624. -
  26625. -
  26626. -+static const struct dev_pm_ops brcmf_pciedrvr_pm = {
  26627. -+ .suspend = brcmf_pcie_pm_enter_D3,
  26628. -+ .resume = brcmf_pcie_pm_leave_D3,
  26629. -+ .freeze = brcmf_pcie_pm_enter_D3,
  26630. -+ .restore = brcmf_pcie_pm_leave_D3,
  26631. -+};
  26632. -+
  26633. -+
  26634. - #endif /* CONFIG_PM */
  26635. -
  26636. -
  26637. -@@ -2086,9 +2072,8 @@ static struct pci_driver brcmf_pciedrvr
  26638. - .probe = brcmf_pcie_probe,
  26639. - .remove = brcmf_pcie_remove,
  26640. - #ifdef CONFIG_PM
  26641. -- .suspend = brcmf_pcie_suspend,
  26642. -- .resume = brcmf_pcie_resume
  26643. --#endif /* CONFIG_PM */
  26644. -+ .driver.pm = &brcmf_pciedrvr_pm,
  26645. -+#endif
  26646. - };
  26647. -
  26648. -
  26649. 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
  26650. deleted file mode 100644
  26651. index 4324cc7..0000000
  26652. --- a/package/kernel/mac80211/patches/374-0009-brcmfmac-Add-wowl-wake-indication-report.patch
  26653. +++ /dev/null
  26654. @@ -1,129 +0,0 @@
  26655. -From: Hante Meuleman <meuleman@broadcom.com>
  26656. -Date: Thu, 29 Oct 2015 20:33:19 +0100
  26657. -Subject: [PATCH] brcmfmac: Add wowl wake indication report.
  26658. -
  26659. -On wakeup of the system (resume) a wowl wakeup indication report
  26660. -can be sent to cfg80211. This patch adds support for this. The
  26661. -report specifies if the device was responsible for the wakeup
  26662. -and if so, will specify the exact reason.
  26663. -
  26664. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  26665. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  26666. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  26667. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  26668. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  26669. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  26670. ----
  26671. -
  26672. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  26673. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  26674. -@@ -3061,6 +3061,67 @@ static s32 brcmf_config_wowl_pattern(str
  26675. - return ret;
  26676. - }
  26677. -
  26678. -+#ifdef CPTCFG_PM
  26679. -+
  26680. -+static void brcmf_report_wowl_wakeind(struct wiphy *wiphy, struct brcmf_if *ifp)
  26681. -+{
  26682. -+ struct brcmf_wowl_wakeind_le wake_ind_le;
  26683. -+ struct cfg80211_wowlan_wakeup wakeup_data;
  26684. -+ struct cfg80211_wowlan_wakeup *wakeup;
  26685. -+ u32 wakeind;
  26686. -+ s32 err;
  26687. -+
  26688. -+ err = brcmf_fil_iovar_data_get(ifp, "wowl_wakeind", &wake_ind_le,
  26689. -+ sizeof(wake_ind_le));
  26690. -+ if (!err) {
  26691. -+ brcmf_err("Get wowl_wakeind failed, err = %d\n", err);
  26692. -+ return;
  26693. -+ }
  26694. -+
  26695. -+ wakeind = le32_to_cpu(wake_ind_le.ucode_wakeind);
  26696. -+ if (wakeind & (BRCMF_WOWL_MAGIC | BRCMF_WOWL_DIS | BRCMF_WOWL_BCN |
  26697. -+ BRCMF_WOWL_RETR | BRCMF_WOWL_NET)) {
  26698. -+ wakeup = &wakeup_data;
  26699. -+ memset(&wakeup_data, 0, sizeof(wakeup_data));
  26700. -+ wakeup_data.pattern_idx = -1;
  26701. -+
  26702. -+ if (wakeind & BRCMF_WOWL_MAGIC) {
  26703. -+ brcmf_dbg(INFO, "WOWL Wake indicator: BRCMF_WOWL_MAGIC\n");
  26704. -+ wakeup_data.magic_pkt = true;
  26705. -+ }
  26706. -+ if (wakeind & BRCMF_WOWL_DIS) {
  26707. -+ brcmf_dbg(INFO, "WOWL Wake indicator: BRCMF_WOWL_DIS\n");
  26708. -+ wakeup_data.disconnect = true;
  26709. -+ }
  26710. -+ if (wakeind & BRCMF_WOWL_BCN) {
  26711. -+ brcmf_dbg(INFO, "WOWL Wake indicator: BRCMF_WOWL_BCN\n");
  26712. -+ wakeup_data.disconnect = true;
  26713. -+ }
  26714. -+ if (wakeind & BRCMF_WOWL_RETR) {
  26715. -+ brcmf_dbg(INFO, "WOWL Wake indicator: BRCMF_WOWL_RETR\n");
  26716. -+ wakeup_data.disconnect = true;
  26717. -+ }
  26718. -+ if (wakeind & BRCMF_WOWL_NET) {
  26719. -+ brcmf_dbg(INFO, "WOWL Wake indicator: BRCMF_WOWL_NET\n");
  26720. -+ /* For now always map to pattern 0, no API to get
  26721. -+ * correct information available at the moment.
  26722. -+ */
  26723. -+ wakeup_data.pattern_idx = 0;
  26724. -+ }
  26725. -+ } else {
  26726. -+ wakeup = NULL;
  26727. -+ }
  26728. -+ cfg80211_report_wowlan_wakeup(&ifp->vif->wdev, wakeup, GFP_KERNEL);
  26729. -+}
  26730. -+
  26731. -+#else
  26732. -+
  26733. -+static void brcmf_report_wowl_wakeind(struct wiphy *wiphy, struct brcmf_if *ifp)
  26734. -+{
  26735. -+}
  26736. -+
  26737. -+#endif /* CPTCFG_PM */
  26738. -+
  26739. - static s32 brcmf_cfg80211_resume(struct wiphy *wiphy)
  26740. - {
  26741. - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  26742. -@@ -3070,11 +3131,12 @@ static s32 brcmf_cfg80211_resume(struct
  26743. - brcmf_dbg(TRACE, "Enter\n");
  26744. -
  26745. - if (cfg->wowl_enabled) {
  26746. -+ brcmf_report_wowl_wakeind(wiphy, ifp);
  26747. -+ brcmf_fil_iovar_int_set(ifp, "wowl_clear", 0);
  26748. -+ brcmf_config_wowl_pattern(ifp, "clr", NULL, 0, NULL, 0);
  26749. - brcmf_configure_arp_offload(ifp, true);
  26750. - brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM,
  26751. - cfg->pre_wowl_pmmode);
  26752. -- brcmf_fil_iovar_int_set(ifp, "wowl_clear", 0);
  26753. -- brcmf_config_wowl_pattern(ifp, "clr", NULL, 0, NULL, 0);
  26754. - cfg->wowl_enabled = false;
  26755. - }
  26756. - return 0;
  26757. -@@ -3108,6 +3170,7 @@ static void brcmf_configure_wowl(struct
  26758. - wowl->patterns[i].pkt_offset);
  26759. - }
  26760. - }
  26761. -+ brcmf_fil_iovar_data_set(ifp, "wowl_wakeind", "clear", strlen("clear"));
  26762. - brcmf_fil_iovar_int_set(ifp, "wowl", wowl_config);
  26763. - brcmf_fil_iovar_int_set(ifp, "wowl_activate", 1);
  26764. - brcmf_bus_wowl_config(cfg->pub->bus_if, true);
  26765. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  26766. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  26767. -@@ -634,4 +634,16 @@ struct brcmf_assoclist_le {
  26768. - u8 mac[BRCMF_MAX_ASSOCLIST][ETH_ALEN];
  26769. - };
  26770. -
  26771. -+/**
  26772. -+ * struct brcmf_wowl_wakeind_le - Wakeup indicators
  26773. -+ * Note: note both fields contain same information.
  26774. -+ *
  26775. -+ * @pci_wakeind: Whether PCI PMECSR PMEStatus bit was set.
  26776. -+ * @ucode_wakeind: What wakeup-event indication was set by ucode
  26777. -+ */
  26778. -+struct brcmf_wowl_wakeind_le {
  26779. -+ __le32 pci_wakeind;
  26780. -+ __le32 ucode_wakeind;
  26781. -+};
  26782. -+
  26783. - #endif /* FWIL_TYPES_H_ */
  26784. 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
  26785. deleted file mode 100644
  26786. index a0cc231..0000000
  26787. --- a/package/kernel/mac80211/patches/375-brcmfmac-constify-brcmf_bus_ops-structures.patch
  26788. +++ /dev/null
  26789. @@ -1,57 +0,0 @@
  26790. -From: Julia Lawall <Julia.Lawall@lip6.fr>
  26791. -Date: Sat, 14 Nov 2015 17:22:07 +0100
  26792. -Subject: [PATCH] brcmfmac: constify brcmf_bus_ops structures
  26793. -
  26794. -The brcmf_bus_ops structures are never modified, so declare them as const.
  26795. -
  26796. -Done with the help of Coccinelle.
  26797. -
  26798. -Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
  26799. -Acked-by: Arend van Spriel <arend@broadcom.com>
  26800. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  26801. ----
  26802. -
  26803. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bus.h
  26804. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bus.h
  26805. -@@ -137,7 +137,7 @@ struct brcmf_bus {
  26806. - bool always_use_fws_queue;
  26807. - bool wowl_supported;
  26808. -
  26809. -- struct brcmf_bus_ops *ops;
  26810. -+ const struct brcmf_bus_ops *ops;
  26811. - struct brcmf_bus_msgbuf *msgbuf;
  26812. - };
  26813. -
  26814. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  26815. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  26816. -@@ -1413,7 +1413,7 @@ static int brcmf_pcie_get_memdump(struct
  26817. - }
  26818. -
  26819. -
  26820. --static struct brcmf_bus_ops brcmf_pcie_bus_ops = {
  26821. -+static const struct brcmf_bus_ops brcmf_pcie_bus_ops = {
  26822. - .txdata = brcmf_pcie_tx,
  26823. - .stop = brcmf_pcie_down,
  26824. - .txctl = brcmf_pcie_tx_ctlpkt,
  26825. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  26826. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  26827. -@@ -4025,7 +4025,7 @@ brcmf_sdio_watchdog(unsigned long data)
  26828. - }
  26829. - }
  26830. -
  26831. --static struct brcmf_bus_ops brcmf_sdio_bus_ops = {
  26832. -+static const struct brcmf_bus_ops brcmf_sdio_bus_ops = {
  26833. - .stop = brcmf_sdio_bus_stop,
  26834. - .preinit = brcmf_sdio_bus_preinit,
  26835. - .txdata = brcmf_sdio_bus_txdata,
  26836. ---- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  26837. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  26838. -@@ -1163,7 +1163,7 @@ static void brcmf_usb_wowl_config(struct
  26839. - device_set_wakeup_enable(devinfo->dev, false);
  26840. - }
  26841. -
  26842. --static struct brcmf_bus_ops brcmf_usb_bus_ops = {
  26843. -+static const struct brcmf_bus_ops brcmf_usb_bus_ops = {
  26844. - .txdata = brcmf_usb_tx,
  26845. - .stop = brcmf_usb_down,
  26846. - .txctl = brcmf_usb_tx_ctlpkt,
  26847. 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
  26848. deleted file mode 100644
  26849. index 83f1ebe..0000000
  26850. --- a/package/kernel/mac80211/patches/376-0001-brcmfmac-Cleanup-ssid-storage.patch
  26851. +++ /dev/null
  26852. @@ -1,251 +0,0 @@
  26853. -From: Hante Meuleman <meuleman@broadcom.com>
  26854. -Date: Wed, 25 Nov 2015 11:32:37 +0100
  26855. -Subject: [PATCH] brcmfmac: Cleanup ssid storage.
  26856. -
  26857. -SSIDs used for connect and p2p got stored, but never used.
  26858. -
  26859. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  26860. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  26861. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  26862. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  26863. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  26864. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  26865. ----
  26866. -
  26867. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  26868. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  26869. -@@ -959,7 +959,7 @@ brcmf_run_escan(struct brcmf_cfg80211_in
  26870. - params_size += sizeof(u32) * ((request->n_channels + 1) / 2);
  26871. -
  26872. - /* Allocate space for populating ssids in struct */
  26873. -- params_size += sizeof(struct brcmf_ssid) * request->n_ssids;
  26874. -+ params_size += sizeof(struct brcmf_ssid_le) * request->n_ssids;
  26875. - }
  26876. -
  26877. - params = kzalloc(params_size, GFP_KERNEL);
  26878. -@@ -1291,6 +1291,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
  26879. - s32 wsec = 0;
  26880. - s32 bcnprd;
  26881. - u16 chanspec;
  26882. -+ u32 ssid_len;
  26883. -
  26884. - brcmf_dbg(TRACE, "Enter\n");
  26885. - if (!check_vif_up(ifp->vif))
  26886. -@@ -1368,17 +1369,15 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
  26887. - memset(&join_params, 0, sizeof(struct brcmf_join_params));
  26888. -
  26889. - /* SSID */
  26890. -- profile->ssid.SSID_len = min_t(u32, params->ssid_len, 32);
  26891. -- memcpy(profile->ssid.SSID, params->ssid, profile->ssid.SSID_len);
  26892. -- memcpy(join_params.ssid_le.SSID, params->ssid, profile->ssid.SSID_len);
  26893. -- join_params.ssid_le.SSID_len = cpu_to_le32(profile->ssid.SSID_len);
  26894. -+ ssid_len = min_t(u32, params->ssid_len, IEEE80211_MAX_SSID_LEN);
  26895. -+ memcpy(join_params.ssid_le.SSID, params->ssid, ssid_len);
  26896. -+ join_params.ssid_le.SSID_len = cpu_to_le32(ssid_len);
  26897. - join_params_size = sizeof(join_params.ssid_le);
  26898. -
  26899. - /* BSSID */
  26900. - if (params->bssid) {
  26901. - memcpy(join_params.params_le.bssid, params->bssid, ETH_ALEN);
  26902. -- join_params_size = sizeof(join_params.ssid_le) +
  26903. -- BRCMF_ASSOC_PARAMS_FIXED_SIZE;
  26904. -+ join_params_size += BRCMF_ASSOC_PARAMS_FIXED_SIZE;
  26905. - memcpy(profile->bssid, params->bssid, ETH_ALEN);
  26906. - } else {
  26907. - eth_broadcast_addr(join_params.params_le.bssid);
  26908. -@@ -1728,7 +1727,6 @@ brcmf_cfg80211_connect(struct wiphy *wip
  26909. - {
  26910. - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  26911. - struct brcmf_if *ifp = netdev_priv(ndev);
  26912. -- struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
  26913. - struct ieee80211_channel *chan = sme->channel;
  26914. - struct brcmf_join_params join_params;
  26915. - size_t join_params_size;
  26916. -@@ -1739,6 +1737,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
  26917. - struct brcmf_ext_join_params_le *ext_join_params;
  26918. - u16 chanspec;
  26919. - s32 err = 0;
  26920. -+ u32 ssid_len;
  26921. -
  26922. - brcmf_dbg(TRACE, "Enter\n");
  26923. - if (!check_vif_up(ifp->vif))
  26924. -@@ -1824,15 +1823,6 @@ brcmf_cfg80211_connect(struct wiphy *wip
  26925. - goto done;
  26926. - }
  26927. -
  26928. -- profile->ssid.SSID_len = min_t(u32, (u32)sizeof(profile->ssid.SSID),
  26929. -- (u32)sme->ssid_len);
  26930. -- memcpy(&profile->ssid.SSID, sme->ssid, profile->ssid.SSID_len);
  26931. -- if (profile->ssid.SSID_len < IEEE80211_MAX_SSID_LEN) {
  26932. -- profile->ssid.SSID[profile->ssid.SSID_len] = 0;
  26933. -- brcmf_dbg(CONN, "SSID \"%s\", len (%d)\n", profile->ssid.SSID,
  26934. -- profile->ssid.SSID_len);
  26935. -- }
  26936. --
  26937. - /* Join with specific BSSID and cached SSID
  26938. - * If SSID is zero join based on BSSID only
  26939. - */
  26940. -@@ -1845,9 +1835,12 @@ brcmf_cfg80211_connect(struct wiphy *wip
  26941. - err = -ENOMEM;
  26942. - goto done;
  26943. - }
  26944. -- ext_join_params->ssid_le.SSID_len = cpu_to_le32(profile->ssid.SSID_len);
  26945. -- memcpy(&ext_join_params->ssid_le.SSID, sme->ssid,
  26946. -- profile->ssid.SSID_len);
  26947. -+ ssid_len = min_t(u32, sme->ssid_len, IEEE80211_MAX_SSID_LEN);
  26948. -+ ext_join_params->ssid_le.SSID_len = cpu_to_le32(ssid_len);
  26949. -+ memcpy(&ext_join_params->ssid_le.SSID, sme->ssid, ssid_len);
  26950. -+ if (ssid_len < IEEE80211_MAX_SSID_LEN)
  26951. -+ brcmf_dbg(CONN, "SSID \"%s\", len (%d)\n",
  26952. -+ ext_join_params->ssid_le.SSID, ssid_len);
  26953. -
  26954. - /* Set up join scan parameters */
  26955. - ext_join_params->scan_le.scan_type = -1;
  26956. -@@ -1895,8 +1888,8 @@ brcmf_cfg80211_connect(struct wiphy *wip
  26957. - memset(&join_params, 0, sizeof(join_params));
  26958. - join_params_size = sizeof(join_params.ssid_le);
  26959. -
  26960. -- memcpy(&join_params.ssid_le.SSID, sme->ssid, profile->ssid.SSID_len);
  26961. -- join_params.ssid_le.SSID_len = cpu_to_le32(profile->ssid.SSID_len);
  26962. -+ memcpy(&join_params.ssid_le.SSID, sme->ssid, ssid_len);
  26963. -+ join_params.ssid_le.SSID_len = cpu_to_le32(ssid_len);
  26964. -
  26965. - if (sme->bssid)
  26966. - memcpy(join_params.params_le.bssid, sme->bssid, ETH_ALEN);
  26967. -@@ -2775,9 +2768,7 @@ CleanUp:
  26968. - static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg,
  26969. - struct brcmf_if *ifp)
  26970. - {
  26971. -- struct brcmf_cfg80211_profile *profile = ndev_to_prof(ifp->ndev);
  26972. - struct brcmf_bss_info_le *bi;
  26973. -- struct brcmf_ssid *ssid;
  26974. - const struct brcmf_tlv *tim;
  26975. - u16 beacon_interval;
  26976. - u8 dtim_period;
  26977. -@@ -2789,8 +2780,6 @@ static s32 brcmf_update_bss_info(struct
  26978. - if (brcmf_is_ibssmode(ifp->vif))
  26979. - return err;
  26980. -
  26981. -- ssid = &profile->ssid;
  26982. --
  26983. - *(__le32 *)cfg->extra_buf = cpu_to_le32(WL_EXTRA_BUF_MAX);
  26984. - err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO,
  26985. - cfg->extra_buf, WL_EXTRA_BUF_MAX);
  26986. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  26987. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  26988. -@@ -124,13 +124,11 @@ struct brcmf_cfg80211_security {
  26989. - /**
  26990. - * struct brcmf_cfg80211_profile - profile information.
  26991. - *
  26992. -- * @ssid: ssid of associated/associating ap.
  26993. - * @bssid: bssid of joined/joining ibss.
  26994. - * @sec: security information.
  26995. - * @key: key information
  26996. - */
  26997. - struct brcmf_cfg80211_profile {
  26998. -- struct brcmf_ssid ssid;
  26999. - u8 bssid[ETH_ALEN];
  27000. - struct brcmf_cfg80211_security sec;
  27001. - struct brcmf_wsec_key key[BRCMF_MAX_DEFAULT_KEYS];
  27002. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  27003. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  27004. -@@ -282,14 +282,9 @@ struct brcm_rateset_le {
  27005. - u8 rates[BRCMF_MAXRATES_IN_SET];
  27006. - };
  27007. -
  27008. --struct brcmf_ssid {
  27009. -- u32 SSID_len;
  27010. -- unsigned char SSID[32];
  27011. --};
  27012. --
  27013. - struct brcmf_ssid_le {
  27014. - __le32 SSID_len;
  27015. -- unsigned char SSID[32];
  27016. -+ unsigned char SSID[IEEE80211_MAX_SSID_LEN];
  27017. - };
  27018. -
  27019. - struct brcmf_scan_params_le {
  27020. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  27021. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  27022. -@@ -642,7 +642,6 @@ static s32 brcmf_p2p_escan(struct brcmf_
  27023. - struct brcmf_cfg80211_vif *vif;
  27024. - struct brcmf_p2p_scan_le *p2p_params;
  27025. - struct brcmf_scan_params_le *sparams;
  27026. -- struct brcmf_ssid ssid;
  27027. -
  27028. - memsize += num_chans * sizeof(__le16);
  27029. - memblk = kzalloc(memsize, GFP_KERNEL);
  27030. -@@ -655,16 +654,16 @@ static s32 brcmf_p2p_escan(struct brcmf_
  27031. - ret = -EINVAL;
  27032. - goto exit;
  27033. - }
  27034. -+ p2p_params = (struct brcmf_p2p_scan_le *)memblk;
  27035. -+ sparams = &p2p_params->eparams.params_le;
  27036. -
  27037. - switch (search_state) {
  27038. - case WL_P2P_DISC_ST_SEARCH:
  27039. - /*
  27040. - * If we in SEARCH STATE, we don't need to set SSID explictly
  27041. -- * because dongle use P2P WILDCARD internally by default
  27042. -+ * because dongle use P2P WILDCARD internally by default, use
  27043. -+ * null ssid, which it is already due to kzalloc.
  27044. - */
  27045. -- /* use null ssid */
  27046. -- ssid.SSID_len = 0;
  27047. -- memset(ssid.SSID, 0, sizeof(ssid.SSID));
  27048. - break;
  27049. - case WL_P2P_DISC_ST_SCAN:
  27050. - /*
  27051. -@@ -673,8 +672,10 @@ static s32 brcmf_p2p_escan(struct brcmf_
  27052. - * P2P WILDCARD because we just do broadcast scan unless
  27053. - * setting SSID.
  27054. - */
  27055. -- ssid.SSID_len = BRCMF_P2P_WILDCARD_SSID_LEN;
  27056. -- memcpy(ssid.SSID, BRCMF_P2P_WILDCARD_SSID, ssid.SSID_len);
  27057. -+ sparams->ssid_le.SSID_len =
  27058. -+ cpu_to_le32(BRCMF_P2P_WILDCARD_SSID_LEN);
  27059. -+ memcpy(sparams->ssid_le.SSID, BRCMF_P2P_WILDCARD_SSID,
  27060. -+ BRCMF_P2P_WILDCARD_SSID_LEN);
  27061. - break;
  27062. - default:
  27063. - brcmf_err(" invalid search state %d\n", search_state);
  27064. -@@ -687,11 +688,9 @@ static s32 brcmf_p2p_escan(struct brcmf_
  27065. - /*
  27066. - * set p2p scan parameters.
  27067. - */
  27068. -- p2p_params = (struct brcmf_p2p_scan_le *)memblk;
  27069. - p2p_params->type = 'E';
  27070. -
  27071. - /* determine the scan engine parameters */
  27072. -- sparams = &p2p_params->eparams.params_le;
  27073. - sparams->bss_type = DOT11_BSSTYPE_ANY;
  27074. - if (p2p->cfg->active_scan)
  27075. - sparams->scan_type = 0;
  27076. -@@ -699,9 +698,6 @@ static s32 brcmf_p2p_escan(struct brcmf_
  27077. - sparams->scan_type = 1;
  27078. -
  27079. - eth_broadcast_addr(sparams->bssid);
  27080. -- if (ssid.SSID_len)
  27081. -- memcpy(sparams->ssid_le.SSID, ssid.SSID, ssid.SSID_len);
  27082. -- sparams->ssid_le.SSID_len = cpu_to_le32(ssid.SSID_len);
  27083. - sparams->home_time = cpu_to_le32(P2PAPI_SCAN_HOME_TIME_MS);
  27084. -
  27085. - /*
  27086. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.h
  27087. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.h
  27088. -@@ -112,7 +112,6 @@ struct afx_hdl {
  27089. - * @int_addr: P2P interface address.
  27090. - * @bss_idx: informate for P2P bss types.
  27091. - * @listen_timer: timer for @WL_P2P_DISC_ST_LISTEN discover state.
  27092. -- * @ssid: ssid for P2P GO.
  27093. - * @listen_channel: channel for @WL_P2P_DISC_ST_LISTEN discover state.
  27094. - * @remain_on_channel: contains copy of struct used by cfg80211.
  27095. - * @remain_on_channel_cookie: cookie counter for remain on channel cmd
  27096. -@@ -133,7 +132,6 @@ struct brcmf_p2p_info {
  27097. - u8 int_addr[ETH_ALEN];
  27098. - struct p2p_bss bss_idx[P2PAPI_BSSCFG_MAX];
  27099. - struct timer_list listen_timer;
  27100. -- struct brcmf_ssid ssid;
  27101. - u8 listen_channel;
  27102. - struct ieee80211_channel remain_on_channel;
  27103. - u32 remain_on_channel_cookie;
  27104. 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
  27105. deleted file mode 100644
  27106. index 8672c18..0000000
  27107. --- a/package/kernel/mac80211/patches/376-0002-brcmfmac-Return-actual-error-by-fwil.patch
  27108. +++ /dev/null
  27109. @@ -1,31 +0,0 @@
  27110. -From: Hante Meuleman <meuleman@broadcom.com>
  27111. -Date: Wed, 25 Nov 2015 11:32:38 +0100
  27112. -Subject: [PATCH] brcmfmac: Return actual error by fwil.
  27113. -
  27114. -FWIL is always mapping back errors to EBADE. This is not very
  27115. -conventient when trying to understand problems by reading logs.
  27116. -Some callers print the error code, but that is quite useless
  27117. -when the exact error code is not returned. It also makes it
  27118. -impossible to differentiate based on error code. This patch
  27119. -changes the return of EBADE into the actual error code.
  27120. -
  27121. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  27122. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  27123. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  27124. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  27125. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  27126. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  27127. ----
  27128. -
  27129. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwil.c
  27130. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil.c
  27131. -@@ -126,7 +126,8 @@ brcmf_fil_cmd_data(struct brcmf_if *ifp,
  27132. -
  27133. - brcmf_dbg(FIL, "Failed: %s (%d)\n",
  27134. - brcmf_fil_get_errstr((u32)(-err)), err);
  27135. -- return -EBADE;
  27136. -+
  27137. -+ return err;
  27138. - }
  27139. -
  27140. - s32
  27141. 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
  27142. deleted file mode 100644
  27143. index 1cfab21..0000000
  27144. --- a/package/kernel/mac80211/patches/376-0003-brcmfmac-Change-error-print-on-wlan0-existence.patch
  27145. +++ /dev/null
  27146. @@ -1,41 +0,0 @@
  27147. -From: Hante Meuleman <meuleman@broadcom.com>
  27148. -Date: Wed, 25 Nov 2015 11:32:39 +0100
  27149. -Subject: [PATCH] brcmfmac: Change error print on wlan0 existence.
  27150. -
  27151. -During initialization of the device, but also on some other
  27152. -moments the driver prints an error that the netdev already exists.
  27153. -This is a result of the way the driver is initializing the
  27154. -firmware and not really an error. The code is not treating it as
  27155. -an error either. This error print has resulted in many questions
  27156. -by users and is confusing and incorrect. This patch changes the
  27157. -error log into a debug info log.
  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/core.c
  27168. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  27169. -@@ -811,14 +811,15 @@ struct brcmf_if *brcmf_add_if(struct brc
  27170. - * in case we missed the BRCMF_E_IF_DEL event.
  27171. - */
  27172. - if (ifp) {
  27173. -- brcmf_err("ERROR: netdev:%s already exists\n",
  27174. -- ifp->ndev->name);
  27175. - if (ifidx) {
  27176. -+ brcmf_err("ERROR: netdev:%s already exists\n",
  27177. -+ ifp->ndev->name);
  27178. - netif_stop_queue(ifp->ndev);
  27179. - brcmf_net_detach(ifp->ndev);
  27180. - drvr->iflist[bsscfgidx] = NULL;
  27181. - } else {
  27182. -- brcmf_err("ignore IF event\n");
  27183. -+ brcmf_dbg(INFO, "netdev:%s ignore IF event\n",
  27184. -+ ifp->ndev->name);
  27185. - return ERR_PTR(-EINVAL);
  27186. - }
  27187. - }
  27188. 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
  27189. deleted file mode 100644
  27190. index dfc3a98..0000000
  27191. --- a/package/kernel/mac80211/patches/376-0004-brcmfmac-no-retries-on-rxglom-superframe-errors.patch
  27192. +++ /dev/null
  27193. @@ -1,76 +0,0 @@
  27194. -From: Franky Lin <frankyl@broadcom.com>
  27195. -Date: Wed, 25 Nov 2015 11:32:40 +0100
  27196. -Subject: [PATCH] brcmfmac: no retries on rxglom superframe errors
  27197. -
  27198. -Aborting the current read attempt on the superframe also removes the
  27199. -packet from the pipeline. Retries should not be attempted on the next
  27200. -packet since it would not be a superframe(either a superframe descriptor
  27201. -or other data packet) and should not be handled by brcmf_sdio_rxglom
  27202. -
  27203. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  27204. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  27205. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  27206. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  27207. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  27208. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  27209. ----
  27210. -
  27211. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  27212. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  27213. -@@ -460,7 +460,6 @@ struct brcmf_sdio {
  27214. -
  27215. - struct sk_buff *glomd; /* Packet containing glomming descriptor */
  27216. - struct sk_buff_head glom; /* Packet list for glommed superframe */
  27217. -- uint glomerr; /* Glom packet read errors */
  27218. -
  27219. - u8 *rxbuf; /* Buffer for receiving control packets */
  27220. - uint rxblen; /* Allocated length of rxbuf */
  27221. -@@ -1654,20 +1653,15 @@ static u8 brcmf_sdio_rxglom(struct brcmf
  27222. - sdio_release_host(bus->sdiodev->func[1]);
  27223. - bus->sdcnt.f2rxdata++;
  27224. -
  27225. -- /* On failure, kill the superframe, allow a couple retries */
  27226. -+ /* On failure, kill the superframe */
  27227. - if (errcode < 0) {
  27228. - brcmf_err("glom read of %d bytes failed: %d\n",
  27229. - dlen, errcode);
  27230. -
  27231. - sdio_claim_host(bus->sdiodev->func[1]);
  27232. -- if (bus->glomerr++ < 3) {
  27233. -- brcmf_sdio_rxfail(bus, true, true);
  27234. -- } else {
  27235. -- bus->glomerr = 0;
  27236. -- brcmf_sdio_rxfail(bus, true, false);
  27237. -- bus->sdcnt.rxglomfail++;
  27238. -- brcmf_sdio_free_glom(bus);
  27239. -- }
  27240. -+ brcmf_sdio_rxfail(bus, true, false);
  27241. -+ bus->sdcnt.rxglomfail++;
  27242. -+ brcmf_sdio_free_glom(bus);
  27243. - sdio_release_host(bus->sdiodev->func[1]);
  27244. - return 0;
  27245. - }
  27246. -@@ -1708,19 +1702,11 @@ static u8 brcmf_sdio_rxglom(struct brcmf
  27247. - }
  27248. -
  27249. - if (errcode) {
  27250. -- /* Terminate frame on error, request
  27251. -- a couple retries */
  27252. -+ /* Terminate frame on error */
  27253. - sdio_claim_host(bus->sdiodev->func[1]);
  27254. -- if (bus->glomerr++ < 3) {
  27255. -- /* Restore superframe header space */
  27256. -- skb_push(pfirst, sfdoff);
  27257. -- brcmf_sdio_rxfail(bus, true, true);
  27258. -- } else {
  27259. -- bus->glomerr = 0;
  27260. -- brcmf_sdio_rxfail(bus, true, false);
  27261. -- bus->sdcnt.rxglomfail++;
  27262. -- brcmf_sdio_free_glom(bus);
  27263. -- }
  27264. -+ brcmf_sdio_rxfail(bus, true, false);
  27265. -+ bus->sdcnt.rxglomfail++;
  27266. -+ brcmf_sdio_free_glom(bus);
  27267. - sdio_release_host(bus->sdiodev->func[1]);
  27268. - bus->cur_read.len = 0;
  27269. - return 0;
  27270. 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
  27271. deleted file mode 100644
  27272. index ede1f47..0000000
  27273. --- a/package/kernel/mac80211/patches/376-0005-brcmfmac-Remove-redundant-parameter-action-from-scan.patch
  27274. +++ /dev/null
  27275. @@ -1,108 +0,0 @@
  27276. -From: Hante Meuleman <meuleman@broadcom.com>
  27277. -Date: Wed, 25 Nov 2015 11:32:41 +0100
  27278. -Subject: [PATCH] brcmfmac: Remove redundant parameter action from scan.
  27279. -
  27280. -ESCAN is always performed using action start scan. No need to
  27281. -pass this parameter on to different functions.
  27282. -
  27283. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  27284. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  27285. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  27286. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  27287. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  27288. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  27289. ----
  27290. -
  27291. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  27292. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  27293. -@@ -945,7 +945,7 @@ static void brcmf_escan_prep(struct brcm
  27294. -
  27295. - static s32
  27296. - brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
  27297. -- struct cfg80211_scan_request *request, u16 action)
  27298. -+ struct cfg80211_scan_request *request)
  27299. - {
  27300. - s32 params_size = BRCMF_SCAN_PARAMS_FIXED_SIZE +
  27301. - offsetof(struct brcmf_escan_params_le, params_le);
  27302. -@@ -970,7 +970,7 @@ brcmf_run_escan(struct brcmf_cfg80211_in
  27303. - BUG_ON(params_size + sizeof("escan") >= BRCMF_DCMD_MEDLEN);
  27304. - brcmf_escan_prep(cfg, &params->params_le, request);
  27305. - params->version = cpu_to_le32(BRCMF_ESCAN_REQ_VERSION);
  27306. -- params->action = cpu_to_le16(action);
  27307. -+ params->action = cpu_to_le16(WL_ESCAN_ACTION_START);
  27308. - params->sync_id = cpu_to_le16(0x1234);
  27309. -
  27310. - err = brcmf_fil_iovar_data_set(ifp, "escan", params, params_size);
  27311. -@@ -1012,7 +1012,7 @@ brcmf_do_escan(struct brcmf_cfg80211_inf
  27312. - results->count = 0;
  27313. - results->buflen = WL_ESCAN_RESULTS_FIXED_SIZE;
  27314. -
  27315. -- err = escan->run(cfg, ifp, request, WL_ESCAN_ACTION_START);
  27316. -+ err = escan->run(cfg, ifp, request);
  27317. - if (err)
  27318. - brcmf_scan_config_mpc(ifp, 1);
  27319. - return err;
  27320. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  27321. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  27322. -@@ -231,7 +231,7 @@ struct escan_info {
  27323. - struct wiphy *wiphy;
  27324. - struct brcmf_if *ifp;
  27325. - s32 (*run)(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
  27326. -- struct cfg80211_scan_request *request, u16 action);
  27327. -+ struct cfg80211_scan_request *request);
  27328. - };
  27329. -
  27330. - /**
  27331. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  27332. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  27333. -@@ -625,11 +625,10 @@ exit:
  27334. - * @num_chans: number of channels to scan.
  27335. - * @chanspecs: channel parameters for @num_chans channels.
  27336. - * @search_state: P2P discover state to use.
  27337. -- * @action: scan action to pass to firmware.
  27338. - * @bss_type: type of P2P bss.
  27339. - */
  27340. - static s32 brcmf_p2p_escan(struct brcmf_p2p_info *p2p, u32 num_chans,
  27341. -- u16 chanspecs[], s32 search_state, u16 action,
  27342. -+ u16 chanspecs[], s32 search_state,
  27343. - enum p2p_bss_type bss_type)
  27344. - {
  27345. - s32 ret = 0;
  27346. -@@ -738,7 +737,7 @@ static s32 brcmf_p2p_escan(struct brcmf_
  27347. -
  27348. - /* set the escan specific parameters */
  27349. - p2p_params->eparams.version = cpu_to_le32(BRCMF_ESCAN_REQ_VERSION);
  27350. -- p2p_params->eparams.action = cpu_to_le16(action);
  27351. -+ p2p_params->eparams.action = cpu_to_le16(WL_ESCAN_ACTION_START);
  27352. - p2p_params->eparams.sync_id = cpu_to_le16(0x1234);
  27353. - /* perform p2p scan on primary device */
  27354. - ret = brcmf_fil_bsscfg_data_set(vif->ifp, "p2p_scan", memblk, memsize);
  27355. -@@ -762,8 +761,7 @@ exit:
  27356. - */
  27357. - static s32 brcmf_p2p_run_escan(struct brcmf_cfg80211_info *cfg,
  27358. - struct brcmf_if *ifp,
  27359. -- struct cfg80211_scan_request *request,
  27360. -- u16 action)
  27361. -+ struct cfg80211_scan_request *request)
  27362. - {
  27363. - struct brcmf_p2p_info *p2p = &cfg->p2p;
  27364. - s32 err = 0;
  27365. -@@ -823,7 +821,7 @@ static s32 brcmf_p2p_run_escan(struct br
  27366. - num_nodfs++;
  27367. - }
  27368. - err = brcmf_p2p_escan(p2p, num_nodfs, chanspecs, search_state,
  27369. -- action, P2PAPI_BSSCFG_DEVICE);
  27370. -+ P2PAPI_BSSCFG_DEVICE);
  27371. - kfree(chanspecs);
  27372. - }
  27373. - exit:
  27374. -@@ -1092,8 +1090,7 @@ static s32 brcmf_p2p_act_frm_search(stru
  27375. - default_chan_list[2] = ch.chspec;
  27376. - }
  27377. - err = brcmf_p2p_escan(p2p, channel_cnt, default_chan_list,
  27378. -- WL_P2P_DISC_ST_SEARCH, WL_ESCAN_ACTION_START,
  27379. -- P2PAPI_BSSCFG_DEVICE);
  27380. -+ WL_P2P_DISC_ST_SEARCH, P2PAPI_BSSCFG_DEVICE);
  27381. - kfree(default_chan_list);
  27382. - exit:
  27383. - return err;
  27384. 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
  27385. deleted file mode 100644
  27386. index 41b8770..0000000
  27387. --- a/package/kernel/mac80211/patches/376-0006-brcmfmac-Cleanup-roaming-configuration.patch
  27388. +++ /dev/null
  27389. @@ -1,180 +0,0 @@
  27390. -From: Hante Meuleman <meuleman@broadcom.com>
  27391. -Date: Wed, 25 Nov 2015 11:32:42 +0100
  27392. -Subject: [PATCH] brcmfmac: Cleanup roaming configuration.
  27393. -
  27394. -Put all roaming configuration related code in one place and
  27395. -configure timeout based upon roaming setting.
  27396. -
  27397. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  27398. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  27399. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  27400. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  27401. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  27402. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  27403. ----
  27404. -
  27405. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  27406. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  27407. -@@ -4755,7 +4755,6 @@ struct brcmf_cfg80211_vif *brcmf_alloc_v
  27408. - vif->wdev.iftype = type;
  27409. -
  27410. - vif->pm_block = pm_block;
  27411. -- vif->roam_off = -1;
  27412. -
  27413. - brcmf_init_prof(&vif->profile);
  27414. -
  27415. -@@ -5305,35 +5304,33 @@ static void init_vif_event(struct brcmf_
  27416. - mutex_init(&event->vif_event_lock);
  27417. - }
  27418. -
  27419. --static s32
  27420. --brcmf_dongle_roam(struct brcmf_if *ifp, u32 bcn_timeout)
  27421. -+static s32 brcmf_dongle_roam(struct brcmf_if *ifp)
  27422. - {
  27423. -- s32 err = 0;
  27424. -+ s32 err;
  27425. -+ u32 bcn_timeout;
  27426. - __le32 roamtrigger[2];
  27427. - __le32 roam_delta[2];
  27428. -
  27429. -- /*
  27430. -- * Setup timeout if Beacons are lost and roam is
  27431. -- * off to report link down
  27432. -- */
  27433. -- if (brcmf_roamoff) {
  27434. -- err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout", bcn_timeout);
  27435. -- if (err) {
  27436. -- brcmf_err("bcn_timeout error (%d)\n", err);
  27437. -- goto dongle_rom_out;
  27438. -- }
  27439. -+ /* Configure beacon timeout value based upon roaming setting */
  27440. -+ if (brcmf_roamoff)
  27441. -+ bcn_timeout = BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_OFF;
  27442. -+ else
  27443. -+ bcn_timeout = BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON;
  27444. -+ err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout", bcn_timeout);
  27445. -+ if (err) {
  27446. -+ brcmf_err("bcn_timeout error (%d)\n", err);
  27447. -+ goto roam_setup_done;
  27448. - }
  27449. -
  27450. -- /*
  27451. -- * Enable/Disable built-in roaming to allow supplicant
  27452. -- * to take care of roaming
  27453. -+ /* Enable/Disable built-in roaming to allow supplicant to take care of
  27454. -+ * roaming.
  27455. - */
  27456. - brcmf_dbg(INFO, "Internal Roaming = %s\n",
  27457. - brcmf_roamoff ? "Off" : "On");
  27458. - err = brcmf_fil_iovar_int_set(ifp, "roam_off", !!(brcmf_roamoff));
  27459. - if (err) {
  27460. - brcmf_err("roam_off error (%d)\n", err);
  27461. -- goto dongle_rom_out;
  27462. -+ goto roam_setup_done;
  27463. - }
  27464. -
  27465. - roamtrigger[0] = cpu_to_le32(WL_ROAM_TRIGGER_LEVEL);
  27466. -@@ -5342,7 +5339,7 @@ brcmf_dongle_roam(struct brcmf_if *ifp,
  27467. - (void *)roamtrigger, sizeof(roamtrigger));
  27468. - if (err) {
  27469. - brcmf_err("WLC_SET_ROAM_TRIGGER error (%d)\n", err);
  27470. -- goto dongle_rom_out;
  27471. -+ goto roam_setup_done;
  27472. - }
  27473. -
  27474. - roam_delta[0] = cpu_to_le32(WL_ROAM_DELTA);
  27475. -@@ -5351,10 +5348,10 @@ brcmf_dongle_roam(struct brcmf_if *ifp,
  27476. - (void *)roam_delta, sizeof(roam_delta));
  27477. - if (err) {
  27478. - brcmf_err("WLC_SET_ROAM_DELTA error (%d)\n", err);
  27479. -- goto dongle_rom_out;
  27480. -+ goto roam_setup_done;
  27481. - }
  27482. -
  27483. --dongle_rom_out:
  27484. -+roam_setup_done:
  27485. - return err;
  27486. - }
  27487. -
  27488. -@@ -6069,7 +6066,7 @@ static s32 brcmf_config_dongle(struct br
  27489. - brcmf_dbg(INFO, "power save set to %s\n",
  27490. - (power_mode ? "enabled" : "disabled"));
  27491. -
  27492. -- err = brcmf_dongle_roam(ifp, WL_BEACON_TIMEOUT);
  27493. -+ err = brcmf_dongle_roam(ifp);
  27494. - if (err)
  27495. - goto default_conf_out;
  27496. - err = brcmf_cfg80211_change_iface(wdev->wiphy, ndev, wdev->iftype,
  27497. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  27498. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  27499. -@@ -28,7 +28,6 @@
  27500. - #define WL_EXTRA_BUF_MAX 2048
  27501. - #define WL_ROAM_TRIGGER_LEVEL -75
  27502. - #define WL_ROAM_DELTA 20
  27503. --#define WL_BEACON_TIMEOUT 3
  27504. -
  27505. - #define WL_SCAN_CHANNEL_TIME 40
  27506. - #define WL_SCAN_UNASSOC_TIME 40
  27507. -@@ -77,6 +76,9 @@
  27508. -
  27509. - #define BRCMF_MAX_DEFAULT_KEYS 4
  27510. -
  27511. -+/* beacon loss timeout defaults */
  27512. -+#define BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON 2
  27513. -+#define BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_OFF 4
  27514. -
  27515. - /**
  27516. - * enum brcmf_scan_status - scan engine status
  27517. -@@ -178,7 +180,6 @@ struct vif_saved_ie {
  27518. - * @ifp: lower layer interface pointer
  27519. - * @wdev: wireless device.
  27520. - * @profile: profile information.
  27521. -- * @roam_off: roaming state.
  27522. - * @sme_state: SME state using enum brcmf_vif_status bits.
  27523. - * @pm_block: power-management blocked.
  27524. - * @list: linked list.
  27525. -@@ -189,7 +190,6 @@ struct brcmf_cfg80211_vif {
  27526. - struct brcmf_if *ifp;
  27527. - struct wireless_dev wdev;
  27528. - struct brcmf_cfg80211_profile profile;
  27529. -- s32 roam_off;
  27530. - unsigned long sme_state;
  27531. - bool pm_block;
  27532. - struct vif_saved_ie saved_ie;
  27533. ---- a/drivers/net/wireless/brcm80211/brcmfmac/common.c
  27534. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/common.c
  27535. -@@ -29,7 +29,6 @@
  27536. -
  27537. - const u8 ALLFFMAC[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
  27538. -
  27539. --#define BRCMF_DEFAULT_BCN_TIMEOUT 3
  27540. - #define BRCMF_DEFAULT_SCAN_CHANNEL_TIME 40
  27541. - #define BRCMF_DEFAULT_SCAN_UNASSOC_TIME 40
  27542. -
  27543. -@@ -107,26 +106,6 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
  27544. - goto done;
  27545. - }
  27546. -
  27547. -- /*
  27548. -- * Setup timeout if Beacons are lost and roam is off to report
  27549. -- * link down
  27550. -- */
  27551. -- err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout",
  27552. -- BRCMF_DEFAULT_BCN_TIMEOUT);
  27553. -- if (err) {
  27554. -- brcmf_err("bcn_timeout error (%d)\n", err);
  27555. -- goto done;
  27556. -- }
  27557. --
  27558. -- /* Enable/Disable build-in roaming to allowed ext supplicant to take
  27559. -- * of romaing
  27560. -- */
  27561. -- err = brcmf_fil_iovar_int_set(ifp, "roam_off", 1);
  27562. -- if (err) {
  27563. -- brcmf_err("roam_off error (%d)\n", err);
  27564. -- goto done;
  27565. -- }
  27566. --
  27567. - /* Setup join_pref to select target by RSSI(with boost on 5GHz) */
  27568. - join_pref_params[0].type = BRCMF_JOIN_PREF_RSSI_DELTA;
  27569. - join_pref_params[0].len = 2;
  27570. 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
  27571. deleted file mode 100644
  27572. index 395166b..0000000
  27573. --- a/package/kernel/mac80211/patches/376-0007-brcmfmac-Add-beamforming-support.patch
  27574. +++ /dev/null
  27575. @@ -1,115 +0,0 @@
  27576. -From: Hante Meuleman <meuleman@broadcom.com>
  27577. -Date: Wed, 25 Nov 2015 11:32:43 +0100
  27578. -Subject: [PATCH] brcmfmac: Add beamforming support.
  27579. -
  27580. -Some devices support beamforming. This patch enables tx beamforming
  27581. -if supported and reports beamforming capabilities per channel if
  27582. -supported.
  27583. -
  27584. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  27585. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  27586. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  27587. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  27588. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  27589. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  27590. ----
  27591. -
  27592. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  27593. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  27594. -@@ -5671,7 +5671,8 @@ static __le16 brcmf_get_mcs_map(u32 ncha
  27595. - }
  27596. -
  27597. - static void brcmf_update_vht_cap(struct ieee80211_supported_band *band,
  27598. -- u32 bw_cap[2], u32 nchain)
  27599. -+ u32 bw_cap[2], u32 nchain, u32 txstreams,
  27600. -+ u32 txbf_bfe_cap, u32 txbf_bfr_cap)
  27601. - {
  27602. - __le16 mcs_map;
  27603. -
  27604. -@@ -5690,6 +5691,25 @@ static void brcmf_update_vht_cap(struct
  27605. - mcs_map = brcmf_get_mcs_map(nchain, IEEE80211_VHT_MCS_SUPPORT_0_9);
  27606. - band->vht_cap.vht_mcs.rx_mcs_map = mcs_map;
  27607. - band->vht_cap.vht_mcs.tx_mcs_map = mcs_map;
  27608. -+
  27609. -+ /* Beamforming support information */
  27610. -+ if (txbf_bfe_cap & BRCMF_TXBF_SU_BFE_CAP)
  27611. -+ band->vht_cap.cap |= IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE;
  27612. -+ if (txbf_bfe_cap & BRCMF_TXBF_MU_BFE_CAP)
  27613. -+ band->vht_cap.cap |= IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE;
  27614. -+ if (txbf_bfr_cap & BRCMF_TXBF_SU_BFR_CAP)
  27615. -+ band->vht_cap.cap |= IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE;
  27616. -+ if (txbf_bfr_cap & BRCMF_TXBF_MU_BFR_CAP)
  27617. -+ band->vht_cap.cap |= IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE;
  27618. -+
  27619. -+ if ((txbf_bfe_cap || txbf_bfr_cap) && (txstreams > 1)) {
  27620. -+ band->vht_cap.cap |=
  27621. -+ (2 << IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT);
  27622. -+ band->vht_cap.cap |= ((txstreams - 1) <<
  27623. -+ IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT);
  27624. -+ band->vht_cap.cap |=
  27625. -+ IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB;
  27626. -+ }
  27627. - }
  27628. -
  27629. - static int brcmf_setup_wiphybands(struct wiphy *wiphy)
  27630. -@@ -5704,6 +5724,9 @@ static int brcmf_setup_wiphybands(struct
  27631. - int err;
  27632. - s32 i;
  27633. - struct ieee80211_supported_band *band;
  27634. -+ u32 txstreams = 0;
  27635. -+ u32 txbf_bfe_cap = 0;
  27636. -+ u32 txbf_bfr_cap = 0;
  27637. -
  27638. - (void)brcmf_fil_iovar_int_get(ifp, "vhtmode", &vhtmode);
  27639. - err = brcmf_fil_iovar_int_get(ifp, "nmode", &nmode);
  27640. -@@ -5732,6 +5755,14 @@ static int brcmf_setup_wiphybands(struct
  27641. - return err;
  27642. - }
  27643. -
  27644. -+ if (vhtmode) {
  27645. -+ (void)brcmf_fil_iovar_int_get(ifp, "txstreams", &txstreams);
  27646. -+ (void)brcmf_fil_iovar_int_get(ifp, "txbf_bfe_cap",
  27647. -+ &txbf_bfe_cap);
  27648. -+ (void)brcmf_fil_iovar_int_get(ifp, "txbf_bfr_cap",
  27649. -+ &txbf_bfr_cap);
  27650. -+ }
  27651. -+
  27652. - wiphy = cfg_to_wiphy(cfg);
  27653. - for (i = 0; i < ARRAY_SIZE(wiphy->bands); i++) {
  27654. - band = wiphy->bands[i];
  27655. -@@ -5741,7 +5772,8 @@ static int brcmf_setup_wiphybands(struct
  27656. - if (nmode)
  27657. - brcmf_update_ht_cap(band, bw_cap, nchain);
  27658. - if (vhtmode)
  27659. -- brcmf_update_vht_cap(band, bw_cap, nchain);
  27660. -+ brcmf_update_vht_cap(band, bw_cap, nchain, txstreams,
  27661. -+ txbf_bfe_cap, txbf_bfr_cap);
  27662. - }
  27663. -
  27664. - return 0;
  27665. ---- a/drivers/net/wireless/brcm80211/brcmfmac/common.c
  27666. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/common.c
  27667. -@@ -153,6 +153,9 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
  27668. - goto done;
  27669. - }
  27670. -
  27671. -+ /* Enable tx beamforming, errors can be ignored (not supported) */
  27672. -+ (void)brcmf_fil_iovar_int_set(ifp, "txbf", 1);
  27673. -+
  27674. - /* do bus specific preinit here */
  27675. - err = brcmf_bus_preinit(ifp->drvr->bus_if);
  27676. - done:
  27677. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  27678. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  27679. -@@ -121,6 +121,11 @@
  27680. -
  27681. - #define BRCMF_MAX_ASSOCLIST 128
  27682. -
  27683. -+#define BRCMF_TXBF_SU_BFE_CAP BIT(0)
  27684. -+#define BRCMF_TXBF_MU_BFE_CAP BIT(1)
  27685. -+#define BRCMF_TXBF_SU_BFR_CAP BIT(0)
  27686. -+#define BRCMF_TXBF_MU_BFR_CAP BIT(1)
  27687. -+
  27688. - /* join preference types for join_pref iovar */
  27689. - enum brcmf_join_pref_types {
  27690. - BRCMF_JOIN_PREF_RSSI = 1,
  27691. 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
  27692. deleted file mode 100644
  27693. index d471eb5..0000000
  27694. --- a/package/kernel/mac80211/patches/376-0008-brcmfmac-assure-net_ratelimit-is-declared-before-use.patch
  27695. +++ /dev/null
  27696. @@ -1,25 +0,0 @@
  27697. -From: Arend van Spriel <arend@broadcom.com>
  27698. -Date: Wed, 25 Nov 2015 11:32:45 +0100
  27699. -Subject: [PATCH] brcmfmac: assure net_ratelimit() is declared before use
  27700. -
  27701. -Under some kernel configuration we get build issue with implicit
  27702. -declaration of net_ratelimit() function. Fix this by explicitly
  27703. -including the file providing the prototype.
  27704. -
  27705. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  27706. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  27707. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  27708. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  27709. ----
  27710. -
  27711. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  27712. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  27713. -@@ -17,6 +17,8 @@
  27714. - #ifndef BRCMFMAC_DEBUG_H
  27715. - #define BRCMFMAC_DEBUG_H
  27716. -
  27717. -+#include <linux/net.h> /* net_ratelimit() */
  27718. -+
  27719. - /* message levels */
  27720. - #define BRCMF_TRACE_VAL 0x00000002
  27721. - #define BRCMF_INFO_VAL 0x00000004
  27722. 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
  27723. deleted file mode 100644
  27724. index 0ec9d10..0000000
  27725. --- a/package/kernel/mac80211/patches/376-0009-brcmfmac-Unify-methods-to-define-and-map-firmware-fi.patch
  27726. +++ /dev/null
  27727. @@ -1,664 +0,0 @@
  27728. -From: Hante Meuleman <meuleman@broadcom.com>
  27729. -Date: Wed, 25 Nov 2015 11:32:46 +0100
  27730. -Subject: [PATCH] brcmfmac: Unify methods to define and map firmware files.
  27731. -
  27732. -All bus drivers (sdio, usb and pcie) require firmware files which
  27733. -needs to be downloaded to the device, The definitions and mapping
  27734. -of device id and revision to firmware and nvram file is done by
  27735. -each bus driver. This patch creates common functions and defines
  27736. -to simplify and unify the definition of these firmware and nvram
  27737. -files and mapping.
  27738. -
  27739. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  27740. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  27741. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  27742. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  27743. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  27744. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  27745. ----
  27746. -
  27747. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  27748. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  27749. -@@ -27,9 +27,9 @@
  27750. - #define BRCMF_FW_NVRAM_DEVPATH_LEN 19 /* devpath0=pcie/1/4/ */
  27751. - #define BRCMF_FW_NVRAM_PCIEDEV_LEN 10 /* pcie/1/4/ + \0 */
  27752. -
  27753. --char brcmf_firmware_path[BRCMF_FW_PATH_LEN];
  27754. -+static char brcmf_firmware_path[BRCMF_FW_NAME_LEN];
  27755. - module_param_string(alternative_fw_path, brcmf_firmware_path,
  27756. -- BRCMF_FW_PATH_LEN, 0440);
  27757. -+ BRCMF_FW_NAME_LEN, 0440);
  27758. -
  27759. - enum nvram_parser_state {
  27760. - IDLE,
  27761. -@@ -531,3 +531,43 @@ int brcmf_fw_get_firmwares(struct device
  27762. - 0);
  27763. - }
  27764. -
  27765. -+int brcmf_fw_map_chip_to_name(u32 chip, u32 chiprev,
  27766. -+ struct brcmf_firmware_mapping mapping_table[],
  27767. -+ u32 table_size, char fw_name[BRCMF_FW_NAME_LEN],
  27768. -+ char nvram_name[BRCMF_FW_NAME_LEN])
  27769. -+{
  27770. -+ u32 i;
  27771. -+ char end;
  27772. -+
  27773. -+ for (i = 0; i < table_size; i++) {
  27774. -+ if (mapping_table[i].chipid == chip &&
  27775. -+ mapping_table[i].revmask & BIT(chiprev))
  27776. -+ break;
  27777. -+ }
  27778. -+
  27779. -+ if (i == table_size) {
  27780. -+ brcmf_err("Unknown chipid %d [%d]\n", chip, chiprev);
  27781. -+ return -ENODEV;
  27782. -+ }
  27783. -+
  27784. -+ /* check if firmware path is provided by module parameter */
  27785. -+ if (brcmf_firmware_path[0] != '\0') {
  27786. -+ strlcpy(fw_name, brcmf_firmware_path, BRCMF_FW_NAME_LEN);
  27787. -+ if ((nvram_name) && (mapping_table[i].nvram))
  27788. -+ strlcpy(nvram_name, brcmf_firmware_path,
  27789. -+ BRCMF_FW_NAME_LEN);
  27790. -+
  27791. -+ end = brcmf_firmware_path[strlen(brcmf_firmware_path) - 1];
  27792. -+ if (end != '/') {
  27793. -+ strlcat(fw_name, "/", BRCMF_FW_NAME_LEN);
  27794. -+ if ((nvram_name) && (mapping_table[i].nvram))
  27795. -+ strlcat(nvram_name, "/", BRCMF_FW_NAME_LEN);
  27796. -+ }
  27797. -+ }
  27798. -+ strlcat(fw_name, mapping_table[i].fw, BRCMF_FW_NAME_LEN);
  27799. -+ if ((nvram_name) && (mapping_table[i].nvram))
  27800. -+ strlcat(nvram_name, mapping_table[i].nvram, BRCMF_FW_NAME_LEN);
  27801. -+
  27802. -+ return 0;
  27803. -+}
  27804. -+
  27805. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.h
  27806. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.h
  27807. -@@ -21,11 +21,51 @@
  27808. - #define BRCMF_FW_REQ_FLAGS 0x00F0
  27809. - #define BRCMF_FW_REQ_NV_OPTIONAL 0x0010
  27810. -
  27811. --#define BRCMF_FW_PATH_LEN 256
  27812. --#define BRCMF_FW_NAME_LEN 32
  27813. -+#define BRCMF_FW_NAME_LEN 320
  27814. -
  27815. --extern char brcmf_firmware_path[];
  27816. -+#define BRCMF_FW_DEFAULT_PATH "brcm/"
  27817. -
  27818. -+/**
  27819. -+ * struct brcmf_firmware_mapping - Used to map chipid/revmask to firmware
  27820. -+ * filename and nvram filename. Each bus type implementation should create
  27821. -+ * a table of firmware mappings (using the macros defined below).
  27822. -+ *
  27823. -+ * @chipid: ID of chip.
  27824. -+ * @revmask: bitmask of revisions, e.g. 0x10 means rev 4 only, 0xf means rev 0-3
  27825. -+ * @fw: name of the firmware file.
  27826. -+ * @nvram: name of nvram file.
  27827. -+ */
  27828. -+struct brcmf_firmware_mapping {
  27829. -+ u32 chipid;
  27830. -+ u32 revmask;
  27831. -+ const char *fw;
  27832. -+ const char *nvram;
  27833. -+};
  27834. -+
  27835. -+#define BRCMF_FW_NVRAM_DEF(fw_nvram_name, fw, nvram) \
  27836. -+static const char BRCM_ ## fw_nvram_name ## _FIRMWARE_NAME[] = \
  27837. -+ BRCMF_FW_DEFAULT_PATH fw; \
  27838. -+static const char BRCM_ ## fw_nvram_name ## _NVRAM_NAME[] = \
  27839. -+ BRCMF_FW_DEFAULT_PATH nvram; \
  27840. -+MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH fw); \
  27841. -+MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH nvram)
  27842. -+
  27843. -+#define BRCMF_FW_DEF(fw_name, fw) \
  27844. -+static const char BRCM_ ## fw_name ## _FIRMWARE_NAME[] = \
  27845. -+ BRCMF_FW_DEFAULT_PATH fw; \
  27846. -+MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH fw) \
  27847. -+
  27848. -+#define BRCMF_FW_NVRAM_ENTRY(chipid, mask, name) \
  27849. -+ { chipid, mask, \
  27850. -+ BRCM_ ## name ## _FIRMWARE_NAME, BRCM_ ## name ## _NVRAM_NAME }
  27851. -+
  27852. -+#define BRCMF_FW_ENTRY(chipid, mask, name) \
  27853. -+ { chipid, mask, BRCM_ ## name ## _FIRMWARE_NAME, NULL }
  27854. -+
  27855. -+int brcmf_fw_map_chip_to_name(u32 chip, u32 chiprev,
  27856. -+ struct brcmf_firmware_mapping mapping_table[],
  27857. -+ u32 table_size, char fw_name[BRCMF_FW_NAME_LEN],
  27858. -+ char nvram_name[BRCMF_FW_NAME_LEN]);
  27859. - void brcmf_fw_nvram_free(void *nvram);
  27860. - /*
  27861. - * Request firmware(s) asynchronously. When the asynchronous request
  27862. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  27863. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  27864. -@@ -44,25 +44,29 @@ enum brcmf_pcie_state {
  27865. - BRCMFMAC_PCIE_STATE_UP
  27866. - };
  27867. -
  27868. --
  27869. --#define BRCMF_PCIE_43602_FW_NAME "brcm/brcmfmac43602-pcie.bin"
  27870. --#define BRCMF_PCIE_43602_NVRAM_NAME "brcm/brcmfmac43602-pcie.txt"
  27871. --#define BRCMF_PCIE_4350_FW_NAME "brcm/brcmfmac4350-pcie.bin"
  27872. --#define BRCMF_PCIE_4350_NVRAM_NAME "brcm/brcmfmac4350-pcie.txt"
  27873. --#define BRCMF_PCIE_4356_FW_NAME "brcm/brcmfmac4356-pcie.bin"
  27874. --#define BRCMF_PCIE_4356_NVRAM_NAME "brcm/brcmfmac4356-pcie.txt"
  27875. --#define BRCMF_PCIE_43570_FW_NAME "brcm/brcmfmac43570-pcie.bin"
  27876. --#define BRCMF_PCIE_43570_NVRAM_NAME "brcm/brcmfmac43570-pcie.txt"
  27877. --#define BRCMF_PCIE_4358_FW_NAME "brcm/brcmfmac4358-pcie.bin"
  27878. --#define BRCMF_PCIE_4358_NVRAM_NAME "brcm/brcmfmac4358-pcie.txt"
  27879. --#define BRCMF_PCIE_4359_FW_NAME "brcm/brcmfmac4359-pcie.bin"
  27880. --#define BRCMF_PCIE_4359_NVRAM_NAME "brcm/brcmfmac4359-pcie.txt"
  27881. --#define BRCMF_PCIE_4365_FW_NAME "brcm/brcmfmac4365b-pcie.bin"
  27882. --#define BRCMF_PCIE_4365_NVRAM_NAME "brcm/brcmfmac4365b-pcie.txt"
  27883. --#define BRCMF_PCIE_4366_FW_NAME "brcm/brcmfmac4366b-pcie.bin"
  27884. --#define BRCMF_PCIE_4366_NVRAM_NAME "brcm/brcmfmac4366b-pcie.txt"
  27885. --#define BRCMF_PCIE_4371_FW_NAME "brcm/brcmfmac4371-pcie.bin"
  27886. --#define BRCMF_PCIE_4371_NVRAM_NAME "brcm/brcmfmac4371-pcie.txt"
  27887. -+BRCMF_FW_NVRAM_DEF(43602, "brcmfmac43602-pcie.bin", "brcmfmac43602-pcie.txt");
  27888. -+BRCMF_FW_NVRAM_DEF(4350, "brcmfmac4350-pcie.bin", "brcmfmac4350-pcie.txt");
  27889. -+BRCMF_FW_NVRAM_DEF(4356, "brcmfmac4356-pcie.bin", "brcmfmac4356-pcie.txt");
  27890. -+BRCMF_FW_NVRAM_DEF(43570, "brcmfmac43570-pcie.bin", "brcmfmac43570-pcie.txt");
  27891. -+BRCMF_FW_NVRAM_DEF(4358, "brcmfmac4358-pcie.bin", "brcmfmac4358-pcie.txt");
  27892. -+BRCMF_FW_NVRAM_DEF(4359, "brcmfmac4359-pcie.bin", "brcmfmac4359-pcie.txt");
  27893. -+BRCMF_FW_NVRAM_DEF(4365B, "brcmfmac4365b-pcie.bin", "brcmfmac4365b-pcie.txt");
  27894. -+BRCMF_FW_NVRAM_DEF(4366B, "brcmfmac4366b-pcie.bin", "brcmfmac4366b-pcie.txt");
  27895. -+BRCMF_FW_NVRAM_DEF(4371, "brcmfmac4371-pcie.bin", "brcmfmac4371-pcie.txt");
  27896. -+
  27897. -+static struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = {
  27898. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43602_CHIP_ID, 0xFFFFFFFF, 43602),
  27899. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4350_CHIP_ID, 0xFFFFFFFF, 4350),
  27900. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4356_CHIP_ID, 0xFFFFFFFF, 4356),
  27901. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43567_CHIP_ID, 0xFFFFFFFF, 43570),
  27902. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43569_CHIP_ID, 0xFFFFFFFF, 43570),
  27903. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43570_CHIP_ID, 0xFFFFFFFF, 43570),
  27904. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4358_CHIP_ID, 0xFFFFFFFF, 4358),
  27905. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4359_CHIP_ID, 0xFFFFFFFF, 4359),
  27906. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4365_CHIP_ID, 0xFFFFFFFF, 4365B),
  27907. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0xFFFFFFFF, 4366B),
  27908. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4371_CHIP_ID, 0xFFFFFFFF, 4371),
  27909. -+};
  27910. -
  27911. - #define BRCMF_PCIE_FW_UP_TIMEOUT 2000 /* msec */
  27912. -
  27913. -@@ -202,26 +206,6 @@ enum brcmf_pcie_state {
  27914. - #define BRCMF_PCIE_LINK_STATUS_CTRL_ASPM_ENAB 3
  27915. -
  27916. -
  27917. --MODULE_FIRMWARE(BRCMF_PCIE_43602_FW_NAME);
  27918. --MODULE_FIRMWARE(BRCMF_PCIE_43602_NVRAM_NAME);
  27919. --MODULE_FIRMWARE(BRCMF_PCIE_4350_FW_NAME);
  27920. --MODULE_FIRMWARE(BRCMF_PCIE_4350_NVRAM_NAME);
  27921. --MODULE_FIRMWARE(BRCMF_PCIE_4356_FW_NAME);
  27922. --MODULE_FIRMWARE(BRCMF_PCIE_4356_NVRAM_NAME);
  27923. --MODULE_FIRMWARE(BRCMF_PCIE_43570_FW_NAME);
  27924. --MODULE_FIRMWARE(BRCMF_PCIE_43570_NVRAM_NAME);
  27925. --MODULE_FIRMWARE(BRCMF_PCIE_4358_FW_NAME);
  27926. --MODULE_FIRMWARE(BRCMF_PCIE_4358_NVRAM_NAME);
  27927. --MODULE_FIRMWARE(BRCMF_PCIE_4359_FW_NAME);
  27928. --MODULE_FIRMWARE(BRCMF_PCIE_4359_NVRAM_NAME);
  27929. --MODULE_FIRMWARE(BRCMF_PCIE_4365_FW_NAME);
  27930. --MODULE_FIRMWARE(BRCMF_PCIE_4365_NVRAM_NAME);
  27931. --MODULE_FIRMWARE(BRCMF_PCIE_4366_FW_NAME);
  27932. --MODULE_FIRMWARE(BRCMF_PCIE_4366_NVRAM_NAME);
  27933. --MODULE_FIRMWARE(BRCMF_PCIE_4371_FW_NAME);
  27934. --MODULE_FIRMWARE(BRCMF_PCIE_4371_NVRAM_NAME);
  27935. --
  27936. --
  27937. - struct brcmf_pcie_console {
  27938. - u32 base_addr;
  27939. - u32 buf_addr;
  27940. -@@ -258,8 +242,8 @@ struct brcmf_pciedev_info {
  27941. - enum brcmf_pcie_state state;
  27942. - bool in_irq;
  27943. - struct pci_dev *pdev;
  27944. -- char fw_name[BRCMF_FW_PATH_LEN + BRCMF_FW_NAME_LEN];
  27945. -- char nvram_name[BRCMF_FW_PATH_LEN + BRCMF_FW_NAME_LEN];
  27946. -+ char fw_name[BRCMF_FW_NAME_LEN];
  27947. -+ char nvram_name[BRCMF_FW_NAME_LEN];
  27948. - void __iomem *regs;
  27949. - void __iomem *tcm;
  27950. - u32 tcm_size;
  27951. -@@ -1478,84 +1462,6 @@ brcmf_pcie_init_share_ram_info(struct br
  27952. - }
  27953. -
  27954. -
  27955. --static int brcmf_pcie_get_fwnames(struct brcmf_pciedev_info *devinfo)
  27956. --{
  27957. -- char *fw_name;
  27958. -- char *nvram_name;
  27959. -- uint fw_len, nv_len;
  27960. -- char end;
  27961. --
  27962. -- brcmf_dbg(PCIE, "Enter, chip 0x%04x chiprev %d\n", devinfo->ci->chip,
  27963. -- devinfo->ci->chiprev);
  27964. --
  27965. -- switch (devinfo->ci->chip) {
  27966. -- case BRCM_CC_43602_CHIP_ID:
  27967. -- fw_name = BRCMF_PCIE_43602_FW_NAME;
  27968. -- nvram_name = BRCMF_PCIE_43602_NVRAM_NAME;
  27969. -- break;
  27970. -- case BRCM_CC_4350_CHIP_ID:
  27971. -- fw_name = BRCMF_PCIE_4350_FW_NAME;
  27972. -- nvram_name = BRCMF_PCIE_4350_NVRAM_NAME;
  27973. -- break;
  27974. -- case BRCM_CC_4356_CHIP_ID:
  27975. -- fw_name = BRCMF_PCIE_4356_FW_NAME;
  27976. -- nvram_name = BRCMF_PCIE_4356_NVRAM_NAME;
  27977. -- break;
  27978. -- case BRCM_CC_43567_CHIP_ID:
  27979. -- case BRCM_CC_43569_CHIP_ID:
  27980. -- case BRCM_CC_43570_CHIP_ID:
  27981. -- fw_name = BRCMF_PCIE_43570_FW_NAME;
  27982. -- nvram_name = BRCMF_PCIE_43570_NVRAM_NAME;
  27983. -- break;
  27984. -- case BRCM_CC_4358_CHIP_ID:
  27985. -- fw_name = BRCMF_PCIE_4358_FW_NAME;
  27986. -- nvram_name = BRCMF_PCIE_4358_NVRAM_NAME;
  27987. -- break;
  27988. -- case BRCM_CC_4359_CHIP_ID:
  27989. -- fw_name = BRCMF_PCIE_4359_FW_NAME;
  27990. -- nvram_name = BRCMF_PCIE_4359_NVRAM_NAME;
  27991. -- break;
  27992. -- case BRCM_CC_4365_CHIP_ID:
  27993. -- fw_name = BRCMF_PCIE_4365_FW_NAME;
  27994. -- nvram_name = BRCMF_PCIE_4365_NVRAM_NAME;
  27995. -- break;
  27996. -- case BRCM_CC_4366_CHIP_ID:
  27997. -- fw_name = BRCMF_PCIE_4366_FW_NAME;
  27998. -- nvram_name = BRCMF_PCIE_4366_NVRAM_NAME;
  27999. -- break;
  28000. -- case BRCM_CC_4371_CHIP_ID:
  28001. -- fw_name = BRCMF_PCIE_4371_FW_NAME;
  28002. -- nvram_name = BRCMF_PCIE_4371_NVRAM_NAME;
  28003. -- break;
  28004. -- default:
  28005. -- brcmf_err("Unsupported chip 0x%04x\n", devinfo->ci->chip);
  28006. -- return -ENODEV;
  28007. -- }
  28008. --
  28009. -- fw_len = sizeof(devinfo->fw_name) - 1;
  28010. -- nv_len = sizeof(devinfo->nvram_name) - 1;
  28011. -- /* check if firmware path is provided by module parameter */
  28012. -- if (brcmf_firmware_path[0] != '\0') {
  28013. -- strncpy(devinfo->fw_name, brcmf_firmware_path, fw_len);
  28014. -- strncpy(devinfo->nvram_name, brcmf_firmware_path, nv_len);
  28015. -- fw_len -= strlen(devinfo->fw_name);
  28016. -- nv_len -= strlen(devinfo->nvram_name);
  28017. --
  28018. -- end = brcmf_firmware_path[strlen(brcmf_firmware_path) - 1];
  28019. -- if (end != '/') {
  28020. -- strncat(devinfo->fw_name, "/", fw_len);
  28021. -- strncat(devinfo->nvram_name, "/", nv_len);
  28022. -- fw_len--;
  28023. -- nv_len--;
  28024. -- }
  28025. -- }
  28026. -- strncat(devinfo->fw_name, fw_name, fw_len);
  28027. -- strncat(devinfo->nvram_name, nvram_name, nv_len);
  28028. --
  28029. -- return 0;
  28030. --}
  28031. --
  28032. --
  28033. - static int brcmf_pcie_download_fw_nvram(struct brcmf_pciedev_info *devinfo,
  28034. - const struct firmware *fw, void *nvram,
  28035. - u32 nvram_len)
  28036. -@@ -1891,7 +1797,10 @@ brcmf_pcie_probe(struct pci_dev *pdev, c
  28037. - bus->wowl_supported = pci_pme_capable(pdev, PCI_D3hot);
  28038. - dev_set_drvdata(&pdev->dev, bus);
  28039. -
  28040. -- ret = brcmf_pcie_get_fwnames(devinfo);
  28041. -+ ret = brcmf_fw_map_chip_to_name(devinfo->ci->chip, devinfo->ci->chiprev,
  28042. -+ brcmf_pcie_fwnames,
  28043. -+ ARRAY_SIZE(brcmf_pcie_fwnames),
  28044. -+ devinfo->fw_name, devinfo->nvram_name);
  28045. - if (ret)
  28046. - goto fail_bus;
  28047. -
  28048. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  28049. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  28050. -@@ -596,136 +596,41 @@ static const struct sdiod_drive_str sdio
  28051. - {4, 0x1}
  28052. - };
  28053. -
  28054. --#define BCM43143_FIRMWARE_NAME "brcm/brcmfmac43143-sdio.bin"
  28055. --#define BCM43143_NVRAM_NAME "brcm/brcmfmac43143-sdio.txt"
  28056. --#define BCM43241B0_FIRMWARE_NAME "brcm/brcmfmac43241b0-sdio.bin"
  28057. --#define BCM43241B0_NVRAM_NAME "brcm/brcmfmac43241b0-sdio.txt"
  28058. --#define BCM43241B4_FIRMWARE_NAME "brcm/brcmfmac43241b4-sdio.bin"
  28059. --#define BCM43241B4_NVRAM_NAME "brcm/brcmfmac43241b4-sdio.txt"
  28060. --#define BCM43241B5_FIRMWARE_NAME "brcm/brcmfmac43241b5-sdio.bin"
  28061. --#define BCM43241B5_NVRAM_NAME "brcm/brcmfmac43241b5-sdio.txt"
  28062. --#define BCM4329_FIRMWARE_NAME "brcm/brcmfmac4329-sdio.bin"
  28063. --#define BCM4329_NVRAM_NAME "brcm/brcmfmac4329-sdio.txt"
  28064. --#define BCM4330_FIRMWARE_NAME "brcm/brcmfmac4330-sdio.bin"
  28065. --#define BCM4330_NVRAM_NAME "brcm/brcmfmac4330-sdio.txt"
  28066. --#define BCM4334_FIRMWARE_NAME "brcm/brcmfmac4334-sdio.bin"
  28067. --#define BCM4334_NVRAM_NAME "brcm/brcmfmac4334-sdio.txt"
  28068. --#define BCM43340_FIRMWARE_NAME "brcm/brcmfmac43340-sdio.bin"
  28069. --#define BCM43340_NVRAM_NAME "brcm/brcmfmac43340-sdio.txt"
  28070. --#define BCM4335_FIRMWARE_NAME "brcm/brcmfmac4335-sdio.bin"
  28071. --#define BCM4335_NVRAM_NAME "brcm/brcmfmac4335-sdio.txt"
  28072. --#define BCM43362_FIRMWARE_NAME "brcm/brcmfmac43362-sdio.bin"
  28073. --#define BCM43362_NVRAM_NAME "brcm/brcmfmac43362-sdio.txt"
  28074. --#define BCM4339_FIRMWARE_NAME "brcm/brcmfmac4339-sdio.bin"
  28075. --#define BCM4339_NVRAM_NAME "brcm/brcmfmac4339-sdio.txt"
  28076. --#define BCM43430_FIRMWARE_NAME "brcm/brcmfmac43430-sdio.bin"
  28077. --#define BCM43430_NVRAM_NAME "brcm/brcmfmac43430-sdio.txt"
  28078. --#define BCM43455_FIRMWARE_NAME "brcm/brcmfmac43455-sdio.bin"
  28079. --#define BCM43455_NVRAM_NAME "brcm/brcmfmac43455-sdio.txt"
  28080. --#define BCM4354_FIRMWARE_NAME "brcm/brcmfmac4354-sdio.bin"
  28081. --#define BCM4354_NVRAM_NAME "brcm/brcmfmac4354-sdio.txt"
  28082. --
  28083. --MODULE_FIRMWARE(BCM43143_FIRMWARE_NAME);
  28084. --MODULE_FIRMWARE(BCM43143_NVRAM_NAME);
  28085. --MODULE_FIRMWARE(BCM43241B0_FIRMWARE_NAME);
  28086. --MODULE_FIRMWARE(BCM43241B0_NVRAM_NAME);
  28087. --MODULE_FIRMWARE(BCM43241B4_FIRMWARE_NAME);
  28088. --MODULE_FIRMWARE(BCM43241B4_NVRAM_NAME);
  28089. --MODULE_FIRMWARE(BCM43241B5_FIRMWARE_NAME);
  28090. --MODULE_FIRMWARE(BCM43241B5_NVRAM_NAME);
  28091. --MODULE_FIRMWARE(BCM4329_FIRMWARE_NAME);
  28092. --MODULE_FIRMWARE(BCM4329_NVRAM_NAME);
  28093. --MODULE_FIRMWARE(BCM4330_FIRMWARE_NAME);
  28094. --MODULE_FIRMWARE(BCM4330_NVRAM_NAME);
  28095. --MODULE_FIRMWARE(BCM4334_FIRMWARE_NAME);
  28096. --MODULE_FIRMWARE(BCM4334_NVRAM_NAME);
  28097. --MODULE_FIRMWARE(BCM43340_FIRMWARE_NAME);
  28098. --MODULE_FIRMWARE(BCM43340_NVRAM_NAME);
  28099. --MODULE_FIRMWARE(BCM4335_FIRMWARE_NAME);
  28100. --MODULE_FIRMWARE(BCM4335_NVRAM_NAME);
  28101. --MODULE_FIRMWARE(BCM43362_FIRMWARE_NAME);
  28102. --MODULE_FIRMWARE(BCM43362_NVRAM_NAME);
  28103. --MODULE_FIRMWARE(BCM4339_FIRMWARE_NAME);
  28104. --MODULE_FIRMWARE(BCM4339_NVRAM_NAME);
  28105. --MODULE_FIRMWARE(BCM43430_FIRMWARE_NAME);
  28106. --MODULE_FIRMWARE(BCM43430_NVRAM_NAME);
  28107. --MODULE_FIRMWARE(BCM43455_FIRMWARE_NAME);
  28108. --MODULE_FIRMWARE(BCM43455_NVRAM_NAME);
  28109. --MODULE_FIRMWARE(BCM4354_FIRMWARE_NAME);
  28110. --MODULE_FIRMWARE(BCM4354_NVRAM_NAME);
  28111. --
  28112. --struct brcmf_firmware_names {
  28113. -- u32 chipid;
  28114. -- u32 revmsk;
  28115. -- const char *bin;
  28116. -- const char *nv;
  28117. -+BRCMF_FW_NVRAM_DEF(43143, "brcmfmac43143-sdio.bin", "brcmfmac43143-sdio.txt");
  28118. -+BRCMF_FW_NVRAM_DEF(43241B0, "brcmfmac43241b0-sdio.bin",
  28119. -+ "brcmfmac43241b0-sdio.txt");
  28120. -+BRCMF_FW_NVRAM_DEF(43241B4, "brcmfmac43241b4-sdio.bin",
  28121. -+ "brcmfmac43241b4-sdio.txt");
  28122. -+BRCMF_FW_NVRAM_DEF(43241B5, "brcmfmac43241b5-sdio.bin",
  28123. -+ "brcmfmac43241b5-sdio.txt");
  28124. -+BRCMF_FW_NVRAM_DEF(4329, "brcmfmac4329-sdio.bin", "brcmfmac4329-sdio.txt");
  28125. -+BRCMF_FW_NVRAM_DEF(4330, "brcmfmac4330-sdio.bin", "brcmfmac4330-sdio.txt");
  28126. -+BRCMF_FW_NVRAM_DEF(4334, "brcmfmac4334-sdio.bin", "brcmfmac4334-sdio.txt");
  28127. -+BRCMF_FW_NVRAM_DEF(43340, "brcmfmac43340-sdio.bin", "brcmfmac43340-sdio.txt");
  28128. -+BRCMF_FW_NVRAM_DEF(4335, "brcmfmac4335-sdio.bin", "brcmfmac4335-sdio.txt");
  28129. -+BRCMF_FW_NVRAM_DEF(43362, "brcmfmac43362-sdio.bin", "brcmfmac43362-sdio.txt");
  28130. -+BRCMF_FW_NVRAM_DEF(4339, "brcmfmac4339-sdio.bin", "brcmfmac4339-sdio.txt");
  28131. -+BRCMF_FW_NVRAM_DEF(43430, "brcmfmac43430-sdio.bin", "brcmfmac43430-sdio.txt");
  28132. -+BRCMF_FW_NVRAM_DEF(43455, "brcmfmac43455-sdio.bin", "brcmfmac43455-sdio.txt");
  28133. -+BRCMF_FW_NVRAM_DEF(4354, "brcmfmac4354-sdio.bin", "brcmfmac4354-sdio.txt");
  28134. -+
  28135. -+static struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = {
  28136. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143),
  28137. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43241_CHIP_ID, 0x0000001F, 43241B0),
  28138. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43241_CHIP_ID, 0x00000020, 43241B4),
  28139. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43241_CHIP_ID, 0xFFFFFFC0, 43241B5),
  28140. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4329_CHIP_ID, 0xFFFFFFFF, 4329),
  28141. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4330_CHIP_ID, 0xFFFFFFFF, 4330),
  28142. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, 4334),
  28143. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43340_CHIP_ID, 0xFFFFFFFF, 43340),
  28144. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, 4335),
  28145. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, 43362),
  28146. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, 4339),
  28147. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43430_CHIP_ID, 0xFFFFFFFF, 43430),
  28148. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4345_CHIP_ID, 0xFFFFFFC0, 43455),
  28149. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, 4354)
  28150. - };
  28151. -
  28152. --enum brcmf_firmware_type {
  28153. -- BRCMF_FIRMWARE_BIN,
  28154. -- BRCMF_FIRMWARE_NVRAM
  28155. --};
  28156. --
  28157. --#define BRCMF_FIRMWARE_NVRAM(name) \
  28158. -- name ## _FIRMWARE_NAME, name ## _NVRAM_NAME
  28159. --
  28160. --static const struct brcmf_firmware_names brcmf_fwname_data[] = {
  28161. -- { BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM43143) },
  28162. -- { BRCM_CC_43241_CHIP_ID, 0x0000001F, BRCMF_FIRMWARE_NVRAM(BCM43241B0) },
  28163. -- { BRCM_CC_43241_CHIP_ID, 0x00000020, BRCMF_FIRMWARE_NVRAM(BCM43241B4) },
  28164. -- { BRCM_CC_43241_CHIP_ID, 0xFFFFFFC0, BRCMF_FIRMWARE_NVRAM(BCM43241B5) },
  28165. -- { BRCM_CC_4329_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4329) },
  28166. -- { BRCM_CC_4330_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4330) },
  28167. -- { BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4334) },
  28168. -- { BRCM_CC_43340_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM43340) },
  28169. -- { BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4335) },
  28170. -- { BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, BRCMF_FIRMWARE_NVRAM(BCM43362) },
  28171. -- { BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4339) },
  28172. -- { BRCM_CC_43430_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM43430) },
  28173. -- { BRCM_CC_4345_CHIP_ID, 0xFFFFFFC0, BRCMF_FIRMWARE_NVRAM(BCM43455) },
  28174. -- { BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4354) }
  28175. --};
  28176. --
  28177. --static int brcmf_sdio_get_fwnames(struct brcmf_chip *ci,
  28178. -- struct brcmf_sdio_dev *sdiodev)
  28179. --{
  28180. -- int i;
  28181. -- char end;
  28182. --
  28183. -- for (i = 0; i < ARRAY_SIZE(brcmf_fwname_data); i++) {
  28184. -- if (brcmf_fwname_data[i].chipid == ci->chip &&
  28185. -- brcmf_fwname_data[i].revmsk & BIT(ci->chiprev))
  28186. -- break;
  28187. -- }
  28188. --
  28189. -- if (i == ARRAY_SIZE(brcmf_fwname_data)) {
  28190. -- brcmf_err("Unknown chipid %d [%d]\n", ci->chip, ci->chiprev);
  28191. -- return -ENODEV;
  28192. -- }
  28193. --
  28194. -- /* check if firmware path is provided by module parameter */
  28195. -- if (brcmf_firmware_path[0] != '\0') {
  28196. -- strlcpy(sdiodev->fw_name, brcmf_firmware_path,
  28197. -- sizeof(sdiodev->fw_name));
  28198. -- strlcpy(sdiodev->nvram_name, brcmf_firmware_path,
  28199. -- sizeof(sdiodev->nvram_name));
  28200. --
  28201. -- end = brcmf_firmware_path[strlen(brcmf_firmware_path) - 1];
  28202. -- if (end != '/') {
  28203. -- strlcat(sdiodev->fw_name, "/",
  28204. -- sizeof(sdiodev->fw_name));
  28205. -- strlcat(sdiodev->nvram_name, "/",
  28206. -- sizeof(sdiodev->nvram_name));
  28207. -- }
  28208. -- }
  28209. -- strlcat(sdiodev->fw_name, brcmf_fwname_data[i].bin,
  28210. -- sizeof(sdiodev->fw_name));
  28211. -- strlcat(sdiodev->nvram_name, brcmf_fwname_data[i].nv,
  28212. -- sizeof(sdiodev->nvram_name));
  28213. --
  28214. -- return 0;
  28215. --}
  28216. --
  28217. - static void pkt_align(struct sk_buff *p, int len, int align)
  28218. - {
  28219. - uint datalign;
  28220. -@@ -4252,7 +4157,10 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
  28221. - brcmf_sdio_debugfs_create(bus);
  28222. - brcmf_dbg(INFO, "completed!!\n");
  28223. -
  28224. -- ret = brcmf_sdio_get_fwnames(bus->ci, sdiodev);
  28225. -+ ret = brcmf_fw_map_chip_to_name(bus->ci->chip, bus->ci->chiprev,
  28226. -+ brcmf_sdio_fwnames,
  28227. -+ ARRAY_SIZE(brcmf_sdio_fwnames),
  28228. -+ sdiodev->fw_name, sdiodev->nvram_name);
  28229. - if (ret)
  28230. - goto fail;
  28231. -
  28232. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.h
  28233. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.h
  28234. -@@ -195,8 +195,8 @@ struct brcmf_sdio_dev {
  28235. - uint max_segment_size;
  28236. - uint txglomsz;
  28237. - struct sg_table sgtable;
  28238. -- char fw_name[BRCMF_FW_PATH_LEN + BRCMF_FW_NAME_LEN];
  28239. -- char nvram_name[BRCMF_FW_PATH_LEN + BRCMF_FW_NAME_LEN];
  28240. -+ char fw_name[BRCMF_FW_NAME_LEN];
  28241. -+ char nvram_name[BRCMF_FW_NAME_LEN];
  28242. - bool wowl_enabled;
  28243. - enum brcmf_sdiod_state state;
  28244. - struct brcmf_sdiod_freezer *freezer;
  28245. ---- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  28246. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  28247. -@@ -43,10 +43,20 @@
  28248. - #define BRCMF_USB_CBCTL_READ 1
  28249. - #define BRCMF_USB_MAX_PKT_SIZE 1600
  28250. -
  28251. --#define BRCMF_USB_43143_FW_NAME "brcm/brcmfmac43143.bin"
  28252. --#define BRCMF_USB_43236_FW_NAME "brcm/brcmfmac43236b.bin"
  28253. --#define BRCMF_USB_43242_FW_NAME "brcm/brcmfmac43242a.bin"
  28254. --#define BRCMF_USB_43569_FW_NAME "brcm/brcmfmac43569.bin"
  28255. -+BRCMF_FW_DEF(43143, "brcmfmac43143.bin");
  28256. -+BRCMF_FW_DEF(43236B, "brcmfmac43236b.bin");
  28257. -+BRCMF_FW_DEF(43242A, "brcmfmac43242a.bin");
  28258. -+BRCMF_FW_DEF(43569, "brcmfmac43569.bin");
  28259. -+
  28260. -+static struct brcmf_firmware_mapping brcmf_usb_fwnames[] = {
  28261. -+ BRCMF_FW_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143),
  28262. -+ BRCMF_FW_ENTRY(BRCM_CC_43235_CHIP_ID, 0x00000008, 43236B),
  28263. -+ BRCMF_FW_ENTRY(BRCM_CC_43236_CHIP_ID, 0x00000008, 43236B),
  28264. -+ BRCMF_FW_ENTRY(BRCM_CC_43238_CHIP_ID, 0x00000008, 43236B),
  28265. -+ BRCMF_FW_ENTRY(BRCM_CC_43242_CHIP_ID, 0xFFFFFFFF, 43242A),
  28266. -+ BRCMF_FW_ENTRY(BRCM_CC_43566_CHIP_ID, 0xFFFFFFFF, 43569),
  28267. -+ BRCMF_FW_ENTRY(BRCM_CC_43569_CHIP_ID, 0xFFFFFFFF, 43569)
  28268. -+};
  28269. -
  28270. - #define TRX_MAGIC 0x30524448 /* "HDR0" */
  28271. - #define TRX_MAX_OFFSET 3 /* Max number of file offsets */
  28272. -@@ -139,6 +149,7 @@ struct brcmf_usbdev_info {
  28273. - struct brcmf_usbreq *tx_reqs;
  28274. - struct brcmf_usbreq *rx_reqs;
  28275. -
  28276. -+ char fw_name[BRCMF_FW_NAME_LEN];
  28277. - const u8 *image; /* buffer for combine fw and nvram */
  28278. - int image_len;
  28279. -
  28280. -@@ -983,45 +994,15 @@ static int brcmf_usb_dlrun(struct brcmf_
  28281. - return 0;
  28282. - }
  28283. -
  28284. --static bool brcmf_usb_chip_support(int chipid, int chiprev)
  28285. --{
  28286. -- switch(chipid) {
  28287. -- case BRCM_CC_43143_CHIP_ID:
  28288. -- return true;
  28289. -- case BRCM_CC_43235_CHIP_ID:
  28290. -- case BRCM_CC_43236_CHIP_ID:
  28291. -- case BRCM_CC_43238_CHIP_ID:
  28292. -- return (chiprev == 3);
  28293. -- case BRCM_CC_43242_CHIP_ID:
  28294. -- return true;
  28295. -- case BRCM_CC_43566_CHIP_ID:
  28296. -- case BRCM_CC_43569_CHIP_ID:
  28297. -- return true;
  28298. -- default:
  28299. -- break;
  28300. -- }
  28301. -- return false;
  28302. --}
  28303. --
  28304. - static int
  28305. - brcmf_usb_fw_download(struct brcmf_usbdev_info *devinfo)
  28306. - {
  28307. -- int devid, chiprev;
  28308. - int err;
  28309. -
  28310. - brcmf_dbg(USB, "Enter\n");
  28311. - if (devinfo == NULL)
  28312. - return -ENODEV;
  28313. -
  28314. -- devid = devinfo->bus_pub.devid;
  28315. -- chiprev = devinfo->bus_pub.chiprev;
  28316. --
  28317. -- if (!brcmf_usb_chip_support(devid, chiprev)) {
  28318. -- brcmf_err("unsupported chip %d rev %d\n",
  28319. -- devid, chiprev);
  28320. -- return -EINVAL;
  28321. -- }
  28322. --
  28323. - if (!devinfo->image) {
  28324. - brcmf_err("No firmware!\n");
  28325. - return -ENOENT;
  28326. -@@ -1071,25 +1052,6 @@ static int check_file(const u8 *headers)
  28327. - return -1;
  28328. - }
  28329. -
  28330. --static const char *brcmf_usb_get_fwname(struct brcmf_usbdev_info *devinfo)
  28331. --{
  28332. -- switch (devinfo->bus_pub.devid) {
  28333. -- case BRCM_CC_43143_CHIP_ID:
  28334. -- return BRCMF_USB_43143_FW_NAME;
  28335. -- case BRCM_CC_43235_CHIP_ID:
  28336. -- case BRCM_CC_43236_CHIP_ID:
  28337. -- case BRCM_CC_43238_CHIP_ID:
  28338. -- return BRCMF_USB_43236_FW_NAME;
  28339. -- case BRCM_CC_43242_CHIP_ID:
  28340. -- return BRCMF_USB_43242_FW_NAME;
  28341. -- case BRCM_CC_43566_CHIP_ID:
  28342. -- case BRCM_CC_43569_CHIP_ID:
  28343. -- return BRCMF_USB_43569_FW_NAME;
  28344. -- default:
  28345. -- return NULL;
  28346. -- }
  28347. --}
  28348. --
  28349. -
  28350. - static
  28351. - struct brcmf_usbdev *brcmf_usb_attach(struct brcmf_usbdev_info *devinfo,
  28352. -@@ -1274,9 +1236,16 @@ static int brcmf_usb_probe_cb(struct brc
  28353. - bus->chip = bus_pub->devid;
  28354. - bus->chiprev = bus_pub->chiprev;
  28355. -
  28356. -+ ret = brcmf_fw_map_chip_to_name(bus_pub->devid, bus_pub->chiprev,
  28357. -+ brcmf_usb_fwnames,
  28358. -+ ARRAY_SIZE(brcmf_usb_fwnames),
  28359. -+ devinfo->fw_name, NULL);
  28360. -+ if (ret)
  28361. -+ goto fail;
  28362. -+
  28363. - /* request firmware here */
  28364. -- ret = brcmf_fw_get_firmwares(dev, 0, brcmf_usb_get_fwname(devinfo),
  28365. -- NULL, brcmf_usb_probe_phase2);
  28366. -+ ret = brcmf_fw_get_firmwares(dev, 0, devinfo->fw_name, NULL,
  28367. -+ brcmf_usb_probe_phase2);
  28368. - if (ret) {
  28369. - brcmf_err("firmware request failed: %d\n", ret);
  28370. - goto fail;
  28371. -@@ -1472,8 +1441,7 @@ static int brcmf_usb_reset_resume(struct
  28372. -
  28373. - brcmf_dbg(USB, "Enter\n");
  28374. -
  28375. -- return brcmf_fw_get_firmwares(&usb->dev, 0,
  28376. -- brcmf_usb_get_fwname(devinfo), NULL,
  28377. -+ return brcmf_fw_get_firmwares(&usb->dev, 0, devinfo->fw_name, NULL,
  28378. - brcmf_usb_probe_phase2);
  28379. - }
  28380. -
  28381. -@@ -1491,10 +1459,6 @@ static struct usb_device_id brcmf_usb_de
  28382. - };
  28383. -
  28384. - MODULE_DEVICE_TABLE(usb, brcmf_usb_devid_table);
  28385. --MODULE_FIRMWARE(BRCMF_USB_43143_FW_NAME);
  28386. --MODULE_FIRMWARE(BRCMF_USB_43236_FW_NAME);
  28387. --MODULE_FIRMWARE(BRCMF_USB_43242_FW_NAME);
  28388. --MODULE_FIRMWARE(BRCMF_USB_43569_FW_NAME);
  28389. -
  28390. - static struct usb_driver brcmf_usbdrvr = {
  28391. - .name = KBUILD_MODNAME,
  28392. 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
  28393. deleted file mode 100644
  28394. index 2174d09..0000000
  28395. --- a/package/kernel/mac80211/patches/376-0010-brcmfmac-Fix-double-free-on-exception-at-module-load.patch
  28396. +++ /dev/null
  28397. @@ -1,22 +0,0 @@
  28398. -From: Hante Meuleman <meuleman@broadcom.com>
  28399. -Date: Wed, 25 Nov 2015 11:32:47 +0100
  28400. -Subject: [PATCH] brcmfmac: Fix double free on exception at module load.
  28401. -
  28402. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  28403. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  28404. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  28405. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  28406. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  28407. ----
  28408. -
  28409. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  28410. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  28411. -@@ -1083,6 +1083,8 @@ fail:
  28412. - brcmf_net_detach(ifp->ndev);
  28413. - if (p2p_ifp)
  28414. - brcmf_net_detach(p2p_ifp->ndev);
  28415. -+ drvr->iflist[0] = NULL;
  28416. -+ drvr->iflist[1] = NULL;
  28417. - return ret;
  28418. - }
  28419. - return 0;
  28420. 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
  28421. deleted file mode 100644
  28422. index 8ec1441..0000000
  28423. --- a/package/kernel/mac80211/patches/377-brcmfmac-only-lock-and-unlock-fws-if-fws-is-not-null.patch
  28424. +++ /dev/null
  28425. @@ -1,30 +0,0 @@
  28426. -From: Colin Ian King <colin.king@canonical.com>
  28427. -Date: Wed, 2 Dec 2015 11:45:10 +0000
  28428. -Subject: [PATCH] brcmfmac: only lock and unlock fws if fws is not null
  28429. -
  28430. -There is a null ptr check for fws to set bcmc_credit_check, however,
  28431. -there a lock and unlock on fws should only performed if fwts is
  28432. -also not null to also avoid a potential null pointer deference.
  28433. -
  28434. -Signed-off-by: Colin Ian King <colin.king@canonical.com>
  28435. -Acked-by: Arend van Spriel <arend@broadcom.com>
  28436. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  28437. ----
  28438. -
  28439. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  28440. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  28441. -@@ -1609,10 +1609,11 @@ static int brcmf_fws_notify_bcmc_credit_
  28442. - {
  28443. - struct brcmf_fws_info *fws = ifp->drvr->fws;
  28444. -
  28445. -- brcmf_fws_lock(fws);
  28446. -- if (fws)
  28447. -+ if (fws) {
  28448. -+ brcmf_fws_lock(fws);
  28449. - fws->bcmc_credit_check = true;
  28450. -- brcmf_fws_unlock(fws);
  28451. -+ brcmf_fws_unlock(fws);
  28452. -+ }
  28453. - return 0;
  28454. - }
  28455. -
  28456. diff --git a/package/kernel/mac80211/patches/400-ath_move_debug_code.patch b/package/kernel/mac80211/patches/400-ath_move_debug_code.patch
  28457. index 298f722..72e9a41 100644
  28458. --- a/package/kernel/mac80211/patches/400-ath_move_debug_code.patch
  28459. +++ b/package/kernel/mac80211/patches/400-ath_move_debug_code.patch
  28460. @@ -14,7 +14,7 @@
  28461. ccflags-y += -D__CHECK_ENDIAN__
  28462. --- a/drivers/net/wireless/ath/ath.h
  28463. +++ b/drivers/net/wireless/ath/ath.h
  28464. -@@ -316,13 +316,6 @@ void _ath_dbg(struct ath_common *common,
  28465. +@@ -318,13 +318,6 @@ void _ath_dbg(struct ath_common *common,
  28466. #endif /* CPTCFG_ATH_DEBUG */
  28467. /** Returns string describing opmode, or NULL if unknown mode. */
  28468. diff --git a/package/kernel/mac80211/patches/402-ath_regd_optional.patch b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  28469. index 2dac505..7351353 100644
  28470. --- a/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  28471. +++ b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  28472. @@ -47,9 +47,9 @@
  28473. --- a/drivers/net/wireless/ath/Kconfig
  28474. +++ b/drivers/net/wireless/ath/Kconfig
  28475. -@@ -22,6 +22,9 @@ menuconfig ATH_CARDS
  28476. +@@ -23,6 +23,9 @@ config WLAN_VENDOR_ATH
  28477. - if ATH_CARDS
  28478. + if WLAN_VENDOR_ATH
  28479. +config ATH_USER_REGD
  28480. + bool "Do not enforce EEPROM regulatory restrictions"
  28481. @@ -59,9 +59,9 @@
  28482. ---help---
  28483. --- a/.local-symbols
  28484. +++ b/.local-symbols
  28485. -@@ -89,6 +89,7 @@ RTL8187_LEDS=
  28486. +@@ -125,6 +125,7 @@ ADM8211=
  28487. ATH_COMMON=
  28488. - ATH_CARDS=
  28489. + WLAN_VENDOR_ATH=
  28490. ATH_DEBUG=
  28491. +ATH_USER_REGD=
  28492. ATH_TRACEPOINTS=
  28493. diff --git a/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch b/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch
  28494. index 1476953..1ef5545 100644
  28495. --- a/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch
  28496. +++ b/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch
  28497. @@ -1,6 +1,6 @@
  28498. --- a/net/wireless/reg.c
  28499. +++ b/net/wireless/reg.c
  28500. -@@ -2368,6 +2368,8 @@ void regulatory_hint_country_ie(struct w
  28501. +@@ -2411,6 +2411,8 @@ void regulatory_hint_country_ie(struct w
  28502. enum environment_cap env = ENVIRON_ANY;
  28503. struct regulatory_request *request = NULL, *lr;
  28504. @@ -9,11 +9,11 @@
  28505. /* IE len must be evenly divisible by 2 */
  28506. if (country_ie_len & 0x01)
  28507. return;
  28508. -@@ -2571,6 +2573,7 @@ static void restore_regulatory_settings(
  28509. +@@ -2617,6 +2619,7 @@ static void restore_regulatory_settings(
  28510. void regulatory_hint_disconnect(void)
  28511. {
  28512. + return;
  28513. - REG_DBG_PRINT("All devices are disconnected, going to restore regulatory settings\n");
  28514. + pr_debug("All devices are disconnected, going to restore regulatory settings\n");
  28515. restore_regulatory_settings(false);
  28516. }
  28517. 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
  28518. index 93760f9..1a62484 100644
  28519. --- a/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
  28520. +++ b/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
  28521. @@ -1,6 +1,6 @@
  28522. --- a/drivers/net/wireless/ath/ath9k/init.c
  28523. +++ b/drivers/net/wireless/ath/ath9k/init.c
  28524. -@@ -715,6 +715,7 @@ static const struct ieee80211_iface_limi
  28525. +@@ -722,6 +722,7 @@ static const struct ieee80211_iface_limi
  28526. BIT(NL80211_IFTYPE_AP) },
  28527. { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  28528. BIT(NL80211_IFTYPE_P2P_GO) },
  28529. diff --git a/package/kernel/mac80211/patches/440-ath5k_channel_bw_debugfs.patch b/package/kernel/mac80211/patches/440-ath5k_channel_bw_debugfs.patch
  28530. index aa521d2..924b62e 100644
  28531. --- a/package/kernel/mac80211/patches/440-ath5k_channel_bw_debugfs.patch
  28532. +++ b/package/kernel/mac80211/patches/440-ath5k_channel_bw_debugfs.patch
  28533. @@ -121,7 +121,7 @@ drivers/net/wireless/ath/ath5k/debug.c | 86 ++++++++++++++++++++++++++++++++
  28534. debugfs_create_file("antenna", S_IWUSR | S_IRUSR, phydir, ah,
  28535. --- a/drivers/net/wireless/ath/ath5k/ath5k.h
  28536. +++ b/drivers/net/wireless/ath/ath5k/ath5k.h
  28537. -@@ -1371,6 +1371,7 @@ struct ath5k_hw {
  28538. +@@ -1372,6 +1372,7 @@ struct ath5k_hw {
  28539. u8 ah_coverage_class;
  28540. bool ah_ack_bitrate_high;
  28541. u8 ah_bwmode;
  28542. diff --git a/package/kernel/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch b/package/kernel/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch
  28543. index ed2cfee..d2a3b96 100644
  28544. --- a/package/kernel/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch
  28545. +++ b/package/kernel/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch
  28546. @@ -1,6 +1,6 @@
  28547. --- a/drivers/net/wireless/ath/ath9k/hw.c
  28548. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  28549. -@@ -389,13 +389,8 @@ static void ath9k_hw_init_config(struct
  28550. +@@ -390,13 +390,8 @@ static void ath9k_hw_init_config(struct
  28551. ah->config.rx_intr_mitigation = true;
  28552. @@ -14,5 +14,5 @@
  28553. + ah->config.rimt_last = 250;
  28554. + ah->config.rimt_first = 500;
  28555. - /*
  28556. - * We need this for PCI devices only (Cardbus, PCI, miniPCI)
  28557. + if (AR_SREV_9462(ah) || AR_SREV_9565(ah))
  28558. + ah->config.pll_pwrsave = 7;
  28559. diff --git a/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch b/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  28560. index d4104f0..6766111 100644
  28561. --- a/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  28562. +++ b/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  28563. @@ -1,6 +1,6 @@
  28564. --- a/drivers/net/wireless/ath/ath9k/ath9k.h
  28565. +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  28566. -@@ -87,7 +87,7 @@ int ath_descdma_setup(struct ath_softc *
  28567. +@@ -88,7 +88,7 @@ int ath_descdma_setup(struct ath_softc *
  28568. (_l) &= ((_sz) - 1); \
  28569. } while (0)
  28570. diff --git a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  28571. index 40b5c81..c84d1bc 100644
  28572. --- a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  28573. +++ b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  28574. @@ -1,6 +1,6 @@
  28575. --- a/drivers/net/wireless/ath/ath9k/hw.c
  28576. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  28577. -@@ -647,6 +647,7 @@ int ath9k_hw_init(struct ath_hw *ah)
  28578. +@@ -651,6 +651,7 @@ int ath9k_hw_init(struct ath_hw *ah)
  28579. /* These are all the AR5008/AR9001/AR9002/AR9003 hardware family of chipsets */
  28580. switch (ah->hw_version.devid) {
  28581. diff --git a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  28582. index 0c50a0b..e151a12 100644
  28583. --- a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  28584. +++ b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  28585. @@ -1,6 +1,6 @@
  28586. --- a/include/net/cfg80211.h
  28587. +++ b/include/net/cfg80211.h
  28588. -@@ -2320,6 +2320,7 @@ struct cfg80211_qos_map {
  28589. +@@ -2363,6 +2363,7 @@ struct cfg80211_qos_map {
  28590. * (as advertised by the nl80211 feature flag.)
  28591. * @get_tx_power: store the current TX power into the dbm variable;
  28592. * return 0 if successful
  28593. @@ -8,7 +8,7 @@
  28594. *
  28595. * @set_wds_peer: set the WDS peer for a WDS interface
  28596. *
  28597. -@@ -2576,6 +2577,7 @@ struct cfg80211_ops {
  28598. +@@ -2624,6 +2625,7 @@ struct cfg80211_ops {
  28599. enum nl80211_tx_power_setting type, int mbm);
  28600. int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
  28601. int *dbm);
  28602. @@ -18,7 +18,7 @@
  28603. const u8 *addr);
  28604. --- a/include/net/mac80211.h
  28605. +++ b/include/net/mac80211.h
  28606. -@@ -1171,6 +1171,7 @@ enum ieee80211_smps_mode {
  28607. +@@ -1286,6 +1286,7 @@ enum ieee80211_smps_mode {
  28608. *
  28609. * @power_level: requested transmit power (in dBm), backward compatibility
  28610. * value only that is set to the minimum of all interfaces
  28611. @@ -26,19 +26,19 @@
  28612. *
  28613. * @chandef: the channel definition to tune to
  28614. * @radar_enabled: whether radar detection is enabled
  28615. -@@ -1192,6 +1193,7 @@ struct ieee80211_conf {
  28616. +@@ -1306,6 +1307,7 @@ enum ieee80211_smps_mode {
  28617. + struct ieee80211_conf {
  28618. u32 flags;
  28619. int power_level, dynamic_ps_timeout;
  28620. - int max_sleep_period;
  28621. + int max_antenna_gain;
  28622. u16 listen_interval;
  28623. u8 ps_dtim_period;
  28624. --- a/include/uapi/linux/nl80211.h
  28625. +++ b/include/uapi/linux/nl80211.h
  28626. -@@ -1760,6 +1760,9 @@ enum nl80211_commands {
  28627. - * @NL80211_ATTR_REG_INDOOR: flag attribute, if set indicates that the device
  28628. - * is operating in an indoor environment.
  28629. +@@ -1790,6 +1790,9 @@ enum nl80211_commands {
  28630. + * between scans. The scan plans are executed sequentially.
  28631. + * Each scan plan is a nested attribute of &enum nl80211_sched_scan_plan.
  28632. *
  28633. + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
  28634. + * transmit power to stay within regulatory limits. u32, dBi.
  28635. @@ -46,9 +46,9 @@
  28636. * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  28637. * @NL80211_ATTR_MAX: highest attribute number currently defined
  28638. * @__NL80211_ATTR_AFTER_LAST: internal use
  28639. -@@ -2129,6 +2132,8 @@ enum nl80211_attrs {
  28640. -
  28641. - NL80211_ATTR_REG_INDOOR,
  28642. +@@ -2164,6 +2167,8 @@ enum nl80211_attrs {
  28643. + NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS,
  28644. + NL80211_ATTR_SCHED_SCAN_PLANS,
  28645. + NL80211_ATTR_WIPHY_ANTENNA_GAIN,
  28646. +
  28647. @@ -57,7 +57,7 @@
  28648. __NL80211_ATTR_AFTER_LAST,
  28649. --- a/net/mac80211/cfg.c
  28650. +++ b/net/mac80211/cfg.c
  28651. -@@ -2208,6 +2208,19 @@ static int ieee80211_get_tx_power(struct
  28652. +@@ -2229,6 +2229,19 @@ static int ieee80211_get_tx_power(struct
  28653. return 0;
  28654. }
  28655. @@ -77,7 +77,7 @@
  28656. static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev,
  28657. const u8 *addr)
  28658. {
  28659. -@@ -3771,6 +3784,7 @@ const struct cfg80211_ops mac80211_confi
  28660. +@@ -3403,6 +3416,7 @@ const struct cfg80211_ops mac80211_confi
  28661. .set_wiphy_params = ieee80211_set_wiphy_params,
  28662. .set_tx_power = ieee80211_set_tx_power,
  28663. .get_tx_power = ieee80211_get_tx_power,
  28664. @@ -87,7 +87,7 @@
  28665. CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd)
  28666. --- a/net/mac80211/ieee80211_i.h
  28667. +++ b/net/mac80211/ieee80211_i.h
  28668. -@@ -1333,6 +1333,7 @@ struct ieee80211_local {
  28669. +@@ -1318,6 +1318,7 @@ struct ieee80211_local {
  28670. int dynamic_ps_forced_timeout;
  28671. int user_power_level; /* in dBm, for all interfaces */
  28672. @@ -97,7 +97,7 @@
  28673. --- a/net/mac80211/main.c
  28674. +++ b/net/mac80211/main.c
  28675. -@@ -98,7 +98,7 @@ static u32 ieee80211_hw_conf_chan(struct
  28676. +@@ -93,7 +93,7 @@ static u32 ieee80211_hw_conf_chan(struct
  28677. struct ieee80211_sub_if_data *sdata;
  28678. struct cfg80211_chan_def chandef = {};
  28679. u32 changed = 0;
  28680. @@ -106,7 +106,7 @@
  28681. u32 offchannel_flag;
  28682. offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
  28683. -@@ -155,6 +155,12 @@ static u32 ieee80211_hw_conf_chan(struct
  28684. +@@ -150,6 +150,12 @@ static u32 ieee80211_hw_conf_chan(struct
  28685. }
  28686. rcu_read_unlock();
  28687. @@ -119,7 +119,7 @@
  28688. if (local->hw.conf.power_level != power) {
  28689. changed |= IEEE80211_CONF_CHANGE_POWER;
  28690. local->hw.conf.power_level = power;
  28691. -@@ -578,6 +584,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
  28692. +@@ -586,6 +592,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
  28693. IEEE80211_RADIOTAP_MCS_HAVE_BW;
  28694. local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI |
  28695. IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH;
  28696. @@ -129,7 +129,7 @@
  28697. local->user_power_level = IEEE80211_UNSET_POWER_LEVEL;
  28698. --- a/net/wireless/nl80211.c
  28699. +++ b/net/wireless/nl80211.c
  28700. -@@ -400,6 +400,7 @@ static const struct nla_policy nl80211_p
  28701. +@@ -403,6 +403,7 @@ static const struct nla_policy nl80211_p
  28702. [NL80211_ATTR_NETNS_FD] = { .type = NLA_U32 },
  28703. [NL80211_ATTR_SCHED_SCAN_DELAY] = { .type = NLA_U32 },
  28704. [NL80211_ATTR_REG_INDOOR] = { .type = NLA_FLAG },
  28705. @@ -137,7 +137,7 @@
  28706. };
  28707. /* policy for the key attributes */
  28708. -@@ -2206,6 +2207,20 @@ static int nl80211_set_wiphy(struct sk_b
  28709. +@@ -2220,6 +2221,20 @@ static int nl80211_set_wiphy(struct sk_b
  28710. if (result)
  28711. return result;
  28712. }
  28713. diff --git a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  28714. index 7512811..5a5e464 100644
  28715. --- a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  28716. +++ b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  28717. @@ -24,7 +24,7 @@
  28718. struct ath_softc {
  28719. struct ieee80211_hw *hw;
  28720. struct device *dev;
  28721. -@@ -1004,9 +1014,8 @@ struct ath_softc {
  28722. +@@ -1005,9 +1015,8 @@ struct ath_softc {
  28723. spinlock_t chan_lock;
  28724. #ifdef CPTCFG_MAC80211_LEDS
  28725. @@ -54,7 +54,8 @@
  28726. + (brightness != LED_OFF) ^ led->gpio->active_low);
  28727. + ath9k_ps_restore(sc);
  28728. +}
  28729. -+
  28730. +
  28731. +- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val);
  28732. +static int ath_add_led(struct ath_softc *sc, struct ath_led *led)
  28733. +{
  28734. + const struct gpio_led *gpio = led->gpio;
  28735. @@ -63,8 +64,7 @@
  28736. + led->cdev.name = gpio->name;
  28737. + led->cdev.default_trigger = gpio->default_trigger;
  28738. + led->cdev.brightness_set = ath_led_brightness;
  28739. -
  28740. -- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val);
  28741. ++
  28742. + ret = led_classdev_register(wiphy_dev(sc->hw->wiphy), &led->cdev);
  28743. + if (ret < 0)
  28744. + return ret;
  28745. @@ -159,7 +159,7 @@
  28746. + trigger = ieee80211_get_radio_led_name(sc->hw);
  28747. - sc->led_registered = true;
  28748. -+ ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, 1);
  28749. ++ ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, !sc->sc_ah->config.led_active_high);
  28750. }
  28751. void ath_fill_led_pin(struct ath_softc *sc)
  28752. diff --git a/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch b/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
  28753. index dc33cd0..7c10ea6 100644
  28754. --- a/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
  28755. +++ b/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
  28756. @@ -59,7 +59,7 @@
  28757. @@ -120,6 +141,12 @@ void ath_init_leds(struct ath_softc *sc)
  28758. trigger = ieee80211_get_radio_led_name(sc->hw);
  28759. - ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, 1);
  28760. + ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, !sc->sc_ah->config.led_active_high);
  28761. +
  28762. + if (!pdata)
  28763. + return;
  28764. 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
  28765. new file mode 100644
  28766. index 0000000..6d62a2b
  28767. --- /dev/null
  28768. +++ b/package/kernel/mac80211/patches/532-ath9k_get_led_polarity_from_platform_data.patch
  28769. @@ -0,0 +1,20 @@
  28770. +--- a/include/linux/ath9k_platform.h
  28771. ++++ b/include/linux/ath9k_platform.h
  28772. +@@ -36,6 +36,7 @@ struct ath9k_platform_data {
  28773. + bool tx_gain_buffalo;
  28774. + bool disable_2ghz;
  28775. + bool disable_5ghz;
  28776. ++ bool led_active_high;
  28777. +
  28778. + int (*get_mac_revision)(void);
  28779. + int (*external_reset)(void);
  28780. +--- a/drivers/net/wireless/ath/ath9k/init.c
  28781. ++++ b/drivers/net/wireless/ath/ath9k/init.c
  28782. +@@ -577,6 +577,7 @@ static int ath9k_init_softc(u16 devid, s
  28783. + ah->external_reset = pdata->external_reset;
  28784. + ah->disable_2ghz = pdata->disable_2ghz;
  28785. + ah->disable_5ghz = pdata->disable_5ghz;
  28786. ++ ah->config.led_active_high = pdata->led_active_high;
  28787. + if (!pdata->endian_check)
  28788. + ah->ah_flags |= AH_NO_EEP_SWAP;
  28789. + }
  28790. diff --git a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  28791. index 08c5a0f..e83c6bf 100644
  28792. --- a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  28793. +++ b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  28794. @@ -62,7 +62,7 @@
  28795. debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy,
  28796. --- a/drivers/net/wireless/ath/ath9k/hw.h
  28797. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  28798. -@@ -513,6 +513,12 @@ enum {
  28799. +@@ -519,6 +519,12 @@ enum {
  28800. ATH9K_RESET_COLD,
  28801. };
  28802. @@ -75,7 +75,7 @@
  28803. struct ath9k_hw_version {
  28804. u32 magic;
  28805. u16 devid;
  28806. -@@ -794,6 +800,8 @@ struct ath_hw {
  28807. +@@ -804,6 +810,8 @@ struct ath_hw {
  28808. u32 rfkill_polarity;
  28809. u32 ah_flags;
  28810. @@ -84,7 +84,7 @@
  28811. bool reset_power_on;
  28812. bool htc_reset_init;
  28813. -@@ -1055,6 +1063,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
  28814. +@@ -1066,6 +1074,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
  28815. bool ath9k_hw_check_alive(struct ath_hw *ah);
  28816. bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode);
  28817. @@ -94,7 +94,7 @@
  28818. struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah,
  28819. --- a/drivers/net/wireless/ath/ath9k/hw.c
  28820. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  28821. -@@ -1804,6 +1804,20 @@ u32 ath9k_hw_get_tsf_offset(struct times
  28822. +@@ -1819,6 +1819,20 @@ u32 ath9k_hw_get_tsf_offset(struct times
  28823. }
  28824. EXPORT_SYMBOL(ath9k_hw_get_tsf_offset);
  28825. @@ -115,7 +115,7 @@
  28826. int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
  28827. struct ath9k_hw_cal_data *caldata, bool fastcc)
  28828. {
  28829. -@@ -2012,6 +2026,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  28830. +@@ -2027,6 +2041,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  28831. ar9003_hw_disable_phy_restart(ah);
  28832. ath9k_hw_apply_gpio_override(ah);
  28833. diff --git a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  28834. index 8c9b34c..d7bb5a1 100644
  28835. --- a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  28836. +++ b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  28837. @@ -1,6 +1,6 @@
  28838. --- a/drivers/net/wireless/ath/ath9k/hw.h
  28839. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  28840. -@@ -710,6 +710,7 @@ struct ath_spec_scan {
  28841. +@@ -720,6 +720,7 @@ struct ath_spec_scan {
  28842. * @config_pci_powersave:
  28843. * @calibrate: periodic calibration for NF, ANI, IQ, ADC gain, ADC-DC
  28844. *
  28845. @@ -8,7 +8,7 @@
  28846. * @spectral_scan_config: set parameters for spectral scan and enable/disable it
  28847. * @spectral_scan_trigger: trigger a spectral scan run
  28848. * @spectral_scan_wait: wait for a spectral scan run to finish
  28849. -@@ -732,6 +733,7 @@ struct ath_hw_ops {
  28850. +@@ -742,6 +743,7 @@ struct ath_hw_ops {
  28851. struct ath_hw_antcomb_conf *antconf);
  28852. void (*antdiv_comb_conf_set)(struct ath_hw *ah,
  28853. struct ath_hw_antcomb_conf *antconf);
  28854. @@ -18,7 +18,7 @@
  28855. void (*spectral_scan_trigger)(struct ath_hw *ah);
  28856. --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  28857. +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  28858. -@@ -1999,6 +1999,26 @@ void ar9003_hw_init_rate_txpower(struct
  28859. +@@ -1998,6 +1998,26 @@ void ar9003_hw_init_rate_txpower(struct
  28860. }
  28861. }
  28862. @@ -45,7 +45,7 @@
  28863. void ar9003_hw_attach_phy_ops(struct ath_hw *ah)
  28864. {
  28865. struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
  28866. -@@ -2035,6 +2055,7 @@ void ar9003_hw_attach_phy_ops(struct ath
  28867. +@@ -2034,6 +2054,7 @@ void ar9003_hw_attach_phy_ops(struct ath
  28868. priv_ops->set_radar_params = ar9003_hw_set_radar_params;
  28869. priv_ops->fast_chan_change = ar9003_hw_fast_chan_change;
  28870. @@ -55,7 +55,7 @@
  28871. ops->spectral_scan_config = ar9003_hw_spectral_scan_config;
  28872. --- a/drivers/net/wireless/ath/ath9k/init.c
  28873. +++ b/drivers/net/wireless/ath/ath9k/init.c
  28874. -@@ -703,7 +703,8 @@ static void ath9k_init_txpower_limits(st
  28875. +@@ -711,7 +711,8 @@ static void ath9k_init_txpower_limits(st
  28876. if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
  28877. ath9k_init_band_txpower(sc, IEEE80211_BAND_5GHZ);
  28878. @@ -65,7 +65,7 @@
  28879. }
  28880. static const struct ieee80211_iface_limit if_limits[] = {
  28881. -@@ -896,6 +897,18 @@ static void ath9k_set_hw_capab(struct at
  28882. +@@ -897,6 +898,18 @@ static void ath9k_set_hw_capab(struct at
  28883. SET_IEEE80211_PERM_ADDR(hw, common->macaddr);
  28884. }
  28885. @@ -84,7 +84,7 @@
  28886. int ath9k_init_device(u16 devid, struct ath_softc *sc,
  28887. const struct ath_bus_ops *bus_ops)
  28888. {
  28889. -@@ -941,6 +954,8 @@ int ath9k_init_device(u16 devid, struct
  28890. +@@ -942,6 +955,8 @@ int ath9k_init_device(u16 devid, struct
  28891. ARRAY_SIZE(ath9k_tpt_blink));
  28892. #endif
  28893. @@ -110,7 +110,7 @@
  28894. static inline void ath9k_hw_set_bt_ant_diversity(struct ath_hw *ah, bool enable)
  28895. --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  28896. +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  28897. -@@ -1316,9 +1316,30 @@ void ar5008_hw_init_rate_txpower(struct
  28898. +@@ -1327,9 +1327,30 @@ void ar5008_hw_init_rate_txpower(struct
  28899. }
  28900. }
  28901. @@ -141,7 +141,7 @@
  28902. static const u32 ar5416_cca_regs[6] = {
  28903. AR_PHY_CCA,
  28904. AR_PHY_CH1_CCA,
  28905. -@@ -1333,6 +1354,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
  28906. +@@ -1344,6 +1365,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
  28907. if (ret)
  28908. return ret;
  28909. 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
  28910. index 240b898..8768c5d 100644
  28911. --- a/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch
  28912. +++ b/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch
  28913. @@ -1,6 +1,6 @@
  28914. --- a/drivers/net/wireless/ath/ath9k/hw.c
  28915. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  28916. -@@ -245,6 +245,19 @@ void ath9k_hw_get_channel_centers(struct
  28917. +@@ -246,6 +246,19 @@ void ath9k_hw_get_channel_centers(struct
  28918. centers->synth_center + (extoff * HT40_CHANNEL_CENTER_SHIFT);
  28919. }
  28920. @@ -20,7 +20,7 @@
  28921. /******************/
  28922. /* Chip Revisions */
  28923. /******************/
  28924. -@@ -1382,6 +1395,9 @@ static bool ath9k_hw_set_reset(struct at
  28925. +@@ -1397,6 +1410,9 @@ static bool ath9k_hw_set_reset(struct at
  28926. if (AR_SREV_9100(ah))
  28927. udelay(50);
  28928. @@ -30,7 +30,7 @@
  28929. return true;
  28930. }
  28931. -@@ -1481,6 +1497,9 @@ static bool ath9k_hw_chip_reset(struct a
  28932. +@@ -1496,6 +1512,9 @@ static bool ath9k_hw_chip_reset(struct a
  28933. ar9003_hw_internal_regulator_apply(ah);
  28934. ath9k_hw_init_pll(ah, chan);
  28935. @@ -40,7 +40,7 @@
  28936. return true;
  28937. }
  28938. -@@ -1782,8 +1801,14 @@ static int ath9k_hw_do_fastcc(struct ath
  28939. +@@ -1797,8 +1816,14 @@ static int ath9k_hw_do_fastcc(struct ath
  28940. if (AR_SREV_9271(ah))
  28941. ar9002_hw_load_ani_reg(ah, chan);
  28942. @@ -55,7 +55,7 @@
  28943. return -EINVAL;
  28944. }
  28945. -@@ -2037,6 +2062,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  28946. +@@ -2052,6 +2077,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  28947. ath9k_hw_set_radar_params(ah);
  28948. }
  28949. diff --git a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  28950. index 9610372..3d24ccd 100644
  28951. --- a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  28952. +++ b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  28953. @@ -1,6 +1,6 @@
  28954. --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  28955. +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  28956. -@@ -945,55 +945,6 @@ static bool ar5008_hw_ani_control_new(st
  28957. +@@ -956,55 +956,6 @@ static bool ar5008_hw_ani_control_new(st
  28958. * on == 0 means more noise imm
  28959. */
  28960. u32 on = param ? 1 : 0;
  28961. @@ -79,7 +79,7 @@
  28962. static const u8 ofdm2pwr[] = {
  28963. ALL_TARGET_LEGACY_6_24,
  28964. ALL_TARGET_LEGACY_6_24,
  28965. -@@ -1090,11 +1076,6 @@ static bool ar9003_hw_ani_control(struct
  28966. +@@ -1089,11 +1075,6 @@ static bool ar9003_hw_ani_control(struct
  28967. struct ath_common *common = ath9k_hw_common(ah);
  28968. struct ath9k_channel *chan = ah->curchan;
  28969. struct ar5416AniState *aniState = &ah->ani;
  28970. @@ -91,7 +91,7 @@
  28971. s32 value, value2;
  28972. switch (cmd & ah->ani_function) {
  28973. -@@ -1108,61 +1089,6 @@ static bool ar9003_hw_ani_control(struct
  28974. +@@ -1107,61 +1088,6 @@ static bool ar9003_hw_ani_control(struct
  28975. */
  28976. u32 on = param ? 1 : 0;
  28977. 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
  28978. index c0dc4fe..bd81555 100644
  28979. --- a/package/kernel/mac80211/patches/600-0001-rt2x00-rt2800lib-move-rt2800_drv_data-declaration-in.patch
  28980. +++ b/package/kernel/mac80211/patches/600-0001-rt2x00-rt2800lib-move-rt2800_drv_data-declaration-in.patch
  28981. @@ -16,36 +16,18 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28982. ---
  28983. Changes since v1: ---
  28984. ---
  28985. - drivers/net/wireless/rt2x00/rt2800.h | 13 -------------
  28986. - drivers/net/wireless/rt2x00/rt2800lib.h | 11 +++++++++++
  28987. + drivers/net/wireless/ralink/rt2x00/rt2800.h | 13 -------------
  28988. + drivers/net/wireless/ralink/rt2x00/rt2800lib.h | 11 +++++++++++
  28989. 2 files changed, 11 insertions(+), 13 deletions(-)
  28990. ---- a/drivers/net/wireless/rt2x00/rt2800.h
  28991. -+++ b/drivers/net/wireless/rt2x00/rt2800.h
  28992. -@@ -2960,17 +2960,4 @@ enum rt2800_eeprom_word {
  28993. - */
  28994. - #define BCN_TBTT_OFFSET 64
  28995. -
  28996. --/*
  28997. -- * RT2800 driver data structure
  28998. -- */
  28999. --struct rt2800_drv_data {
  29000. -- u8 calibration_bw20;
  29001. -- u8 calibration_bw40;
  29002. -- u8 bbp25;
  29003. -- u8 bbp26;
  29004. -- u8 txmixer_gain_24g;
  29005. -- u8 txmixer_gain_5g;
  29006. -- unsigned int tbtt_tick;
  29007. --};
  29008. --
  29009. - #endif /* RT2800_H */
  29010. ---- a/drivers/net/wireless/rt2x00/rt2800lib.h
  29011. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.h
  29012. -@@ -20,6 +20,17 @@
  29013. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
  29014. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
  29015. +@@ -20,6 +20,20 @@
  29016. #ifndef RT2800LIB_H
  29017. #define RT2800LIB_H
  29018. ++#include "rt2800.h"
  29019. ++
  29020. +/* RT2800 driver data structure */
  29021. +struct rt2800_drv_data {
  29022. + u8 calibration_bw20;
  29023. @@ -55,8 +37,30 @@ Changes since v1: ---
  29024. + u8 txmixer_gain_24g;
  29025. + u8 txmixer_gain_5g;
  29026. + unsigned int tbtt_tick;
  29027. ++ DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  29028. +};
  29029. +
  29030. struct rt2800_ops {
  29031. void (*register_read)(struct rt2x00_dev *rt2x00dev,
  29032. const unsigned int offset, u32 *value);
  29033. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
  29034. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
  29035. +@@ -2969,18 +2969,4 @@ enum rt2800_eeprom_word {
  29036. + #define WCID_END 222
  29037. + #define STA_IDS_SIZE (WCID_END - WCID_START + 2)
  29038. +
  29039. +-/*
  29040. +- * RT2800 driver data structure
  29041. +- */
  29042. +-struct rt2800_drv_data {
  29043. +- u8 calibration_bw20;
  29044. +- u8 calibration_bw40;
  29045. +- u8 bbp25;
  29046. +- u8 bbp26;
  29047. +- u8 txmixer_gain_24g;
  29048. +- u8 txmixer_gain_5g;
  29049. +- unsigned int tbtt_tick;
  29050. +- DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  29051. +-};
  29052. +-
  29053. + #endif /* RT2800_H */
  29054. 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
  29055. index 6bad6ac..8245909 100644
  29056. --- a/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch
  29057. +++ b/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch
  29058. @@ -18,13 +18,13 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29059. Changes since v1:
  29060. - don't enable the new flag for RT3071 and RT5592
  29061. ---
  29062. - drivers/net/wireless/rt2x00/rt2800lib.c | 4 ++++
  29063. - drivers/net/wireless/rt2x00/rt2800lib.h | 13 +++++++++++++
  29064. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 4 ++++
  29065. + drivers/net/wireless/ralink/rt2x00/rt2800lib.h | 13 +++++++++++++
  29066. 2 files changed, 17 insertions(+)
  29067. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29068. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29069. -@@ -7747,6 +7747,7 @@ static int rt2800_probe_rt(struct rt2x00
  29070. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29071. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29072. +@@ -7722,6 +7722,7 @@ static int rt2800_probe_rt(struct rt2x00
  29073. int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
  29074. {
  29075. @@ -32,7 +32,7 @@ Changes since v1:
  29076. int retval;
  29077. u32 reg;
  29078. -@@ -7754,6 +7755,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  29079. +@@ -7729,6 +7730,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  29080. if (retval)
  29081. return retval;
  29082. @@ -42,11 +42,11 @@ Changes since v1:
  29083. /*
  29084. * Allocate eeprom data.
  29085. */
  29086. ---- a/drivers/net/wireless/rt2x00/rt2800lib.h
  29087. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.h
  29088. -@@ -20,6 +20,10 @@
  29089. - #ifndef RT2800LIB_H
  29090. - #define RT2800LIB_H
  29091. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
  29092. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
  29093. +@@ -22,6 +22,10 @@
  29094. +
  29095. + #include "rt2800.h"
  29096. +enum rt2800_flag {
  29097. + RT2800_HAS_HIGH_SHARED_MEM,
  29098. @@ -55,16 +55,16 @@ Changes since v1:
  29099. /* RT2800 driver data structure */
  29100. struct rt2800_drv_data {
  29101. u8 calibration_bw20;
  29102. -@@ -29,6 +33,8 @@ struct rt2800_drv_data {
  29103. - u8 txmixer_gain_24g;
  29104. +@@ -32,6 +36,8 @@ struct rt2800_drv_data {
  29105. u8 txmixer_gain_5g;
  29106. unsigned int tbtt_tick;
  29107. + DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  29108. +
  29109. + unsigned long rt2800_flags;
  29110. };
  29111. struct rt2800_ops {
  29112. -@@ -61,6 +67,13 @@ struct rt2800_ops {
  29113. +@@ -64,6 +70,13 @@ struct rt2800_ops {
  29114. __le32 *(*drv_get_txwi)(struct queue_entry *entry);
  29115. };
  29116. 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
  29117. index 9f8dfcc..7abfcd1 100644
  29118. --- a/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch
  29119. +++ b/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch
  29120. @@ -17,17 +17,17 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29121. ---
  29122. Changes since v1: ---
  29123. ---
  29124. - drivers/net/wireless/rt2x00/rt2800lib.c | 55 +++++++++++++++++++++++++++++-
  29125. - drivers/net/wireless/rt2x00/rt2800lib.h | 32 +++++++++++++++++
  29126. - drivers/net/wireless/rt2x00/rt2800mmio.c | 26 ++++++++++++++
  29127. - drivers/net/wireless/rt2x00/rt2800mmio.h | 4 +++
  29128. - drivers/net/wireless/rt2x00/rt2800pci.c | 14 ++++++++
  29129. - drivers/net/wireless/rt2x00/rt2800soc.c | 3 ++
  29130. - drivers/net/wireless/rt2x00/rt2800usb.c | 31 +++++++++++++++++
  29131. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 55 +++++++++++++++++++++++++++++-
  29132. + drivers/net/wireless/ralink/rt2x00/rt2800lib.h | 32 +++++++++++++++++
  29133. + drivers/net/wireless/ralink/rt2x00/rt2800mmio.c | 26 ++++++++++++++
  29134. + drivers/net/wireless/ralink/rt2x00/rt2800mmio.h | 4 +++
  29135. + drivers/net/wireless/ralink/rt2x00/rt2800pci.c | 14 ++++++++
  29136. + drivers/net/wireless/ralink/rt2x00/rt2800soc.c | 3 ++
  29137. + drivers/net/wireless/ralink/rt2x00/rt2800usb.c | 31 +++++++++++++++++
  29138. 7 files changed, 164 insertions(+), 1 deletion(-)
  29139. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29140. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29141. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29142. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29143. @@ -451,11 +451,13 @@ void rt2800_mcu_request(struct rt2x00_de
  29144. rt2x00_set_field32(&reg, H2M_MAILBOX_CSR_CMD_TOKEN, token);
  29145. rt2x00_set_field32(&reg, H2M_MAILBOX_CSR_ARG0, arg0);
  29146. @@ -175,7 +175,7 @@ Changes since v1: ---
  29147. /*
  29148. * Update WCID information
  29149. -@@ -1437,8 +1467,11 @@ int rt2800_config_pairwise_key(struct rt
  29150. +@@ -1405,8 +1435,11 @@ int rt2800_config_pairwise_key(struct rt
  29151. sizeof(key_entry.rx_mic));
  29152. offset = PAIRWISE_KEY_ENTRY(key->hw_key_idx);
  29153. @@ -187,7 +187,7 @@ Changes since v1: ---
  29154. }
  29155. /*
  29156. -@@ -4908,14 +4941,19 @@ static int rt2800_init_registers(struct
  29157. +@@ -4885,14 +4918,19 @@ static int rt2800_init_registers(struct
  29158. /*
  29159. * ASIC will keep garbage value after boot, clear encryption keys.
  29160. */
  29161. @@ -207,7 +207,7 @@ Changes since v1: ---
  29162. }
  29163. /*
  29164. -@@ -5041,8 +5079,10 @@ static int rt2800_wait_bbp_ready(struct
  29165. +@@ -5018,8 +5056,10 @@ static int rt2800_wait_bbp_ready(struct
  29166. * BBP was enabled after firmware was loaded,
  29167. * but we need to reactivate it now.
  29168. */
  29169. @@ -218,7 +218,7 @@ Changes since v1: ---
  29170. msleep(1);
  29171. for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
  29172. -@@ -6738,11 +6778,19 @@ int rt2800_enable_radio(struct rt2x00_de
  29173. +@@ -6715,11 +6755,19 @@ int rt2800_enable_radio(struct rt2x00_de
  29174. /*
  29175. * Send signal during boot time to initialize firmware.
  29176. */
  29177. @@ -239,7 +239,7 @@ Changes since v1: ---
  29178. msleep(1);
  29179. /*
  29180. -@@ -7751,6 +7799,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  29181. +@@ -7726,6 +7774,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  29182. int retval;
  29183. u32 reg;
  29184. @@ -248,22 +248,22 @@ Changes since v1: ---
  29185. retval = rt2800_probe_rt(rt2x00dev);
  29186. if (retval)
  29187. return retval;
  29188. -@@ -7830,8 +7880,11 @@ void rt2800_get_tkip_seq(struct ieee8021
  29189. - u32 offset;
  29190. +@@ -7809,8 +7859,11 @@ void rt2800_get_key_seq(struct ieee80211
  29191. + return;
  29192. - offset = MAC_IVEIV_ENTRY(hw_key_idx);
  29193. + offset = MAC_IVEIV_ENTRY(key->hw_key_idx);
  29194. +
  29195. + rt2800_shared_mem_lock(rt2x00dev);
  29196. rt2800_register_multiread(rt2x00dev, offset,
  29197. &iveiv_entry, sizeof(iveiv_entry));
  29198. + rt2800_shared_mem_unlock(rt2x00dev);
  29199. - memcpy(iv16, &iveiv_entry.iv[0], sizeof(*iv16));
  29200. - memcpy(iv32, &iveiv_entry.iv[4], sizeof(*iv32));
  29201. ---- a/drivers/net/wireless/rt2x00/rt2800lib.h
  29202. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.h
  29203. -@@ -35,6 +35,11 @@ struct rt2800_drv_data {
  29204. - unsigned int tbtt_tick;
  29205. + memcpy(&seq->tkip.iv16, &iveiv_entry.iv[0], 2);
  29206. + memcpy(&seq->tkip.iv32, &iveiv_entry.iv[4], 4);
  29207. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
  29208. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
  29209. +@@ -38,6 +38,11 @@ struct rt2800_drv_data {
  29210. + DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  29211. unsigned long rt2800_flags;
  29212. +
  29213. @@ -274,7 +274,7 @@ Changes since v1: ---
  29214. };
  29215. struct rt2800_ops {
  29216. -@@ -65,6 +70,10 @@ struct rt2800_ops {
  29217. +@@ -68,6 +73,10 @@ struct rt2800_ops {
  29218. const u8 *data, const size_t len);
  29219. int (*drv_init_registers)(struct rt2x00_dev *rt2x00dev);
  29220. __le32 *(*drv_get_txwi)(struct queue_entry *entry);
  29221. @@ -285,7 +285,7 @@ Changes since v1: ---
  29222. };
  29223. static inline bool rt2800_has_high_shared_mem(struct rt2x00_dev *rt2x00dev)
  29224. -@@ -74,6 +83,29 @@ static inline bool rt2800_has_high_share
  29225. +@@ -77,6 +86,29 @@ static inline bool rt2800_has_high_share
  29226. return test_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  29227. }
  29228. @@ -315,8 +315,8 @@ Changes since v1: ---
  29229. static inline void rt2800_register_read(struct rt2x00_dev *rt2x00dev,
  29230. const unsigned int offset,
  29231. u32 *value)
  29232. ---- a/drivers/net/wireless/rt2x00/rt2800mmio.c
  29233. -+++ b/drivers/net/wireless/rt2x00/rt2800mmio.c
  29234. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
  29235. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
  29236. @@ -820,8 +820,10 @@ int rt2800mmio_init_registers(struct rt2
  29237. rt2x00_set_field32(&reg, WPDMA_RST_IDX_DRX_IDX0, 1);
  29238. rt2x00mmio_register_write(rt2x00dev, WPDMA_RST_IDX, reg);
  29239. @@ -359,8 +359,8 @@ Changes since v1: ---
  29240. MODULE_AUTHOR(DRV_PROJECT);
  29241. MODULE_VERSION(DRV_VERSION);
  29242. MODULE_DESCRIPTION("rt2800 MMIO library");
  29243. ---- a/drivers/net/wireless/rt2x00/rt2800mmio.h
  29244. -+++ b/drivers/net/wireless/rt2x00/rt2800mmio.h
  29245. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.h
  29246. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.h
  29247. @@ -160,4 +160,8 @@ int rt2800mmio_init_registers(struct rt2
  29248. /* Device state switch handlers. */
  29249. int rt2800mmio_enable_radio(struct rt2x00_dev *rt2x00dev);
  29250. @@ -370,8 +370,8 @@ Changes since v1: ---
  29251. +void rt2800mmio_shmem_unlock(struct rt2x00_dev *rt2x00dev);
  29252. +
  29253. #endif /* RT2800MMIO_H */
  29254. ---- a/drivers/net/wireless/rt2x00/rt2800pci.c
  29255. -+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
  29256. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800pci.c
  29257. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800pci.c
  29258. @@ -69,7 +69,9 @@ static void rt2800pci_mcu_status(struct
  29259. return;
  29260. @@ -444,8 +444,8 @@ Changes since v1: ---
  29261. };
  29262. static const struct rt2x00lib_ops rt2800pci_rt2x00_ops = {
  29263. ---- a/drivers/net/wireless/rt2x00/rt2800soc.c
  29264. -+++ b/drivers/net/wireless/rt2x00/rt2800soc.c
  29265. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
  29266. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
  29267. @@ -176,6 +176,9 @@ static const struct rt2800_ops rt2800soc
  29268. .drv_write_firmware = rt2800soc_write_firmware,
  29269. .drv_init_registers = rt2800mmio_init_registers,
  29270. @@ -456,8 +456,8 @@ Changes since v1: ---
  29271. };
  29272. static const struct rt2x00lib_ops rt2800soc_rt2x00_ops = {
  29273. ---- a/drivers/net/wireless/rt2x00/rt2800usb.c
  29274. -+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
  29275. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
  29276. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
  29277. @@ -51,6 +51,27 @@ static bool rt2800usb_hwcrypt_disabled(s
  29278. return modparam_nohwcrypt;
  29279. }
  29280. @@ -486,7 +486,7 @@ Changes since v1: ---
  29281. /*
  29282. * Queue handlers.
  29283. */
  29284. -@@ -294,8 +315,10 @@ static int rt2800usb_write_firmware(stru
  29285. +@@ -299,8 +320,10 @@ static int rt2800usb_write_firmware(stru
  29286. data + offset, length);
  29287. }
  29288. @@ -497,7 +497,7 @@ Changes since v1: ---
  29289. /*
  29290. * Send firmware request to device to load firmware,
  29291. -@@ -310,7 +333,10 @@ static int rt2800usb_write_firmware(stru
  29292. +@@ -315,7 +338,10 @@ static int rt2800usb_write_firmware(stru
  29293. }
  29294. msleep(10);
  29295. @@ -508,7 +508,7 @@ Changes since v1: ---
  29296. return 0;
  29297. }
  29298. -@@ -328,8 +354,10 @@ static int rt2800usb_init_registers(stru
  29299. +@@ -333,8 +359,10 @@ static int rt2800usb_init_registers(stru
  29300. if (rt2800_wait_csr_ready(rt2x00dev))
  29301. return -EBUSY;
  29302. @@ -519,7 +519,7 @@ Changes since v1: ---
  29303. reg = 0;
  29304. rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_CSR, 1);
  29305. -@@ -859,6 +887,9 @@ static const struct rt2800_ops rt2800usb
  29306. +@@ -863,6 +891,9 @@ static const struct rt2800_ops rt2800usb
  29307. .drv_write_firmware = rt2800usb_write_firmware,
  29308. .drv_init_registers = rt2800usb_init_registers,
  29309. .drv_get_txwi = rt2800usb_get_txwi,
  29310. 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
  29311. index b8c1914..985a3b9 100644
  29312. --- a/package/kernel/mac80211/patches/600-0004-rt2x00-rt2800lib-fix-beacon-generation-on-RT3593.patch
  29313. +++ b/package/kernel/mac80211/patches/600-0004-rt2x00-rt2800lib-fix-beacon-generation-on-RT3593.patch
  29314. @@ -23,12 +23,12 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29315. ---
  29316. Changes since v1: ---
  29317. ---
  29318. - drivers/net/wireless/rt2x00/rt2800.h | 3 +++
  29319. - drivers/net/wireless/rt2x00/rt2800lib.c | 44 +++++++++++++++++++++++++++++++
  29320. + drivers/net/wireless/ralink/rt2x00/rt2800.h | 3 +++
  29321. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 44 +++++++++++++++++++++++++++++++
  29322. 2 files changed, 47 insertions(+)
  29323. ---- a/drivers/net/wireless/rt2x00/rt2800.h
  29324. -+++ b/drivers/net/wireless/rt2x00/rt2800.h
  29325. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
  29326. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
  29327. @@ -574,6 +574,7 @@
  29328. #define PBF_SYS_CTRL 0x0400
  29329. #define PBF_SYS_CTRL_READY FIELD32(0x00000080)
  29330. @@ -46,8 +46,8 @@ Changes since v1: ---
  29331. #define BEACON_BASE_TO_OFFSET(_base) (((_base) - 0x4000) / 64)
  29332. /*
  29333. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29334. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29335. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29336. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29337. @@ -82,6 +82,39 @@ static inline bool rt2800_is_305x_soc(st
  29338. return false;
  29339. }
  29340. 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
  29341. index e7eb630..02b2acf 100644
  29342. --- a/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch
  29343. +++ b/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch
  29344. @@ -18,13 +18,13 @@ new field with the actually used value.
  29345. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29346. ---
  29347. - drivers/net/wireless/rt2x00/rt2800lib.c | 5 ++++-
  29348. - drivers/net/wireless/rt2x00/rt2800lib.h | 1 +
  29349. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 5 ++++-
  29350. + drivers/net/wireless/ralink/rt2x00/rt2800lib.h | 1 +
  29351. 2 files changed, 5 insertions(+), 1 deletion(-)
  29352. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29353. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29354. -@@ -4638,6 +4638,7 @@ EXPORT_SYMBOL_GPL(rt2800_link_tuner);
  29355. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29356. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29357. +@@ -4615,6 +4615,7 @@ EXPORT_SYMBOL_GPL(rt2800_link_tuner);
  29358. */
  29359. static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
  29360. {
  29361. @@ -32,7 +32,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29362. u32 reg;
  29363. u16 eeprom;
  29364. unsigned int i;
  29365. -@@ -5003,7 +5004,7 @@ static int rt2800_init_registers(struct
  29366. +@@ -4980,7 +4981,7 @@ static int rt2800_init_registers(struct
  29367. /*
  29368. * Clear all beacons
  29369. */
  29370. @@ -41,7 +41,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29371. rt2800_clear_beacon_register(rt2x00dev, i);
  29372. if (rt2x00_is_usb(rt2x00dev)) {
  29373. -@@ -7852,6 +7853,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  29374. +@@ -7827,6 +7828,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  29375. if (rt2x00_rt(rt2x00dev, RT3593))
  29376. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  29377. @@ -50,13 +50,13 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29378. /*
  29379. * Allocate eeprom data.
  29380. */
  29381. ---- a/drivers/net/wireless/rt2x00/rt2800lib.h
  29382. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.h
  29383. -@@ -33,6 +33,7 @@ struct rt2800_drv_data {
  29384. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
  29385. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
  29386. +@@ -35,6 +35,7 @@ struct rt2800_drv_data {
  29387. u8 txmixer_gain_24g;
  29388. u8 txmixer_gain_5g;
  29389. unsigned int tbtt_tick;
  29390. + unsigned int hw_beacon_count;
  29391. + DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  29392. unsigned long rt2800_flags;
  29393. -
  29394. 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
  29395. index b79b4be..4e735d3 100644
  29396. --- a/package/kernel/mac80211/patches/600-0006-rt2x00-rt2800lib-init-additional-beacon-offset-regis.patch
  29397. +++ b/package/kernel/mac80211/patches/600-0006-rt2x00-rt2800lib-init-additional-beacon-offset-regis.patch
  29398. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: init additional beacon offset registers
  29399. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29400. ---
  29401. - drivers/net/wireless/rt2x00/rt2800.h | 14 ++++++++++++++
  29402. - drivers/net/wireless/rt2x00/rt2800lib.c | 24 ++++++++++++++++++++++++
  29403. + drivers/net/wireless/ralink/rt2x00/rt2800.h | 14 ++++++++++++++
  29404. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 24 ++++++++++++++++++++++++
  29405. 2 files changed, 38 insertions(+)
  29406. ---- a/drivers/net/wireless/rt2x00/rt2800.h
  29407. -+++ b/drivers/net/wireless/rt2x00/rt2800.h
  29408. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
  29409. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
  29410. @@ -629,6 +629,20 @@
  29411. */
  29412. #define PBF_DBG 0x043c
  29413. @@ -32,9 +32,9 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29414. /*
  29415. * RF registers
  29416. */
  29417. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29418. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29419. -@@ -4650,6 +4650,30 @@ static int rt2800_init_registers(struct
  29420. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29421. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29422. +@@ -4627,6 +4627,30 @@ static int rt2800_init_registers(struct
  29423. if (ret)
  29424. return ret;
  29425. 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
  29426. index 180c5e3..e909272 100644
  29427. --- a/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch
  29428. +++ b/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch
  29429. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: fix max supported beacon count for RT3593
  29430. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29431. ---
  29432. - drivers/net/wireless/rt2x00/rt2800lib.c | 5 ++++-
  29433. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 5 ++++-
  29434. 1 file changed, 4 insertions(+), 1 deletion(-)
  29435. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29436. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29437. -@@ -7877,7 +7877,10 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  29438. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29439. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29440. +@@ -7852,7 +7852,10 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  29441. if (rt2x00_rt(rt2x00dev, RT3593))
  29442. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  29443. 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
  29444. index 8a10c6e..565e39d 100644
  29445. --- a/package/kernel/mac80211/patches/600-0008-rt2x00-allow-to-build-rt2800soc-module-for-RT3883.patch
  29446. +++ b/package/kernel/mac80211/patches/600-0008-rt2x00-allow-to-build-rt2800soc-module-for-RT3883.patch
  29447. @@ -5,11 +5,11 @@ Subject: [PATCH] rt2x00: allow to build rt2800soc module for RT3883
  29448. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29449. ---
  29450. - drivers/net/wireless/rt2x00/Kconfig | 2 +-
  29451. + drivers/net/wireless/ralink/rt2x00/Kconfig | 2 +-
  29452. 1 file changed, 1 insertion(+), 1 deletion(-)
  29453. ---- a/drivers/net/wireless/rt2x00/Kconfig
  29454. -+++ b/drivers/net/wireless/rt2x00/Kconfig
  29455. +--- a/drivers/net/wireless/ralink/rt2x00/Kconfig
  29456. ++++ b/drivers/net/wireless/ralink/rt2x00/Kconfig
  29457. @@ -210,7 +210,7 @@ endif
  29458. config RT2800SOC
  29459. tristate "Ralink WiSoC support"
  29460. 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
  29461. index 31aa34a..7fe38e0 100644
  29462. --- a/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch
  29463. +++ b/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch
  29464. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: enable support for RT3883
  29465. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29466. ---
  29467. - drivers/net/wireless/rt2x00/rt2800lib.c | 1 +
  29468. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 1 +
  29469. 1 file changed, 1 insertion(+)
  29470. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29471. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29472. -@@ -7847,6 +7847,7 @@ static int rt2800_probe_rt(struct rt2x00
  29473. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29474. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29475. +@@ -7822,6 +7822,7 @@ static int rt2800_probe_rt(struct rt2x00
  29476. case RT3390:
  29477. case RT3572:
  29478. case RT3593:
  29479. 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
  29480. index a90c590..253a0c0 100644
  29481. --- a/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
  29482. +++ b/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
  29483. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: add rf_vals for RF3853
  29484. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29485. ---
  29486. - drivers/net/wireless/rt2x00/rt2800.h | 4 +-
  29487. - drivers/net/wireless/rt2x00/rt2800lib.c | 65 +++++++++++++++++++++++++++++++
  29488. + drivers/net/wireless/ralink/rt2x00/rt2800.h | 4 +-
  29489. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 65 +++++++++++++++++++++++++++++++
  29490. 2 files changed, 68 insertions(+), 1 deletion(-)
  29491. ---- a/drivers/net/wireless/rt2x00/rt2800.h
  29492. -+++ b/drivers/net/wireless/rt2x00/rt2800.h
  29493. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
  29494. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
  29495. @@ -48,7 +48,8 @@
  29496. * RF2853 2.4G/5G 3T3R
  29497. * RF3320 2.4G 1T1R(RT3350/RT3370/RT3390)
  29498. @@ -29,9 +29,9 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29499. #define RF5360 0x5360
  29500. #define RF5362 0x5362
  29501. #define RF5370 0x5370
  29502. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29503. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29504. -@@ -7465,6 +7465,66 @@ static const struct rf_channel rf_vals_3
  29505. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29506. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29507. +@@ -7442,6 +7442,66 @@ static const struct rf_channel rf_vals_3
  29508. {173, 0x61, 0, 9},
  29509. };
  29510. @@ -98,7 +98,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29511. static const struct rf_channel rf_vals_5592_xtal20[] = {
  29512. /* Channel, N, K, mod, R */
  29513. {1, 482, 4, 10, 3},
  29514. -@@ -7694,6 +7754,11 @@ static int rt2800_probe_hw_mode(struct r
  29515. +@@ -7669,6 +7729,11 @@ static int rt2800_probe_hw_mode(struct r
  29516. spec->channels = rf_vals_3x;
  29517. break;
  29518. 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
  29519. index ab2673b..f15c22b 100644
  29520. --- a/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
  29521. +++ b/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
  29522. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: enable VCO calibration for RF3853
  29523. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29524. ---
  29525. - drivers/net/wireless/rt2x00/rt2800lib.c | 2 ++
  29526. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 2 ++
  29527. 1 file changed, 2 insertions(+)
  29528. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29529. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29530. -@@ -4402,6 +4402,7 @@ void rt2800_vco_calibration(struct rt2x0
  29531. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29532. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29533. +@@ -4379,6 +4379,7 @@ void rt2800_vco_calibration(struct rt2x0
  29534. case RF3053:
  29535. case RF3070:
  29536. case RF3290:
  29537. @@ -18,7 +18,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29538. case RF5360:
  29539. case RF5362:
  29540. case RF5370:
  29541. -@@ -7873,6 +7874,7 @@ static int rt2800_probe_hw_mode(struct r
  29542. +@@ -7848,6 +7849,7 @@ static int rt2800_probe_hw_mode(struct r
  29543. case RF3053:
  29544. case RF3070:
  29545. case RF3290:
  29546. 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
  29547. index 05ed444..c120f2c 100644
  29548. --- a/package/kernel/mac80211/patches/600-0012-rt2x00-rt2800lib-add-channel-configuration-function-.patch
  29549. +++ b/package/kernel/mac80211/patches/600-0012-rt2x00-rt2800lib-add-channel-configuration-function-.patch
  29550. @@ -6,12 +6,12 @@ Subject: [PATCH] rt2x00: rt2800lib: add channel configuration function for
  29551. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29552. ---
  29553. - drivers/net/wireless/rt2x00/rt2800lib.c | 208 +++++++++++++++++++++++++++++++
  29554. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 208 +++++++++++++++++++++++++++++++
  29555. 1 file changed, 208 insertions(+)
  29556. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29557. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29558. -@@ -2649,6 +2649,211 @@ static void rt2800_config_channel_rf3053
  29559. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29560. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29561. +@@ -2626,6 +2626,211 @@ static void rt2800_config_channel_rf3053
  29562. }
  29563. }
  29564. @@ -223,7 +223,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29565. #define POWER_BOUND 0x27
  29566. #define POWER_BOUND_5G 0x2b
  29567. -@@ -3261,6 +3466,9 @@ static void rt2800_config_channel(struct
  29568. +@@ -3238,6 +3443,9 @@ static void rt2800_config_channel(struct
  29569. case RF3322:
  29570. rt2800_config_channel_rf3322(rt2x00dev, conf, rf, info);
  29571. break;
  29572. 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
  29573. index 3b50775..f006304 100644
  29574. --- a/package/kernel/mac80211/patches/600-0013-rt2x00-rt2800lib-enable-RF3853-support.patch
  29575. +++ b/package/kernel/mac80211/patches/600-0013-rt2x00-rt2800lib-enable-RF3853-support.patch
  29576. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: enable RF3853 support
  29577. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29578. ---
  29579. - drivers/net/wireless/rt2x00/rt2800lib.c | 1 +
  29580. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 1 +
  29581. 1 file changed, 1 insertion(+)
  29582. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29583. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29584. -@@ -7430,6 +7430,7 @@ static int rt2800_init_eeprom(struct rt2
  29585. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29586. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29587. +@@ -7407,6 +7407,7 @@ static int rt2800_init_eeprom(struct rt2
  29588. case RF3290:
  29589. case RF3320:
  29590. case RF3322:
  29591. 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
  29592. index 4dfb068..a56bfa8 100644
  29593. --- a/package/kernel/mac80211/patches/600-0014-rt2x00-rt2800lib-add-MAC-register-initialization-for.patch
  29594. +++ b/package/kernel/mac80211/patches/600-0014-rt2x00-rt2800lib-add-MAC-register-initialization-for.patch
  29595. @@ -6,12 +6,12 @@ Subject: [PATCH] rt2x00: rt2800lib: add MAC register initialization for
  29596. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29597. ---
  29598. - drivers/net/wireless/rt2x00/rt2800.h | 14 ++++++++++++++
  29599. - drivers/net/wireless/rt2x00/rt2800lib.c | 19 ++++++++++++++++---
  29600. + drivers/net/wireless/ralink/rt2x00/rt2800.h | 14 ++++++++++++++
  29601. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 19 ++++++++++++++++---
  29602. 2 files changed, 30 insertions(+), 3 deletions(-)
  29603. ---- a/drivers/net/wireless/rt2x00/rt2800.h
  29604. -+++ b/drivers/net/wireless/rt2x00/rt2800.h
  29605. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
  29606. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
  29607. @@ -1588,6 +1588,20 @@
  29608. #define TX_PWR_CFG_9_STBC7_CH2 FIELD32(0x00000f00)
  29609. @@ -33,9 +33,9 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29610. * RX_FILTER_CFG: RX configuration register.
  29611. */
  29612. #define RX_FILTER_CFG 0x1400
  29613. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29614. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29615. -@@ -5005,6 +5005,12 @@ static int rt2800_init_registers(struct
  29616. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29617. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29618. +@@ -4982,6 +4982,12 @@ static int rt2800_init_registers(struct
  29619. rt2800_register_write(rt2x00dev, TX_SW_CFG2,
  29620. 0x00000000);
  29621. }
  29622. @@ -48,7 +48,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29623. } else if (rt2x00_rt(rt2x00dev, RT5390) ||
  29624. rt2x00_rt(rt2x00dev, RT5392) ||
  29625. rt2x00_rt(rt2x00dev, RT5592)) {
  29626. -@@ -5035,9 +5041,11 @@ static int rt2800_init_registers(struct
  29627. +@@ -5012,9 +5018,11 @@ static int rt2800_init_registers(struct
  29628. rt2800_register_read(rt2x00dev, MAX_LEN_CFG, &reg);
  29629. rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_MPDU, AGGREGATION_SIZE);
  29630. @@ -63,7 +63,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29631. rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 2);
  29632. else
  29633. rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 1);
  29634. -@@ -5190,6 +5198,11 @@ static int rt2800_init_registers(struct
  29635. +@@ -5167,6 +5175,11 @@ static int rt2800_init_registers(struct
  29636. reg = rt2x00_rt(rt2x00dev, RT5592) ? 0x00000082 : 0x00000002;
  29637. rt2800_register_write(rt2x00dev, TXOP_HLDR_ET, reg);
  29638. 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
  29639. index 837c025..d68ad50 100644
  29640. --- a/package/kernel/mac80211/patches/600-0015-rt2x00-rt2800soc-fix-rt2800soc_disable_radio-for-RT3.patch
  29641. +++ b/package/kernel/mac80211/patches/600-0015-rt2x00-rt2800soc-fix-rt2800soc_disable_radio-for-RT3.patch
  29642. @@ -5,11 +5,11 @@ Subject: [PATCH] rt2x00: rt2800soc: fix rt2800soc_disable_radio for RT3883
  29643. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29644. ---
  29645. - drivers/net/wireless/rt2x00/rt2800soc.c | 9 ++++++++-
  29646. + drivers/net/wireless/ralink/rt2x00/rt2800soc.c | 9 ++++++++-
  29647. 1 file changed, 8 insertions(+), 1 deletion(-)
  29648. ---- a/drivers/net/wireless/rt2x00/rt2800soc.c
  29649. -+++ b/drivers/net/wireless/rt2x00/rt2800soc.c
  29650. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
  29651. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
  29652. @@ -51,9 +51,16 @@ static bool rt2800soc_hwcrypt_disabled(s
  29653. static void rt2800soc_disable_radio(struct rt2x00_dev *rt2x00dev)
  29654. 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
  29655. index 6663b78..9532632 100644
  29656. --- a/package/kernel/mac80211/patches/600-0016-rt2x00-rt2800lib-add-BBP-register-initialization-for.patch
  29657. +++ b/package/kernel/mac80211/patches/600-0016-rt2x00-rt2800lib-add-BBP-register-initialization-for.patch
  29658. @@ -6,12 +6,12 @@ Subject: [PATCH] rt2x00: rt2800lib: add BBP register initialization for
  29659. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29660. ---
  29661. - drivers/net/wireless/rt2x00/rt2800lib.c | 44 +++++++++++++++++++++++++++++++
  29662. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 44 +++++++++++++++++++++++++++++++
  29663. 1 file changed, 44 insertions(+)
  29664. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29665. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29666. -@@ -5808,6 +5808,47 @@ static void rt2800_init_bbp_3593(struct
  29667. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29668. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29669. +@@ -5785,6 +5785,47 @@ static void rt2800_init_bbp_3593(struct
  29670. rt2800_bbp_write(rt2x00dev, 103, 0xc0);
  29671. }
  29672. @@ -59,7 +59,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29673. static void rt2800_init_bbp_53xx(struct rt2x00_dev *rt2x00dev)
  29674. {
  29675. int ant, div_mode;
  29676. -@@ -6026,6 +6067,9 @@ static void rt2800_init_bbp(struct rt2x0
  29677. +@@ -6003,6 +6044,9 @@ static void rt2800_init_bbp(struct rt2x0
  29678. case RT3593:
  29679. rt2800_init_bbp_3593(rt2x00dev);
  29680. return;
  29681. 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
  29682. index 6e66f14..936fa35 100644
  29683. --- a/package/kernel/mac80211/patches/600-0017-rt2x00-rt2800lib-add-RFCSR-initialization-for-RT3883.patch
  29684. +++ b/package/kernel/mac80211/patches/600-0017-rt2x00-rt2800lib-add-RFCSR-initialization-for-RT3883.patch
  29685. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: add RFCSR initialization for RT3883
  29686. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29687. ---
  29688. - drivers/net/wireless/rt2x00/rt2800.h | 1 +
  29689. - drivers/net/wireless/rt2x00/rt2800lib.c | 141 +++++++++++++++++++++++++++++++
  29690. + drivers/net/wireless/ralink/rt2x00/rt2800.h | 1 +
  29691. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 141 +++++++++++++++++++++++++++++++
  29692. 2 files changed, 142 insertions(+)
  29693. ---- a/drivers/net/wireless/rt2x00/rt2800.h
  29694. -+++ b/drivers/net/wireless/rt2x00/rt2800.h
  29695. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
  29696. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
  29697. @@ -2171,6 +2171,7 @@ struct mac_iveiv_entry {
  29698. /*
  29699. * RFCSR 2:
  29700. @@ -19,9 +19,9 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29701. #define RFCSR2_RESCAL_EN FIELD8(0x80)
  29702. /*
  29703. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29704. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29705. -@@ -6843,6 +6843,144 @@ static void rt2800_init_rfcsr_3593(struc
  29706. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29707. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29708. +@@ -6820,6 +6820,144 @@ static void rt2800_init_rfcsr_3593(struc
  29709. /* TODO: enable stream mode support */
  29710. }
  29711. @@ -166,7 +166,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29712. static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
  29713. {
  29714. rt2800_rf_init_calibration(rt2x00dev, 2);
  29715. -@@ -7074,6 +7212,9 @@ static void rt2800_init_rfcsr(struct rt2
  29716. +@@ -7051,6 +7189,9 @@ static void rt2800_init_rfcsr(struct rt2
  29717. case RT3390:
  29718. rt2800_init_rfcsr_3390(rt2x00dev);
  29719. break;
  29720. 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
  29721. index 57af961..ae899f7 100644
  29722. --- a/package/kernel/mac80211/patches/600-0018-rt2x00-rt2800lib-use-the-extended-EEPROM-map-for-RT3.patch
  29723. +++ b/package/kernel/mac80211/patches/600-0018-rt2x00-rt2800lib-use-the-extended-EEPROM-map-for-RT3.patch
  29724. @@ -5,11 +5,11 @@ Subject: [PATCH] rt2x00: rt2800lib: use the extended EEPROM map for RT3883
  29725. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29726. ---
  29727. - drivers/net/wireless/rt2x00/rt2800lib.c | 3 ++-
  29728. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ++-
  29729. 1 file changed, 2 insertions(+), 1 deletion(-)
  29730. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29731. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29732. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29733. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29734. @@ -342,7 +342,8 @@ static unsigned int rt2800_eeprom_word_i
  29735. wiphy_name(rt2x00dev->hw->wiphy), word))
  29736. return 0;
  29737. 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
  29738. index 9390f7e..bcaf676 100644
  29739. --- a/package/kernel/mac80211/patches/600-0019-rt2x00-rt2800lib-force-rf-type-to-RF3853-on-RT3883.patch
  29740. +++ b/package/kernel/mac80211/patches/600-0019-rt2x00-rt2800lib-force-rf-type-to-RF3853-on-RT3883.patch
  29741. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: force rf type to RF3853 on RT3883
  29742. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29743. ---
  29744. - drivers/net/wireless/rt2x00/rt2800lib.c | 2 ++
  29745. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 2 ++
  29746. 1 file changed, 2 insertions(+)
  29747. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29748. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29749. -@@ -7611,6 +7611,8 @@ static int rt2800_init_eeprom(struct rt2
  29750. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29751. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29752. +@@ -7588,6 +7588,8 @@ static int rt2800_init_eeprom(struct rt2
  29753. rt2x00_rt(rt2x00dev, RT5390) ||
  29754. rt2x00_rt(rt2x00dev, RT5392))
  29755. rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &rf);
  29756. 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
  29757. index 1cba4f6..3169c10 100644
  29758. --- a/package/kernel/mac80211/patches/600-0020-rt2x00-rt2800lib-add-channel-configuration-code-for-.patch
  29759. +++ b/package/kernel/mac80211/patches/600-0020-rt2x00-rt2800lib-add-channel-configuration-code-for-.patch
  29760. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: add channel configuration code for RT3883
  29761. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29762. ---
  29763. - drivers/net/wireless/rt2x00/rt2800lib.c | 72 +++++++++++++++++++++++++++++--
  29764. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 72 +++++++++++++++++++++++++++++--
  29765. 1 file changed, 69 insertions(+), 3 deletions(-)
  29766. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29767. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29768. -@@ -3429,6 +3429,36 @@ static char rt2800_txpower_to_dev(struct
  29769. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29770. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29771. +@@ -3406,6 +3406,36 @@ static char rt2800_txpower_to_dev(struct
  29772. return clamp_t(char, txpower, MIN_A_TXPOWER, MAX_A_TXPOWER);
  29773. }
  29774. @@ -47,7 +47,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29775. static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
  29776. struct ieee80211_conf *conf,
  29777. struct rf_channel *rf,
  29778. -@@ -3447,6 +3477,12 @@ static void rt2800_config_channel(struct
  29779. +@@ -3424,6 +3454,12 @@ static void rt2800_config_channel(struct
  29780. rt2800_txpower_to_dev(rt2x00dev, rf->channel,
  29781. info->default_power3);
  29782. @@ -60,7 +60,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29783. switch (rt2x00dev->chip.rf) {
  29784. case RF2020:
  29785. case RF3020:
  29786. -@@ -3530,6 +3566,15 @@ static void rt2800_config_channel(struct
  29787. +@@ -3507,6 +3543,15 @@ static void rt2800_config_channel(struct
  29788. rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain);
  29789. rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain);
  29790. rt2800_bbp_write(rt2x00dev, 77, 0x98);
  29791. @@ -76,7 +76,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29792. } else {
  29793. rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain);
  29794. rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain);
  29795. -@@ -3542,6 +3587,7 @@ static void rt2800_config_channel(struct
  29796. +@@ -3519,6 +3564,7 @@ static void rt2800_config_channel(struct
  29797. !rt2x00_rt(rt2x00dev, RT5392)) {
  29798. if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
  29799. rt2800_bbp_write(rt2x00dev, 82, 0x62);
  29800. @@ -84,7 +84,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29801. rt2800_bbp_write(rt2x00dev, 75, 0x46);
  29802. } else {
  29803. if (rt2x00_rt(rt2x00dev, RT3593))
  29804. -@@ -3550,19 +3596,22 @@ static void rt2800_config_channel(struct
  29805. +@@ -3527,19 +3573,22 @@ static void rt2800_config_channel(struct
  29806. rt2800_bbp_write(rt2x00dev, 82, 0x84);
  29807. rt2800_bbp_write(rt2x00dev, 75, 0x50);
  29808. }
  29809. @@ -110,7 +110,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29810. rt2800_bbp_write(rt2x00dev, 83, 0x9a);
  29811. if (rt2x00_has_cap_external_lna_a(rt2x00dev))
  29812. -@@ -3684,6 +3733,23 @@ static void rt2800_config_channel(struct
  29813. +@@ -3661,6 +3710,23 @@ static void rt2800_config_channel(struct
  29814. rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg);
  29815. 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
  29816. index 1773128..fa646d2 100644
  29817. --- a/package/kernel/mac80211/patches/600-0021-rt2x00-rt2800lib-fix-txpower_to_dev-function-for-RT3.patch
  29818. +++ b/package/kernel/mac80211/patches/600-0021-rt2x00-rt2800lib-fix-txpower_to_dev-function-for-RT3.patch
  29819. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: fix txpower_to_dev function for RT3883
  29820. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29821. ---
  29822. - drivers/net/wireless/rt2x00/rt2800lib.c | 6 ++++--
  29823. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 6 ++++--
  29824. 1 file changed, 4 insertions(+), 2 deletions(-)
  29825. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29826. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29827. -@@ -3416,13 +3416,15 @@ static char rt2800_txpower_to_dev(struct
  29828. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29829. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29830. +@@ -3393,13 +3393,15 @@ static char rt2800_txpower_to_dev(struct
  29831. unsigned int channel,
  29832. char txpower)
  29833. {
  29834. 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
  29835. index 36f0a4c..c068769 100644
  29836. --- a/package/kernel/mac80211/patches/600-0022-rt2x00-rt2800lib-use-correct-txpower-calculation-fun.patch
  29837. +++ b/package/kernel/mac80211/patches/600-0022-rt2x00-rt2800lib-use-correct-txpower-calculation-fun.patch
  29838. @@ -6,12 +6,12 @@ Subject: [PATCH] rt2x00: rt2800lib: use correct txpower calculation function
  29839. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29840. ---
  29841. - drivers/net/wireless/rt2x00/rt2800lib.c | 3 ++-
  29842. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ++-
  29843. 1 file changed, 2 insertions(+), 1 deletion(-)
  29844. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29845. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29846. -@@ -4635,7 +4635,8 @@ static void rt2800_config_txpower(struct
  29847. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29848. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29849. +@@ -4612,7 +4612,8 @@ static void rt2800_config_txpower(struct
  29850. struct ieee80211_channel *chan,
  29851. int power_level)
  29852. {
  29853. 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
  29854. index 8119f97..74d80de 100644
  29855. --- a/package/kernel/mac80211/patches/600-0023-rt2x00-rt2800lib-hardcode-txmixer-gain-values-to-zer.patch
  29856. +++ b/package/kernel/mac80211/patches/600-0023-rt2x00-rt2800lib-hardcode-txmixer-gain-values-to-zer.patch
  29857. @@ -6,12 +6,12 @@ Subject: [PATCH] rt2x00: rt2800lib: hardcode txmixer gain values to zero for
  29858. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29859. ---
  29860. - drivers/net/wireless/rt2x00/rt2800lib.c | 6 ++++--
  29861. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 6 ++++--
  29862. 1 file changed, 4 insertions(+), 2 deletions(-)
  29863. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29864. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29865. -@@ -7493,7 +7493,8 @@ static u8 rt2800_get_txmixer_gain_24g(st
  29866. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29867. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29868. +@@ -7470,7 +7470,8 @@ static u8 rt2800_get_txmixer_gain_24g(st
  29869. {
  29870. u16 word;
  29871. @@ -21,7 +21,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29872. return 0;
  29873. rt2800_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_BG, &word);
  29874. -@@ -7507,7 +7508,8 @@ static u8 rt2800_get_txmixer_gain_5g(str
  29875. +@@ -7484,7 +7485,8 @@ static u8 rt2800_get_txmixer_gain_5g(str
  29876. {
  29877. u16 word;
  29878. 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
  29879. index 53435aa..1259286 100644
  29880. --- a/package/kernel/mac80211/patches/600-0024-rt2x00-rt2800lib-use-correct-RT-XWI-size-for-RT3883.patch
  29881. +++ b/package/kernel/mac80211/patches/600-0024-rt2x00-rt2800lib-use-correct-RT-XWI-size-for-RT3883.patch
  29882. @@ -5,11 +5,11 @@ Subject: [PATCH] rt2x00: rt2800lib: use correct [RT]XWI size for RT3883
  29883. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29884. ---
  29885. - drivers/net/wireless/rt2x00/rt2800lib.c | 1 +
  29886. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 1 +
  29887. 1 file changed, 1 insertion(+)
  29888. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29889. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29890. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29891. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29892. @@ -558,6 +558,7 @@ void rt2800_get_txwi_rxwi_size(struct rt
  29893. {
  29894. switch (rt2x00dev->chip.rt) {
  29895. 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
  29896. index 08f3f88..0dcc027 100644
  29897. --- a/package/kernel/mac80211/patches/600-0025-rt2x00-rt2800lib-use-correct-beacon-base-for-RT3883.patch
  29898. +++ b/package/kernel/mac80211/patches/600-0025-rt2x00-rt2800lib-use-correct-beacon-base-for-RT3883.patch
  29899. @@ -5,11 +5,11 @@ Subject: [PATCH] rt2x00: rt2800lib: use correct beacon base for RT3883
  29900. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29901. ---
  29902. - drivers/net/wireless/rt2x00/rt2800lib.c | 3 ++-
  29903. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ++-
  29904. 1 file changed, 2 insertions(+), 1 deletion(-)
  29905. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29906. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29907. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29908. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29909. @@ -983,7 +983,8 @@ EXPORT_SYMBOL_GPL(rt2800_txdone_entry);
  29910. static unsigned int rt2800_hw_beacon_base(struct rt2x00_dev *rt2x00dev,
  29911. unsigned int index)
  29912. 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
  29913. index dfbdee7..6ce224a 100644
  29914. --- a/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch
  29915. +++ b/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch
  29916. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: use correct beacon count for RT3883
  29917. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29918. ---
  29919. - drivers/net/wireless/rt2x00/rt2800lib.c | 3 ++-
  29920. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ++-
  29921. 1 file changed, 2 insertions(+), 1 deletion(-)
  29922. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29923. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29924. -@@ -8428,7 +8428,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  29925. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29926. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29927. +@@ -8403,7 +8403,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  29928. if (rt2x00_rt(rt2x00dev, RT3593))
  29929. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  29930. 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
  29931. index 22f7110..3936368 100644
  29932. --- a/package/kernel/mac80211/patches/600-0027-rt2x00-rt2800lib-fix-antenna-configuration-for-RT388.patch
  29933. +++ b/package/kernel/mac80211/patches/600-0027-rt2x00-rt2800lib-fix-antenna-configuration-for-RT388.patch
  29934. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: fix antenna configuration for RT3883
  29935. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29936. ---
  29937. - drivers/net/wireless/rt2x00/rt2800lib.c | 3 ++-
  29938. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ++-
  29939. 1 file changed, 2 insertions(+), 1 deletion(-)
  29940. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29941. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29942. -@@ -1961,7 +1961,8 @@ void rt2800_config_ant(struct rt2x00_dev
  29943. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29944. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29945. +@@ -1938,7 +1938,8 @@ void rt2800_config_ant(struct rt2x00_dev
  29946. rt2800_bbp_write(rt2x00dev, 3, r3);
  29947. rt2800_bbp_write(rt2x00dev, 1, r1);
  29948. 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
  29949. index 9945f38..f028587 100644
  29950. --- a/package/kernel/mac80211/patches/600-0028-rt2x00-rt2800lib-fix-LNA-gain-configuration-for-RT38.patch
  29951. +++ b/package/kernel/mac80211/patches/600-0028-rt2x00-rt2800lib-fix-LNA-gain-configuration-for-RT38.patch
  29952. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: fix LNA gain configuration for RT3883
  29953. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29954. ---
  29955. - drivers/net/wireless/rt2x00/rt2800lib.c | 6 ++++--
  29956. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 6 ++++--
  29957. 1 file changed, 4 insertions(+), 2 deletions(-)
  29958. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29959. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29960. -@@ -1984,7 +1984,8 @@ static void rt2800_config_lna_gain(struc
  29961. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29962. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29963. +@@ -1961,7 +1961,8 @@ static void rt2800_config_lna_gain(struc
  29964. rt2800_eeprom_read(rt2x00dev, EEPROM_LNA, &eeprom);
  29965. lna_gain = rt2x00_get_field16(eeprom, EEPROM_LNA_A0);
  29966. } else if (libconf->rf.channel <= 128) {
  29967. @@ -20,7 +20,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29968. rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2, &eeprom);
  29969. lna_gain = rt2x00_get_field16(eeprom,
  29970. EEPROM_EXT_LNA2_A1);
  29971. -@@ -1994,7 +1995,8 @@ static void rt2800_config_lna_gain(struc
  29972. +@@ -1971,7 +1972,8 @@ static void rt2800_config_lna_gain(struc
  29973. EEPROM_RSSI_BG2_LNA_A1);
  29974. }
  29975. } else {
  29976. 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
  29977. index beadea8..ab8c625 100644
  29978. --- a/package/kernel/mac80211/patches/600-0029-rt2x00-rt2800lib-fix-VGC-setup-for-RT3883.patch
  29979. +++ b/package/kernel/mac80211/patches/600-0029-rt2x00-rt2800lib-fix-VGC-setup-for-RT3883.patch
  29980. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: fix VGC setup for RT3883
  29981. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29982. ---
  29983. - drivers/net/wireless/rt2x00/rt2800lib.c | 11 +++++++++--
  29984. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 11 +++++++++--
  29985. 1 file changed, 9 insertions(+), 2 deletions(-)
  29986. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  29987. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  29988. -@@ -4835,7 +4835,8 @@ static u8 rt2800_get_default_vgc(struct
  29989. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29990. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  29991. +@@ -4812,7 +4812,8 @@ static u8 rt2800_get_default_vgc(struct
  29992. else
  29993. vgc = 0x2e + rt2x00dev->lna_gain;
  29994. } else { /* 5GHZ band */
  29995. @@ -20,7 +20,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  29996. vgc = 0x20 + (rt2x00dev->lna_gain * 5) / 3;
  29997. else if (rt2x00_rt(rt2x00dev, RT5592))
  29998. vgc = 0x24 + (2 * rt2x00dev->lna_gain);
  29999. -@@ -4855,7 +4856,8 @@ static inline void rt2800_set_vgc(struct
  30000. +@@ -4832,7 +4833,8 @@ static inline void rt2800_set_vgc(struct
  30001. {
  30002. if (qual->vgc_level != vgc_level) {
  30003. if (rt2x00_rt(rt2x00dev, RT3572) ||
  30004. @@ -30,7 +30,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  30005. rt2800_bbp_write_with_rx_chain(rt2x00dev, 66,
  30006. vgc_level);
  30007. } else if (rt2x00_rt(rt2x00dev, RT5592)) {
  30008. -@@ -4902,6 +4904,11 @@ void rt2800_link_tuner(struct rt2x00_dev
  30009. +@@ -4879,6 +4881,11 @@ void rt2800_link_tuner(struct rt2x00_dev
  30010. }
  30011. break;
  30012. 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
  30013. index a6c0f58..49830a1 100644
  30014. --- a/package/kernel/mac80211/patches/600-0030-rt2x00-rt2800lib-fix-EEPROM-LNA-validation-for-RT388.patch
  30015. +++ b/package/kernel/mac80211/patches/600-0030-rt2x00-rt2800lib-fix-EEPROM-LNA-validation-for-RT388.patch
  30016. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: fix EEPROM LNA validation for RT3883
  30017. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  30018. ---
  30019. - drivers/net/wireless/rt2x00/rt2800lib.c | 9 ++++++---
  30020. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 9 ++++++---
  30021. 1 file changed, 6 insertions(+), 3 deletions(-)
  30022. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  30023. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  30024. -@@ -7630,7 +7630,8 @@ static int rt2800_validate_eeprom(struct
  30025. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30026. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30027. +@@ -7607,7 +7607,8 @@ static int rt2800_validate_eeprom(struct
  30028. rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2, &word);
  30029. if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG2_OFFSET2)) > 10)
  30030. rt2x00_set_field16(&word, EEPROM_RSSI_BG2_OFFSET2, 0);
  30031. @@ -20,7 +20,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  30032. if (rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0x00 ||
  30033. rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0xff)
  30034. rt2x00_set_field16(&word, EEPROM_RSSI_BG2_LNA_A1,
  30035. -@@ -7650,7 +7651,8 @@ static int rt2800_validate_eeprom(struct
  30036. +@@ -7627,7 +7628,8 @@ static int rt2800_validate_eeprom(struct
  30037. rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_A2, &word);
  30038. if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A2_OFFSET2)) > 10)
  30039. rt2x00_set_field16(&word, EEPROM_RSSI_A2_OFFSET2, 0);
  30040. @@ -30,7 +30,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  30041. if (rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0x00 ||
  30042. rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0xff)
  30043. rt2x00_set_field16(&word, EEPROM_RSSI_A2_LNA_A2,
  30044. -@@ -7658,7 +7660,8 @@ static int rt2800_validate_eeprom(struct
  30045. +@@ -7635,7 +7637,8 @@ static int rt2800_validate_eeprom(struct
  30046. }
  30047. rt2800_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word);
  30048. 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
  30049. index 910f9ec..6e22847 100644
  30050. --- a/package/kernel/mac80211/patches/600-0031-rt2x00-rt2800lib-fix-txpower-compensation-for-RT3883.patch
  30051. +++ b/package/kernel/mac80211/patches/600-0031-rt2x00-rt2800lib-fix-txpower-compensation-for-RT3883.patch
  30052. @@ -5,12 +5,12 @@ Subject: [PATCH] rt2x00: rt2800lib: fix txpower compensation for RT3883
  30053. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  30054. ---
  30055. - drivers/net/wireless/rt2x00/rt2800lib.c | 3 +++
  30056. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 +++
  30057. 1 file changed, 3 insertions(+)
  30058. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  30059. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  30060. -@@ -4005,6 +4005,9 @@ static u8 rt2800_compensate_txpower(stru
  30061. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30062. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30063. +@@ -3982,6 +3982,9 @@ static u8 rt2800_compensate_txpower(stru
  30064. if (rt2x00_rt(rt2x00dev, RT3593))
  30065. return min_t(u8, txpower, 0xc);
  30066. 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
  30067. index bcdfc67..25753af 100644
  30068. --- a/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch
  30069. +++ b/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch
  30070. @@ -6,12 +6,12 @@ Subject: [PATCH] rt2x00: rt2800lib: enable RT2800_HAS_HIGH_SHARED_MEM for
  30071. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  30072. ---
  30073. - drivers/net/wireless/rt2x00/rt2800lib.c | 3 ++-
  30074. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ++-
  30075. 1 file changed, 2 insertions(+), 1 deletion(-)
  30076. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  30077. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  30078. -@@ -8441,7 +8441,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  30079. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30080. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30081. +@@ -8416,7 +8416,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  30082. if (retval)
  30083. return retval;
  30084. 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
  30085. index dc06e6a..4f2e754 100644
  30086. --- a/package/kernel/mac80211/patches/600-0033-rt2x00-rt2800lib-use-high-memory-for-beacons-on-RT38.patch
  30087. +++ b/package/kernel/mac80211/patches/600-0033-rt2x00-rt2800lib-use-high-memory-for-beacons-on-RT38.patch
  30088. @@ -5,11 +5,11 @@ Subject: [PATCH] rt2x00: rt2800lib: use high memory for beacons on RT3883
  30089. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  30090. ---
  30091. - drivers/net/wireless/rt2x00/rt2800lib.c | 3 ++-
  30092. + drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ++-
  30093. 1 file changed, 2 insertions(+), 1 deletion(-)
  30094. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  30095. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  30096. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30097. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30098. @@ -97,7 +97,8 @@ static inline void rt2800_shared_mem_sel
  30099. static inline bool rt2800_beacon_uses_high_mem(struct rt2x00_dev *rt2x00dev)
  30100. 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
  30101. index 212eb4e..a497b5e 100644
  30102. --- a/package/kernel/mac80211/patches/600-0034-rt2x00-rt2800mmio-add-a-workaround-for-spurious-TX_F.patch
  30103. +++ b/package/kernel/mac80211/patches/600-0034-rt2x00-rt2800mmio-add-a-workaround-for-spurious-TX_F.patch
  30104. @@ -6,12 +6,12 @@ Subject: [PATCH] rt2x00: rt2800mmio: add a workaround for spurious
  30105. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  30106. ---
  30107. - drivers/net/wireless/rt2x00/rt2800mmio.c | 72 +++++++++++++++++++++++++-----
  30108. - drivers/net/wireless/rt2x00/rt2x00.h | 5 +++
  30109. + drivers/net/wireless/ralink/rt2x00/rt2800mmio.c | 72 +++++++++++++++++++++++++-----
  30110. + drivers/net/wireless/ralink/rt2x00/rt2x00.h | 5 +++
  30111. 2 files changed, 65 insertions(+), 12 deletions(-)
  30112. ---- a/drivers/net/wireless/rt2x00/rt2800mmio.c
  30113. -+++ b/drivers/net/wireless/rt2x00/rt2800mmio.c
  30114. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
  30115. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
  30116. @@ -415,9 +415,9 @@ void rt2800mmio_autowake_tasklet(unsigne
  30117. }
  30118. EXPORT_SYMBOL_GPL(rt2800mmio_autowake_tasklet);
  30119. @@ -120,9 +120,9 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  30120. /*
  30121. * Never disable the TX_FIFO_STATUS interrupt.
  30122. */
  30123. ---- a/drivers/net/wireless/rt2x00/rt2x00.h
  30124. -+++ b/drivers/net/wireless/rt2x00/rt2x00.h
  30125. -@@ -987,6 +987,11 @@ struct rt2x00_dev {
  30126. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  30127. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  30128. +@@ -991,6 +991,11 @@ struct rt2x00_dev {
  30129. int rf_channel;
  30130. /*
  30131. diff --git a/package/kernel/mac80211/patches/601-rt2x00-set_pci_mwi.patch b/package/kernel/mac80211/patches/601-rt2x00-set_pci_mwi.patch
  30132. index 08c8fa6..a407161 100644
  30133. --- a/package/kernel/mac80211/patches/601-rt2x00-set_pci_mwi.patch
  30134. +++ b/package/kernel/mac80211/patches/601-rt2x00-set_pci_mwi.patch
  30135. @@ -1,5 +1,5 @@
  30136. ---- a/drivers/net/wireless/rt2x00/rt2x00pci.c
  30137. -+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
  30138. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00pci.c
  30139. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00pci.c
  30140. @@ -94,8 +94,10 @@ int rt2x00pci_probe(struct pci_dev *pci_
  30141. pci_set_master(pci_dev);
  30142. 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
  30143. index 8c71075..7a183a4 100644
  30144. --- a/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00_platform_h.patch
  30145. +++ b/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00_platform_h.patch
  30146. @@ -20,8 +20,8 @@
  30147. +};
  30148. +
  30149. +#endif /* _RT2X00_PLATFORM_H */
  30150. ---- a/drivers/net/wireless/rt2x00/rt2x00.h
  30151. -+++ b/drivers/net/wireless/rt2x00/rt2x00.h
  30152. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  30153. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  30154. @@ -38,6 +38,7 @@
  30155. #include <linux/kfifo.h>
  30156. #include <linux/hrtimer.h>
  30157. diff --git a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  30158. index 8f650a2..bc056cd 100644
  30159. --- a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  30160. +++ b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  30161. @@ -1,15 +1,15 @@
  30162. --- a/.local-symbols
  30163. +++ b/.local-symbols
  30164. -@@ -263,6 +263,7 @@ RT2X00_LIB_FIRMWARE=
  30165. +@@ -329,6 +329,7 @@ RT2X00_LIB_FIRMWARE=
  30166. RT2X00_LIB_CRYPTO=
  30167. RT2X00_LIB_LEDS=
  30168. RT2X00_LIB_DEBUGFS=
  30169. +RT2X00_LIB_EEPROM=
  30170. RT2X00_DEBUG=
  30171. - RTL_CARDS=
  30172. - RTL8192CE=
  30173. ---- a/drivers/net/wireless/rt2x00/Kconfig
  30174. -+++ b/drivers/net/wireless/rt2x00/Kconfig
  30175. + WLAN_VENDOR_REALTEK=
  30176. + RTL8180=
  30177. +--- a/drivers/net/wireless/ralink/rt2x00/Kconfig
  30178. ++++ b/drivers/net/wireless/ralink/rt2x00/Kconfig
  30179. @@ -69,6 +69,7 @@ config RT2800PCI
  30180. select RT2X00_LIB_MMIO
  30181. select RT2X00_LIB_PCI
  30182. @@ -26,7 +26,7 @@
  30183. select RT2800_LIB
  30184. select RT2800_LIB_MMIO
  30185. ---help---
  30186. -@@ -266,6 +268,9 @@ config RT2X00_LIB_FIRMWARE
  30187. +@@ -265,6 +267,9 @@ config RT2X00_LIB_FIRMWARE
  30188. config RT2X00_LIB_CRYPTO
  30189. bool
  30190. @@ -36,8 +36,8 @@
  30191. config RT2X00_LIB_LEDS
  30192. bool
  30193. default y if (RT2X00_LIB=y && LEDS_CLASS=y) || (RT2X00_LIB=m && LEDS_CLASS!=n)
  30194. ---- a/drivers/net/wireless/rt2x00/Makefile
  30195. -+++ b/drivers/net/wireless/rt2x00/Makefile
  30196. +--- a/drivers/net/wireless/ralink/rt2x00/Makefile
  30197. ++++ b/drivers/net/wireless/ralink/rt2x00/Makefile
  30198. @@ -7,6 +7,7 @@ rt2x00lib-$(CPTCFG_RT2X00_LIB_DEBUGFS) +
  30199. rt2x00lib-$(CPTCFG_RT2X00_LIB_CRYPTO) += rt2x00crypto.o
  30200. rt2x00lib-$(CPTCFG_RT2X00_LIB_FIRMWARE) += rt2x00firmware.o
  30201. @@ -46,9 +46,9 @@
  30202. obj-$(CPTCFG_RT2X00_LIB) += rt2x00lib.o
  30203. obj-$(CPTCFG_RT2X00_LIB_MMIO) += rt2x00mmio.o
  30204. ---- a/drivers/net/wireless/rt2x00/rt2800lib.h
  30205. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.h
  30206. -@@ -43,6 +43,8 @@ struct rt2800_drv_data {
  30207. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
  30208. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
  30209. +@@ -46,6 +46,8 @@ struct rt2800_drv_data {
  30210. } shmem_lock;
  30211. };
  30212. @@ -57,7 +57,7 @@
  30213. struct rt2800_ops {
  30214. void (*register_read)(struct rt2x00_dev *rt2x00dev,
  30215. const unsigned int offset, u32 *value);
  30216. -@@ -176,6 +178,15 @@ static inline int rt2800_read_eeprom(str
  30217. +@@ -179,6 +181,15 @@ static inline int rt2800_read_eeprom(str
  30218. {
  30219. const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
  30220. @@ -73,8 +73,8 @@
  30221. return rt2800ops->read_eeprom(rt2x00dev);
  30222. }
  30223. ---- a/drivers/net/wireless/rt2x00/rt2800soc.c
  30224. -+++ b/drivers/net/wireless/rt2x00/rt2800soc.c
  30225. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
  30226. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
  30227. @@ -102,19 +102,6 @@ static int rt2800soc_set_device_state(st
  30228. return retval;
  30229. }
  30230. @@ -103,9 +103,9 @@
  30231. .hwcrypt_disabled = rt2800soc_hwcrypt_disabled,
  30232. .drv_write_firmware = rt2800soc_write_firmware,
  30233. .drv_init_registers = rt2800mmio_init_registers,
  30234. ---- a/drivers/net/wireless/rt2x00/rt2x00.h
  30235. -+++ b/drivers/net/wireless/rt2x00/rt2x00.h
  30236. -@@ -695,6 +695,7 @@ enum rt2x00_capability_flags {
  30237. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  30238. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  30239. +@@ -697,6 +697,7 @@ enum rt2x00_capability_flags {
  30240. REQUIRE_HT_TX_DESC,
  30241. REQUIRE_PS_AUTOWAKE,
  30242. REQUIRE_DELAYED_RFKILL,
  30243. @@ -113,7 +113,7 @@
  30244. /*
  30245. * Capabilities
  30246. -@@ -964,6 +965,11 @@ struct rt2x00_dev {
  30247. +@@ -968,6 +969,11 @@ struct rt2x00_dev {
  30248. const struct firmware *fw;
  30249. /*
  30250. @@ -125,9 +125,9 @@
  30251. * FIFO for storing tx status reports between isr and tasklet.
  30252. */
  30253. DECLARE_KFIFO_PTR(txstatus_fifo, u32);
  30254. ---- a/drivers/net/wireless/rt2x00/rt2x00dev.c
  30255. -+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
  30256. -@@ -1334,6 +1334,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de
  30257. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  30258. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  30259. +@@ -1335,6 +1335,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de
  30260. INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup);
  30261. INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep);
  30262. @@ -138,7 +138,7 @@
  30263. /*
  30264. * Let the driver probe the device to detect the capabilities.
  30265. */
  30266. -@@ -1474,6 +1478,11 @@ void rt2x00lib_remove_dev(struct rt2x00_
  30267. +@@ -1475,6 +1479,11 @@ void rt2x00lib_remove_dev(struct rt2x00_
  30268. * Free the driver data.
  30269. */
  30270. kfree(rt2x00dev->drv_data);
  30271. @@ -151,7 +151,7 @@
  30272. EXPORT_SYMBOL_GPL(rt2x00lib_remove_dev);
  30273. --- /dev/null
  30274. -+++ b/drivers/net/wireless/rt2x00/rt2x00eeprom.c
  30275. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c
  30276. @@ -0,0 +1,111 @@
  30277. +/*
  30278. + Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
  30279. @@ -264,8 +264,8 @@
  30280. + release_firmware(rt2x00dev->eeprom_file);
  30281. + rt2x00dev->eeprom_file = NULL;
  30282. +}
  30283. ---- a/drivers/net/wireless/rt2x00/rt2x00lib.h
  30284. -+++ b/drivers/net/wireless/rt2x00/rt2x00lib.h
  30285. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00lib.h
  30286. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00lib.h
  30287. @@ -320,6 +320,22 @@ static inline void rt2x00lib_free_firmwa
  30288. #endif /* CPTCFG_RT2X00_LIB_FIRMWARE */
  30289. @@ -289,8 +289,8 @@
  30290. * Debugfs handlers.
  30291. */
  30292. #ifdef CPTCFG_RT2X00_LIB_DEBUGFS
  30293. ---- a/drivers/net/wireless/rt2x00/rt2x00soc.c
  30294. -+++ b/drivers/net/wireless/rt2x00/rt2x00soc.c
  30295. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00soc.c
  30296. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00soc.c
  30297. @@ -92,6 +92,7 @@ int rt2x00soc_probe(struct platform_devi
  30298. rt2x00dev->hw = hw;
  30299. rt2x00dev->irq = platform_get_irq(pdev, 0);
  30300. 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
  30301. index 4bc6f37..9dffef1 100644
  30302. --- a/package/kernel/mac80211/patches/604-rt2x00-of_load_eeprom_filename.patch
  30303. +++ b/package/kernel/mac80211/patches/604-rt2x00-of_load_eeprom_filename.patch
  30304. @@ -1,5 +1,5 @@
  30305. ---- a/drivers/net/wireless/rt2x00/rt2x00eeprom.c
  30306. -+++ b/drivers/net/wireless/rt2x00/rt2x00eeprom.c
  30307. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c
  30308. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c
  30309. @@ -26,6 +26,7 @@
  30310. #include <linux/kernel.h>
  30311. 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
  30312. index 75f0415..5dceff8 100644
  30313. --- a/package/kernel/mac80211/patches/605-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch
  30314. +++ b/package/kernel/mac80211/patches/605-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch
  30315. @@ -6,12 +6,12 @@ Subject: [PATCH] rt2x00: load eeprom on SoC from a mtd device defines inside
  30316. Signed-off-by: John Crispin <blogic@openwrt.org>
  30317. ---
  30318. - drivers/net/wireless/rt2x00/Kconfig | 1 +
  30319. - drivers/net/wireless/rt2x00/rt2800pci.c | 44 ++++++++++++++++++++++++++-----
  30320. + drivers/net/wireless/ralink/rt2x00/Kconfig | 1 +
  30321. + drivers/net/wireless/ralink/rt2x00/rt2800pci.c | 44 ++++++++++++++++++++++++++-----
  30322. 2 files changed, 39 insertions(+), 6 deletions(-)
  30323. ---- a/drivers/net/wireless/rt2x00/Kconfig
  30324. -+++ b/drivers/net/wireless/rt2x00/Kconfig
  30325. +--- a/drivers/net/wireless/ralink/rt2x00/Kconfig
  30326. ++++ b/drivers/net/wireless/ralink/rt2x00/Kconfig
  30327. @@ -219,6 +219,7 @@ config RT2800SOC
  30328. select RT2X00_LIB_EEPROM
  30329. select RT2800_LIB
  30330. @@ -20,8 +20,8 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  30331. ---help---
  30332. This adds support for Ralink WiSoC devices.
  30333. Supported chips: RT2880, RT3050, RT3052, RT3350, RT3352.
  30334. ---- a/drivers/net/wireless/rt2x00/rt2x00eeprom.c
  30335. -+++ b/drivers/net/wireless/rt2x00/rt2x00eeprom.c
  30336. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c
  30337. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c
  30338. @@ -26,11 +26,66 @@
  30339. #include <linux/kernel.h>
  30340. @@ -79,7 +79,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  30341. + if (!ret) {
  30342. + rt2x00dev->eeprom_file = &mtd_fw;
  30343. + mtd_fw.size = len;
  30344. -+ mtd_fw.data = rt2x00dev->eeprom;
  30345. ++ mtd_fw.data = (const u8 *) rt2x00dev->eeprom;
  30346. + }
  30347. +#endif
  30348. +
  30349. 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
  30350. index 70f7b78..d923e05 100644
  30351. --- a/package/kernel/mac80211/patches/607-rt2x00-allow_disabling_bands_through_platform_data.patch
  30352. +++ b/package/kernel/mac80211/patches/607-rt2x00-allow_disabling_bands_through_platform_data.patch
  30353. @@ -10,8 +10,8 @@
  30354. };
  30355. #endif /* _RT2X00_PLATFORM_H */
  30356. ---- a/drivers/net/wireless/rt2x00/rt2x00dev.c
  30357. -+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
  30358. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  30359. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  30360. @@ -940,6 +940,22 @@ static int rt2x00lib_probe_hw_modes(stru
  30361. unsigned int num_rates;
  30362. unsigned int i;
  30363. @@ -35,9 +35,9 @@
  30364. num_rates = 0;
  30365. if (spec->supported_rates & SUPPORT_RATE_CCK)
  30366. num_rates += 4;
  30367. ---- a/drivers/net/wireless/rt2x00/rt2x00.h
  30368. -+++ b/drivers/net/wireless/rt2x00/rt2x00.h
  30369. -@@ -403,6 +403,7 @@ struct hw_mode_spec {
  30370. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  30371. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  30372. +@@ -405,6 +405,7 @@ struct hw_mode_spec {
  30373. unsigned int supported_bands;
  30374. #define SUPPORT_BAND_2GHZ 0x00000001
  30375. #define SUPPORT_BAND_5GHZ 0x00000002
  30376. 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
  30377. index a35bd55..a645ba1 100644
  30378. --- a/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch
  30379. +++ b/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch
  30380. @@ -8,8 +8,8 @@
  30381. int disable_2ghz;
  30382. int disable_5ghz;
  30383. ---- a/drivers/net/wireless/rt2x00/rt2x00dev.c
  30384. -+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
  30385. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  30386. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  30387. @@ -931,6 +931,18 @@ static void rt2x00lib_rate(struct ieee80
  30388. entry->flags |= IEEE80211_RATE_SHORT_PREAMBLE;
  30389. }
  30390. @@ -29,9 +29,9 @@
  30391. static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev,
  30392. struct hw_mode_spec *spec)
  30393. {
  30394. ---- a/drivers/net/wireless/rt2x00/rt2x00.h
  30395. -+++ b/drivers/net/wireless/rt2x00/rt2x00.h
  30396. -@@ -1410,6 +1410,7 @@ static inline void rt2x00debug_dump_fram
  30397. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  30398. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  30399. +@@ -1414,6 +1414,7 @@ static inline void rt2x00debug_dump_fram
  30400. */
  30401. u32 rt2x00lib_get_bssidx(struct rt2x00_dev *rt2x00dev,
  30402. struct ieee80211_vif *vif);
  30403. @@ -39,8 +39,8 @@
  30404. /*
  30405. * Interrupt context handlers.
  30406. ---- a/drivers/net/wireless/rt2x00/rt61pci.c
  30407. -+++ b/drivers/net/wireless/rt2x00/rt61pci.c
  30408. +--- a/drivers/net/wireless/ralink/rt2x00/rt61pci.c
  30409. ++++ b/drivers/net/wireless/ralink/rt2x00/rt61pci.c
  30410. @@ -2392,6 +2392,7 @@ static int rt61pci_validate_eeprom(struc
  30411. u32 reg;
  30412. u16 word;
  30413. 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
  30414. index 63a8641..3fdaae7 100644
  30415. --- a/package/kernel/mac80211/patches/609-rt2x00-allow_disabling_bands_through_dts.patch
  30416. +++ b/package/kernel/mac80211/patches/609-rt2x00-allow_disabling_bands_through_dts.patch
  30417. @@ -1,5 +1,5 @@
  30418. ---- a/drivers/net/wireless/rt2x00/rt2x00dev.c
  30419. -+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
  30420. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  30421. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  30422. @@ -26,6 +26,7 @@
  30423. #include <linux/module.h>
  30424. #include <linux/slab.h>
  30425. 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
  30426. index 067d2ea..c69d330 100644
  30427. --- a/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
  30428. +++ b/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
  30429. @@ -1,6 +1,6 @@
  30430. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  30431. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  30432. -@@ -3552,11 +3552,18 @@ static void rt2800_config_channel(struct
  30433. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30434. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30435. +@@ -3529,11 +3529,18 @@ static void rt2800_config_channel(struct
  30436. /*
  30437. * Change BBP settings
  30438. */
  30439. @@ -19,7 +19,7 @@
  30440. } else if (rt2x00_rt(rt2x00dev, RT3593)) {
  30441. if (rf->channel > 14) {
  30442. /* Disable CCK Packet detection on 5GHz */
  30443. -@@ -6618,6 +6625,12 @@ static void rt2800_init_rfcsr_3290(struc
  30444. +@@ -6595,6 +6602,12 @@ static void rt2800_init_rfcsr_3290(struc
  30445. static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev)
  30446. {
  30447. @@ -32,7 +32,7 @@
  30448. rt2800_rf_init_calibration(rt2x00dev, 30);
  30449. rt2800_rfcsr_write(rt2x00dev, 0, 0xf0);
  30450. -@@ -6653,15 +6666,30 @@ static void rt2800_init_rfcsr_3352(struc
  30451. +@@ -6630,15 +6643,30 @@ static void rt2800_init_rfcsr_3352(struc
  30452. rt2800_rfcsr_write(rt2x00dev, 31, 0x80);
  30453. rt2800_rfcsr_write(rt2x00dev, 32, 0x80);
  30454. rt2800_rfcsr_write(rt2x00dev, 33, 0x00);
  30455. @@ -66,7 +66,7 @@
  30456. rt2800_rfcsr_write(rt2x00dev, 43, 0xdb);
  30457. rt2800_rfcsr_write(rt2x00dev, 44, 0xdb);
  30458. rt2800_rfcsr_write(rt2x00dev, 45, 0xdb);
  30459. -@@ -6669,15 +6697,20 @@ static void rt2800_init_rfcsr_3352(struc
  30460. +@@ -6646,15 +6674,20 @@ static void rt2800_init_rfcsr_3352(struc
  30461. rt2800_rfcsr_write(rt2x00dev, 47, 0x0d);
  30462. rt2800_rfcsr_write(rt2x00dev, 48, 0x14);
  30463. rt2800_rfcsr_write(rt2x00dev, 49, 0x00);
  30464. @@ -96,7 +96,7 @@
  30465. rt2800_rfcsr_write(rt2x00dev, 59, 0x00);
  30466. rt2800_rfcsr_write(rt2x00dev, 60, 0x00);
  30467. rt2800_rfcsr_write(rt2x00dev, 61, 0x00);
  30468. -@@ -7698,6 +7731,7 @@ static int rt2800_init_eeprom(struct rt2
  30469. +@@ -7675,6 +7708,7 @@ static int rt2800_init_eeprom(struct rt2
  30470. * RT53xx: defined in "EEPROM_CHIP_ID" field
  30471. */
  30472. if (rt2x00_rt(rt2x00dev, RT3290) ||
  30473. @@ -104,7 +104,7 @@
  30474. rt2x00_rt(rt2x00dev, RT5390) ||
  30475. rt2x00_rt(rt2x00dev, RT5392))
  30476. rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &rf);
  30477. -@@ -7793,7 +7827,8 @@ static int rt2800_init_eeprom(struct rt2
  30478. +@@ -7770,7 +7804,8 @@ static int rt2800_init_eeprom(struct rt2
  30479. /*
  30480. * Detect if this device has Bluetooth co-existence.
  30481. */
  30482. @@ -114,7 +114,7 @@
  30483. __set_bit(CAPABILITY_BT_COEXIST, &rt2x00dev->cap_flags);
  30484. /*
  30485. -@@ -7822,6 +7857,22 @@ static int rt2800_init_eeprom(struct rt2
  30486. +@@ -7799,6 +7834,22 @@ static int rt2800_init_eeprom(struct rt2
  30487. EIRP_MAX_TX_POWER_LIMIT)
  30488. __set_bit(CAPABILITY_POWER_LIMIT, &rt2x00dev->cap_flags);
  30489. @@ -137,8 +137,8 @@
  30490. return 0;
  30491. }
  30492. ---- a/drivers/net/wireless/rt2x00/rt2800.h
  30493. -+++ b/drivers/net/wireless/rt2x00/rt2800.h
  30494. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
  30495. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
  30496. @@ -2335,6 +2335,12 @@ struct mac_iveiv_entry {
  30497. #define RFCSR36_RF_BS FIELD8(0x80)
  30498. @@ -198,9 +198,9 @@
  30499. /*
  30500. * EEPROM frequency
  30501. ---- a/drivers/net/wireless/rt2x00/rt2x00.h
  30502. -+++ b/drivers/net/wireless/rt2x00/rt2x00.h
  30503. -@@ -715,6 +715,8 @@ enum rt2x00_capability_flags {
  30504. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  30505. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  30506. +@@ -717,6 +717,8 @@ enum rt2x00_capability_flags {
  30507. CAPABILITY_DOUBLE_ANTENNA,
  30508. CAPABILITY_BT_COEXIST,
  30509. CAPABILITY_VCO_RECALIBRATION,
  30510. 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
  30511. index 1dcca36..b44fe90 100644
  30512. --- a/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
  30513. +++ b/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
  30514. @@ -1,6 +1,6 @@
  30515. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  30516. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  30517. -@@ -8209,6 +8209,27 @@ static const struct rf_channel rf_vals_5
  30518. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30519. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30520. +@@ -8186,6 +8186,27 @@ static const struct rf_channel rf_vals_5
  30521. {196, 83, 0, 12, 1},
  30522. };
  30523. @@ -28,7 +28,7 @@
  30524. static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
  30525. {
  30526. struct hw_mode_spec *spec = &rt2x00dev->spec;
  30527. -@@ -8297,7 +8318,10 @@ static int rt2800_probe_hw_mode(struct r
  30528. +@@ -8272,7 +8293,10 @@ static int rt2800_probe_hw_mode(struct r
  30529. case RF5390:
  30530. case RF5392:
  30531. spec->num_channels = 14;
  30532. @@ -40,7 +40,7 @@
  30533. break;
  30534. case RF3052:
  30535. -@@ -8481,6 +8505,19 @@ static int rt2800_probe_rt(struct rt2x00
  30536. +@@ -8456,6 +8480,19 @@ static int rt2800_probe_rt(struct rt2x00
  30537. return 0;
  30538. }
  30539. @@ -60,7 +60,7 @@
  30540. int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
  30541. {
  30542. struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
  30543. -@@ -8523,6 +8560,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  30544. +@@ -8498,6 +8535,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  30545. rt2800_register_write(rt2x00dev, GPIO_CTRL, reg);
  30546. /*
  30547. @@ -76,9 +76,9 @@
  30548. * Initialize hw specifications.
  30549. */
  30550. retval = rt2800_probe_hw_mode(rt2x00dev);
  30551. ---- a/drivers/net/wireless/rt2x00/rt2x00.h
  30552. -+++ b/drivers/net/wireless/rt2x00/rt2x00.h
  30553. -@@ -398,6 +398,7 @@ static inline struct rt2x00_intf* vif_to
  30554. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  30555. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  30556. +@@ -400,6 +400,7 @@ static inline struct rt2x00_intf* vif_to
  30557. * @channels: Device/chipset specific channel values (See &struct rf_channel).
  30558. * @channels_info: Additional information for channels (See &struct channel_info).
  30559. * @ht: Driver HT Capabilities (See &ieee80211_sta_ht_cap).
  30560. @@ -86,7 +86,7 @@
  30561. */
  30562. struct hw_mode_spec {
  30563. unsigned int supported_bands;
  30564. -@@ -414,6 +415,7 @@ struct hw_mode_spec {
  30565. +@@ -416,6 +417,7 @@ struct hw_mode_spec {
  30566. const struct channel_info *channels_info;
  30567. struct ieee80211_sta_ht_cap ht;
  30568. 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
  30569. index 1970efc..e4b028b 100644
  30570. --- a/package/kernel/mac80211/patches/612-rt2x00-make-wmac-loadable-via-OF-on-rt288x-305x-SoC.patch
  30571. +++ b/package/kernel/mac80211/patches/612-rt2x00-make-wmac-loadable-via-OF-on-rt288x-305x-SoC.patch
  30572. @@ -8,11 +8,11 @@ devicetree.
  30573. Signed-off-by: John Crispin <blogic@openwrt.org>
  30574. ---
  30575. - drivers/net/wireless/rt2x00/rt2800pci.c | 7 +++++++
  30576. + drivers/net/wireless/ralink/rt2x00/rt2800pci.c | 7 +++++++
  30577. 1 file changed, 7 insertions(+)
  30578. ---- a/drivers/net/wireless/rt2x00/rt2800soc.c
  30579. -+++ b/drivers/net/wireless/rt2x00/rt2800soc.c
  30580. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
  30581. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
  30582. @@ -237,10 +237,17 @@ static int rt2800soc_probe(struct platfo
  30583. return rt2x00soc_probe(pdev, &rt2800soc_ops);
  30584. }
  30585. diff --git a/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch b/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  30586. index c779a17..8e3bd2a 100644
  30587. --- a/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  30588. +++ b/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  30589. @@ -1,5 +1,5 @@
  30590. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  30591. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  30592. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30593. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30594. @@ -36,6 +36,7 @@
  30595. #include <linux/kernel.h>
  30596. #include <linux/module.h>
  30597. @@ -8,7 +8,7 @@
  30598. #include "rt2x00.h"
  30599. #include "rt2800lib.h"
  30600. -@@ -8507,13 +8508,14 @@ static int rt2800_probe_rt(struct rt2x00
  30601. +@@ -8482,13 +8483,14 @@ static int rt2800_probe_rt(struct rt2x00
  30602. int rt2800_probe_clk(struct rt2x00_dev *rt2x00dev)
  30603. {
  30604. diff --git a/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch b/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  30605. index 840b3bc..faa5879 100644
  30606. --- a/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  30607. +++ b/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  30608. @@ -1,5 +1,5 @@
  30609. ---- a/drivers/net/wireless/rt2x00/rt2800.h
  30610. -+++ b/drivers/net/wireless/rt2x00/rt2800.h
  30611. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
  30612. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
  30613. @@ -74,6 +74,7 @@
  30614. #define RF3070 0x3070
  30615. #define RF3290 0x3290
  30616. @@ -8,9 +8,9 @@
  30617. #define RF5360 0x5360
  30618. #define RF5362 0x5362
  30619. #define RF5370 0x5370
  30620. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  30621. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  30622. -@@ -3038,6 +3038,13 @@ static void rt2800_config_channel_rf53xx
  30623. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30624. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30625. +@@ -3015,6 +3015,13 @@ static void rt2800_config_channel_rf53xx
  30626. rt2800_rfcsr_write(rt2x00dev, 59,
  30627. r59_non_bt[idx]);
  30628. @@ -24,7 +24,7 @@
  30629. }
  30630. }
  30631. }
  30632. -@@ -3516,6 +3523,7 @@ static void rt2800_config_channel(struct
  30633. +@@ -3493,6 +3500,7 @@ static void rt2800_config_channel(struct
  30634. rt2800_config_channel_rf3853(rt2x00dev, conf, rf, info);
  30635. break;
  30636. case RF3070:
  30637. @@ -32,7 +32,7 @@
  30638. case RF5360:
  30639. case RF5362:
  30640. case RF5370:
  30641. -@@ -3534,6 +3542,7 @@ static void rt2800_config_channel(struct
  30642. +@@ -3511,6 +3519,7 @@ static void rt2800_config_channel(struct
  30643. if (rt2x00_rf(rt2x00dev, RF3070) ||
  30644. rt2x00_rf(rt2x00dev, RF3290) ||
  30645. rt2x00_rf(rt2x00dev, RF3322) ||
  30646. @@ -40,7 +40,7 @@
  30647. rt2x00_rf(rt2x00dev, RF5360) ||
  30648. rt2x00_rf(rt2x00dev, RF5362) ||
  30649. rt2x00_rf(rt2x00dev, RF5370) ||
  30650. -@@ -3812,7 +3821,8 @@ static void rt2800_config_channel(struct
  30651. +@@ -3789,7 +3798,8 @@ static void rt2800_config_channel(struct
  30652. /*
  30653. * Clear update flag
  30654. */
  30655. @@ -50,7 +50,7 @@
  30656. rt2800_bbp_read(rt2x00dev, 49, &bbp);
  30657. rt2x00_set_field8(&bbp, BBP49_UPDATE_FLAG, 0);
  30658. rt2800_bbp_write(rt2x00dev, 49, bbp);
  30659. -@@ -4698,6 +4708,7 @@ void rt2800_vco_calibration(struct rt2x0
  30660. +@@ -4675,6 +4685,7 @@ void rt2800_vco_calibration(struct rt2x0
  30661. case RF3070:
  30662. case RF3290:
  30663. case RF3853:
  30664. @@ -58,7 +58,7 @@
  30665. case RF5360:
  30666. case RF5362:
  30667. case RF5370:
  30668. -@@ -5111,6 +5122,8 @@ static int rt2800_init_registers(struct
  30669. +@@ -5088,6 +5099,8 @@ static int rt2800_init_registers(struct
  30670. rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
  30671. rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);
  30672. rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000);
  30673. @@ -67,7 +67,7 @@
  30674. } else {
  30675. rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000000);
  30676. rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);
  30677. -@@ -5766,9 +5779,13 @@ static void rt2800_init_bbp_3352(struct
  30678. +@@ -5743,9 +5756,13 @@ static void rt2800_init_bbp_3352(struct
  30679. rt2800_bbp_write(rt2x00dev, 82, 0x62);
  30680. @@ -84,7 +84,7 @@
  30681. rt2800_bbp_write(rt2x00dev, 86, 0x38);
  30682. -@@ -5782,9 +5799,13 @@ static void rt2800_init_bbp_3352(struct
  30683. +@@ -5759,9 +5776,13 @@ static void rt2800_init_bbp_3352(struct
  30684. rt2800_bbp_write(rt2x00dev, 104, 0x92);
  30685. @@ -101,7 +101,7 @@
  30686. rt2800_bbp_write(rt2x00dev, 120, 0x50);
  30687. -@@ -5809,6 +5830,13 @@ static void rt2800_init_bbp_3352(struct
  30688. +@@ -5786,6 +5807,13 @@ static void rt2800_init_bbp_3352(struct
  30689. rt2800_bbp_write(rt2x00dev, 143, 0xa2);
  30690. rt2800_bbp_write(rt2x00dev, 148, 0xc8);
  30691. @@ -115,7 +115,7 @@
  30692. }
  30693. static void rt2800_init_bbp_3390(struct rt2x00_dev *rt2x00dev)
  30694. -@@ -6150,6 +6178,7 @@ static void rt2800_init_bbp(struct rt2x0
  30695. +@@ -6127,6 +6155,7 @@ static void rt2800_init_bbp(struct rt2x0
  30696. rt2800_init_bbp_3290(rt2x00dev);
  30697. break;
  30698. case RT3352:
  30699. @@ -123,7 +123,7 @@
  30700. rt2800_init_bbp_3352(rt2x00dev);
  30701. break;
  30702. case RT3390:
  30703. -@@ -7101,6 +7130,76 @@ static void rt2800_init_rfcsr_3883(struc
  30704. +@@ -7078,6 +7107,76 @@ static void rt2800_init_rfcsr_3883(struc
  30705. rt2800_rfcsr_write(rt2x00dev, 20, rfcsr);
  30706. }
  30707. @@ -200,7 +200,7 @@
  30708. static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
  30709. {
  30710. rt2800_rf_init_calibration(rt2x00dev, 2);
  30711. -@@ -7341,6 +7440,9 @@ static void rt2800_init_rfcsr(struct rt2
  30712. +@@ -7318,6 +7417,9 @@ static void rt2800_init_rfcsr(struct rt2
  30713. case RT3593:
  30714. rt2800_init_rfcsr_3593(rt2x00dev);
  30715. break;
  30716. @@ -210,7 +210,7 @@
  30717. case RT5390:
  30718. rt2800_init_rfcsr_5390(rt2x00dev);
  30719. break;
  30720. -@@ -7600,6 +7702,12 @@ static int rt2800_validate_eeprom(struct
  30721. +@@ -7577,6 +7679,12 @@ static int rt2800_validate_eeprom(struct
  30722. rt2x00_set_field16(&word, EEPROM_NIC_CONF0_RF_TYPE, RF2820);
  30723. rt2800_eeprom_write(rt2x00dev, EEPROM_NIC_CONF0, word);
  30724. rt2x00_eeprom_dbg(rt2x00dev, "Antenna: 0x%04x\n", word);
  30725. @@ -223,7 +223,7 @@
  30726. } else if (rt2x00_rt(rt2x00dev, RT2860) ||
  30727. rt2x00_rt(rt2x00dev, RT2872)) {
  30728. /*
  30729. -@@ -7738,6 +7846,8 @@ static int rt2800_init_eeprom(struct rt2
  30730. +@@ -7715,6 +7823,8 @@ static int rt2800_init_eeprom(struct rt2
  30731. rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &rf);
  30732. else if (rt2x00_rt(rt2x00dev, RT3883))
  30733. rf = RF3853;
  30734. @@ -232,7 +232,7 @@
  30735. else
  30736. rf = rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RF_TYPE);
  30737. -@@ -7757,6 +7867,7 @@ static int rt2800_init_eeprom(struct rt2
  30738. +@@ -7734,6 +7844,7 @@ static int rt2800_init_eeprom(struct rt2
  30739. case RF3320:
  30740. case RF3322:
  30741. case RF3853:
  30742. @@ -240,7 +240,7 @@
  30743. case RF5360:
  30744. case RF5362:
  30745. case RF5370:
  30746. -@@ -8312,6 +8423,7 @@ static int rt2800_probe_hw_mode(struct r
  30747. +@@ -8287,6 +8398,7 @@ static int rt2800_probe_hw_mode(struct r
  30748. case RF3290:
  30749. case RF3320:
  30750. case RF3322:
  30751. @@ -248,7 +248,7 @@
  30752. case RF5360:
  30753. case RF5362:
  30754. case RF5370:
  30755. -@@ -8451,6 +8563,7 @@ static int rt2800_probe_hw_mode(struct r
  30756. +@@ -8426,6 +8538,7 @@ static int rt2800_probe_hw_mode(struct r
  30757. case RF3070:
  30758. case RF3290:
  30759. case RF3853:
  30760. @@ -256,7 +256,7 @@
  30761. case RF5360:
  30762. case RF5362:
  30763. case RF5370:
  30764. -@@ -8491,6 +8604,7 @@ static int rt2800_probe_rt(struct rt2x00
  30765. +@@ -8466,6 +8579,7 @@ static int rt2800_probe_rt(struct rt2x00
  30766. case RT3572:
  30767. case RT3593:
  30768. case RT3883:
  30769. @@ -264,8 +264,8 @@
  30770. case RT5390:
  30771. case RT5392:
  30772. case RT5592:
  30773. ---- a/drivers/net/wireless/rt2x00/rt2x00.h
  30774. -+++ b/drivers/net/wireless/rt2x00/rt2x00.h
  30775. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  30776. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  30777. @@ -169,6 +169,7 @@ struct rt2x00_chip {
  30778. #define RT3572 0x3572
  30779. #define RT3593 0x3593
  30780. 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
  30781. index 13f2048..6094a61 100644
  30782. --- a/package/kernel/mac80211/patches/619-rt2x00-change-led-polarity-from-OF.patch
  30783. +++ b/package/kernel/mac80211/patches/619-rt2x00-change-led-polarity-from-OF.patch
  30784. @@ -1,5 +1,5 @@
  30785. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  30786. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  30787. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30788. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30789. @@ -37,6 +37,7 @@
  30790. #include <linux/module.h>
  30791. #include <linux/slab.h>
  30792. @@ -8,7 +8,7 @@
  30793. #include "rt2x00.h"
  30794. #include "rt2800lib.h"
  30795. -@@ -7957,6 +7958,17 @@ static int rt2800_init_eeprom(struct rt2
  30796. +@@ -7934,6 +7935,17 @@ static int rt2800_init_eeprom(struct rt2
  30797. rt2800_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC);
  30798. rt2800_init_led(rt2x00dev, &rt2x00dev->led_qual, LED_TYPE_QUALITY);
  30799. @@ -26,8 +26,8 @@
  30800. rt2x00dev->led_mcu_reg = eeprom;
  30801. #endif /* CPTCFG_RT2X00_LIB_LEDS */
  30802. ---- a/drivers/net/wireless/rt2x00/rt2x00leds.c
  30803. -+++ b/drivers/net/wireless/rt2x00/rt2x00leds.c
  30804. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00leds.c
  30805. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00leds.c
  30806. @@ -109,6 +109,9 @@ static int rt2x00leds_register_led(struc
  30807. led->led_dev.name = name;
  30808. led->led_dev.brightness = LED_OFF;
  30809. 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
  30810. index 2dbfd10..55452b9 100644
  30811. --- a/package/kernel/mac80211/patches/620-rt2x00-add-AP+STA-support.patch
  30812. +++ b/package/kernel/mac80211/patches/620-rt2x00-add-AP+STA-support.patch
  30813. @@ -1,6 +1,6 @@
  30814. ---- a/drivers/net/wireless/rt2x00/rt2x00dev.c
  30815. -+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
  30816. -@@ -1283,7 +1283,7 @@ static inline void rt2x00lib_set_if_comb
  30817. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  30818. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  30819. +@@ -1284,7 +1284,7 @@ static inline void rt2x00lib_set_if_comb
  30820. */
  30821. if_limit = &rt2x00dev->if_limits_ap;
  30822. if_limit->max = rt2x00dev->ops->max_ap_intf;
  30823. diff --git a/package/kernel/mac80211/patches/620-rt2x00-rt3352-rf-id.patch b/package/kernel/mac80211/patches/620-rt2x00-rt3352-rf-id.patch
  30824. index aaa8367..8ddf425 100644
  30825. --- a/package/kernel/mac80211/patches/620-rt2x00-rt3352-rf-id.patch
  30826. +++ b/package/kernel/mac80211/patches/620-rt2x00-rt3352-rf-id.patch
  30827. @@ -1,6 +1,6 @@
  30828. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  30829. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  30830. -@@ -7841,10 +7841,11 @@ static int rt2800_init_eeprom(struct rt2
  30831. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30832. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30833. +@@ -7818,10 +7818,11 @@ static int rt2800_init_eeprom(struct rt2
  30834. * RT53xx: defined in "EEPROM_CHIP_ID" field
  30835. */
  30836. if (rt2x00_rt(rt2x00dev, RT3290) ||
  30837. diff --git a/package/kernel/mac80211/patches/621-rt2x00-ht20_40_fix.patch b/package/kernel/mac80211/patches/621-rt2x00-ht20_40_fix.patch
  30838. index bb2fc1c..e3e4c98 100644
  30839. --- a/package/kernel/mac80211/patches/621-rt2x00-ht20_40_fix.patch
  30840. +++ b/package/kernel/mac80211/patches/621-rt2x00-ht20_40_fix.patch
  30841. @@ -1,5 +1,5 @@
  30842. ---- a/drivers/net/wireless/rt2x00/rt2800.h
  30843. -+++ b/drivers/net/wireless/rt2x00/rt2800.h
  30844. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
  30845. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
  30846. @@ -2321,6 +2321,8 @@ struct mac_iveiv_entry {
  30847. #define RFCSR30_RX_H20M FIELD8(0x04)
  30848. #define RFCSR30_RX_VCM FIELD8(0x18)
  30849. @@ -9,9 +9,9 @@
  30850. /*
  30851. * RFCSR 31:
  30852. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  30853. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  30854. -@@ -3551,8 +3551,13 @@ static void rt2800_config_channel(struct
  30855. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30856. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  30857. +@@ -3528,8 +3528,13 @@ static void rt2800_config_channel(struct
  30858. rt2x00_rf(rt2x00dev, RF5390) ||
  30859. rt2x00_rf(rt2x00dev, RF5392)) {
  30860. rt2800_rfcsr_read(rt2x00dev, 30, &rfcsr);
  30861. 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
  30862. new file mode 100644
  30863. index 0000000..3cf6268
  30864. --- /dev/null
  30865. +++ b/package/kernel/mac80211/patches/622-rt2x00-fix-beacon-bit-balance.patch
  30866. @@ -0,0 +1,47 @@
  30867. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
  30868. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
  30869. +@@ -627,12 +627,8 @@ void rt2x00mac_bss_info_changed(struct i
  30870. + } else if (bss_conf->enable_beacon && !intf->enable_beacon) {
  30871. + rt2x00dev->intf_beaconing++;
  30872. + intf->enable_beacon = true;
  30873. +- /*
  30874. +- * Upload beacon to the H/W. This is only required on
  30875. +- * USB devices. PCI devices fetch beacons periodically.
  30876. +- */
  30877. +- if (rt2x00_is_usb(rt2x00dev))
  30878. +- rt2x00queue_update_beacon(rt2x00dev, vif);
  30879. ++
  30880. ++ rt2x00queue_update_beacon(rt2x00dev, vif);
  30881. +
  30882. + if (rt2x00dev->intf_beaconing == 1) {
  30883. + /*
  30884. +--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  30885. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  30886. +@@ -144,7 +144,8 @@ static void rt2x00lib_intf_scheduled_ite
  30887. +
  30888. + if (test_and_clear_bit(DELAYED_UPDATE_BEACON, &intf->delayed_flags)) {
  30889. + mutex_lock(&intf->beacon_skb_mutex);
  30890. +- rt2x00queue_update_beacon(rt2x00dev, vif);
  30891. ++ if (intf->enable_beacon)
  30892. ++ rt2x00queue_update_beacon(rt2x00dev, vif);
  30893. + mutex_unlock(&intf->beacon_skb_mutex);
  30894. + }
  30895. + }
  30896. +@@ -207,6 +208,7 @@ static void rt2x00lib_beaconupdate_iter(
  30897. + struct ieee80211_vif *vif)
  30898. + {
  30899. + struct rt2x00_dev *rt2x00dev = data;
  30900. ++ struct rt2x00_intf *intf = vif_to_intf(vif);
  30901. +
  30902. + if (vif->type != NL80211_IFTYPE_AP &&
  30903. + vif->type != NL80211_IFTYPE_ADHOC &&
  30904. +@@ -220,7 +222,8 @@ static void rt2x00lib_beaconupdate_iter(
  30905. + * never be called for USB devices.
  30906. + */
  30907. + WARN_ON(rt2x00_is_usb(rt2x00dev));
  30908. +- rt2x00queue_update_beacon(rt2x00dev, vif);
  30909. ++ if (intf->enable_beacon)
  30910. ++ rt2x00queue_update_beacon(rt2x00dev, vif);
  30911. + }
  30912. +
  30913. + void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev)
  30914. 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
  30915. index f2a7663..a901a44 100644
  30916. --- a/package/kernel/mac80211/patches/700-mwl8k-missing-pci-id-for-WNR854T.patch
  30917. +++ b/package/kernel/mac80211/patches/700-mwl8k-missing-pci-id-for-WNR854T.patch
  30918. @@ -1,6 +1,6 @@
  30919. ---- a/drivers/net/wireless/mwl8k.c
  30920. -+++ b/drivers/net/wireless/mwl8k.c
  30921. -@@ -5678,6 +5678,7 @@ MODULE_FIRMWARE("mwl8k/fmimage_8366.fw")
  30922. +--- a/drivers/net/wireless/marvell/mwl8k.c
  30923. ++++ b/drivers/net/wireless/marvell/mwl8k.c
  30924. +@@ -5681,6 +5681,7 @@ MODULE_FIRMWARE("mwl8k/fmimage_8366.fw")
  30925. MODULE_FIRMWARE(MWL8K_8366_AP_FW(MWL8K_8366_AP_FW_API));
  30926. static const struct pci_device_id mwl8k_pci_id_table[] = {
  30927. diff --git a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  30928. index 9e29034..fd885cc 100644
  30929. --- a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  30930. +++ b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  30931. @@ -1,5 +1,5 @@
  30932. ---- a/drivers/net/wireless/libertas/cfg.c
  30933. -+++ b/drivers/net/wireless/libertas/cfg.c
  30934. +--- a/drivers/net/wireless/marvell/libertas/cfg.c
  30935. ++++ b/drivers/net/wireless/marvell/libertas/cfg.c
  30936. @@ -2084,6 +2084,8 @@ struct wireless_dev *lbs_cfg_alloc(struc
  30937. goto err_wiphy_new;
  30938. }
  30939. @@ -9,8 +9,8 @@
  30940. lbs_deb_leave(LBS_DEB_CFG80211);
  30941. return wdev;
  30942. ---- a/drivers/net/wireless/libertas/main.c
  30943. -+++ b/drivers/net/wireless/libertas/main.c
  30944. +--- a/drivers/net/wireless/marvell/libertas/main.c
  30945. ++++ b/drivers/net/wireless/marvell/libertas/main.c
  30946. @@ -987,6 +987,7 @@ struct lbs_private *lbs_add_card(void *c
  30947. goto err_adapter;
  30948. }
  30949. diff --git a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  30950. index 252fa81..b67a95f 100644
  30951. --- a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  30952. +++ b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  30953. @@ -1,5 +1,5 @@
  30954. ---- a/drivers/net/wireless/libertas/cfg.c
  30955. -+++ b/drivers/net/wireless/libertas/cfg.c
  30956. +--- a/drivers/net/wireless/marvell/libertas/cfg.c
  30957. ++++ b/drivers/net/wireless/marvell/libertas/cfg.c
  30958. @@ -2174,6 +2174,8 @@ int lbs_cfg_register(struct lbs_private
  30959. wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  30960. wdev->wiphy->reg_notifier = lbs_reg_notifier;
  30961. diff --git a/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch b/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch
  30962. new file mode 100644
  30963. index 0000000..74cd448
  30964. --- /dev/null
  30965. +++ b/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch
  30966. @@ -0,0 +1,17 @@
  30967. +--- a/drivers/net/wireless/broadcom/b43/main.c
  30968. ++++ b/drivers/net/wireless/broadcom/b43/main.c
  30969. +@@ -1215,10 +1215,10 @@ void b43_wireless_core_phy_pll_reset(str
  30970. + case B43_BUS_BCMA:
  30971. + bcma_cc = &dev->dev->bdev->bus->drv_cc;
  30972. +
  30973. +- bcma_cc_write32(bcma_cc, BCMA_CC_CHIPCTL_ADDR, 0);
  30974. +- bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4);
  30975. +- bcma_cc_set32(bcma_cc, BCMA_CC_CHIPCTL_DATA, 0x4);
  30976. +- bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4);
  30977. ++ bcma_cc_write32(bcma_cc, BCMA_CC_PMU_CHIPCTL_ADDR, 0);
  30978. ++ bcma_cc_mask32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, ~0x4);
  30979. ++ bcma_cc_set32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, 0x4);
  30980. ++ bcma_cc_mask32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, ~0x4);
  30981. + break;
  30982. + #endif
  30983. + #ifdef CPTCFG_B43_SSB
  30984. 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
  30985. index 95867ef..fd9e6fd 100644
  30986. --- a/package/kernel/mac80211/patches/805-b43-gpio-mask-module-option.patch
  30987. +++ b/package/kernel/mac80211/patches/805-b43-gpio-mask-module-option.patch
  30988. @@ -1,5 +1,5 @@
  30989. ---- a/drivers/net/wireless/b43/b43.h
  30990. -+++ b/drivers/net/wireless/b43/b43.h
  30991. +--- a/drivers/net/wireless/broadcom/b43/b43.h
  30992. ++++ b/drivers/net/wireless/broadcom/b43/b43.h
  30993. @@ -839,6 +839,7 @@ struct b43_wldev {
  30994. bool qos_enabled; /* TRUE, if QoS is used. */
  30995. bool hwcrypto_enabled; /* TRUE, if HW crypto acceleration is enabled. */
  30996. @@ -8,9 +8,9 @@
  30997. /* PHY/Radio device. */
  30998. struct b43_phy phy;
  30999. ---- a/drivers/net/wireless/b43/main.c
  31000. -+++ b/drivers/net/wireless/b43/main.c
  31001. -@@ -76,6 +76,11 @@ MODULE_FIRMWARE("b43/ucode16_mimo.fw");
  31002. +--- a/drivers/net/wireless/broadcom/b43/main.c
  31003. ++++ b/drivers/net/wireless/broadcom/b43/main.c
  31004. +@@ -75,6 +75,11 @@ MODULE_FIRMWARE("b43/ucode16_mimo.fw");
  31005. MODULE_FIRMWARE("b43/ucode5.fw");
  31006. MODULE_FIRMWARE("b43/ucode9.fw");
  31007. diff --git a/package/kernel/mac80211/patches/810-b43_no_pio.patch b/package/kernel/mac80211/patches/810-b43_no_pio.patch
  31008. index 0979100..79428c2 100644
  31009. --- a/package/kernel/mac80211/patches/810-b43_no_pio.patch
  31010. +++ b/package/kernel/mac80211/patches/810-b43_no_pio.patch
  31011. @@ -1,5 +1,5 @@
  31012. ---- a/drivers/net/wireless/b43/Makefile
  31013. -+++ b/drivers/net/wireless/b43/Makefile
  31014. +--- a/drivers/net/wireless/broadcom/b43/Makefile
  31015. ++++ b/drivers/net/wireless/broadcom/b43/Makefile
  31016. @@ -17,7 +17,7 @@ b43-$(CPTCFG_B43_PHY_AC) += phy_ac.o
  31017. b43-y += sysfs.o
  31018. b43-y += xmit.o
  31019. @@ -9,8 +9,8 @@
  31020. b43-y += rfkill.o
  31021. b43-y += ppr.o
  31022. b43-$(CPTCFG_B43_LEDS) += leds.o
  31023. ---- a/drivers/net/wireless/b43/main.c
  31024. -+++ b/drivers/net/wireless/b43/main.c
  31025. +--- a/drivers/net/wireless/broadcom/b43/main.c
  31026. ++++ b/drivers/net/wireless/broadcom/b43/main.c
  31027. @@ -2008,10 +2008,12 @@ static void b43_do_interrupt_thread(stru
  31028. dma_reason[0], dma_reason[1],
  31029. dma_reason[2], dma_reason[3],
  31030. @@ -24,8 +24,8 @@
  31031. b43_controller_restart(dev, "DMA error");
  31032. return;
  31033. }
  31034. ---- a/drivers/net/wireless/b43/pio.h
  31035. -+++ b/drivers/net/wireless/b43/pio.h
  31036. +--- a/drivers/net/wireless/broadcom/b43/pio.h
  31037. ++++ b/drivers/net/wireless/broadcom/b43/pio.h
  31038. @@ -150,7 +150,7 @@ static inline void b43_piorx_write32(str
  31039. b43_write32(q->dev, q->mmio_base + offset, value);
  31040. }
  31041. @@ -73,9 +73,9 @@
  31042. +#endif /* CPTCFG_B43_PIO */
  31043. #endif /* B43_PIO_H_ */
  31044. ---- a/drivers/net/wireless/b43/Kconfig
  31045. -+++ b/drivers/net/wireless/b43/Kconfig
  31046. -@@ -118,7 +118,7 @@ config B43_BCMA_PIO
  31047. +--- a/drivers/net/wireless/broadcom/b43/Kconfig
  31048. ++++ b/drivers/net/wireless/broadcom/b43/Kconfig
  31049. +@@ -98,7 +98,7 @@ config B43_BCMA_PIO
  31050. default y
  31051. config B43_PIO
  31052. diff --git a/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch b/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  31053. index ac58dba..06c731f 100644
  31054. --- a/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  31055. +++ b/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  31056. @@ -1,5 +1,5 @@
  31057. ---- a/drivers/net/wireless/b43/main.c
  31058. -+++ b/drivers/net/wireless/b43/main.c
  31059. +--- a/drivers/net/wireless/broadcom/b43/main.c
  31060. ++++ b/drivers/net/wireless/broadcom/b43/main.c
  31061. @@ -1648,7 +1648,7 @@ static void b43_write_beacon_template(st
  31062. len, ram_offset, shm_size_offset, rate);
  31063. @@ -9,7 +9,7 @@
  31064. antenna = b43_antenna_to_phyctl(antenna);
  31065. ctl = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_BEACPHYCTL);
  31066. /* We can't send beacons with short preamble. Would get PHY errors. */
  31067. -@@ -3302,8 +3302,8 @@ static int b43_chip_init(struct b43_wlde
  31068. +@@ -3300,8 +3300,8 @@ static int b43_chip_init(struct b43_wlde
  31069. /* Select the antennae */
  31070. if (phy->ops->set_rx_antenna)
  31071. @@ -20,7 +20,7 @@
  31072. if (phy->type == B43_PHYTYPE_B) {
  31073. value16 = b43_read16(dev, 0x005E);
  31074. -@@ -4003,7 +4003,6 @@ static int b43_op_config(struct ieee8021
  31075. +@@ -4001,7 +4001,6 @@ static int b43_op_config(struct ieee8021
  31076. struct b43_wldev *dev = wl->current_dev;
  31077. struct b43_phy *phy = &dev->phy;
  31078. struct ieee80211_conf *conf = &hw->conf;
  31079. @@ -28,7 +28,7 @@
  31080. int err = 0;
  31081. mutex_lock(&wl->mutex);
  31082. -@@ -4046,11 +4045,9 @@ static int b43_op_config(struct ieee8021
  31083. +@@ -4044,11 +4043,9 @@ static int b43_op_config(struct ieee8021
  31084. }
  31085. /* Antennas for RX and management frame TX. */
  31086. @@ -42,7 +42,7 @@
  31087. if (wl->radio_enabled != phy->radio_on) {
  31088. if (wl->radio_enabled) {
  31089. -@@ -5213,6 +5210,47 @@ static int b43_op_get_survey(struct ieee
  31090. +@@ -5209,6 +5206,47 @@ static int b43_op_get_survey(struct ieee
  31091. return 0;
  31092. }
  31093. @@ -90,7 +90,7 @@
  31094. static const struct ieee80211_ops b43_hw_ops = {
  31095. .tx = b43_op_tx,
  31096. .conf_tx = b43_op_conf_tx,
  31097. -@@ -5234,6 +5272,8 @@ static const struct ieee80211_ops b43_hw
  31098. +@@ -5230,6 +5268,8 @@ static const struct ieee80211_ops b43_hw
  31099. .sw_scan_complete = b43_op_sw_scan_complete_notifier,
  31100. .get_survey = b43_op_get_survey,
  31101. .rfkill_poll = b43_rfkill_poll,
  31102. @@ -99,7 +99,7 @@
  31103. };
  31104. /* Hard-reset the chip. Do not call this directly.
  31105. -@@ -5542,6 +5582,8 @@ static int b43_one_core_attach(struct b4
  31106. +@@ -5538,6 +5578,8 @@ static int b43_one_core_attach(struct b4
  31107. if (!wldev)
  31108. goto out;
  31109. @@ -108,7 +108,7 @@
  31110. wldev->use_pio = b43_modparam_pio;
  31111. wldev->dev = dev;
  31112. wldev->wl = wl;
  31113. -@@ -5632,6 +5674,9 @@ static struct b43_wl *b43_wireless_init(
  31114. +@@ -5628,6 +5670,9 @@ static struct b43_wl *b43_wireless_init(
  31115. hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
  31116. @@ -118,8 +118,8 @@
  31117. wl->hw_registred = false;
  31118. hw->max_rates = 2;
  31119. SET_IEEE80211_DEV(hw, dev->dev);
  31120. ---- a/drivers/net/wireless/b43/b43.h
  31121. -+++ b/drivers/net/wireless/b43/b43.h
  31122. +--- a/drivers/net/wireless/broadcom/b43/b43.h
  31123. ++++ b/drivers/net/wireless/broadcom/b43/b43.h
  31124. @@ -840,6 +840,8 @@ struct b43_wldev {
  31125. bool hwcrypto_enabled; /* TRUE, if HW crypto acceleration is enabled. */
  31126. bool use_pio; /* TRUE if next init should use PIO */
  31127. 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
  31128. index 9c51ac6..5899706 100644
  31129. --- a/package/kernel/mac80211/patches/841-b43-reduce-number-of-RX-slots.patch
  31130. +++ b/package/kernel/mac80211/patches/841-b43-reduce-number-of-RX-slots.patch
  31131. @@ -1,5 +1,5 @@
  31132. ---- a/drivers/net/wireless/b43/dma.h
  31133. -+++ b/drivers/net/wireless/b43/dma.h
  31134. +--- a/drivers/net/wireless/broadcom/b43/dma.h
  31135. ++++ b/drivers/net/wireless/broadcom/b43/dma.h
  31136. @@ -169,7 +169,7 @@ struct b43_dmadesc_generic {
  31137. /* DMA engine tuning knobs */
  31138. 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
  31139. index d4f9a88..8d0c041 100644
  31140. --- a/package/kernel/mac80211/patches/845-b43-only-use-gpio-0-1-for-led.patch
  31141. +++ b/package/kernel/mac80211/patches/845-b43-only-use-gpio-0-1-for-led.patch
  31142. @@ -1,5 +1,5 @@
  31143. ---- a/drivers/net/wireless/b43/main.c
  31144. -+++ b/drivers/net/wireless/b43/main.c
  31145. +--- a/drivers/net/wireless/broadcom/b43/main.c
  31146. ++++ b/drivers/net/wireless/broadcom/b43/main.c
  31147. @@ -2899,6 +2899,14 @@ static int b43_gpio_init(struct b43_wlde
  31148. } else if (dev->dev->chip_id == 0x5354) {
  31149. /* Don't allow overtaking buttons GPIOs */
  31150. 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
  31151. index 9d1d419..ef7f3c9 100644
  31152. --- a/package/kernel/mac80211/patches/847-b43-always-take-overlapping-devs.patch
  31153. +++ b/package/kernel/mac80211/patches/847-b43-always-take-overlapping-devs.patch
  31154. @@ -1,6 +1,6 @@
  31155. ---- a/drivers/net/wireless/b43/main.c
  31156. -+++ b/drivers/net/wireless/b43/main.c
  31157. -@@ -118,7 +118,7 @@ static int b43_modparam_pio = 0;
  31158. +--- a/drivers/net/wireless/broadcom/b43/main.c
  31159. ++++ b/drivers/net/wireless/broadcom/b43/main.c
  31160. +@@ -117,7 +117,7 @@ static int b43_modparam_pio = 0;
  31161. module_param_named(pio, b43_modparam_pio, int, 0644);
  31162. MODULE_PARM_DESC(pio, "Use PIO accesses by default: 0=DMA, 1=PIO");
  31163. 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
  31164. index 185c427..3c93386 100644
  31165. --- a/package/kernel/mac80211/patches/850-brcmsmac-remove-extra-regulation-restriction.patch
  31166. +++ b/package/kernel/mac80211/patches/850-brcmsmac-remove-extra-regulation-restriction.patch
  31167. @@ -1,5 +1,5 @@
  31168. ---- a/drivers/net/wireless/brcm80211/brcmsmac/channel.c
  31169. -+++ b/drivers/net/wireless/brcm80211/brcmsmac/channel.c
  31170. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/channel.c
  31171. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/channel.c
  31172. @@ -58,19 +58,12 @@
  31173. (((c) < 149) ? 3 : 4))))
  31174. 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
  31175. deleted file mode 100644
  31176. index 44bb779..0000000
  31177. --- a/package/kernel/mac80211/patches/860-brcmfmac-use-bcm47xx-platform-NVRAM-as-fallback.patch
  31178. +++ /dev/null
  31179. @@ -1,80 +0,0 @@
  31180. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  31181. -Date: Mon, 8 Jun 2015 16:59:31 +0200
  31182. -Subject: [PATCH] brcmfmac: use bcm47xx platform NVRAM as fallback
  31183. -MIME-Version: 1.0
  31184. -Content-Type: text/plain; charset=UTF-8
  31185. -Content-Transfer-Encoding: 8bit
  31186. -
  31187. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  31188. ----
  31189. -
  31190. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  31191. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  31192. -@@ -19,6 +19,9 @@
  31193. - #include <linux/device.h>
  31194. - #include <linux/firmware.h>
  31195. - #include <linux/module.h>
  31196. -+#if IS_ENABLED(CONFIG_BCM47XX_NVRAM)
  31197. -+#include <linux/bcm47xx_nvram.h>
  31198. -+#endif
  31199. -
  31200. - #include "debug.h"
  31201. - #include "firmware.h"
  31202. -@@ -424,17 +427,42 @@ struct brcmf_fw {
  31203. - static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx)
  31204. - {
  31205. - struct brcmf_fw *fwctx = ctx;
  31206. -+#if IS_ENABLED(CONFIG_BCM47XX_NVRAM)
  31207. -+ const u8 *bcm47xx_nvram = NULL;
  31208. -+ size_t bcm47xx_nvram_len;
  31209. -+#endif
  31210. -+ const u8 *data = NULL;
  31211. -+ size_t data_len;
  31212. - u32 nvram_length = 0;
  31213. - void *nvram = NULL;
  31214. -
  31215. - brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(fwctx->dev));
  31216. -- if (!fw && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL))
  31217. -+ if (fw) {
  31218. -+ data = fw->data;
  31219. -+ data_len = fw->size;
  31220. -+ }
  31221. -+#if IS_ENABLED(CONFIG_BCM47XX_NVRAM)
  31222. -+ else {
  31223. -+ bcm47xx_nvram = bcm47xx_nvram_get_contents(&bcm47xx_nvram_len);
  31224. -+ if (bcm47xx_nvram) {
  31225. -+ data = bcm47xx_nvram;
  31226. -+ data_len = bcm47xx_nvram_len;
  31227. -+ brcmf_err("Found platform NVRAM (%zu B)\n", data_len);
  31228. -+ }
  31229. -+ }
  31230. -+#endif
  31231. -+ if (!data && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL))
  31232. - goto fail;
  31233. -
  31234. -- if (fw) {
  31235. -- nvram = brcmf_fw_nvram_strip(fw->data, fw->size, &nvram_length,
  31236. -+ if (data) {
  31237. -+ nvram = brcmf_fw_nvram_strip(data, data_len, &nvram_length,
  31238. - fwctx->domain_nr, fwctx->bus_nr);
  31239. -- release_firmware(fw);
  31240. -+ if (fw)
  31241. -+ release_firmware(fw);
  31242. -+#if IS_ENABLED(CONFIG_BCM47XX_NVRAM)
  31243. -+ if (bcm47xx_nvram)
  31244. -+ bcm47xx_nvram_release_contents(bcm47xx_nvram);
  31245. -+#endif
  31246. - if (!nvram && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL))
  31247. - goto fail;
  31248. - }
  31249. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  31250. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  31251. -@@ -19,6 +19,8 @@
  31252. -
  31253. - #include <linux/net.h> /* net_ratelimit() */
  31254. -
  31255. -+#include <linux/net.h>
  31256. -+
  31257. - /* message levels */
  31258. - #define BRCMF_TRACE_VAL 0x00000002
  31259. - #define BRCMF_INFO_VAL 0x00000004
  31260. 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
  31261. index 14f8a00..95d93ae 100644
  31262. --- a/package/kernel/mac80211/patches/861-brcmfmac-register-wiphy-s-during-module_init.patch
  31263. +++ b/package/kernel/mac80211/patches/861-brcmfmac-register-wiphy-s-during-module_init.patch
  31264. @@ -11,9 +11,9 @@ module loads successfully.
  31265. Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  31266. ---
  31267. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  31268. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  31269. -@@ -1226,6 +1226,7 @@ static int __init brcmfmac_module_init(v
  31270. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  31271. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  31272. +@@ -1332,6 +1332,7 @@ static int __init brcmfmac_module_init(v
  31273. #endif
  31274. if (!schedule_work(&brcmf_driver_work))
  31275. return -EBUSY;
  31276. @@ -21,9 +21,9 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  31277. return 0;
  31278. }
  31279. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  31280. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  31281. -@@ -422,13 +422,14 @@ struct brcmf_fw {
  31282. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  31283. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  31284. +@@ -418,6 +418,7 @@ struct brcmf_fw {
  31285. u16 bus_nr;
  31286. void (*done)(struct device *dev, const struct firmware *fw,
  31287. void *nvram_image, u32 nvram_len);
  31288. @@ -31,16 +31,8 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  31289. };
  31290. static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx)
  31291. - {
  31292. - struct brcmf_fw *fwctx = ctx;
  31293. - #if IS_ENABLED(CONFIG_BCM47XX_NVRAM)
  31294. -- const u8 *bcm47xx_nvram = NULL;
  31295. -+ u8 *bcm47xx_nvram = NULL;
  31296. - size_t bcm47xx_nvram_len;
  31297. - #endif
  31298. - const u8 *data = NULL;
  31299. -@@ -468,6 +469,8 @@ static void brcmf_fw_request_nvram_done(
  31300. - }
  31301. +@@ -452,6 +453,8 @@ static void brcmf_fw_request_nvram_done(
  31302. + goto fail;
  31303. fwctx->done(fwctx->dev, fwctx->code, nvram, nvram_length);
  31304. + if (fwctx->completion)
  31305. @@ -48,7 +40,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  31306. kfree(fwctx);
  31307. return;
  31308. -@@ -475,6 +478,8 @@ fail:
  31309. +@@ -459,6 +462,8 @@ fail:
  31310. brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  31311. release_firmware(fwctx->code);
  31312. device_release_driver(fwctx->dev);
  31313. @@ -57,7 +49,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  31314. kfree(fwctx);
  31315. }
  31316. -@@ -490,6 +495,8 @@ static void brcmf_fw_request_code_done(c
  31317. +@@ -474,6 +479,8 @@ static void brcmf_fw_request_code_done(c
  31318. /* only requested code so done here */
  31319. if (!(fwctx->flags & BRCMF_FW_REQUEST_NVRAM)) {
  31320. fwctx->done(fwctx->dev, fw, NULL, 0);
  31321. @@ -66,16 +58,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  31322. kfree(fwctx);
  31323. return;
  31324. }
  31325. -@@ -504,6 +511,8 @@ static void brcmf_fw_request_code_done(c
  31326. - /* when nvram is optional call .done() callback here */
  31327. - if (fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL) {
  31328. - fwctx->done(fwctx->dev, fw, NULL, 0);
  31329. -+ if (fwctx->completion)
  31330. -+ complete(fwctx->completion);
  31331. - kfree(fwctx);
  31332. - return;
  31333. - }
  31334. -@@ -513,6 +522,8 @@ static void brcmf_fw_request_code_done(c
  31335. +@@ -491,6 +498,8 @@ static void brcmf_fw_request_code_done(c
  31336. fail:
  31337. brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  31338. device_release_driver(fwctx->dev);
  31339. @@ -84,7 +67,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  31340. kfree(fwctx);
  31341. }
  31342. -@@ -524,6 +535,8 @@ int brcmf_fw_get_firmwares_pcie(struct d
  31343. +@@ -502,6 +511,8 @@ int brcmf_fw_get_firmwares_pcie(struct d
  31344. u16 domain_nr, u16 bus_nr)
  31345. {
  31346. struct brcmf_fw *fwctx;
  31347. @@ -93,7 +76,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  31348. brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev));
  31349. if (!fw_cb || !code)
  31350. -@@ -544,9 +557,17 @@ int brcmf_fw_get_firmwares_pcie(struct d
  31351. +@@ -522,9 +533,17 @@ int brcmf_fw_get_firmwares_pcie(struct d
  31352. fwctx->domain_nr = domain_nr;
  31353. fwctx->bus_nr = bus_nr;
  31354. 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
  31355. index 32c4a6f..4295b4b 100644
  31356. --- a/package/kernel/mac80211/patches/862-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
  31357. +++ b/package/kernel/mac80211/patches/862-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
  31358. @@ -8,9 +8,9 @@ Content-Transfer-Encoding: 8bit
  31359. Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  31360. ---
  31361. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  31362. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  31363. -@@ -608,9 +608,37 @@ static struct wireless_dev *brcmf_cfg802
  31364. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  31365. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  31366. +@@ -615,9 +615,37 @@ static struct wireless_dev *brcmf_cfg802
  31367. u32 *flags,
  31368. struct vif_params *params)
  31369. {
  31370. 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
  31371. deleted file mode 100644
  31372. index d6b9e37..0000000
  31373. --- a/package/kernel/mac80211/patches/863-brcmfmac-fix-setting-primary-channel-for-80-MHz-widt.patch
  31374. +++ /dev/null
  31375. @@ -1,65 +0,0 @@
  31376. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  31377. -Date: Wed, 20 Jan 2016 16:35:12 +0100
  31378. -Subject: [PATCH] brcmfmac: fix setting primary channel for 80 MHz width
  31379. -MIME-Version: 1.0
  31380. -Content-Type: text/plain; charset=UTF-8
  31381. -Content-Transfer-Encoding: 8bit
  31382. -
  31383. -First of all it changes the way we calculate primary channel offset. If
  31384. -we use e.g. 80 MHz channel with primary frequency 5180 MHz (which means
  31385. -center frequency is 5210 MHz) it makes sense to calculate primary offset
  31386. -as -30 MHz.
  31387. -Then it fixes values we compare primary_offset with. We were comparing
  31388. -offset in MHz against -2 or 2 which was resulting in picking a wrong
  31389. -primary channel.
  31390. -
  31391. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  31392. ----
  31393. - .../brcm80211/brcmfmac/cfg80211.c | 23 ++++++++++------------
  31394. - 1 file changed, 10 insertions(+), 13 deletions(-)
  31395. -
  31396. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  31397. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  31398. -@@ -246,7 +246,7 @@ static u16 chandef_to_chanspec(struct br
  31399. - brcmf_dbg(TRACE, "chandef: control %d center %d width %d\n",
  31400. - ch->chan->center_freq, ch->center_freq1, ch->width);
  31401. - ch_inf.chnum = ieee80211_frequency_to_channel(ch->center_freq1);
  31402. -- primary_offset = ch->center_freq1 - ch->chan->center_freq;
  31403. -+ primary_offset = ch->chan->center_freq - ch->center_freq1;
  31404. - switch (ch->width) {
  31405. - case NL80211_CHAN_WIDTH_20:
  31406. - case NL80211_CHAN_WIDTH_20_NOHT:
  31407. -@@ -255,24 +255,21 @@ static u16 chandef_to_chanspec(struct br
  31408. - break;
  31409. - case NL80211_CHAN_WIDTH_40:
  31410. - ch_inf.bw = BRCMU_CHAN_BW_40;
  31411. -- if (primary_offset < 0)
  31412. -+ if (primary_offset > 0)
  31413. - ch_inf.sb = BRCMU_CHAN_SB_U;
  31414. - else
  31415. - ch_inf.sb = BRCMU_CHAN_SB_L;
  31416. - break;
  31417. - case NL80211_CHAN_WIDTH_80:
  31418. - ch_inf.bw = BRCMU_CHAN_BW_80;
  31419. -- if (primary_offset < 0) {
  31420. -- if (primary_offset < -CH_10MHZ_APART)
  31421. -- ch_inf.sb = BRCMU_CHAN_SB_UU;
  31422. -- else
  31423. -- ch_inf.sb = BRCMU_CHAN_SB_UL;
  31424. -- } else {
  31425. -- if (primary_offset > CH_10MHZ_APART)
  31426. -- ch_inf.sb = BRCMU_CHAN_SB_LL;
  31427. -- else
  31428. -- ch_inf.sb = BRCMU_CHAN_SB_LU;
  31429. -- }
  31430. -+ if (primary_offset == -30)
  31431. -+ ch_inf.sb = BRCMU_CHAN_SB_LL;
  31432. -+ else if (primary_offset == -10)
  31433. -+ ch_inf.sb = BRCMU_CHAN_SB_LU;
  31434. -+ else if (primary_offset == 10)
  31435. -+ ch_inf.sb = BRCMU_CHAN_SB_UL;
  31436. -+ else
  31437. -+ ch_inf.sb = BRCMU_CHAN_SB_UU;
  31438. - break;
  31439. - case NL80211_CHAN_WIDTH_80P80:
  31440. - case NL80211_CHAN_WIDTH_160:
  31441. 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
  31442. deleted file mode 100644
  31443. index 856dea8..0000000
  31444. --- a/package/kernel/mac80211/patches/900-wlcore-Add-support-for-DT-platform-data.patch
  31445. +++ /dev/null
  31446. @@ -1,139 +0,0 @@
  31447. -When running with DT, we no longer have a board file that can set up the
  31448. -platform data for wlcore. Allow this data to be passed from DT.
  31449. -
  31450. -Since some platforms use a gpio-irq, add support for passing either the
  31451. -irq number or the gpio number. For the latter case, the driver will
  31452. -request the gpio and convert it to the irq number. If an irq is
  31453. -specified, it'll be used as is.
  31454. -
  31455. -[Arik - the pdev_data pointer does not belong to us and is freed when
  31456. -the device is released. Dereference to our private data first.]
  31457. -
  31458. -Signed-off-by: Ido Yariv <ido@wizery.com>
  31459. -Signed-off-by: Arik Nemtsov <arik@wizery.com>
  31460. ----
  31461. - drivers/net/wireless/ti/wlcore/sdio.c | 71 ++++++++++++++++++++++++++++++++---
  31462. - include/linux/wl12xx.h | 3 +-
  31463. - 2 files changed, 67 insertions(+), 7 deletions(-)
  31464. -
  31465. ---- a/drivers/net/wireless/ti/wlcore/sdio.c
  31466. -+++ b/drivers/net/wireless/ti/wlcore/sdio.c
  31467. -@@ -34,6 +34,7 @@
  31468. - #include <linux/wl12xx.h>
  31469. - #include <linux/pm_runtime.h>
  31470. - #include <linux/printk.h>
  31471. -+#include <linux/of.h>
  31472. -
  31473. - #include "wlcore.h"
  31474. - #include "wl12xx_80211.h"
  31475. -@@ -214,6 +215,61 @@ static struct wl1271_if_operations sdio_
  31476. - .set_block_size = wl1271_sdio_set_block_size,
  31477. - };
  31478. -
  31479. -+static const struct of_device_id wlcore_of_match[] = {
  31480. -+ {
  31481. -+ .compatible = "wlcore",
  31482. -+ },
  31483. -+ {}
  31484. -+};
  31485. -+MODULE_DEVICE_TABLE(of, wlcore_of_match);
  31486. -+
  31487. -+static struct wl12xx_platform_data *get_platform_data(struct device *dev)
  31488. -+{
  31489. -+ struct wl12xx_platform_data *pdata;
  31490. -+ struct device_node *np;
  31491. -+ u32 gpio;
  31492. -+
  31493. -+ pdata = wl12xx_get_platform_data();
  31494. -+ if (!IS_ERR(pdata))
  31495. -+ return kmemdup(pdata, sizeof(*pdata), GFP_KERNEL);
  31496. -+
  31497. -+ np = of_find_matching_node(NULL, wlcore_of_match);
  31498. -+ if (!np) {
  31499. -+ dev_err(dev, "No platform data set\n");
  31500. -+ return NULL;
  31501. -+ }
  31502. -+
  31503. -+ pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
  31504. -+ if (!pdata) {
  31505. -+ dev_err(dev, "Can't allocate platform data\n");
  31506. -+ return NULL;
  31507. -+ }
  31508. -+
  31509. -+ if (of_property_read_u32(np, "irq", &pdata->irq)) {
  31510. -+ if (!of_property_read_u32(np, "gpio", &gpio) &&
  31511. -+ !gpio_request_one(gpio, GPIOF_IN, "wlcore_irq")) {
  31512. -+ pdata->gpio = gpio;
  31513. -+ pdata->irq = gpio_to_irq(gpio);
  31514. -+ }
  31515. -+ }
  31516. -+
  31517. -+ /* Optional fields */
  31518. -+ pdata->use_eeprom = of_property_read_bool(np, "use-eeprom");
  31519. -+ of_property_read_u32(np, "board-ref-clock", &pdata->board_ref_clock);
  31520. -+ of_property_read_u32(np, "board-tcxo-clock", &pdata->board_tcxo_clock);
  31521. -+ of_property_read_u32(np, "platform-quirks", &pdata->platform_quirks);
  31522. -+
  31523. -+ return pdata;
  31524. -+}
  31525. -+
  31526. -+static void del_platform_data(struct wl12xx_platform_data *pdata)
  31527. -+{
  31528. -+ if (pdata->gpio)
  31529. -+ gpio_free(pdata->gpio);
  31530. -+
  31531. -+ kfree(pdata);
  31532. -+}
  31533. -+
  31534. - static int wl1271_probe(struct sdio_func *func,
  31535. - const struct sdio_device_id *id)
  31536. - {
  31537. -@@ -245,10 +301,10 @@ static int wl1271_probe(struct sdio_func
  31538. - /* Use block mode for transferring over one block size of data */
  31539. - func->card->quirks |= MMC_QUIRK_BLKSZ_FOR_BYTE_MODE;
  31540. -
  31541. -- pdev_data.pdata = wl12xx_get_platform_data();
  31542. -- if (IS_ERR(pdev_data.pdata)) {
  31543. -- ret = PTR_ERR(pdev_data.pdata);
  31544. -- dev_err(glue->dev, "missing wlan platform data: %d\n", ret);
  31545. -+ pdev_data.pdata = get_platform_data(&func->dev);
  31546. -+ if (!pdev_data.pdata) {
  31547. -+ ret = -EINVAL;
  31548. -+ dev_err(glue->dev, "missing wlan platform data\n");
  31549. - goto out_free_glue;
  31550. - }
  31551. -
  31552. -@@ -279,7 +335,7 @@ static int wl1271_probe(struct sdio_func
  31553. - if (!glue->core) {
  31554. - dev_err(glue->dev, "can't allocate platform_device");
  31555. - ret = -ENOMEM;
  31556. -- goto out_free_glue;
  31557. -+ goto out_free_pdata;
  31558. - }
  31559. -
  31560. - glue->core->dev.parent = &func->dev;
  31561. -@@ -313,6 +369,9 @@ static int wl1271_probe(struct sdio_func
  31562. - out_dev_put:
  31563. - platform_device_put(glue->core);
  31564. -
  31565. -+out_free_pdata:
  31566. -+ del_platform_data(pdev_data->pdata);
  31567. -+
  31568. - out_free_glue:
  31569. - kfree(glue);
  31570. -
  31571. -@@ -323,11 +382,14 @@ out:
  31572. - static void wl1271_remove(struct sdio_func *func)
  31573. - {
  31574. - struct wl12xx_sdio_glue *glue = sdio_get_drvdata(func);
  31575. -+ struct wlcore_platdev_data *pdev_data = glue->core->dev.platform_data;
  31576. -+ struct wl12xx_platform_data *pdata = pdev_data->pdata;
  31577. -
  31578. - /* Undo decrement done above in wl1271_probe */
  31579. - pm_runtime_get_noresume(&func->dev);
  31580. -
  31581. - platform_device_unregister(glue->core);
  31582. -+ del_platform_data(pdata);
  31583. - kfree(glue);
  31584. - }
  31585. -
  31586. 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
  31587. index e6b2d7b..bc9f799 100644
  31588. --- a/package/kernel/mac80211/patches/910-00-rt2x00-enable-rt2800soc-for-mt7620.patch
  31589. +++ b/package/kernel/mac80211/patches/910-00-rt2x00-enable-rt2800soc-for-mt7620.patch
  31590. @@ -1,5 +1,5 @@
  31591. ---- a/drivers/net/wireless/rt2x00/Kconfig
  31592. -+++ b/drivers/net/wireless/rt2x00/Kconfig
  31593. +--- a/drivers/net/wireless/ralink/rt2x00/Kconfig
  31594. ++++ b/drivers/net/wireless/ralink/rt2x00/Kconfig
  31595. @@ -211,7 +211,7 @@ endif
  31596. config RT2800SOC
  31597. tristate "Ralink WiSoC support"
  31598. 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
  31599. index 501910f..f2e21ea 100644
  31600. --- a/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch
  31601. +++ b/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch
  31602. @@ -1,5 +1,5 @@
  31603. ---- a/drivers/net/wireless/rt2x00/rt2800.h
  31604. -+++ b/drivers/net/wireless/rt2x00/rt2800.h
  31605. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
  31606. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
  31607. @@ -81,6 +81,7 @@
  31608. #define RF5372 0x5372
  31609. #define RF5390 0x5390
  31610. @@ -62,8 +62,8 @@
  31611. /* TX_PWR_CFG_7 */
  31612. #define TX_PWR_CFG_7 0x13d4
  31613. #define TX_PWR_CFG_7_OFDM54_CH0 FIELD32(0x0000000f)
  31614. ---- a/drivers/net/wireless/rt2x00/rt2800lib.c
  31615. -+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  31616. +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  31617. ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  31618. @@ -61,6 +61,8 @@
  31619. rt2800_regbusy_read((__dev), BBP_CSR_CFG, BBP_CSR_CFG_BUSY, (__reg))
  31620. #define WAIT_FOR_RFCSR(__dev, __reg) \
  31621. @@ -91,7 +91,8 @@
  31622. + rt2x00_set_field32(&reg, RF_CSR_CFG_REGNUM_MT7620, word);
  31623. + rt2x00_set_field32(&reg, RF_CSR_CFG_WRITE_MT7620, 1);
  31624. + rt2x00_set_field32(&reg, RF_CSR_CFG_BUSY_MT7620, 1);
  31625. -+
  31626. +
  31627. +- rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg);
  31628. + rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg);
  31629. + }
  31630. + break;
  31631. @@ -103,8 +104,7 @@
  31632. + rt2x00_set_field32(&reg, RF_CSR_CFG_REGNUM, word);
  31633. + rt2x00_set_field32(&reg, RF_CSR_CFG_WRITE, 1);
  31634. + rt2x00_set_field32(&reg, RF_CSR_CFG_BUSY, 1);
  31635. -
  31636. -- rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg);
  31637. ++
  31638. + rt2800_register_write_lock(rt2x00dev, RF_CSR_CFG, reg);
  31639. + }
  31640. + break;
  31641. @@ -210,7 +210,7 @@
  31642. case RT5592:
  31643. *txwi_size = TXWI_DESC_SIZE_5WORDS;
  31644. *rxwi_size = RXWI_DESC_SIZE_6WORDS;
  31645. -@@ -3326,6 +3399,312 @@ static void rt2800_config_channel_rf55xx
  31646. +@@ -3303,6 +3376,312 @@ static void rt2800_config_channel_rf55xx
  31647. rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x19 : 0x7F);
  31648. }
  31649. @@ -258,6 +258,7 @@
  31650. + u32 mac_sys_ctrl, mac_status;
  31651. + u32 tx_pin = 0x00150F0F;
  31652. + struct hw_mode_spec *spec = &rt2x00dev->spec;
  31653. ++ struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
  31654. +
  31655. + /* Frequeny plan setting */
  31656. + /*
  31657. @@ -383,7 +384,6 @@
  31658. + rfcsr &= (~0x4);
  31659. + rt2800_rfcsr_write(rt2x00dev, 28, rfcsr);
  31660. +
  31661. -+ struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
  31662. + /*if (bScan == FALSE)*/
  31663. + if (conf_is_ht40(conf)) {
  31664. + txrx_agc_fc = rt2x00_get_field8(drv_data->calibration_bw40,
  31665. @@ -523,7 +523,7 @@
  31666. static void rt2800_bbp_write_with_rx_chain(struct rt2x00_dev *rt2x00dev,
  31667. const unsigned int word,
  31668. const u8 value)
  31669. -@@ -3482,7 +3861,7 @@ static void rt2800_config_channel(struct
  31670. +@@ -3459,7 +3838,7 @@ static void rt2800_config_channel(struct
  31671. struct channel_info *info)
  31672. {
  31673. u32 reg;
  31674. @@ -532,7 +532,7 @@
  31675. u8 bbp, rfcsr;
  31676. info->default_power1 = rt2800_txpower_to_dev(rt2x00dev, rf->channel,
  31677. -@@ -3536,6 +3915,9 @@ static void rt2800_config_channel(struct
  31678. +@@ -3513,6 +3892,9 @@ static void rt2800_config_channel(struct
  31679. case RF5592:
  31680. rt2800_config_channel_rf55xx(rt2x00dev, conf, rf, info);
  31681. break;
  31682. @@ -542,7 +542,7 @@
  31683. default:
  31684. rt2800_config_channel_rf2xxx(rt2x00dev, conf, rf, info);
  31685. }
  31686. -@@ -3638,7 +4020,7 @@ static void rt2800_config_channel(struct
  31687. +@@ -3615,7 +3997,7 @@ static void rt2800_config_channel(struct
  31688. else if (rt2x00_rt(rt2x00dev, RT3593) ||
  31689. rt2x00_rt(rt2x00dev, RT3883))
  31690. rt2800_bbp_write(rt2x00dev, 82, 0x82);
  31691. @@ -551,7 +551,7 @@
  31692. rt2800_bbp_write(rt2x00dev, 82, 0xf2);
  31693. if (rt2x00_rt(rt2x00dev, RT3593) ||
  31694. -@@ -3660,7 +4042,7 @@ static void rt2800_config_channel(struct
  31695. +@@ -3637,7 +4019,7 @@ static void rt2800_config_channel(struct
  31696. if (rt2x00_rt(rt2x00dev, RT3572))
  31697. rt2800_rfcsr_write(rt2x00dev, 8, 0);
  31698. @@ -560,7 +560,7 @@
  31699. switch (rt2x00dev->default_ant.tx_chain_num) {
  31700. case 3:
  31701. -@@ -3709,6 +4091,7 @@ static void rt2800_config_channel(struct
  31702. +@@ -3686,6 +4068,7 @@ static void rt2800_config_channel(struct
  31703. rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFTR_EN, 1);
  31704. rt2x00_set_field32(&tx_pin, TX_PIN_CFG_TRSW_EN, 1);
  31705. @@ -568,7 +568,7 @@
  31706. rt2800_register_write(rt2x00dev, TX_PIN_CFG, tx_pin);
  31707. -@@ -4725,6 +5108,14 @@ void rt2800_vco_calibration(struct rt2x0
  31708. +@@ -4702,6 +5085,14 @@ void rt2800_vco_calibration(struct rt2x0
  31709. rt2x00_set_field8(&rfcsr, RFCSR3_VCOCAL_EN, 1);
  31710. rt2800_rfcsr_write(rt2x00dev, 3, rfcsr);
  31711. break;
  31712. @@ -583,7 +583,7 @@
  31713. default:
  31714. return;
  31715. }
  31716. -@@ -5125,9 +5516,42 @@ static int rt2800_init_registers(struct
  31717. +@@ -5102,9 +5493,42 @@ static int rt2800_init_registers(struct
  31718. } else if (rt2x00_rt(rt2x00dev, RT5390) ||
  31719. rt2x00_rt(rt2x00dev, RT5392) ||
  31720. rt2x00_rt(rt2x00dev, RT5592)) {
  31721. @@ -629,7 +629,7 @@
  31722. } else if (rt2x00_rt(rt2x00dev, RT5350)) {
  31723. rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
  31724. } else {
  31725. -@@ -6159,6 +6583,225 @@ static void rt2800_init_bbp_5592(struct
  31726. +@@ -6136,6 +6560,225 @@ static void rt2800_init_bbp_5592(struct
  31727. rt2800_bbp_write(rt2x00dev, 103, 0xc0);
  31728. }
  31729. @@ -855,7 +855,7 @@
  31730. static void rt2800_init_bbp(struct rt2x00_dev *rt2x00dev)
  31731. {
  31732. unsigned int i;
  31733. -@@ -6201,7 +6844,10 @@ static void rt2800_init_bbp(struct rt2x0
  31734. +@@ -6178,7 +6821,10 @@ static void rt2800_init_bbp(struct rt2x0
  31735. return;
  31736. case RT5390:
  31737. case RT5392:
  31738. @@ -867,7 +867,7 @@
  31739. break;
  31740. case RT5592:
  31741. rt2800_init_bbp_5592(rt2x00dev);
  31742. -@@ -7415,6 +8061,295 @@ static void rt2800_init_rfcsr_5592(struc
  31743. +@@ -7392,6 +8038,296 @@ static void rt2800_init_rfcsr_5592(struc
  31744. rt2800_led_open_drain_enable(rt2x00dev);
  31745. }
  31746. @@ -875,6 +875,8 @@
  31747. +{
  31748. + u16 freq;
  31749. + u8 rfvalue;
  31750. ++ struct hw_mode_spec *spec = &rt2x00dev->spec;
  31751. ++
  31752. + /* Initialize RF central register to default value */
  31753. + rt2800_rfcsr_write(rt2x00dev, 0, 0x02);
  31754. + rt2800_rfcsr_write(rt2x00dev, 1, 0x03);
  31755. @@ -921,7 +923,6 @@
  31756. + rt2800_rfcsr_write(rt2x00dev, 42, 0x5B);
  31757. + rt2800_rfcsr_write(rt2x00dev, 43, 0x00);
  31758. +
  31759. -+ struct hw_mode_spec *spec = &rt2x00dev->spec;
  31760. + rt2800_rfcsr_write(rt2x00dev, 11, 0x21);
  31761. + if (spec->clk_is_20mhz)
  31762. + rt2800_rfcsr_write(rt2x00dev, 13, 0x03);
  31763. @@ -1163,7 +1164,7 @@
  31764. static void rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
  31765. {
  31766. if (rt2800_is_305x_soc(rt2x00dev)) {
  31767. -@@ -7450,7 +8385,10 @@ static void rt2800_init_rfcsr(struct rt2
  31768. +@@ -7427,7 +8363,10 @@ static void rt2800_init_rfcsr(struct rt2
  31769. rt2800_init_rfcsr_5350(rt2x00dev);
  31770. break;
  31771. case RT5390:
  31772. @@ -1175,7 +1176,7 @@
  31773. break;
  31774. case RT5392:
  31775. rt2800_init_rfcsr_5392(rt2x00dev);
  31776. -@@ -7882,6 +8820,7 @@ static int rt2800_init_eeprom(struct rt2
  31777. +@@ -7859,6 +8798,7 @@ static int rt2800_init_eeprom(struct rt2
  31778. case RF5390:
  31779. case RF5392:
  31780. case RF5592:
  31781. @@ -1183,7 +1184,7 @@
  31782. break;
  31783. default:
  31784. rt2x00_err(rt2x00dev, "Invalid RF chipset 0x%04x detected\n",
  31785. -@@ -8448,6 +9387,7 @@ static int rt2800_probe_hw_mode(struct r
  31786. +@@ -8423,6 +9363,7 @@ static int rt2800_probe_hw_mode(struct r
  31787. case RF5372:
  31788. case RF5390:
  31789. case RF5392:
  31790. @@ -1191,7 +1192,7 @@
  31791. spec->num_channels = 14;
  31792. if (spec->clk_is_20mhz)
  31793. spec->channels = rf_vals_xtal20mhz_3x;
  31794. -@@ -8588,6 +9528,7 @@ static int rt2800_probe_hw_mode(struct r
  31795. +@@ -8563,6 +9504,7 @@ static int rt2800_probe_hw_mode(struct r
  31796. case RF5372:
  31797. case RF5390:
  31798. case RF5392:
  31799. 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
  31800. deleted file mode 100644
  31801. index 4c04d4f..0000000
  31802. --- a/package/kernel/mac80211/patches/920-ath10k_allow_fallback_to_board_bin_on_empty_otp_stream.patch
  31803. +++ /dev/null
  31804. @@ -1,20 +0,0 @@
  31805. ---- a/drivers/net/wireless/ath/ath10k/core.c
  31806. -+++ b/drivers/net/wireless/ath/ath10k/core.c
  31807. -@@ -387,9 +387,14 @@ static int ath10k_download_and_run_otp(s
  31808. -
  31809. - ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot otp execute result %d\n", result);
  31810. -
  31811. -- if (!skip_otp && result != 0) {
  31812. -- ath10k_err(ar, "otp calibration failed: %d", result);
  31813. -- return -EINVAL;
  31814. -+ if (!skip_otp) {
  31815. -+ if (result == 2) {
  31816. -+ ath10k_warn(ar, "otp stream is empty, using board.bin contents");
  31817. -+ return 0;
  31818. -+ } else if (result != 0) {
  31819. -+ ath10k_err(ar, "otp calibration failed: %d", result);
  31820. -+ return -EINVAL;
  31821. -+ }
  31822. - }
  31823. -
  31824. - return 0;
  31825. diff --git a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  31826. index eed3814..8c6d720 100644
  31827. --- a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  31828. +++ b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  31829. @@ -14,7 +14,7 @@ Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  31830. --- a/drivers/net/wireless/ath/ath10k/core.c
  31831. +++ b/drivers/net/wireless/ath/ath10k/core.c
  31832. -@@ -1323,6 +1323,16 @@ int ath10k_core_register(struct ath10k *
  31833. +@@ -1914,6 +1914,16 @@ int ath10k_core_register(struct ath10k *
  31834. ar->chip_id = chip_id;
  31835. queue_work(ar->workqueue, &ar->register_work);
  31836. 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
  31837. index 8003f86..281b447 100644
  31838. --- a/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
  31839. +++ b/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
  31840. @@ -1,6 +1,6 @@
  31841. --- a/drivers/net/wireless/ath/ath10k/mac.c
  31842. +++ b/drivers/net/wireless/ath/ath10k/mac.c
  31843. -@@ -5416,6 +5416,21 @@ struct ath10k_vif *ath10k_get_arvif(stru
  31844. +@@ -7141,6 +7141,21 @@ struct ath10k_vif *ath10k_get_arvif(stru
  31845. return arvif_iter.arvif;
  31846. }
  31847. @@ -22,7 +22,7 @@
  31848. int ath10k_mac_register(struct ath10k *ar)
  31849. {
  31850. static const u32 cipher_suites[] = {
  31851. -@@ -5590,6 +5605,12 @@ int ath10k_mac_register(struct ath10k *a
  31852. +@@ -7357,6 +7372,12 @@ int ath10k_mac_register(struct ath10k *a
  31853. ar->hw->wiphy->cipher_suites = cipher_suites;
  31854. ar->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  31855. diff --git a/package/kernel/mac80211/patches/940-mwl8k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/940-mwl8k_init_devices_synchronously.patch
  31856. new file mode 100644
  31857. index 0000000..357faee
  31858. --- /dev/null
  31859. +++ b/package/kernel/mac80211/patches/940-mwl8k_init_devices_synchronously.patch
  31860. @@ -0,0 +1,20 @@
  31861. +--- a/drivers/net/wireless/marvell/mwl8k.c
  31862. ++++ b/drivers/net/wireless/marvell/mwl8k.c
  31863. +@@ -6264,6 +6264,8 @@ static int mwl8k_probe(struct pci_dev *p
  31864. +
  31865. + priv->running_bsses = 0;
  31866. +
  31867. ++ wait_for_completion(&priv->firmware_loading_complete);
  31868. ++
  31869. + return rc;
  31870. +
  31871. + err_stop_firmware:
  31872. +@@ -6297,8 +6299,6 @@ static void mwl8k_remove(struct pci_dev
  31873. + return;
  31874. + priv = hw->priv;
  31875. +
  31876. +- wait_for_completion(&priv->firmware_loading_complete);
  31877. +-
  31878. + if (priv->fw_state == FW_STATE_ERROR) {
  31879. + mwl8k_hw_reset(priv);
  31880. + goto unmap;
  31881. diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile
  31882. index 5ede95a..c098832 100644
  31883. --- a/package/kernel/mt76/Makefile
  31884. +++ b/package/kernel/mt76/Makefile
  31885. @@ -1,7 +1,7 @@
  31886. include $(TOPDIR)/rules.mk
  31887. PKG_NAME:=mt76
  31888. -PKG_VERSION:=2015-10-12
  31889. +PKG_VERSION:=2016-02-08
  31890. PKG_RELEASE=1
  31891. PKG_LICENSE:=GPLv2
  31892. @@ -10,7 +10,7 @@ PKG_LICENSE_FILES:=
  31893. PKG_SOURCE_URL:=https://github.com/openwrt/mt76
  31894. PKG_SOURCE_PROTO:=git
  31895. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  31896. -PKG_SOURCE_VERSION:=2f31d1e329dc43074a05782624195860c45b099a
  31897. +PKG_SOURCE_VERSION:=84a312645c7b805255e6d7b6191e9f62142985d9
  31898. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
  31899. PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  31900. @@ -23,8 +23,10 @@ define KernelPackage/mt76
  31901. SUBMENU:=Wireless Drivers
  31902. TITLE:=MediaTek MT76x2 wireless driver
  31903. DEPENDS:=+kmod-mac80211 +@DRIVER_11N_SUPPORT @PCI_SUPPORT
  31904. - FILES:=$(PKG_BUILD_DIR)/mt76pci.ko
  31905. - AUTOLOAD:=$(call AutoLoad,50,mac80211 mt76pci)
  31906. + FILES:=\
  31907. + $(PKG_BUILD_DIR)/mt76.ko \
  31908. + $(PKG_BUILD_DIR)/mt76x2e.ko
  31909. + AUTOLOAD:=$(call AutoLoad,50,mac80211 mt76 mt76x2e)
  31910. endef
  31911. NOSTDINC_FLAGS = \
  31912. diff --git a/package/kernel/mt76/patches/001-backport_ieee80211_hw_set.patch b/package/kernel/mt76/patches/001-backport_ieee80211_hw_set.patch
  31913. deleted file mode 100644
  31914. index e94574d..0000000
  31915. --- a/package/kernel/mt76/patches/001-backport_ieee80211_hw_set.patch
  31916. +++ /dev/null
  31917. @@ -1,12 +0,0 @@
  31918. ---- a/init.c
  31919. -+++ b/init.c
  31920. -@@ -16,6 +16,9 @@
  31921. - #include "eeprom.h"
  31922. - #include "mcu.h"
  31923. -
  31924. -+#define ieee80211_hw_set(hw, flag) \
  31925. -+ do { (hw)->flags |= IEEE80211_HW_##flag; } while(0)
  31926. -+
  31927. - static bool
  31928. - mt76_wait_for_mac(struct mt76_dev *dev)
  31929. - {
  31930. diff --git a/package/kernel/mt76/patches/002-disable_fast_xmit.patch b/package/kernel/mt76/patches/002-disable_fast_xmit.patch
  31931. deleted file mode 100644
  31932. index f7a011b..0000000
  31933. --- a/package/kernel/mt76/patches/002-disable_fast_xmit.patch
  31934. +++ /dev/null
  31935. @@ -1,10 +0,0 @@
  31936. ---- a/init.c
  31937. -+++ b/init.c
  31938. -@@ -816,7 +816,6 @@ int mt76_register_device(struct mt76_dev
  31939. - ieee80211_hw_set(hw, HOST_BROADCAST_PS_BUFFERING);
  31940. - ieee80211_hw_set(hw, AMPDU_AGGREGATION);
  31941. - ieee80211_hw_set(hw, SUPPORTS_RC_TABLE);
  31942. -- ieee80211_hw_set(hw, SUPPORT_FAST_XMIT);
  31943. -
  31944. - hw->sta_data_size = sizeof(struct mt76_sta);
  31945. - hw->vif_data_size = sizeof(struct mt76_vif);
  31946. diff --git a/package/kernel/mwlwifi/patches/100-drop_old_api.patch b/package/kernel/mwlwifi/patches/100-drop_old_api.patch
  31947. new file mode 100644
  31948. index 0000000..d2e149e
  31949. --- /dev/null
  31950. +++ b/package/kernel/mwlwifi/patches/100-drop_old_api.patch
  31951. @@ -0,0 +1,92 @@
  31952. +--- a/main.c
  31953. ++++ b/main.c
  31954. +@@ -418,11 +418,7 @@ static void mwl_set_ht_caps(struct mwl_p
  31955. + band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_20;
  31956. + band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_40;
  31957. +
  31958. +-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
  31959. +- hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;
  31960. +-#else
  31961. + ieee80211_hw_set(hw, AMPDU_AGGREGATION);
  31962. +-#endif
  31963. + band->ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K;
  31964. + band->ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_4;
  31965. +
  31966. +@@ -524,29 +520,16 @@ static int mwl_wl_init(struct mwl_priv *
  31967. + hw->queues = SYSADPT_TX_WMM_QUEUES;
  31968. +
  31969. + /* Set rssi values to dBm */
  31970. +-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
  31971. +- hw->flags |= IEEE80211_HW_SIGNAL_DBM | IEEE80211_HW_HAS_RATE_CONTROL;
  31972. +-#else
  31973. + ieee80211_hw_set(hw, SIGNAL_DBM);
  31974. + ieee80211_hw_set(hw, HAS_RATE_CONTROL);
  31975. +-#endif
  31976. +
  31977. + /* Ask mac80211 not to trigger PS mode
  31978. + * based on PM bit of incoming frames.
  31979. + */
  31980. +-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
  31981. +- hw->flags |= IEEE80211_HW_AP_LINK_PS;
  31982. +-#else
  31983. + ieee80211_hw_set(hw, AP_LINK_PS);
  31984. +-#endif
  31985. +
  31986. +-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
  31987. +- hw->flags |= IEEE80211_HW_SUPPORTS_PER_STA_GTK |
  31988. +- IEEE80211_HW_MFP_CAPABLE;
  31989. +-#else
  31990. + ieee80211_hw_set(hw, SUPPORTS_PER_STA_GTK);
  31991. + ieee80211_hw_set(hw, MFP_CAPABLE);
  31992. +-#endif
  31993. +
  31994. + hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
  31995. +
  31996. +--- a/dev.h
  31997. ++++ b/dev.h
  31998. +@@ -484,10 +484,6 @@ static inline struct mwl_sta *mwl_dev_ge
  31999. + return (struct mwl_sta *)&sta->drv_priv;
  32000. + }
  32001. +
  32002. +-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)
  32003. +-#define ether_addr_copy(dst, src) memcpy(dst, src, ETH_ALEN)
  32004. +-#endif
  32005. +-
  32006. + /* Defined in mac80211.c. */
  32007. + extern const struct ieee80211_ops mwl_mac80211_ops;
  32008. +
  32009. +--- a/mac80211.c
  32010. ++++ b/mac80211.c
  32011. +@@ -572,19 +572,11 @@ static int mwl_mac80211_get_survey(struc
  32012. + return 0;
  32013. + }
  32014. +
  32015. +-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
  32016. +-static int mwl_mac80211_ampdu_action(struct ieee80211_hw *hw,
  32017. +- struct ieee80211_vif *vif,
  32018. +- enum ieee80211_ampdu_mlme_action action,
  32019. +- struct ieee80211_sta *sta,
  32020. +- u16 tid, u16 *ssn, u8 buf_size)
  32021. +-#else
  32022. + static int mwl_mac80211_ampdu_action(struct ieee80211_hw *hw,
  32023. + struct ieee80211_vif *vif,
  32024. + enum ieee80211_ampdu_mlme_action action,
  32025. + struct ieee80211_sta *sta,
  32026. + u16 tid, u16 *ssn, u8 buf_size, bool amsdu)
  32027. +-#endif
  32028. + {
  32029. + int rc = 0;
  32030. + struct mwl_priv *priv = hw->priv;
  32031. +--- a/rx.c
  32032. ++++ b/rx.c
  32033. +@@ -232,10 +232,8 @@ static inline void mwl_rx_prepare_status
  32034. + status->flag |= RX_FLAG_VHT;
  32035. + if (bw == RX_RATE_INFO_HT40)
  32036. + status->flag |= RX_FLAG_40MHZ;
  32037. +-#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 18, 0)
  32038. + if (bw == RX_RATE_INFO_HT80)
  32039. + status->vht_flag |= RX_VHT_FLAG_80MHZ;
  32040. +-#endif
  32041. + if (gi == RX_RATE_INFO_SHORT_INTERVAL)
  32042. + status->flag |= RX_FLAG_SHORT_GI;
  32043. + status->vht_nss = (nss + 1);
  32044. diff --git a/package/kernel/mwlwifi/patches/110-api_sync.patch b/package/kernel/mwlwifi/patches/110-api_sync.patch
  32045. new file mode 100644
  32046. index 0000000..ed3e06a
  32047. --- /dev/null
  32048. +++ b/package/kernel/mwlwifi/patches/110-api_sync.patch
  32049. @@ -0,0 +1,19 @@
  32050. +--- a/mac80211.c
  32051. ++++ b/mac80211.c
  32052. +@@ -597,10 +597,13 @@ static int mwl_mac80211_get_survey(struc
  32053. +
  32054. + static int mwl_mac80211_ampdu_action(struct ieee80211_hw *hw,
  32055. + struct ieee80211_vif *vif,
  32056. +- enum ieee80211_ampdu_mlme_action action,
  32057. +- struct ieee80211_sta *sta,
  32058. +- u16 tid, u16 *ssn, u8 buf_size, bool amsdu)
  32059. ++ struct ieee80211_ampdu_params *params)
  32060. + {
  32061. ++ enum ieee80211_ampdu_mlme_action action = params->action;
  32062. ++ struct ieee80211_sta *sta = params->sta;
  32063. ++ u16 tid = params->tid;
  32064. ++ u16 *ssn = &params->ssn;
  32065. ++ u8 buf_size = params->buf_size;
  32066. + int rc = 0;
  32067. + struct mwl_priv *priv = hw->priv;
  32068. + struct mwl_ampdu_stream *stream;
  32069. diff --git a/target/linux/generic/files/include/linux/ath9k_platform.h b/target/linux/generic/files/include/linux/ath9k_platform.h
  32070. index 9fa7016..30ce216 100644
  32071. --- a/target/linux/generic/files/include/linux/ath9k_platform.h
  32072. +++ b/target/linux/generic/files/include/linux/ath9k_platform.h
  32073. @@ -36,6 +36,7 @@ struct ath9k_platform_data {
  32074. bool tx_gain_buffalo;
  32075. bool disable_2ghz;
  32076. bool disable_5ghz;
  32077. + bool led_active_high;
  32078. int (*get_mac_revision)(void);
  32079. int (*external_reset)(void);
  32080. 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
  32081. new file mode 100644
  32082. index 0000000..7ae8b1d
  32083. --- /dev/null
  32084. +++ b/target/linux/generic/patches-3.18/030-backport_bcm47xx_nvram.patch
  32085. @@ -0,0 +1,52 @@
  32086. +--- /dev/null
  32087. ++++ b/include/linux/bcm47xx_nvram.h
  32088. +@@ -0,0 +1,49 @@
  32089. ++/*
  32090. ++ * This program is free software; you can redistribute it and/or modify it
  32091. ++ * under the terms of the GNU General Public License as published by the
  32092. ++ * Free Software Foundation; either version 2 of the License, or (at your
  32093. ++ * option) any later version.
  32094. ++ */
  32095. ++
  32096. ++#ifndef __BCM47XX_NVRAM_H
  32097. ++#define __BCM47XX_NVRAM_H
  32098. ++
  32099. ++#include <linux/types.h>
  32100. ++#include <linux/kernel.h>
  32101. ++#include <linux/vmalloc.h>
  32102. ++
  32103. ++#ifdef CONFIG_BCM47XX_NVRAM
  32104. ++int bcm47xx_nvram_init_from_mem(u32 base, u32 lim);
  32105. ++int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len);
  32106. ++int bcm47xx_nvram_gpio_pin(const char *name);
  32107. ++char *bcm47xx_nvram_get_contents(size_t *val_len);
  32108. ++static inline void bcm47xx_nvram_release_contents(char *nvram)
  32109. ++{
  32110. ++ vfree(nvram);
  32111. ++};
  32112. ++#else
  32113. ++static inline int bcm47xx_nvram_init_from_mem(u32 base, u32 lim)
  32114. ++{
  32115. ++ return -ENOTSUPP;
  32116. ++};
  32117. ++static inline int bcm47xx_nvram_getenv(const char *name, char *val,
  32118. ++ size_t val_len)
  32119. ++{
  32120. ++ return -ENOTSUPP;
  32121. ++};
  32122. ++static inline int bcm47xx_nvram_gpio_pin(const char *name)
  32123. ++{
  32124. ++ return -ENOTSUPP;
  32125. ++};
  32126. ++
  32127. ++static inline char *bcm47xx_nvram_get_contents(size_t *val_len)
  32128. ++{
  32129. ++ return NULL;
  32130. ++};
  32131. ++
  32132. ++static inline void bcm47xx_nvram_release_contents(char *nvram)
  32133. ++{
  32134. ++};
  32135. ++#endif
  32136. ++
  32137. ++#endif /* __BCM47XX_NVRAM_H */
  32138. 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
  32139. index 8ec73d9..a74d9ee 100644
  32140. --- a/target/linux/generic/patches-3.18/032-bcma-from-4.6.patch
  32141. +++ b/target/linux/generic/patches-3.18/032-bcma-from-4.6.patch
  32142. @@ -1,6 +1,40 @@
  32143. --- a/drivers/bcma/driver_chipcommon.c
  32144. +++ b/drivers/bcma/driver_chipcommon.c
  32145. -@@ -190,6 +190,7 @@ u32 bcma_chipco_watchdog_timer_set(struc
  32146. +@@ -15,6 +15,8 @@
  32147. + #include <linux/platform_device.h>
  32148. + #include <linux/bcma/bcma.h>
  32149. +
  32150. ++static void bcma_chipco_serial_init(struct bcma_drv_cc *cc);
  32151. ++
  32152. + static inline u32 bcma_cc_write32_masked(struct bcma_drv_cc *cc, u16 offset,
  32153. + u32 mask, u32 value)
  32154. + {
  32155. +@@ -115,6 +117,8 @@ int bcma_chipco_watchdog_register(struct
  32156. +
  32157. + void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc)
  32158. + {
  32159. ++ struct bcma_bus *bus = cc->core->bus;
  32160. ++
  32161. + if (cc->early_setup_done)
  32162. + return;
  32163. +
  32164. +@@ -129,6 +133,9 @@ void bcma_core_chipcommon_early_init(str
  32165. + if (cc->capabilities & BCMA_CC_CAP_PMU)
  32166. + bcma_pmu_early_init(cc);
  32167. +
  32168. ++ if (IS_BUILTIN(CONFIG_BCM47XX) && bus->hosttype == BCMA_HOSTTYPE_SOC)
  32169. ++ bcma_chipco_serial_init(cc);
  32170. ++
  32171. + cc->early_setup_done = true;
  32172. + }
  32173. +
  32174. +@@ -185,11 +192,12 @@ u32 bcma_chipco_watchdog_timer_set(struc
  32175. + ticks = 2;
  32176. + else if (ticks > maxt)
  32177. + ticks = maxt;
  32178. +- bcma_cc_write32(cc, BCMA_CC_PMU_WATCHDOG, ticks);
  32179. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_WATCHDOG, ticks);
  32180. + } else {
  32181. struct bcma_bus *bus = cc->core->bus;
  32182. if (bus->chipinfo.id != BCMA_CHIP_ID_BCM4707 &&
  32183. @@ -8,6 +42,232 @@
  32184. bus->chipinfo.id != BCMA_CHIP_ID_BCM53018)
  32185. bcma_core_set_clockmode(cc->core,
  32186. ticks ? BCMA_CLKMODE_FAST : BCMA_CLKMODE_DYNAMIC);
  32187. +@@ -314,9 +322,9 @@ u32 bcma_chipco_gpio_pulldown(struct bcm
  32188. + return res;
  32189. + }
  32190. +
  32191. +-#ifdef CONFIG_BCMA_DRIVER_MIPS
  32192. +-void bcma_chipco_serial_init(struct bcma_drv_cc *cc)
  32193. ++static void bcma_chipco_serial_init(struct bcma_drv_cc *cc)
  32194. + {
  32195. ++#if IS_BUILTIN(CONFIG_BCM47XX)
  32196. + unsigned int irq;
  32197. + u32 baud_base;
  32198. + u32 i;
  32199. +@@ -358,5 +366,5 @@ void bcma_chipco_serial_init(struct bcma
  32200. + ports[i].baud_base = baud_base;
  32201. + ports[i].reg_shift = 0;
  32202. + }
  32203. ++#endif /* CONFIG_BCM47XX */
  32204. + }
  32205. +-#endif /* CONFIG_BCMA_DRIVER_MIPS */
  32206. +--- a/drivers/bcma/driver_chipcommon_pmu.c
  32207. ++++ b/drivers/bcma/driver_chipcommon_pmu.c
  32208. +@@ -15,44 +15,44 @@
  32209. +
  32210. + u32 bcma_chipco_pll_read(struct bcma_drv_cc *cc, u32 offset)
  32211. + {
  32212. +- bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR, offset);
  32213. +- bcma_cc_read32(cc, BCMA_CC_PLLCTL_ADDR);
  32214. +- return bcma_cc_read32(cc, BCMA_CC_PLLCTL_DATA);
  32215. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR, offset);
  32216. ++ bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_ADDR);
  32217. ++ return bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_DATA);
  32218. + }
  32219. + EXPORT_SYMBOL_GPL(bcma_chipco_pll_read);
  32220. +
  32221. + void bcma_chipco_pll_write(struct bcma_drv_cc *cc, u32 offset, u32 value)
  32222. + {
  32223. +- bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR, offset);
  32224. +- bcma_cc_read32(cc, BCMA_CC_PLLCTL_ADDR);
  32225. +- bcma_cc_write32(cc, BCMA_CC_PLLCTL_DATA, value);
  32226. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR, offset);
  32227. ++ bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_ADDR);
  32228. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_DATA, value);
  32229. + }
  32230. + EXPORT_SYMBOL_GPL(bcma_chipco_pll_write);
  32231. +
  32232. + void bcma_chipco_pll_maskset(struct bcma_drv_cc *cc, u32 offset, u32 mask,
  32233. + u32 set)
  32234. + {
  32235. +- bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR, offset);
  32236. +- bcma_cc_read32(cc, BCMA_CC_PLLCTL_ADDR);
  32237. +- bcma_cc_maskset32(cc, BCMA_CC_PLLCTL_DATA, mask, set);
  32238. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR, offset);
  32239. ++ bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_ADDR);
  32240. ++ bcma_pmu_maskset32(cc, BCMA_CC_PMU_PLLCTL_DATA, mask, set);
  32241. + }
  32242. + EXPORT_SYMBOL_GPL(bcma_chipco_pll_maskset);
  32243. +
  32244. + void bcma_chipco_chipctl_maskset(struct bcma_drv_cc *cc,
  32245. + u32 offset, u32 mask, u32 set)
  32246. + {
  32247. +- bcma_cc_write32(cc, BCMA_CC_CHIPCTL_ADDR, offset);
  32248. +- bcma_cc_read32(cc, BCMA_CC_CHIPCTL_ADDR);
  32249. +- bcma_cc_maskset32(cc, BCMA_CC_CHIPCTL_DATA, mask, set);
  32250. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_CHIPCTL_ADDR, offset);
  32251. ++ bcma_pmu_read32(cc, BCMA_CC_PMU_CHIPCTL_ADDR);
  32252. ++ bcma_pmu_maskset32(cc, BCMA_CC_PMU_CHIPCTL_DATA, mask, set);
  32253. + }
  32254. + EXPORT_SYMBOL_GPL(bcma_chipco_chipctl_maskset);
  32255. +
  32256. + void bcma_chipco_regctl_maskset(struct bcma_drv_cc *cc, u32 offset, u32 mask,
  32257. + u32 set)
  32258. + {
  32259. +- bcma_cc_write32(cc, BCMA_CC_REGCTL_ADDR, offset);
  32260. +- bcma_cc_read32(cc, BCMA_CC_REGCTL_ADDR);
  32261. +- bcma_cc_maskset32(cc, BCMA_CC_REGCTL_DATA, mask, set);
  32262. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_REGCTL_ADDR, offset);
  32263. ++ bcma_pmu_read32(cc, BCMA_CC_PMU_REGCTL_ADDR);
  32264. ++ bcma_pmu_maskset32(cc, BCMA_CC_PMU_REGCTL_DATA, mask, set);
  32265. + }
  32266. + EXPORT_SYMBOL_GPL(bcma_chipco_regctl_maskset);
  32267. +
  32268. +@@ -60,18 +60,18 @@ static u32 bcma_pmu_xtalfreq(struct bcma
  32269. + {
  32270. + u32 ilp_ctl, alp_hz;
  32271. +
  32272. +- if (!(bcma_cc_read32(cc, BCMA_CC_PMU_STAT) &
  32273. ++ if (!(bcma_pmu_read32(cc, BCMA_CC_PMU_STAT) &
  32274. + BCMA_CC_PMU_STAT_EXT_LPO_AVAIL))
  32275. + return 0;
  32276. +
  32277. +- bcma_cc_write32(cc, BCMA_CC_PMU_XTAL_FREQ,
  32278. +- BIT(BCMA_CC_PMU_XTAL_FREQ_MEASURE_SHIFT));
  32279. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_XTAL_FREQ,
  32280. ++ BIT(BCMA_CC_PMU_XTAL_FREQ_MEASURE_SHIFT));
  32281. + usleep_range(1000, 2000);
  32282. +
  32283. +- ilp_ctl = bcma_cc_read32(cc, BCMA_CC_PMU_XTAL_FREQ);
  32284. ++ ilp_ctl = bcma_pmu_read32(cc, BCMA_CC_PMU_XTAL_FREQ);
  32285. + ilp_ctl &= BCMA_CC_PMU_XTAL_FREQ_ILPCTL_MASK;
  32286. +
  32287. +- bcma_cc_write32(cc, BCMA_CC_PMU_XTAL_FREQ, 0);
  32288. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_XTAL_FREQ, 0);
  32289. +
  32290. + alp_hz = ilp_ctl * 32768 / 4;
  32291. + return (alp_hz + 50000) / 100000 * 100;
  32292. +@@ -127,8 +127,8 @@ static void bcma_pmu2_pll_init0(struct b
  32293. + mask = (u32)~(BCMA_RES_4314_HT_AVAIL |
  32294. + BCMA_RES_4314_MACPHY_CLK_AVAIL);
  32295. +
  32296. +- bcma_cc_mask32(cc, BCMA_CC_PMU_MINRES_MSK, mask);
  32297. +- bcma_cc_mask32(cc, BCMA_CC_PMU_MAXRES_MSK, mask);
  32298. ++ bcma_pmu_mask32(cc, BCMA_CC_PMU_MINRES_MSK, mask);
  32299. ++ bcma_pmu_mask32(cc, BCMA_CC_PMU_MAXRES_MSK, mask);
  32300. + bcma_wait_value(cc->core, BCMA_CLKCTLST,
  32301. + BCMA_CLKCTLST_HAVEHT, 0, 20000);
  32302. + break;
  32303. +@@ -140,7 +140,7 @@ static void bcma_pmu2_pll_init0(struct b
  32304. +
  32305. + /* Flush */
  32306. + if (cc->pmu.rev >= 2)
  32307. +- bcma_cc_set32(cc, BCMA_CC_PMU_CTL, BCMA_CC_PMU_CTL_PLL_UPD);
  32308. ++ bcma_pmu_set32(cc, BCMA_CC_PMU_CTL, BCMA_CC_PMU_CTL_PLL_UPD);
  32309. +
  32310. + /* TODO: Do we need to update OTP? */
  32311. + }
  32312. +@@ -195,9 +195,9 @@ static void bcma_pmu_resources_init(stru
  32313. +
  32314. + /* Set the resource masks. */
  32315. + if (min_msk)
  32316. +- bcma_cc_write32(cc, BCMA_CC_PMU_MINRES_MSK, min_msk);
  32317. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_MINRES_MSK, min_msk);
  32318. + if (max_msk)
  32319. +- bcma_cc_write32(cc, BCMA_CC_PMU_MAXRES_MSK, max_msk);
  32320. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_MAXRES_MSK, max_msk);
  32321. +
  32322. + /*
  32323. + * Add some delay; allow resources to come up and settle.
  32324. +@@ -269,23 +269,33 @@ static void bcma_pmu_workarounds(struct
  32325. +
  32326. + void bcma_pmu_early_init(struct bcma_drv_cc *cc)
  32327. + {
  32328. ++ struct bcma_bus *bus = cc->core->bus;
  32329. + u32 pmucap;
  32330. +
  32331. +- pmucap = bcma_cc_read32(cc, BCMA_CC_PMU_CAP);
  32332. ++ if (cc->core->id.rev >= 35 &&
  32333. ++ cc->capabilities_ext & BCMA_CC_CAP_EXT_AOB_PRESENT) {
  32334. ++ cc->pmu.core = bcma_find_core(bus, BCMA_CORE_PMU);
  32335. ++ if (!cc->pmu.core)
  32336. ++ bcma_warn(bus, "Couldn't find expected PMU core");
  32337. ++ }
  32338. ++ if (!cc->pmu.core)
  32339. ++ cc->pmu.core = cc->core;
  32340. ++
  32341. ++ pmucap = bcma_pmu_read32(cc, BCMA_CC_PMU_CAP);
  32342. + cc->pmu.rev = (pmucap & BCMA_CC_PMU_CAP_REVISION);
  32343. +
  32344. +- bcma_debug(cc->core->bus, "Found rev %u PMU (capabilities 0x%08X)\n",
  32345. +- cc->pmu.rev, pmucap);
  32346. ++ bcma_debug(bus, "Found rev %u PMU (capabilities 0x%08X)\n", cc->pmu.rev,
  32347. ++ pmucap);
  32348. + }
  32349. +
  32350. + void bcma_pmu_init(struct bcma_drv_cc *cc)
  32351. + {
  32352. + if (cc->pmu.rev == 1)
  32353. +- bcma_cc_mask32(cc, BCMA_CC_PMU_CTL,
  32354. +- ~BCMA_CC_PMU_CTL_NOILPONW);
  32355. ++ bcma_pmu_mask32(cc, BCMA_CC_PMU_CTL,
  32356. ++ ~BCMA_CC_PMU_CTL_NOILPONW);
  32357. + else
  32358. +- bcma_cc_set32(cc, BCMA_CC_PMU_CTL,
  32359. +- BCMA_CC_PMU_CTL_NOILPONW);
  32360. ++ bcma_pmu_set32(cc, BCMA_CC_PMU_CTL,
  32361. ++ BCMA_CC_PMU_CTL_NOILPONW);
  32362. +
  32363. + bcma_pmu_pll_init(cc);
  32364. + bcma_pmu_resources_init(cc);
  32365. +@@ -472,8 +482,8 @@ u32 bcma_pmu_get_cpu_clock(struct bcma_d
  32366. + static void bcma_pmu_spuravoid_pll_write(struct bcma_drv_cc *cc, u32 offset,
  32367. + u32 value)
  32368. + {
  32369. +- bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR, offset);
  32370. +- bcma_cc_write32(cc, BCMA_CC_PLLCTL_DATA, value);
  32371. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR, offset);
  32372. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_DATA, value);
  32373. + }
  32374. +
  32375. + void bcma_pmu_spuravoid_pllupdate(struct bcma_drv_cc *cc, int spuravoid)
  32376. +@@ -497,20 +507,20 @@ void bcma_pmu_spuravoid_pllupdate(struct
  32377. + bus->chipinfo.id == BCMA_CHIP_ID_BCM53572) ? 6 : 0;
  32378. +
  32379. + /* RMW only the P1 divider */
  32380. +- bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR,
  32381. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR,
  32382. + BCMA_CC_PMU_PLL_CTL0 + phypll_offset);
  32383. +- tmp = bcma_cc_read32(cc, BCMA_CC_PLLCTL_DATA);
  32384. ++ tmp = bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_DATA);
  32385. + tmp &= (~(BCMA_CC_PMU1_PLL0_PC0_P1DIV_MASK));
  32386. + tmp |= (bcm5357_bcm43236_p1div[spuravoid] << BCMA_CC_PMU1_PLL0_PC0_P1DIV_SHIFT);
  32387. +- bcma_cc_write32(cc, BCMA_CC_PLLCTL_DATA, tmp);
  32388. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_DATA, tmp);
  32389. +
  32390. + /* RMW only the int feedback divider */
  32391. +- bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR,
  32392. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR,
  32393. + BCMA_CC_PMU_PLL_CTL2 + phypll_offset);
  32394. +- tmp = bcma_cc_read32(cc, BCMA_CC_PLLCTL_DATA);
  32395. ++ tmp = bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_DATA);
  32396. + tmp &= ~(BCMA_CC_PMU1_PLL0_PC2_NDIV_INT_MASK);
  32397. + tmp |= (bcm5357_bcm43236_ndiv[spuravoid]) << BCMA_CC_PMU1_PLL0_PC2_NDIV_INT_SHIFT;
  32398. +- bcma_cc_write32(cc, BCMA_CC_PLLCTL_DATA, tmp);
  32399. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_DATA, tmp);
  32400. +
  32401. + tmp = BCMA_CC_PMU_CTL_PLL_UPD;
  32402. + break;
  32403. +@@ -646,7 +656,7 @@ void bcma_pmu_spuravoid_pllupdate(struct
  32404. + break;
  32405. + }
  32406. +
  32407. +- tmp |= bcma_cc_read32(cc, BCMA_CC_PMU_CTL);
  32408. +- bcma_cc_write32(cc, BCMA_CC_PMU_CTL, tmp);
  32409. ++ tmp |= bcma_pmu_read32(cc, BCMA_CC_PMU_CTL);
  32410. ++ bcma_pmu_write32(cc, BCMA_CC_PMU_CTL, tmp);
  32411. + }
  32412. + EXPORT_SYMBOL_GPL(bcma_pmu_spuravoid_pllupdate);
  32413. --- a/drivers/bcma/driver_chipcommon_sflash.c
  32414. +++ b/drivers/bcma/driver_chipcommon_sflash.c
  32415. @@ -38,6 +38,7 @@ static const struct bcma_sflash_tbl_e bc
  32416. @@ -18,27 +278,6 @@
  32417. { NULL },
  32418. };
  32419. ---- a/drivers/bcma/driver_gpio.c
  32420. -+++ b/drivers/bcma/driver_gpio.c
  32421. -@@ -229,6 +229,7 @@ int bcma_gpio_init(struct bcma_drv_cc *c
  32422. - case BCMA_CHIP_ID_BCM4707:
  32423. - case BCMA_CHIP_ID_BCM5357:
  32424. - case BCMA_CHIP_ID_BCM53572:
  32425. -+ case BCMA_CHIP_ID_BCM47094:
  32426. - chip->ngpio = 32;
  32427. - break;
  32428. - default:
  32429. ---- a/drivers/bcma/host_pci.c
  32430. -+++ b/drivers/bcma/host_pci.c
  32431. -@@ -294,7 +294,7 @@ static const struct pci_device_id bcma_p
  32432. - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4358) },
  32433. - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4359) },
  32434. - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4360) },
  32435. -- { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4365) },
  32436. -+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_BROADCOM, 0x4365, PCI_VENDOR_ID_DELL, 0x0016) },
  32437. - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a0) },
  32438. - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a9) },
  32439. - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43aa) },
  32440. --- a/drivers/bcma/scan.c
  32441. +++ b/drivers/bcma/scan.c
  32442. @@ -98,6 +98,9 @@ static const struct bcma_device_id_name
  32443. @@ -51,6 +290,32 @@
  32444. { BCMA_CORE_DEFAULT, "Default" },
  32445. };
  32446. +@@ -315,6 +318,8 @@ static int bcma_get_next_core(struct bcm
  32447. + switch (core->id.id) {
  32448. + case BCMA_CORE_4706_MAC_GBIT_COMMON:
  32449. + case BCMA_CORE_NS_CHIPCOMMON_B:
  32450. ++ case BCMA_CORE_PMU:
  32451. ++ case BCMA_CORE_GCI:
  32452. + /* Not used yet: case BCMA_CORE_OOB_ROUTER: */
  32453. + break;
  32454. + default:
  32455. +--- a/drivers/net/wireless/b43/main.c
  32456. ++++ b/drivers/net/wireless/b43/main.c
  32457. +@@ -1215,10 +1215,10 @@ void b43_wireless_core_phy_pll_reset(str
  32458. + case B43_BUS_BCMA:
  32459. + bcma_cc = &dev->dev->bdev->bus->drv_cc;
  32460. +
  32461. +- bcma_cc_write32(bcma_cc, BCMA_CC_CHIPCTL_ADDR, 0);
  32462. +- bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4);
  32463. +- bcma_cc_set32(bcma_cc, BCMA_CC_CHIPCTL_DATA, 0x4);
  32464. +- bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4);
  32465. ++ bcma_cc_write32(bcma_cc, BCMA_CC_PMU_CHIPCTL_ADDR, 0);
  32466. ++ bcma_cc_mask32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, ~0x4);
  32467. ++ bcma_cc_set32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, 0x4);
  32468. ++ bcma_cc_mask32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, ~0x4);
  32469. + break;
  32470. + #endif
  32471. + #ifdef CONFIG_B43_SSB
  32472. --- a/include/linux/bcma/bcma.h
  32473. +++ b/include/linux/bcma/bcma.h
  32474. @@ -151,6 +151,8 @@ struct bcma_host_ops {
  32475. @@ -70,3 +335,110 @@
  32476. #define BCMA_CHIP_ID_BCM53018 53018
  32477. /* Board types (on PCI usually equals to the subsystem dev id) */
  32478. +--- a/include/linux/bcma/bcma_driver_chipcommon.h
  32479. ++++ b/include/linux/bcma/bcma_driver_chipcommon.h
  32480. +@@ -217,6 +217,11 @@
  32481. + #define BCMA_CC_CLKDIV_JTAG_SHIFT 8
  32482. + #define BCMA_CC_CLKDIV_UART 0x000000FF
  32483. + #define BCMA_CC_CAP_EXT 0x00AC /* Capabilities */
  32484. ++#define BCMA_CC_CAP_EXT_SECI_PRESENT 0x00000001
  32485. ++#define BCMA_CC_CAP_EXT_GSIO_PRESENT 0x00000002
  32486. ++#define BCMA_CC_CAP_EXT_GCI_PRESENT 0x00000004
  32487. ++#define BCMA_CC_CAP_EXT_SECI_PUART_PRESENT 0x00000008 /* UART present */
  32488. ++#define BCMA_CC_CAP_EXT_AOB_PRESENT 0x00000040
  32489. + #define BCMA_CC_PLLONDELAY 0x00B0 /* Rev >= 4 only */
  32490. + #define BCMA_CC_FREFSELDELAY 0x00B4 /* Rev >= 4 only */
  32491. + #define BCMA_CC_SLOWCLKCTL 0x00B8 /* 6 <= Rev <= 9 only */
  32492. +@@ -351,12 +356,12 @@
  32493. + #define BCMA_CC_PMU_RES_REQTS 0x0640 /* PMU res req timer sel */
  32494. + #define BCMA_CC_PMU_RES_REQT 0x0644 /* PMU res req timer */
  32495. + #define BCMA_CC_PMU_RES_REQM 0x0648 /* PMU res req mask */
  32496. +-#define BCMA_CC_CHIPCTL_ADDR 0x0650
  32497. +-#define BCMA_CC_CHIPCTL_DATA 0x0654
  32498. +-#define BCMA_CC_REGCTL_ADDR 0x0658
  32499. +-#define BCMA_CC_REGCTL_DATA 0x065C
  32500. +-#define BCMA_CC_PLLCTL_ADDR 0x0660
  32501. +-#define BCMA_CC_PLLCTL_DATA 0x0664
  32502. ++#define BCMA_CC_PMU_CHIPCTL_ADDR 0x0650
  32503. ++#define BCMA_CC_PMU_CHIPCTL_DATA 0x0654
  32504. ++#define BCMA_CC_PMU_REGCTL_ADDR 0x0658
  32505. ++#define BCMA_CC_PMU_REGCTL_DATA 0x065C
  32506. ++#define BCMA_CC_PMU_PLLCTL_ADDR 0x0660
  32507. ++#define BCMA_CC_PMU_PLLCTL_DATA 0x0664
  32508. + #define BCMA_CC_PMU_STRAPOPT 0x0668 /* (corerev >= 28) */
  32509. + #define BCMA_CC_PMU_XTAL_FREQ 0x066C /* (pmurev >= 10) */
  32510. + #define BCMA_CC_PMU_XTAL_FREQ_ILPCTL_MASK 0x00001FFF
  32511. +@@ -566,6 +571,7 @@
  32512. + * Check availability with ((struct bcma_chipcommon)->capabilities & BCMA_CC_CAP_PMU)
  32513. + */
  32514. + struct bcma_chipcommon_pmu {
  32515. ++ struct bcma_device *core; /* Can be separated core or just ChipCommon one */
  32516. + u8 rev; /* PMU revision */
  32517. + u32 crystalfreq; /* The active crystal frequency (in kHz) */
  32518. + };
  32519. +@@ -663,6 +669,19 @@ struct bcma_drv_cc_b {
  32520. + #define bcma_cc_maskset32(cc, offset, mask, set) \
  32521. + bcma_cc_write32(cc, offset, (bcma_cc_read32(cc, offset) & (mask)) | (set))
  32522. +
  32523. ++/* PMU registers access */
  32524. ++#define bcma_pmu_read32(cc, offset) \
  32525. ++ bcma_read32((cc)->pmu.core, offset)
  32526. ++#define bcma_pmu_write32(cc, offset, val) \
  32527. ++ bcma_write32((cc)->pmu.core, offset, val)
  32528. ++
  32529. ++#define bcma_pmu_mask32(cc, offset, mask) \
  32530. ++ bcma_pmu_write32(cc, offset, bcma_pmu_read32(cc, offset) & (mask))
  32531. ++#define bcma_pmu_set32(cc, offset, set) \
  32532. ++ bcma_pmu_write32(cc, offset, bcma_pmu_read32(cc, offset) | (set))
  32533. ++#define bcma_pmu_maskset32(cc, offset, mask, set) \
  32534. ++ bcma_pmu_write32(cc, offset, (bcma_pmu_read32(cc, offset) & (mask)) | (set))
  32535. ++
  32536. + extern u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks);
  32537. +
  32538. + extern u32 bcma_chipco_get_alp_clock(struct bcma_drv_cc *cc);
  32539. +--- a/drivers/bcma/bcma_private.h
  32540. ++++ b/drivers/bcma/bcma_private.h
  32541. +@@ -47,7 +47,6 @@ void bcma_core_chipcommon_early_init(str
  32542. + void bcma_core_chipcommon_init(struct bcma_drv_cc *cc);
  32543. + void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable);
  32544. + #ifdef CONFIG_BCMA_DRIVER_MIPS
  32545. +-void bcma_chipco_serial_init(struct bcma_drv_cc *cc);
  32546. + extern struct platform_device bcma_pflash_dev;
  32547. + #endif /* CONFIG_BCMA_DRIVER_MIPS */
  32548. +
  32549. +--- a/drivers/bcma/driver_gpio.c
  32550. ++++ b/drivers/bcma/driver_gpio.c
  32551. +@@ -229,6 +229,7 @@ int bcma_gpio_init(struct bcma_drv_cc *c
  32552. + case BCMA_CHIP_ID_BCM4707:
  32553. + case BCMA_CHIP_ID_BCM5357:
  32554. + case BCMA_CHIP_ID_BCM53572:
  32555. ++ case BCMA_CHIP_ID_BCM47094:
  32556. + chip->ngpio = 32;
  32557. + break;
  32558. + default:
  32559. +--- a/drivers/bcma/driver_mips.c
  32560. ++++ b/drivers/bcma/driver_mips.c
  32561. +@@ -328,12 +328,9 @@ static void bcma_core_mips_flash_detect(
  32562. +
  32563. + void bcma_core_mips_early_init(struct bcma_drv_mips *mcore)
  32564. + {
  32565. +- struct bcma_bus *bus = mcore->core->bus;
  32566. +-
  32567. + if (mcore->early_setup_done)
  32568. + return;
  32569. +
  32570. +- bcma_chipco_serial_init(&bus->drv_cc);
  32571. + bcma_core_mips_flash_detect(mcore);
  32572. +
  32573. + mcore->early_setup_done = true;
  32574. +--- a/drivers/bcma/host_pci.c
  32575. ++++ b/drivers/bcma/host_pci.c
  32576. +@@ -294,7 +294,7 @@ static const struct pci_device_id bcma_p
  32577. + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4358) },
  32578. + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4359) },
  32579. + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4360) },
  32580. +- { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4365) },
  32581. ++ { PCI_DEVICE_SUB(PCI_VENDOR_ID_BROADCOM, 0x4365, PCI_VENDOR_ID_DELL, 0x0016) },
  32582. + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a0) },
  32583. + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a9) },
  32584. + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43aa) },