0007-mac80211-backport-from-trunk-r47249.patch 1.0 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Tue, 23 Dec 2014 18:57:16 +0100
  3. Subject: mac80211: backport from trunk r47249
  4. diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
  5. index a1eedce..566e156 100644
  6. --- a/package/kernel/mac80211/Makefile
  7. +++ b/package/kernel/mac80211/Makefile
  8. @@ -10,11 +10,11 @@ include $(INCLUDE_DIR)/kernel.mk
  9. PKG_NAME:=mac80211
  10. -PKG_VERSION:=2015-03-09
  11. -PKG_RELEASE:=3
  12. +PKG_VERSION:=2015-07-21
  13. +PKG_RELEASE:=1
  14. PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
  15. PKG_BACKPORT_VERSION:=
  16. -PKG_MD5SUM:=6d4b04e4ce8a1f54dabfb04f4709453c
  17. +PKG_MD5SUM:=ec529acfb9c942daf8116e5cff47c999
  18. PKG_SOURCE:=compat-wireless-$(PKG_VERSION)$(PKG_BACKPORT_VERSION).tar.bz2
  19. PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION)
  20. @@ -23,15 +23,28 @@ PKG_BUILD_PARALLEL:=1
  21. PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  22. PKG_DRIVERS = \
  23. - adm8211 ath5k libertas-usb libertas-sdio p54-common p54-pci p54-usb p54-spi \
  24. - rt2x00-lib rt2x00-pci rt2x00-usb rt2800-lib rt2400-pci rt2500-pci \
  25. - rt2500-usb rt61-pci rt73-usb rt2800-mmio rt2800-pci rt2800-usb rt2800-soc \
  26. - rtl8180 rtl8187 zd1211rw mac80211-hwsim carl9170 b43 b43legacy \
  27. - ath9k-common ath9k ath9k-htc ath10k ath net-libipw net-ipw2100 net-ipw2200 \
  28. - mwl8k mwifiex-pcie net-hermes net-hermes-pci net-hermes-plx net-hermes-pcmcia \
  29. - iwl-legacy iwl3945 iwl4965 iwlagn wlcore wl12xx wl18xx lib80211 \
  30. + adm8211 \
  31. + ath ath5k ath9k ath9k-common ath9k-htc ath10k \
  32. + b43 b43legacy \
  33. + carl9170 \
  34. + hermes hermes-pci hermes-pcmcia hermes-plx\
  35. + iwl-legacy iwl3945 iwl4965 iwlwifi \
  36. + lib80211 \
  37. + libipw ipw2100 ipw2200 \
  38. + libertas-sdio libertas-usb \
  39. + mac80211-hwsim \
  40. + mt7601u \
  41. + mwl8k mwifiex-pcie \
  42. + p54-common p54-pci p54-spi p54-usb \
  43. + rt2x00-lib rt2x00-pci rt2x00-usb \
  44. + rt2400-pci rt2500-pci rt2500-usb \
  45. + rt2800-lib rt2800-mmio rt2800-pci rt2800-soc rt2800-usb \
  46. + rt61-pci rt73-usb \
  47. + rtl8180 rtl8187 \
  48. rtlwifi rtlwifi-pci rtlwifi-usb rtl8192c-common rtl8192ce rtl8192se \
  49. - rtl8192de rtl8192cu
  50. + rtl8192de rtl8192cu \
  51. + wlcore wl12xx wl18xx \
  52. + zd1211rw
  53. PKG_CONFIG_DEPENDS:= \
  54. CONFIG_PACKAGE_kmod-mac80211 \
  55. @@ -60,7 +73,6 @@ define KernelPackage/mac80211/Default
  56. SUBMENU:=$(WMENU)
  57. URL:=https://wireless.wiki.kernel.org/
  58. MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  59. - DEPENDS:=@!TARGET_uml
  60. endef
  61. define KernelPackage/cfg80211
  62. @@ -109,8 +121,8 @@ Generic IEEE 802.11 Networking Stack (mac80211)
  63. endef
  64. PKG_LINUX_FIRMWARE_NAME:=linux-firmware
  65. -PKG_LINUX_FIRMWARE_VERSION:=f404336ba808cbd57547196e13367079a23b822c
  66. -PKG_LINUX_FIRMWARE_SOURCE:=$(PKG_LINUX_FIRMWARE_NAME)-2015-03-20-$(PKG_LINUX_FIRMWARE_VERSION).tar.bz2
  67. +PKG_LINUX_FIRMWARE_VERSION:=6ebf5d57d9f6d0cf05558baef1af2b90a3fe98ed
  68. +PKG_LINUX_FIRMWARE_SOURCE:=$(PKG_LINUX_FIRMWARE_NAME)-2015-09-03-$(PKG_LINUX_FIRMWARE_VERSION).tar.xz
  69. PKG_LINUX_FIRMWARE_PROTO:=git
  70. PKG_LINUX_FIRMWARE_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
  71. PKG_LINUX_FIRMWARE_SUBDIR:=$(PKG_LINUX_FIRMWARE_NAME)-$(PKG_LINUX_FIRMWARE_VERSION)
  72. @@ -127,723 +139,769 @@ define Download/linux-firmware
  73. endef
  74. $(eval $(call Download,linux-firmware))
  75. -PKG_ATH10K_LINUX_FIRMWARE_NAME:=ath10k-firmware
  76. -PKG_ATH10K_LINUX_FIRMWARE_VERSION:=da0f85d924226ee30c46e037120621c9e192b39e
  77. -PKG_ATH10K_LINUX_FIRMWARE_SOURCE:=$(PKG_ATH10K_LINUX_FIRMWARE_NAME)-$(PKG_ATH10K_LINUX_FIRMWARE_VERSION).tar.bz2
  78. -PKG_ATH10K_LINUX_FIRMWARE_PROTO:=git
  79. -PKG_ATH10K_LINUX_FIRMWARE_SOURCE_URL:=https://github.com/kvalo/ath10k-firmware.git
  80. -PKG_ATH10K_LINUX_FIRMWARE_SUBDIR:=$(PKG_ATH10K_LINUX_FIRMWARE_NAME)-$(PKG_ATH10K_LINUX_FIRMWARE_VERSION)
  81. -#PKG_ATH10K_LINUX_FIRMWARE_MIRROR_MD5SUM:=?
  82. -define Download/ath10k-firmware
  83. - FILE:=$(PKG_ATH10K_LINUX_FIRMWARE_SOURCE)
  84. - URL:=$(PKG_ATH10K_LINUX_FIRMWARE_SOURCE_URL)
  85. - PROTO:=$(PKG_ATH10K_LINUX_FIRMWARE_PROTO)
  86. - VERSION:=$(PKG_ATH10K_LINUX_FIRMWARE_VERSION)
  87. - SUBDIR:=$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)
  88. - #MIRROR_MD5SUM:=$(PKG_ATH10K_LINUX_FIRMWARE_MIRROR_MD5SUM)
  89. +define KernelPackage/adm8211
  90. + $(call KernelPackage/mac80211/Default)
  91. + TITLE:=ADMTek 8211 support
  92. + DEPENDS+=@PCI_SUPPORT +kmod-mac80211 +kmod-eeprom-93cx6
  93. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/adm8211.ko
  94. + AUTOLOAD:=$(call AutoProbe,adm8211)
  95. endef
  96. -$(eval $(call Download,ath10k-firmware))
  97. -# Prism54 drivers
  98. -P54PCIFW:=2.13.12.0.arm
  99. -P54USBFW:=2.13.24.0.lm87.arm
  100. -P54SPIFW:=2.13.0.0.a.13.14.arm
  101. +define KernelPackage/ath/config
  102. + if PACKAGE_kmod-ath
  103. + config ATH_USER_REGD
  104. + bool "Force Atheros drivers to respect the user's regdomain settings"
  105. + help
  106. + Atheros' idea of regulatory handling is that the EEPROM of the card defines
  107. + the regulatory limits and the user is only allowed to restrict the settings
  108. + even further, even if the country allows frequencies or power levels that
  109. + are forbidden by the EEPROM settings.
  110. -define Download/p54usb
  111. - FILE:=$(P54USBFW)
  112. - URL:=http://daemonizer.de/prism54/prism54-fw/fw-usb
  113. - MD5SUM:=8e8ab005a4f8f0123bcdc51bc25b47f6
  114. -endef
  115. -$(eval $(call Download,p54usb))
  116. + Select this option if you want the driver to respect the user's decision about
  117. + regulatory settings.
  118. -define Download/p54pci
  119. - FILE:=$(P54PCIFW)
  120. - URL:=http://daemonizer.de/prism54/prism54-fw/fw-softmac
  121. - MD5SUM:=ff7536af2092b1c4b21315bd103ef4c4
  122. -endef
  123. -$(eval $(call Download,p54pci))
  124. + config PACKAGE_ATH_DEBUG
  125. + bool "Atheros wireless debugging"
  126. + help
  127. + Say Y, if you want to debug atheros wireless drivers.
  128. + Only ath9k & ath10k make use of this.
  129. -define Download/p54spi
  130. - FILE:=$(P54SPIFW)
  131. - URL:=http://daemonizer.de/prism54/prism54-fw/stlc4560
  132. - MD5SUM:=42661f8ecbadd88012807493f596081d
  133. -endef
  134. -$(eval $(call Download,p54spi))
  135. + config PACKAGE_ATH_DFS
  136. + bool "Enable DFS support"
  137. + default y
  138. + help
  139. + Dynamic frequency selection (DFS) is required for most of the 5 GHz band
  140. + channels in Europe, US, and Japan.
  141. -define KernelPackage/p54/Default
  142. - $(call KernelPackage/mac80211/Default)
  143. - TITLE:=Prism54 Drivers
  144. -endef
  145. + Select this option if you want to use such channels.
  146. -define KernelPackage/p54/description
  147. - Kernel module for Prism54 chipsets (mac80211)
  148. + endif
  149. endef
  150. -define KernelPackage/p54-common
  151. - $(call KernelPackage/p54/Default)
  152. - DEPENDS+= @PCI_SUPPORT||@USB_SUPPORT||@TARGET_omap24xx +kmod-mac80211 +kmod-lib-crc-ccitt
  153. - TITLE+= (COMMON)
  154. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54common.ko
  155. +define KernelPackage/ath
  156. + $(call KernelPackage/mac80211/Default)
  157. + TITLE:=Atheros common driver part
  158. + DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx||TARGET_ath25 +kmod-mac80211
  159. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath.ko
  160. + MENU:=1
  161. endef
  162. -define KernelPackage/p54-pci
  163. - $(call KernelPackage/p54/Default)
  164. - TITLE+= (PCI)
  165. - DEPENDS+= @PCI_SUPPORT +kmod-p54-common
  166. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54pci.ko
  167. - AUTOLOAD:=$(call AutoProbe,p54pci)
  168. +define KernelPackage/ath/description
  169. + This module contains some common parts needed by Atheros Wireless drivers.
  170. endef
  171. -define KernelPackage/p54-usb
  172. - $(call KernelPackage/p54/Default)
  173. - TITLE+= (USB)
  174. - DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-p54-common
  175. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54usb.ko
  176. - AUTOLOAD:=$(call AutoProbe,p54usb)
  177. +define KernelPackage/ath5k
  178. + $(call KernelPackage/mac80211/Default)
  179. + TITLE:=Atheros 5xxx wireless cards support
  180. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath5k
  181. + DEPENDS+= @PCI_SUPPORT||@TARGET_ath25 +kmod-ath
  182. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath5k/ath5k.ko
  183. + AUTOLOAD:=$(call AutoProbe,ath5k)
  184. endef
  185. -define KernelPackage/p54-spi
  186. - $(call KernelPackage/p54/Default)
  187. - TITLE+= (SPI)
  188. - DEPENDS+= @TARGET_omap24xx +kmod-p54-common
  189. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54spi.ko
  190. - AUTOLOAD:=$(call AutoProbe,p54spi)
  191. +define KernelPackage/ath5k/description
  192. + This module adds support for wireless adapters based on
  193. + Atheros 5xxx chipset.
  194. endef
  195. -define KernelPackage/rt2x00/Default
  196. +define KernelPackage/ath9k-common
  197. $(call KernelPackage/mac80211/Default)
  198. - TITLE:=Ralink Drivers for RT2x00 cards
  199. + TITLE:=Atheros 802.11n wireless devices (common code for ath9k and ath9k_htc)
  200. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  201. + DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY
  202. + FILES:= \
  203. + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_common.ko \
  204. + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_hw.ko
  205. endef
  206. -define KernelPackage/rt2x00-lib
  207. -$(call KernelPackage/rt2x00/Default)
  208. - DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-mac80211 +kmod-lib-crc-itu-t
  209. - TITLE+= (LIB)
  210. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00lib.ko
  211. - MENU:=1
  212. +define KernelPackage/ath9k
  213. + $(call KernelPackage/mac80211/Default)
  214. + TITLE:=Atheros 802.11n PCI wireless cards support
  215. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  216. + DEPENDS+= @PCI_SUPPORT||TARGET_ar71xx +kmod-ath9k-common
  217. + FILES:= \
  218. + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k.ko
  219. + AUTOLOAD:=$(call AutoProbe,ath9k)
  220. endef
  221. -define KernelPackage/rt2x00-lib/config
  222. - if PACKAGE_kmod-rt2x00-lib
  223. -
  224. - config PACKAGE_RT2X00_LIB_DEBUGFS
  225. - bool "Enable rt2x00 debugfs support"
  226. - depends on PACKAGE_MAC80211_DEBUGFS
  227. - help
  228. - Enable creation of debugfs files for the rt2x00 drivers.
  229. - These debugfs files support both reading and writing of the
  230. - most important register types of the rt2x00 hardware.
  231. -
  232. - config PACKAGE_RT2X00_DEBUG
  233. - bool "Enable rt2x00 debug output"
  234. - help
  235. - Enable debugging output for all rt2x00 modules
  236. -
  237. - endif
  238. +define KernelPackage/ath9k/description
  239. +This module adds support for wireless adapters based on
  240. +Atheros IEEE 802.11n AR5008 and AR9001 family of chipsets.
  241. endef
  242. -define KernelPackage/rt2x00-mmio
  243. -$(call KernelPackage/rt2x00/Default)
  244. - DEPENDS+= @(PCI_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib +kmod-eeprom-93cx6
  245. - HIDDEN:=1
  246. - TITLE+= (MMIO)
  247. - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00mmio.ko
  248. -endef
  249. +define KernelPackage/ath9k/config
  250. -define KernelPackage/rt2x00-pci
  251. -$(call KernelPackage/rt2x00/Default)
  252. - DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-mmio +kmod-rt2x00-lib
  253. - HIDDEN:=1
  254. - TITLE+= (PCI)
  255. - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00pci.ko
  256. - AUTOLOAD:=$(call AutoProbe,rt2x00pci)
  257. -endef
  258. + config ATH9K_SUPPORT_PCOEM
  259. + bool "Support chips used in PC OEM cards"
  260. + depends on PACKAGE_kmod-ath9k
  261. -define KernelPackage/rt2x00-usb
  262. -$(call KernelPackage/rt2x00/Default)
  263. - DEPENDS+= @USB_SUPPORT +kmod-rt2x00-lib +kmod-usb-core
  264. - HIDDEN:=1
  265. - TITLE+= (USB)
  266. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00usb.ko
  267. - AUTOLOAD:=$(call AutoProbe,rt2x00usb)
  268. endef
  269. -define KernelPackage/rt2800-lib
  270. -$(call KernelPackage/rt2x00/Default)
  271. - DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib +kmod-lib-crc-ccitt +@DRIVER_11N_SUPPORT
  272. - HIDDEN:=1
  273. - TITLE+= (rt2800 LIB)
  274. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800lib.ko
  275. +define KernelPackage/ath9k-htc
  276. + $(call KernelPackage/mac80211/Default)
  277. + TITLE:=Atheros 802.11n USB device support
  278. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  279. + DEPENDS+= @USB_SUPPORT +kmod-ath9k-common +kmod-usb-core
  280. + FILES:= \
  281. + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_htc.ko
  282. + AUTOLOAD:=$(call AutoProbe,ath9k_htc)
  283. endef
  284. -define KernelPackage/rt2400-pci
  285. -$(call KernelPackage/rt2x00/Default)
  286. - DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
  287. - TITLE+= (RT2400 PCI)
  288. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2400pci.ko
  289. - AUTOLOAD:=$(call AutoProbe,rt2400pci)
  290. +define KernelPackage/ath9k-htc/description
  291. +This module adds support for wireless adapters based on
  292. +Atheros USB AR9271 and AR7010 family of chipsets.
  293. endef
  294. -define KernelPackage/rt2500-pci
  295. -$(call KernelPackage/rt2x00/Default)
  296. - DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
  297. - TITLE+= (RT2500 PCI)
  298. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2500pci.ko
  299. - AUTOLOAD:=$(call AutoProbe,rt2500pci)
  300. +define KernelPackage/ath10k
  301. + $(call KernelPackage/mac80211/Default)
  302. + TITLE:=Atheros 802.11ac wireless cards support
  303. + URL:=https://wireless.wiki.kernel.org/en/users/Drivers/ath10k
  304. + DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT
  305. + FILES:= \
  306. + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_core.ko \
  307. + $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_pci.ko
  308. + AUTOLOAD:=$(call AutoLoad,55,ath10k_core ath10k_pci)
  309. endef
  310. -define KernelPackage/rt2500-usb
  311. -$(call KernelPackage/rt2x00/Default)
  312. - DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb
  313. - TITLE+= (RT2500 USB)
  314. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2500usb.ko
  315. - AUTOLOAD:=$(call AutoProbe,rt2500usb)
  316. +define KernelPackage/ath10k/description
  317. +This module adds support for wireless adapters based on
  318. +Atheros IEEE 802.11ac family of chipsets. For now only
  319. +PCI is supported.
  320. endef
  321. -define KernelPackage/rt61-pci
  322. -$(call KernelPackage/rt2x00/Default)
  323. - DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
  324. - TITLE+= (RT2x61 PCI)
  325. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt61pci.ko
  326. - AUTOLOAD:=$(call AutoProbe,rt61pci)
  327. -endef
  328. +PKG_ATH10K_LINUX_FIRMWARE_NAME:=ath10k-firmware
  329. +PKG_ATH10K_LINUX_FIRMWARE_VERSION:=b46f3e01a6c1f9150fb4612ef53611d714565842
  330. +PKG_ATH10K_LINUX_FIRMWARE_SOURCE:=$(PKG_ATH10K_LINUX_FIRMWARE_NAME)-$(PKG_ATH10K_LINUX_FIRMWARE_VERSION).tar.bz2
  331. +PKG_ATH10K_LINUX_FIRMWARE_PROTO:=git
  332. +PKG_ATH10K_LINUX_FIRMWARE_SOURCE_URL:=https://github.com/kvalo/ath10k-firmware.git
  333. +PKG_ATH10K_LINUX_FIRMWARE_SUBDIR:=$(PKG_ATH10K_LINUX_FIRMWARE_NAME)-$(PKG_ATH10K_LINUX_FIRMWARE_VERSION)
  334. +#PKG_ATH10K_LINUX_FIRMWARE_MIRROR_MD5SUM:=?
  335. -define KernelPackage/rt73-usb
  336. - $(call KernelPackage/rt2x00/Default)
  337. - DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb
  338. - TITLE+= (RT73 USB)
  339. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt73usb.ko
  340. - AUTOLOAD:=$(call AutoProbe,rt73usb)
  341. +define Download/ath10k-firmware
  342. + FILE:=$(PKG_ATH10K_LINUX_FIRMWARE_SOURCE)
  343. + URL:=$(PKG_ATH10K_LINUX_FIRMWARE_SOURCE_URL)
  344. + PROTO:=$(PKG_ATH10K_LINUX_FIRMWARE_PROTO)
  345. + VERSION:=$(PKG_ATH10K_LINUX_FIRMWARE_VERSION)
  346. + SUBDIR:=$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)
  347. + #MIRROR_MD5SUM:=$(PKG_ATH10K_LINUX_FIRMWARE_MIRROR_MD5SUM)
  348. endef
  349. +$(eval $(call Download,ath10k-firmware))
  350. -define KernelPackage/rt2800-mmio
  351. -$(call KernelPackage/rt2x00/Default)
  352. - TITLE += (RT28xx/RT3xxx MMIO)
  353. - DEPENDS += +kmod-rt2800-lib +kmod-rt2x00-mmio
  354. - HIDDEN:=1
  355. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800mmio.ko
  356. -endef
  357. -define KernelPackage/rt2800-soc
  358. -$(call KernelPackage/rt2x00/Default)
  359. - DEPENDS += @(TARGET_ramips_rt288x||TARGET_ramips_rt305x||TARGET_ramips_rt3883||TARGET_ramips_mt7620) +kmod-rt2800-mmio +kmod-rt2800-lib
  360. - TITLE += (RT28xx/RT3xxx SoC)
  361. - FILES := \
  362. - $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00soc.ko \
  363. - $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800soc.ko
  364. - AUTOLOAD:=$(call AutoProbe,rt2800soc)
  365. -endef
  366. +#Broadcom firmware
  367. +ifneq ($(CONFIG_B43_FW_6_30),)
  368. + PKG_B43_FWV4_NAME:=broadcom-wl
  369. + PKG_B43_FWV4_VERSION:=6.30.163.46
  370. + PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).wl_apsta.o
  371. + PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  372. + PKG_B43_FWV4_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/
  373. + PKG_B43_FWV4_MD5SUM:=6fe97e9368d25342a1ab943d3cf3496d
  374. +else
  375. +ifneq ($(CONFIG_B43_FW_5_10),)
  376. + PKG_B43_FWV4_NAME:=broadcom-wl
  377. + PKG_B43_FWV4_VERSION:=5.10.56.27.3
  378. + PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/driver/wl_apsta/wl_prebuilt.o
  379. + PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)_mipsel.tar.bz2
  380. + PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
  381. + PKG_B43_FWV4_MD5SUM:=3363e3a6b3d9d73c49dea870c7834eac
  382. +else
  383. +ifneq ($(CONFIG_B43_FW_4_178),)
  384. + PKG_B43_FWV4_NAME:=broadcom-wl
  385. + PKG_B43_FWV4_VERSION:=4.178.10.4
  386. + PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/linux/wl_apsta.o
  387. + PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  388. + PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
  389. + PKG_B43_FWV4_MD5SUM:=14477e8cbbb91b11896affac9b219fdb
  390. +else
  391. +ifneq ($(CONFIG_B43_FW_5_100_138),)
  392. + PKG_B43_FWV4_NAME:=broadcom-wl
  393. + PKG_B43_FWV4_VERSION:=5.100.138
  394. + PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/linux/wl_apsta.o
  395. + PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  396. + PKG_B43_FWV4_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/
  397. + PKG_B43_FWV4_MD5SUM:=f4e357b09eaf5d8b1f1920cf3493a555
  398. +else
  399. + PKG_B43_FWV4_NAME:=broadcom-wl
  400. + PKG_B43_FWV4_VERSION:=4.150.10.5
  401. + PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/driver/wl_apsta_mimo.o
  402. + PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  403. + PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
  404. + PKG_B43_FWV4_MD5SUM:=0c6ba9687114c6b598e8019e262d9a60
  405. +endif
  406. +endif
  407. +endif
  408. +endif
  409. +ifneq ($(CONFIG_B43_OPENFIRMWARE),)
  410. + PKG_B43_FWV4_NAME:=broadcom-wl
  411. + PKG_B43_FWV4_VERSION:=5.2
  412. + PKG_B43_FWV4_OBJECT:=openfwwf-$(PKG_B43_FWV4_VERSION)
  413. + PKG_B43_FWV4_SOURCE:=openfwwf-$(PKG_B43_FWV4_VERSION).tar.gz
  414. + PKG_B43_FWV4_SOURCE_URL:=http://www.ing.unibs.it/openfwwf/firmware/
  415. + PKG_B43_FWV4_MD5SUM:=e045a135453274e439ae183f8498b0fa
  416. +endif
  417. -define KernelPackage/rt2800-pci
  418. -$(call KernelPackage/rt2x00/Default)
  419. - DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci +kmod-rt2800-lib +kmod-rt2800-mmio
  420. - TITLE+= (RT2860 PCI)
  421. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800pci.ko
  422. - AUTOLOAD:=$(call AutoProbe,rt2800pci)
  423. +
  424. +PKG_B43_FWV3_NAME:=wl_apsta
  425. +PKG_B43_FWV3_VERSION:=3.130.20.0
  426. +PKG_B43_FWV3_SOURCE:=$(PKG_B43_FWV3_NAME)-$(PKG_B43_FWV3_VERSION).o
  427. +PKG_B43_FWV3_SOURCE_URL:=http://downloads.openwrt.org/sources/
  428. +PKG_B43_FWV3_MD5SUM:=e08665c5c5b66beb9c3b2dd54aa80cb3
  429. +
  430. +define Download/b43
  431. + FILE:=$(PKG_B43_FWV4_SOURCE)
  432. + URL:=$(PKG_B43_FWV4_SOURCE_URL)
  433. + MD5SUM:=$(PKG_B43_FWV4_MD5SUM)
  434. endef
  435. +$(eval $(call Download,b43))
  436. -define KernelPackage/rt2800-usb
  437. -$(call KernelPackage/rt2x00/Default)
  438. - DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb +kmod-rt2800-lib +kmod-lib-crc-ccitt
  439. - TITLE+= (RT2870 USB)
  440. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800usb.ko
  441. - AUTOLOAD:=$(call AutoProbe,rt2800usb)
  442. +define Download/b43legacy
  443. + FILE:=$(PKG_B43_FWV3_SOURCE)
  444. + URL:=$(PKG_B43_FWV3_SOURCE_URL)
  445. + MD5SUM:=$(PKG_B43_FWV3_MD5SUM)
  446. endef
  447. +$(eval $(call Download,b43legacy))
  448. -define KernelPackage/rtl818x/Default
  449. +
  450. +define KernelPackage/b43
  451. $(call KernelPackage/mac80211/Default)
  452. - TITLE:=Realtek Drivers for RTL818x devices
  453. - URL:=http://wireless.kernel.org/en/users/Drivers/rtl8187
  454. - DEPENDS+= +kmod-eeprom-93cx6 +kmod-mac80211
  455. + TITLE:=Broadcom 43xx wireless support
  456. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/b43
  457. + KCONFIG:= \
  458. + CONFIG_HW_RANDOM=y
  459. + # Depend on PCI_SUPPORT to make sure we can select kmod-bcma or kmod-ssb
  460. + DEPENDS += \
  461. + @PCI_SUPPORT +kmod-mac80211 \
  462. + $(if $(CONFIG_PACKAGE_B43_USE_SSB),+kmod-ssb) \
  463. + $(if $(CONFIG_PACKAGE_B43_USE_BCMA),+kmod-bcma)
  464. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/b43/b43.ko
  465. + AUTOLOAD:=$(call AutoProbe,b43)
  466. + MENU:=1
  467. endef
  468. -define KernelPackage/rtl8180
  469. - $(call KernelPackage/rtl818x/Default)
  470. - DEPENDS+= @PCI_SUPPORT
  471. - TITLE+= (RTL8180 PCI)
  472. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtl818x/rtl8180/rtl818x_pci.ko
  473. - AUTOLOAD:=$(call AutoProbe,rtl818x_pci)
  474. -endef
  475. +define KernelPackage/b43/config
  476. -define KernelPackage/rtl8187
  477. -$(call KernelPackage/rtl818x/Default)
  478. - DEPENDS+= @USB_SUPPORT +kmod-usb-core
  479. - TITLE+= (RTL8187 USB)
  480. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtl818x/rtl8187/rtl8187.ko
  481. - AUTOLOAD:=$(call AutoProbe,rtl8187)
  482. -endef
  483. +config PACKAGE_B43_USE_SSB
  484. + select PACKAGE_kmod-ssb
  485. + tristate
  486. + depends on !TARGET_brcm47xx && !TARGET_brcm63xx
  487. + default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA_AND_SSB
  488. + default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_SSB
  489. -define KernelPackage/rtlwifi/config
  490. - config PACKAGE_RTLWIFI_DEBUG
  491. - bool "Realtek wireless debugging"
  492. - depends on PACKAGE_kmod-rtlwifi
  493. +config PACKAGE_B43_USE_BCMA
  494. + select PACKAGE_kmod-bcma
  495. + tristate
  496. + depends on !TARGET_brcm47xx && !TARGET_bcm53xx
  497. + default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA_AND_SSB
  498. + default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA
  499. +
  500. + if PACKAGE_kmod-b43
  501. +
  502. + choice
  503. + prompt "b43 firmware version"
  504. + default B43_FW_5_100_138
  505. help
  506. - Say Y, if you want to debug realtek wireless drivers.
  507. + This option allows you to select the version of the b43 firmware.
  508. -endef
  509. + config B43_FW_4_150
  510. + bool "Firmware 410.2160 from driver 4.150.10.5 (old stable)"
  511. + help
  512. + Old stable firmware for BCM43xx devices.
  513. -define KernelPackage/rtlwifi
  514. - $(call KernelPackage/mac80211/Default)
  515. - TITLE:=Realtek common driver part
  516. - DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT) +kmod-mac80211 +@DRIVER_11N_SUPPORT
  517. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtlwifi.ko
  518. - HIDDEN:=1
  519. -endef
  520. + If unsure, select this.
  521. -define KernelPackage/rtlwifi-pci
  522. - $(call KernelPackage/mac80211/Default)
  523. - TITLE:=Realtek common driver part (PCI support)
  524. - DEPENDS+= @PCI_SUPPORT +kmod-rtlwifi
  525. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl_pci.ko
  526. - AUTOLOAD:=$(call AutoProbe,rtl_pci)
  527. - HIDDEN:=1
  528. -endef
  529. + config B43_FW_4_178
  530. + bool "Firmware 478.104 from driver 4.178.10.4"
  531. + help
  532. + Older firmware for BCM43xx devices.
  533. -define KernelPackage/rtlwifi-usb
  534. - $(call KernelPackage/mac80211/Default)
  535. - TITLE:=Realtek common driver part (USB support)
  536. - DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-rtlwifi
  537. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl_usb.ko
  538. - AUTOLOAD:=$(call AutoProbe,rtl_usb)
  539. - HIDDEN:=1
  540. -endef
  541. + If unsure, select the "stable" firmware.
  542. -define KernelPackage/rtl8192c-common
  543. - $(call KernelPackage/mac80211/Default)
  544. - TITLE:=Realtek RTL8192CE/RTL8192CU common support module
  545. - DEPENDS+= +kmod-rtlwifi
  546. - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192c/rtl8192c-common.ko
  547. - HIDDEN:=1
  548. -endef
  549. + config B43_FW_5_10
  550. + bool "Firmware 508.1084 from driver 5.10.56.27"
  551. + help
  552. + Older firmware for BCM43xx devices.
  553. -define KernelPackage/rtl8192ce
  554. - $(call KernelPackage/mac80211/Default)
  555. - TITLE:=Realtek RTL8192CE/RTL8188CE support
  556. - DEPENDS+= +kmod-rtlwifi-pci +kmod-rtl8192c-common
  557. - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192ce/rtl8192ce.ko
  558. - AUTOLOAD:=$(call AutoProbe,rtl8192ce)
  559. -endef
  560. + If unsure, select the "stable" firmware.
  561. -define KernelPackage/rtl8192ce/install
  562. - $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  563. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cfw.bin $(1)/lib/firmware/rtlwifi
  564. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cfwU.bin $(1)/lib/firmware/rtlwifi
  565. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cfwU_B.bin $(1)/lib/firmware/rtlwifi
  566. -endef
  567. + config B43_FW_5_100_138
  568. + bool "Firmware 666.2 from driver 5.100.138 (stable)"
  569. + help
  570. + The currently default firmware for BCM43xx devices.
  571. -define KernelPackage/rtl8192se
  572. - $(call KernelPackage/mac80211/Default)
  573. - TITLE:=Realtek RTL8192SE/RTL8191SE support
  574. - DEPENDS+= +kmod-rtlwifi-pci
  575. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192se/rtl8192se.ko
  576. - AUTOLOAD:=$(call AutoProbe,rtl8192se)
  577. -endef
  578. + This firmware currently gets most of the testing and is needed for some N-PHY devices.
  579. -define KernelPackage/rtl8192se/install
  580. - $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  581. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192sefw.bin $(1)/lib/firmware/rtlwifi
  582. -endef
  583. + If unsure, select the this firmware.
  584. -define KernelPackage/rtl8192de
  585. - $(call KernelPackage/mac80211/Default)
  586. - TITLE:=Realtek RTL8192DE/RTL8188DE support
  587. - DEPENDS+= +kmod-rtlwifi-pci
  588. - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192de/rtl8192de.ko
  589. - AUTOLOAD:=$(call AutoProbe,rtl8192de)
  590. -endef
  591. + config B43_FW_6_30
  592. + bool "Firmware 784.2 from driver 6.30.163.46 (experimental)"
  593. + help
  594. + Newer experimental firmware for BCM43xx devices.
  595. -define KernelPackage/rtl8192de/install
  596. - $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  597. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192defw.bin $(1)/lib/firmware/rtlwifi
  598. -endef
  599. + This firmware is mostly untested.
  600. -define KernelPackage/rtl8192cu
  601. - $(call KernelPackage/mac80211/Default)
  602. - TITLE:=Realtek RTL8192CU/RTL8188CU support
  603. - DEPENDS+= +kmod-rtlwifi-usb +kmod-rtl8192c-common
  604. - FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192cu/rtl8192cu.ko
  605. - AUTOLOAD:=$(call AutoProbe,rtl8192cu)
  606. -endef
  607. + If unsure, select the "stable" firmware.
  608. -define KernelPackage/rtl8192cu/install
  609. - $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  610. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw.bin $(1)/lib/firmware/rtlwifi
  611. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw_A.bin $(1)/lib/firmware/rtlwifi
  612. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw_B.bin $(1)/lib/firmware/rtlwifi
  613. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw_TMSC.bin $(1)/lib/firmware/rtlwifi
  614. -endef
  615. + config B43_OPENFIRMWARE
  616. + bool "Open FirmWare for WiFi networks"
  617. + help
  618. + Opensource firmware for BCM43xx devices.
  619. -ZD1211FW_NAME:=zd1211-firmware
  620. -ZD1211FW_VERSION:=1.4
  621. -define Download/zd1211rw
  622. - FILE:=$(ZD1211FW_NAME)-$(ZD1211FW_VERSION).tar.bz2
  623. - URL:=@SF/zd1211/
  624. - MD5SUM:=19f28781d76569af8551c9d11294c870
  625. -endef
  626. -$(eval $(call Download,zd1211rw))
  627. + Do _not_ select this, unless you know what you are doing.
  628. + The Opensource firmware is not suitable for embedded devices, yet.
  629. + It does not support QoS, which is bad for AccessPoints.
  630. + It does not support hardware crypto acceleration, which is a showstopper
  631. + for embedded devices with low CPU resources.
  632. -define KernelPackage/zd1211rw
  633. - $(call KernelPackage/mac80211/Default)
  634. - TITLE:=Zydas ZD1211 support
  635. - DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-mac80211
  636. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/zd1211rw/zd1211rw.ko
  637. - AUTOLOAD:=$(call AutoProbe,zd1211rw)
  638. -endef
  639. + If unsure, select the "stable" firmware.
  640. -define KernelPackage/adm8211
  641. - $(call KernelPackage/mac80211/Default)
  642. - TITLE:=ADMTek 8211 support
  643. - DEPENDS+=@PCI_SUPPORT +kmod-mac80211 +kmod-eeprom-93cx6
  644. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/adm8211.ko
  645. - AUTOLOAD:=$(call AutoProbe,adm8211)
  646. -endef
  647. + endchoice
  648. +
  649. + config B43_FW_SQUASH
  650. + bool "Remove unnecessary firmware files"
  651. + depends on !B43_OPENFIRMWARE
  652. + default y
  653. + help
  654. + This options allows you to remove unnecessary b43 firmware files
  655. + from the final rootfs image. This can reduce the rootfs size by
  656. + up to 200k.
  657. +
  658. + If unsure, say Y.
  659. +
  660. + config B43_FW_SQUASH_COREREVS
  661. + string "Core revisions to include"
  662. + depends on B43_FW_SQUASH
  663. + default "5,6,7,8,9,10,11,13,15" if TARGET_brcm47xx_legacy
  664. + default "16,28,29,30" if TARGET_brcm47xx_mips74k
  665. + default "5,6,7,8,9,10,11,13,15,16,28,29,30"
  666. + help
  667. + This is a comma seperated list of core revision numbers.
  668. +
  669. + Example (keep files for rev5 only):
  670. + 5
  671. +
  672. + Example (keep files for rev5 and rev11):
  673. + 5,11
  674. +
  675. + config B43_FW_SQUASH_PHYTYPES
  676. + string "PHY types to include"
  677. + depends on B43_FW_SQUASH
  678. + default "G,N,LP" if TARGET_brcm47xx_legacy
  679. + default "N,HT" if TARGET_brcm47xx_mips74k
  680. + default "G,N,LP,HT"
  681. + help
  682. + This is a comma seperated list of PHY types:
  683. + A => A-PHY
  684. + AG => Dual A-PHY G-PHY
  685. + G => G-PHY
  686. + LP => LP-PHY
  687. + N => N-PHY
  688. + HT => HT-PHY
  689. + LCN => LCN-PHY
  690. + LCN40 => LCN40-PHY
  691. + AC => AC-PHY
  692. +
  693. + Example (keep files for G-PHY only):
  694. + G
  695. +
  696. + Example (keep files for G-PHY and N-PHY):
  697. + G,N
  698. +
  699. + choice
  700. + prompt "Supported buses"
  701. + default PACKAGE_B43_BUSES_BCMA_AND_SSB
  702. + help
  703. + This allows choosing buses that b43 should support.
  704. +
  705. + config PACKAGE_B43_BUSES_BCMA_AND_SSB
  706. + depends on !TARGET_brcm47xx_legacy && !TARGET_brcm47xx_mips74k && !TARGET_bcm53xx
  707. + bool "BCMA and SSB"
  708. +
  709. + config PACKAGE_B43_BUSES_BCMA
  710. + depends on !TARGET_brcm47xx_legacy
  711. + bool "BCMA only"
  712. +
  713. + config PACKAGE_B43_BUSES_SSB
  714. + depends on !TARGET_brcm47xx_mips74k && !TARGET_bcm53xx
  715. + bool "SSB only"
  716. +
  717. + endchoice
  718. +
  719. + config PACKAGE_B43_DEBUG
  720. + bool "Enable debug output and debugfs for b43"
  721. + default n
  722. + help
  723. + Enable additional debug output and runtime sanity checks for b43
  724. + and enables the debugfs interface.
  725. +
  726. + If unsure, say N.
  727. +
  728. + config PACKAGE_B43_PIO
  729. + bool "Enable support for PIO transfer mode"
  730. + default n
  731. + help
  732. + Enable support for using PIO instead of DMA. Unless you have DMA
  733. + transfer problems you don't need this.
  734. +
  735. + If unsure, say N.
  736. +
  737. + config PACKAGE_B43_PHY_G
  738. + bool "Enable support for G-PHYs"
  739. + default n if TARGET_brcm47xx_mips74k
  740. + default y
  741. + help
  742. + Enable support for G-PHY. This includes support for the following devices:
  743. + PCI: BCM4306, BCM4311, BCM4318
  744. + SoC: BCM5352E, BCM4712
  745. -define KernelPackage/ath/config
  746. - if PACKAGE_kmod-ath
  747. - config ATH_USER_REGD
  748. - bool "Force Atheros drivers to respect the user's regdomain settings"
  749. + If unsure, say Y.
  750. +
  751. + config PACKAGE_B43_PHY_N
  752. + bool "Enable support for N-PHYs"
  753. + default y
  754. help
  755. - Atheros' idea of regulatory handling is that the EEPROM of the card defines
  756. - the regulatory limits and the user is only allowed to restrict the settings
  757. - even further, even if the country allows frequencies or power levels that
  758. - are forbidden by the EEPROM settings.
  759. + Enable support for N-PHY. This includes support for the following devices:
  760. + PCI: BCM4321, BCM4322, BCM43222, BCM43224, BCM43225
  761. + SoC: BCM4716, BCM4717, BCM4718
  762. - Select this option if you want the driver to respect the user's decision about
  763. - regulatory settings.
  764. + Currently only 11g speed is available.
  765. - config PACKAGE_ATH_DEBUG
  766. - bool "Atheros wireless debugging"
  767. + If unsure, say Y.
  768. +
  769. + config PACKAGE_B43_PHY_LP
  770. + bool "Enable support for LP-PHYs"
  771. + default n if TARGET_brcm47xx_mips74k
  772. + default y
  773. help
  774. - Say Y, if you want to debug atheros wireless drivers.
  775. - Right now only ath9k makes use of this.
  776. + Enable support for LP-PHY. This includes support for the following devices:
  777. + PCI: BCM4312
  778. + SoC: BCM5354
  779. - config PACKAGE_ATH_DFS
  780. - bool "Enable DFS support"
  781. + If unsure, say Y.
  782. +
  783. + config PACKAGE_B43_PHY_HT
  784. + bool "Enable support for HT-PHYs"
  785. + default n if TARGET_brcm47xx_legacy
  786. default y
  787. help
  788. - Dynamic frequency selection (DFS) is required for most of the 5 GHz band
  789. - channels in Europe, US, and Japan.
  790. + Enable support for HT-PHY. This includes support for the following devices:
  791. + PCI: BCM4331
  792. - Select this option if you want to use such channels.
  793. + Currently only 11g speed is available.
  794. - endif
  795. -endef
  796. + If unsure, say Y.
  797. -define KernelPackage/ath
  798. - $(call KernelPackage/mac80211/Default)
  799. - TITLE:=Atheros common driver part
  800. - DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx||TARGET_ath25 +kmod-mac80211
  801. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath.ko
  802. - MENU:=1
  803. -endef
  804. + config PACKAGE_B43_PHY_LCN
  805. + bool "Enable support for LCN-PHYs"
  806. + depends on BROKEN
  807. + default n
  808. + help
  809. + Currently broken.
  810. -define KernelPackage/ath/description
  811. - This module contains some common parts needed by Atheros Wireless drivers.
  812. -endef
  813. + If unsure, say N.
  814. -define KernelPackage/ath5k
  815. - $(call KernelPackage/mac80211/Default)
  816. - TITLE:=Atheros 5xxx wireless cards support
  817. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath5k
  818. - DEPENDS+= @PCI_SUPPORT||@TARGET_ath25 +kmod-ath
  819. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath5k/ath5k.ko
  820. - AUTOLOAD:=$(call AutoProbe,ath5k)
  821. + endif
  822. endef
  823. -define KernelPackage/ath5k/description
  824. - This module adds support for wireless adapters based on
  825. - Atheros 5xxx chipset.
  826. +define KernelPackage/b43/description
  827. +Kernel module for Broadcom 43xx wireless support (mac80211 stack) new
  828. endef
  829. -define KernelPackage/ath9k-common
  830. +define KernelPackage/b43legacy
  831. $(call KernelPackage/mac80211/Default)
  832. - TITLE:=Atheros 802.11n wireless devices (common code for ath9k and ath9k_htc)
  833. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  834. - DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx +kmod-ath +@DRIVER_11N_SUPPORT +@KERNEL_RELAY
  835. - FILES:= \
  836. - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_common.ko \
  837. - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_hw.ko
  838. + TITLE:=Broadcom 43xx-legacy wireless support
  839. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/b43
  840. + KCONFIG:= \
  841. + CONFIG_HW_RANDOM=y
  842. + DEPENDS+= +kmod-mac80211 +!(TARGET_brcm47xx||TARGET_brcm63xx):kmod-ssb
  843. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/b43legacy/b43legacy.ko
  844. + AUTOLOAD:=$(call AutoProbe,b43legacy)
  845. + MENU:=1
  846. endef
  847. -define KernelPackage/ath9k
  848. - $(call KernelPackage/mac80211/Default)
  849. - TITLE:=Atheros 802.11n PCI wireless cards support
  850. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  851. - DEPENDS+= @PCI_SUPPORT||TARGET_ar71xx +kmod-ath9k-common
  852. - FILES:= \
  853. - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k.ko
  854. - AUTOLOAD:=$(call AutoProbe,ath9k)
  855. -endef
  856. +define KernelPackage/b43legacy/config
  857. + if PACKAGE_kmod-b43legacy
  858. -define KernelPackage/ath9k/description
  859. -This module adds support for wireless adapters based on
  860. -Atheros IEEE 802.11n AR5008 and AR9001 family of chipsets.
  861. -endef
  862. + config B43LEGACY_FW_SQUASH
  863. + bool "Remove unnecessary firmware files"
  864. + default y
  865. + help
  866. + This options allows you to remove unnecessary b43legacy firmware files
  867. + from the final rootfs image. This can reduce the rootfs size by
  868. + up to 50k.
  869. -define KernelPackage/ath9k/config
  870. + If unsure, say Y.
  871. - config ATH9K_SUPPORT_PCOEM
  872. - bool "Support chips used in PC OEM cards"
  873. - depends on PACKAGE_kmod-ath9k
  874. -
  875. -endef
  876. + config B43LEGACY_FW_SQUASH_COREREVS
  877. + string "Core revisions to include"
  878. + depends on B43LEGACY_FW_SQUASH
  879. + default "1,2,3,4"
  880. + help
  881. + This is a comma seperated list of core revision numbers.
  882. -define KernelPackage/ath9k-htc
  883. - $(call KernelPackage/mac80211/Default)
  884. - TITLE:=Atheros 802.11n USB device support
  885. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  886. - DEPENDS+= @USB_SUPPORT +kmod-ath9k-common +kmod-usb-core
  887. - FILES:= \
  888. - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_htc.ko
  889. - AUTOLOAD:=$(call AutoProbe,ath9k_htc)
  890. + Example (keep files for rev4 only):
  891. + 4
  892. +
  893. + Example (keep files for rev2 and rev4):
  894. + 2,4
  895. +
  896. + endif
  897. endef
  898. -define KernelPackage/ath9k-htc/description
  899. -This module adds support for wireless adapters based on
  900. -Atheros USB AR9271 and AR7010 family of chipsets.
  901. +define KernelPackage/b43legacy/description
  902. +Kernel module for Broadcom 43xx-legacy wireless support (mac80211 stack) new
  903. endef
  904. -define KernelPackage/ath10k
  905. +
  906. +define KernelPackage/brcmutil
  907. $(call KernelPackage/mac80211/Default)
  908. - TITLE:=Atheros 802.11ac wireless cards support
  909. - URL:=https://wireless.wiki.kernel.org/en/users/Drivers/ath10k
  910. - DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT
  911. - FILES:= \
  912. - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_core.ko \
  913. - $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_pci.ko
  914. - AUTOLOAD:=$(call AutoLoad,55,ath10k_core ath10k_pci)
  915. + TITLE:=Broadcom IEEE802.11n common driver parts
  916. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
  917. + DEPENDS+=@PCI_SUPPORT||USB_SUPPORT
  918. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/brcm80211/brcmutil/brcmutil.ko
  919. + AUTOLOAD:=$(call AutoProbe,brcmutil)
  920. + MENU:=1
  921. endef
  922. -define KernelPackage/ath10k/description
  923. -This module adds support for wireless adapters based on
  924. -Atheros IEEE 802.11ac family of chipsets. For now only
  925. -PCI is supported.
  926. +define KernelPackage/brcmutil/description
  927. + This module contains some common parts needed by Broadcom Wireless drivers brcmsmac and brcmfmac.
  928. endef
  929. -define KernelPackage/ath10k/config
  930. - if PACKAGE_kmod-ath10k
  931. -
  932. - config ATH10K_STA_FW
  933. - bool "Firmware optimized for STA operation"
  934. - default n
  935. - help
  936. - Use the ath10k firmware optimized for wireless client instead
  937. - of access point operation.
  938. +define KernelPackage/brcmutil/config
  939. + if PACKAGE_kmod-brcmutil
  940. - config ATH10K_API2_FW
  941. - bool "Firmware optimized for AP operation (v10.1 / API v2)"
  942. - default n
  943. - depends on !ATH10K_STA_FW
  944. + config PACKAGE_BRCM80211_DEBUG
  945. + bool "Broadcom wireless driver debugging"
  946. help
  947. - Use the ath10k firmware from the 10.1 SDK using API v2 optimized
  948. - for access point operation if the default firmware keeps crashing.
  949. + Say Y, if you want to debug brcmsmac and brcmfmac wireless driver.
  950. endif
  951. endef
  952. -define KernelPackage/carl9170
  953. - $(call KernelPackage/mac80211/Default)
  954. - TITLE:=Driver for Atheros AR9170 USB sticks
  955. - DEPENDS:=@USB_SUPPORT +kmod-mac80211 +kmod-ath +kmod-usb-core +kmod-input-core +@DRIVER_11N_SUPPORT
  956. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/carl9170/carl9170.ko
  957. - AUTOLOAD:=$(call AutoProbe,carl9170)
  958. +PKG_BRCMSMAC_FW_NAME:=broadcom-wl
  959. +PKG_BRCMSMAC_FW_VERSION:=5.100.138
  960. +PKG_BRCMSMAC_FW_OBJECT:=$(PKG_BRCMSMAC_FW_NAME)-$(PKG_BRCMSMAC_FW_VERSION)/linux/wl_apsta.o
  961. +PKG_BRCMSMAC_FW_SOURCE:=$(PKG_BRCMSMAC_FW_NAME)-$(PKG_BRCMSMAC_FW_VERSION).tar.bz2
  962. +PKG_BRCMSMAC_FW_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/
  963. +PKG_BRCMSMAC_FW_MD5SUM:=f4e357b09eaf5d8b1f1920cf3493a555
  964. +
  965. +define Download/brcmsmac
  966. + FILE:=$(PKG_BRCMSMAC_FW_SOURCE)
  967. + URL:=$(PKG_BRCMSMAC_FW_SOURCE_URL)
  968. + MD5SUM:=$(PKG_BRCMSMAC_FW_MD5SUM)
  969. endef
  970. +$(eval $(call Download,brcmsmac))
  971. -define KernelPackage/lib80211
  972. +define KernelPackage/brcmsmac
  973. $(call KernelPackage/mac80211/Default)
  974. - TITLE:=802.11 Networking stack
  975. - DEPENDS:=+kmod-cfg80211
  976. - FILES:= \
  977. - $(PKG_BUILD_DIR)/net/wireless/lib80211.ko \
  978. - $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_wep.ko \
  979. - $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_ccmp.ko \
  980. - $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_tkip.ko
  981. - AUTOLOAD:=$(call AutoProbe, \
  982. - lib80211 \
  983. - lib80211_crypt_wep \
  984. - lib80211_crypt_ccmp \
  985. - lib80211_crypt_tkip \
  986. - )
  987. + TITLE:=Broadcom IEEE802.11n PCIe SoftMAC WLAN driver
  988. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
  989. + DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT +!TARGET_brcm47xx:kmod-bcma +kmod-lib-cordic +kmod-lib-crc8 +kmod-brcmutil
  990. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/brcm80211/brcmsmac/brcmsmac.ko
  991. + AUTOLOAD:=$(call AutoProbe,brcmsmac)
  992. + MENU:=1
  993. endef
  994. -define KernelPackage/lib80211/description
  995. - Kernel modules for 802.11 Networking stack
  996. - Includes:
  997. - - lib80211
  998. - - lib80211_crypt_wep
  999. - - lib80211_crypt_tkip
  1000. - - lib80211_crytp_ccmp
  1001. +define KernelPackage/brcmsmac/description
  1002. + Kernel module for Broadcom IEEE802.11n PCIe Wireless cards
  1003. endef
  1004. -define KernelPackage/libertas-usb
  1005. - $(call KernelPackage/mac80211/Default)
  1006. - DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +kmod-usb-core +kmod-lib80211 +@DRIVER_WEXT_SUPPORT
  1007. - TITLE:=Marvell 88W8015 Wireless Driver
  1008. - FILES:= \
  1009. - $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/libertas.ko \
  1010. - $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/usb8xxx.ko
  1011. - AUTOLOAD:=$(call AutoProbe,libertas usb8xxx)
  1012. -endef
  1013. +define KernelPackage/brcmsmac/config
  1014. + if PACKAGE_kmod-brcmsmac
  1015. -define KernelPackage/libertas-sdio
  1016. - $(call KernelPackage/mac80211/Default)
  1017. - DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +kmod-mmc +@DRIVER_WEXT_SUPPORT @!TARGET_uml
  1018. - TITLE:=Marvell 88W8686 Wireless Driver
  1019. - FILES:= \
  1020. - $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/libertas.ko \
  1021. - $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/libertas_sdio.ko
  1022. - AUTOLOAD:=$(call AutoProbe,libertas libertas_sdio)
  1023. + config BRCMSMAC_USE_FW_FROM_WL
  1024. + bool "Use firmware extracted from broadcom proprietary driver"
  1025. + default y
  1026. + help
  1027. + Instead of using the official brcmsmac firmware a firmware
  1028. + version 666.2 extracted from the proprietary Broadcom driver
  1029. + is used. This is needed to get core rev 17 used in bcm4716
  1030. + to work.
  1031. +
  1032. + If unsure, say Y.
  1033. +
  1034. + endif
  1035. endef
  1036. -define KernelPackage/mac80211-hwsim
  1037. - $(call KernelPackage/mac80211/Default)
  1038. - TITLE:=mac80211 HW simulation device
  1039. - DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT
  1040. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mac80211_hwsim.ko
  1041. - AUTOLOAD:=$(call AutoProbe,mac80211_hwsim)
  1042. -endef
  1043. -define KernelPackage/net-libipw
  1044. +define KernelPackage/brcmfmac
  1045. $(call KernelPackage/mac80211/Default)
  1046. - TITLE:=libipw for ipw2100 and ipw2200
  1047. - DEPENDS:=@PCI_SUPPORT +kmod-crypto-core +kmod-crypto-arc4 +kmod-crypto-aes +kmod-crypto-michael-mic +kmod-lib80211 +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT @!BIG_ENDIAN
  1048. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ipw2x00/libipw.ko
  1049. - AUTOLOAD:=$(call AutoProbe,libipw)
  1050. + TITLE:=Broadcom IEEE802.11n USB FullMAC WLAN driver
  1051. + URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
  1052. + DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +@DRIVER_11N_SUPPORT +kmod-brcmutil +BRCMFMAC_SDIO:kmod-mmc +BRCMFMAC_USB:kmod-usb-core
  1053. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/brcm80211/brcmfmac/brcmfmac.ko
  1054. + AUTOLOAD:=$(call AutoProbe,brcmfmac)
  1055. endef
  1056. -define KernelPackage/net-libipw/description
  1057. - Hardware independent IEEE 802.11 networking stack for ipw2100 and ipw2200.
  1058. +define KernelPackage/brcmfmac/description
  1059. + Kernel module for Broadcom IEEE802.11n USB Wireless cards
  1060. endef
  1061. -IPW2100_NAME:=ipw2100-fw
  1062. -IPW2100_VERSION:=1.3
  1063. -
  1064. -define Download/net-ipw2100
  1065. - URL:=http://bughost.org/firmware/
  1066. - FILE:=$(IPW2100_NAME)-$(IPW2100_VERSION).tgz
  1067. - MD5SUM=46aa75bcda1a00efa841f9707bbbd113
  1068. -endef
  1069. -$(eval $(call Download,net-ipw2100))
  1070. +define KernelPackage/brcmfmac/config
  1071. + if PACKAGE_kmod-brcmfmac
  1072. -define KernelPackage/net-ipw2100
  1073. - $(call KernelPackage/mac80211/Default)
  1074. - TITLE:=Intel IPW2100 driver
  1075. - DEPENDS:=@PCI_SUPPORT +kmod-net-libipw
  1076. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ipw2x00/ipw2100.ko
  1077. - AUTOLOAD:=$(call AutoProbe,ipw2100)
  1078. -endef
  1079. + config BRCMFMAC_SDIO
  1080. + bool "Enable SDIO bus interface support"
  1081. + default n
  1082. + help
  1083. + Enable support for cards attached to an SDIO bus.
  1084. + Select this option only if you are sure that your
  1085. + board has a Broadcom wireless chip atacched to
  1086. + that bus.
  1087. -define KernelPackage/net-ipw2100/description
  1088. - Kernel support for Intel IPW2100
  1089. - Includes:
  1090. - - ipw2100
  1091. -endef
  1092. + config BRCMFMAC_USB
  1093. + bool "Enable USB bus interface support"
  1094. + depends on USB_SUPPORT
  1095. + default y
  1096. + help
  1097. + Supported USB connected chipsets:
  1098. + BCM43235, BCM43236, BCM43238 (all in revision 3 only)
  1099. + BCM43143, BCM43242, BCM43566, BCM43569
  1100. -IPW2200_NAME:=ipw2200-fw
  1101. -IPW2200_VERSION:=3.1
  1102. + config BRCMFMAC_PCIE
  1103. + bool "Enable PCIE bus interface support"
  1104. + depends on PCI_SUPPORT
  1105. + default y
  1106. + help
  1107. + Supported PCIe connected chipsets:
  1108. + BCM4354, BCM4356, BCM43567, BCM43570, BCM43602
  1109. -define Download/net-ipw2200
  1110. - URL:=http://bughost.org/firmware/
  1111. - FILE:=$(IPW2200_NAME)-$(IPW2200_VERSION).tgz
  1112. - MD5SUM=eaba788643c7cc7483dd67ace70f6e99
  1113. + endif
  1114. endef
  1115. -$(eval $(call Download,net-ipw2200))
  1116. -define KernelPackage/net-ipw2200
  1117. - $(call KernelPackage/mac80211/Default)
  1118. - TITLE:=Intel IPW2200 driver
  1119. - DEPENDS:=@PCI_SUPPORT +kmod-net-libipw
  1120. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ipw2x00/ipw2200.ko
  1121. - AUTOLOAD:=$(call AutoProbe,ipw2200)
  1122. -endef
  1123. -define KernelPackage/net-ipw2200/description
  1124. - Kernel support for Intel IPW2200
  1125. - Includes:
  1126. - - ipw2200
  1127. +define KernelPackage/carl9170
  1128. + $(call KernelPackage/mac80211/Default)
  1129. + TITLE:=Driver for Atheros AR9170 USB sticks
  1130. + DEPENDS:=@USB_SUPPORT +kmod-mac80211 +kmod-ath +kmod-usb-core +kmod-input-core +@DRIVER_11N_SUPPORT
  1131. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/carl9170/carl9170.ko
  1132. + AUTOLOAD:=$(call AutoProbe,carl9170)
  1133. endef
  1134. -define KernelPackage/net-hermes
  1135. +define KernelPackage/hermes
  1136. $(call KernelPackage/mac80211/Default)
  1137. TITLE:=Hermes 802.11b chipset support
  1138. - DEPENDS:=@PCI_SUPPORT||PCMCIA_SUPPORT +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT
  1139. + DEPENDS:=@PCI_SUPPORT||PCMCIA_SUPPORT +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT +kmod-crypto-michael-mic
  1140. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/orinoco/orinoco.ko
  1141. AUTOLOAD:=$(call AutoProbe,orinoco)
  1142. endef
  1143. -define KernelPackage/net-hermes/description
  1144. +define KernelPackage/hermes/description
  1145. Kernel support for Hermes 802.11b chipsets
  1146. endef
  1147. -define KernelPackage/net-hermes-pci
  1148. +define KernelPackage/hermes-pci
  1149. $(call KernelPackage/mac80211/Default)
  1150. TITLE:=Intersil Prism 2.5 PCI support
  1151. - DEPENDS:=@PCI_SUPPORT +kmod-net-hermes
  1152. + DEPENDS:=@PCI_SUPPORT +kmod-hermes
  1153. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/orinoco/orinoco_pci.ko
  1154. AUTOLOAD:=$(call AutoProbe,orinoco_pci)
  1155. endef
  1156. -define KernelPackage/net-hermes-pci/description
  1157. +define KernelPackage/hermes-pci/description
  1158. Kernel modules for Intersil Prism 2.5 PCI support
  1159. endef
  1160. -define KernelPackage/net-hermes-plx
  1161. +define KernelPackage/hermes-plx
  1162. $(call KernelPackage/mac80211/Default)
  1163. TITLE:=PLX9052 based PCI adaptor
  1164. - DEPENDS:=@PCI_SUPPORT +kmod-net-hermes
  1165. + DEPENDS:=@PCI_SUPPORT +kmod-hermes
  1166. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/orinoco/orinoco_plx.ko
  1167. AUTOLOAD:=$(call AutoProbe,orinoco_plx)
  1168. endef
  1169. -define KernelPackage/net-hermes-plx/description
  1170. +define KernelPackage/hermes-plx/description
  1171. Kernel modules for Hermes in PLX9052 based PCI adaptors
  1172. endef
  1173. -define KernelPackage/net-hermes-pcmcia
  1174. +define KernelPackage/hermes-pcmcia
  1175. $(call KernelPackage/mac80211/Default)
  1176. TITLE:=Hermes based PCMCIA adaptors
  1177. - DEPENDS:=@PCMCIA_SUPPORT +kmod-net-hermes @BROKEN
  1178. + DEPENDS:=@PCMCIA_SUPPORT +kmod-hermes @BROKEN
  1179. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/orinoco/orinoco_cs.ko
  1180. AUTOLOAD:=$(call AutoProbe,orinoco_cs)
  1181. endef
  1182. -define KernelPackage/net-hermes-pcmcia/description
  1183. +define KernelPackage/hermes-pcmcia/description
  1184. Kernel modules for Hermes based PCMCIA adaptors
  1185. endef
  1186. -define KernelPackage/iwlagn
  1187. +
  1188. +define KernelPackage/iwlwifi
  1189. $(call KernelPackage/mac80211/Default)
  1190. DEPENDS:= +kmod-mac80211 @PCI_SUPPORT +@DRIVER_11N_SUPPORT
  1191. TITLE:=Intel AGN Wireless support
  1192. FILES:= \
  1193. $(PKG_BUILD_DIR)/drivers/net/wireless/iwlwifi/iwlwifi.ko \
  1194. - $(PKG_BUILD_DIR)/drivers/net/wireless/iwlwifi/dvm/iwldvm.ko
  1195. - AUTOLOAD:=$(call AutoProbe,iwlwifi iwldvm)
  1196. + $(PKG_BUILD_DIR)/drivers/net/wireless/iwlwifi/dvm/iwldvm.ko \
  1197. + $(PKG_BUILD_DIR)/drivers/net/wireless/iwlwifi/mvm/iwlmvm.ko
  1198. + AUTOLOAD:=$(call AutoProbe,iwlwifi iwldvm iwlmvm)
  1199. MENU:=1
  1200. endef
  1201. -define KernelPackage/iwlagn/description
  1202. - iwlagn kernel module for Intel 5000/5150/1000/6000/6050/6005/6030/100 support
  1203. -endef
  1204. +define KernelPackage/iwlwifi/description
  1205. + iwlwifi kernel module for
  1206. + Intel Wireless WiFi Link 6250AGN Adapter
  1207. + Intel 6000 Series Wi-Fi Adapters (6200AGN and 6300AGN)
  1208. + Intel WiFi Link 1000BGN
  1209. + Intel Wireless WiFi 5150AGN
  1210. + Intel Wireless WiFi 5100AGN, 5300AGN, and 5350AGN
  1211. + Intel 6005 Series Wi-Fi Adapters
  1212. + Intel 6030 Series Wi-Fi Adapters
  1213. + Intel Wireless WiFi Link 6150BGN 2 Adapter
  1214. + Intel 100 Series Wi-Fi Adapters (100BGN and 130BGN)
  1215. + Intel 2000 Series Wi-Fi Adapters
  1216. + Intel 7260 Wi-Fi Adapter
  1217. + Intel 3160 Wi-Fi Adapter
  1218. + Intel 7265 Wi-Fi Adapter
  1219. + Intel 8260 Wi-Fi Adapter
  1220. + Intel 3165 Wi-Fi Adapter
  1221. +endef
  1222. +
  1223. +define KernelPackage/iwlwifi/config
  1224. + if PACKAGE_kmod-iwlwifi
  1225. +
  1226. + config PACKAGE_IWLWIFI_DEBUG
  1227. + bool "Enable full debugging output in the iwlwifi driver"
  1228. + default n
  1229. + help
  1230. + This option will enable debug tracing output for the iwlwifi drivers
  1231. -define KernelPackage/iwlagn/config
  1232. - if PACKAGE_kmod-iwlagn
  1233. + This will result in the kernel module being ~100k larger. You can
  1234. + control which debug output is sent to the kernel log by setting the
  1235. + value in
  1236. - config IWL5000_FW
  1237. - bool "Intel 5000 Firmware"
  1238. - default y
  1239. + /sys/module/iwlwifi/parameters/debug
  1240. +
  1241. + This entry will only exist if this option is enabled.
  1242. +
  1243. + To set a value, simply echo an 8-byte hex value to the same file:
  1244. +
  1245. + % echo 0x43fff > /sys/module/iwlwifi/parameters/debug
  1246. +
  1247. + You can find the list of debug mask values in:
  1248. + drivers/net/wireless/iwlwifi/iwl-debug.h
  1249. +
  1250. + If this is your first time using this driver, you should say Y here
  1251. + as the debug information can assist others in helping you resolve
  1252. + any problems you may encounter.
  1253. +
  1254. + config PACKAGE_IWLWIFI_DEBUGFS
  1255. + bool "iwlwifi debugfs support"
  1256. + depends on PACKAGE_MAC80211_DEBUGFS
  1257. + default n
  1258. help
  1259. - Download and install firmware for:
  1260. - Intel Wireless WiFi 5100AGN, 5300AGN, and 5350AGN
  1261. + Enable creation of debugfs files for the iwlwifi drivers. This
  1262. + is a low-impact option that allows getting insight into the
  1263. + driver's state at runtime.
  1264. - config IWL5150_FW
  1265. - bool "Intel 5150 Firmware"
  1266. + config IWL100_FW
  1267. + bool "Intel 100 Firmware"
  1268. default y
  1269. help
  1270. Download and install firmware for:
  1271. - Intel Wireless WiFi 5150AGN
  1272. + Intel Centrino Wireless-N 100
  1273. config IWL1000_FW
  1274. bool "Intel 1000 Firmware"
  1275. @@ -852,89 +910,104 @@ define KernelPackage/iwlagn/config
  1276. Download and install firmware for:
  1277. Intel Centrino Wireless-N 1000
  1278. - config IWL6000_FW
  1279. - bool "Intel 6000 Firmware"
  1280. + config IWL105_FW
  1281. + bool "Intel 105 Firmware"
  1282. default y
  1283. help
  1284. Download and install firmware for:
  1285. - Intel Centrino Ultimate-N 6300 and Advanced-N 6200
  1286. + Intel Centrino Wireless-N 105
  1287. - config IWL6050_FW
  1288. - bool "Intel 6050 Firmware"
  1289. + config IWL135_FW
  1290. + bool "Intel 135 Firmware"
  1291. default y
  1292. help
  1293. Download and install firmware for:
  1294. - Intel Centrino Advanced-N + WiMAX 6250 and Wireless-N + WiMAX 6150
  1295. + Intel Centrino Wireless-N 135
  1296. - config IWL6005_FW
  1297. - bool "Intel 6005 Firmware"
  1298. + config IWL2000_FW
  1299. + bool "Intel 2000 Firmware"
  1300. default y
  1301. help
  1302. Download and install firmware for:
  1303. - Intel Centrino Advanced-N 6205
  1304. + Intel Centrino Wireless-N 2200
  1305. - config IWL6030_FW
  1306. - bool "Intel 6030 Firmware"
  1307. + config IWL2030_FW
  1308. + bool "Intel 2030 Firmware"
  1309. default y
  1310. help
  1311. Download and install firmware for:
  1312. - Intel Centrino Advanced-N 6230, Wireless-N 1030, Wireless-N 130 and Advanced-N 6235
  1313. + Intel Centrino Wireless-N 2230
  1314. - config IWL7260_FW
  1315. - bool "Intel 7260 Firmware"
  1316. + config IWL3160_FW
  1317. + bool "Intel 3160 Firmware"
  1318. default y
  1319. help
  1320. Download and install firmware for:
  1321. - Intel Dual Band Wireless-N 7260 and Intel Dual Band Wireless-AC 7260
  1322. + Intel Wireless WiFi 3160
  1323. - config IWL7265_FW
  1324. - bool "Intel 7265 Firmware"
  1325. + config IWL5000_FW
  1326. + bool "Intel 5000 Firmware"
  1327. default y
  1328. help
  1329. Download and install firmware for:
  1330. - Intel Wireless 7265
  1331. + Intel Wireless WiFi 5100AGN, 5300AGN, and 5350AGN
  1332. - config IWL100_FW
  1333. - bool "Intel 100 Firmware"
  1334. + config IWL5150_FW
  1335. + bool "Intel 5150 Firmware"
  1336. default y
  1337. help
  1338. Download and install firmware for:
  1339. - Intel Centrino Wireless-N 100
  1340. + Intel Wireless WiFi 5150AGN
  1341. - config IWL2000_FW
  1342. - bool "Intel 2000 Firmware"
  1343. + config IWL6000_FW
  1344. + bool "Intel 6000 Firmware"
  1345. default y
  1346. help
  1347. Download and install firmware for:
  1348. - Intel Centrino Wireless-N 2200
  1349. + Intel Centrino Ultimate-N 6300 and Advanced-N 6200
  1350. - config IWL2030_FW
  1351. - bool "Intel 2030 Firmware"
  1352. + config IWL6005_FW
  1353. + bool "Intel 6005 Firmware"
  1354. default y
  1355. help
  1356. Download and install firmware for:
  1357. - Intel Centrino Wireless-N 2230
  1358. + Intel Centrino Advanced-N 6205
  1359. - config IWL105_FW
  1360. - bool "Intel 105 Firmware"
  1361. + config IWL6030_FW
  1362. + bool "Intel 6030 Firmware"
  1363. default y
  1364. help
  1365. Download and install firmware for:
  1366. - Intel Centrino Wireless-N 105
  1367. + Intel Centrino Advanced-N 6230, Wireless-N 1030, Wireless-N 130 and Advanced-N 6235
  1368. - config IWL135_FW
  1369. - bool "Intel 135 Firmware"
  1370. + config IWL6050_FW
  1371. + bool "Intel 6050 Firmware"
  1372. default y
  1373. help
  1374. Download and install firmware for:
  1375. - Intel Centrino Wireless-N 135
  1376. + Intel Centrino Advanced-N + WiMAX 6250 and Wireless-N + WiMAX 6150
  1377. - config IWL3160_FW
  1378. - bool "Intel 3160 Firmware"
  1379. + config IWL7260_FW
  1380. + bool "Intel 7260 Firmware"
  1381. + default y
  1382. + help
  1383. + Download and install firmware for:
  1384. + Intel Dual Band Wireless-N 7260 and Intel Dual Band Wireless-AC 7260
  1385. +
  1386. + config IWL7265_FW
  1387. + bool "Intel 7265 Firmware"
  1388. + default y
  1389. + help
  1390. + Download and install firmware for:
  1391. + Intel Wireless 7265, 7265D, 3165
  1392. +
  1393. + config IWL8000_FW
  1394. + bool "Intel 8000 Series Firmware"
  1395. default y
  1396. help
  1397. Download and install firmware for:
  1398. - Intel Wireless 3160
  1399. + Intel Wireless Series 8260, 4165
  1400. +
  1401. endif
  1402. endef
  1403. @@ -953,578 +1026,587 @@ endef
  1404. define KernelPackage/iwl3945
  1405. $(call KernelPackage/mac80211/Default)
  1406. DEPENDS:= +kmod-mac80211 +kmod-iwl-legacy
  1407. - TITLE:=Intel iwl3945 Wireless support
  1408. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/iwlegacy/iwl3945.ko
  1409. - AUTOLOAD:=$(call AutoProbe,iwl3945)
  1410. -endef
  1411. -
  1412. -define KernelPackage/iwl3945/description
  1413. - iwl3945 kernel module for Intel 3945 support
  1414. -endef
  1415. -
  1416. -define KernelPackage/iwl4965
  1417. - $(call KernelPackage/mac80211/Default)
  1418. - DEPENDS:= +kmod-mac80211 +kmod-iwl-legacy +@DRIVER_11N_SUPPORT
  1419. - TITLE:=Intel iwl4965 Wireless support
  1420. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/iwlegacy/iwl4965.ko
  1421. - AUTOLOAD:=$(call AutoProbe,iwl4965)
  1422. -endef
  1423. -
  1424. -define KernelPackage/iwl4965/description
  1425. - iwl4965 kernel module for Intel 4965 support
  1426. -endef
  1427. -
  1428. -
  1429. -define KernelPackage/mwl8k
  1430. - $(call KernelPackage/mac80211/Default)
  1431. - TITLE:=Driver for Marvell TOPDOG 802.11 Wireless cards
  1432. - URL:=http://wireless.kernel.org/en/users/Drivers/mwl8k
  1433. - DEPENDS+= @PCI_SUPPORT +kmod-mac80211 +@DRIVER_11N_SUPPORT
  1434. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mwl8k.ko
  1435. - AUTOLOAD:=$(call AutoProbe,mwl8k)
  1436. -endef
  1437. -
  1438. -define KernelPackage/mwl8k/description
  1439. - Kernel modules for Marvell TOPDOG 802.11 Wireless cards
  1440. -endef
  1441. -
  1442. -
  1443. -define KernelPackage/mwifiex-pcie
  1444. - $(call KernelPackage/mac80211/Default)
  1445. - TITLE:=Driver for Marvell 802.11n/802.11ac PCIe Wireless cards
  1446. - URL:=http://wireless.kernel.org/en/users/Drivers/mwifiex
  1447. - DEPENDS+= @PCI_SUPPORT +kmod-mac80211 +@DRIVER_11N_SUPPORT
  1448. - FILES:= \
  1449. - $(PKG_BUILD_DIR)/drivers/net/wireless/mwifiex/mwifiex.ko \
  1450. - $(PKG_BUILD_DIR)/drivers/net/wireless/mwifiex/mwifiex_pcie.ko
  1451. - AUTOLOAD:=$(call AutoProbe,mwifiex_pcie)
  1452. -endef
  1453. -
  1454. -define KernelPackage/mwifiex-pcie/description
  1455. - Kernel modules for Marvell 802.11n/802.11ac PCIe Wireless cards
  1456. -endef
  1457. -
  1458. -
  1459. -define KernelPackage/wlcore
  1460. - $(call KernelPackage/mac80211/Default)
  1461. - TITLE:=TI common driver part
  1462. - DEPENDS+= @TARGET_omap +kmod-mac80211 +@DRIVER_11N_SUPPORT
  1463. - FILES:= \
  1464. - $(PKG_BUILD_DIR)/drivers/net/wireless/ti/wlcore/wlcore.ko \
  1465. - $(PKG_BUILD_DIR)/drivers/net/wireless/ti/wlcore/wlcore_sdio.ko
  1466. - AUTOLOAD:=$(call AutoProbe,wlcore wlcore_sdio)
  1467. -endef
  1468. -
  1469. -define KernelPackage/wlcore/description
  1470. - This module contains some common parts needed by TI Wireless drivers.
  1471. -endef
  1472. -
  1473. -define KernelPackage/wl12xx
  1474. - $(call KernelPackage/mac80211/Default)
  1475. - TITLE:=Driver for TI WL12xx
  1476. - URL:=http://wireless.kernel.org/en/users/Drivers/wl12xx
  1477. - DEPENDS+= +kmod-wlcore
  1478. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ti/wl12xx/wl12xx.ko
  1479. - AUTOLOAD:=$(call AutoProbe,wl12xx)
  1480. + TITLE:=Intel iwl3945 Wireless support
  1481. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/iwlegacy/iwl3945.ko
  1482. + AUTOLOAD:=$(call AutoProbe,iwl3945)
  1483. endef
  1484. -define KernelPackage/wl12xx/description
  1485. - Kernel modules for TI WL12xx
  1486. +define KernelPackage/iwl3945/description
  1487. + iwl3945 kernel module for Intel 3945 support
  1488. endef
  1489. -define KernelPackage/wl18xx
  1490. +define KernelPackage/iwl4965
  1491. $(call KernelPackage/mac80211/Default)
  1492. - TITLE:=Driver for TI WL18xx
  1493. - URL:=http://wireless.kernel.org/en/users/Drivers/wl18xx
  1494. - DEPENDS+= +kmod-wlcore
  1495. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ti/wl18xx/wl18xx.ko
  1496. - AUTOLOAD:=$(call AutoProbe,wl18xx)
  1497. + DEPENDS:= +kmod-mac80211 +kmod-iwl-legacy +@DRIVER_11N_SUPPORT
  1498. + TITLE:=Intel iwl4965 Wireless support
  1499. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/iwlegacy/iwl4965.ko
  1500. + AUTOLOAD:=$(call AutoProbe,iwl4965)
  1501. endef
  1502. -define KernelPackage/wl18xx/description
  1503. - Kernel modules for TI WL18xx
  1504. +define KernelPackage/iwl4965/description
  1505. + iwl4965 kernel module for Intel 4965 support
  1506. endef
  1507. -#Broadcom firmware
  1508. -ifneq ($(CONFIG_B43_FW_6_30),)
  1509. - PKG_B43_FWV4_NAME:=broadcom-wl
  1510. - PKG_B43_FWV4_VERSION:=6.30.163.46
  1511. - PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).wl_apsta.o
  1512. - PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  1513. - PKG_B43_FWV4_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/
  1514. - PKG_B43_FWV4_MD5SUM:=6fe97e9368d25342a1ab943d3cf3496d
  1515. -else
  1516. -ifneq ($(CONFIG_B43_FW_5_10),)
  1517. - PKG_B43_FWV4_NAME:=broadcom-wl
  1518. - PKG_B43_FWV4_VERSION:=5.10.56.27.3
  1519. - PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/driver/wl_apsta/wl_prebuilt.o
  1520. - PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)_mipsel.tar.bz2
  1521. - PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
  1522. - PKG_B43_FWV4_MD5SUM:=3363e3a6b3d9d73c49dea870c7834eac
  1523. -else
  1524. -ifneq ($(CONFIG_B43_FW_4_178),)
  1525. - PKG_B43_FWV4_NAME:=broadcom-wl
  1526. - PKG_B43_FWV4_VERSION:=4.178.10.4
  1527. - PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/linux/wl_apsta.o
  1528. - PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  1529. - PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
  1530. - PKG_B43_FWV4_MD5SUM:=14477e8cbbb91b11896affac9b219fdb
  1531. -else
  1532. -ifneq ($(CONFIG_B43_FW_5_100_138),)
  1533. - PKG_B43_FWV4_NAME:=broadcom-wl
  1534. - PKG_B43_FWV4_VERSION:=5.100.138
  1535. - PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/linux/wl_apsta.o
  1536. - PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  1537. - PKG_B43_FWV4_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/
  1538. - PKG_B43_FWV4_MD5SUM:=f4e357b09eaf5d8b1f1920cf3493a555
  1539. -else
  1540. - PKG_B43_FWV4_NAME:=broadcom-wl
  1541. - PKG_B43_FWV4_VERSION:=4.150.10.5
  1542. - PKG_B43_FWV4_OBJECT:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION)/driver/wl_apsta_mimo.o
  1543. - PKG_B43_FWV4_SOURCE:=$(PKG_B43_FWV4_NAME)-$(PKG_B43_FWV4_VERSION).tar.bz2
  1544. - PKG_B43_FWV4_SOURCE_URL:=http://mirror2.openwrt.org/sources/
  1545. - PKG_B43_FWV4_MD5SUM:=0c6ba9687114c6b598e8019e262d9a60
  1546. -endif
  1547. -endif
  1548. -endif
  1549. -endif
  1550. -ifneq ($(CONFIG_B43_OPENFIRMWARE),)
  1551. - PKG_B43_FWV4_NAME:=broadcom-wl
  1552. - PKG_B43_FWV4_VERSION:=5.2
  1553. - PKG_B43_FWV4_OBJECT:=openfwwf-$(PKG_B43_FWV4_VERSION)
  1554. - PKG_B43_FWV4_SOURCE:=openfwwf-$(PKG_B43_FWV4_VERSION).tar.gz
  1555. - PKG_B43_FWV4_SOURCE_URL:=http://www.ing.unibs.it/openfwwf/firmware/
  1556. - PKG_B43_FWV4_MD5SUM:=e045a135453274e439ae183f8498b0fa
  1557. -endif
  1558. -
  1559. -
  1560. -PKG_B43_FWV3_NAME:=wl_apsta
  1561. -PKG_B43_FWV3_VERSION:=3.130.20.0
  1562. -PKG_B43_FWV3_SOURCE:=$(PKG_B43_FWV3_NAME)-$(PKG_B43_FWV3_VERSION).o
  1563. -PKG_B43_FWV3_SOURCE_URL:=http://downloads.openwrt.org/sources/
  1564. -PKG_B43_FWV3_MD5SUM:=e08665c5c5b66beb9c3b2dd54aa80cb3
  1565. -
  1566. -define Download/b43
  1567. - FILE:=$(PKG_B43_FWV4_SOURCE)
  1568. - URL:=$(PKG_B43_FWV4_SOURCE_URL)
  1569. - MD5SUM:=$(PKG_B43_FWV4_MD5SUM)
  1570. +define KernelPackage/lib80211
  1571. + $(call KernelPackage/mac80211/Default)
  1572. + TITLE:=802.11 Networking stack
  1573. + DEPENDS:=+kmod-cfg80211
  1574. + FILES:= \
  1575. + $(PKG_BUILD_DIR)/net/wireless/lib80211.ko \
  1576. + $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_wep.ko \
  1577. + $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_ccmp.ko \
  1578. + $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_tkip.ko
  1579. + AUTOLOAD:=$(call AutoProbe, \
  1580. + lib80211 \
  1581. + lib80211_crypt_wep \
  1582. + lib80211_crypt_ccmp \
  1583. + lib80211_crypt_tkip \
  1584. + )
  1585. endef
  1586. -$(eval $(call Download,b43))
  1587. -define Download/b43legacy
  1588. - FILE:=$(PKG_B43_FWV3_SOURCE)
  1589. - URL:=$(PKG_B43_FWV3_SOURCE_URL)
  1590. - MD5SUM:=$(PKG_B43_FWV3_MD5SUM)
  1591. +define KernelPackage/lib80211/description
  1592. + Kernel modules for 802.11 Networking stack
  1593. + Includes:
  1594. + - lib80211
  1595. + - lib80211_crypt_wep
  1596. + - lib80211_crypt_tkip
  1597. + - lib80211_crytp_ccmp
  1598. endef
  1599. -$(eval $(call Download,b43legacy))
  1600. -define KernelPackage/b43
  1601. +define KernelPackage/libipw
  1602. $(call KernelPackage/mac80211/Default)
  1603. - TITLE:=Broadcom 43xx wireless support
  1604. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/b43
  1605. - KCONFIG:= \
  1606. - CONFIG_HW_RANDOM=y
  1607. - # Depend on PCI_SUPPORT to make sure we can select kmod-bcma or kmod-ssb
  1608. - DEPENDS += \
  1609. - @PCI_SUPPORT +kmod-mac80211 \
  1610. - $(if $(CONFIG_PACKAGE_B43_USE_SSB),+kmod-ssb) \
  1611. - $(if $(CONFIG_PACKAGE_B43_USE_BCMA),+kmod-bcma)
  1612. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/b43/b43.ko
  1613. - AUTOLOAD:=$(call AutoProbe,b43)
  1614. - MENU:=1
  1615. + TITLE:=libipw for ipw2100 and ipw2200
  1616. + DEPENDS:=@PCI_SUPPORT +kmod-crypto-michael-mic +kmod-lib80211 +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT @!BIG_ENDIAN
  1617. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ipw2x00/libipw.ko
  1618. + AUTOLOAD:=$(call AutoProbe,libipw)
  1619. endef
  1620. -define KernelPackage/b43/config
  1621. -
  1622. -config PACKAGE_B43_USE_SSB
  1623. - select PACKAGE_kmod-ssb
  1624. - tristate
  1625. - depends on !TARGET_brcm47xx && !TARGET_brcm63xx
  1626. - default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA_AND_SSB
  1627. - default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_SSB
  1628. +define KernelPackage/libipw/description
  1629. + Hardware independent IEEE 802.11 networking stack for ipw2100 and ipw2200.
  1630. +endef
  1631. -config PACKAGE_B43_USE_BCMA
  1632. - select PACKAGE_kmod-bcma
  1633. - tristate
  1634. - depends on !TARGET_brcm47xx && !TARGET_bcm53xx
  1635. - default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA_AND_SSB
  1636. - default PACKAGE_kmod-b43 if PACKAGE_B43_BUSES_BCMA
  1637. +IPW2100_NAME:=ipw2100-fw
  1638. +IPW2100_VERSION:=1.3
  1639. - if PACKAGE_kmod-b43
  1640. +define Download/ipw2100
  1641. + URL:=http://bughost.org/firmware/
  1642. + FILE:=$(IPW2100_NAME)-$(IPW2100_VERSION).tgz
  1643. + MD5SUM=46aa75bcda1a00efa841f9707bbbd113
  1644. +endef
  1645. +$(eval $(call Download,ipw2100))
  1646. - choice
  1647. - prompt "b43 firmware version"
  1648. - default B43_FW_5_100_138
  1649. - help
  1650. - This option allows you to select the version of the b43 firmware.
  1651. +define KernelPackage/ipw2100
  1652. + $(call KernelPackage/mac80211/Default)
  1653. + TITLE:=Intel IPW2100 driver
  1654. + DEPENDS:=@PCI_SUPPORT +kmod-libipw
  1655. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ipw2x00/ipw2100.ko
  1656. + AUTOLOAD:=$(call AutoProbe,ipw2100)
  1657. +endef
  1658. - config B43_FW_4_150
  1659. - bool "Firmware 410.2160 from driver 4.150.10.5 (old stable)"
  1660. - help
  1661. - Old stable firmware for BCM43xx devices.
  1662. +define KernelPackage/ipw2100/description
  1663. + Kernel support for Intel IPW2100
  1664. + Includes:
  1665. + - ipw2100
  1666. +endef
  1667. - If unsure, select this.
  1668. +IPW2200_NAME:=ipw2200-fw
  1669. +IPW2200_VERSION:=3.1
  1670. - config B43_FW_4_178
  1671. - bool "Firmware 478.104 from driver 4.178.10.4"
  1672. - help
  1673. - Older firmware for BCM43xx devices.
  1674. +define Download/ipw2200
  1675. + URL:=http://bughost.org/firmware/
  1676. + FILE:=$(IPW2200_NAME)-$(IPW2200_VERSION).tgz
  1677. + MD5SUM=eaba788643c7cc7483dd67ace70f6e99
  1678. +endef
  1679. +$(eval $(call Download,ipw2200))
  1680. - If unsure, select the "stable" firmware.
  1681. +define KernelPackage/ipw2200
  1682. + $(call KernelPackage/mac80211/Default)
  1683. + TITLE:=Intel IPW2200 driver
  1684. + DEPENDS:=@PCI_SUPPORT +kmod-libipw
  1685. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ipw2x00/ipw2200.ko
  1686. + AUTOLOAD:=$(call AutoProbe,ipw2200)
  1687. +endef
  1688. - config B43_FW_5_10
  1689. - bool "Firmware 508.1084 from driver 5.10.56.27"
  1690. - help
  1691. - Older firmware for BCM43xx devices.
  1692. +define KernelPackage/ipw2200/description
  1693. + Kernel support for Intel IPW2200
  1694. + Includes:
  1695. + - ipw2200
  1696. +endef
  1697. - If unsure, select the "stable" firmware.
  1698. - config B43_FW_5_100_138
  1699. - bool "Firmware 666.2 from driver 5.100.138 (stable)"
  1700. - help
  1701. - The currently default firmware for BCM43xx devices.
  1702. +define KernelPackage/libertas-usb
  1703. + $(call KernelPackage/mac80211/Default)
  1704. + DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +kmod-usb-core +kmod-lib80211 +@DRIVER_WEXT_SUPPORT
  1705. + TITLE:=Marvell 88W8015 Wireless Driver
  1706. + FILES:= \
  1707. + $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/libertas.ko \
  1708. + $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/usb8xxx.ko
  1709. + AUTOLOAD:=$(call AutoProbe,libertas usb8xxx)
  1710. +endef
  1711. - This firmware currently gets most of the testing and is needed for some N-PHY devices.
  1712. +define KernelPackage/libertas-sdio
  1713. + $(call KernelPackage/mac80211/Default)
  1714. + DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +kmod-mmc +@DRIVER_WEXT_SUPPORT @!TARGET_uml
  1715. + TITLE:=Marvell 88W8686 Wireless Driver
  1716. + FILES:= \
  1717. + $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/libertas.ko \
  1718. + $(PKG_BUILD_DIR)/drivers/net/wireless/libertas/libertas_sdio.ko
  1719. + AUTOLOAD:=$(call AutoProbe,libertas libertas_sdio)
  1720. +endef
  1721. - If unsure, select the this firmware.
  1722. +define KernelPackage/mac80211-hwsim
  1723. + $(call KernelPackage/mac80211/Default)
  1724. + TITLE:=mac80211 HW simulation device
  1725. + DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT
  1726. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mac80211_hwsim.ko
  1727. + AUTOLOAD:=$(call AutoProbe,mac80211_hwsim)
  1728. +endef
  1729. - config B43_FW_6_30
  1730. - bool "Firmware 784.2 from driver 6.30.163.46 (experimental)"
  1731. - help
  1732. - Newer experimental firmware for BCM43xx devices.
  1733. +PKG_MT7601U_FW_NAME:=DPO_MT7601U_LinuxSTA
  1734. +PKG_MT7601U_FW_VERSION:=3.0.0.4_20130913
  1735. +PKG_MT7601U_FW_MD5SUM:=5f440dccc8bc952745a191994fc34699
  1736. +PKG_MT7601U_FW_SOURCE:=$(PKG_MT7601U_FW_NAME)_$(PKG_MT7601U_FW_VERSION).tar.bz2
  1737. +PKG_MT7601U_FW_SOURCE_URL:=http://www.mediatek.com/AmazonS3/Downloads/linux/
  1738. +define Download/mt7601u-firmware
  1739. + FILE:=$(PKG_MT7601U_FW_SOURCE)
  1740. + URL:=$(PKG_MT7601U_FW_SOURCE_URL)
  1741. + MD5SUM:=$(PKG_MT7601U_FW_MD5SUM)
  1742. + SUBDIR:=$(PKG_MT7601U_FW_NAME)_$(PKG_MT7601U_FW_VERSION)
  1743. +endef
  1744. +$(eval $(call Download,mt7601u-firmware))
  1745. - This firmware is mostly untested.
  1746. +define KernelPackage/mt7601u
  1747. + $(call KernelPackage/mac80211/Default)
  1748. + TITLE:=MT7601U-based USB dongles Wireless Driver
  1749. + DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT @USB_SUPPORT +kmod-usb-core
  1750. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mediatek/mt7601u/mt7601u.ko
  1751. + AUTOLOAD:=$(call AutoProbe,mt7601)
  1752. +endef
  1753. - If unsure, select the "stable" firmware.
  1754. - config B43_OPENFIRMWARE
  1755. - bool "Open FirmWare for WiFi networks"
  1756. - help
  1757. - Opensource firmware for BCM43xx devices.
  1758. +define KernelPackage/mwl8k
  1759. + $(call KernelPackage/mac80211/Default)
  1760. + TITLE:=Driver for Marvell TOPDOG 802.11 Wireless cards
  1761. + URL:=http://wireless.kernel.org/en/users/Drivers/mwl8k
  1762. + DEPENDS+= @PCI_SUPPORT +kmod-mac80211 +@DRIVER_11N_SUPPORT
  1763. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mwl8k.ko
  1764. + AUTOLOAD:=$(call AutoProbe,mwl8k)
  1765. +endef
  1766. - Do _not_ select this, unless you know what you are doing.
  1767. - The Opensource firmware is not suitable for embedded devices, yet.
  1768. - It does not support QoS, which is bad for AccessPoints.
  1769. - It does not support hardware crypto acceleration, which is a showstopper
  1770. - for embedded devices with low CPU resources.
  1771. +define KernelPackage/mwl8k/description
  1772. + Kernel modules for Marvell TOPDOG 802.11 Wireless cards
  1773. +endef
  1774. - If unsure, select the "stable" firmware.
  1775. - endchoice
  1776. +define KernelPackage/mwifiex-pcie
  1777. + $(call KernelPackage/mac80211/Default)
  1778. + TITLE:=Driver for Marvell 802.11n/802.11ac PCIe Wireless cards
  1779. + URL:=http://wireless.kernel.org/en/users/Drivers/mwifiex
  1780. + DEPENDS+= @PCI_SUPPORT +kmod-mac80211 +@DRIVER_11N_SUPPORT
  1781. + FILES:= \
  1782. + $(PKG_BUILD_DIR)/drivers/net/wireless/mwifiex/mwifiex.ko \
  1783. + $(PKG_BUILD_DIR)/drivers/net/wireless/mwifiex/mwifiex_pcie.ko
  1784. + AUTOLOAD:=$(call AutoProbe,mwifiex_pcie)
  1785. +endef
  1786. - config B43_FW_SQUASH
  1787. - bool "Remove unnecessary firmware files"
  1788. - depends on !B43_OPENFIRMWARE
  1789. - default y
  1790. - help
  1791. - This options allows you to remove unnecessary b43 firmware files
  1792. - from the final rootfs image. This can reduce the rootfs size by
  1793. - up to 200k.
  1794. +define KernelPackage/mwifiex-pcie/description
  1795. + Kernel modules for Marvell 802.11n/802.11ac PCIe Wireless cards
  1796. +endef
  1797. - If unsure, say Y.
  1798. - config B43_FW_SQUASH_COREREVS
  1799. - string "Core revisions to include"
  1800. - depends on B43_FW_SQUASH
  1801. - default "5,6,7,8,9,10,11,13,15" if TARGET_brcm47xx_legacy
  1802. - default "16,28,29,30" if TARGET_brcm47xx_mips74k
  1803. - default "5,6,7,8,9,10,11,13,15,16,28,29,30"
  1804. - help
  1805. - This is a comma seperated list of core revision numbers.
  1806. +# Prism54 drivers
  1807. +P54PCIFW:=2.13.12.0.arm
  1808. +P54USBFW:=2.13.24.0.lm87.arm
  1809. +P54SPIFW:=2.13.0.0.a.13.14.arm
  1810. - Example (keep files for rev5 only):
  1811. - 5
  1812. +define Download/p54usb
  1813. + FILE:=$(P54USBFW)
  1814. + URL:=http://daemonizer.de/prism54/prism54-fw/fw-usb
  1815. + MD5SUM:=8e8ab005a4f8f0123bcdc51bc25b47f6
  1816. +endef
  1817. +$(eval $(call Download,p54usb))
  1818. - Example (keep files for rev5 and rev11):
  1819. - 5,11
  1820. +define Download/p54pci
  1821. + FILE:=$(P54PCIFW)
  1822. + URL:=http://daemonizer.de/prism54/prism54-fw/fw-softmac
  1823. + MD5SUM:=ff7536af2092b1c4b21315bd103ef4c4
  1824. +endef
  1825. +$(eval $(call Download,p54pci))
  1826. - config B43_FW_SQUASH_PHYTYPES
  1827. - string "PHY types to include"
  1828. - depends on B43_FW_SQUASH
  1829. - default "G,N,LP" if TARGET_brcm47xx_legacy
  1830. - default "N,HT" if TARGET_brcm47xx_mips74k
  1831. - default "G,N,LP,HT"
  1832. - help
  1833. - This is a comma seperated list of PHY types:
  1834. - A => A-PHY
  1835. - AG => Dual A-PHY G-PHY
  1836. - G => G-PHY
  1837. - LP => LP-PHY
  1838. - N => N-PHY
  1839. - HT => HT-PHY
  1840. - LCN => LCN-PHY
  1841. - LCN40 => LCN40-PHY
  1842. - AC => AC-PHY
  1843. +define Download/p54spi
  1844. + FILE:=$(P54SPIFW)
  1845. + URL:=http://daemonizer.de/prism54/prism54-fw/stlc4560
  1846. + MD5SUM:=42661f8ecbadd88012807493f596081d
  1847. +endef
  1848. +$(eval $(call Download,p54spi))
  1849. - Example (keep files for G-PHY only):
  1850. - G
  1851. +define KernelPackage/p54/Default
  1852. + $(call KernelPackage/mac80211/Default)
  1853. + TITLE:=Prism54 Drivers
  1854. +endef
  1855. - Example (keep files for G-PHY and N-PHY):
  1856. - G,N
  1857. +define KernelPackage/p54/description
  1858. + Kernel module for Prism54 chipsets (mac80211)
  1859. +endef
  1860. - choice
  1861. - prompt "Supported buses"
  1862. - default PACKAGE_B43_BUSES_BCMA_AND_SSB
  1863. - help
  1864. - This allows choosing buses that b43 should support.
  1865. +define KernelPackage/p54-common
  1866. + $(call KernelPackage/p54/Default)
  1867. + DEPENDS+= @PCI_SUPPORT||@USB_SUPPORT||@TARGET_omap24xx +kmod-mac80211 +kmod-lib-crc-ccitt
  1868. + TITLE+= (COMMON)
  1869. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54common.ko
  1870. +endef
  1871. - config PACKAGE_B43_BUSES_BCMA_AND_SSB
  1872. - depends on !TARGET_brcm47xx_legacy && !TARGET_brcm47xx_mips74k && !TARGET_bcm53xx
  1873. - bool "BCMA and SSB"
  1874. +define KernelPackage/p54-pci
  1875. + $(call KernelPackage/p54/Default)
  1876. + TITLE+= (PCI)
  1877. + DEPENDS+= @PCI_SUPPORT +kmod-p54-common
  1878. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54pci.ko
  1879. + AUTOLOAD:=$(call AutoProbe,p54pci)
  1880. +endef
  1881. - config PACKAGE_B43_BUSES_BCMA
  1882. - depends on !TARGET_brcm47xx_legacy
  1883. - bool "BCMA only"
  1884. +define KernelPackage/p54-usb
  1885. + $(call KernelPackage/p54/Default)
  1886. + TITLE+= (USB)
  1887. + DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-p54-common
  1888. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54usb.ko
  1889. + AUTOLOAD:=$(call AutoProbe,p54usb)
  1890. +endef
  1891. - config PACKAGE_B43_BUSES_SSB
  1892. - depends on !TARGET_brcm47xx_mips74k && !TARGET_bcm53xx
  1893. - bool "SSB only"
  1894. +define KernelPackage/p54-spi
  1895. + $(call KernelPackage/p54/Default)
  1896. + TITLE+= (SPI)
  1897. + DEPENDS+= @TARGET_omap24xx +kmod-p54-common
  1898. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/p54/p54spi.ko
  1899. + AUTOLOAD:=$(call AutoProbe,p54spi)
  1900. +endef
  1901. - endchoice
  1902. +define KernelPackage/rt2x00/Default
  1903. + $(call KernelPackage/mac80211/Default)
  1904. + TITLE:=Ralink Drivers for RT2x00 cards
  1905. +endef
  1906. - config PACKAGE_B43_DEBUG
  1907. - bool "Enable debug output and debugfs for b43"
  1908. - default n
  1909. - help
  1910. - Enable additional debug output and runtime sanity checks for b43
  1911. - and enables the debugfs interface.
  1912. +define KernelPackage/rt2x00-lib
  1913. +$(call KernelPackage/rt2x00/Default)
  1914. + DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-mac80211 +kmod-lib-crc-itu-t
  1915. + TITLE+= (LIB)
  1916. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00lib.ko
  1917. + MENU:=1
  1918. +endef
  1919. - If unsure, say N.
  1920. +define KernelPackage/rt2x00-lib/config
  1921. + if PACKAGE_kmod-rt2x00-lib
  1922. - config PACKAGE_B43_PIO
  1923. - bool "Enable support for PIO transfer mode"
  1924. - default n
  1925. + config PACKAGE_RT2X00_LIB_DEBUGFS
  1926. + bool "Enable rt2x00 debugfs support"
  1927. + depends on PACKAGE_MAC80211_DEBUGFS
  1928. help
  1929. - Enable support for using PIO instead of DMA. Unless you have DMA
  1930. - transfer problems you don't need this.
  1931. -
  1932. - If unsure, say N.
  1933. + Enable creation of debugfs files for the rt2x00 drivers.
  1934. + These debugfs files support both reading and writing of the
  1935. + most important register types of the rt2x00 hardware.
  1936. - config PACKAGE_B43_PHY_G
  1937. - bool "Enable support for G-PHYs"
  1938. - default n if TARGET_brcm47xx_mips74k
  1939. - default y
  1940. + config PACKAGE_RT2X00_DEBUG
  1941. + bool "Enable rt2x00 debug output"
  1942. help
  1943. - Enable support for G-PHY. This includes support for the following devices:
  1944. - PCI: BCM4306, BCM4311, BCM4318
  1945. - SoC: BCM5352E, BCM4712
  1946. + Enable debugging output for all rt2x00 modules
  1947. - If unsure, say Y.
  1948. + endif
  1949. +endef
  1950. - config PACKAGE_B43_PHY_N
  1951. - bool "Enable support for N-PHYs"
  1952. - default y
  1953. - help
  1954. - Enable support for N-PHY. This includes support for the following devices:
  1955. - PCI: BCM4321, BCM4322, BCM43222, BCM43224, BCM43225
  1956. - SoC: BCM4716, BCM4717, BCM4718
  1957. +define KernelPackage/rt2x00-mmio
  1958. +$(call KernelPackage/rt2x00/Default)
  1959. + DEPENDS+= @(PCI_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib +kmod-eeprom-93cx6
  1960. + HIDDEN:=1
  1961. + TITLE+= (MMIO)
  1962. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00mmio.ko
  1963. +endef
  1964. - Currently only 11g speed is available.
  1965. +define KernelPackage/rt2x00-pci
  1966. +$(call KernelPackage/rt2x00/Default)
  1967. + DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-mmio +kmod-rt2x00-lib
  1968. + HIDDEN:=1
  1969. + TITLE+= (PCI)
  1970. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00pci.ko
  1971. + AUTOLOAD:=$(call AutoProbe,rt2x00pci)
  1972. +endef
  1973. - If unsure, say Y.
  1974. +define KernelPackage/rt2x00-usb
  1975. +$(call KernelPackage/rt2x00/Default)
  1976. + DEPENDS+= @USB_SUPPORT +kmod-rt2x00-lib +kmod-usb-core
  1977. + HIDDEN:=1
  1978. + TITLE+= (USB)
  1979. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00usb.ko
  1980. + AUTOLOAD:=$(call AutoProbe,rt2x00usb)
  1981. +endef
  1982. - config PACKAGE_B43_PHY_LP
  1983. - bool "Enable support for LP-PHYs"
  1984. - default n if TARGET_brcm47xx_mips74k
  1985. - default y
  1986. - help
  1987. - Enable support for LP-PHY. This includes support for the following devices:
  1988. - PCI: BCM4312
  1989. - SoC: BCM5354
  1990. +define KernelPackage/rt2800-lib
  1991. +$(call KernelPackage/rt2x00/Default)
  1992. + DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib +kmod-lib-crc-ccitt +@DRIVER_11N_SUPPORT
  1993. + HIDDEN:=1
  1994. + TITLE+= (rt2800 LIB)
  1995. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800lib.ko
  1996. +endef
  1997. - If unsure, say Y.
  1998. +define KernelPackage/rt2400-pci
  1999. +$(call KernelPackage/rt2x00/Default)
  2000. + DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
  2001. + TITLE+= (RT2400 PCI)
  2002. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2400pci.ko
  2003. + AUTOLOAD:=$(call AutoProbe,rt2400pci)
  2004. +endef
  2005. - config PACKAGE_B43_PHY_HT
  2006. - bool "Enable support for HT-PHYs"
  2007. - default n if TARGET_brcm47xx_legacy
  2008. - default y
  2009. - help
  2010. - Enable support for HT-PHY. This includes support for the following devices:
  2011. - PCI: BCM4331
  2012. +define KernelPackage/rt2500-pci
  2013. +$(call KernelPackage/rt2x00/Default)
  2014. + DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
  2015. + TITLE+= (RT2500 PCI)
  2016. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2500pci.ko
  2017. + AUTOLOAD:=$(call AutoProbe,rt2500pci)
  2018. +endef
  2019. +
  2020. +define KernelPackage/rt2500-usb
  2021. +$(call KernelPackage/rt2x00/Default)
  2022. + DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb
  2023. + TITLE+= (RT2500 USB)
  2024. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2500usb.ko
  2025. + AUTOLOAD:=$(call AutoProbe,rt2500usb)
  2026. +endef
  2027. +
  2028. +define KernelPackage/rt2800-mmio
  2029. +$(call KernelPackage/rt2x00/Default)
  2030. + TITLE += (RT28xx/RT3xxx MMIO)
  2031. + DEPENDS += +kmod-rt2800-lib +kmod-rt2x00-mmio
  2032. + HIDDEN:=1
  2033. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800mmio.ko
  2034. +endef
  2035. - Currently only 11g speed is available.
  2036. +define KernelPackage/rt2800-soc
  2037. +$(call KernelPackage/rt2x00/Default)
  2038. + DEPENDS += @(TARGET_ramips_rt288x||TARGET_ramips_rt305x||TARGET_ramips_rt3883||TARGET_ramips_mt7620) +kmod-rt2800-mmio +kmod-rt2800-lib
  2039. + TITLE += (RT28xx/RT3xxx SoC)
  2040. + FILES := \
  2041. + $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00soc.ko \
  2042. + $(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800soc.ko
  2043. + AUTOLOAD:=$(call AutoProbe,rt2800soc)
  2044. +endef
  2045. - If unsure, say Y.
  2046. +define KernelPackage/rt2800-pci
  2047. +$(call KernelPackage/rt2x00/Default)
  2048. + DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci +kmod-rt2800-lib +kmod-rt2800-mmio
  2049. + TITLE+= (RT2860 PCI)
  2050. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800pci.ko
  2051. + AUTOLOAD:=$(call AutoProbe,rt2800pci)
  2052. +endef
  2053. - config PACKAGE_B43_PHY_LCN
  2054. - bool "Enable support for LCN-PHYs"
  2055. - depends on BROKEN
  2056. - default n
  2057. - help
  2058. - Currently broken.
  2059. +define KernelPackage/rt2800-usb
  2060. +$(call KernelPackage/rt2x00/Default)
  2061. + DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb +kmod-rt2800-lib +kmod-lib-crc-ccitt
  2062. + TITLE+= (RT2870 USB)
  2063. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800usb.ko
  2064. + AUTOLOAD:=$(call AutoProbe,rt2800usb)
  2065. +endef
  2066. - If unsure, say N.
  2067. - endif
  2068. +define KernelPackage/rt61-pci
  2069. +$(call KernelPackage/rt2x00/Default)
  2070. + DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci
  2071. + TITLE+= (RT2x61 PCI)
  2072. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt61pci.ko
  2073. + AUTOLOAD:=$(call AutoProbe,rt61pci)
  2074. endef
  2075. -define KernelPackage/b43/description
  2076. -Kernel module for Broadcom 43xx wireless support (mac80211 stack) new
  2077. +define KernelPackage/rt73-usb
  2078. + $(call KernelPackage/rt2x00/Default)
  2079. + DEPENDS+= @USB_SUPPORT +kmod-rt2x00-usb
  2080. + TITLE+= (RT73 USB)
  2081. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt73usb.ko
  2082. + AUTOLOAD:=$(call AutoProbe,rt73usb)
  2083. endef
  2084. -define KernelPackage/b43legacy
  2085. +
  2086. +define KernelPackage/rtl818x/Default
  2087. $(call KernelPackage/mac80211/Default)
  2088. - TITLE:=Broadcom 43xx-legacy wireless support
  2089. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/b43
  2090. - KCONFIG:= \
  2091. - CONFIG_HW_RANDOM=y
  2092. - DEPENDS+= +kmod-mac80211 +!(TARGET_brcm47xx||TARGET_brcm63xx):kmod-ssb
  2093. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/b43legacy/b43legacy.ko
  2094. - AUTOLOAD:=$(call AutoProbe,b43legacy)
  2095. - MENU:=1
  2096. + TITLE:=Realtek Drivers for RTL818x devices
  2097. + URL:=http://wireless.kernel.org/en/users/Drivers/rtl8187
  2098. + DEPENDS+= +kmod-eeprom-93cx6 +kmod-mac80211
  2099. endef
  2100. -define KernelPackage/b43legacy/config
  2101. - if PACKAGE_kmod-b43legacy
  2102. -
  2103. - config B43LEGACY_FW_SQUASH
  2104. - bool "Remove unnecessary firmware files"
  2105. - default y
  2106. - help
  2107. - This options allows you to remove unnecessary b43legacy firmware files
  2108. - from the final rootfs image. This can reduce the rootfs size by
  2109. - up to 50k.
  2110. +define KernelPackage/rtl8180
  2111. + $(call KernelPackage/rtl818x/Default)
  2112. + DEPENDS+= @PCI_SUPPORT
  2113. + TITLE+= (RTL8180 PCI)
  2114. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtl818x/rtl8180/rtl818x_pci.ko
  2115. + AUTOLOAD:=$(call AutoProbe,rtl818x_pci)
  2116. +endef
  2117. - If unsure, say Y.
  2118. +define KernelPackage/rtl8187
  2119. +$(call KernelPackage/rtl818x/Default)
  2120. + DEPENDS+= @USB_SUPPORT +kmod-usb-core
  2121. + TITLE+= (RTL8187 USB)
  2122. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtl818x/rtl8187/rtl8187.ko
  2123. + AUTOLOAD:=$(call AutoProbe,rtl8187)
  2124. +endef
  2125. - config B43LEGACY_FW_SQUASH_COREREVS
  2126. - string "Core revisions to include"
  2127. - depends on B43LEGACY_FW_SQUASH
  2128. - default "1,2,3,4"
  2129. +define KernelPackage/rtlwifi/config
  2130. + config PACKAGE_RTLWIFI_DEBUG
  2131. + bool "Realtek wireless debugging"
  2132. + depends on PACKAGE_kmod-rtlwifi
  2133. help
  2134. - This is a comma seperated list of core revision numbers.
  2135. + Say Y, if you want to debug realtek wireless drivers.
  2136. - Example (keep files for rev4 only):
  2137. - 4
  2138. +endef
  2139. - Example (keep files for rev2 and rev4):
  2140. - 2,4
  2141. +define KernelPackage/rtlwifi
  2142. + $(call KernelPackage/mac80211/Default)
  2143. + TITLE:=Realtek common driver part
  2144. + DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT) +kmod-mac80211 +@DRIVER_11N_SUPPORT
  2145. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtlwifi.ko
  2146. + HIDDEN:=1
  2147. +endef
  2148. - endif
  2149. +define KernelPackage/rtlwifi-pci
  2150. + $(call KernelPackage/mac80211/Default)
  2151. + TITLE:=Realtek common driver part (PCI support)
  2152. + DEPENDS+= @PCI_SUPPORT +kmod-rtlwifi
  2153. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl_pci.ko
  2154. + AUTOLOAD:=$(call AutoProbe,rtl_pci)
  2155. + HIDDEN:=1
  2156. endef
  2157. -define KernelPackage/b43legacy/description
  2158. -Kernel module for Broadcom 43xx-legacy wireless support (mac80211 stack) new
  2159. +define KernelPackage/rtlwifi-usb
  2160. + $(call KernelPackage/mac80211/Default)
  2161. + TITLE:=Realtek common driver part (USB support)
  2162. + DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-rtlwifi
  2163. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl_usb.ko
  2164. + AUTOLOAD:=$(call AutoProbe,rtl_usb)
  2165. + HIDDEN:=1
  2166. endef
  2167. +define KernelPackage/rtl8192c-common
  2168. + $(call KernelPackage/mac80211/Default)
  2169. + TITLE:=Realtek RTL8192CE/RTL8192CU common support module
  2170. + DEPENDS+= +kmod-rtlwifi
  2171. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192c/rtl8192c-common.ko
  2172. + HIDDEN:=1
  2173. +endef
  2174. -define KernelPackage/brcmutil
  2175. +define KernelPackage/rtl8192ce
  2176. $(call KernelPackage/mac80211/Default)
  2177. - TITLE:=Broadcom IEEE802.11n common driver parts
  2178. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
  2179. - DEPENDS+=@PCI_SUPPORT||USB_SUPPORT
  2180. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/brcm80211/brcmutil/brcmutil.ko
  2181. - AUTOLOAD:=$(call AutoProbe,brcmutil)
  2182. - MENU:=1
  2183. + TITLE:=Realtek RTL8192CE/RTL8188CE support
  2184. + DEPENDS+= +kmod-rtlwifi-pci +kmod-rtl8192c-common
  2185. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192ce/rtl8192ce.ko
  2186. + AUTOLOAD:=$(call AutoProbe,rtl8192ce)
  2187. endef
  2188. -define KernelPackage/brcmutil/description
  2189. - This module contains some common parts needed by Broadcom Wireless drivers brcmsmac and brcmfmac.
  2190. +define KernelPackage/rtl8192ce/install
  2191. + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  2192. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cfw.bin $(1)/lib/firmware/rtlwifi
  2193. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cfwU.bin $(1)/lib/firmware/rtlwifi
  2194. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cfwU_B.bin $(1)/lib/firmware/rtlwifi
  2195. endef
  2196. -define KernelPackage/brcmutil/config
  2197. - if PACKAGE_kmod-brcmutil
  2198. +define KernelPackage/rtl8192se
  2199. + $(call KernelPackage/mac80211/Default)
  2200. + TITLE:=Realtek RTL8192SE/RTL8191SE support
  2201. + DEPENDS+= +kmod-rtlwifi-pci
  2202. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192se/rtl8192se.ko
  2203. + AUTOLOAD:=$(call AutoProbe,rtl8192se)
  2204. +endef
  2205. - config PACKAGE_BRCM80211_DEBUG
  2206. - bool "Broadcom wireless driver debugging"
  2207. - help
  2208. - Say Y, if you want to debug brcmsmac and brcmfmac wireless driver.
  2209. +define KernelPackage/rtl8192se/install
  2210. + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  2211. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192sefw.bin $(1)/lib/firmware/rtlwifi
  2212. +endef
  2213. - endif
  2214. +define KernelPackage/rtl8192de
  2215. + $(call KernelPackage/mac80211/Default)
  2216. + TITLE:=Realtek RTL8192DE/RTL8188DE support
  2217. + DEPENDS+= +kmod-rtlwifi-pci
  2218. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192de/rtl8192de.ko
  2219. + AUTOLOAD:=$(call AutoProbe,rtl8192de)
  2220. endef
  2221. -PKG_BRCMSMAC_FW_NAME:=broadcom-wl
  2222. -PKG_BRCMSMAC_FW_VERSION:=5.100.138
  2223. -PKG_BRCMSMAC_FW_OBJECT:=$(PKG_BRCMSMAC_FW_NAME)-$(PKG_BRCMSMAC_FW_VERSION)/linux/wl_apsta.o
  2224. -PKG_BRCMSMAC_FW_SOURCE:=$(PKG_BRCMSMAC_FW_NAME)-$(PKG_BRCMSMAC_FW_VERSION).tar.bz2
  2225. -PKG_BRCMSMAC_FW_SOURCE_URL:=http://www.lwfinger.com/b43-firmware/
  2226. -PKG_BRCMSMAC_FW_MD5SUM:=f4e357b09eaf5d8b1f1920cf3493a555
  2227. +define KernelPackage/rtl8192de/install
  2228. + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  2229. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192defw.bin $(1)/lib/firmware/rtlwifi
  2230. +endef
  2231. -define Download/brcmsmac
  2232. - FILE:=$(PKG_BRCMSMAC_FW_SOURCE)
  2233. - URL:=$(PKG_BRCMSMAC_FW_SOURCE_URL)
  2234. - MD5SUM:=$(PKG_BRCMSMAC_FW_MD5SUM)
  2235. +define KernelPackage/rtl8192cu
  2236. + $(call KernelPackage/mac80211/Default)
  2237. + TITLE:=Realtek RTL8192CU/RTL8188CU support
  2238. + DEPENDS+= +kmod-rtlwifi-usb +kmod-rtl8192c-common
  2239. + FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/rtlwifi/rtl8192cu/rtl8192cu.ko
  2240. + AUTOLOAD:=$(call AutoProbe,rtl8192cu)
  2241. endef
  2242. -$(eval $(call Download,brcmsmac))
  2243. -define KernelPackage/brcmsmac
  2244. +define KernelPackage/rtl8192cu/install
  2245. + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  2246. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw.bin $(1)/lib/firmware/rtlwifi
  2247. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw_A.bin $(1)/lib/firmware/rtlwifi
  2248. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw_B.bin $(1)/lib/firmware/rtlwifi
  2249. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rtlwifi/rtl8192cufw_TMSC.bin $(1)/lib/firmware/rtlwifi
  2250. +endef
  2251. +
  2252. +
  2253. +define KernelPackage/wlcore
  2254. $(call KernelPackage/mac80211/Default)
  2255. - TITLE:=Broadcom IEEE802.11n PCIe SoftMAC WLAN driver
  2256. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
  2257. - DEPENDS+= +kmod-mac80211 +@DRIVER_11N_SUPPORT +!TARGET_brcm47xx:kmod-bcma +kmod-lib-cordic +kmod-lib-crc8 +kmod-brcmutil
  2258. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/brcm80211/brcmsmac/brcmsmac.ko
  2259. - AUTOLOAD:=$(call AutoProbe,brcmsmac)
  2260. - MENU:=1
  2261. + TITLE:=TI common driver part
  2262. + DEPENDS+= @TARGET_omap +kmod-mac80211 +@DRIVER_11N_SUPPORT
  2263. + FILES:= \
  2264. + $(PKG_BUILD_DIR)/drivers/net/wireless/ti/wlcore/wlcore.ko \
  2265. + $(PKG_BUILD_DIR)/drivers/net/wireless/ti/wlcore/wlcore_sdio.ko
  2266. + AUTOLOAD:=$(call AutoProbe,wlcore wlcore_sdio)
  2267. endef
  2268. -define KernelPackage/brcmsmac/description
  2269. - Kernel module for Broadcom IEEE802.11n PCIe Wireless cards
  2270. +define KernelPackage/wlcore/description
  2271. + This module contains some common parts needed by TI Wireless drivers.
  2272. endef
  2273. -define KernelPackage/brcmsmac/config
  2274. - if PACKAGE_kmod-brcmsmac
  2275. +define KernelPackage/wl12xx
  2276. + $(call KernelPackage/mac80211/Default)
  2277. + TITLE:=Driver for TI WL12xx
  2278. + URL:=http://wireless.kernel.org/en/users/Drivers/wl12xx
  2279. + DEPENDS+= +kmod-wlcore
  2280. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ti/wl12xx/wl12xx.ko
  2281. + AUTOLOAD:=$(call AutoProbe,wl12xx)
  2282. +endef
  2283. - config BRCMSMAC_USE_FW_FROM_WL
  2284. - bool "Use firmware extracted from broadcom proprietary driver"
  2285. - default y
  2286. - help
  2287. - Instead of using the official brcmsmac firmware a firmware
  2288. - version 666.2 extracted from the proprietary Broadcom driver
  2289. - is used. This is needed to get core rev 17 used in bcm4716
  2290. - to work.
  2291. +define KernelPackage/wl12xx/description
  2292. + Kernel modules for TI WL12xx
  2293. +endef
  2294. - If unsure, say Y.
  2295. +define KernelPackage/wl18xx
  2296. + $(call KernelPackage/mac80211/Default)
  2297. + TITLE:=Driver for TI WL18xx
  2298. + URL:=http://wireless.kernel.org/en/users/Drivers/wl18xx
  2299. + DEPENDS+= +kmod-wlcore
  2300. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ti/wl18xx/wl18xx.ko
  2301. + AUTOLOAD:=$(call AutoProbe,wl18xx)
  2302. +endef
  2303. - endif
  2304. +define KernelPackage/wl18xx/description
  2305. + Kernel modules for TI WL18xx
  2306. endef
  2307. -define KernelPackage/brcmfmac
  2308. - $(call KernelPackage/mac80211/Default)
  2309. - TITLE:=Broadcom IEEE802.11n USB FullMAC WLAN driver
  2310. - URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211
  2311. - DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +@DRIVER_11N_SUPPORT +kmod-brcmutil +BRCMFMAC_SDIO:kmod-mmc +BRCMFMAC_USB:kmod-usb-core
  2312. - FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/brcm80211/brcmfmac/brcmfmac.ko
  2313. - AUTOLOAD:=$(call AutoProbe,brcmfmac)
  2314. +ZD1211FW_NAME:=zd1211-firmware
  2315. +ZD1211FW_VERSION:=1.4
  2316. +define Download/zd1211rw
  2317. + FILE:=$(ZD1211FW_NAME)-$(ZD1211FW_VERSION).tar.bz2
  2318. + URL:=@SF/zd1211/
  2319. + MD5SUM:=19f28781d76569af8551c9d11294c870
  2320. endef
  2321. +$(eval $(call Download,zd1211rw))
  2322. -define KernelPackage/brcmfmac/description
  2323. - Kernel module for Broadcom IEEE802.11n USB Wireless cards
  2324. +define KernelPackage/zd1211rw
  2325. + $(call KernelPackage/mac80211/Default)
  2326. + TITLE:=Zydas ZD1211 support
  2327. + DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-mac80211
  2328. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/zd1211rw/zd1211rw.ko
  2329. + AUTOLOAD:=$(call AutoProbe,zd1211rw)
  2330. endef
  2331. -define KernelPackage/brcmfmac/config
  2332. - if PACKAGE_kmod-brcmfmac
  2333. -
  2334. - config BRCMFMAC_SDIO
  2335. - bool "Enable SDIO bus interface support"
  2336. - default n
  2337. - help
  2338. - Enable support for cards attached to an SDIO bus.
  2339. - Select this option only if you are sure that your
  2340. - board has a Broadcom wireless chip atacched to
  2341. - that bus.
  2342. -
  2343. - config BRCMFMAC_USB
  2344. - bool "Enable USB bus interface support"
  2345. - depends on USB_SUPPORT
  2346. - default y
  2347. - help
  2348. - Supported USB connected chipsets:
  2349. - BCM43235, BCM43236, BCM43238 (all in revision 3 only)
  2350. - BCM43143, BCM43242, BCM43566, BCM43569
  2351. -
  2352. - config BRCMFMAC_PCIE
  2353. - bool "Enable PCIE bus interface support"
  2354. - depends on PCI_SUPPORT
  2355. - default y
  2356. - help
  2357. - Supported PCIe connected chipsets:
  2358. - BCM4354, BCM4356, BCM43567, BCM43570, BCM43602
  2359. - endif
  2360. -endef
  2361. config_package=$(if $(CONFIG_PACKAGE_kmod-$(1)),m)
  2362. @@ -1602,6 +1684,8 @@ config-$(CONFIG_BRCMFMAC_PCIE) += BRCMFMAC_PCIE
  2363. config-$(CONFIG_PACKAGE_BRCM80211_DEBUG) += BRCMDBG
  2364. config-$(call config_package,mac80211-hwsim) += MAC80211_HWSIM
  2365. +config-$(call config_package,mt7601u) += MT7601U
  2366. +config-y += WL_MEDIATEK
  2367. config-$(call config_package,rt2x00-lib) += RT2X00 RT2X00_LIB
  2368. config-$(call config_package,rt2x00-pci) += RT2X00_LIB_PCI
  2369. @@ -1623,26 +1707,28 @@ config-$(call config_package,rt2800-pci) += RT2800PCI
  2370. config-y += RT2800PCI_RT33XX RT2800PCI_RT35XX RT2800PCI_RT53XX RT2800PCI_RT3290
  2371. config-$(call config_package,rt2800-usb) += RT2800USB
  2372. -config-y += RT2800USB_RT33XX RT2800USB_RT35XX RT2800USB_RT3573 RT2800USB_RT53XX RT2800USB_RT55XX
  2373. +config-y += RT2800USB_RT33XX RT2800USB_RT35XX RT2800USB_RT3573 RT2800USB_RT53XX RT2800USB_RT55XX RT2800USB_UNKNOWN
  2374. config-$(call config_package,iwl-legacy) += IWLEGACY
  2375. config-$(call config_package,iwl3945) += IWL3945
  2376. config-$(call config_package,iwl4965) += IWL4965
  2377. -config-$(call config_package,iwlagn) += IWLWIFI IWLDVM
  2378. +config-$(call config_package,iwlwifi) += IWLWIFI IWLDVM IWLMVM
  2379. +config-$(CONFIG_PACKAGE_IWLWIFI_DEBUG)+= IWLWIFI_DEBUG
  2380. +config-$(CONFIG_PACKAGE_IWLWIFI_DEBUGFS)+= IWLWIFI_DEBUGFS
  2381. -config-$(call config_package,net-libipw) += LIBIPW
  2382. -config-$(call config_package,net-ipw2100) += IPW2100
  2383. -config-$(call config_package,net-ipw2200) += IPW2200
  2384. +config-$(call config_package,libipw) += LIBIPW
  2385. +config-$(call config_package,ipw2100) += IPW2100
  2386. +config-$(call config_package,ipw2200) += IPW2200
  2387. config-$(call config_package,p54-common) += P54_COMMON
  2388. config-$(call config_package,p54-pci) += P54_PCI
  2389. config-$(call config_package,p54-usb) += P54_USB
  2390. config-$(call config_package,p54-spi) += P54_SPI
  2391. -config-$(call config_package,net-hermes) += HERMES
  2392. -config-$(call config_package,net-hermes-pci) += PCI_HERMES
  2393. -config-$(call config_package,net-hermes-plx) += PLX_HERMES
  2394. -config-$(call config_package,net-hermes-pcmcia) += PCMCIA_HERMES
  2395. +config-$(call config_package,hermes) += HERMES
  2396. +config-$(call config_package,hermes-pci) += PCI_HERMES
  2397. +config-$(call config_package,hermes-plx) += PLX_HERMES
  2398. +config-$(call config_package,hermes-pcmcia) += PCMCIA_HERMES
  2399. config-y += HERMES_PRISM
  2400. config-$(call config_package,adm8211) += ADM8211
  2401. @@ -1702,8 +1788,9 @@ define Build/Prepare
  2402. $(TAR) -C $(PKG_BUILD_DIR) -xzf $(DL_DIR)/$(IPW2100_NAME)-$(IPW2100_VERSION).tgz
  2403. $(TAR) -C $(PKG_BUILD_DIR) -xzf $(DL_DIR)/$(IPW2200_NAME)-$(IPW2200_VERSION).tgz
  2404. $(TAR) -C $(PKG_BUILD_DIR) -xjf $(DL_DIR)/$(ZD1211FW_NAME)-$(ZD1211FW_VERSION).tar.bz2
  2405. - $(TAR) -C $(PKG_BUILD_DIR) -xjf $(DL_DIR)/$(PKG_LINUX_FIRMWARE_SOURCE)
  2406. + $(TAR) -C $(PKG_BUILD_DIR) -xJf $(DL_DIR)/$(PKG_LINUX_FIRMWARE_SOURCE)
  2407. $(TAR) -C $(PKG_BUILD_DIR) -xjf $(DL_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SOURCE)
  2408. + $(TAR) -C $(PKG_BUILD_DIR) -xjf $(DL_DIR)/$(PKG_MT7601U_FW_SOURCE)
  2409. rm -rf \
  2410. $(PKG_BUILD_DIR)/include/linux/ssb \
  2411. $(PKG_BUILD_DIR)/include/linux/bcma \
  2412. @@ -1739,233 +1826,37 @@ define Build/Compile
  2413. $(MAKE) $(MAKE_OPTS) allnoconfig
  2414. $(call Build/Compile/kmod)
  2415. endef
  2416. -
  2417. -define Build/InstallDev
  2418. - mkdir -p \
  2419. - $(1)/usr/include/mac80211 \
  2420. - $(1)/usr/include/mac80211-backport \
  2421. - $(1)/usr/include/mac80211/ath \
  2422. - $(1)/usr/include/net/mac80211
  2423. - $(CP) $(PKG_BUILD_DIR)/net/mac80211/*.h $(PKG_BUILD_DIR)/include/* $(1)/usr/include/mac80211/
  2424. - $(CP) $(PKG_BUILD_DIR)/backport-include/* $(1)/usr/include/mac80211-backport/
  2425. - $(CP) $(PKG_BUILD_DIR)/net/mac80211/rate.h $(1)/usr/include/net/mac80211/
  2426. - $(CP) $(PKG_BUILD_DIR)/drivers/net/wireless/ath/*.h $(1)/usr/include/mac80211/ath/
  2427. - rm -f $(1)/usr/include/mac80211-backport/linux/module.h
  2428. -endef
  2429. -
  2430. -define KernelPackage/libertas-usb/install
  2431. - $(INSTALL_DIR) $(1)/lib/firmware/libertas
  2432. - $(INSTALL_DATA) \
  2433. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/usb8388_v9.bin \
  2434. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/usb8682.bin \
  2435. - $(1)/lib/firmware/libertas/
  2436. -endef
  2437. -
  2438. -define KernelPackage/libertas-sdio/install
  2439. - $(INSTALL_DIR) $(1)/lib/firmware/libertas
  2440. - $(INSTALL_DATA) \
  2441. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8385_helper.bin \
  2442. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8385.bin \
  2443. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8686_v9_helper.bin \
  2444. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8686_v9.bin \
  2445. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8688_helper.bin \
  2446. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8688.bin \
  2447. - $(1)/lib/firmware/libertas
  2448. -endef
  2449. -
  2450. -define KernelPackage/cfg80211/install
  2451. - $(INSTALL_DIR) $(1)/lib/wifi $(1)/lib/netifd/wireless
  2452. - $(INSTALL_DATA) ./files/lib/wifi/mac80211.sh $(1)/lib/wifi
  2453. - $(INSTALL_BIN) ./files/lib/netifd/wireless/mac80211.sh $(1)/lib/netifd/wireless
  2454. -endef
  2455. -
  2456. -define KernelPackage/p54-pci/install
  2457. - $(INSTALL_DIR) $(1)/lib/firmware
  2458. - $(INSTALL_DATA) $(DL_DIR)/$(P54PCIFW) $(1)/lib/firmware/isl3886pci
  2459. -endef
  2460. -
  2461. -define KernelPackage/p54-usb/install
  2462. - $(INSTALL_DIR) $(1)/lib/firmware
  2463. - $(INSTALL_DATA) $(DL_DIR)/$(P54USBFW) $(1)/lib/firmware/isl3887usb
  2464. -endef
  2465. -
  2466. -define KernelPackage/p54-spi/install
  2467. - $(INSTALL_DIR) $(1)/lib/firmware
  2468. - $(INSTALL_DATA) $(DL_DIR)/$(P54SPIFW) $(1)/lib/firmware/3826.arm
  2469. -endef
  2470. -
  2471. -define KernelPackage/rt61-pci/install
  2472. - $(INSTALL_DIR) $(1)/lib/firmware
  2473. - $(INSTALL_DATA) \
  2474. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2561.bin \
  2475. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2561s.bin \
  2476. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2661.bin \
  2477. - $(1)/lib/firmware/
  2478. -endef
  2479. -
  2480. -define KernelPackage/rt73-usb/install
  2481. - $(INSTALL_DIR) $(1)/lib/firmware
  2482. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt73.bin $(1)/lib/firmware/
  2483. -endef
  2484. -
  2485. -define KernelPackage/rt2800-pci/install
  2486. - $(INSTALL_DIR) $(1)/lib/firmware
  2487. - $(INSTALL_DATA) \
  2488. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2860.bin \
  2489. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt3290.bin \
  2490. - $(1)/lib/firmware
  2491. -endef
  2492. -
  2493. -define KernelPackage/rt2800-usb/install
  2494. - $(INSTALL_DIR) $(1)/lib/firmware
  2495. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2870.bin $(1)/lib/firmware/
  2496. -endef
  2497. -
  2498. -define KernelPackage/wl12xx/install
  2499. - $(INSTALL_DIR) $(1)/lib/firmware/ti-connectivity
  2500. - $(INSTALL_DATA) \
  2501. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl127x-fw-5-mr.bin \
  2502. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl127x-fw-5-plt.bin \
  2503. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl127x-fw-5-sr.bin \
  2504. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl1271-nvs.bin \
  2505. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-fw-5-mr.bin \
  2506. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-fw-5-plt.bin \
  2507. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-fw-5-sr.bin \
  2508. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-nvs.bin \
  2509. - $(1)/lib/firmware/ti-connectivity
  2510. -endef
  2511. -
  2512. -define KernelPackage/wl18xx/install
  2513. - $(INSTALL_DIR) $(1)/lib/firmware/ti-connectivity
  2514. - $(INSTALL_DATA) \
  2515. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl18xx-conf.bin \
  2516. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl18xx-fw-3.bin \
  2517. - $(1)/lib/firmware/ti-connectivity
  2518. -endef
  2519. -
  2520. -define KernelPackage/zd1211rw/install
  2521. - $(INSTALL_DIR) $(1)/lib/firmware/zd1211
  2522. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(ZD1211FW_NAME)/zd1211* $(1)/lib/firmware/zd1211
  2523. -endef
  2524. -
  2525. -define KernelPackage/carl9170/install
  2526. - $(INSTALL_DIR) $(1)/lib/firmware
  2527. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/carl9170-1.fw $(1)/lib/firmware
  2528. -endef
  2529. -
  2530. -define KernelPackage/ath9k-htc/install
  2531. - $(INSTALL_DIR) $(1)/lib/firmware
  2532. - $(INSTALL_DATA) \
  2533. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/htc_9271.fw \
  2534. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/htc_7010.fw \
  2535. - $(1)/lib/firmware/
  2536. -endef
  2537. -
  2538. -define KernelPackage/ath10k/install
  2539. - $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
  2540. - $(INSTALL_DATA) \
  2541. - $(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/ath10k/QCA988X/hw2.0/board.bin \
  2542. - $(1)/lib/firmware/ath10k/QCA988X/hw2.0/
  2543. -ifeq ($(CONFIG_ATH10K_STA_FW),y)
  2544. - $(INSTALL_DATA) \
  2545. - $(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/main/firmware-2.bin_999.999.0.636 \
  2546. - $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-2.bin
  2547. -else ifeq ($(CONFIG_ATH10K_API2_FW),y)
  2548. - $(INSTALL_DATA) \
  2549. - $(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/10.1/firmware-2.bin_10.1.467.2-1 \
  2550. - $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-2.bin
  2551. -else
  2552. - $(INSTALL_DATA) \
  2553. - $(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/10.2.4/firmware-4.bin_10.2.4.45 \
  2554. - $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-4.bin
  2555. -endif
  2556. -endef
  2557. -
  2558. -define KernelPackage/mwl8k/install
  2559. - $(INSTALL_DIR) $(1)/lib/firmware/mwl8k
  2560. - $(INSTALL_DATA) \
  2561. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/fmimage_8366_ap-3.fw \
  2562. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/fmimage_8366.fw \
  2563. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/helper_8366.fw \
  2564. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/fmimage_8687.fw \
  2565. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/helper_8687.fw \
  2566. - $(1)/lib/firmware/mwl8k/
  2567. -endef
  2568. -
  2569. -define KernelPackage/mwifiex-pcie/install
  2570. - $(INSTALL_DIR) $(1)/lib/firmware/mrvl
  2571. - $(INSTALL_DATA) \
  2572. - $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mrvl/pcie8897_uapsta.bin \
  2573. - $(1)/lib/firmware/mrvl/
  2574. -endef
  2575. -
  2576. -define KernelPackage/net-ipw2100/install
  2577. - $(INSTALL_DIR) $(1)/lib/firmware
  2578. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/ipw2100-$(IPW2100_VERSION)*.fw $(1)/lib/firmware
  2579. -endef
  2580. -
  2581. -define KernelPackage/net-ipw2200/install
  2582. - $(INSTALL_DIR) $(1)/lib/firmware
  2583. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(IPW2200_NAME)-$(IPW2200_VERSION)/ipw2200*.fw $(1)/lib/firmware
  2584. -endef
  2585. -
  2586. -define KernelPackage/iwlagn/install
  2587. - $(INSTALL_DIR) $(1)/lib/firmware
  2588. -ifneq ($(CONFIG_IWL5000_FW),)
  2589. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-5000-5.ucode $(1)/lib/firmware
  2590. -endif
  2591. -ifneq ($(CONFIG_IWL5150_FW),)
  2592. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-5150-2.ucode $(1)/lib/firmware
  2593. -endif
  2594. -ifneq ($(CONFIG_IWL1000_FW),)
  2595. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-1000-5.ucode $(1)/lib/firmware
  2596. -endif
  2597. -ifneq ($(CONFIG_IWL6000_FW),)
  2598. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6000-4.ucode $(1)/lib/firmware
  2599. -endif
  2600. -ifneq ($(CONFIG_IWL6050_FW),)
  2601. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6050-5.ucode $(1)/lib/firmware
  2602. -endif
  2603. -ifneq ($(CONFIG_IWL6005_FW),)
  2604. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6000g2a-6.ucode $(1)/lib/firmware
  2605. -endif
  2606. -ifneq ($(CONFIG_IWL6030_FW),)
  2607. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6000g2b-6.ucode $(1)/lib/firmware
  2608. -endif
  2609. -ifneq ($(CONFIG_IWL7260_FW),)
  2610. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-7260-9.ucode $(1)/lib/firmware
  2611. -endif
  2612. -ifneq ($(CONFIG_IWL7265_FW),)
  2613. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-7265-9.ucode $(1)/lib/firmware
  2614. -endif
  2615. -ifneq ($(CONFIG_IWL100_FW),)
  2616. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-100-5.ucode $(1)/lib/firmware
  2617. -endif
  2618. -ifneq ($(CONFIG_IWL2000_FW),)
  2619. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-2000-6.ucode $(1)/lib/firmware
  2620. -endif
  2621. -ifneq ($(CONFIG_IWL2030_FW),)
  2622. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-2030-6.ucode $(1)/lib/firmware
  2623. -endif
  2624. -ifneq ($(CONFIG_IWL105_FW),)
  2625. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-105-6.ucode $(1)/lib/firmware
  2626. -endif
  2627. -ifneq ($(CONFIG_IWL135_FW),)
  2628. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-135-6.ucode $(1)/lib/firmware
  2629. -endif
  2630. -ifneq ($(CONFIG_IWL3160_FW),)
  2631. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-3160-9.ucode $(1)/lib/firmware
  2632. -endif
  2633. +
  2634. +define Build/InstallDev
  2635. + mkdir -p \
  2636. + $(1)/usr/include/mac80211 \
  2637. + $(1)/usr/include/mac80211-backport \
  2638. + $(1)/usr/include/mac80211/ath \
  2639. + $(1)/usr/include/net/mac80211
  2640. + $(CP) $(PKG_BUILD_DIR)/net/mac80211/*.h $(PKG_BUILD_DIR)/include/* $(1)/usr/include/mac80211/
  2641. + $(CP) $(PKG_BUILD_DIR)/backport-include/* $(1)/usr/include/mac80211-backport/
  2642. + $(CP) $(PKG_BUILD_DIR)/net/mac80211/rate.h $(1)/usr/include/net/mac80211/
  2643. + $(CP) $(PKG_BUILD_DIR)/drivers/net/wireless/ath/*.h $(1)/usr/include/mac80211/ath/
  2644. + rm -f $(1)/usr/include/mac80211-backport/linux/module.h
  2645. endef
  2646. -define KernelPackage/iwl3945/install
  2647. +
  2648. +define KernelPackage/ath9k-htc/install
  2649. $(INSTALL_DIR) $(1)/lib/firmware
  2650. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-3945-2.ucode $(1)/lib/firmware
  2651. + $(INSTALL_DATA) \
  2652. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/htc_9271.fw \
  2653. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/htc_7010.fw \
  2654. + $(1)/lib/firmware/
  2655. endef
  2656. -define KernelPackage/iwl4965/install
  2657. - $(INSTALL_DIR) $(1)/lib/firmware
  2658. - $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-4965-2.ucode $(1)/lib/firmware
  2659. +define KernelPackage/ath10k/install
  2660. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
  2661. + $(INSTALL_DATA) \
  2662. + $(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/ath10k/QCA988X/hw2.0/board.bin \
  2663. + $(1)/lib/firmware/ath10k/QCA988X/hw2.0/
  2664. + $(INSTALL_DATA) \
  2665. + $(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/10.2.4/untested/firmware-5.bin_10.2.4.70-2 \
  2666. + $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin
  2667. endef
  2668. define KernelPackage/b43/install
  2669. @@ -2028,13 +1919,237 @@ ifneq ($(CONFIG_BRCMFMAC_PCIE),)
  2670. endif
  2671. endef
  2672. +define KernelPackage/carl9170/install
  2673. + $(INSTALL_DIR) $(1)/lib/firmware
  2674. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/carl9170-1.fw $(1)/lib/firmware
  2675. +endef
  2676. +
  2677. +define KernelPackage/cfg80211/install
  2678. + $(INSTALL_DIR) $(1)/lib/wifi $(1)/lib/netifd/wireless
  2679. + $(INSTALL_DATA) ./files/lib/wifi/mac80211.sh $(1)/lib/wifi
  2680. + $(INSTALL_BIN) ./files/lib/netifd/wireless/mac80211.sh $(1)/lib/netifd/wireless
  2681. +endef
  2682. +
  2683. +define KernelPackage/ipw2100/install
  2684. + $(INSTALL_DIR) $(1)/lib/firmware
  2685. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/ipw2100-$(IPW2100_VERSION)*.fw $(1)/lib/firmware
  2686. +endef
  2687. +
  2688. +define KernelPackage/ipw2200/install
  2689. + $(INSTALL_DIR) $(1)/lib/firmware
  2690. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(IPW2200_NAME)-$(IPW2200_VERSION)/ipw2200*.fw $(1)/lib/firmware
  2691. +endef
  2692. +
  2693. +define KernelPackage/iwlwifi/install
  2694. + $(INSTALL_DIR) $(1)/lib/firmware
  2695. +ifneq ($(CONFIG_IWL100_FW),)
  2696. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-100-5.ucode $(1)/lib/firmware
  2697. +endif
  2698. +ifneq ($(CONFIG_IWL1000_FW),)
  2699. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-1000-5.ucode $(1)/lib/firmware
  2700. +endif
  2701. +ifneq ($(CONFIG_IWL105_FW),)
  2702. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-105-6.ucode $(1)/lib/firmware
  2703. +endif
  2704. +ifneq ($(CONFIG_IWL135_FW),)
  2705. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-135-6.ucode $(1)/lib/firmware
  2706. +endif
  2707. +ifneq ($(CONFIG_IWL2000_FW),)
  2708. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-2000-6.ucode $(1)/lib/firmware
  2709. +endif
  2710. +ifneq ($(CONFIG_IWL2030_FW),)
  2711. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-2030-6.ucode $(1)/lib/firmware
  2712. +endif
  2713. +ifneq ($(CONFIG_IWL3160_FW),)
  2714. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-3160-13.ucode $(1)/lib/firmware
  2715. +endif
  2716. +ifneq ($(CONFIG_IWL5000_FW),)
  2717. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-5000-5.ucode $(1)/lib/firmware
  2718. +endif
  2719. +ifneq ($(CONFIG_IWL5150_FW),)
  2720. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-5150-2.ucode $(1)/lib/firmware
  2721. +endif
  2722. +ifneq ($(CONFIG_IWL6000_FW),)
  2723. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6000-4.ucode $(1)/lib/firmware
  2724. +endif
  2725. +ifneq ($(CONFIG_IWL6005_FW),)
  2726. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6000g2a-6.ucode $(1)/lib/firmware
  2727. +endif
  2728. +ifneq ($(CONFIG_IWL6030_FW),)
  2729. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6000g2b-6.ucode $(1)/lib/firmware
  2730. +endif
  2731. +ifneq ($(CONFIG_IWL6050_FW),)
  2732. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-6050-5.ucode $(1)/lib/firmware
  2733. +endif
  2734. +ifneq ($(CONFIG_IWL7260_FW),)
  2735. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-7260-13.ucode $(1)/lib/firmware
  2736. +endif
  2737. +ifneq ($(CONFIG_IWL7265_FW),)
  2738. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-7265-13.ucode $(1)/lib/firmware
  2739. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-7265D-13.ucode $(1)/lib/firmware
  2740. +endif
  2741. +ifneq ($(CONFIG_IWL8000_FW),)
  2742. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-8000C-13.ucode $(1)/lib/firmware
  2743. +endif
  2744. +endef
  2745. +
  2746. +define KernelPackage/iwl3945/install
  2747. + $(INSTALL_DIR) $(1)/lib/firmware
  2748. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-3945-2.ucode $(1)/lib/firmware
  2749. +endef
  2750. +
  2751. +define KernelPackage/iwl4965/install
  2752. + $(INSTALL_DIR) $(1)/lib/firmware
  2753. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-4965-2.ucode $(1)/lib/firmware
  2754. +endef
  2755. +
  2756. +define KernelPackage/libertas-usb/install
  2757. + $(INSTALL_DIR) $(1)/lib/firmware/libertas
  2758. + $(INSTALL_DATA) \
  2759. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/usb8388_v9.bin \
  2760. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/usb8682.bin \
  2761. + $(1)/lib/firmware/libertas/
  2762. +endef
  2763. +
  2764. +define KernelPackage/libertas-sdio/install
  2765. + $(INSTALL_DIR) $(1)/lib/firmware/libertas
  2766. + $(INSTALL_DATA) \
  2767. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8385_helper.bin \
  2768. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8385.bin \
  2769. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8686_v9_helper.bin \
  2770. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8686_v9.bin \
  2771. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8688_helper.bin \
  2772. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/libertas/sd8688.bin \
  2773. + $(1)/lib/firmware/libertas
  2774. +endef
  2775. +
  2776. +define KernelPackage/mt7601u/install
  2777. + $(INSTALL_DIR) $(1)/lib/firmware
  2778. + $(INSTALL_DATA) \
  2779. + $(PKG_BUILD_DIR)/$(PKG_MT7601U_FW_NAME)_$(PKG_MT7601U_FW_VERSION)/mcu/bin/MT7601.bin \
  2780. + $(1)/lib/firmware/mt7601u.bin
  2781. +endef
  2782. +
  2783. +define KernelPackage/mwl8k/install
  2784. + $(INSTALL_DIR) $(1)/lib/firmware/mwl8k
  2785. + $(INSTALL_DATA) \
  2786. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/fmimage_8366_ap-3.fw \
  2787. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/fmimage_8366.fw \
  2788. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/helper_8366.fw \
  2789. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/fmimage_8687.fw \
  2790. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mwl8k/helper_8687.fw \
  2791. + $(1)/lib/firmware/mwl8k/
  2792. +endef
  2793. +
  2794. +define KernelPackage/mwifiex-pcie/install
  2795. + $(INSTALL_DIR) $(1)/lib/firmware/mrvl
  2796. + $(INSTALL_DATA) \
  2797. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/mrvl/pcie8897_uapsta.bin \
  2798. + $(1)/lib/firmware/mrvl/
  2799. +endef
  2800. +
  2801. +define KernelPackage/p54-pci/install
  2802. + $(INSTALL_DIR) $(1)/lib/firmware
  2803. + $(INSTALL_DATA) $(DL_DIR)/$(P54PCIFW) $(1)/lib/firmware/isl3886pci
  2804. +endef
  2805. +
  2806. +define KernelPackage/p54-usb/install
  2807. + $(INSTALL_DIR) $(1)/lib/firmware
  2808. + $(INSTALL_DATA) $(DL_DIR)/$(P54USBFW) $(1)/lib/firmware/isl3887usb
  2809. +endef
  2810. +
  2811. +define KernelPackage/p54-spi/install
  2812. + $(INSTALL_DIR) $(1)/lib/firmware
  2813. + $(INSTALL_DATA) $(DL_DIR)/$(P54SPIFW) $(1)/lib/firmware/3826.arm
  2814. +endef
  2815. +
  2816. +define KernelPackage/rt2800-pci/install
  2817. + $(INSTALL_DIR) $(1)/lib/firmware
  2818. + $(INSTALL_DATA) \
  2819. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2860.bin \
  2820. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt3290.bin \
  2821. + $(1)/lib/firmware
  2822. +endef
  2823. +
  2824. +define KernelPackage/rt2800-usb/install
  2825. + $(INSTALL_DIR) $(1)/lib/firmware
  2826. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2870.bin $(1)/lib/firmware/
  2827. +endef
  2828. +
  2829. +define KernelPackage/rt61-pci/install
  2830. + $(INSTALL_DIR) $(1)/lib/firmware
  2831. + $(INSTALL_DATA) \
  2832. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2561.bin \
  2833. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2561s.bin \
  2834. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt2661.bin \
  2835. + $(1)/lib/firmware/
  2836. +endef
  2837. +
  2838. +define KernelPackage/rt73-usb/install
  2839. + $(INSTALL_DIR) $(1)/lib/firmware
  2840. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/rt73.bin $(1)/lib/firmware/
  2841. +endef
  2842. +
  2843. +define KernelPackage/wl12xx/install
  2844. + $(INSTALL_DIR) $(1)/lib/firmware/ti-connectivity
  2845. + $(INSTALL_DATA) \
  2846. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl127x-fw-5-mr.bin \
  2847. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl127x-fw-5-plt.bin \
  2848. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl127x-fw-5-sr.bin \
  2849. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl1271-nvs.bin \
  2850. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-fw-5-mr.bin \
  2851. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-fw-5-plt.bin \
  2852. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-fw-5-sr.bin \
  2853. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl128x-nvs.bin \
  2854. + $(1)/lib/firmware/ti-connectivity
  2855. +endef
  2856. +
  2857. +define KernelPackage/wl18xx/install
  2858. + $(INSTALL_DIR) $(1)/lib/firmware/ti-connectivity
  2859. + $(INSTALL_DATA) \
  2860. + $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/ti-connectivity/wl18xx-fw-4.bin \
  2861. + $(1)/lib/firmware/ti-connectivity
  2862. +endef
  2863. +
  2864. +define KernelPackage/zd1211rw/install
  2865. + $(INSTALL_DIR) $(1)/lib/firmware/zd1211
  2866. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(ZD1211FW_NAME)/zd1211* $(1)/lib/firmware/zd1211
  2867. +endef
  2868. +
  2869. +
  2870. $(eval $(call KernelPackage,adm8211))
  2871. +$(eval $(call KernelPackage,ath))
  2872. +$(eval $(call KernelPackage,ath10k))
  2873. $(eval $(call KernelPackage,ath5k))
  2874. +$(eval $(call KernelPackage,ath9k))
  2875. +$(eval $(call KernelPackage,ath9k-common))
  2876. +$(eval $(call KernelPackage,ath9k-htc))
  2877. +$(eval $(call KernelPackage,b43))
  2878. +$(eval $(call KernelPackage,b43legacy))
  2879. +$(eval $(call KernelPackage,brcmsmac))
  2880. +$(eval $(call KernelPackage,brcmfmac))
  2881. +$(eval $(call KernelPackage,brcmutil))
  2882. +$(eval $(call KernelPackage,carl9170))
  2883. +$(eval $(call KernelPackage,cfg80211))
  2884. +$(eval $(call KernelPackage,hermes))
  2885. +$(eval $(call KernelPackage,hermes-pci))
  2886. +$(eval $(call KernelPackage,hermes-plx))
  2887. +$(eval $(call KernelPackage,hermes-pcmcia))
  2888. +$(eval $(call KernelPackage,iwlwifi))
  2889. +$(eval $(call KernelPackage,iwl-legacy))
  2890. +$(eval $(call KernelPackage,iwl4965))
  2891. +$(eval $(call KernelPackage,iwl3945))
  2892. $(eval $(call KernelPackage,lib80211))
  2893. $(eval $(call KernelPackage,libertas-usb))
  2894. $(eval $(call KernelPackage,libertas-sdio))
  2895. -$(eval $(call KernelPackage,cfg80211))
  2896. +$(eval $(call KernelPackage,libipw))
  2897. +$(eval $(call KernelPackage,ipw2100))
  2898. +$(eval $(call KernelPackage,ipw2200))
  2899. $(eval $(call KernelPackage,mac80211))
  2900. +$(eval $(call KernelPackage,mac80211-hwsim))
  2901. +$(eval $(call KernelPackage,mt7601u))
  2902. +$(eval $(call KernelPackage,mwl8k))
  2903. +$(eval $(call KernelPackage,mwifiex-pcie))
  2904. $(eval $(call KernelPackage,p54-common))
  2905. $(eval $(call KernelPackage,p54-pci))
  2906. $(eval $(call KernelPackage,p54-usb))
  2907. @@ -2047,12 +2162,12 @@ $(eval $(call KernelPackage,rt2800-lib))
  2908. $(eval $(call KernelPackage,rt2400-pci))
  2909. $(eval $(call KernelPackage,rt2500-pci))
  2910. $(eval $(call KernelPackage,rt2500-usb))
  2911. -$(eval $(call KernelPackage,rt61-pci))
  2912. -$(eval $(call KernelPackage,rt73-usb))
  2913. $(eval $(call KernelPackage,rt2800-mmio))
  2914. $(eval $(call KernelPackage,rt2800-soc))
  2915. $(eval $(call KernelPackage,rt2800-pci))
  2916. $(eval $(call KernelPackage,rt2800-usb))
  2917. +$(eval $(call KernelPackage,rt61-pci))
  2918. +$(eval $(call KernelPackage,rt73-usb))
  2919. $(eval $(call KernelPackage,rtl8180))
  2920. $(eval $(call KernelPackage,rtl8187))
  2921. $(eval $(call KernelPackage,rtlwifi))
  2922. @@ -2063,32 +2178,7 @@ $(eval $(call KernelPackage,rtl8192ce))
  2923. $(eval $(call KernelPackage,rtl8192se))
  2924. $(eval $(call KernelPackage,rtl8192de))
  2925. $(eval $(call KernelPackage,rtl8192cu))
  2926. -$(eval $(call KernelPackage,zd1211rw))
  2927. -$(eval $(call KernelPackage,mac80211-hwsim))
  2928. -$(eval $(call KernelPackage,ath9k-common))
  2929. -$(eval $(call KernelPackage,ath9k))
  2930. -$(eval $(call KernelPackage,ath9k-htc))
  2931. -$(eval $(call KernelPackage,ath10k))
  2932. -$(eval $(call KernelPackage,ath))
  2933. -$(eval $(call KernelPackage,carl9170))
  2934. -$(eval $(call KernelPackage,b43))
  2935. -$(eval $(call KernelPackage,b43legacy))
  2936. -$(eval $(call KernelPackage,brcmutil))
  2937. -$(eval $(call KernelPackage,brcmsmac))
  2938. -$(eval $(call KernelPackage,brcmfmac))
  2939. -$(eval $(call KernelPackage,net-libipw))
  2940. -$(eval $(call KernelPackage,net-ipw2100))
  2941. -$(eval $(call KernelPackage,net-ipw2200))
  2942. -$(eval $(call KernelPackage,iwlagn))
  2943. -$(eval $(call KernelPackage,iwl-legacy))
  2944. -$(eval $(call KernelPackage,iwl4965))
  2945. -$(eval $(call KernelPackage,iwl3945))
  2946. -$(eval $(call KernelPackage,mwl8k))
  2947. -$(eval $(call KernelPackage,mwifiex-pcie))
  2948. -$(eval $(call KernelPackage,net-hermes))
  2949. -$(eval $(call KernelPackage,net-hermes-pci))
  2950. -$(eval $(call KernelPackage,net-hermes-plx))
  2951. -$(eval $(call KernelPackage,net-hermes-pcmcia))
  2952. $(eval $(call KernelPackage,wlcore))
  2953. $(eval $(call KernelPackage,wl12xx))
  2954. $(eval $(call KernelPackage,wl18xx))
  2955. +$(eval $(call KernelPackage,zd1211rw))
  2956. diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  2957. index 2852f3e..2a8d2f9 100644
  2958. --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  2959. +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  2960. @@ -486,7 +486,7 @@ mac80211_prepare_vif() {
  2961. # All interfaces must have unique mac addresses
  2962. # which can either be explicitly set in the device
  2963. # section, or automatically generated
  2964. - ifconfig "$ifname" hw ether "$macaddr"
  2965. + ip link set dev "$ifname" address "$macaddr"
  2966. fi
  2967. json_select ..
  2968. @@ -525,9 +525,6 @@ mac80211_setup_adhoc_htmode() {
  2969. esac
  2970. [ "$auto_channel" -gt 0 ] && ibss_htmode="HT40+"
  2971. ;;
  2972. - NONE|NOHT)
  2973. - ibss_htmode="NOHT"
  2974. - ;;
  2975. *) ibss_htmode="" ;;
  2976. esac
  2977. @@ -585,7 +582,7 @@ mac80211_setup_vif() {
  2978. json_get_vars mode
  2979. json_get_var vif_txpower txpower
  2980. - ifconfig "$ifname" up || {
  2981. + ip link set dev "$ifname" up || {
  2982. wireless_setup_vif_failed IFUP_ERROR
  2983. json_select ..
  2984. return
  2985. @@ -641,7 +638,7 @@ mac80211_interface_cleanup() {
  2986. local phy="$1"
  2987. for wdev in $(list_phy_interfaces "$phy"); do
  2988. - ifconfig "$wdev" down 2>/dev/null
  2989. + ip link set dev "$wdev" down 2>/dev/null
  2990. iw dev "$wdev" del
  2991. done
  2992. }
  2993. diff --git a/package/kernel/mac80211/files/regdb.txt b/package/kernel/mac80211/files/regdb.txt
  2994. index 463ace3..84413fd 100644
  2995. --- a/package/kernel/mac80211/files/regdb.txt
  2996. +++ b/package/kernel/mac80211/files/regdb.txt
  2997. @@ -2,7 +2,7 @@
  2998. country 00:
  2999. (2402 - 2472 @ 40), (20)
  3000. # Channel 12 - 13.
  3001. - (2457 - 2482 @ 20), (20), NO-IR, AUTO-BW
  3002. + (2457 - 2482 @ 40), (20), NO-IR
  3003. # Channel 14. Only JP enables this and for 802.11b only
  3004. (2474 - 2494 @ 20), (20), NO-IR, NO-OFDM
  3005. # Channel 36 - 48
  3006. @@ -22,7 +22,7 @@ country AD:
  3007. (5170 - 5250 @ 80), (20)
  3008. (5250 - 5330 @ 80), (20), DFS
  3009. (5490 - 5710 @ 80), (27), DFS
  3010. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3011. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3012. (57000 - 66000 @ 2160), (40)
  3013. country AE: DFS-FCC
  3014. @@ -82,7 +82,7 @@ country AT: DFS-ETSI
  3015. (5170 - 5250 @ 80), (20), AUTO-BW
  3016. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3017. (5490 - 5710 @ 160), (27), DFS
  3018. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3019. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3020. (57000 - 66000 @ 2160), (40)
  3021. country AU: DFS-ETSI
  3022. @@ -108,7 +108,7 @@ country BA: DFS-ETSI
  3023. (5170 - 5250 @ 80), (20), AUTO-BW
  3024. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3025. (5490 - 5710 @ 160), (27), DFS
  3026. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3027. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3028. (57000 - 66000 @ 2160), (40)
  3029. country BB: DFS-FCC
  3030. @@ -126,7 +126,7 @@ country BE: DFS-ETSI
  3031. (5170 - 5250 @ 80), (20), AUTO-BW
  3032. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3033. (5490 - 5710 @ 160), (27), DFS
  3034. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3035. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3036. (57000 - 66000 @ 2160), (40)
  3037. country BF: DFS-FCC
  3038. @@ -141,13 +141,13 @@ country BG: DFS-ETSI
  3039. (5170 - 5250 @ 80), (20), AUTO-BW
  3040. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3041. (5490 - 5710 @ 160), (27), DFS
  3042. - # 5 GHz Short Range Devices, ref:
  3043. + # 5 gHz Short Range Devices, ref:
  3044. # Etsi EN 300 440-1
  3045. # Etsi EN 300 440-2
  3046. # http://crc.bg/files/_bg/Spisak_2015.pdf
  3047. # http://crc.bg/files/_bg/Pravila_2015_resh24.pdf
  3048. (5725 - 5875 @ 80), (14)
  3049. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3050. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3051. (57000 - 66000 @ 2160), (40)
  3052. country BH: DFS-JP
  3053. @@ -216,8 +216,7 @@ country CA: DFS-FCC
  3054. (2402 - 2472 @ 40), (30)
  3055. (5170 - 5250 @ 80), (17), AUTO-BW
  3056. (5250 - 5330 @ 80), (24), DFS, AUTO-BW
  3057. - (5490 - 5600 @ 80), (24), DFS
  3058. - (5650 - 5730 @ 80), (24), DFS
  3059. + (5490 - 5730 @ 160), (24), DFS
  3060. (5735 - 5835 @ 80), (30)
  3061. # Source:
  3062. @@ -234,7 +233,7 @@ country CH: DFS-ETSI
  3063. (5170 - 5250 @ 80), (20), AUTO-BW
  3064. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3065. (5490 - 5710 @ 160), (27), DFS
  3066. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3067. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3068. (57000 - 66000 @ 2160), (40)
  3069. country CI: DFS-FCC
  3070. @@ -255,7 +254,7 @@ country CN: DFS-FCC
  3071. (5170 - 5250 @ 80), (23), AUTO-BW
  3072. (5250 - 5330 @ 80), (23), DFS, AUTO-BW
  3073. (5735 - 5835 @ 80), (30)
  3074. - # 60 GHz band channels 1,4: 28dBm, channels 2,3: 44dBm
  3075. + # 60 gHz band channels 1,4: 28dBm, channels 2,3: 44dBm
  3076. # ref: http://www.miit.gov.cn/n11293472/n11505629/n11506593/n11960250/n11960606/n11960700/n12330791.files/n12330790.pdf
  3077. (57240 - 59400 @ 2160), (28)
  3078. (59400 - 63720 @ 2160), (44)
  3079. @@ -287,7 +286,7 @@ country CY: DFS-ETSI
  3080. (5170 - 5250 @ 80), (20), AUTO-BW
  3081. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3082. (5490 - 5710 @ 160), (27), DFS
  3083. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3084. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3085. (57000 - 66000 @ 2160), (40)
  3086. # Data from http://www.ctu.eu/164/download/VOR/VOR-12-08-2005-34.pdf
  3087. @@ -299,7 +298,7 @@ country CZ: DFS-ETSI
  3088. (5150 - 5250 @ 80), (200 mW), NO-OUTDOOR, AUTO-BW
  3089. (5250 - 5350 @ 80), (100 mW), NO-OUTDOOR, DFS, AUTO-BW
  3090. (5470 - 5725 @ 160), (500 mW), DFS
  3091. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3092. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3093. (57000 - 66000 @ 2160), (40)
  3094. # Data from "Frequenznutzungsplan" (as published in April 2008), downloaded from
  3095. @@ -323,7 +322,7 @@ country DE: DFS-ETSI
  3096. (5250 - 5350 @ 80), (100 mW), NO-OUTDOOR, DFS, AUTO-BW
  3097. # entries 308002, 309001 and 310003
  3098. (5470 - 5725 @ 160), (500 mW), DFS
  3099. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3100. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3101. (57000 - 66000 @ 2160), (40)
  3102. country DK: DFS-ETSI
  3103. @@ -331,7 +330,7 @@ country DK: DFS-ETSI
  3104. (5170 - 5250 @ 80), (20), AUTO-BW
  3105. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3106. (5490 - 5710 @ 160), (27), DFS
  3107. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3108. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3109. (57000 - 66000 @ 2160), (40)
  3110. # Source:
  3111. @@ -366,7 +365,7 @@ country EE: DFS-ETSI
  3112. (5170 - 5250 @ 80), (20), AUTO-BW
  3113. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3114. (5490 - 5710 @ 160), (27), DFS
  3115. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3116. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3117. (57000 - 66000 @ 2160), (40)
  3118. country EG: DFS-ETSI
  3119. @@ -386,7 +385,7 @@ country ES: DFS-ETSI
  3120. (5150 - 5250 @ 80), (200 mW), NO-OUTDOOR, AUTO-BW
  3121. (5250 - 5350 @ 80), (100 mW), NO-OUTDOOR, DFS, AUTO-BW
  3122. (5470 - 5725 @ 160), (500 mW), DFS
  3123. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3124. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3125. (57000 - 66000 @ 2160), (40)
  3126. country ET: DFS-ETSI
  3127. @@ -396,11 +395,11 @@ country ET: DFS-ETSI
  3128. (5490 - 5710 @ 160), (27), DFS
  3129. country FI: DFS-ETSI
  3130. - (2400 - 2483.5 @ 40), (20)
  3131. - (5150 - 5250 @ 80), (23), NO-OUTDOOR, AUTO-BW
  3132. - (5250 - 5350 @ 80), (20), NO-OUTDOOR, DFS, AUTO-BW
  3133. - (5470 - 5725 @ 160), (27), DFS
  3134. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3135. + (2402 - 2482 @ 40), (20)
  3136. + (5170 - 5250 @ 80), (20), AUTO-BW
  3137. + (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3138. + (5490 - 5710 @ 160), (27), DFS
  3139. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3140. (57000 - 66000 @ 2160), (40)
  3141. country FM: DFS-FCC
  3142. @@ -415,7 +414,7 @@ country FR: DFS-ETSI
  3143. (5170 - 5250 @ 80), (20), AUTO-BW
  3144. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3145. (5490 - 5710 @ 160), (27), DFS
  3146. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3147. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3148. (57000 - 66000 @ 2160), (40)
  3149. country GB: DFS-ETSI
  3150. @@ -423,7 +422,7 @@ country GB: DFS-ETSI
  3151. (5170 - 5250 @ 80), (20), AUTO-BW
  3152. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3153. (5490 - 5710 @ 160), (27), DFS
  3154. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3155. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3156. (57000 - 66000 @ 2160), (40)
  3157. country GD: DFS-FCC
  3158. @@ -437,7 +436,7 @@ country GE: DFS-ETSI
  3159. (2402 - 2482 @ 40), (20)
  3160. (5170 - 5250 @ 80), (18), AUTO-BW
  3161. (5250 - 5330 @ 80), (18), DFS, AUTO-BW
  3162. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3163. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3164. (57000 - 66000 @ 2160), (40)
  3165. country GF: DFS-ETSI
  3166. @@ -455,9 +454,9 @@ country GH: DFS-FCC
  3167. country GL: DFS-ETSI
  3168. (2402 - 2482 @ 40), (20)
  3169. - (5170 - 5250 @ 80), (20), AUTO-BW
  3170. - (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3171. - (5490 - 5710 @ 160), (27), DFS
  3172. + (5170 - 5250 @ 80), (20)
  3173. + (5250 - 5330 @ 80), (20), DFS
  3174. + (5490 - 5710 @ 80), (27), DFS
  3175. country GP: DFS-ETSI
  3176. (2402 - 2482 @ 40), (20)
  3177. @@ -470,7 +469,7 @@ country GR: DFS-ETSI
  3178. (5170 - 5250 @ 80), (20), AUTO-BW
  3179. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3180. (5490 - 5710 @ 160), (27), DFS
  3181. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3182. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3183. (57000 - 66000 @ 2160), (40)
  3184. country GT: DFS-FCC
  3185. @@ -490,7 +489,7 @@ country GY:
  3186. (2402 - 2482 @ 40), (30)
  3187. (5735 - 5835 @ 80), (30)
  3188. -country HK: DFS-ETSI
  3189. +country HK:
  3190. (2402 - 2482 @ 40), (20)
  3191. (5170 - 5250 @ 80), (17), AUTO-BW
  3192. (5250 - 5330 @ 80), (24), DFS, AUTO-BW
  3193. @@ -505,11 +504,11 @@ country HN: DFS-FCC
  3194. (5735 - 5835 @ 80), (30)
  3195. country HR: DFS-ETSI
  3196. - (2400 - 2483.5 @ 40), (20)
  3197. - (5150 - 5250 @ 80), (23), NO-OUTDOOR, AUTO-BW
  3198. - (5250 - 5350 @ 80), (20), NO-OUTDOOR, DFS, AUTO-BW
  3199. - (5470 - 5725 @ 160), (27), DFS
  3200. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3201. + (2402 - 2482 @ 40), (20)
  3202. + (5170 - 5250 @ 80), (20), AUTO-BW
  3203. + (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3204. + (5490 - 5710 @ 160), (27), DFS
  3205. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3206. (57000 - 66000 @ 2160), (40)
  3207. country HT: DFS-FCC
  3208. @@ -524,7 +523,7 @@ country HU: DFS-ETSI
  3209. (5170 - 5250 @ 80), (20), AUTO-BW
  3210. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3211. (5490 - 5710 @ 160), (27), DFS
  3212. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3213. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3214. (57000 - 66000 @ 2160), (40)
  3215. country ID: DFS-JP
  3216. @@ -537,7 +536,7 @@ country IE: DFS-ETSI
  3217. (5170 - 5250 @ 80), (20), AUTO-BW
  3218. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3219. (5490 - 5710 @ 160), (27), DFS
  3220. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3221. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3222. (57000 - 66000 @ 2160), (40)
  3223. country IL: DFS-ETSI
  3224. @@ -560,7 +559,7 @@ country IS: DFS-ETSI
  3225. (5170 - 5250 @ 80), (20), AUTO-BW
  3226. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3227. (5490 - 5710 @ 160), (27), DFS
  3228. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3229. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3230. (57000 - 66000 @ 2160), (40)
  3231. country IT: DFS-ETSI
  3232. @@ -568,7 +567,7 @@ country IT: DFS-ETSI
  3233. (5170 - 5250 @ 80), (20), AUTO-BW
  3234. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3235. (5490 - 5710 @ 160), (27), DFS
  3236. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3237. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3238. (57000 - 66000 @ 2160), (40)
  3239. country JM: DFS-FCC
  3240. @@ -687,7 +686,7 @@ country LT: DFS-ETSI
  3241. (5170 - 5250 @ 80), (20), AUTO-BW
  3242. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3243. (5490 - 5710 @ 160), (27), DFS
  3244. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3245. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3246. (57000 - 66000 @ 2160), (40)
  3247. country LU: DFS-ETSI
  3248. @@ -695,7 +694,7 @@ country LU: DFS-ETSI
  3249. (5170 - 5250 @ 80), (20), AUTO-BW
  3250. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3251. (5490 - 5710 @ 160), (27), DFS
  3252. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3253. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3254. (57000 - 66000 @ 2160), (40)
  3255. country LV: DFS-ETSI
  3256. @@ -703,7 +702,7 @@ country LV: DFS-ETSI
  3257. (5170 - 5250 @ 80), (20), AUTO-BW
  3258. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3259. (5490 - 5710 @ 160), (27), DFS
  3260. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3261. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3262. (57000 - 66000 @ 2160), (40)
  3263. country MA: DFS-ETSI
  3264. @@ -751,7 +750,7 @@ country MK: DFS-ETSI
  3265. (5170 - 5250 @ 80), (20), AUTO-BW
  3266. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3267. (5490 - 5710 @ 160), (27), DFS
  3268. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3269. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3270. (57000 - 66000 @ 2160), (40)
  3271. country MN: DFS-FCC
  3272. @@ -794,7 +793,7 @@ country MT: DFS-ETSI
  3273. (5170 - 5250 @ 80), (20), AUTO-BW
  3274. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3275. (5490 - 5710 @ 160), (27), DFS
  3276. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3277. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3278. (57000 - 66000 @ 2160), (40)
  3279. country MU: DFS-FCC
  3280. @@ -827,10 +826,9 @@ country MX: DFS-FCC
  3281. country MY: DFS-FCC
  3282. (2402 - 2482 @ 40), (20)
  3283. - (5170 - 5250 @ 80), (24), AUTO-BW
  3284. - (5250 - 5330 @ 80), (24), DFS, AUTO-BW
  3285. - (5490 - 5650 @ 160), (24), DFS
  3286. - (5735 - 5835 @ 80), (24)
  3287. + (5170 - 5250 @ 80), (17), AUTO-BW
  3288. + (5250 - 5330 @ 80), (23), DFS, AUTO-BW
  3289. + (5735 - 5835 @ 80), (30)
  3290. country NG: DFS-ETSI
  3291. (2402 - 2482 @ 40), (20)
  3292. @@ -849,7 +847,7 @@ country NL: DFS-ETSI
  3293. (5170 - 5250 @ 80), (20), NO-OUTDOOR, AUTO-BW
  3294. (5250 - 5330 @ 80), (20), NO-OUTDOOR, DFS, AUTO-BW
  3295. (5490 - 5710 @ 160), (27), DFS
  3296. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3297. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3298. (57000 - 66000 @ 2160), (40)
  3299. # Data from http://www.lovdata.no/dokument/SF/forskrift/2012-01-19-77
  3300. @@ -864,7 +862,7 @@ country NO: DFS-ETSI
  3301. (5470 - 5795 @ 160), (500 mW), DFS
  3302. (5815 - 5850 @ 35), (2000 mW), DFS
  3303. (17100 - 17300 @ 200), (100 mW)
  3304. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3305. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3306. (57000 - 66000 @ 2160), (40)
  3307. country NP: DFS-JP
  3308. @@ -928,7 +926,7 @@ country PL: DFS-ETSI
  3309. (5170 - 5250 @ 80), (20), AUTO-BW
  3310. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3311. (5490 - 5710 @ 160), (27), DFS
  3312. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3313. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3314. (57000 - 66000 @ 2160), (40)
  3315. country PM: DFS-ETSI
  3316. @@ -949,7 +947,7 @@ country PT: DFS-ETSI
  3317. (5170 - 5250 @ 80), (20), AUTO-BW
  3318. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3319. (5490 - 5710 @ 160), (27), DFS
  3320. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3321. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3322. (57000 - 66000 @ 2160), (40)
  3323. country PW: DFS-FCC
  3324. @@ -981,7 +979,7 @@ country RO: DFS-ETSI
  3325. (5170 - 5250 @ 80), (20), AUTO-BW
  3326. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3327. (5490 - 5710 @ 160), (27), DFS
  3328. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3329. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3330. (57000 - 66000 @ 2160), (40)
  3331. @@ -991,15 +989,15 @@ country RS: DFS-ETSI
  3332. (2400 - 2483.5 @ 40), (100 mW)
  3333. (5150 - 5350 @ 40), (200 mW), NO-OUTDOOR
  3334. (5470 - 5725 @ 20), (1000 mW), DFS
  3335. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3336. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3337. (57000 - 66000 @ 2160), (40)
  3338. country RU: DFS-ETSI
  3339. (2402 - 2482 @ 40), (20)
  3340. - (5170 - 5250 @ 80), (20), AUTO-BW
  3341. - (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3342. - (5650 - 5730 @ 80), (30), DFS
  3343. - (5735 - 5835 @ 80), (30)
  3344. + (5170 - 5250 @ 40), (20)
  3345. + (5250 - 5330 @ 40), (20), DFS
  3346. + (5650 - 5730 @ 40), (30), DFS
  3347. + (5735 - 5835 @ 40), (30)
  3348. # 60 GHz band channels 1-4, ref: Changes to NLA 124_Order №129_22042015.pdf
  3349. (57000 - 66000 @ 2160), (40)
  3350. @@ -1021,7 +1019,7 @@ country SE: DFS-ETSI
  3351. (5170 - 5250 @ 80), (20), AUTO-BW
  3352. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3353. (5490 - 5710 @ 160), (27), DFS
  3354. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3355. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3356. (57000 - 66000 @ 2160), (40)
  3357. country SG: DFS-FCC
  3358. @@ -1036,7 +1034,7 @@ country SI: DFS-ETSI
  3359. (5170 - 5250 @ 80), (20), AUTO-BW
  3360. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3361. (5490 - 5710 @ 160), (27), DFS
  3362. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3363. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3364. (57000 - 66000 @ 2160), (40)
  3365. country SK: DFS-ETSI
  3366. @@ -1044,7 +1042,7 @@ country SK: DFS-ETSI
  3367. (5170 - 5250 @ 80), (20), AUTO-BW
  3368. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3369. (5490 - 5710 @ 160), (27), DFS
  3370. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3371. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3372. (57000 - 66000 @ 2160), (40)
  3373. # Source:
  3374. @@ -1109,7 +1107,7 @@ country TR: DFS-ETSI
  3375. (5170 - 5250 @ 80), (20), AUTO-BW
  3376. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3377. (5490 - 5710 @ 160), (27), DFS
  3378. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3379. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3380. (57000 - 66000 @ 2160), (40)
  3381. country TT: DFS-FCC
  3382. @@ -1119,20 +1117,12 @@ country TT: DFS-FCC
  3383. (5490 - 5730 @ 160), (24), DFS
  3384. (5735 - 5835 @ 80), (30)
  3385. -# Source:
  3386. -# Table of Frequency Allocations of Republic of China (Taiwan) / Nov 2014:
  3387. -# http://www.motc.gov.tw/websitedowndoc?file=post/201411171137330.doc& \
  3388. -# filedisplay=Table+of+radio+frequency+allocation.doc
  3389. -# LP0002 Low-power Radio-frequency Devices Technical Regulations / 28 Jun 2011:
  3390. -# http://www.ncc.gov.tw/english/show_file.aspx?table_name=news&file_sn=681
  3391. -# (section 3.10.1, 4.7)
  3392. -country TW: DFS-FCC
  3393. - (2400 - 2483.5 @ 40), (30)
  3394. - # Follow US 5.15 ~ 5.25 GHz: 30 dBm for master mode, 23 dBm for clients
  3395. - (5150 - 5250 @ 80), (23), AUTO-BW
  3396. - (5250 - 5350 @ 80), (23), DFS, AUTO-BW
  3397. - (5470 - 5725 @ 160), (23), DFS
  3398. - (5725 - 5850 @ 80), (30)
  3399. +country TW: DFS-JP
  3400. + (2402 - 2472 @ 40), (30)
  3401. + (5270 - 5330 @ 40), (17), DFS
  3402. + (5490 - 5590 @ 80), (30), DFS
  3403. + (5650 - 5710 @ 40), (30), DFS
  3404. + (5735 - 5835 @ 80), (30)
  3405. country TZ:
  3406. (2402 - 2482 @ 40), (20)
  3407. @@ -1147,11 +1137,10 @@ country TZ:
  3408. # disputable definitions there.
  3409. country UA: DFS-ETSI
  3410. (2400 - 2483.5 @ 40), (20), NO-OUTDOOR
  3411. - (5150 - 5250 @ 80), (20), NO-OUTDOOR, AUTO-BW
  3412. - (5250 - 5350 @ 80), (20), DFS, NO-OUTDOOR, AUTO-BW
  3413. - (5490 - 5670 @ 160), (20), DFS
  3414. + (5150 - 5350 @ 40), (20), NO-OUTDOOR
  3415. + (5490 - 5670 @ 80), (20), DFS
  3416. (5735 - 5835 @ 80), (20)
  3417. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  3418. + # 60 gHz band channels 1-4, ref: Etsi En 302 567
  3419. (57000 - 66000 @ 2160), (40)
  3420. country UG: DFS-FCC
  3421. @@ -1163,8 +1152,7 @@ country UG: DFS-FCC
  3422. country US: DFS-FCC
  3423. (2402 - 2472 @ 40), (30)
  3424. - # 5.15 ~ 5.25 GHz: 30 dBm for master mode, 23 dBm for clients
  3425. - (5170 - 5250 @ 80), (23), AUTO-BW
  3426. + (5170 - 5250 @ 80), (17), AUTO-BW
  3427. (5250 - 5330 @ 80), (23), DFS, AUTO-BW
  3428. (5490 - 5730 @ 160), (23), DFS
  3429. (5735 - 5835 @ 80), (30)
  3430. @@ -1175,8 +1163,9 @@ country US: DFS-FCC
  3431. country UY: DFS-FCC
  3432. (2402 - 2482 @ 40), (20)
  3433. - (5170 - 5250 @ 80), (23), AUTO-BW
  3434. - (5250 - 5330 @ 80), (23), DFS, AUTO-BW
  3435. + (5170 - 5250 @ 80), (17), AUTO-BW
  3436. + (5250 - 5330 @ 80), (24), DFS, AUTO-BW
  3437. + (5490 - 5730 @ 160), (24), DFS
  3438. (5735 - 5835 @ 80), (30)
  3439. # Source:
  3440. @@ -1252,7 +1241,7 @@ country ZA: DFS-ETSI
  3441. (2402 - 2482 @ 40), (20)
  3442. (5170 - 5250 @ 80), (20), AUTO-BW
  3443. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  3444. - (5490 - 5710 @ 160), (30)
  3445. + (5490 - 5710 @ 160), (27), DFS
  3446. country ZW: DFS-ETSI
  3447. (2402 - 2482 @ 40), (20)
  3448. diff --git a/package/kernel/mac80211/patches/001-fix_build.patch b/package/kernel/mac80211/patches/001-fix_build.patch
  3449. index 818983e..402649d 100644
  3450. --- a/package/kernel/mac80211/patches/001-fix_build.patch
  3451. +++ b/package/kernel/mac80211/patches/001-fix_build.patch
  3452. @@ -27,7 +27,7 @@
  3453. @set -e ; test -f .local-symbols || ( \
  3454. echo "/--------------" ;\
  3455. echo "| You shouldn't run make in the backports tree, but only in" ;\
  3456. -@@ -60,56 +62,60 @@ mrproper:
  3457. +@@ -60,57 +62,61 @@ mrproper:
  3458. echo "| (that isn't currently running.)" ;\
  3459. echo "\\--" ;\
  3460. false)
  3461. @@ -56,11 +56,12 @@
  3462. - done \
  3463. - ) > Kconfig.kernel ;\
  3464. - kver=$$($(MAKE) --no-print-directory -C $(KLIB_BUILD) kernelversion | \
  3465. -- sed 's/^\(\(3\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\
  3466. +- sed 's/^\(\([3-4]\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\
  3467. - test "$$kver" != "" || echo "Kernel version parse failed!" ;\
  3468. - test "$$kver" != "" ;\
  3469. - kvers="$$(seq 14 39 | sed 's/^/2.6./')" ;\
  3470. -- kvers="$$kvers $$(seq 0 99 | sed 's/^/3./')" ;\
  3471. +- kvers="$$kvers $$(seq 0 19 | sed 's/^/3./')" ;\
  3472. +- kvers="$$kvers $$(seq 0 99 | sed 's/^/4./')" ;\
  3473. - print=0 ;\
  3474. - for v in $$kvers ; do \
  3475. - if [ "$$print" = "1" ] ; then \
  3476. @@ -111,11 +112,12 @@
  3477. +
  3478. +Kconfig.versions: Kconfig.kernel
  3479. + @kver=$$($(MAKE) --no-print-directory -C $(KLIB_BUILD) kernelversion | \
  3480. -+ sed 's/^\(\(3\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\
  3481. ++ sed 's/^\(\([3-4]\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\
  3482. + test "$$kver" != "" || echo "Kernel version parse failed!" ;\
  3483. + test "$$kver" != "" ;\
  3484. + kvers="$$(seq 14 39 | sed 's/^/2.6./')" ;\
  3485. -+ kvers="$$kvers $$(seq 0 99 | sed 's/^/3./')" ;\
  3486. ++ kvers="$$kvers $$(seq 0 19 | sed 's/^/3./')" ;\
  3487. ++ kvers="$$kvers $$(seq 0 99 | sed 's/^/4./')" ;\
  3488. + print=0 ;\
  3489. + for v in $$kvers ; do \
  3490. + if [ "$$print" = "1" ] ; then \
  3491. diff --git a/package/kernel/mac80211/patches/004-backports_debugfs_fix.patch b/package/kernel/mac80211/patches/004-backports_debugfs_fix.patch
  3492. deleted file mode 100644
  3493. index d48a723..0000000
  3494. --- a/package/kernel/mac80211/patches/004-backports_debugfs_fix.patch
  3495. +++ /dev/null
  3496. @@ -1,10 +0,0 @@
  3497. ---- a/backport-include/linux/debugfs.h
  3498. -+++ b/backport-include/linux/debugfs.h
  3499. -@@ -3,6 +3,7 @@
  3500. - #include_next <linux/debugfs.h>
  3501. - #include <linux/version.h>
  3502. - #include <generated/utsrelease.h>
  3503. -+#include <linux/device.h>
  3504. -
  3505. - #if defined(CONFIG_DEBUG_FS)
  3506. - struct dentry *debugfs_create_devm_seqfile(struct device *dev, const char *name,
  3507. diff --git a/package/kernel/mac80211/patches/008-fix_netdev_unregister.patch b/package/kernel/mac80211/patches/008-fix_netdev_unregister.patch
  3508. deleted file mode 100644
  3509. index e07f323..0000000
  3510. --- a/package/kernel/mac80211/patches/008-fix_netdev_unregister.patch
  3511. +++ /dev/null
  3512. @@ -1,16 +0,0 @@
  3513. ---- a/net/mac80211/iface.c
  3514. -+++ b/net/mac80211/iface.c
  3515. -@@ -1858,6 +1858,13 @@ void ieee80211_remove_interfaces(struct
  3516. - }
  3517. - mutex_unlock(&local->iflist_mtx);
  3518. - unregister_netdevice_many(&unreg_list);
  3519. -+#if (!(LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,45) && \
  3520. -+ LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)) && \
  3521. -+ !(LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,9) && \
  3522. -+ LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0)) && \
  3523. -+ (LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)))
  3524. -+ list_del(&unreg_list);
  3525. -+#endif
  3526. -
  3527. - list_for_each_entry_safe(sdata, tmp, &wdev_list, list) {
  3528. - list_del(&sdata->list);
  3529. diff --git a/package/kernel/mac80211/patches/020-add_mpls_h.patch b/package/kernel/mac80211/patches/020-add_mpls_h.patch
  3530. deleted file mode 100644
  3531. index e5310bc..0000000
  3532. --- a/package/kernel/mac80211/patches/020-add_mpls_h.patch
  3533. +++ /dev/null
  3534. @@ -1,37 +0,0 @@
  3535. ---- /dev/null
  3536. -+++ b/include/uapi/linux/mpls.h
  3537. -@@ -0,0 +1,34 @@
  3538. -+#ifndef _UAPI_MPLS_H
  3539. -+#define _UAPI_MPLS_H
  3540. -+
  3541. -+#include <linux/types.h>
  3542. -+#include <asm/byteorder.h>
  3543. -+
  3544. -+/* Reference: RFC 5462, RFC 3032
  3545. -+ *
  3546. -+ * 0 1 2 3
  3547. -+ * 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
  3548. -+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  3549. -+ * | Label | TC |S| TTL |
  3550. -+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  3551. -+ *
  3552. -+ * Label: Label Value, 20 bits
  3553. -+ * TC: Traffic Class field, 3 bits
  3554. -+ * S: Bottom of Stack, 1 bit
  3555. -+ * TTL: Time to Live, 8 bits
  3556. -+ */
  3557. -+
  3558. -+struct mpls_label {
  3559. -+ __be32 entry;
  3560. -+};
  3561. -+
  3562. -+#define MPLS_LS_LABEL_MASK 0xFFFFF000
  3563. -+#define MPLS_LS_LABEL_SHIFT 12
  3564. -+#define MPLS_LS_TC_MASK 0x00000E00
  3565. -+#define MPLS_LS_TC_SHIFT 9
  3566. -+#define MPLS_LS_S_MASK 0x00000100
  3567. -+#define MPLS_LS_S_SHIFT 8
  3568. -+#define MPLS_LS_TTL_MASK 0x000000FF
  3569. -+#define MPLS_LS_TTL_SHIFT 0
  3570. -+
  3571. -+#endif /* _UAPI_MPLS_H */
  3572. diff --git a/package/kernel/mac80211/patches/020-backports-do-not-add-debugfs_create_devm_seqfile-on-.patch b/package/kernel/mac80211/patches/020-backports-do-not-add-debugfs_create_devm_seqfile-on-.patch
  3573. new file mode 100644
  3574. index 0000000..97f678c
  3575. --- /dev/null
  3576. +++ b/package/kernel/mac80211/patches/020-backports-do-not-add-debugfs_create_devm_seqfile-on-.patch
  3577. @@ -0,0 +1,33 @@
  3578. +From e15e9231e7a9f81f5264d294fd3fd96a20d92516 Mon Sep 17 00:00:00 2001
  3579. +From: Hauke Mehrtens <hauke@hauke-m.de>
  3580. +Date: Sat, 25 Jul 2015 15:19:17 +0200
  3581. +Subject: [PATCH 3/3] backports: do not add debugfs_create_devm_seqfile() on
  3582. + recent kernel versions
  3583. +
  3584. +An #ifdef for the kernel version was missing around the header of
  3585. +debugfs_create_devm_seqfile() and the LINUX_BACKPORT() was also not
  3586. +done.
  3587. +
  3588. +Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  3589. +---
  3590. + backport/backport-include/linux/debugfs.h | 3 +++
  3591. + 1 file changed, 3 insertions(+)
  3592. +
  3593. +--- a/backport-include/linux/debugfs.h
  3594. ++++ b/backport-include/linux/debugfs.h
  3595. +@@ -5,6 +5,8 @@
  3596. + #include <linux/device.h>
  3597. + #include <generated/utsrelease.h>
  3598. +
  3599. ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
  3600. ++#define debugfs_create_devm_seqfile LINUX_BACKPORT(debugfs_create_devm_seqfile)
  3601. + #if defined(CONFIG_DEBUG_FS)
  3602. + struct dentry *debugfs_create_devm_seqfile(struct device *dev, const char *name,
  3603. + struct dentry *parent,
  3604. +@@ -20,5 +22,6 @@ static inline struct dentry *debugfs_cre
  3605. + return ERR_PTR(-ENODEV);
  3606. + }
  3607. + #endif /* CONFIG_DEBUG_FS */
  3608. ++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) */
  3609. +
  3610. + #endif /* __BACKPORT_DEBUGFS_H_ */
  3611. diff --git a/package/kernel/mac80211/patches/045-bcma-from-4.1.patch b/package/kernel/mac80211/patches/045-bcma-from-4.1.patch
  3612. deleted file mode 100644
  3613. index dce217f..0000000
  3614. --- a/package/kernel/mac80211/patches/045-bcma-from-4.1.patch
  3615. +++ /dev/null
  3616. @@ -1,104 +0,0 @@
  3617. ---- a/drivers/bcma/driver_pci.c
  3618. -+++ b/drivers/bcma/driver_pci.c
  3619. -@@ -282,39 +282,6 @@ void bcma_core_pci_power_save(struct bcm
  3620. - }
  3621. - EXPORT_SYMBOL_GPL(bcma_core_pci_power_save);
  3622. -
  3623. --int bcma_core_pci_irq_ctl(struct bcma_bus *bus, struct bcma_device *core,
  3624. -- bool enable)
  3625. --{
  3626. -- struct pci_dev *pdev;
  3627. -- u32 coremask, tmp;
  3628. -- int err = 0;
  3629. --
  3630. -- if (bus->hosttype != BCMA_HOSTTYPE_PCI) {
  3631. -- /* This bcma device is not on a PCI host-bus. So the IRQs are
  3632. -- * not routed through the PCI core.
  3633. -- * So we must not enable routing through the PCI core. */
  3634. -- goto out;
  3635. -- }
  3636. --
  3637. -- pdev = bus->host_pci;
  3638. --
  3639. -- err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp);
  3640. -- if (err)
  3641. -- goto out;
  3642. --
  3643. -- coremask = BIT(core->core_index) << 8;
  3644. -- if (enable)
  3645. -- tmp |= coremask;
  3646. -- else
  3647. -- tmp &= ~coremask;
  3648. --
  3649. -- err = pci_write_config_dword(pdev, BCMA_PCI_IRQMASK, tmp);
  3650. --
  3651. --out:
  3652. -- return err;
  3653. --}
  3654. --EXPORT_SYMBOL_GPL(bcma_core_pci_irq_ctl);
  3655. --
  3656. - static void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend)
  3657. - {
  3658. - u32 w;
  3659. ---- a/drivers/bcma/host_pci.c
  3660. -+++ b/drivers/bcma/host_pci.c
  3661. -@@ -351,3 +351,37 @@ void bcma_host_pci_down(struct bcma_bus
  3662. - bcma_core_pci_down(&bus->drv_pci[0]);
  3663. - }
  3664. - EXPORT_SYMBOL_GPL(bcma_host_pci_down);
  3665. -+
  3666. -+/* See also si_pci_setup */
  3667. -+int bcma_host_pci_irq_ctl(struct bcma_bus *bus, struct bcma_device *core,
  3668. -+ bool enable)
  3669. -+{
  3670. -+ struct pci_dev *pdev;
  3671. -+ u32 coremask, tmp;
  3672. -+ int err = 0;
  3673. -+
  3674. -+ if (bus->hosttype != BCMA_HOSTTYPE_PCI) {
  3675. -+ /* This bcma device is not on a PCI host-bus. So the IRQs are
  3676. -+ * not routed through the PCI core.
  3677. -+ * So we must not enable routing through the PCI core. */
  3678. -+ goto out;
  3679. -+ }
  3680. -+
  3681. -+ pdev = bus->host_pci;
  3682. -+
  3683. -+ err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp);
  3684. -+ if (err)
  3685. -+ goto out;
  3686. -+
  3687. -+ coremask = BIT(core->core_index) << 8;
  3688. -+ if (enable)
  3689. -+ tmp |= coremask;
  3690. -+ else
  3691. -+ tmp &= ~coremask;
  3692. -+
  3693. -+ err = pci_write_config_dword(pdev, BCMA_PCI_IRQMASK, tmp);
  3694. -+
  3695. -+out:
  3696. -+ return err;
  3697. -+}
  3698. -+EXPORT_SYMBOL_GPL(bcma_host_pci_irq_ctl);
  3699. ---- a/drivers/net/wireless/b43/main.c
  3700. -+++ b/drivers/net/wireless/b43/main.c
  3701. -@@ -4866,7 +4866,7 @@ static int b43_wireless_core_init(struct
  3702. - switch (dev->dev->bus_type) {
  3703. - #ifdef CPTCFG_B43_BCMA
  3704. - case B43_BUS_BCMA:
  3705. -- bcma_core_pci_irq_ctl(dev->dev->bdev->bus,
  3706. -+ bcma_host_pci_irq_ctl(dev->dev->bdev->bus,
  3707. - dev->dev->bdev, true);
  3708. - bcma_host_pci_up(dev->dev->bdev->bus);
  3709. - break;
  3710. ---- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
  3711. -+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
  3712. -@@ -4959,7 +4959,7 @@ static int brcms_b_up_prep(struct brcms_
  3713. - * Configure pci/pcmcia here instead of in brcms_c_attach()
  3714. - * to allow mfg hotswap: down, hotswap (chip power cycle), up.
  3715. - */
  3716. -- bcma_core_pci_irq_ctl(wlc_hw->d11core->bus, wlc_hw->d11core,
  3717. -+ bcma_host_pci_irq_ctl(wlc_hw->d11core->bus, wlc_hw->d11core,
  3718. - true);
  3719. -
  3720. - /*
  3721. diff --git a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  3722. index d307949..4fbab23 100644
  3723. --- a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  3724. +++ b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  3725. @@ -1,6 +1,6 @@
  3726. --- a/.local-symbols
  3727. +++ b/.local-symbols
  3728. -@@ -344,40 +344,3 @@ USB_CDC_PHONET=
  3729. +@@ -449,43 +449,6 @@ USB_CDC_PHONET=
  3730. USB_IPHETH=
  3731. USB_SIERRA_NET=
  3732. USB_VL600=
  3733. @@ -32,26 +32,18 @@
  3734. -BCMA_BLOCKIO=
  3735. -BCMA_HOST_PCI_POSSIBLE=
  3736. -BCMA_HOST_PCI=
  3737. --BCMA_DRIVER_PCI_HOSTMODE=
  3738. -BCMA_HOST_SOC=
  3739. -BCMA_DRIVER_PCI=
  3740. +-BCMA_DRIVER_PCI_HOSTMODE=
  3741. -BCMA_DRIVER_MIPS=
  3742. -BCMA_SFLASH=
  3743. -BCMA_NFLASH=
  3744. -BCMA_DRIVER_GMAC_CMN=
  3745. -BCMA_DRIVER_GPIO=
  3746. -BCMA_DEBUG=
  3747. ---- a/Makefile.kernel
  3748. -+++ b/Makefile.kernel
  3749. -@@ -38,8 +38,6 @@ obj-$(CPTCFG_MAC80211) += net/mac80211/
  3750. - obj-$(CPTCFG_WLAN) += drivers/net/wireless/
  3751. - #obj-$(CPTCFG_BT) += net/bluetooth/
  3752. - #obj-$(CPTCFG_BT) += drivers/bluetooth/
  3753. --obj-$(CPTCFG_SSB) += drivers/ssb/
  3754. --obj-$(CPTCFG_BCMA) += drivers/bcma/
  3755. - #obj-$(CPTCFG_ETHERNET) += drivers/net/ethernet/
  3756. - obj-$(CPTCFG_USB_NET_RNDIS_WLAN) += drivers/net/usb/
  3757. - #obj-$(CPTCFG_NFC) += net/nfc/
  3758. + NFC=
  3759. + NFC_DIGITAL=
  3760. + NFC_NCI=
  3761. --- a/drivers/net/wireless/b43/main.c
  3762. +++ b/drivers/net/wireless/b43/main.c
  3763. @@ -2866,7 +2866,7 @@ static struct ssb_device *b43_ssb_gpio_d
  3764. @@ -63,7 +55,7 @@
  3765. return (bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev);
  3766. #else
  3767. return bus->chipco.dev;
  3768. -@@ -4907,7 +4907,7 @@ static int b43_wireless_core_init(struct
  3769. +@@ -4903,7 +4903,7 @@ static int b43_wireless_core_init(struct
  3770. }
  3771. if (sprom->boardflags_lo & B43_BFL_XTAL_NOSLOW)
  3772. hf |= B43_HF_DSCRQ; /* Disable slowclock requests from ucode. */
  3773. @@ -116,12 +108,23 @@
  3774. --- a/Kconfig.sources
  3775. +++ b/Kconfig.sources
  3776. @@ -9,9 +9,6 @@ source "$BACKPORT_DIR/drivers/net/wirele
  3777. - #source "$BACKPORT_DIR/drivers/net/ethernet/Kconfig"
  3778. + source "$BACKPORT_DIR/drivers/net/ethernet/Kconfig"
  3779. source "$BACKPORT_DIR/drivers/net/usb/Kconfig"
  3780. -source "$BACKPORT_DIR/drivers/ssb/Kconfig"
  3781. -source "$BACKPORT_DIR/drivers/bcma/Kconfig"
  3782. -
  3783. - #source "$BACKPORT_DIR/net/nfc/Kconfig"
  3784. + source "$BACKPORT_DIR/net/nfc/Kconfig"
  3785. - #source "$BACKPORT_DIR/drivers/media/Kconfig"
  3786. + source "$BACKPORT_DIR/drivers/media/Kconfig"
  3787. +--- a/Makefile.kernel
  3788. ++++ b/Makefile.kernel
  3789. +@@ -38,8 +38,6 @@ obj-$(CPTCFG_MAC80211) += net/mac80211/
  3790. + obj-$(CPTCFG_WLAN) += drivers/net/wireless/
  3791. + obj-$(CPTCFG_BT) += net/bluetooth/
  3792. + obj-$(CPTCFG_BT) += drivers/bluetooth/
  3793. +-obj-$(CPTCFG_SSB) += drivers/ssb/
  3794. +-obj-$(CPTCFG_BCMA) += drivers/bcma/
  3795. + obj-$(CPTCFG_ETHERNET) += drivers/net/ethernet/
  3796. + obj-$(CPTCFG_USB_NET_RNDIS_WLAN) += drivers/net/usb/
  3797. + obj-$(CPTCFG_NFC) += net/nfc/
  3798. 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
  3799. deleted file mode 100644
  3800. index 85c5280..0000000
  3801. --- a/package/kernel/mac80211/patches/090-linux_3_18_12_compat.patch
  3802. +++ /dev/null
  3803. @@ -1,29 +0,0 @@
  3804. ---- a/backport-include/linux/wait.h
  3805. -+++ b/backport-include/linux/wait.h
  3806. -@@ -23,7 +23,7 @@ backport_wait_on_bit_io(void *word, int
  3807. -
  3808. - #endif
  3809. -
  3810. --#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
  3811. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,12)
  3812. - #define WQ_FLAG_WOKEN 0x02
  3813. -
  3814. - #define wait_woken LINUX_BACKPORT(wait_woken)
  3815. ---- a/compat/backport-3.19.c
  3816. -+++ b/compat/backport-3.19.c
  3817. -@@ -15,6 +15,7 @@
  3818. - #include <linux/netdevice.h>
  3819. - #include <linux/debugfs.h>
  3820. -
  3821. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,12)
  3822. - static inline bool is_kthread_should_stop(void)
  3823. - {
  3824. - return (current->flags & PF_KTHREAD) && kthread_should_stop();
  3825. -@@ -79,6 +80,7 @@ int woken_wake_function(wait_queue_t *wa
  3826. - return default_wake_function(wait, mode, sync, key);
  3827. - }
  3828. - EXPORT_SYMBOL(woken_wake_function);
  3829. -+#endif
  3830. -
  3831. - #ifdef __BACKPORT_NETDEV_RSS_KEY_FILL
  3832. - u8 netdev_rss_key[NETDEV_RSS_KEY_LEN];
  3833. diff --git a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  3834. new file mode 100644
  3835. index 0000000..07dde54
  3836. --- /dev/null
  3837. +++ b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  3838. @@ -0,0 +1,376 @@
  3839. +--- a/net/mac80211/Kconfig
  3840. ++++ b/net/mac80211/Kconfig
  3841. +@@ -5,8 +5,6 @@ config MAC80211
  3842. + depends on CRYPTO
  3843. + depends on CRYPTO_ARC4
  3844. + depends on CRYPTO_AES
  3845. +- select BPAUTO_CRYPTO_CCM
  3846. +- depends on CRYPTO_GCM
  3847. + depends on CRC32
  3848. + select BPAUTO_AVERAGE
  3849. + ---help---
  3850. +--- a/net/mac80211/Makefile
  3851. ++++ b/net/mac80211/Makefile
  3852. +@@ -15,9 +15,7 @@ mac80211-y := \
  3853. + michael.o \
  3854. + tkip.o \
  3855. + aes_ccm.o \
  3856. +- aes_gcm.o \
  3857. + aes_cmac.o \
  3858. +- aes_gmac.o \
  3859. + cfg.o \
  3860. + ethtool.o \
  3861. + rx.o \
  3862. +--- a/net/mac80211/aes_ccm.c
  3863. ++++ b/net/mac80211/aes_ccm.c
  3864. +@@ -13,89 +13,132 @@
  3865. + #include <linux/types.h>
  3866. + #include <linux/err.h>
  3867. + #include <crypto/aead.h>
  3868. ++#include <crypto/aes.h>
  3869. +
  3870. + #include <net/mac80211.h>
  3871. + #include "key.h"
  3872. + #include "aes_ccm.h"
  3873. +
  3874. +-void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  3875. +- u8 *data, size_t data_len, u8 *mic,
  3876. +- size_t mic_len)
  3877. ++static void aes_ccm_prepare(struct crypto_cipher *tfm, u8 *b_0, u8 *aad, u8 *s_0,
  3878. ++ u8 *a, u8 *b)
  3879. + {
  3880. +- struct scatterlist sg[3];
  3881. ++ int i;
  3882. ++
  3883. ++ crypto_cipher_encrypt_one(tfm, b, b_0);
  3884. ++
  3885. ++ /* Extra Authenticate-only data (always two AES blocks) */
  3886. ++ for (i = 0; i < AES_BLOCK_SIZE; i++)
  3887. ++ aad[i] ^= b[i];
  3888. ++ crypto_cipher_encrypt_one(tfm, b, aad);
  3889. ++
  3890. ++ aad += AES_BLOCK_SIZE;
  3891. ++
  3892. ++ for (i = 0; i < AES_BLOCK_SIZE; i++)
  3893. ++ aad[i] ^= b[i];
  3894. ++ crypto_cipher_encrypt_one(tfm, a, aad);
  3895. +
  3896. +- char aead_req_data[sizeof(struct aead_request) +
  3897. +- crypto_aead_reqsize(tfm)]
  3898. +- __aligned(__alignof__(struct aead_request));
  3899. +- struct aead_request *aead_req = (void *) aead_req_data;
  3900. ++ /* Mask out bits from auth-only-b_0 */
  3901. ++ b_0[0] &= 0x07;
  3902. +
  3903. +- memset(aead_req, 0, sizeof(aead_req_data));
  3904. ++ /* S_0 is used to encrypt T (= MIC) */
  3905. ++ b_0[14] = 0;
  3906. ++ b_0[15] = 0;
  3907. ++ crypto_cipher_encrypt_one(tfm, s_0, b_0);
  3908. ++}
  3909. +
  3910. +- sg_init_table(sg, 3);
  3911. +- sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad));
  3912. +- sg_set_buf(&sg[1], data, data_len);
  3913. +- sg_set_buf(&sg[2], mic, mic_len);
  3914. +
  3915. +- aead_request_set_tfm(aead_req, tfm);
  3916. +- aead_request_set_crypt(aead_req, sg, sg, data_len, b_0);
  3917. +- aead_request_set_ad(aead_req, sg[0].length);
  3918. ++void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
  3919. ++ u8 *data, size_t data_len, u8 *mic,
  3920. ++ size_t mic_len)
  3921. ++{
  3922. ++ int i, j, last_len, num_blocks;
  3923. ++ u8 b[AES_BLOCK_SIZE];
  3924. ++ u8 s_0[AES_BLOCK_SIZE];
  3925. ++ u8 e[AES_BLOCK_SIZE];
  3926. ++ u8 *pos, *cpos;
  3927. ++
  3928. ++ num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
  3929. ++ last_len = data_len % AES_BLOCK_SIZE;
  3930. ++ aes_ccm_prepare(tfm, b_0, aad, s_0, b, b);
  3931. ++
  3932. ++ /* Process payload blocks */
  3933. ++ pos = data;
  3934. ++ cpos = data;
  3935. ++ for (j = 1; j <= num_blocks; j++) {
  3936. ++ int blen = (j == num_blocks && last_len) ?
  3937. ++ last_len : AES_BLOCK_SIZE;
  3938. ++
  3939. ++ /* Authentication followed by encryption */
  3940. ++ for (i = 0; i < blen; i++)
  3941. ++ b[i] ^= pos[i];
  3942. ++ crypto_cipher_encrypt_one(tfm, b, b);
  3943. ++
  3944. ++ b_0[14] = (j >> 8) & 0xff;
  3945. ++ b_0[15] = j & 0xff;
  3946. ++ crypto_cipher_encrypt_one(tfm, e, b_0);
  3947. ++ for (i = 0; i < blen; i++)
  3948. ++ *cpos++ = *pos++ ^ e[i];
  3949. ++ }
  3950. +
  3951. +- crypto_aead_encrypt(aead_req);
  3952. ++ for (i = 0; i < mic_len; i++)
  3953. ++ mic[i] = b[i] ^ s_0[i];
  3954. + }
  3955. +
  3956. +-int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  3957. ++int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
  3958. + u8 *data, size_t data_len, u8 *mic,
  3959. + size_t mic_len)
  3960. + {
  3961. +- struct scatterlist sg[3];
  3962. +- char aead_req_data[sizeof(struct aead_request) +
  3963. +- crypto_aead_reqsize(tfm)]
  3964. +- __aligned(__alignof__(struct aead_request));
  3965. +- struct aead_request *aead_req = (void *) aead_req_data;
  3966. +-
  3967. +- if (data_len == 0)
  3968. +- return -EINVAL;
  3969. +-
  3970. +- memset(aead_req, 0, sizeof(aead_req_data));
  3971. +-
  3972. +- sg_init_table(sg, 3);
  3973. +- sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad));
  3974. +- sg_set_buf(&sg[1], data, data_len);
  3975. +- sg_set_buf(&sg[2], mic, mic_len);
  3976. +-
  3977. +- aead_request_set_tfm(aead_req, tfm);
  3978. +- aead_request_set_crypt(aead_req, sg, sg, data_len + mic_len, b_0);
  3979. +- aead_request_set_ad(aead_req, sg[0].length);
  3980. ++ int i, j, last_len, num_blocks;
  3981. ++ u8 *pos, *cpos;
  3982. ++ u8 a[AES_BLOCK_SIZE];
  3983. ++ u8 b[AES_BLOCK_SIZE];
  3984. ++ u8 s_0[AES_BLOCK_SIZE];
  3985. ++
  3986. ++ num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
  3987. ++ last_len = data_len % AES_BLOCK_SIZE;
  3988. ++ aes_ccm_prepare(tfm, b_0, aad, s_0, a, b);
  3989. ++
  3990. ++ /* Process payload blocks */
  3991. ++ cpos = data;
  3992. ++ pos = data;
  3993. ++ for (j = 1; j <= num_blocks; j++) {
  3994. ++ int blen = (j == num_blocks && last_len) ?
  3995. ++ last_len : AES_BLOCK_SIZE;
  3996. ++
  3997. ++ /* Decryption followed by authentication */
  3998. ++ b_0[14] = (j >> 8) & 0xff;
  3999. ++ b_0[15] = j & 0xff;
  4000. ++ crypto_cipher_encrypt_one(tfm, b, b_0);
  4001. ++ for (i = 0; i < blen; i++) {
  4002. ++ *pos = *cpos++ ^ b[i];
  4003. ++ a[i] ^= *pos++;
  4004. ++ }
  4005. ++ crypto_cipher_encrypt_one(tfm, a, a);
  4006. ++ }
  4007. ++
  4008. ++ for (i = 0; i < mic_len; i++) {
  4009. ++ if ((mic[i] ^ s_0[i]) != a[i])
  4010. ++ return -1;
  4011. ++ }
  4012. +
  4013. +- return crypto_aead_decrypt(aead_req);
  4014. ++ return 0;
  4015. + }
  4016. +
  4017. +-struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[],
  4018. +- size_t key_len,
  4019. +- size_t mic_len)
  4020. ++struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[],
  4021. ++ size_t key_len,
  4022. ++ size_t mic_len)
  4023. + {
  4024. +- struct crypto_aead *tfm;
  4025. +- int err;
  4026. ++ struct crypto_cipher *tfm;
  4027. +
  4028. +- tfm = crypto_alloc_aead("ccm(aes)", 0, CRYPTO_ALG_ASYNC);
  4029. +- if (IS_ERR(tfm))
  4030. +- return tfm;
  4031. +-
  4032. +- err = crypto_aead_setkey(tfm, key, key_len);
  4033. +- if (err)
  4034. +- goto free_aead;
  4035. +- err = crypto_aead_setauthsize(tfm, mic_len);
  4036. +- if (err)
  4037. +- goto free_aead;
  4038. ++ tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
  4039. ++ if (!IS_ERR(tfm))
  4040. ++ crypto_cipher_setkey(tfm, key, key_len);
  4041. +
  4042. + return tfm;
  4043. +-
  4044. +-free_aead:
  4045. +- crypto_free_aead(tfm);
  4046. +- return ERR_PTR(err);
  4047. + }
  4048. +
  4049. +-void ieee80211_aes_key_free(struct crypto_aead *tfm)
  4050. ++
  4051. ++void ieee80211_aes_key_free(struct crypto_cipher *tfm)
  4052. + {
  4053. +- crypto_free_aead(tfm);
  4054. ++ crypto_free_cipher(tfm);
  4055. + }
  4056. +--- a/net/mac80211/aes_ccm.h
  4057. ++++ b/net/mac80211/aes_ccm.h
  4058. +@@ -12,15 +12,15 @@
  4059. +
  4060. + #include <linux/crypto.h>
  4061. +
  4062. +-struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[],
  4063. +- size_t key_len,
  4064. +- size_t mic_len);
  4065. +-void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  4066. ++struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[],
  4067. ++ size_t key_len,
  4068. ++ size_t mic_len);
  4069. ++void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
  4070. + u8 *data, size_t data_len, u8 *mic,
  4071. + size_t mic_len);
  4072. +-int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  4073. ++int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
  4074. + u8 *data, size_t data_len, u8 *mic,
  4075. + size_t mic_len);
  4076. +-void ieee80211_aes_key_free(struct crypto_aead *tfm);
  4077. ++void ieee80211_aes_key_free(struct crypto_cipher *tfm);
  4078. +
  4079. + #endif /* AES_CCM_H */
  4080. +--- a/net/mac80211/aes_gcm.h
  4081. ++++ b/net/mac80211/aes_gcm.h
  4082. +@@ -11,12 +11,28 @@
  4083. +
  4084. + #include <linux/crypto.h>
  4085. +
  4086. +-void ieee80211_aes_gcm_encrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  4087. +- u8 *data, size_t data_len, u8 *mic);
  4088. +-int ieee80211_aes_gcm_decrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  4089. +- u8 *data, size_t data_len, u8 *mic);
  4090. +-struct crypto_aead *ieee80211_aes_gcm_key_setup_encrypt(const u8 key[],
  4091. +- size_t key_len);
  4092. +-void ieee80211_aes_gcm_key_free(struct crypto_aead *tfm);
  4093. ++static inline void
  4094. ++ieee80211_aes_gcm_encrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  4095. ++ u8 *data, size_t data_len, u8 *mic)
  4096. ++{
  4097. ++}
  4098. ++
  4099. ++static inline int
  4100. ++ieee80211_aes_gcm_decrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  4101. ++ u8 *data, size_t data_len, u8 *mic)
  4102. ++{
  4103. ++ return -EOPNOTSUPP;
  4104. ++}
  4105. ++
  4106. ++static inline struct crypto_aead *
  4107. ++ieee80211_aes_gcm_key_setup_encrypt(const u8 key[], size_t key_len)
  4108. ++{
  4109. ++ return NULL;
  4110. ++}
  4111. ++
  4112. ++static inline void
  4113. ++ieee80211_aes_gcm_key_free(struct crypto_aead *tfm)
  4114. ++{
  4115. ++}
  4116. +
  4117. + #endif /* AES_GCM_H */
  4118. +--- a/net/mac80211/aes_gmac.h
  4119. ++++ b/net/mac80211/aes_gmac.h
  4120. +@@ -11,10 +11,22 @@
  4121. +
  4122. + #include <linux/crypto.h>
  4123. +
  4124. +-struct crypto_aead *ieee80211_aes_gmac_key_setup(const u8 key[],
  4125. +- size_t key_len);
  4126. +-int ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce,
  4127. +- const u8 *data, size_t data_len, u8 *mic);
  4128. +-void ieee80211_aes_gmac_key_free(struct crypto_aead *tfm);
  4129. ++static inline struct crypto_aead *
  4130. ++ieee80211_aes_gmac_key_setup(const u8 key[], size_t key_len)
  4131. ++{
  4132. ++ return NULL;
  4133. ++}
  4134. ++
  4135. ++static inline int
  4136. ++ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce,
  4137. ++ const u8 *data, size_t data_len, u8 *mic)
  4138. ++{
  4139. ++ return -EOPNOTSUPP;
  4140. ++}
  4141. ++
  4142. ++static inline void
  4143. ++ieee80211_aes_gmac_key_free(struct crypto_aead *tfm)
  4144. ++{
  4145. ++}
  4146. +
  4147. + #endif /* AES_GMAC_H */
  4148. +--- a/net/mac80211/key.h
  4149. ++++ b/net/mac80211/key.h
  4150. +@@ -84,7 +84,7 @@ struct ieee80211_key {
  4151. + * Management frames.
  4152. + */
  4153. + u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_CCMP_PN_LEN];
  4154. +- struct crypto_aead *tfm;
  4155. ++ struct crypto_cipher *tfm;
  4156. + u32 replays; /* dot11RSNAStatsCCMPReplays */
  4157. + } ccmp;
  4158. + struct {
  4159. +--- a/net/mac80211/wpa.c
  4160. ++++ b/net/mac80211/wpa.c
  4161. +@@ -304,7 +304,8 @@ ieee80211_crypto_tkip_decrypt(struct iee
  4162. + }
  4163. +
  4164. +
  4165. +-static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad)
  4166. ++static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad,
  4167. ++ u16 data_len)
  4168. + {
  4169. + __le16 mask_fc;
  4170. + int a4_included, mgmt;
  4171. +@@ -334,14 +335,8 @@ static void ccmp_special_blocks(struct s
  4172. + else
  4173. + qos_tid = 0;
  4174. +
  4175. +- /* In CCM, the initial vectors (IV) used for CTR mode encryption and CBC
  4176. +- * mode authentication are not allowed to collide, yet both are derived
  4177. +- * from this vector b_0. We only set L := 1 here to indicate that the
  4178. +- * data size can be represented in (L+1) bytes. The CCM layer will take
  4179. +- * care of storing the data length in the top (L+1) bytes and setting
  4180. +- * and clearing the other bits as is required to derive the two IVs.
  4181. +- */
  4182. +- b_0[0] = 0x1;
  4183. ++ /* First block, b_0 */
  4184. ++ b_0[0] = 0x59; /* flags: Adata: 1, M: 011, L: 001 */
  4185. +
  4186. + /* Nonce: Nonce Flags | A2 | PN
  4187. + * Nonce Flags: Priority (b0..b3) | Management (b4) | Reserved (b5..b7)
  4188. +@@ -349,6 +344,8 @@ static void ccmp_special_blocks(struct s
  4189. + b_0[1] = qos_tid | (mgmt << 4);
  4190. + memcpy(&b_0[2], hdr->addr2, ETH_ALEN);
  4191. + memcpy(&b_0[8], pn, IEEE80211_CCMP_PN_LEN);
  4192. ++ /* l(m) */
  4193. ++ put_unaligned_be16(data_len, &b_0[14]);
  4194. +
  4195. + /* AAD (extra authenticate-only data) / masked 802.11 header
  4196. + * FC | A1 | A2 | A3 | SC | [A4] | [QC] */
  4197. +@@ -460,7 +457,7 @@ static int ccmp_encrypt_skb(struct ieee8
  4198. + return 0;
  4199. +
  4200. + pos += IEEE80211_CCMP_HDR_LEN;
  4201. +- ccmp_special_blocks(skb, pn, b_0, aad);
  4202. ++ ccmp_special_blocks(skb, pn, b_0, aad, len);
  4203. + ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, b_0, aad, pos, len,
  4204. + skb_put(skb, mic_len), mic_len);
  4205. +
  4206. +@@ -531,7 +528,7 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  4207. + u8 aad[2 * AES_BLOCK_SIZE];
  4208. + u8 b_0[AES_BLOCK_SIZE];
  4209. + /* hardware didn't decrypt/verify MIC */
  4210. +- ccmp_special_blocks(skb, pn, b_0, aad);
  4211. ++ ccmp_special_blocks(skb, pn, b_0, aad, data_len);
  4212. +
  4213. + if (ieee80211_aes_ccm_decrypt(
  4214. + key->u.ccmp.tfm, b_0, aad,
  4215. diff --git a/package/kernel/mac80211/patches/100-revert-cryptoapi-ports.patch b/package/kernel/mac80211/patches/100-revert-cryptoapi-ports.patch
  4216. deleted file mode 100644
  4217. index ceca952..0000000
  4218. --- a/package/kernel/mac80211/patches/100-revert-cryptoapi-ports.patch
  4219. +++ /dev/null
  4220. @@ -1,2055 +0,0 @@
  4221. -This patch reverts the following commits from wireless-testing:
  4222. -
  4223. -8ade538bf39b1ee53418528fdacd36b8e65621b9
  4224. -56c52da2d554f081e8fce58ecbcf6a40c605b95b
  4225. -2b2ba0db1c820d04d5143452d70012cd44d7b578
  4226. -00b9cfa3ff38401bd70c34b250ca13e5ea347b4a
  4227. -4f031fa9f188b2b0641ac20087d9e16bcfb4e49d
  4228. -6e1ee5d2e9e411892b5d84e3ea93e3fc88ac786c
  4229. -30ef7ef9672d92ab2cac37f60a31955c118321e7
  4230. -f359d3fe832e49eeec2232b2af5a9e3aee6b4862 (only the changes in aes_cmac.{c,h})
  4231. -7ec7c4a9a686c608315739ab6a2b0527a240883c
  4232. ----
  4233. -
  4234. ---- a/include/linux/ieee80211.h
  4235. -+++ b/include/linux/ieee80211.h
  4236. -@@ -1017,15 +1017,6 @@ struct ieee80211_mmie {
  4237. - u8 mic[8];
  4238. - } __packed;
  4239. -
  4240. --/* Management MIC information element (IEEE 802.11w) for GMAC and CMAC-256 */
  4241. --struct ieee80211_mmie_16 {
  4242. -- u8 element_id;
  4243. -- u8 length;
  4244. -- __le16 key_id;
  4245. -- u8 sequence_number[6];
  4246. -- u8 mic[16];
  4247. --} __packed;
  4248. --
  4249. - struct ieee80211_vendor_ie {
  4250. - u8 element_id;
  4251. - u8 len;
  4252. ---- a/include/net/mac80211.h
  4253. -+++ b/include/net/mac80211.h
  4254. -@@ -1306,8 +1306,8 @@ struct ieee80211_vif *wdev_to_ieee80211_
  4255. - * @IEEE80211_KEY_FLAG_PAIRWISE: Set by mac80211, this flag indicates
  4256. - * that the key is pairwise rather then a shared key.
  4257. - * @IEEE80211_KEY_FLAG_SW_MGMT_TX: This flag should be set by the driver for a
  4258. -- * CCMP/GCMP key if it requires CCMP/GCMP encryption of management frames
  4259. -- * (MFP) to be done in software.
  4260. -+ * CCMP key if it requires CCMP encryption of management frames (MFP) to
  4261. -+ * be done in software.
  4262. - * @IEEE80211_KEY_FLAG_PUT_IV_SPACE: This flag should be set by the driver
  4263. - * if space should be prepared for the IV, but the IV
  4264. - * itself should not be generated. Do not set together with
  4265. -@@ -1322,7 +1322,7 @@ struct ieee80211_vif *wdev_to_ieee80211_
  4266. - * RX, if your crypto engine can't deal with TX you can also set the
  4267. - * %IEEE80211_KEY_FLAG_SW_MGMT_TX flag to encrypt such frames in SW.
  4268. - * @IEEE80211_KEY_FLAG_GENERATE_IV_MGMT: This flag should be set by the
  4269. -- * driver for a CCMP/GCMP key to indicate that is requires IV generation
  4270. -+ * driver for a CCMP key to indicate that is requires IV generation
  4271. - * only for managment frames (MFP).
  4272. - * @IEEE80211_KEY_FLAG_RESERVE_TAILROOM: This flag should be set by the
  4273. - * driver for a key to indicate that sufficient tailroom must always
  4274. -@@ -4112,10 +4112,6 @@ void ieee80211_aes_cmac_calculate_k1_k2(
  4275. - * reverse order than in packet)
  4276. - * @aes_cmac: PN data, most significant byte first (big endian,
  4277. - * reverse order than in packet)
  4278. -- * @aes_gmac: PN data, most significant byte first (big endian,
  4279. -- * reverse order than in packet)
  4280. -- * @gcmp: PN data, most significant byte first (big endian,
  4281. -- * reverse order than in packet)
  4282. - */
  4283. - struct ieee80211_key_seq {
  4284. - union {
  4285. -@@ -4129,12 +4125,6 @@ struct ieee80211_key_seq {
  4286. - struct {
  4287. - u8 pn[6];
  4288. - } aes_cmac;
  4289. -- struct {
  4290. -- u8 pn[6];
  4291. -- } aes_gmac;
  4292. -- struct {
  4293. -- u8 pn[6];
  4294. -- } gcmp;
  4295. - };
  4296. - };
  4297. -
  4298. -@@ -4159,7 +4149,7 @@ void ieee80211_get_key_tx_seq(struct iee
  4299. - * ieee80211_get_key_rx_seq - get key RX sequence counter
  4300. - *
  4301. - * @keyconf: the parameter passed with the set key
  4302. -- * @tid: The TID, or -1 for the management frame value (CCMP/GCMP only);
  4303. -+ * @tid: The TID, or -1 for the management frame value (CCMP only);
  4304. - * the value on TID 0 is also used for non-QoS frames. For
  4305. - * CMAC, only TID 0 is valid.
  4306. - * @seq: buffer to receive the sequence data
  4307. -@@ -4195,7 +4185,7 @@ void ieee80211_set_key_tx_seq(struct iee
  4308. - * ieee80211_set_key_rx_seq - set key RX sequence counter
  4309. - *
  4310. - * @keyconf: the parameter passed with the set key
  4311. -- * @tid: The TID, or -1 for the management frame value (CCMP/GCMP only);
  4312. -+ * @tid: The TID, or -1 for the management frame value (CCMP only);
  4313. - * the value on TID 0 is also used for non-QoS frames. For
  4314. - * CMAC, only TID 0 is valid.
  4315. - * @seq: new sequence data
  4316. ---- a/net/mac80211/Kconfig
  4317. -+++ b/net/mac80211/Kconfig
  4318. -@@ -5,8 +5,6 @@ config MAC80211
  4319. - depends on CRYPTO
  4320. - depends on CRYPTO_ARC4
  4321. - depends on CRYPTO_AES
  4322. -- select BPAUTO_CRYPTO_CCM
  4323. -- depends on CRYPTO_GCM
  4324. - depends on CRC32
  4325. - select BPAUTO_AVERAGE
  4326. - ---help---
  4327. ---- a/net/mac80211/Makefile
  4328. -+++ b/net/mac80211/Makefile
  4329. -@@ -15,9 +15,7 @@ mac80211-y := \
  4330. - michael.o \
  4331. - tkip.o \
  4332. - aes_ccm.o \
  4333. -- aes_gcm.o \
  4334. - aes_cmac.o \
  4335. -- aes_gmac.o \
  4336. - cfg.o \
  4337. - ethtool.o \
  4338. - rx.o \
  4339. ---- a/net/mac80211/aes_ccm.c
  4340. -+++ b/net/mac80211/aes_ccm.c
  4341. -@@ -2,8 +2,6 @@
  4342. - * Copyright 2003-2004, Instant802 Networks, Inc.
  4343. - * Copyright 2005-2006, Devicescape Software, Inc.
  4344. - *
  4345. -- * Rewrite: Copyright (C) 2013 Linaro Ltd <ard.biesheuvel@linaro.org>
  4346. -- *
  4347. - * This program is free software; you can redistribute it and/or modify
  4348. - * it under the terms of the GNU General Public License version 2 as
  4349. - * published by the Free Software Foundation.
  4350. -@@ -19,82 +17,134 @@
  4351. - #include "key.h"
  4352. - #include "aes_ccm.h"
  4353. -
  4354. --void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  4355. -- u8 *data, size_t data_len, u8 *mic,
  4356. -- size_t mic_len)
  4357. -+static void aes_ccm_prepare(struct crypto_cipher *tfm, u8 *scratch, u8 *a)
  4358. -+{
  4359. -+ int i;
  4360. -+ u8 *b_0, *aad, *b, *s_0;
  4361. -+
  4362. -+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
  4363. -+ aad = scratch + 4 * AES_BLOCK_SIZE;
  4364. -+ b = scratch;
  4365. -+ s_0 = scratch + AES_BLOCK_SIZE;
  4366. -+
  4367. -+ crypto_cipher_encrypt_one(tfm, b, b_0);
  4368. -+
  4369. -+ /* Extra Authenticate-only data (always two AES blocks) */
  4370. -+ for (i = 0; i < AES_BLOCK_SIZE; i++)
  4371. -+ aad[i] ^= b[i];
  4372. -+ crypto_cipher_encrypt_one(tfm, b, aad);
  4373. -+
  4374. -+ aad += AES_BLOCK_SIZE;
  4375. -+
  4376. -+ for (i = 0; i < AES_BLOCK_SIZE; i++)
  4377. -+ aad[i] ^= b[i];
  4378. -+ crypto_cipher_encrypt_one(tfm, a, aad);
  4379. -+
  4380. -+ /* Mask out bits from auth-only-b_0 */
  4381. -+ b_0[0] &= 0x07;
  4382. -+
  4383. -+ /* S_0 is used to encrypt T (= MIC) */
  4384. -+ b_0[14] = 0;
  4385. -+ b_0[15] = 0;
  4386. -+ crypto_cipher_encrypt_one(tfm, s_0, b_0);
  4387. -+}
  4388. -+
  4389. -+
  4390. -+void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch,
  4391. -+ u8 *data, size_t data_len,
  4392. -+ u8 *cdata, u8 *mic)
  4393. - {
  4394. -- struct scatterlist assoc, pt, ct[2];
  4395. -+ int i, j, last_len, num_blocks;
  4396. -+ u8 *pos, *cpos, *b, *s_0, *e, *b_0;
  4397. -
  4398. -- char aead_req_data[sizeof(struct aead_request) +
  4399. -- crypto_aead_reqsize(tfm)]
  4400. -- __aligned(__alignof__(struct aead_request));
  4401. -- struct aead_request *aead_req = (void *) aead_req_data;
  4402. --
  4403. -- memset(aead_req, 0, sizeof(aead_req_data));
  4404. --
  4405. -- sg_init_one(&pt, data, data_len);
  4406. -- sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad));
  4407. -- sg_init_table(ct, 2);
  4408. -- sg_set_buf(&ct[0], data, data_len);
  4409. -- sg_set_buf(&ct[1], mic, mic_len);
  4410. --
  4411. -- aead_request_set_tfm(aead_req, tfm);
  4412. -- aead_request_set_assoc(aead_req, &assoc, assoc.length);
  4413. -- aead_request_set_crypt(aead_req, &pt, ct, data_len, b_0);
  4414. -+ b = scratch;
  4415. -+ s_0 = scratch + AES_BLOCK_SIZE;
  4416. -+ e = scratch + 2 * AES_BLOCK_SIZE;
  4417. -+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
  4418. -+
  4419. -+ num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
  4420. -+ last_len = data_len % AES_BLOCK_SIZE;
  4421. -+ aes_ccm_prepare(tfm, scratch, b);
  4422. -+
  4423. -+ /* Process payload blocks */
  4424. -+ pos = data;
  4425. -+ cpos = cdata;
  4426. -+ for (j = 1; j <= num_blocks; j++) {
  4427. -+ int blen = (j == num_blocks && last_len) ?
  4428. -+ last_len : AES_BLOCK_SIZE;
  4429. -+
  4430. -+ /* Authentication followed by encryption */
  4431. -+ for (i = 0; i < blen; i++)
  4432. -+ b[i] ^= pos[i];
  4433. -+ crypto_cipher_encrypt_one(tfm, b, b);
  4434. -+
  4435. -+ b_0[14] = (j >> 8) & 0xff;
  4436. -+ b_0[15] = j & 0xff;
  4437. -+ crypto_cipher_encrypt_one(tfm, e, b_0);
  4438. -+ for (i = 0; i < blen; i++)
  4439. -+ *cpos++ = *pos++ ^ e[i];
  4440. -+ }
  4441. -
  4442. -- crypto_aead_encrypt(aead_req);
  4443. -+ for (i = 0; i < IEEE80211_CCMP_MIC_LEN; i++)
  4444. -+ mic[i] = b[i] ^ s_0[i];
  4445. - }
  4446. -
  4447. --int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  4448. -- u8 *data, size_t data_len, u8 *mic,
  4449. -- size_t mic_len)
  4450. -+
  4451. -+int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *scratch,
  4452. -+ u8 *cdata, size_t data_len, u8 *mic, u8 *data)
  4453. - {
  4454. -- struct scatterlist assoc, pt, ct[2];
  4455. -- char aead_req_data[sizeof(struct aead_request) +
  4456. -- crypto_aead_reqsize(tfm)]
  4457. -- __aligned(__alignof__(struct aead_request));
  4458. -- struct aead_request *aead_req = (void *) aead_req_data;
  4459. --
  4460. -- if (data_len == 0)
  4461. -- return -EINVAL;
  4462. --
  4463. -- memset(aead_req, 0, sizeof(aead_req_data));
  4464. --
  4465. -- sg_init_one(&pt, data, data_len);
  4466. -- sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad));
  4467. -- sg_init_table(ct, 2);
  4468. -- sg_set_buf(&ct[0], data, data_len);
  4469. -- sg_set_buf(&ct[1], mic, mic_len);
  4470. --
  4471. -- aead_request_set_tfm(aead_req, tfm);
  4472. -- aead_request_set_assoc(aead_req, &assoc, assoc.length);
  4473. -- aead_request_set_crypt(aead_req, ct, &pt, data_len + mic_len, b_0);
  4474. -+ int i, j, last_len, num_blocks;
  4475. -+ u8 *pos, *cpos, *b, *s_0, *a, *b_0;
  4476. -+
  4477. -+ b = scratch;
  4478. -+ s_0 = scratch + AES_BLOCK_SIZE;
  4479. -+ a = scratch + 2 * AES_BLOCK_SIZE;
  4480. -+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
  4481. -+
  4482. -+ num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
  4483. -+ last_len = data_len % AES_BLOCK_SIZE;
  4484. -+ aes_ccm_prepare(tfm, scratch, a);
  4485. -+
  4486. -+ /* Process payload blocks */
  4487. -+ cpos = cdata;
  4488. -+ pos = data;
  4489. -+ for (j = 1; j <= num_blocks; j++) {
  4490. -+ int blen = (j == num_blocks && last_len) ?
  4491. -+ last_len : AES_BLOCK_SIZE;
  4492. -+
  4493. -+ /* Decryption followed by authentication */
  4494. -+ b_0[14] = (j >> 8) & 0xff;
  4495. -+ b_0[15] = j & 0xff;
  4496. -+ crypto_cipher_encrypt_one(tfm, b, b_0);
  4497. -+ for (i = 0; i < blen; i++) {
  4498. -+ *pos = *cpos++ ^ b[i];
  4499. -+ a[i] ^= *pos++;
  4500. -+ }
  4501. -+ crypto_cipher_encrypt_one(tfm, a, a);
  4502. -+ }
  4503. -+
  4504. -+ for (i = 0; i < IEEE80211_CCMP_MIC_LEN; i++) {
  4505. -+ if ((mic[i] ^ s_0[i]) != a[i])
  4506. -+ return -1;
  4507. -+ }
  4508. -
  4509. -- return crypto_aead_decrypt(aead_req);
  4510. -+ return 0;
  4511. - }
  4512. -
  4513. --struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[],
  4514. -- size_t key_len,
  4515. -- size_t mic_len)
  4516. -+
  4517. -+struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[])
  4518. - {
  4519. -- struct crypto_aead *tfm;
  4520. -- int err;
  4521. -+ struct crypto_cipher *tfm;
  4522. -
  4523. -- tfm = crypto_alloc_aead("ccm(aes)", 0, CRYPTO_ALG_ASYNC);
  4524. -- if (IS_ERR(tfm))
  4525. -- return tfm;
  4526. --
  4527. -- err = crypto_aead_setkey(tfm, key, key_len);
  4528. -- if (!err)
  4529. -- err = crypto_aead_setauthsize(tfm, mic_len);
  4530. -- if (!err)
  4531. -- return tfm;
  4532. -+ tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
  4533. -+ if (!IS_ERR(tfm))
  4534. -+ crypto_cipher_setkey(tfm, key, WLAN_KEY_LEN_CCMP);
  4535. -
  4536. -- crypto_free_aead(tfm);
  4537. -- return ERR_PTR(err);
  4538. -+ return tfm;
  4539. - }
  4540. -
  4541. --void ieee80211_aes_key_free(struct crypto_aead *tfm)
  4542. -+
  4543. -+void ieee80211_aes_key_free(struct crypto_cipher *tfm)
  4544. - {
  4545. -- crypto_free_aead(tfm);
  4546. -+ crypto_free_cipher(tfm);
  4547. - }
  4548. ---- a/net/mac80211/aes_ccm.h
  4549. -+++ b/net/mac80211/aes_ccm.h
  4550. -@@ -12,15 +12,13 @@
  4551. -
  4552. - #include <linux/crypto.h>
  4553. -
  4554. --struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[],
  4555. -- size_t key_len,
  4556. -- size_t mic_len);
  4557. --void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  4558. -- u8 *data, size_t data_len, u8 *mic,
  4559. -- size_t mic_len);
  4560. --int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  4561. -- u8 *data, size_t data_len, u8 *mic,
  4562. -- size_t mic_len);
  4563. --void ieee80211_aes_key_free(struct crypto_aead *tfm);
  4564. -+struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[]);
  4565. -+void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch,
  4566. -+ u8 *data, size_t data_len,
  4567. -+ u8 *cdata, u8 *mic);
  4568. -+int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *scratch,
  4569. -+ u8 *cdata, size_t data_len,
  4570. -+ u8 *mic, u8 *data);
  4571. -+void ieee80211_aes_key_free(struct crypto_cipher *tfm);
  4572. -
  4573. - #endif /* AES_CCM_H */
  4574. ---- a/net/mac80211/aes_cmac.c
  4575. -+++ b/net/mac80211/aes_cmac.c
  4576. -@@ -18,8 +18,8 @@
  4577. - #include "key.h"
  4578. - #include "aes_cmac.h"
  4579. -
  4580. -+#define AES_CMAC_KEY_LEN 16
  4581. - #define CMAC_TLEN 8 /* CMAC TLen = 64 bits (8 octets) */
  4582. --#define CMAC_TLEN_256 16 /* CMAC TLen = 128 bits (16 octets) */
  4583. - #define AAD_LEN 20
  4584. -
  4585. -
  4586. -@@ -35,9 +35,9 @@ static void gf_mulx(u8 *pad)
  4587. - pad[AES_BLOCK_SIZE - 1] ^= 0x87;
  4588. - }
  4589. -
  4590. --static void aes_cmac_vector(struct crypto_cipher *tfm, size_t num_elem,
  4591. -- const u8 *addr[], const size_t *len, u8 *mac,
  4592. -- size_t mac_len)
  4593. -+
  4594. -+static void aes_128_cmac_vector(struct crypto_cipher *tfm, size_t num_elem,
  4595. -+ const u8 *addr[], const size_t *len, u8 *mac)
  4596. - {
  4597. - u8 cbc[AES_BLOCK_SIZE], pad[AES_BLOCK_SIZE];
  4598. - const u8 *pos, *end;
  4599. -@@ -88,7 +88,7 @@ static void aes_cmac_vector(struct crypt
  4600. - for (i = 0; i < AES_BLOCK_SIZE; i++)
  4601. - pad[i] ^= cbc[i];
  4602. - crypto_cipher_encrypt_one(tfm, pad, pad);
  4603. -- memcpy(mac, pad, mac_len);
  4604. -+ memcpy(mac, pad, CMAC_TLEN);
  4605. - }
  4606. -
  4607. -
  4608. -@@ -107,35 +107,17 @@ void ieee80211_aes_cmac(struct crypto_ci
  4609. - addr[2] = zero;
  4610. - len[2] = CMAC_TLEN;
  4611. -
  4612. -- aes_cmac_vector(tfm, 3, addr, len, mic, CMAC_TLEN);
  4613. -+ aes_128_cmac_vector(tfm, 3, addr, len, mic);
  4614. - }
  4615. -
  4616. --void ieee80211_aes_cmac_256(struct crypto_cipher *tfm, const u8 *aad,
  4617. -- const u8 *data, size_t data_len, u8 *mic)
  4618. --{
  4619. -- const u8 *addr[3];
  4620. -- size_t len[3];
  4621. -- u8 zero[CMAC_TLEN_256];
  4622. --
  4623. -- memset(zero, 0, CMAC_TLEN_256);
  4624. -- addr[0] = aad;
  4625. -- len[0] = AAD_LEN;
  4626. -- addr[1] = data;
  4627. -- len[1] = data_len - CMAC_TLEN_256;
  4628. -- addr[2] = zero;
  4629. -- len[2] = CMAC_TLEN_256;
  4630. --
  4631. -- aes_cmac_vector(tfm, 3, addr, len, mic, CMAC_TLEN_256);
  4632. --}
  4633. -
  4634. --struct crypto_cipher *ieee80211_aes_cmac_key_setup(const u8 key[],
  4635. -- size_t key_len)
  4636. -+struct crypto_cipher * ieee80211_aes_cmac_key_setup(const u8 key[])
  4637. - {
  4638. - struct crypto_cipher *tfm;
  4639. -
  4640. - tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
  4641. - if (!IS_ERR(tfm))
  4642. -- crypto_cipher_setkey(tfm, key, key_len);
  4643. -+ crypto_cipher_setkey(tfm, key, AES_CMAC_KEY_LEN);
  4644. -
  4645. - return tfm;
  4646. - }
  4647. ---- a/net/mac80211/aes_cmac.h
  4648. -+++ b/net/mac80211/aes_cmac.h
  4649. -@@ -11,12 +11,9 @@
  4650. -
  4651. - #include <linux/crypto.h>
  4652. -
  4653. --struct crypto_cipher *ieee80211_aes_cmac_key_setup(const u8 key[],
  4654. -- size_t key_len);
  4655. -+struct crypto_cipher * ieee80211_aes_cmac_key_setup(const u8 key[]);
  4656. - void ieee80211_aes_cmac(struct crypto_cipher *tfm, const u8 *aad,
  4657. - const u8 *data, size_t data_len, u8 *mic);
  4658. --void ieee80211_aes_cmac_256(struct crypto_cipher *tfm, const u8 *aad,
  4659. -- const u8 *data, size_t data_len, u8 *mic);
  4660. - void ieee80211_aes_cmac_key_free(struct crypto_cipher *tfm);
  4661. -
  4662. - #endif /* AES_CMAC_H */
  4663. ---- a/net/mac80211/aes_gcm.c
  4664. -+++ /dev/null
  4665. -@@ -1,95 +0,0 @@
  4666. --/*
  4667. -- * Copyright 2014-2015, Qualcomm Atheros, Inc.
  4668. -- *
  4669. -- * This program is free software; you can redistribute it and/or modify
  4670. -- * it under the terms of the GNU General Public License version 2 as
  4671. -- * published by the Free Software Foundation.
  4672. -- */
  4673. --
  4674. --#include <linux/kernel.h>
  4675. --#include <linux/types.h>
  4676. --#include <linux/crypto.h>
  4677. --#include <linux/err.h>
  4678. --#include <crypto/aes.h>
  4679. --
  4680. --#include <net/mac80211.h>
  4681. --#include "key.h"
  4682. --#include "aes_gcm.h"
  4683. --
  4684. --void ieee80211_aes_gcm_encrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  4685. -- u8 *data, size_t data_len, u8 *mic)
  4686. --{
  4687. -- struct scatterlist assoc, pt, ct[2];
  4688. --
  4689. -- char aead_req_data[sizeof(struct aead_request) +
  4690. -- crypto_aead_reqsize(tfm)]
  4691. -- __aligned(__alignof__(struct aead_request));
  4692. -- struct aead_request *aead_req = (void *)aead_req_data;
  4693. --
  4694. -- memset(aead_req, 0, sizeof(aead_req_data));
  4695. --
  4696. -- sg_init_one(&pt, data, data_len);
  4697. -- sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad));
  4698. -- sg_init_table(ct, 2);
  4699. -- sg_set_buf(&ct[0], data, data_len);
  4700. -- sg_set_buf(&ct[1], mic, IEEE80211_GCMP_MIC_LEN);
  4701. --
  4702. -- aead_request_set_tfm(aead_req, tfm);
  4703. -- aead_request_set_assoc(aead_req, &assoc, assoc.length);
  4704. -- aead_request_set_crypt(aead_req, &pt, ct, data_len, j_0);
  4705. --
  4706. -- crypto_aead_encrypt(aead_req);
  4707. --}
  4708. --
  4709. --int ieee80211_aes_gcm_decrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  4710. -- u8 *data, size_t data_len, u8 *mic)
  4711. --{
  4712. -- struct scatterlist assoc, pt, ct[2];
  4713. -- char aead_req_data[sizeof(struct aead_request) +
  4714. -- crypto_aead_reqsize(tfm)]
  4715. -- __aligned(__alignof__(struct aead_request));
  4716. -- struct aead_request *aead_req = (void *)aead_req_data;
  4717. --
  4718. -- if (data_len == 0)
  4719. -- return -EINVAL;
  4720. --
  4721. -- memset(aead_req, 0, sizeof(aead_req_data));
  4722. --
  4723. -- sg_init_one(&pt, data, data_len);
  4724. -- sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad));
  4725. -- sg_init_table(ct, 2);
  4726. -- sg_set_buf(&ct[0], data, data_len);
  4727. -- sg_set_buf(&ct[1], mic, IEEE80211_GCMP_MIC_LEN);
  4728. --
  4729. -- aead_request_set_tfm(aead_req, tfm);
  4730. -- aead_request_set_assoc(aead_req, &assoc, assoc.length);
  4731. -- aead_request_set_crypt(aead_req, ct, &pt,
  4732. -- data_len + IEEE80211_GCMP_MIC_LEN, j_0);
  4733. --
  4734. -- return crypto_aead_decrypt(aead_req);
  4735. --}
  4736. --
  4737. --struct crypto_aead *ieee80211_aes_gcm_key_setup_encrypt(const u8 key[],
  4738. -- size_t key_len)
  4739. --{
  4740. -- struct crypto_aead *tfm;
  4741. -- int err;
  4742. --
  4743. -- tfm = crypto_alloc_aead("gcm(aes)", 0, CRYPTO_ALG_ASYNC);
  4744. -- if (IS_ERR(tfm))
  4745. -- return tfm;
  4746. --
  4747. -- err = crypto_aead_setkey(tfm, key, key_len);
  4748. -- if (!err)
  4749. -- err = crypto_aead_setauthsize(tfm, IEEE80211_GCMP_MIC_LEN);
  4750. -- if (!err)
  4751. -- return tfm;
  4752. --
  4753. -- crypto_free_aead(tfm);
  4754. -- return ERR_PTR(err);
  4755. --}
  4756. --
  4757. --void ieee80211_aes_gcm_key_free(struct crypto_aead *tfm)
  4758. --{
  4759. -- crypto_free_aead(tfm);
  4760. --}
  4761. ---- a/net/mac80211/aes_gcm.h
  4762. -+++ /dev/null
  4763. -@@ -1,22 +0,0 @@
  4764. --/*
  4765. -- * Copyright 2014-2015, Qualcomm Atheros, Inc.
  4766. -- *
  4767. -- * This program is free software; you can redistribute it and/or modify
  4768. -- * it under the terms of the GNU General Public License version 2 as
  4769. -- * published by the Free Software Foundation.
  4770. -- */
  4771. --
  4772. --#ifndef AES_GCM_H
  4773. --#define AES_GCM_H
  4774. --
  4775. --#include <linux/crypto.h>
  4776. --
  4777. --void ieee80211_aes_gcm_encrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  4778. -- u8 *data, size_t data_len, u8 *mic);
  4779. --int ieee80211_aes_gcm_decrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
  4780. -- u8 *data, size_t data_len, u8 *mic);
  4781. --struct crypto_aead *ieee80211_aes_gcm_key_setup_encrypt(const u8 key[],
  4782. -- size_t key_len);
  4783. --void ieee80211_aes_gcm_key_free(struct crypto_aead *tfm);
  4784. --
  4785. --#endif /* AES_GCM_H */
  4786. ---- a/net/mac80211/aes_gmac.c
  4787. -+++ /dev/null
  4788. -@@ -1,84 +0,0 @@
  4789. --/*
  4790. -- * AES-GMAC for IEEE 802.11 BIP-GMAC-128 and BIP-GMAC-256
  4791. -- * Copyright 2015, Qualcomm Atheros, Inc.
  4792. -- *
  4793. -- * This program is free software; you can redistribute it and/or modify
  4794. -- * it under the terms of the GNU General Public License version 2 as
  4795. -- * published by the Free Software Foundation.
  4796. -- */
  4797. --
  4798. --#include <linux/kernel.h>
  4799. --#include <linux/types.h>
  4800. --#include <linux/crypto.h>
  4801. --#include <linux/err.h>
  4802. --#include <crypto/aes.h>
  4803. --
  4804. --#include <net/mac80211.h>
  4805. --#include "key.h"
  4806. --#include "aes_gmac.h"
  4807. --
  4808. --#define GMAC_MIC_LEN 16
  4809. --#define GMAC_NONCE_LEN 12
  4810. --#define AAD_LEN 20
  4811. --
  4812. --int ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce,
  4813. -- const u8 *data, size_t data_len, u8 *mic)
  4814. --{
  4815. -- struct scatterlist sg[3], ct[1];
  4816. -- char aead_req_data[sizeof(struct aead_request) +
  4817. -- crypto_aead_reqsize(tfm)]
  4818. -- __aligned(__alignof__(struct aead_request));
  4819. -- struct aead_request *aead_req = (void *)aead_req_data;
  4820. -- u8 zero[GMAC_MIC_LEN], iv[AES_BLOCK_SIZE];
  4821. --
  4822. -- if (data_len < GMAC_MIC_LEN)
  4823. -- return -EINVAL;
  4824. --
  4825. -- memset(aead_req, 0, sizeof(aead_req_data));
  4826. --
  4827. -- memset(zero, 0, GMAC_MIC_LEN);
  4828. -- sg_init_table(sg, 3);
  4829. -- sg_set_buf(&sg[0], aad, AAD_LEN);
  4830. -- sg_set_buf(&sg[1], data, data_len - GMAC_MIC_LEN);
  4831. -- sg_set_buf(&sg[2], zero, GMAC_MIC_LEN);
  4832. --
  4833. -- memcpy(iv, nonce, GMAC_NONCE_LEN);
  4834. -- memset(iv + GMAC_NONCE_LEN, 0, sizeof(iv) - GMAC_NONCE_LEN);
  4835. -- iv[AES_BLOCK_SIZE - 1] = 0x01;
  4836. --
  4837. -- sg_init_table(ct, 1);
  4838. -- sg_set_buf(&ct[0], mic, GMAC_MIC_LEN);
  4839. --
  4840. -- aead_request_set_tfm(aead_req, tfm);
  4841. -- aead_request_set_assoc(aead_req, sg, AAD_LEN + data_len);
  4842. -- aead_request_set_crypt(aead_req, NULL, ct, 0, iv);
  4843. --
  4844. -- crypto_aead_encrypt(aead_req);
  4845. --
  4846. -- return 0;
  4847. --}
  4848. --
  4849. --struct crypto_aead *ieee80211_aes_gmac_key_setup(const u8 key[],
  4850. -- size_t key_len)
  4851. --{
  4852. -- struct crypto_aead *tfm;
  4853. -- int err;
  4854. --
  4855. -- tfm = crypto_alloc_aead("gcm(aes)", 0, CRYPTO_ALG_ASYNC);
  4856. -- if (IS_ERR(tfm))
  4857. -- return tfm;
  4858. --
  4859. -- err = crypto_aead_setkey(tfm, key, key_len);
  4860. -- if (!err)
  4861. -- return tfm;
  4862. -- if (!err)
  4863. -- err = crypto_aead_setauthsize(tfm, GMAC_MIC_LEN);
  4864. --
  4865. -- crypto_free_aead(tfm);
  4866. -- return ERR_PTR(err);
  4867. --}
  4868. --
  4869. --void ieee80211_aes_gmac_key_free(struct crypto_aead *tfm)
  4870. --{
  4871. -- crypto_free_aead(tfm);
  4872. --}
  4873. ---- a/net/mac80211/aes_gmac.h
  4874. -+++ /dev/null
  4875. -@@ -1,20 +0,0 @@
  4876. --/*
  4877. -- * Copyright 2015, Qualcomm Atheros, Inc.
  4878. -- *
  4879. -- * This program is free software; you can redistribute it and/or modify
  4880. -- * it under the terms of the GNU General Public License version 2 as
  4881. -- * published by the Free Software Foundation.
  4882. -- */
  4883. --
  4884. --#ifndef AES_GMAC_H
  4885. --#define AES_GMAC_H
  4886. --
  4887. --#include <linux/crypto.h>
  4888. --
  4889. --struct crypto_aead *ieee80211_aes_gmac_key_setup(const u8 key[],
  4890. -- size_t key_len);
  4891. --int ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce,
  4892. -- const u8 *data, size_t data_len, u8 *mic);
  4893. --void ieee80211_aes_gmac_key_free(struct crypto_aead *tfm);
  4894. --
  4895. --#endif /* AES_GMAC_H */
  4896. ---- a/net/mac80211/cfg.c
  4897. -+++ b/net/mac80211/cfg.c
  4898. -@@ -162,13 +162,8 @@ static int ieee80211_add_key(struct wiph
  4899. - return -EINVAL;
  4900. - break;
  4901. - case WLAN_CIPHER_SUITE_CCMP:
  4902. -- case WLAN_CIPHER_SUITE_CCMP_256:
  4903. - case WLAN_CIPHER_SUITE_AES_CMAC:
  4904. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  4905. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  4906. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  4907. - case WLAN_CIPHER_SUITE_GCMP:
  4908. -- case WLAN_CIPHER_SUITE_GCMP_256:
  4909. - break;
  4910. - default:
  4911. - cs = ieee80211_cs_get(local, params->cipher, sdata->vif.type);
  4912. -@@ -353,7 +348,6 @@ static int ieee80211_get_key(struct wiph
  4913. - params.seq_len = 6;
  4914. - break;
  4915. - case WLAN_CIPHER_SUITE_CCMP:
  4916. -- case WLAN_CIPHER_SUITE_CCMP_256:
  4917. - pn64 = atomic64_read(&key->u.ccmp.tx_pn);
  4918. - seq[0] = pn64;
  4919. - seq[1] = pn64 >> 8;
  4920. -@@ -365,35 +359,10 @@ static int ieee80211_get_key(struct wiph
  4921. - params.seq_len = 6;
  4922. - break;
  4923. - case WLAN_CIPHER_SUITE_AES_CMAC:
  4924. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  4925. - pn64 = atomic64_read(&key->u.aes_cmac.tx_pn);
  4926. - seq[0] = pn64;
  4927. - seq[1] = pn64 >> 8;
  4928. - seq[2] = pn64 >> 16;
  4929. -- seq[3] = pn64 >> 24;
  4930. -- seq[4] = pn64 >> 32;
  4931. -- seq[5] = pn64 >> 40;
  4932. -- params.seq = seq;
  4933. -- params.seq_len = 6;
  4934. -- break;
  4935. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  4936. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  4937. -- pn64 = atomic64_read(&key->u.aes_gmac.tx_pn);
  4938. -- seq[0] = pn64;
  4939. -- seq[1] = pn64 >> 8;
  4940. -- seq[2] = pn64 >> 16;
  4941. -- seq[3] = pn64 >> 24;
  4942. -- seq[4] = pn64 >> 32;
  4943. -- seq[5] = pn64 >> 40;
  4944. -- params.seq = seq;
  4945. -- params.seq_len = 6;
  4946. -- break;
  4947. -- case WLAN_CIPHER_SUITE_GCMP:
  4948. -- case WLAN_CIPHER_SUITE_GCMP_256:
  4949. -- pn64 = atomic64_read(&key->u.gcmp.tx_pn);
  4950. -- seq[0] = pn64;
  4951. -- seq[1] = pn64 >> 8;
  4952. -- seq[2] = pn64 >> 16;
  4953. - seq[3] = pn64 >> 24;
  4954. - seq[4] = pn64 >> 32;
  4955. - seq[5] = pn64 >> 40;
  4956. ---- a/net/mac80211/debugfs_key.c
  4957. -+++ b/net/mac80211/debugfs_key.c
  4958. -@@ -94,33 +94,17 @@ static ssize_t key_tx_spec_read(struct f
  4959. - key->u.tkip.tx.iv16);
  4960. - break;
  4961. - case WLAN_CIPHER_SUITE_CCMP:
  4962. -- case WLAN_CIPHER_SUITE_CCMP_256:
  4963. - pn = atomic64_read(&key->u.ccmp.tx_pn);
  4964. - len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n",
  4965. - (u8)(pn >> 40), (u8)(pn >> 32), (u8)(pn >> 24),
  4966. - (u8)(pn >> 16), (u8)(pn >> 8), (u8)pn);
  4967. - break;
  4968. - case WLAN_CIPHER_SUITE_AES_CMAC:
  4969. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  4970. - pn = atomic64_read(&key->u.aes_cmac.tx_pn);
  4971. - len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n",
  4972. - (u8)(pn >> 40), (u8)(pn >> 32), (u8)(pn >> 24),
  4973. - (u8)(pn >> 16), (u8)(pn >> 8), (u8)pn);
  4974. - break;
  4975. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  4976. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  4977. -- pn = atomic64_read(&key->u.aes_gmac.tx_pn);
  4978. -- len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n",
  4979. -- (u8)(pn >> 40), (u8)(pn >> 32), (u8)(pn >> 24),
  4980. -- (u8)(pn >> 16), (u8)(pn >> 8), (u8)pn);
  4981. -- break;
  4982. -- case WLAN_CIPHER_SUITE_GCMP:
  4983. -- case WLAN_CIPHER_SUITE_GCMP_256:
  4984. -- pn = atomic64_read(&key->u.gcmp.tx_pn);
  4985. -- len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n",
  4986. -- (u8)(pn >> 40), (u8)(pn >> 32), (u8)(pn >> 24),
  4987. -- (u8)(pn >> 16), (u8)(pn >> 8), (u8)pn);
  4988. -- break;
  4989. - default:
  4990. - return 0;
  4991. - }
  4992. -@@ -150,7 +134,6 @@ static ssize_t key_rx_spec_read(struct f
  4993. - len = p - buf;
  4994. - break;
  4995. - case WLAN_CIPHER_SUITE_CCMP:
  4996. -- case WLAN_CIPHER_SUITE_CCMP_256:
  4997. - for (i = 0; i < IEEE80211_NUM_TIDS + 1; i++) {
  4998. - rpn = key->u.ccmp.rx_pn[i];
  4999. - p += scnprintf(p, sizeof(buf)+buf-p,
  5000. -@@ -161,7 +144,6 @@ static ssize_t key_rx_spec_read(struct f
  5001. - len = p - buf;
  5002. - break;
  5003. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5004. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5005. - rpn = key->u.aes_cmac.rx_pn;
  5006. - p += scnprintf(p, sizeof(buf)+buf-p,
  5007. - "%02x%02x%02x%02x%02x%02x\n",
  5008. -@@ -169,26 +151,6 @@ static ssize_t key_rx_spec_read(struct f
  5009. - rpn[3], rpn[4], rpn[5]);
  5010. - len = p - buf;
  5011. - break;
  5012. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5013. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5014. -- rpn = key->u.aes_gmac.rx_pn;
  5015. -- p += scnprintf(p, sizeof(buf)+buf-p,
  5016. -- "%02x%02x%02x%02x%02x%02x\n",
  5017. -- rpn[0], rpn[1], rpn[2],
  5018. -- rpn[3], rpn[4], rpn[5]);
  5019. -- len = p - buf;
  5020. -- break;
  5021. -- case WLAN_CIPHER_SUITE_GCMP:
  5022. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5023. -- for (i = 0; i < IEEE80211_NUM_TIDS + 1; i++) {
  5024. -- rpn = key->u.gcmp.rx_pn[i];
  5025. -- p += scnprintf(p, sizeof(buf)+buf-p,
  5026. -- "%02x%02x%02x%02x%02x%02x\n",
  5027. -- rpn[0], rpn[1], rpn[2],
  5028. -- rpn[3], rpn[4], rpn[5]);
  5029. -- }
  5030. -- len = p - buf;
  5031. -- break;
  5032. - default:
  5033. - return 0;
  5034. - }
  5035. -@@ -205,23 +167,12 @@ static ssize_t key_replays_read(struct f
  5036. -
  5037. - switch (key->conf.cipher) {
  5038. - case WLAN_CIPHER_SUITE_CCMP:
  5039. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5040. - len = scnprintf(buf, sizeof(buf), "%u\n", key->u.ccmp.replays);
  5041. - break;
  5042. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5043. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5044. - len = scnprintf(buf, sizeof(buf), "%u\n",
  5045. - key->u.aes_cmac.replays);
  5046. - break;
  5047. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5048. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5049. -- len = scnprintf(buf, sizeof(buf), "%u\n",
  5050. -- key->u.aes_gmac.replays);
  5051. -- break;
  5052. -- case WLAN_CIPHER_SUITE_GCMP:
  5053. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5054. -- len = scnprintf(buf, sizeof(buf), "%u\n", key->u.gcmp.replays);
  5055. -- break;
  5056. - default:
  5057. - return 0;
  5058. - }
  5059. -@@ -238,15 +189,9 @@ static ssize_t key_icverrors_read(struct
  5060. -
  5061. - switch (key->conf.cipher) {
  5062. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5063. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5064. - len = scnprintf(buf, sizeof(buf), "%u\n",
  5065. - key->u.aes_cmac.icverrors);
  5066. - break;
  5067. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5068. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5069. -- len = scnprintf(buf, sizeof(buf), "%u\n",
  5070. -- key->u.aes_gmac.icverrors);
  5071. -- break;
  5072. - default:
  5073. - return 0;
  5074. - }
  5075. ---- a/net/mac80211/key.c
  5076. -+++ b/net/mac80211/key.c
  5077. -@@ -24,8 +24,6 @@
  5078. - #include "debugfs_key.h"
  5079. - #include "aes_ccm.h"
  5080. - #include "aes_cmac.h"
  5081. --#include "aes_gmac.h"
  5082. --#include "aes_gcm.h"
  5083. -
  5084. -
  5085. - /**
  5086. -@@ -164,13 +162,7 @@ static int ieee80211_key_enable_hw_accel
  5087. - case WLAN_CIPHER_SUITE_WEP104:
  5088. - case WLAN_CIPHER_SUITE_TKIP:
  5089. - case WLAN_CIPHER_SUITE_CCMP:
  5090. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5091. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5092. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5093. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5094. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5095. -- case WLAN_CIPHER_SUITE_GCMP:
  5096. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5097. - /* all of these we can do in software - if driver can */
  5098. - if (ret == 1)
  5099. - return 0;
  5100. -@@ -394,26 +386,7 @@ ieee80211_key_alloc(u32 cipher, int idx,
  5101. - * Initialize AES key state here as an optimization so that
  5102. - * it does not need to be initialized for every packet.
  5103. - */
  5104. -- key->u.ccmp.tfm = ieee80211_aes_key_setup_encrypt(
  5105. -- key_data, key_len, IEEE80211_CCMP_MIC_LEN);
  5106. -- if (IS_ERR(key->u.ccmp.tfm)) {
  5107. -- err = PTR_ERR(key->u.ccmp.tfm);
  5108. -- kfree(key);
  5109. -- return ERR_PTR(err);
  5110. -- }
  5111. -- break;
  5112. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5113. -- key->conf.iv_len = IEEE80211_CCMP_256_HDR_LEN;
  5114. -- key->conf.icv_len = IEEE80211_CCMP_256_MIC_LEN;
  5115. -- for (i = 0; seq && i < IEEE80211_NUM_TIDS + 1; i++)
  5116. -- for (j = 0; j < IEEE80211_CCMP_256_PN_LEN; j++)
  5117. -- key->u.ccmp.rx_pn[i][j] =
  5118. -- seq[IEEE80211_CCMP_256_PN_LEN - j - 1];
  5119. -- /* Initialize AES key state here as an optimization so that
  5120. -- * it does not need to be initialized for every packet.
  5121. -- */
  5122. -- key->u.ccmp.tfm = ieee80211_aes_key_setup_encrypt(
  5123. -- key_data, key_len, IEEE80211_CCMP_256_MIC_LEN);
  5124. -+ key->u.ccmp.tfm = ieee80211_aes_key_setup_encrypt(key_data);
  5125. - if (IS_ERR(key->u.ccmp.tfm)) {
  5126. - err = PTR_ERR(key->u.ccmp.tfm);
  5127. - kfree(key);
  5128. -@@ -421,12 +394,8 @@ ieee80211_key_alloc(u32 cipher, int idx,
  5129. - }
  5130. - break;
  5131. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5132. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5133. - key->conf.iv_len = 0;
  5134. -- if (cipher == WLAN_CIPHER_SUITE_AES_CMAC)
  5135. -- key->conf.icv_len = sizeof(struct ieee80211_mmie);
  5136. -- else
  5137. -- key->conf.icv_len = sizeof(struct ieee80211_mmie_16);
  5138. -+ key->conf.icv_len = sizeof(struct ieee80211_mmie);
  5139. - if (seq)
  5140. - for (j = 0; j < IEEE80211_CMAC_PN_LEN; j++)
  5141. - key->u.aes_cmac.rx_pn[j] =
  5142. -@@ -436,51 +405,13 @@ ieee80211_key_alloc(u32 cipher, int idx,
  5143. - * it does not need to be initialized for every packet.
  5144. - */
  5145. - key->u.aes_cmac.tfm =
  5146. -- ieee80211_aes_cmac_key_setup(key_data, key_len);
  5147. -+ ieee80211_aes_cmac_key_setup(key_data);
  5148. - if (IS_ERR(key->u.aes_cmac.tfm)) {
  5149. - err = PTR_ERR(key->u.aes_cmac.tfm);
  5150. - kfree(key);
  5151. - return ERR_PTR(err);
  5152. - }
  5153. - break;
  5154. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5155. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5156. -- key->conf.iv_len = 0;
  5157. -- key->conf.icv_len = sizeof(struct ieee80211_mmie_16);
  5158. -- if (seq)
  5159. -- for (j = 0; j < IEEE80211_GMAC_PN_LEN; j++)
  5160. -- key->u.aes_gmac.rx_pn[j] =
  5161. -- seq[IEEE80211_GMAC_PN_LEN - j - 1];
  5162. -- /* Initialize AES key state here as an optimization so that
  5163. -- * it does not need to be initialized for every packet.
  5164. -- */
  5165. -- key->u.aes_gmac.tfm =
  5166. -- ieee80211_aes_gmac_key_setup(key_data, key_len);
  5167. -- if (IS_ERR(key->u.aes_gmac.tfm)) {
  5168. -- err = PTR_ERR(key->u.aes_gmac.tfm);
  5169. -- kfree(key);
  5170. -- return ERR_PTR(err);
  5171. -- }
  5172. -- break;
  5173. -- case WLAN_CIPHER_SUITE_GCMP:
  5174. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5175. -- key->conf.iv_len = IEEE80211_GCMP_HDR_LEN;
  5176. -- key->conf.icv_len = IEEE80211_GCMP_MIC_LEN;
  5177. -- for (i = 0; seq && i < IEEE80211_NUM_TIDS + 1; i++)
  5178. -- for (j = 0; j < IEEE80211_GCMP_PN_LEN; j++)
  5179. -- key->u.gcmp.rx_pn[i][j] =
  5180. -- seq[IEEE80211_GCMP_PN_LEN - j - 1];
  5181. -- /* Initialize AES key state here as an optimization so that
  5182. -- * it does not need to be initialized for every packet.
  5183. -- */
  5184. -- key->u.gcmp.tfm = ieee80211_aes_gcm_key_setup_encrypt(key_data,
  5185. -- key_len);
  5186. -- if (IS_ERR(key->u.gcmp.tfm)) {
  5187. -- err = PTR_ERR(key->u.gcmp.tfm);
  5188. -- kfree(key);
  5189. -- return ERR_PTR(err);
  5190. -- }
  5191. -- break;
  5192. - default:
  5193. - if (cs) {
  5194. - size_t len = (seq_len > MAX_PN_LEN) ?
  5195. -@@ -502,24 +433,10 @@ ieee80211_key_alloc(u32 cipher, int idx,
  5196. -
  5197. - static void ieee80211_key_free_common(struct ieee80211_key *key)
  5198. - {
  5199. -- switch (key->conf.cipher) {
  5200. -- case WLAN_CIPHER_SUITE_CCMP:
  5201. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5202. -+ if (key->conf.cipher == WLAN_CIPHER_SUITE_CCMP)
  5203. - ieee80211_aes_key_free(key->u.ccmp.tfm);
  5204. -- break;
  5205. -- case WLAN_CIPHER_SUITE_AES_CMAC:
  5206. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5207. -+ if (key->conf.cipher == WLAN_CIPHER_SUITE_AES_CMAC)
  5208. - ieee80211_aes_cmac_key_free(key->u.aes_cmac.tfm);
  5209. -- break;
  5210. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5211. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5212. -- ieee80211_aes_gmac_key_free(key->u.aes_gmac.tfm);
  5213. -- break;
  5214. -- case WLAN_CIPHER_SUITE_GCMP:
  5215. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5216. -- ieee80211_aes_gcm_key_free(key->u.gcmp.tfm);
  5217. -- break;
  5218. -- }
  5219. - kzfree(key);
  5220. - }
  5221. -
  5222. -@@ -826,7 +743,6 @@ void ieee80211_get_key_tx_seq(struct iee
  5223. - seq->tkip.iv16 = key->u.tkip.tx.iv16;
  5224. - break;
  5225. - case WLAN_CIPHER_SUITE_CCMP:
  5226. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5227. - pn64 = atomic64_read(&key->u.ccmp.tx_pn);
  5228. - seq->ccmp.pn[5] = pn64;
  5229. - seq->ccmp.pn[4] = pn64 >> 8;
  5230. -@@ -836,7 +752,6 @@ void ieee80211_get_key_tx_seq(struct iee
  5231. - seq->ccmp.pn[0] = pn64 >> 40;
  5232. - break;
  5233. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5234. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5235. - pn64 = atomic64_read(&key->u.aes_cmac.tx_pn);
  5236. - seq->ccmp.pn[5] = pn64;
  5237. - seq->ccmp.pn[4] = pn64 >> 8;
  5238. -@@ -845,26 +760,6 @@ void ieee80211_get_key_tx_seq(struct iee
  5239. - seq->ccmp.pn[1] = pn64 >> 32;
  5240. - seq->ccmp.pn[0] = pn64 >> 40;
  5241. - break;
  5242. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5243. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5244. -- pn64 = atomic64_read(&key->u.aes_gmac.tx_pn);
  5245. -- seq->ccmp.pn[5] = pn64;
  5246. -- seq->ccmp.pn[4] = pn64 >> 8;
  5247. -- seq->ccmp.pn[3] = pn64 >> 16;
  5248. -- seq->ccmp.pn[2] = pn64 >> 24;
  5249. -- seq->ccmp.pn[1] = pn64 >> 32;
  5250. -- seq->ccmp.pn[0] = pn64 >> 40;
  5251. -- break;
  5252. -- case WLAN_CIPHER_SUITE_GCMP:
  5253. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5254. -- pn64 = atomic64_read(&key->u.gcmp.tx_pn);
  5255. -- seq->gcmp.pn[5] = pn64;
  5256. -- seq->gcmp.pn[4] = pn64 >> 8;
  5257. -- seq->gcmp.pn[3] = pn64 >> 16;
  5258. -- seq->gcmp.pn[2] = pn64 >> 24;
  5259. -- seq->gcmp.pn[1] = pn64 >> 32;
  5260. -- seq->gcmp.pn[0] = pn64 >> 40;
  5261. -- break;
  5262. - default:
  5263. - WARN_ON(1);
  5264. - }
  5265. -@@ -887,7 +782,6 @@ void ieee80211_get_key_rx_seq(struct iee
  5266. - seq->tkip.iv16 = key->u.tkip.rx[tid].iv16;
  5267. - break;
  5268. - case WLAN_CIPHER_SUITE_CCMP:
  5269. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5270. - if (WARN_ON(tid < -1 || tid >= IEEE80211_NUM_TIDS))
  5271. - return;
  5272. - if (tid < 0)
  5273. -@@ -897,29 +791,11 @@ void ieee80211_get_key_rx_seq(struct iee
  5274. - memcpy(seq->ccmp.pn, pn, IEEE80211_CCMP_PN_LEN);
  5275. - break;
  5276. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5277. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5278. - if (WARN_ON(tid != 0))
  5279. - return;
  5280. - pn = key->u.aes_cmac.rx_pn;
  5281. - memcpy(seq->aes_cmac.pn, pn, IEEE80211_CMAC_PN_LEN);
  5282. - break;
  5283. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5284. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5285. -- if (WARN_ON(tid != 0))
  5286. -- return;
  5287. -- pn = key->u.aes_gmac.rx_pn;
  5288. -- memcpy(seq->aes_gmac.pn, pn, IEEE80211_GMAC_PN_LEN);
  5289. -- break;
  5290. -- case WLAN_CIPHER_SUITE_GCMP:
  5291. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5292. -- if (WARN_ON(tid < -1 || tid >= IEEE80211_NUM_TIDS))
  5293. -- return;
  5294. -- if (tid < 0)
  5295. -- pn = key->u.gcmp.rx_pn[IEEE80211_NUM_TIDS];
  5296. -- else
  5297. -- pn = key->u.gcmp.rx_pn[tid];
  5298. -- memcpy(seq->gcmp.pn, pn, IEEE80211_GCMP_PN_LEN);
  5299. -- break;
  5300. - }
  5301. - }
  5302. - EXPORT_SYMBOL(ieee80211_get_key_rx_seq);
  5303. -@@ -938,7 +814,6 @@ void ieee80211_set_key_tx_seq(struct iee
  5304. - key->u.tkip.tx.iv16 = seq->tkip.iv16;
  5305. - break;
  5306. - case WLAN_CIPHER_SUITE_CCMP:
  5307. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5308. - pn64 = (u64)seq->ccmp.pn[5] |
  5309. - ((u64)seq->ccmp.pn[4] << 8) |
  5310. - ((u64)seq->ccmp.pn[3] << 16) |
  5311. -@@ -948,7 +823,6 @@ void ieee80211_set_key_tx_seq(struct iee
  5312. - atomic64_set(&key->u.ccmp.tx_pn, pn64);
  5313. - break;
  5314. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5315. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5316. - pn64 = (u64)seq->aes_cmac.pn[5] |
  5317. - ((u64)seq->aes_cmac.pn[4] << 8) |
  5318. - ((u64)seq->aes_cmac.pn[3] << 16) |
  5319. -@@ -957,26 +831,6 @@ void ieee80211_set_key_tx_seq(struct iee
  5320. - ((u64)seq->aes_cmac.pn[0] << 40);
  5321. - atomic64_set(&key->u.aes_cmac.tx_pn, pn64);
  5322. - break;
  5323. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5324. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5325. -- pn64 = (u64)seq->aes_gmac.pn[5] |
  5326. -- ((u64)seq->aes_gmac.pn[4] << 8) |
  5327. -- ((u64)seq->aes_gmac.pn[3] << 16) |
  5328. -- ((u64)seq->aes_gmac.pn[2] << 24) |
  5329. -- ((u64)seq->aes_gmac.pn[1] << 32) |
  5330. -- ((u64)seq->aes_gmac.pn[0] << 40);
  5331. -- atomic64_set(&key->u.aes_gmac.tx_pn, pn64);
  5332. -- break;
  5333. -- case WLAN_CIPHER_SUITE_GCMP:
  5334. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5335. -- pn64 = (u64)seq->gcmp.pn[5] |
  5336. -- ((u64)seq->gcmp.pn[4] << 8) |
  5337. -- ((u64)seq->gcmp.pn[3] << 16) |
  5338. -- ((u64)seq->gcmp.pn[2] << 24) |
  5339. -- ((u64)seq->gcmp.pn[1] << 32) |
  5340. -- ((u64)seq->gcmp.pn[0] << 40);
  5341. -- atomic64_set(&key->u.gcmp.tx_pn, pn64);
  5342. -- break;
  5343. - default:
  5344. - WARN_ON(1);
  5345. - break;
  5346. -@@ -1000,7 +854,6 @@ void ieee80211_set_key_rx_seq(struct iee
  5347. - key->u.tkip.rx[tid].iv16 = seq->tkip.iv16;
  5348. - break;
  5349. - case WLAN_CIPHER_SUITE_CCMP:
  5350. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5351. - if (WARN_ON(tid < -1 || tid >= IEEE80211_NUM_TIDS))
  5352. - return;
  5353. - if (tid < 0)
  5354. -@@ -1010,29 +863,11 @@ void ieee80211_set_key_rx_seq(struct iee
  5355. - memcpy(pn, seq->ccmp.pn, IEEE80211_CCMP_PN_LEN);
  5356. - break;
  5357. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5358. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5359. - if (WARN_ON(tid != 0))
  5360. - return;
  5361. - pn = key->u.aes_cmac.rx_pn;
  5362. - memcpy(pn, seq->aes_cmac.pn, IEEE80211_CMAC_PN_LEN);
  5363. - break;
  5364. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5365. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5366. -- if (WARN_ON(tid != 0))
  5367. -- return;
  5368. -- pn = key->u.aes_gmac.rx_pn;
  5369. -- memcpy(pn, seq->aes_gmac.pn, IEEE80211_GMAC_PN_LEN);
  5370. -- break;
  5371. -- case WLAN_CIPHER_SUITE_GCMP:
  5372. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5373. -- if (WARN_ON(tid < -1 || tid >= IEEE80211_NUM_TIDS))
  5374. -- return;
  5375. -- if (tid < 0)
  5376. -- pn = key->u.gcmp.rx_pn[IEEE80211_NUM_TIDS];
  5377. -- else
  5378. -- pn = key->u.gcmp.rx_pn[tid];
  5379. -- memcpy(pn, seq->gcmp.pn, IEEE80211_GCMP_PN_LEN);
  5380. -- break;
  5381. - default:
  5382. - WARN_ON(1);
  5383. - break;
  5384. ---- a/net/mac80211/key.h
  5385. -+++ b/net/mac80211/key.h
  5386. -@@ -84,7 +84,7 @@ struct ieee80211_key {
  5387. - * Management frames.
  5388. - */
  5389. - u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_CCMP_PN_LEN];
  5390. -- struct crypto_aead *tfm;
  5391. -+ struct crypto_cipher *tfm;
  5392. - u32 replays; /* dot11RSNAStatsCCMPReplays */
  5393. - } ccmp;
  5394. - struct {
  5395. -@@ -95,24 +95,6 @@ struct ieee80211_key {
  5396. - u32 icverrors; /* dot11RSNAStatsCMACICVErrors */
  5397. - } aes_cmac;
  5398. - struct {
  5399. -- atomic64_t tx_pn;
  5400. -- u8 rx_pn[IEEE80211_GMAC_PN_LEN];
  5401. -- struct crypto_aead *tfm;
  5402. -- u32 replays; /* dot11RSNAStatsCMACReplays */
  5403. -- u32 icverrors; /* dot11RSNAStatsCMACICVErrors */
  5404. -- } aes_gmac;
  5405. -- struct {
  5406. -- atomic64_t tx_pn;
  5407. -- /* Last received packet number. The first
  5408. -- * IEEE80211_NUM_TIDS counters are used with Data
  5409. -- * frames and the last counter is used with Robust
  5410. -- * Management frames.
  5411. -- */
  5412. -- u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_GCMP_PN_LEN];
  5413. -- struct crypto_aead *tfm;
  5414. -- u32 replays; /* dot11RSNAStatsGCMPReplays */
  5415. -- } gcmp;
  5416. -- struct {
  5417. - /* generic cipher scheme */
  5418. - u8 rx_pn[IEEE80211_NUM_TIDS + 1][MAX_PN_LEN];
  5419. - } gen;
  5420. ---- a/net/mac80211/main.c
  5421. -+++ b/net/mac80211/main.c
  5422. -@@ -666,15 +666,9 @@ static int ieee80211_init_cipher_suites(
  5423. - WLAN_CIPHER_SUITE_WEP104,
  5424. - WLAN_CIPHER_SUITE_TKIP,
  5425. - WLAN_CIPHER_SUITE_CCMP,
  5426. -- WLAN_CIPHER_SUITE_CCMP_256,
  5427. -- WLAN_CIPHER_SUITE_GCMP,
  5428. -- WLAN_CIPHER_SUITE_GCMP_256,
  5429. -
  5430. - /* keep last -- depends on hw flags! */
  5431. -- WLAN_CIPHER_SUITE_AES_CMAC,
  5432. -- WLAN_CIPHER_SUITE_BIP_CMAC_256,
  5433. -- WLAN_CIPHER_SUITE_BIP_GMAC_128,
  5434. -- WLAN_CIPHER_SUITE_BIP_GMAC_256,
  5435. -+ WLAN_CIPHER_SUITE_AES_CMAC
  5436. - };
  5437. -
  5438. - if (local->hw.flags & IEEE80211_HW_SW_CRYPTO_CONTROL ||
  5439. -@@ -713,7 +707,7 @@ static int ieee80211_init_cipher_suites(
  5440. - local->hw.wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  5441. -
  5442. - if (!have_mfp)
  5443. -- local->hw.wiphy->n_cipher_suites -= 4;
  5444. -+ local->hw.wiphy->n_cipher_suites--;
  5445. -
  5446. - if (!have_wep) {
  5447. - local->hw.wiphy->cipher_suites += 2;
  5448. -@@ -730,42 +724,32 @@ static int ieee80211_init_cipher_suites(
  5449. - /* Driver specifies cipher schemes only (but not cipher suites
  5450. - * including the schemes)
  5451. - *
  5452. -- * We start counting ciphers defined by schemes, TKIP, CCMP,
  5453. -- * CCMP-256, GCMP, and GCMP-256
  5454. -+ * We start counting ciphers defined by schemes, TKIP and CCMP
  5455. - */
  5456. -- n_suites = local->hw.n_cipher_schemes + 5;
  5457. -+ n_suites = local->hw.n_cipher_schemes + 2;
  5458. -
  5459. - /* check if we have WEP40 and WEP104 */
  5460. - if (have_wep)
  5461. - n_suites += 2;
  5462. -
  5463. -- /* check if we have AES_CMAC, BIP-CMAC-256, BIP-GMAC-128,
  5464. -- * BIP-GMAC-256
  5465. -- */
  5466. -+ /* check if we have AES_CMAC */
  5467. - if (have_mfp)
  5468. -- n_suites += 4;
  5469. -+ n_suites++;
  5470. -
  5471. - suites = kmalloc(sizeof(u32) * n_suites, GFP_KERNEL);
  5472. - if (!suites)
  5473. - return -ENOMEM;
  5474. -
  5475. - suites[w++] = WLAN_CIPHER_SUITE_CCMP;
  5476. -- suites[w++] = WLAN_CIPHER_SUITE_CCMP_256;
  5477. - suites[w++] = WLAN_CIPHER_SUITE_TKIP;
  5478. -- suites[w++] = WLAN_CIPHER_SUITE_GCMP;
  5479. -- suites[w++] = WLAN_CIPHER_SUITE_GCMP_256;
  5480. -
  5481. - if (have_wep) {
  5482. - suites[w++] = WLAN_CIPHER_SUITE_WEP40;
  5483. - suites[w++] = WLAN_CIPHER_SUITE_WEP104;
  5484. - }
  5485. -
  5486. -- if (have_mfp) {
  5487. -+ if (have_mfp)
  5488. - suites[w++] = WLAN_CIPHER_SUITE_AES_CMAC;
  5489. -- suites[w++] = WLAN_CIPHER_SUITE_BIP_CMAC_256;
  5490. -- suites[w++] = WLAN_CIPHER_SUITE_BIP_GMAC_128;
  5491. -- suites[w++] = WLAN_CIPHER_SUITE_BIP_GMAC_256;
  5492. -- }
  5493. -
  5494. - for (r = 0; r < local->hw.n_cipher_schemes; r++)
  5495. - suites[w++] = cs[r].cipher;
  5496. ---- a/net/mac80211/rx.c
  5497. -+++ b/net/mac80211/rx.c
  5498. -@@ -647,7 +647,6 @@ static int ieee80211_get_mmie_keyidx(str
  5499. - {
  5500. - struct ieee80211_mgmt *hdr = (struct ieee80211_mgmt *) skb->data;
  5501. - struct ieee80211_mmie *mmie;
  5502. -- struct ieee80211_mmie_16 *mmie16;
  5503. -
  5504. - if (skb->len < 24 + sizeof(*mmie) || !is_multicast_ether_addr(hdr->da))
  5505. - return -1;
  5506. -@@ -657,18 +656,11 @@ static int ieee80211_get_mmie_keyidx(str
  5507. -
  5508. - mmie = (struct ieee80211_mmie *)
  5509. - (skb->data + skb->len - sizeof(*mmie));
  5510. -- if (mmie->element_id == WLAN_EID_MMIE &&
  5511. -- mmie->length == sizeof(*mmie) - 2)
  5512. -- return le16_to_cpu(mmie->key_id);
  5513. --
  5514. -- mmie16 = (struct ieee80211_mmie_16 *)
  5515. -- (skb->data + skb->len - sizeof(*mmie16));
  5516. -- if (skb->len >= 24 + sizeof(*mmie16) &&
  5517. -- mmie16->element_id == WLAN_EID_MMIE &&
  5518. -- mmie16->length == sizeof(*mmie16) - 2)
  5519. -- return le16_to_cpu(mmie16->key_id);
  5520. -+ if (mmie->element_id != WLAN_EID_MMIE ||
  5521. -+ mmie->length != sizeof(*mmie) - 2)
  5522. -+ return -1;
  5523. -
  5524. -- return -1;
  5525. -+ return le16_to_cpu(mmie->key_id);
  5526. - }
  5527. -
  5528. - static int iwl80211_get_cs_keyid(const struct ieee80211_cipher_scheme *cs,
  5529. -@@ -1658,27 +1650,11 @@ ieee80211_rx_h_decrypt(struct ieee80211_
  5530. - result = ieee80211_crypto_tkip_decrypt(rx);
  5531. - break;
  5532. - case WLAN_CIPHER_SUITE_CCMP:
  5533. -- result = ieee80211_crypto_ccmp_decrypt(
  5534. -- rx, IEEE80211_CCMP_MIC_LEN);
  5535. -- break;
  5536. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5537. -- result = ieee80211_crypto_ccmp_decrypt(
  5538. -- rx, IEEE80211_CCMP_256_MIC_LEN);
  5539. -+ result = ieee80211_crypto_ccmp_decrypt(rx);
  5540. - break;
  5541. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5542. - result = ieee80211_crypto_aes_cmac_decrypt(rx);
  5543. - break;
  5544. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5545. -- result = ieee80211_crypto_aes_cmac_256_decrypt(rx);
  5546. -- break;
  5547. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5548. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5549. -- result = ieee80211_crypto_aes_gmac_decrypt(rx);
  5550. -- break;
  5551. -- case WLAN_CIPHER_SUITE_GCMP:
  5552. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5553. -- result = ieee80211_crypto_gcmp_decrypt(rx);
  5554. -- break;
  5555. - default:
  5556. - result = ieee80211_crypto_hw_decrypt(rx);
  5557. - }
  5558. -@@ -1805,9 +1781,7 @@ ieee80211_rx_h_defragment(struct ieee802
  5559. - /* This is the first fragment of a new frame. */
  5560. - entry = ieee80211_reassemble_add(rx->sdata, frag, seq,
  5561. - rx->seqno_idx, &(rx->skb));
  5562. -- if (rx->key &&
  5563. -- (rx->key->conf.cipher == WLAN_CIPHER_SUITE_CCMP ||
  5564. -- rx->key->conf.cipher == WLAN_CIPHER_SUITE_CCMP_256) &&
  5565. -+ if (rx->key && rx->key->conf.cipher == WLAN_CIPHER_SUITE_CCMP &&
  5566. - ieee80211_has_protected(fc)) {
  5567. - int queue = rx->security_idx;
  5568. - /* Store CCMP PN so that we can verify that the next
  5569. -@@ -1836,9 +1810,7 @@ ieee80211_rx_h_defragment(struct ieee802
  5570. - int i;
  5571. - u8 pn[IEEE80211_CCMP_PN_LEN], *rpn;
  5572. - int queue;
  5573. -- if (!rx->key ||
  5574. -- (rx->key->conf.cipher != WLAN_CIPHER_SUITE_CCMP &&
  5575. -- rx->key->conf.cipher != WLAN_CIPHER_SUITE_CCMP_256))
  5576. -+ if (!rx->key || rx->key->conf.cipher != WLAN_CIPHER_SUITE_CCMP)
  5577. - return RX_DROP_UNUSABLE;
  5578. - memcpy(pn, entry->last_pn, IEEE80211_CCMP_PN_LEN);
  5579. - for (i = IEEE80211_CCMP_PN_LEN - 1; i >= 0; i--) {
  5580. ---- a/net/mac80211/tx.c
  5581. -+++ b/net/mac80211/tx.c
  5582. -@@ -626,9 +626,6 @@ ieee80211_tx_h_select_key(struct ieee802
  5583. - tx->key = NULL;
  5584. - break;
  5585. - case WLAN_CIPHER_SUITE_CCMP:
  5586. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5587. -- case WLAN_CIPHER_SUITE_GCMP:
  5588. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5589. - if (!ieee80211_is_data_present(hdr->frame_control) &&
  5590. - !ieee80211_use_mfp(hdr->frame_control, tx->sta,
  5591. - tx->skb))
  5592. -@@ -639,9 +636,6 @@ ieee80211_tx_h_select_key(struct ieee802
  5593. - ieee80211_is_mgmt(hdr->frame_control);
  5594. - break;
  5595. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5596. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5597. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5598. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5599. - if (!ieee80211_is_mgmt(hdr->frame_control))
  5600. - tx->key = NULL;
  5601. - break;
  5602. -@@ -1017,21 +1011,9 @@ ieee80211_tx_h_encrypt(struct ieee80211_
  5603. - case WLAN_CIPHER_SUITE_TKIP:
  5604. - return ieee80211_crypto_tkip_encrypt(tx);
  5605. - case WLAN_CIPHER_SUITE_CCMP:
  5606. -- return ieee80211_crypto_ccmp_encrypt(
  5607. -- tx, IEEE80211_CCMP_MIC_LEN);
  5608. -- case WLAN_CIPHER_SUITE_CCMP_256:
  5609. -- return ieee80211_crypto_ccmp_encrypt(
  5610. -- tx, IEEE80211_CCMP_256_MIC_LEN);
  5611. -+ return ieee80211_crypto_ccmp_encrypt(tx);
  5612. - case WLAN_CIPHER_SUITE_AES_CMAC:
  5613. - return ieee80211_crypto_aes_cmac_encrypt(tx);
  5614. -- case WLAN_CIPHER_SUITE_BIP_CMAC_256:
  5615. -- return ieee80211_crypto_aes_cmac_256_encrypt(tx);
  5616. -- case WLAN_CIPHER_SUITE_BIP_GMAC_128:
  5617. -- case WLAN_CIPHER_SUITE_BIP_GMAC_256:
  5618. -- return ieee80211_crypto_aes_gmac_encrypt(tx);
  5619. -- case WLAN_CIPHER_SUITE_GCMP:
  5620. -- case WLAN_CIPHER_SUITE_GCMP_256:
  5621. -- return ieee80211_crypto_gcmp_encrypt(tx);
  5622. - default:
  5623. - return ieee80211_crypto_hw_encrypt(tx);
  5624. - }
  5625. ---- a/net/mac80211/wpa.c
  5626. -+++ b/net/mac80211/wpa.c
  5627. -@@ -22,8 +22,6 @@
  5628. - #include "tkip.h"
  5629. - #include "aes_ccm.h"
  5630. - #include "aes_cmac.h"
  5631. --#include "aes_gmac.h"
  5632. --#include "aes_gcm.h"
  5633. - #include "wpa.h"
  5634. -
  5635. - ieee80211_tx_result
  5636. -@@ -304,15 +302,22 @@ ieee80211_crypto_tkip_decrypt(struct iee
  5637. - }
  5638. -
  5639. -
  5640. --static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad)
  5641. -+static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *scratch,
  5642. -+ int encrypted)
  5643. - {
  5644. - __le16 mask_fc;
  5645. - int a4_included, mgmt;
  5646. - u8 qos_tid;
  5647. -- u16 len_a;
  5648. -+ u8 *b_0, *aad;
  5649. -+ u16 data_len, len_a;
  5650. - unsigned int hdrlen;
  5651. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  5652. -
  5653. -+ memset(scratch, 0, 6 * AES_BLOCK_SIZE);
  5654. -+
  5655. -+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
  5656. -+ aad = scratch + 4 * AES_BLOCK_SIZE;
  5657. -+
  5658. - /*
  5659. - * Mask FC: zero subtype b4 b5 b6 (if not mgmt)
  5660. - * Retry, PwrMgt, MoreData; set Protected
  5661. -@@ -334,21 +339,20 @@ static void ccmp_special_blocks(struct s
  5662. - else
  5663. - qos_tid = 0;
  5664. -
  5665. -- /* In CCM, the initial vectors (IV) used for CTR mode encryption and CBC
  5666. -- * mode authentication are not allowed to collide, yet both are derived
  5667. -- * from this vector b_0. We only set L := 1 here to indicate that the
  5668. -- * data size can be represented in (L+1) bytes. The CCM layer will take
  5669. -- * care of storing the data length in the top (L+1) bytes and setting
  5670. -- * and clearing the other bits as is required to derive the two IVs.
  5671. -- */
  5672. -- b_0[0] = 0x1;
  5673. -+ data_len = skb->len - hdrlen - IEEE80211_CCMP_HDR_LEN;
  5674. -+ if (encrypted)
  5675. -+ data_len -= IEEE80211_CCMP_MIC_LEN;
  5676. -
  5677. -+ /* First block, b_0 */
  5678. -+ b_0[0] = 0x59; /* flags: Adata: 1, M: 011, L: 001 */
  5679. - /* Nonce: Nonce Flags | A2 | PN
  5680. - * Nonce Flags: Priority (b0..b3) | Management (b4) | Reserved (b5..b7)
  5681. - */
  5682. - b_0[1] = qos_tid | (mgmt << 4);
  5683. - memcpy(&b_0[2], hdr->addr2, ETH_ALEN);
  5684. - memcpy(&b_0[8], pn, IEEE80211_CCMP_PN_LEN);
  5685. -+ /* l(m) */
  5686. -+ put_unaligned_be16(data_len, &b_0[14]);
  5687. -
  5688. - /* AAD (extra authenticate-only data) / masked 802.11 header
  5689. - * FC | A1 | A2 | A3 | SC | [A4] | [QC] */
  5690. -@@ -395,8 +399,7 @@ static inline void ccmp_hdr2pn(u8 *pn, u
  5691. - }
  5692. -
  5693. -
  5694. --static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb,
  5695. -- unsigned int mic_len)
  5696. -+static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
  5697. - {
  5698. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  5699. - struct ieee80211_key *key = tx->key;
  5700. -@@ -405,8 +408,7 @@ static int ccmp_encrypt_skb(struct ieee8
  5701. - u8 *pos;
  5702. - u8 pn[6];
  5703. - u64 pn64;
  5704. -- u8 aad[2 * AES_BLOCK_SIZE];
  5705. -- u8 b_0[AES_BLOCK_SIZE];
  5706. -+ u8 scratch[6 * AES_BLOCK_SIZE];
  5707. -
  5708. - if (info->control.hw_key &&
  5709. - !(info->control.hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) &&
  5710. -@@ -427,7 +429,7 @@ static int ccmp_encrypt_skb(struct ieee8
  5711. - if (info->control.hw_key)
  5712. - tail = 0;
  5713. - else
  5714. -- tail = mic_len;
  5715. -+ tail = IEEE80211_CCMP_MIC_LEN;
  5716. -
  5717. - if (WARN_ON(skb_tailroom(skb) < tail ||
  5718. - skb_headroom(skb) < IEEE80211_CCMP_HDR_LEN))
  5719. -@@ -460,24 +462,23 @@ static int ccmp_encrypt_skb(struct ieee8
  5720. - return 0;
  5721. -
  5722. - pos += IEEE80211_CCMP_HDR_LEN;
  5723. -- ccmp_special_blocks(skb, pn, b_0, aad);
  5724. -- ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, b_0, aad, pos, len,
  5725. -- skb_put(skb, mic_len), mic_len);
  5726. -+ ccmp_special_blocks(skb, pn, scratch, 0);
  5727. -+ ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, scratch, pos, len,
  5728. -+ pos, skb_put(skb, IEEE80211_CCMP_MIC_LEN));
  5729. -
  5730. - return 0;
  5731. - }
  5732. -
  5733. -
  5734. - ieee80211_tx_result
  5735. --ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx,
  5736. -- unsigned int mic_len)
  5737. -+ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx)
  5738. - {
  5739. - struct sk_buff *skb;
  5740. -
  5741. - ieee80211_tx_set_protected(tx);
  5742. -
  5743. - skb_queue_walk(&tx->skbs, skb) {
  5744. -- if (ccmp_encrypt_skb(tx, skb, mic_len) < 0)
  5745. -+ if (ccmp_encrypt_skb(tx, skb) < 0)
  5746. - return TX_DROP;
  5747. - }
  5748. -
  5749. -@@ -486,8 +487,7 @@ ieee80211_crypto_ccmp_encrypt(struct iee
  5750. -
  5751. -
  5752. - ieee80211_rx_result
  5753. --ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx,
  5754. -- unsigned int mic_len)
  5755. -+ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx)
  5756. - {
  5757. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
  5758. - int hdrlen;
  5759. -@@ -504,7 +504,8 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  5760. - !ieee80211_is_robust_mgmt_frame(skb))
  5761. - return RX_CONTINUE;
  5762. -
  5763. -- data_len = skb->len - hdrlen - IEEE80211_CCMP_HDR_LEN - mic_len;
  5764. -+ data_len = skb->len - hdrlen - IEEE80211_CCMP_HDR_LEN -
  5765. -+ IEEE80211_CCMP_MIC_LEN;
  5766. - if (!rx->sta || data_len < 0)
  5767. - return RX_DROP_UNUSABLE;
  5768. -
  5769. -@@ -526,23 +527,23 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  5770. - }
  5771. -
  5772. - if (!(status->flag & RX_FLAG_DECRYPTED)) {
  5773. -- u8 aad[2 * AES_BLOCK_SIZE];
  5774. -- u8 b_0[AES_BLOCK_SIZE];
  5775. -+ u8 scratch[6 * AES_BLOCK_SIZE];
  5776. - /* hardware didn't decrypt/verify MIC */
  5777. -- ccmp_special_blocks(skb, pn, b_0, aad);
  5778. -+ ccmp_special_blocks(skb, pn, scratch, 1);
  5779. -
  5780. - if (ieee80211_aes_ccm_decrypt(
  5781. -- key->u.ccmp.tfm, b_0, aad,
  5782. -+ key->u.ccmp.tfm, scratch,
  5783. - skb->data + hdrlen + IEEE80211_CCMP_HDR_LEN,
  5784. - data_len,
  5785. -- skb->data + skb->len - mic_len, mic_len))
  5786. -+ skb->data + skb->len - IEEE80211_CCMP_MIC_LEN,
  5787. -+ skb->data + hdrlen + IEEE80211_CCMP_HDR_LEN))
  5788. - return RX_DROP_UNUSABLE;
  5789. - }
  5790. -
  5791. - memcpy(key->u.ccmp.rx_pn[queue], pn, IEEE80211_CCMP_PN_LEN);
  5792. -
  5793. - /* Remove CCMP header and MIC */
  5794. -- if (pskb_trim(skb, skb->len - mic_len))
  5795. -+ if (pskb_trim(skb, skb->len - IEEE80211_CCMP_MIC_LEN))
  5796. - return RX_DROP_UNUSABLE;
  5797. - memmove(skb->data + IEEE80211_CCMP_HDR_LEN, skb->data, hdrlen);
  5798. - skb_pull(skb, IEEE80211_CCMP_HDR_LEN);
  5799. -@@ -550,229 +551,6 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  5800. - return RX_CONTINUE;
  5801. - }
  5802. -
  5803. --static void gcmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *j_0, u8 *aad)
  5804. --{
  5805. -- __le16 mask_fc;
  5806. -- u8 qos_tid;
  5807. -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  5808. --
  5809. -- memcpy(j_0, hdr->addr2, ETH_ALEN);
  5810. -- memcpy(&j_0[ETH_ALEN], pn, IEEE80211_GCMP_PN_LEN);
  5811. -- j_0[13] = 0;
  5812. -- j_0[14] = 0;
  5813. -- j_0[AES_BLOCK_SIZE - 1] = 0x01;
  5814. --
  5815. -- /* AAD (extra authenticate-only data) / masked 802.11 header
  5816. -- * FC | A1 | A2 | A3 | SC | [A4] | [QC]
  5817. -- */
  5818. -- put_unaligned_be16(ieee80211_hdrlen(hdr->frame_control) - 2, &aad[0]);
  5819. -- /* Mask FC: zero subtype b4 b5 b6 (if not mgmt)
  5820. -- * Retry, PwrMgt, MoreData; set Protected
  5821. -- */
  5822. -- mask_fc = hdr->frame_control;
  5823. -- mask_fc &= ~cpu_to_le16(IEEE80211_FCTL_RETRY |
  5824. -- IEEE80211_FCTL_PM | IEEE80211_FCTL_MOREDATA);
  5825. -- if (!ieee80211_is_mgmt(hdr->frame_control))
  5826. -- mask_fc &= ~cpu_to_le16(0x0070);
  5827. -- mask_fc |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
  5828. --
  5829. -- put_unaligned(mask_fc, (__le16 *)&aad[2]);
  5830. -- memcpy(&aad[4], &hdr->addr1, 3 * ETH_ALEN);
  5831. --
  5832. -- /* Mask Seq#, leave Frag# */
  5833. -- aad[22] = *((u8 *)&hdr->seq_ctrl) & 0x0f;
  5834. -- aad[23] = 0;
  5835. --
  5836. -- if (ieee80211_is_data_qos(hdr->frame_control))
  5837. -- qos_tid = *ieee80211_get_qos_ctl(hdr) &
  5838. -- IEEE80211_QOS_CTL_TID_MASK;
  5839. -- else
  5840. -- qos_tid = 0;
  5841. --
  5842. -- if (ieee80211_has_a4(hdr->frame_control)) {
  5843. -- memcpy(&aad[24], hdr->addr4, ETH_ALEN);
  5844. -- aad[30] = qos_tid;
  5845. -- aad[31] = 0;
  5846. -- } else {
  5847. -- memset(&aad[24], 0, ETH_ALEN + IEEE80211_QOS_CTL_LEN);
  5848. -- aad[24] = qos_tid;
  5849. -- }
  5850. --}
  5851. --
  5852. --static inline void gcmp_pn2hdr(u8 *hdr, const u8 *pn, int key_id)
  5853. --{
  5854. -- hdr[0] = pn[5];
  5855. -- hdr[1] = pn[4];
  5856. -- hdr[2] = 0;
  5857. -- hdr[3] = 0x20 | (key_id << 6);
  5858. -- hdr[4] = pn[3];
  5859. -- hdr[5] = pn[2];
  5860. -- hdr[6] = pn[1];
  5861. -- hdr[7] = pn[0];
  5862. --}
  5863. --
  5864. --static inline void gcmp_hdr2pn(u8 *pn, const u8 *hdr)
  5865. --{
  5866. -- pn[0] = hdr[7];
  5867. -- pn[1] = hdr[6];
  5868. -- pn[2] = hdr[5];
  5869. -- pn[3] = hdr[4];
  5870. -- pn[4] = hdr[1];
  5871. -- pn[5] = hdr[0];
  5872. --}
  5873. --
  5874. --static int gcmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
  5875. --{
  5876. -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  5877. -- struct ieee80211_key *key = tx->key;
  5878. -- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  5879. -- int hdrlen, len, tail;
  5880. -- u8 *pos;
  5881. -- u8 pn[6];
  5882. -- u64 pn64;
  5883. -- u8 aad[2 * AES_BLOCK_SIZE];
  5884. -- u8 j_0[AES_BLOCK_SIZE];
  5885. --
  5886. -- if (info->control.hw_key &&
  5887. -- !(info->control.hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) &&
  5888. -- !(info->control.hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE) &&
  5889. -- !((info->control.hw_key->flags &
  5890. -- IEEE80211_KEY_FLAG_GENERATE_IV_MGMT) &&
  5891. -- ieee80211_is_mgmt(hdr->frame_control))) {
  5892. -- /* hwaccel has no need for preallocated room for GCMP
  5893. -- * header or MIC fields
  5894. -- */
  5895. -- return 0;
  5896. -- }
  5897. --
  5898. -- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  5899. -- len = skb->len - hdrlen;
  5900. --
  5901. -- if (info->control.hw_key)
  5902. -- tail = 0;
  5903. -- else
  5904. -- tail = IEEE80211_GCMP_MIC_LEN;
  5905. --
  5906. -- if (WARN_ON(skb_tailroom(skb) < tail ||
  5907. -- skb_headroom(skb) < IEEE80211_GCMP_HDR_LEN))
  5908. -- return -1;
  5909. --
  5910. -- pos = skb_push(skb, IEEE80211_GCMP_HDR_LEN);
  5911. -- memmove(pos, pos + IEEE80211_GCMP_HDR_LEN, hdrlen);
  5912. -- skb_set_network_header(skb, skb_network_offset(skb) +
  5913. -- IEEE80211_GCMP_HDR_LEN);
  5914. --
  5915. -- /* the HW only needs room for the IV, but not the actual IV */
  5916. -- if (info->control.hw_key &&
  5917. -- (info->control.hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE))
  5918. -- return 0;
  5919. --
  5920. -- hdr = (struct ieee80211_hdr *)pos;
  5921. -- pos += hdrlen;
  5922. --
  5923. -- pn64 = atomic64_inc_return(&key->u.gcmp.tx_pn);
  5924. --
  5925. -- pn[5] = pn64;
  5926. -- pn[4] = pn64 >> 8;
  5927. -- pn[3] = pn64 >> 16;
  5928. -- pn[2] = pn64 >> 24;
  5929. -- pn[1] = pn64 >> 32;
  5930. -- pn[0] = pn64 >> 40;
  5931. --
  5932. -- gcmp_pn2hdr(pos, pn, key->conf.keyidx);
  5933. --
  5934. -- /* hwaccel - with software GCMP header */
  5935. -- if (info->control.hw_key)
  5936. -- return 0;
  5937. --
  5938. -- pos += IEEE80211_GCMP_HDR_LEN;
  5939. -- gcmp_special_blocks(skb, pn, j_0, aad);
  5940. -- ieee80211_aes_gcm_encrypt(key->u.gcmp.tfm, j_0, aad, pos, len,
  5941. -- skb_put(skb, IEEE80211_GCMP_MIC_LEN));
  5942. --
  5943. -- return 0;
  5944. --}
  5945. --
  5946. --ieee80211_tx_result
  5947. --ieee80211_crypto_gcmp_encrypt(struct ieee80211_tx_data *tx)
  5948. --{
  5949. -- struct sk_buff *skb;
  5950. --
  5951. -- ieee80211_tx_set_protected(tx);
  5952. --
  5953. -- skb_queue_walk(&tx->skbs, skb) {
  5954. -- if (gcmp_encrypt_skb(tx, skb) < 0)
  5955. -- return TX_DROP;
  5956. -- }
  5957. --
  5958. -- return TX_CONTINUE;
  5959. --}
  5960. --
  5961. --ieee80211_rx_result
  5962. --ieee80211_crypto_gcmp_decrypt(struct ieee80211_rx_data *rx)
  5963. --{
  5964. -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
  5965. -- int hdrlen;
  5966. -- struct ieee80211_key *key = rx->key;
  5967. -- struct sk_buff *skb = rx->skb;
  5968. -- struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
  5969. -- u8 pn[IEEE80211_GCMP_PN_LEN];
  5970. -- int data_len;
  5971. -- int queue;
  5972. --
  5973. -- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  5974. --
  5975. -- if (!ieee80211_is_data(hdr->frame_control) &&
  5976. -- !ieee80211_is_robust_mgmt_frame(skb))
  5977. -- return RX_CONTINUE;
  5978. --
  5979. -- data_len = skb->len - hdrlen - IEEE80211_GCMP_HDR_LEN -
  5980. -- IEEE80211_GCMP_MIC_LEN;
  5981. -- if (!rx->sta || data_len < 0)
  5982. -- return RX_DROP_UNUSABLE;
  5983. --
  5984. -- if (status->flag & RX_FLAG_DECRYPTED) {
  5985. -- if (!pskb_may_pull(rx->skb, hdrlen + IEEE80211_GCMP_HDR_LEN))
  5986. -- return RX_DROP_UNUSABLE;
  5987. -- } else {
  5988. -- if (skb_linearize(rx->skb))
  5989. -- return RX_DROP_UNUSABLE;
  5990. -- }
  5991. --
  5992. -- gcmp_hdr2pn(pn, skb->data + hdrlen);
  5993. --
  5994. -- queue = rx->security_idx;
  5995. --
  5996. -- if (memcmp(pn, key->u.gcmp.rx_pn[queue], IEEE80211_GCMP_PN_LEN) <= 0) {
  5997. -- key->u.gcmp.replays++;
  5998. -- return RX_DROP_UNUSABLE;
  5999. -- }
  6000. --
  6001. -- if (!(status->flag & RX_FLAG_DECRYPTED)) {
  6002. -- u8 aad[2 * AES_BLOCK_SIZE];
  6003. -- u8 j_0[AES_BLOCK_SIZE];
  6004. -- /* hardware didn't decrypt/verify MIC */
  6005. -- gcmp_special_blocks(skb, pn, j_0, aad);
  6006. --
  6007. -- if (ieee80211_aes_gcm_decrypt(
  6008. -- key->u.gcmp.tfm, j_0, aad,
  6009. -- skb->data + hdrlen + IEEE80211_GCMP_HDR_LEN,
  6010. -- data_len,
  6011. -- skb->data + skb->len - IEEE80211_GCMP_MIC_LEN))
  6012. -- return RX_DROP_UNUSABLE;
  6013. -- }
  6014. --
  6015. -- memcpy(key->u.gcmp.rx_pn[queue], pn, IEEE80211_GCMP_PN_LEN);
  6016. --
  6017. -- /* Remove GCMP header and MIC */
  6018. -- if (pskb_trim(skb, skb->len - IEEE80211_GCMP_MIC_LEN))
  6019. -- return RX_DROP_UNUSABLE;
  6020. -- memmove(skb->data + IEEE80211_GCMP_HDR_LEN, skb->data, hdrlen);
  6021. -- skb_pull(skb, IEEE80211_GCMP_HDR_LEN);
  6022. --
  6023. -- return RX_CONTINUE;
  6024. --}
  6025. --
  6026. - static ieee80211_tx_result
  6027. - ieee80211_crypto_cs_encrypt(struct ieee80211_tx_data *tx,
  6028. - struct sk_buff *skb)
  6029. -@@ -956,48 +734,6 @@ ieee80211_crypto_aes_cmac_encrypt(struct
  6030. - return TX_CONTINUE;
  6031. - }
  6032. -
  6033. --ieee80211_tx_result
  6034. --ieee80211_crypto_aes_cmac_256_encrypt(struct ieee80211_tx_data *tx)
  6035. --{
  6036. -- struct sk_buff *skb;
  6037. -- struct ieee80211_tx_info *info;
  6038. -- struct ieee80211_key *key = tx->key;
  6039. -- struct ieee80211_mmie_16 *mmie;
  6040. -- u8 aad[20];
  6041. -- u64 pn64;
  6042. --
  6043. -- if (WARN_ON(skb_queue_len(&tx->skbs) != 1))
  6044. -- return TX_DROP;
  6045. --
  6046. -- skb = skb_peek(&tx->skbs);
  6047. --
  6048. -- info = IEEE80211_SKB_CB(skb);
  6049. --
  6050. -- if (info->control.hw_key)
  6051. -- return TX_CONTINUE;
  6052. --
  6053. -- if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie)))
  6054. -- return TX_DROP;
  6055. --
  6056. -- mmie = (struct ieee80211_mmie_16 *)skb_put(skb, sizeof(*mmie));
  6057. -- mmie->element_id = WLAN_EID_MMIE;
  6058. -- mmie->length = sizeof(*mmie) - 2;
  6059. -- mmie->key_id = cpu_to_le16(key->conf.keyidx);
  6060. --
  6061. -- /* PN = PN + 1 */
  6062. -- pn64 = atomic64_inc_return(&key->u.aes_cmac.tx_pn);
  6063. --
  6064. -- bip_ipn_set64(mmie->sequence_number, pn64);
  6065. --
  6066. -- bip_aad(skb, aad);
  6067. --
  6068. -- /* MIC = AES-256-CMAC(IGTK, AAD || Management Frame Body || MMIE, 128)
  6069. -- */
  6070. -- ieee80211_aes_cmac_256(key->u.aes_cmac.tfm, aad,
  6071. -- skb->data + 24, skb->len - 24, mmie->mic);
  6072. --
  6073. -- return TX_CONTINUE;
  6074. --}
  6075. -
  6076. - ieee80211_rx_result
  6077. - ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx)
  6078. -@@ -1045,160 +781,6 @@ ieee80211_crypto_aes_cmac_decrypt(struct
  6079. -
  6080. - /* Remove MMIE */
  6081. - skb_trim(skb, skb->len - sizeof(*mmie));
  6082. --
  6083. -- return RX_CONTINUE;
  6084. --}
  6085. --
  6086. --ieee80211_rx_result
  6087. --ieee80211_crypto_aes_cmac_256_decrypt(struct ieee80211_rx_data *rx)
  6088. --{
  6089. -- struct sk_buff *skb = rx->skb;
  6090. -- struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
  6091. -- struct ieee80211_key *key = rx->key;
  6092. -- struct ieee80211_mmie_16 *mmie;
  6093. -- u8 aad[20], mic[16], ipn[6];
  6094. -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  6095. --
  6096. -- if (!ieee80211_is_mgmt(hdr->frame_control))
  6097. -- return RX_CONTINUE;
  6098. --
  6099. -- /* management frames are already linear */
  6100. --
  6101. -- if (skb->len < 24 + sizeof(*mmie))
  6102. -- return RX_DROP_UNUSABLE;
  6103. --
  6104. -- mmie = (struct ieee80211_mmie_16 *)
  6105. -- (skb->data + skb->len - sizeof(*mmie));
  6106. -- if (mmie->element_id != WLAN_EID_MMIE ||
  6107. -- mmie->length != sizeof(*mmie) - 2)
  6108. -- return RX_DROP_UNUSABLE; /* Invalid MMIE */
  6109. --
  6110. -- bip_ipn_swap(ipn, mmie->sequence_number);
  6111. --
  6112. -- if (memcmp(ipn, key->u.aes_cmac.rx_pn, 6) <= 0) {
  6113. -- key->u.aes_cmac.replays++;
  6114. -- return RX_DROP_UNUSABLE;
  6115. -- }
  6116. --
  6117. -- if (!(status->flag & RX_FLAG_DECRYPTED)) {
  6118. -- /* hardware didn't decrypt/verify MIC */
  6119. -- bip_aad(skb, aad);
  6120. -- ieee80211_aes_cmac_256(key->u.aes_cmac.tfm, aad,
  6121. -- skb->data + 24, skb->len - 24, mic);
  6122. -- if (memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) {
  6123. -- key->u.aes_cmac.icverrors++;
  6124. -- return RX_DROP_UNUSABLE;
  6125. -- }
  6126. -- }
  6127. --
  6128. -- memcpy(key->u.aes_cmac.rx_pn, ipn, 6);
  6129. --
  6130. -- /* Remove MMIE */
  6131. -- skb_trim(skb, skb->len - sizeof(*mmie));
  6132. --
  6133. -- return RX_CONTINUE;
  6134. --}
  6135. --
  6136. --ieee80211_tx_result
  6137. --ieee80211_crypto_aes_gmac_encrypt(struct ieee80211_tx_data *tx)
  6138. --{
  6139. -- struct sk_buff *skb;
  6140. -- struct ieee80211_tx_info *info;
  6141. -- struct ieee80211_key *key = tx->key;
  6142. -- struct ieee80211_mmie_16 *mmie;
  6143. -- struct ieee80211_hdr *hdr;
  6144. -- u8 aad[20];
  6145. -- u64 pn64;
  6146. -- u8 nonce[12];
  6147. --
  6148. -- if (WARN_ON(skb_queue_len(&tx->skbs) != 1))
  6149. -- return TX_DROP;
  6150. --
  6151. -- skb = skb_peek(&tx->skbs);
  6152. --
  6153. -- info = IEEE80211_SKB_CB(skb);
  6154. --
  6155. -- if (info->control.hw_key)
  6156. -- return TX_CONTINUE;
  6157. --
  6158. -- if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie)))
  6159. -- return TX_DROP;
  6160. --
  6161. -- mmie = (struct ieee80211_mmie_16 *)skb_put(skb, sizeof(*mmie));
  6162. -- mmie->element_id = WLAN_EID_MMIE;
  6163. -- mmie->length = sizeof(*mmie) - 2;
  6164. -- mmie->key_id = cpu_to_le16(key->conf.keyidx);
  6165. --
  6166. -- /* PN = PN + 1 */
  6167. -- pn64 = atomic64_inc_return(&key->u.aes_gmac.tx_pn);
  6168. --
  6169. -- bip_ipn_set64(mmie->sequence_number, pn64);
  6170. --
  6171. -- bip_aad(skb, aad);
  6172. --
  6173. -- hdr = (struct ieee80211_hdr *)skb->data;
  6174. -- memcpy(nonce, hdr->addr2, ETH_ALEN);
  6175. -- bip_ipn_swap(nonce + ETH_ALEN, mmie->sequence_number);
  6176. --
  6177. -- /* MIC = AES-GMAC(IGTK, AAD || Management Frame Body || MMIE, 128) */
  6178. -- if (ieee80211_aes_gmac(key->u.aes_gmac.tfm, aad, nonce,
  6179. -- skb->data + 24, skb->len - 24, mmie->mic) < 0)
  6180. -- return TX_DROP;
  6181. --
  6182. -- return TX_CONTINUE;
  6183. --}
  6184. --
  6185. --ieee80211_rx_result
  6186. --ieee80211_crypto_aes_gmac_decrypt(struct ieee80211_rx_data *rx)
  6187. --{
  6188. -- struct sk_buff *skb = rx->skb;
  6189. -- struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
  6190. -- struct ieee80211_key *key = rx->key;
  6191. -- struct ieee80211_mmie_16 *mmie;
  6192. -- u8 aad[20], mic[16], ipn[6], nonce[12];
  6193. -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  6194. --
  6195. -- if (!ieee80211_is_mgmt(hdr->frame_control))
  6196. -- return RX_CONTINUE;
  6197. --
  6198. -- /* management frames are already linear */
  6199. --
  6200. -- if (skb->len < 24 + sizeof(*mmie))
  6201. -- return RX_DROP_UNUSABLE;
  6202. --
  6203. -- mmie = (struct ieee80211_mmie_16 *)
  6204. -- (skb->data + skb->len - sizeof(*mmie));
  6205. -- if (mmie->element_id != WLAN_EID_MMIE ||
  6206. -- mmie->length != sizeof(*mmie) - 2)
  6207. -- return RX_DROP_UNUSABLE; /* Invalid MMIE */
  6208. --
  6209. -- bip_ipn_swap(ipn, mmie->sequence_number);
  6210. --
  6211. -- if (memcmp(ipn, key->u.aes_gmac.rx_pn, 6) <= 0) {
  6212. -- key->u.aes_gmac.replays++;
  6213. -- return RX_DROP_UNUSABLE;
  6214. -- }
  6215. --
  6216. -- if (!(status->flag & RX_FLAG_DECRYPTED)) {
  6217. -- /* hardware didn't decrypt/verify MIC */
  6218. -- bip_aad(skb, aad);
  6219. --
  6220. -- memcpy(nonce, hdr->addr2, ETH_ALEN);
  6221. -- memcpy(nonce + ETH_ALEN, ipn, 6);
  6222. --
  6223. -- if (ieee80211_aes_gmac(key->u.aes_gmac.tfm, aad, nonce,
  6224. -- skb->data + 24, skb->len - 24,
  6225. -- mic) < 0 ||
  6226. -- memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) {
  6227. -- key->u.aes_gmac.icverrors++;
  6228. -- return RX_DROP_UNUSABLE;
  6229. -- }
  6230. -- }
  6231. --
  6232. -- memcpy(key->u.aes_gmac.rx_pn, ipn, 6);
  6233. --
  6234. -- /* Remove MMIE */
  6235. -- skb_trim(skb, skb->len - sizeof(*mmie));
  6236. -
  6237. - return RX_CONTINUE;
  6238. - }
  6239. ---- a/net/mac80211/wpa.h
  6240. -+++ b/net/mac80211/wpa.h
  6241. -@@ -24,32 +24,17 @@ ieee80211_rx_result
  6242. - ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx);
  6243. -
  6244. - ieee80211_tx_result
  6245. --ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx,
  6246. -- unsigned int mic_len);
  6247. -+ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx);
  6248. - ieee80211_rx_result
  6249. --ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx,
  6250. -- unsigned int mic_len);
  6251. -+ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx);
  6252. -
  6253. - ieee80211_tx_result
  6254. - ieee80211_crypto_aes_cmac_encrypt(struct ieee80211_tx_data *tx);
  6255. --ieee80211_tx_result
  6256. --ieee80211_crypto_aes_cmac_256_encrypt(struct ieee80211_tx_data *tx);
  6257. - ieee80211_rx_result
  6258. - ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx);
  6259. --ieee80211_rx_result
  6260. --ieee80211_crypto_aes_cmac_256_decrypt(struct ieee80211_rx_data *rx);
  6261. --ieee80211_tx_result
  6262. --ieee80211_crypto_aes_gmac_encrypt(struct ieee80211_tx_data *tx);
  6263. --ieee80211_rx_result
  6264. --ieee80211_crypto_aes_gmac_decrypt(struct ieee80211_rx_data *rx);
  6265. - ieee80211_tx_result
  6266. - ieee80211_crypto_hw_encrypt(struct ieee80211_tx_data *tx);
  6267. - ieee80211_rx_result
  6268. - ieee80211_crypto_hw_decrypt(struct ieee80211_rx_data *rx);
  6269. -
  6270. --ieee80211_tx_result
  6271. --ieee80211_crypto_gcmp_encrypt(struct ieee80211_tx_data *tx);
  6272. --ieee80211_rx_result
  6273. --ieee80211_crypto_gcmp_decrypt(struct ieee80211_rx_data *rx);
  6274. --
  6275. - #endif /* WPA_H */
  6276. 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
  6277. index 41a3c4f..cff6d89 100644
  6278. --- a/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
  6279. +++ b/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
  6280. @@ -2,7 +2,7 @@ Used for AP+STA support in OpenWrt - preserve AP mode keys across STA reconnects
  6281. --- a/net/mac80211/cfg.c
  6282. +++ b/net/mac80211/cfg.c
  6283. -@@ -856,7 +856,6 @@ static int ieee80211_stop_ap(struct wiph
  6284. +@@ -886,7 +886,6 @@ static int ieee80211_stop_ap(struct wiph
  6285. sdata->u.ap.driver_smps_mode = IEEE80211_SMPS_OFF;
  6286. __sta_info_flush(sdata, true);
  6287. diff --git a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  6288. index de79bd2..5fc9454 100644
  6289. --- a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  6290. +++ b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  6291. @@ -18,7 +18,7 @@
  6292. static int ieee80211_ifa6_changed(struct notifier_block *nb,
  6293. unsigned long data, void *arg)
  6294. {
  6295. -@@ -1057,14 +1057,14 @@ int ieee80211_register_hw(struct ieee802
  6296. +@@ -1086,14 +1086,14 @@ int ieee80211_register_hw(struct ieee802
  6297. if (result)
  6298. goto fail_pm_qos;
  6299. @@ -35,7 +35,7 @@
  6300. local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed;
  6301. result = register_inet6addr_notifier(&local->ifa6_notifier);
  6302. if (result)
  6303. -@@ -1073,13 +1073,13 @@ int ieee80211_register_hw(struct ieee802
  6304. +@@ -1102,13 +1102,13 @@ int ieee80211_register_hw(struct ieee802
  6305. return 0;
  6306. @@ -52,7 +52,7 @@
  6307. fail_ifa:
  6308. pm_qos_remove_notifier(PM_QOS_NETWORK_LATENCY,
  6309. &local->network_latency_notifier);
  6310. -@@ -1124,10 +1124,10 @@ void ieee80211_unregister_hw(struct ieee
  6311. +@@ -1141,10 +1141,10 @@ void ieee80211_unregister_hw(struct ieee
  6312. pm_qos_remove_notifier(PM_QOS_NETWORK_LATENCY,
  6313. &local->network_latency_notifier);
  6314. diff --git a/package/kernel/mac80211/patches/210-ap_scan.patch b/package/kernel/mac80211/patches/210-ap_scan.patch
  6315. index 47dcec3..29f05c4 100644
  6316. --- a/package/kernel/mac80211/patches/210-ap_scan.patch
  6317. +++ b/package/kernel/mac80211/patches/210-ap_scan.patch
  6318. @@ -1,6 +1,6 @@
  6319. --- a/net/mac80211/cfg.c
  6320. +++ b/net/mac80211/cfg.c
  6321. -@@ -1963,7 +1963,7 @@ static int ieee80211_scan(struct wiphy *
  6322. +@@ -2008,7 +2008,7 @@ static int ieee80211_scan(struct wiphy *
  6323. * the frames sent while scanning on other channel will be
  6324. * lost)
  6325. */
  6326. 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
  6327. new file mode 100644
  6328. index 0000000..bddb15a
  6329. --- /dev/null
  6330. +++ b/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch
  6331. @@ -0,0 +1,31 @@
  6332. +From: Felix Fietkau <nbd@openwrt.org>
  6333. +Date: Sun, 7 Jun 2015 13:53:35 +0200
  6334. +Subject: [PATCH] ath9k: force rx_clear when disabling rx
  6335. +
  6336. +This makes stopping Rx more reliable and should reduce the frequency of
  6337. +Rx related DMA stop warnings
  6338. +
  6339. +Cc: stable@vger.kernel.org
  6340. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  6341. +---
  6342. +
  6343. +--- a/drivers/net/wireless/ath/ath9k/mac.c
  6344. ++++ b/drivers/net/wireless/ath/ath9k/mac.c
  6345. +@@ -677,13 +677,15 @@ void ath9k_hw_startpcureceive(struct ath
  6346. +
  6347. + ath9k_ani_reset(ah, is_scanning);
  6348. +
  6349. +- REG_CLR_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT));
  6350. ++ REG_CLR_BIT(ah, AR_DIAG_SW,
  6351. ++ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  6352. + }
  6353. + EXPORT_SYMBOL(ath9k_hw_startpcureceive);
  6354. +
  6355. + void ath9k_hw_abortpcurecv(struct ath_hw *ah)
  6356. + {
  6357. +- REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_ABORT | AR_DIAG_RX_DIS);
  6358. ++ REG_SET_BIT(ah, AR_DIAG_SW,
  6359. ++ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  6360. +
  6361. + ath9k_hw_disable_mib_counters(ah);
  6362. + }
  6363. 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
  6364. deleted file mode 100644
  6365. index 237121b..0000000
  6366. --- a/package/kernel/mac80211/patches/300-mac80211-add-an-intermediate-software-queue-implemen.patch
  6367. +++ /dev/null
  6368. @@ -1,882 +0,0 @@
  6369. -From: Felix Fietkau <nbd@openwrt.org>
  6370. -Date: Tue, 18 Nov 2014 23:58:51 +0100
  6371. -Subject: [PATCH] mac80211: add an intermediate software queue implementation
  6372. -
  6373. -This allows drivers to request per-vif and per-sta-tid queues from which
  6374. -they can pull frames. This makes it easier to keep the hardware queues
  6375. -short, and to improve fairness between clients and vifs.
  6376. -
  6377. -The task of scheduling packet transmission is left up to the driver -
  6378. -queueing is controlled by mac80211. Drivers can only dequeue packets by
  6379. -calling ieee80211_tx_dequeue. This makes it possible to add active queue
  6380. -management later without changing drivers using this code.
  6381. -
  6382. -This can also be used as a starting point to implement A-MSDU
  6383. -aggregation in a way that does not add artificially induced latency.
  6384. -
  6385. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  6386. ----
  6387. -
  6388. ---- a/include/net/mac80211.h
  6389. -+++ b/include/net/mac80211.h
  6390. -@@ -84,6 +84,39 @@
  6391. - *
  6392. - */
  6393. -
  6394. -+/**
  6395. -+ * DOC: mac80211 software tx queueing
  6396. -+ *
  6397. -+ * mac80211 provides an optional intermediate queueing implementation designed
  6398. -+ * to allow the driver to keep hardware queues short and provide some fairness
  6399. -+ * between different stations/interfaces.
  6400. -+ * In this model, the driver pulls data frames from the mac80211 queue instead
  6401. -+ * of letting mac80211 push them via drv_tx().
  6402. -+ * Other frames (e.g. control or management) are still pushed using drv_tx().
  6403. -+ *
  6404. -+ * Drivers indicate that they use this model by implementing the .wake_tx_queue
  6405. -+ * driver operation.
  6406. -+ *
  6407. -+ * Intermediate queues (struct ieee80211_txq) are kept per-sta per-tid, with a
  6408. -+ * single per-vif queue for multicast data frames.
  6409. -+ *
  6410. -+ * The driver is expected to initialize its private per-queue data for stations
  6411. -+ * and interfaces in the .add_interface and .sta_add ops.
  6412. -+ *
  6413. -+ * The driver can't access the queue directly. To dequeue a frame, it calls
  6414. -+ * ieee80211_tx_dequeue(). Whenever mac80211 adds a new frame to a queue, it
  6415. -+ * calls the .wake_tx_queue driver op.
  6416. -+ *
  6417. -+ * For AP powersave TIM handling, the driver only needs to indicate if it has
  6418. -+ * buffered packets in the driver specific data structures by calling
  6419. -+ * ieee80211_sta_set_buffered(). For frames buffered in the ieee80211_txq
  6420. -+ * struct, mac80211 sets the appropriate TIM PVB bits and calls
  6421. -+ * .release_buffered_frames().
  6422. -+ * In that callback the driver is therefore expected to release its own
  6423. -+ * buffered frames and afterwards also frames from the ieee80211_txq (obtained
  6424. -+ * via the usual ieee80211_tx_dequeue).
  6425. -+ */
  6426. -+
  6427. - struct device;
  6428. -
  6429. - /**
  6430. -@@ -1246,6 +1279,7 @@ enum ieee80211_vif_flags {
  6431. - * monitor interface (if that is requested.)
  6432. - * @drv_priv: data area for driver use, will always be aligned to
  6433. - * sizeof(void *).
  6434. -+ * @txq: the multicast data TX queue (if driver uses the TXQ abstraction)
  6435. - */
  6436. - struct ieee80211_vif {
  6437. - enum nl80211_iftype type;
  6438. -@@ -1257,6 +1291,8 @@ struct ieee80211_vif {
  6439. - u8 cab_queue;
  6440. - u8 hw_queue[IEEE80211_NUM_ACS];
  6441. -
  6442. -+ struct ieee80211_txq *txq;
  6443. -+
  6444. - struct ieee80211_chanctx_conf __rcu *chanctx_conf;
  6445. -
  6446. - u32 driver_flags;
  6447. -@@ -1501,6 +1537,7 @@ struct ieee80211_sta_rates {
  6448. - * @tdls_initiator: indicates the STA is an initiator of the TDLS link. Only
  6449. - * valid if the STA is a TDLS peer in the first place.
  6450. - * @mfp: indicates whether the STA uses management frame protection or not.
  6451. -+ * @txq: per-TID data TX queues (if driver uses the TXQ abstraction)
  6452. - */
  6453. - struct ieee80211_sta {
  6454. - u32 supp_rates[IEEE80211_NUM_BANDS];
  6455. -@@ -1519,6 +1556,8 @@ struct ieee80211_sta {
  6456. - bool tdls_initiator;
  6457. - bool mfp;
  6458. -
  6459. -+ struct ieee80211_txq *txq[IEEE80211_NUM_TIDS];
  6460. -+
  6461. - /* must be last */
  6462. - u8 drv_priv[0] __aligned(sizeof(void *));
  6463. - };
  6464. -@@ -1547,6 +1586,27 @@ struct ieee80211_tx_control {
  6465. - };
  6466. -
  6467. - /**
  6468. -+ * struct ieee80211_txq - Software intermediate tx queue
  6469. -+ *
  6470. -+ * @vif: &struct ieee80211_vif pointer from the add_interface callback.
  6471. -+ * @sta: station table entry, %NULL for per-vif queue
  6472. -+ * @tid: the TID for this queue (unused for per-vif queue)
  6473. -+ * @ac: the AC for this queue
  6474. -+ *
  6475. -+ * The driver can obtain packets from this queue by calling
  6476. -+ * ieee80211_tx_dequeue().
  6477. -+ */
  6478. -+struct ieee80211_txq {
  6479. -+ struct ieee80211_vif *vif;
  6480. -+ struct ieee80211_sta *sta;
  6481. -+ u8 tid;
  6482. -+ u8 ac;
  6483. -+
  6484. -+ /* must be last */
  6485. -+ u8 drv_priv[0] __aligned(sizeof(void *));
  6486. -+};
  6487. -+
  6488. -+/**
  6489. - * enum ieee80211_hw_flags - hardware flags
  6490. - *
  6491. - * These flags are used to indicate hardware capabilities to
  6492. -@@ -1770,6 +1830,8 @@ enum ieee80211_hw_flags {
  6493. - * within &struct ieee80211_sta.
  6494. - * @chanctx_data_size: size (in bytes) of the drv_priv data area
  6495. - * within &struct ieee80211_chanctx_conf.
  6496. -+ * @txq_data_size: size (in bytes) of the drv_priv data area
  6497. -+ * within @struct ieee80211_txq.
  6498. - *
  6499. - * @max_rates: maximum number of alternate rate retry stages the hw
  6500. - * can handle.
  6501. -@@ -1818,6 +1880,9 @@ enum ieee80211_hw_flags {
  6502. - * @n_cipher_schemes: a size of an array of cipher schemes definitions.
  6503. - * @cipher_schemes: a pointer to an array of cipher scheme definitions
  6504. - * supported by HW.
  6505. -+ *
  6506. -+ * @txq_ac_max_pending: maximum number of frames per AC pending in all txq
  6507. -+ * entries for a vif.
  6508. - */
  6509. - struct ieee80211_hw {
  6510. - struct ieee80211_conf conf;
  6511. -@@ -1830,6 +1895,7 @@ struct ieee80211_hw {
  6512. - int vif_data_size;
  6513. - int sta_data_size;
  6514. - int chanctx_data_size;
  6515. -+ int txq_data_size;
  6516. - u16 queues;
  6517. - u16 max_listen_interval;
  6518. - s8 max_signal;
  6519. -@@ -1846,6 +1912,7 @@ struct ieee80211_hw {
  6520. - u8 uapsd_max_sp_len;
  6521. - u8 n_cipher_schemes;
  6522. - const struct ieee80211_cipher_scheme *cipher_schemes;
  6523. -+ int txq_ac_max_pending;
  6524. - };
  6525. -
  6526. - /**
  6527. -@@ -3007,6 +3074,8 @@ enum ieee80211_reconfig_type {
  6528. - * response template is provided, together with the location of the
  6529. - * switch-timing IE within the template. The skb can only be used within
  6530. - * the function call.
  6531. -+ *
  6532. -+ * @wake_tx_queue: Called when new packets have been added to the queue.
  6533. - */
  6534. - struct ieee80211_ops {
  6535. - void (*tx)(struct ieee80211_hw *hw,
  6536. -@@ -3238,6 +3307,9 @@ struct ieee80211_ops {
  6537. - void (*tdls_recv_channel_switch)(struct ieee80211_hw *hw,
  6538. - struct ieee80211_vif *vif,
  6539. - struct ieee80211_tdls_ch_sw_params *params);
  6540. -+
  6541. -+ void (*wake_tx_queue)(struct ieee80211_hw *hw,
  6542. -+ struct ieee80211_txq *txq);
  6543. - };
  6544. -
  6545. - /**
  6546. -@@ -5249,4 +5321,15 @@ void ieee80211_unreserve_tid(struct ieee
  6547. - */
  6548. - size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
  6549. - const u8 *ids, int n_ids, size_t offset);
  6550. -+
  6551. -+/**
  6552. -+ * ieee80211_tx_dequeue - dequeue a packet from a software tx queue
  6553. -+ *
  6554. -+ * @hw: pointer as obtained from ieee80211_alloc_hw()
  6555. -+ * @txq: pointer obtained from station or virtual interface
  6556. -+ *
  6557. -+ * Returns the skb if successful, %NULL if no frame was available.
  6558. -+ */
  6559. -+struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
  6560. -+ struct ieee80211_txq *txq);
  6561. - #endif /* MAC80211_H */
  6562. ---- a/net/mac80211/driver-ops.h
  6563. -+++ b/net/mac80211/driver-ops.h
  6564. -@@ -1367,4 +1367,16 @@ drv_tdls_recv_channel_switch(struct ieee
  6565. - trace_drv_return_void(local);
  6566. - }
  6567. -
  6568. -+static inline void drv_wake_tx_queue(struct ieee80211_local *local,
  6569. -+ struct txq_info *txq)
  6570. -+{
  6571. -+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->txq.vif);
  6572. -+
  6573. -+ if (!check_sdata_in_driver(sdata))
  6574. -+ return;
  6575. -+
  6576. -+ trace_drv_wake_tx_queue(local, sdata, txq);
  6577. -+ local->ops->wake_tx_queue(&local->hw, &txq->txq);
  6578. -+}
  6579. -+
  6580. - #endif /* __MAC80211_DRIVER_OPS */
  6581. ---- a/net/mac80211/ieee80211_i.h
  6582. -+++ b/net/mac80211/ieee80211_i.h
  6583. -@@ -809,6 +809,19 @@ struct mac80211_qos_map {
  6584. - struct rcu_head rcu_head;
  6585. - };
  6586. -
  6587. -+enum txq_info_flags {
  6588. -+ IEEE80211_TXQ_STOP,
  6589. -+ IEEE80211_TXQ_AMPDU,
  6590. -+};
  6591. -+
  6592. -+struct txq_info {
  6593. -+ struct sk_buff_head queue;
  6594. -+ unsigned long flags;
  6595. -+
  6596. -+ /* keep last! */
  6597. -+ struct ieee80211_txq txq;
  6598. -+};
  6599. -+
  6600. - struct ieee80211_sub_if_data {
  6601. - struct list_head list;
  6602. -
  6603. -@@ -853,6 +866,7 @@ struct ieee80211_sub_if_data {
  6604. - bool control_port_no_encrypt;
  6605. - int encrypt_headroom;
  6606. -
  6607. -+ atomic_t txqs_len[IEEE80211_NUM_ACS];
  6608. - struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS];
  6609. - struct mac80211_qos_map __rcu *qos_map;
  6610. -
  6611. -@@ -1453,6 +1467,10 @@ static inline struct ieee80211_local *hw
  6612. - return container_of(hw, struct ieee80211_local, hw);
  6613. - }
  6614. -
  6615. -+static inline struct txq_info *to_txq_info(struct ieee80211_txq *txq)
  6616. -+{
  6617. -+ return container_of(txq, struct txq_info, txq);
  6618. -+}
  6619. -
  6620. - static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr)
  6621. - {
  6622. -@@ -1905,6 +1923,9 @@ static inline bool ieee80211_can_run_wor
  6623. - return true;
  6624. - }
  6625. -
  6626. -+void ieee80211_init_tx_queue(struct ieee80211_sub_if_data *sdata,
  6627. -+ struct sta_info *sta,
  6628. -+ struct txq_info *txq, int tid);
  6629. - void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
  6630. - u16 transaction, u16 auth_alg, u16 status,
  6631. - const u8 *extra, size_t extra_len, const u8 *bssid,
  6632. ---- a/net/mac80211/iface.c
  6633. -+++ b/net/mac80211/iface.c
  6634. -@@ -969,6 +969,13 @@ static void ieee80211_do_stop(struct iee
  6635. - }
  6636. - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
  6637. -
  6638. -+ if (sdata->vif.txq) {
  6639. -+ struct txq_info *txqi = to_txq_info(sdata->vif.txq);
  6640. -+
  6641. -+ ieee80211_purge_tx_queue(&local->hw, &txqi->queue);
  6642. -+ atomic_set(&sdata->txqs_len[txqi->txq.ac], 0);
  6643. -+ }
  6644. -+
  6645. - if (local->open_count == 0)
  6646. - ieee80211_clear_tx_pending(local);
  6647. -
  6648. -@@ -1674,6 +1681,7 @@ int ieee80211_if_add(struct ieee80211_lo
  6649. - {
  6650. - struct net_device *ndev = NULL;
  6651. - struct ieee80211_sub_if_data *sdata = NULL;
  6652. -+ struct txq_info *txqi;
  6653. - int ret, i;
  6654. - int txqs = 1;
  6655. -
  6656. -@@ -1693,10 +1701,18 @@ int ieee80211_if_add(struct ieee80211_lo
  6657. - ieee80211_assign_perm_addr(local, wdev->address, type);
  6658. - memcpy(sdata->vif.addr, wdev->address, ETH_ALEN);
  6659. - } else {
  6660. -+ int size = ALIGN(sizeof(*sdata) + local->hw.vif_data_size,
  6661. -+ sizeof(void *));
  6662. -+ int txq_size = 0;
  6663. -+
  6664. -+ if (local->ops->wake_tx_queue)
  6665. -+ txq_size += sizeof(struct txq_info) +
  6666. -+ local->hw.txq_data_size;
  6667. -+
  6668. - if (local->hw.queues >= IEEE80211_NUM_ACS)
  6669. - txqs = IEEE80211_NUM_ACS;
  6670. -
  6671. -- ndev = alloc_netdev_mqs(sizeof(*sdata) + local->hw.vif_data_size,
  6672. -+ ndev = alloc_netdev_mqs(size + txq_size,
  6673. - name, NET_NAME_UNKNOWN,
  6674. - ieee80211_if_setup, txqs, 1);
  6675. - if (!ndev)
  6676. -@@ -1731,6 +1747,11 @@ int ieee80211_if_add(struct ieee80211_lo
  6677. - memcpy(sdata->vif.addr, ndev->dev_addr, ETH_ALEN);
  6678. - memcpy(sdata->name, ndev->name, IFNAMSIZ);
  6679. -
  6680. -+ if (txq_size) {
  6681. -+ txqi = netdev_priv(ndev) + size;
  6682. -+ ieee80211_init_tx_queue(sdata, NULL, txqi, 0);
  6683. -+ }
  6684. -+
  6685. - sdata->dev = ndev;
  6686. - }
  6687. -
  6688. ---- a/net/mac80211/main.c
  6689. -+++ b/net/mac80211/main.c
  6690. -@@ -1019,6 +1019,9 @@ int ieee80211_register_hw(struct ieee802
  6691. -
  6692. - local->dynamic_ps_forced_timeout = -1;
  6693. -
  6694. -+ if (!local->hw.txq_ac_max_pending)
  6695. -+ local->hw.txq_ac_max_pending = 64;
  6696. -+
  6697. - result = ieee80211_wep_init(local);
  6698. - if (result < 0)
  6699. - wiphy_debug(local->hw.wiphy, "Failed to initialize wep: %d\n",
  6700. ---- a/net/mac80211/sta_info.c
  6701. -+++ b/net/mac80211/sta_info.c
  6702. -@@ -118,6 +118,16 @@ static void __cleanup_single_sta(struct
  6703. - atomic_dec(&ps->num_sta_ps);
  6704. - }
  6705. -
  6706. -+ if (sta->sta.txq[0]) {
  6707. -+ for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) {
  6708. -+ struct txq_info *txqi = to_txq_info(sta->sta.txq[i]);
  6709. -+ int n = skb_queue_len(&txqi->queue);
  6710. -+
  6711. -+ ieee80211_purge_tx_queue(&local->hw, &txqi->queue);
  6712. -+ atomic_sub(n, &sdata->txqs_len[txqi->txq.ac]);
  6713. -+ }
  6714. -+ }
  6715. -+
  6716. - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
  6717. - local->total_ps_buffered -= skb_queue_len(&sta->ps_tx_buf[ac]);
  6718. - ieee80211_purge_tx_queue(&local->hw, &sta->ps_tx_buf[ac]);
  6719. -@@ -234,6 +244,8 @@ void sta_info_free(struct ieee80211_loca
  6720. -
  6721. - sta_dbg(sta->sdata, "Destroyed STA %pM\n", sta->sta.addr);
  6722. -
  6723. -+ if (sta->sta.txq[0])
  6724. -+ kfree(to_txq_info(sta->sta.txq[0]));
  6725. - kfree(rcu_dereference_raw(sta->sta.rates));
  6726. - kfree(sta);
  6727. - }
  6728. -@@ -285,11 +297,12 @@ struct sta_info *sta_info_alloc(struct i
  6729. - const u8 *addr, gfp_t gfp)
  6730. - {
  6731. - struct ieee80211_local *local = sdata->local;
  6732. -+ struct ieee80211_hw *hw = &local->hw;
  6733. - struct sta_info *sta;
  6734. - struct timespec uptime;
  6735. - int i;
  6736. -
  6737. -- sta = kzalloc(sizeof(*sta) + local->hw.sta_data_size, gfp);
  6738. -+ sta = kzalloc(sizeof(*sta) + hw->sta_data_size, gfp);
  6739. - if (!sta)
  6740. - return NULL;
  6741. -
  6742. -@@ -321,11 +334,25 @@ struct sta_info *sta_info_alloc(struct i
  6743. - for (i = 0; i < ARRAY_SIZE(sta->chain_signal_avg); i++)
  6744. - ewma_init(&sta->chain_signal_avg[i], 1024, 8);
  6745. -
  6746. -- if (sta_prepare_rate_control(local, sta, gfp)) {
  6747. -- kfree(sta);
  6748. -- return NULL;
  6749. -+ if (local->ops->wake_tx_queue) {
  6750. -+ void *txq_data;
  6751. -+ int size = sizeof(struct txq_info) +
  6752. -+ ALIGN(hw->txq_data_size, sizeof(void *));
  6753. -+
  6754. -+ txq_data = kcalloc(ARRAY_SIZE(sta->sta.txq), size, gfp);
  6755. -+ if (!txq_data)
  6756. -+ goto free;
  6757. -+
  6758. -+ for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) {
  6759. -+ struct txq_info *txq = txq_data + i * size;
  6760. -+
  6761. -+ ieee80211_init_tx_queue(sdata, sta, txq, i);
  6762. -+ }
  6763. - }
  6764. -
  6765. -+ if (sta_prepare_rate_control(local, sta, gfp))
  6766. -+ goto free_txq;
  6767. -+
  6768. - for (i = 0; i < IEEE80211_NUM_TIDS; i++) {
  6769. - /*
  6770. - * timer_to_tid must be initialized with identity mapping
  6771. -@@ -346,7 +373,7 @@ struct sta_info *sta_info_alloc(struct i
  6772. - if (sdata->vif.type == NL80211_IFTYPE_AP ||
  6773. - sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
  6774. - struct ieee80211_supported_band *sband =
  6775. -- local->hw.wiphy->bands[ieee80211_get_sdata_band(sdata)];
  6776. -+ hw->wiphy->bands[ieee80211_get_sdata_band(sdata)];
  6777. - u8 smps = (sband->ht_cap.cap & IEEE80211_HT_CAP_SM_PS) >>
  6778. - IEEE80211_HT_CAP_SM_PS_SHIFT;
  6779. - /*
  6780. -@@ -371,6 +398,13 @@ struct sta_info *sta_info_alloc(struct i
  6781. - sta_dbg(sdata, "Allocated STA %pM\n", sta->sta.addr);
  6782. -
  6783. - return sta;
  6784. -+
  6785. -+free_txq:
  6786. -+ if (sta->sta.txq[0])
  6787. -+ kfree(to_txq_info(sta->sta.txq[0]));
  6788. -+free:
  6789. -+ kfree(sta);
  6790. -+ return NULL;
  6791. - }
  6792. -
  6793. - static int sta_info_insert_check(struct sta_info *sta)
  6794. -@@ -640,6 +674,8 @@ static void __sta_info_recalc_tim(struct
  6795. -
  6796. - indicate_tim |=
  6797. - sta->driver_buffered_tids & tids;
  6798. -+ indicate_tim |=
  6799. -+ sta->txq_buffered_tids & tids;
  6800. - }
  6801. -
  6802. - done:
  6803. -@@ -1071,7 +1107,7 @@ void ieee80211_sta_ps_deliver_wakeup(str
  6804. - struct ieee80211_sub_if_data *sdata = sta->sdata;
  6805. - struct ieee80211_local *local = sdata->local;
  6806. - struct sk_buff_head pending;
  6807. -- int filtered = 0, buffered = 0, ac;
  6808. -+ int filtered = 0, buffered = 0, ac, i;
  6809. - unsigned long flags;
  6810. - struct ps_data *ps;
  6811. -
  6812. -@@ -1090,10 +1126,22 @@ void ieee80211_sta_ps_deliver_wakeup(str
  6813. -
  6814. - BUILD_BUG_ON(BITS_TO_LONGS(IEEE80211_NUM_TIDS) > 1);
  6815. - sta->driver_buffered_tids = 0;
  6816. -+ sta->txq_buffered_tids = 0;
  6817. -
  6818. - if (!(local->hw.flags & IEEE80211_HW_AP_LINK_PS))
  6819. - drv_sta_notify(local, sdata, STA_NOTIFY_AWAKE, &sta->sta);
  6820. -
  6821. -+ if (sta->sta.txq[0]) {
  6822. -+ for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) {
  6823. -+ struct txq_info *txqi = to_txq_info(sta->sta.txq[i]);
  6824. -+
  6825. -+ if (!skb_queue_len(&txqi->queue))
  6826. -+ continue;
  6827. -+
  6828. -+ drv_wake_tx_queue(local, txqi);
  6829. -+ }
  6830. -+ }
  6831. -+
  6832. - skb_queue_head_init(&pending);
  6833. -
  6834. - /* sync with ieee80211_tx_h_unicast_ps_buf */
  6835. -@@ -1275,8 +1323,10 @@ ieee80211_sta_ps_deliver_response(struct
  6836. - /* if we already have frames from software, then we can't also
  6837. - * release from hardware queues
  6838. - */
  6839. -- if (skb_queue_empty(&frames))
  6840. -+ if (skb_queue_empty(&frames)) {
  6841. - driver_release_tids |= sta->driver_buffered_tids & tids;
  6842. -+ driver_release_tids |= sta->txq_buffered_tids & tids;
  6843. -+ }
  6844. -
  6845. - if (driver_release_tids) {
  6846. - /* If the driver has data on more than one TID then
  6847. -@@ -1447,6 +1497,9 @@ ieee80211_sta_ps_deliver_response(struct
  6848. -
  6849. - sta_info_recalc_tim(sta);
  6850. - } else {
  6851. -+ unsigned long tids = sta->txq_buffered_tids & driver_release_tids;
  6852. -+ int tid;
  6853. -+
  6854. - /*
  6855. - * We need to release a frame that is buffered somewhere in the
  6856. - * driver ... it'll have to handle that.
  6857. -@@ -1466,8 +1519,22 @@ ieee80211_sta_ps_deliver_response(struct
  6858. - * that the TID(s) became empty before returning here from the
  6859. - * release function.
  6860. - * Either way, however, when the driver tells us that the TID(s)
  6861. -- * became empty we'll do the TIM recalculation.
  6862. -+ * became empty or we find that a txq became empty, we'll do the
  6863. -+ * TIM recalculation.
  6864. - */
  6865. -+
  6866. -+ if (!sta->sta.txq[0])
  6867. -+ return;
  6868. -+
  6869. -+ for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) {
  6870. -+ struct txq_info *txqi = to_txq_info(sta->sta.txq[tid]);
  6871. -+
  6872. -+ if (!(tids & BIT(tid)) || skb_queue_len(&txqi->queue))
  6873. -+ continue;
  6874. -+
  6875. -+ sta_info_recalc_tim(sta);
  6876. -+ break;
  6877. -+ }
  6878. - }
  6879. - }
  6880. -
  6881. ---- a/net/mac80211/sta_info.h
  6882. -+++ b/net/mac80211/sta_info.h
  6883. -@@ -274,6 +274,7 @@ struct sta_ampdu_mlme {
  6884. - * entered power saving state, these are also delivered to
  6885. - * the station when it leaves powersave or polls for frames
  6886. - * @driver_buffered_tids: bitmap of TIDs the driver has data buffered on
  6887. -+ * @txq_buffered_tids: bitmap of TIDs that mac80211 has txq data buffered on
  6888. - * @rx_packets: Number of MSDUs received from this STA
  6889. - * @rx_bytes: Number of bytes received from this STA
  6890. - * @last_rx: time (in jiffies) when last frame was received from this STA
  6891. -@@ -368,6 +369,7 @@ struct sta_info {
  6892. - struct sk_buff_head ps_tx_buf[IEEE80211_NUM_ACS];
  6893. - struct sk_buff_head tx_filtered[IEEE80211_NUM_ACS];
  6894. - unsigned long driver_buffered_tids;
  6895. -+ unsigned long txq_buffered_tids;
  6896. -
  6897. - /* Updated from RX path only, no locking requirements */
  6898. - unsigned long rx_packets;
  6899. ---- a/net/mac80211/trace.h
  6900. -+++ b/net/mac80211/trace.h
  6901. -@@ -2312,6 +2312,37 @@ TRACE_EVENT(drv_tdls_recv_channel_switch
  6902. - )
  6903. - );
  6904. -
  6905. -+TRACE_EVENT(drv_wake_tx_queue,
  6906. -+ TP_PROTO(struct ieee80211_local *local,
  6907. -+ struct ieee80211_sub_if_data *sdata,
  6908. -+ struct txq_info *txq),
  6909. -+
  6910. -+ TP_ARGS(local, sdata, txq),
  6911. -+
  6912. -+ TP_STRUCT__entry(
  6913. -+ LOCAL_ENTRY
  6914. -+ VIF_ENTRY
  6915. -+ STA_ENTRY
  6916. -+ __field(u8, ac)
  6917. -+ __field(u8, tid)
  6918. -+ ),
  6919. -+
  6920. -+ TP_fast_assign(
  6921. -+ struct ieee80211_sta *sta = txq->txq.sta;
  6922. -+
  6923. -+ LOCAL_ASSIGN;
  6924. -+ VIF_ASSIGN;
  6925. -+ STA_ASSIGN;
  6926. -+ __entry->ac = txq->txq.ac;
  6927. -+ __entry->tid = txq->txq.tid;
  6928. -+ ),
  6929. -+
  6930. -+ TP_printk(
  6931. -+ LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " ac:%d tid:%d",
  6932. -+ LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->ac, __entry->tid
  6933. -+ )
  6934. -+);
  6935. -+
  6936. - #ifdef CPTCFG_MAC80211_MESSAGE_TRACING
  6937. - #undef TRACE_SYSTEM
  6938. - #define TRACE_SYSTEM mac80211_msg
  6939. ---- a/net/mac80211/tx.c
  6940. -+++ b/net/mac80211/tx.c
  6941. -@@ -776,12 +776,22 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021
  6942. - return TX_CONTINUE;
  6943. - }
  6944. -
  6945. -+static __le16 ieee80211_tx_next_seq(struct sta_info *sta, int tid)
  6946. -+{
  6947. -+ u16 *seq = &sta->tid_seq[tid];
  6948. -+ __le16 ret = cpu_to_le16(*seq);
  6949. -+
  6950. -+ /* Increase the sequence number. */
  6951. -+ *seq = (*seq + 0x10) & IEEE80211_SCTL_SEQ;
  6952. -+
  6953. -+ return ret;
  6954. -+}
  6955. -+
  6956. - static ieee80211_tx_result debug_noinline
  6957. - ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx)
  6958. - {
  6959. - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
  6960. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
  6961. -- u16 *seq;
  6962. - u8 *qc;
  6963. - int tid;
  6964. -
  6965. -@@ -832,13 +842,10 @@ ieee80211_tx_h_sequence(struct ieee80211
  6966. -
  6967. - qc = ieee80211_get_qos_ctl(hdr);
  6968. - tid = *qc & IEEE80211_QOS_CTL_TID_MASK;
  6969. -- seq = &tx->sta->tid_seq[tid];
  6970. - tx->sta->tx_msdu[tid]++;
  6971. -
  6972. -- hdr->seq_ctrl = cpu_to_le16(*seq);
  6973. --
  6974. -- /* Increase the sequence number. */
  6975. -- *seq = (*seq + 0x10) & IEEE80211_SCTL_SEQ;
  6976. -+ if (!tx->sta->sta.txq[0])
  6977. -+ hdr->seq_ctrl = ieee80211_tx_next_seq(tx->sta, tid);
  6978. -
  6979. - return TX_CONTINUE;
  6980. - }
  6981. -@@ -1067,7 +1074,7 @@ static bool ieee80211_tx_prep_agg(struct
  6982. - * nothing -- this aggregation session is being started
  6983. - * but that might still fail with the driver
  6984. - */
  6985. -- } else {
  6986. -+ } else if (!tx->sta->sta.txq[tid]) {
  6987. - spin_lock(&tx->sta->lock);
  6988. - /*
  6989. - * Need to re-check now, because we may get here
  6990. -@@ -1201,13 +1208,102 @@ ieee80211_tx_prepare(struct ieee80211_su
  6991. - return TX_CONTINUE;
  6992. - }
  6993. -
  6994. -+static void ieee80211_drv_tx(struct ieee80211_local *local,
  6995. -+ struct ieee80211_vif *vif,
  6996. -+ struct ieee80211_sta *pubsta,
  6997. -+ struct sk_buff *skb)
  6998. -+{
  6999. -+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  7000. -+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
  7001. -+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  7002. -+ struct ieee80211_tx_control control = {
  7003. -+ .sta = pubsta,
  7004. -+ };
  7005. -+ struct ieee80211_txq *txq = NULL;
  7006. -+ struct txq_info *txqi;
  7007. -+ u8 ac;
  7008. -+
  7009. -+ if (info->control.flags & IEEE80211_TX_CTRL_PS_RESPONSE)
  7010. -+ goto tx_normal;
  7011. -+
  7012. -+ if (!ieee80211_is_data(hdr->frame_control))
  7013. -+ goto tx_normal;
  7014. -+
  7015. -+ if (pubsta) {
  7016. -+ u8 tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK;
  7017. -+
  7018. -+ txq = pubsta->txq[tid];
  7019. -+ } else if (vif) {
  7020. -+ txq = vif->txq;
  7021. -+ }
  7022. -+
  7023. -+ if (!txq)
  7024. -+ goto tx_normal;
  7025. -+
  7026. -+ ac = txq->ac;
  7027. -+ txqi = to_txq_info(txq);
  7028. -+ atomic_inc(&sdata->txqs_len[ac]);
  7029. -+ if (atomic_read(&sdata->txqs_len[ac]) >= local->hw.txq_ac_max_pending)
  7030. -+ netif_stop_subqueue(sdata->dev, ac);
  7031. -+
  7032. -+ skb_queue_tail(&txqi->queue, skb);
  7033. -+ drv_wake_tx_queue(local, txqi);
  7034. -+
  7035. -+ return;
  7036. -+
  7037. -+tx_normal:
  7038. -+ drv_tx(local, &control, skb);
  7039. -+}
  7040. -+
  7041. -+struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
  7042. -+ struct ieee80211_txq *txq)
  7043. -+{
  7044. -+ struct ieee80211_local *local = hw_to_local(hw);
  7045. -+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->vif);
  7046. -+ struct txq_info *txqi = container_of(txq, struct txq_info, txq);
  7047. -+ struct ieee80211_hdr *hdr;
  7048. -+ struct sk_buff *skb = NULL;
  7049. -+ u8 ac = txq->ac;
  7050. -+
  7051. -+ spin_lock_bh(&txqi->queue.lock);
  7052. -+
  7053. -+ if (test_bit(IEEE80211_TXQ_STOP, &txqi->flags))
  7054. -+ goto out;
  7055. -+
  7056. -+ skb = __skb_dequeue(&txqi->queue);
  7057. -+ if (!skb)
  7058. -+ goto out;
  7059. -+
  7060. -+ atomic_dec(&sdata->txqs_len[ac]);
  7061. -+ if (__netif_subqueue_stopped(sdata->dev, ac))
  7062. -+ ieee80211_propagate_queue_wake(local, sdata->vif.hw_queue[ac]);
  7063. -+
  7064. -+ hdr = (struct ieee80211_hdr *)skb->data;
  7065. -+ if (txq->sta && ieee80211_is_data_qos(hdr->frame_control)) {
  7066. -+ struct sta_info *sta = container_of(txq->sta, struct sta_info,
  7067. -+ sta);
  7068. -+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  7069. -+
  7070. -+ hdr->seq_ctrl = ieee80211_tx_next_seq(sta, txq->tid);
  7071. -+ if (test_bit(IEEE80211_TXQ_AMPDU, &txqi->flags))
  7072. -+ info->flags |= IEEE80211_TX_CTL_AMPDU;
  7073. -+ else
  7074. -+ info->flags &= ~IEEE80211_TX_CTL_AMPDU;
  7075. -+ }
  7076. -+
  7077. -+out:
  7078. -+ spin_unlock_bh(&txqi->queue.lock);
  7079. -+
  7080. -+ return skb;
  7081. -+}
  7082. -+EXPORT_SYMBOL(ieee80211_tx_dequeue);
  7083. -+
  7084. - static bool ieee80211_tx_frags(struct ieee80211_local *local,
  7085. - struct ieee80211_vif *vif,
  7086. - struct ieee80211_sta *sta,
  7087. - struct sk_buff_head *skbs,
  7088. - bool txpending)
  7089. - {
  7090. -- struct ieee80211_tx_control control;
  7091. - struct sk_buff *skb, *tmp;
  7092. - unsigned long flags;
  7093. -
  7094. -@@ -1265,10 +1361,9 @@ static bool ieee80211_tx_frags(struct ie
  7095. - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
  7096. -
  7097. - info->control.vif = vif;
  7098. -- control.sta = sta;
  7099. -
  7100. - __skb_unlink(skb, skbs);
  7101. -- drv_tx(local, &control, skb);
  7102. -+ ieee80211_drv_tx(local, vif, sta, skb);
  7103. - }
  7104. -
  7105. - return true;
  7106. ---- a/net/mac80211/util.c
  7107. -+++ b/net/mac80211/util.c
  7108. -@@ -308,6 +308,11 @@ void ieee80211_propagate_queue_wake(stru
  7109. - for (ac = 0; ac < n_acs; ac++) {
  7110. - int ac_queue = sdata->vif.hw_queue[ac];
  7111. -
  7112. -+ if (local->ops->wake_tx_queue &&
  7113. -+ (atomic_read(&sdata->txqs_len[ac]) >
  7114. -+ local->hw.txq_ac_max_pending))
  7115. -+ continue;
  7116. -+
  7117. - if (ac_queue == queue ||
  7118. - (sdata->vif.cab_queue == queue &&
  7119. - local->queue_stop_reasons[ac_queue] == 0 &&
  7120. -@@ -3307,3 +3312,20 @@ u8 *ieee80211_add_wmm_info_ie(u8 *buf, u
  7121. -
  7122. - return buf;
  7123. - }
  7124. -+
  7125. -+void ieee80211_init_tx_queue(struct ieee80211_sub_if_data *sdata,
  7126. -+ struct sta_info *sta,
  7127. -+ struct txq_info *txqi, int tid)
  7128. -+{
  7129. -+ skb_queue_head_init(&txqi->queue);
  7130. -+ txqi->txq.vif = &sdata->vif;
  7131. -+
  7132. -+ if (sta) {
  7133. -+ txqi->txq.sta = &sta->sta;
  7134. -+ sta->sta.txq[tid] = &txqi->txq;
  7135. -+ txqi->txq.ac = ieee802_1d_to_ac[tid & 7];
  7136. -+ } else {
  7137. -+ sdata->vif.txq = &txqi->txq;
  7138. -+ txqi->txq.ac = IEEE80211_AC_BE;
  7139. -+ }
  7140. -+}
  7141. ---- a/net/mac80211/rx.c
  7142. -+++ b/net/mac80211/rx.c
  7143. -@@ -1176,6 +1176,7 @@ static void sta_ps_start(struct sta_info
  7144. - struct ieee80211_sub_if_data *sdata = sta->sdata;
  7145. - struct ieee80211_local *local = sdata->local;
  7146. - struct ps_data *ps;
  7147. -+ int tid;
  7148. -
  7149. - if (sta->sdata->vif.type == NL80211_IFTYPE_AP ||
  7150. - sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
  7151. -@@ -1189,6 +1190,18 @@ static void sta_ps_start(struct sta_info
  7152. - drv_sta_notify(local, sdata, STA_NOTIFY_SLEEP, &sta->sta);
  7153. - ps_dbg(sdata, "STA %pM aid %d enters power save mode\n",
  7154. - sta->sta.addr, sta->sta.aid);
  7155. -+
  7156. -+ if (!sta->sta.txq[0])
  7157. -+ return;
  7158. -+
  7159. -+ for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) {
  7160. -+ struct txq_info *txqi = to_txq_info(sta->sta.txq[tid]);
  7161. -+
  7162. -+ if (!skb_queue_len(&txqi->queue))
  7163. -+ set_bit(tid, &sta->txq_buffered_tids);
  7164. -+ else
  7165. -+ clear_bit(tid, &sta->txq_buffered_tids);
  7166. -+ }
  7167. - }
  7168. -
  7169. - static void sta_ps_end(struct sta_info *sta)
  7170. ---- a/net/mac80211/agg-tx.c
  7171. -+++ b/net/mac80211/agg-tx.c
  7172. -@@ -188,6 +188,43 @@ ieee80211_wake_queue_agg(struct ieee8021
  7173. - __release(agg_queue);
  7174. - }
  7175. -
  7176. -+static void
  7177. -+ieee80211_agg_stop_txq(struct sta_info *sta, int tid)
  7178. -+{
  7179. -+ struct ieee80211_txq *txq = sta->sta.txq[tid];
  7180. -+ struct txq_info *txqi;
  7181. -+
  7182. -+ if (!txq)
  7183. -+ return;
  7184. -+
  7185. -+ txqi = to_txq_info(txq);
  7186. -+
  7187. -+ /* Lock here to protect against further seqno updates on dequeue */
  7188. -+ spin_lock_bh(&txqi->queue.lock);
  7189. -+ set_bit(IEEE80211_TXQ_STOP, &txqi->flags);
  7190. -+ spin_unlock_bh(&txqi->queue.lock);
  7191. -+}
  7192. -+
  7193. -+static void
  7194. -+ieee80211_agg_start_txq(struct sta_info *sta, int tid, bool enable)
  7195. -+{
  7196. -+ struct ieee80211_txq *txq = sta->sta.txq[tid];
  7197. -+ struct txq_info *txqi;
  7198. -+
  7199. -+ if (!txq)
  7200. -+ return;
  7201. -+
  7202. -+ txqi = to_txq_info(txq);
  7203. -+
  7204. -+ if (enable)
  7205. -+ set_bit(IEEE80211_TXQ_AMPDU, &txqi->flags);
  7206. -+ else
  7207. -+ clear_bit(IEEE80211_TXQ_AMPDU, &txqi->flags);
  7208. -+
  7209. -+ clear_bit(IEEE80211_TXQ_STOP, &txqi->flags);
  7210. -+ drv_wake_tx_queue(sta->sdata->local, txqi);
  7211. -+}
  7212. -+
  7213. - /*
  7214. - * splice packets from the STA's pending to the local pending,
  7215. - * requires a call to ieee80211_agg_splice_finish later
  7216. -@@ -247,6 +284,7 @@ static void ieee80211_remove_tid_tx(stru
  7217. - ieee80211_assign_tid_tx(sta, tid, NULL);
  7218. -
  7219. - ieee80211_agg_splice_finish(sta->sdata, tid);
  7220. -+ ieee80211_agg_start_txq(sta, tid, false);
  7221. -
  7222. - kfree_rcu(tid_tx, rcu_head);
  7223. - }
  7224. -@@ -418,6 +456,8 @@ void ieee80211_tx_ba_session_handle_star
  7225. - */
  7226. - clear_bit(HT_AGG_STATE_WANT_START, &tid_tx->state);
  7227. -
  7228. -+ ieee80211_agg_stop_txq(sta, tid);
  7229. -+
  7230. - /*
  7231. - * Make sure no packets are being processed. This ensures that
  7232. - * we have a valid starting sequence number and that in-flight
  7233. -@@ -440,6 +480,8 @@ void ieee80211_tx_ba_session_handle_star
  7234. - ieee80211_agg_splice_finish(sdata, tid);
  7235. - spin_unlock_bh(&sta->lock);
  7236. -
  7237. -+ ieee80211_agg_start_txq(sta, tid, false);
  7238. -+
  7239. - kfree_rcu(tid_tx, rcu_head);
  7240. - return;
  7241. - }
  7242. -@@ -666,6 +708,8 @@ static void ieee80211_agg_tx_operational
  7243. - ieee80211_agg_splice_finish(sta->sdata, tid);
  7244. -
  7245. - spin_unlock_bh(&sta->lock);
  7246. -+
  7247. -+ ieee80211_agg_start_txq(sta, tid, true);
  7248. - }
  7249. -
  7250. - void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid)
  7251. 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
  7252. new file mode 100644
  7253. index 0000000..4faac0d
  7254. --- /dev/null
  7255. +++ b/package/kernel/mac80211/patches/301-ath9k-limit-retries-for-powersave-response-frames.patch
  7256. @@ -0,0 +1,121 @@
  7257. +From: Felix Fietkau <nbd@openwrt.org>
  7258. +Date: Thu, 2 Jul 2015 15:20:56 +0200
  7259. +Subject: [PATCH] ath9k: limit retries for powersave response frames
  7260. +
  7261. +In some cases, the channel might be busy enough that an ath9k AP's
  7262. +response to PS-Poll frames might be too slow and the station has already
  7263. +gone to sleep. To avoid wasting too much airtime on this, limit the
  7264. +number of retries on such frames and ensure that no sample rate gets
  7265. +used.
  7266. +
  7267. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  7268. +---
  7269. +
  7270. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  7271. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  7272. +@@ -147,10 +147,25 @@ static void ath_send_bar(struct ath_atx_
  7273. + }
  7274. +
  7275. + static void ath_set_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta,
  7276. +- struct ath_buf *bf)
  7277. ++ struct ath_buf *bf, bool ps)
  7278. + {
  7279. ++ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(bf->bf_mpdu);
  7280. ++
  7281. ++ if (ps) {
  7282. ++ /* Clear the first rate to avoid using a sample rate for PS frames */
  7283. ++ info->control.rates[0].idx = -1;
  7284. ++ info->control.rates[0].count = 0;
  7285. ++ }
  7286. ++
  7287. + ieee80211_get_tx_rates(vif, sta, bf->bf_mpdu, bf->rates,
  7288. + ARRAY_SIZE(bf->rates));
  7289. ++ if (!ps)
  7290. ++ return;
  7291. ++
  7292. ++ if (bf->rates[0].count > 2)
  7293. ++ bf->rates[0].count = 2;
  7294. ++
  7295. ++ bf->rates[1].idx = -1;
  7296. + }
  7297. +
  7298. + static void ath_txq_skb_done(struct ath_softc *sc, struct ath_txq *txq,
  7299. +@@ -1430,7 +1445,7 @@ ath_tx_form_burst(struct ath_softc *sc,
  7300. + if (tx_info->flags & IEEE80211_TX_CTL_AMPDU)
  7301. + break;
  7302. +
  7303. +- ath_set_rates(tid->an->vif, tid->an->sta, bf);
  7304. ++ ath_set_rates(tid->an->vif, tid->an->sta, bf, false);
  7305. + } while (1);
  7306. + }
  7307. +
  7308. +@@ -1461,7 +1476,7 @@ static bool ath_tx_sched_aggr(struct ath
  7309. + return false;
  7310. + }
  7311. +
  7312. +- ath_set_rates(tid->an->vif, tid->an->sta, bf);
  7313. ++ ath_set_rates(tid->an->vif, tid->an->sta, bf, false);
  7314. + if (aggr)
  7315. + last = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf,
  7316. + tid_q, &aggr_len);
  7317. +@@ -1653,7 +1668,7 @@ void ath9k_release_buffered_frames(struc
  7318. +
  7319. + __skb_unlink(bf->bf_mpdu, tid_q);
  7320. + list_add_tail(&bf->list, &bf_q);
  7321. +- ath_set_rates(tid->an->vif, tid->an->sta, bf);
  7322. ++ ath_set_rates(tid->an->vif, tid->an->sta, bf, true);
  7323. + if (bf_isampdu(bf)) {
  7324. + ath_tx_addto_baw(sc, tid, bf);
  7325. + bf->bf_state.bf_type &= ~BUF_AGGR;
  7326. +@@ -2318,7 +2333,7 @@ int ath_tx_start(struct ieee80211_hw *hw
  7327. + struct ath_txq *txq = txctl->txq;
  7328. + struct ath_atx_tid *tid = NULL;
  7329. + struct ath_buf *bf;
  7330. +- bool queue, skip_uapsd = false, ps_resp;
  7331. ++ bool queue, ps_resp;
  7332. + int q, ret;
  7333. +
  7334. + if (vif)
  7335. +@@ -2365,13 +2380,13 @@ int ath_tx_start(struct ieee80211_hw *hw
  7336. + if (!txctl->an)
  7337. + txctl->an = &avp->mcast_node;
  7338. + queue = true;
  7339. +- skip_uapsd = true;
  7340. ++ ps_resp = false;
  7341. + }
  7342. +
  7343. + if (txctl->an && queue)
  7344. + tid = ath_get_skb_tid(sc, txctl->an, skb);
  7345. +
  7346. +- if (!skip_uapsd && ps_resp) {
  7347. ++ if (ps_resp) {
  7348. + ath_txq_unlock(sc, txq);
  7349. + txq = sc->tx.uapsdq;
  7350. + ath_txq_lock(sc, txq);
  7351. +@@ -2409,7 +2424,7 @@ int ath_tx_start(struct ieee80211_hw *hw
  7352. + if (txctl->paprd)
  7353. + bf->bf_state.bfs_paprd_timestamp = jiffies;
  7354. +
  7355. +- ath_set_rates(vif, sta, bf);
  7356. ++ ath_set_rates(vif, sta, bf, ps_resp);
  7357. + ath_tx_send_normal(sc, txq, tid, skb);
  7358. +
  7359. + out:
  7360. +@@ -2448,7 +2463,7 @@ void ath_tx_cabq(struct ieee80211_hw *hw
  7361. + break;
  7362. +
  7363. + bf->bf_lastbf = bf;
  7364. +- ath_set_rates(vif, NULL, bf);
  7365. ++ ath_set_rates(vif, NULL, bf, false);
  7366. + ath_buf_set_rate(sc, bf, &info, fi->framelen, false);
  7367. + duration += info.rates[0].PktDuration;
  7368. + if (bf_tail)
  7369. +@@ -2968,7 +2983,7 @@ int ath9k_tx99_send(struct ath_softc *sc
  7370. + return -EINVAL;
  7371. + }
  7372. +
  7373. +- ath_set_rates(sc->tx99_vif, NULL, bf);
  7374. ++ ath_set_rates(sc->tx99_vif, NULL, bf, false);
  7375. +
  7376. + ath9k_hw_set_desc_link(sc->sc_ah, bf->bf_desc, bf->bf_daddr);
  7377. + ath9k_hw_tx99_start(sc->sc_ah, txctl->txq->axq_qnum);
  7378. diff --git a/package/kernel/mac80211/patches/301-mac80211-lock-rate-control.patch b/package/kernel/mac80211/patches/301-mac80211-lock-rate-control.patch
  7379. deleted file mode 100644
  7380. index 465d943..0000000
  7381. --- a/package/kernel/mac80211/patches/301-mac80211-lock-rate-control.patch
  7382. +++ /dev/null
  7383. @@ -1,125 +0,0 @@
  7384. -From: Johannes Berg <johannes.berg@intel.com>
  7385. -Date: Wed, 11 Mar 2015 09:14:15 +0100
  7386. -Subject: [PATCH] mac80211: lock rate control
  7387. -
  7388. -Both minstrel (reported by Sven Eckelmann) and the iwlwifi rate
  7389. -control aren't properly taking concurrency into account. It's
  7390. -likely that the same is true for other rate control algorithms.
  7391. -
  7392. -In the case of minstrel this manifests itself in crashes when an
  7393. -update and other data access are run concurrently, for example
  7394. -when the stations change bandwidth or similar. In iwlwifi, this
  7395. -can cause firmware crashes.
  7396. -
  7397. -Since fixing all rate control algorithms will be very difficult,
  7398. -just provide locking for invocations. This protects the internal
  7399. -data structures the algorithms maintain.
  7400. -
  7401. -I've manipulated hostapd to test this, by having it change its
  7402. -advertised bandwidth roughly ever 150ms. At the same time, I'm
  7403. -running a flood ping between the client and the AP, which causes
  7404. -this race of update vs. get_rate/status to easily happen on the
  7405. -client. With this change, the system survives this test.
  7406. -
  7407. -Reported-by: Sven Eckelmann <sven@open-mesh.com>
  7408. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  7409. ----
  7410. -
  7411. ---- a/net/mac80211/rate.c
  7412. -+++ b/net/mac80211/rate.c
  7413. -@@ -683,7 +683,13 @@ void rate_control_get_rate(struct ieee80
  7414. - if (sdata->local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL)
  7415. - return;
  7416. -
  7417. -- ref->ops->get_rate(ref->priv, ista, priv_sta, txrc);
  7418. -+ if (ista) {
  7419. -+ spin_lock_bh(&sta->rate_ctrl_lock);
  7420. -+ ref->ops->get_rate(ref->priv, ista, priv_sta, txrc);
  7421. -+ spin_unlock_bh(&sta->rate_ctrl_lock);
  7422. -+ } else {
  7423. -+ ref->ops->get_rate(ref->priv, NULL, NULL, txrc);
  7424. -+ }
  7425. -
  7426. - if (sdata->local->hw.flags & IEEE80211_HW_SUPPORTS_RC_TABLE)
  7427. - return;
  7428. ---- a/net/mac80211/rate.h
  7429. -+++ b/net/mac80211/rate.h
  7430. -@@ -42,10 +42,12 @@ static inline void rate_control_tx_statu
  7431. - if (!ref || !test_sta_flag(sta, WLAN_STA_RATE_CONTROL))
  7432. - return;
  7433. -
  7434. -+ spin_lock_bh(&sta->rate_ctrl_lock);
  7435. - if (ref->ops->tx_status)
  7436. - ref->ops->tx_status(ref->priv, sband, ista, priv_sta, skb);
  7437. - else
  7438. - ref->ops->tx_status_noskb(ref->priv, sband, ista, priv_sta, info);
  7439. -+ spin_unlock_bh(&sta->rate_ctrl_lock);
  7440. - }
  7441. -
  7442. - static inline void
  7443. -@@ -64,7 +66,9 @@ rate_control_tx_status_noskb(struct ieee
  7444. - if (WARN_ON_ONCE(!ref->ops->tx_status_noskb))
  7445. - return;
  7446. -
  7447. -+ spin_lock_bh(&sta->rate_ctrl_lock);
  7448. - ref->ops->tx_status_noskb(ref->priv, sband, ista, priv_sta, info);
  7449. -+ spin_unlock_bh(&sta->rate_ctrl_lock);
  7450. - }
  7451. -
  7452. - static inline void rate_control_rate_init(struct sta_info *sta)
  7453. -@@ -91,8 +95,10 @@ static inline void rate_control_rate_ini
  7454. -
  7455. - sband = local->hw.wiphy->bands[chanctx_conf->def.chan->band];
  7456. -
  7457. -+ spin_lock_bh(&sta->rate_ctrl_lock);
  7458. - ref->ops->rate_init(ref->priv, sband, &chanctx_conf->def, ista,
  7459. - priv_sta);
  7460. -+ spin_unlock_bh(&sta->rate_ctrl_lock);
  7461. - rcu_read_unlock();
  7462. - set_sta_flag(sta, WLAN_STA_RATE_CONTROL);
  7463. - }
  7464. -@@ -115,18 +121,20 @@ static inline void rate_control_rate_upd
  7465. - return;
  7466. - }
  7467. -
  7468. -+ spin_lock_bh(&sta->rate_ctrl_lock);
  7469. - ref->ops->rate_update(ref->priv, sband, &chanctx_conf->def,
  7470. - ista, priv_sta, changed);
  7471. -+ spin_unlock_bh(&sta->rate_ctrl_lock);
  7472. - rcu_read_unlock();
  7473. - }
  7474. - drv_sta_rc_update(local, sta->sdata, &sta->sta, changed);
  7475. - }
  7476. -
  7477. - static inline void *rate_control_alloc_sta(struct rate_control_ref *ref,
  7478. -- struct ieee80211_sta *sta,
  7479. -- gfp_t gfp)
  7480. -+ struct sta_info *sta, gfp_t gfp)
  7481. - {
  7482. -- return ref->ops->alloc_sta(ref->priv, sta, gfp);
  7483. -+ spin_lock_init(&sta->rate_ctrl_lock);
  7484. -+ return ref->ops->alloc_sta(ref->priv, &sta->sta, gfp);
  7485. - }
  7486. -
  7487. - static inline void rate_control_free_sta(struct sta_info *sta)
  7488. ---- a/net/mac80211/sta_info.c
  7489. -+++ b/net/mac80211/sta_info.c
  7490. -@@ -286,7 +286,7 @@ static int sta_prepare_rate_control(stru
  7491. -
  7492. - sta->rate_ctrl = local->rate_ctrl;
  7493. - sta->rate_ctrl_priv = rate_control_alloc_sta(sta->rate_ctrl,
  7494. -- &sta->sta, gfp);
  7495. -+ sta, gfp);
  7496. - if (!sta->rate_ctrl_priv)
  7497. - return -ENOMEM;
  7498. -
  7499. ---- a/net/mac80211/sta_info.h
  7500. -+++ b/net/mac80211/sta_info.h
  7501. -@@ -349,6 +349,7 @@ struct sta_info {
  7502. - u8 ptk_idx;
  7503. - struct rate_control_ref *rate_ctrl;
  7504. - void *rate_ctrl_priv;
  7505. -+ spinlock_t rate_ctrl_lock;
  7506. - spinlock_t lock;
  7507. -
  7508. - struct work_struct drv_deliver_wk;
  7509. diff --git a/package/kernel/mac80211/patches/302-ath10k-Delay-device-access-after-cold-reset.patch b/package/kernel/mac80211/patches/302-ath10k-Delay-device-access-after-cold-reset.patch
  7510. new file mode 100644
  7511. index 0000000..820aa9a
  7512. --- /dev/null
  7513. +++ b/package/kernel/mac80211/patches/302-ath10k-Delay-device-access-after-cold-reset.patch
  7514. @@ -0,0 +1,56 @@
  7515. +From: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
  7516. +Date: Fri, 3 Jul 2015 11:45:42 +0530
  7517. +Subject: [PATCH] ath10k: Delay device access after cold reset
  7518. +
  7519. +It is observed that during cold reset pcie access right
  7520. +after a write operation to SOC_GLOBAL_RESET_ADDRESS causes
  7521. +Data Bus Error and system hard lockup. The reason
  7522. +for bus error is that pcie needs some time to get
  7523. +back to stable state for any transaction during cold reset. Add
  7524. +delay of 20 msecs after write of SOC_GLOBAL_RESET_ADDRESS
  7525. +to fix this issue.
  7526. +
  7527. +Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
  7528. +---
  7529. +
  7530. +--- a/drivers/net/wireless/ath/ath10k/pci.c
  7531. ++++ b/drivers/net/wireless/ath/ath10k/pci.c
  7532. +@@ -2761,7 +2761,6 @@ static int ath10k_pci_wait_for_target_in
  7533. +
  7534. + static int ath10k_pci_cold_reset(struct ath10k *ar)
  7535. + {
  7536. +- int i;
  7537. + u32 val;
  7538. +
  7539. + ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot cold reset\n");
  7540. +@@ -2777,23 +2776,18 @@ static int ath10k_pci_cold_reset(struct
  7541. + val |= 1;
  7542. + ath10k_pci_reg_write32(ar, SOC_GLOBAL_RESET_ADDRESS, val);
  7543. +
  7544. +- for (i = 0; i < ATH_PCI_RESET_WAIT_MAX; i++) {
  7545. +- if (ath10k_pci_reg_read32(ar, RTC_STATE_ADDRESS) &
  7546. +- RTC_STATE_COLD_RESET_MASK)
  7547. +- break;
  7548. +- msleep(1);
  7549. +- }
  7550. ++ /* After writing into SOC_GLOBAL_RESET to put device into
  7551. ++ * reset and pulling out of reset pcie may not be stable
  7552. ++ * for any immediate pcie register access and cause bus error,
  7553. ++ * add delay before any pcie access request to fix this issue.
  7554. ++ */
  7555. ++ msleep(20);
  7556. +
  7557. + /* Pull Target, including PCIe, out of RESET. */
  7558. + val &= ~1;
  7559. + ath10k_pci_reg_write32(ar, SOC_GLOBAL_RESET_ADDRESS, val);
  7560. +
  7561. +- for (i = 0; i < ATH_PCI_RESET_WAIT_MAX; i++) {
  7562. +- if (!(ath10k_pci_reg_read32(ar, RTC_STATE_ADDRESS) &
  7563. +- RTC_STATE_COLD_RESET_MASK))
  7564. +- break;
  7565. +- msleep(1);
  7566. +- }
  7567. ++ msleep(20);
  7568. +
  7569. + ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot cold reset complete\n");
  7570. +
  7571. 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
  7572. deleted file mode 100644
  7573. index e54e16e..0000000
  7574. --- a/package/kernel/mac80211/patches/302-ath9k-restart-only-triggering-DFS-detector-line.patch
  7575. +++ /dev/null
  7576. @@ -1,21 +0,0 @@
  7577. -From: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  7578. -Date: Tue, 10 Mar 2015 17:49:29 +0100
  7579. -Subject: [PATCH] ath9k: restart only triggering DFS detector line
  7580. -
  7581. -To support HT40 DFS mode, a triggering detector must
  7582. -reset only itself but not other detector lines.
  7583. -
  7584. -Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  7585. ----
  7586. -
  7587. ---- a/drivers/net/wireless/ath/dfs_pattern_detector.c
  7588. -+++ b/drivers/net/wireless/ath/dfs_pattern_detector.c
  7589. -@@ -289,7 +289,7 @@ dpd_add_pulse(struct dfs_pattern_detecto
  7590. - "count=%d, count_false=%d\n",
  7591. - event->freq, pd->rs->type_id,
  7592. - ps->pri, ps->count, ps->count_falses);
  7593. -- channel_detector_reset(dpd, cd);
  7594. -+ pd->reset(pd, dpd->last_pulse_ts);
  7595. - return true;
  7596. - }
  7597. - }
  7598. 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
  7599. deleted file mode 100644
  7600. index ed268ea..0000000
  7601. --- a/package/kernel/mac80211/patches/303-ath9k-add-DFS-support-for-extension-channel.patch
  7602. +++ /dev/null
  7603. @@ -1,76 +0,0 @@
  7604. -From: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  7605. -Date: Tue, 10 Mar 2015 17:49:30 +0100
  7606. -Subject: [PATCH] ath9k: add DFS support for extension channel
  7607. -
  7608. -In HT40 modes, pulse events on primary and extension
  7609. -channel are processed individually. If valid, a pulse
  7610. -event will be fed into the detector
  7611. -* for primary frequency, or
  7612. -* for extension frequency (+/-20MHz based on HT40-mode)
  7613. -* or both
  7614. -
  7615. -With that, a 40MHz radar will result in two individual
  7616. -radar events.
  7617. -
  7618. -Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  7619. ----
  7620. -
  7621. ---- a/drivers/net/wireless/ath/ath9k/dfs.c
  7622. -+++ b/drivers/net/wireless/ath/ath9k/dfs.c
  7623. -@@ -126,8 +126,19 @@ ath9k_postprocess_radar_event(struct ath
  7624. - DFS_STAT_INC(sc, pulses_detected);
  7625. - return true;
  7626. - }
  7627. --#undef PRI_CH_RADAR_FOUND
  7628. --#undef EXT_CH_RADAR_FOUND
  7629. -+
  7630. -+static void
  7631. -+ath9k_dfs_process_radar_pulse(struct ath_softc *sc, struct pulse_event *pe)
  7632. -+{
  7633. -+ struct dfs_pattern_detector *pd = sc->dfs_detector;
  7634. -+ DFS_STAT_INC(sc, pulses_processed);
  7635. -+ if (pd == NULL)
  7636. -+ return;
  7637. -+ if (!pd->add_pulse(pd, pe))
  7638. -+ return;
  7639. -+ DFS_STAT_INC(sc, radar_detected);
  7640. -+ ieee80211_radar_detected(sc->hw);
  7641. -+}
  7642. -
  7643. - /*
  7644. - * DFS: check PHY-error for radar pulse and feed the detector
  7645. -@@ -176,18 +187,21 @@ void ath9k_dfs_process_phyerr(struct ath
  7646. - ard.pulse_length_pri = vdata_end[-3];
  7647. - pe.freq = ah->curchan->channel;
  7648. - pe.ts = mactime;
  7649. -- if (ath9k_postprocess_radar_event(sc, &ard, &pe)) {
  7650. -- struct dfs_pattern_detector *pd = sc->dfs_detector;
  7651. -- ath_dbg(common, DFS,
  7652. -- "ath9k_dfs_process_phyerr: channel=%d, ts=%llu, "
  7653. -- "width=%d, rssi=%d, delta_ts=%llu\n",
  7654. -- pe.freq, pe.ts, pe.width, pe.rssi,
  7655. -- pe.ts - sc->dfs_prev_pulse_ts);
  7656. -- sc->dfs_prev_pulse_ts = pe.ts;
  7657. -- DFS_STAT_INC(sc, pulses_processed);
  7658. -- if (pd != NULL && pd->add_pulse(pd, &pe)) {
  7659. -- DFS_STAT_INC(sc, radar_detected);
  7660. -- ieee80211_radar_detected(sc->hw);
  7661. -- }
  7662. -+ if (!ath9k_postprocess_radar_event(sc, &ard, &pe))
  7663. -+ return;
  7664. -+
  7665. -+ ath_dbg(common, DFS,
  7666. -+ "ath9k_dfs_process_phyerr: type=%d, freq=%d, ts=%llu, "
  7667. -+ "width=%d, rssi=%d, delta_ts=%llu\n",
  7668. -+ ard.pulse_bw_info, pe.freq, pe.ts, pe.width, pe.rssi,
  7669. -+ pe.ts - sc->dfs_prev_pulse_ts);
  7670. -+ sc->dfs_prev_pulse_ts = pe.ts;
  7671. -+ if (ard.pulse_bw_info & PRI_CH_RADAR_FOUND)
  7672. -+ ath9k_dfs_process_radar_pulse(sc, &pe);
  7673. -+ if (ard.pulse_bw_info & EXT_CH_RADAR_FOUND) {
  7674. -+ pe.freq += IS_CHAN_HT40PLUS(ah->curchan) ? 20 : -20;
  7675. -+ ath9k_dfs_process_radar_pulse(sc, &pe);
  7676. - }
  7677. - }
  7678. -+#undef PRI_CH_RADAR_FOUND
  7679. -+#undef EXT_CH_RADAR_FOUND
  7680. diff --git a/package/kernel/mac80211/patches/303-ath9k-add-fast-xmit-support.patch b/package/kernel/mac80211/patches/303-ath9k-add-fast-xmit-support.patch
  7681. new file mode 100644
  7682. index 0000000..139015c
  7683. --- /dev/null
  7684. +++ b/package/kernel/mac80211/patches/303-ath9k-add-fast-xmit-support.patch
  7685. @@ -0,0 +1,17 @@
  7686. +From: Felix Fietkau <nbd@openwrt.org>
  7687. +Date: Mon, 11 May 2015 18:35:20 +0200
  7688. +Subject: [PATCH] ath9k: add fast-xmit support
  7689. +
  7690. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  7691. +---
  7692. +
  7693. +--- a/drivers/net/wireless/ath/ath9k/init.c
  7694. ++++ b/drivers/net/wireless/ath/ath9k/init.c
  7695. +@@ -826,6 +826,7 @@ static void ath9k_set_hw_capab(struct at
  7696. + ieee80211_hw_set(hw, SIGNAL_DBM);
  7697. + ieee80211_hw_set(hw, RX_INCLUDES_FCS);
  7698. + ieee80211_hw_set(hw, HOST_BROADCAST_PS_BUFFERING);
  7699. ++ ieee80211_hw_set(hw, SUPPORT_FAST_XMIT);
  7700. +
  7701. + if (ath9k_ps_enable)
  7702. + ieee80211_hw_set(hw, SUPPORTS_PS);
  7703. 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
  7704. deleted file mode 100644
  7705. index e1eab64..0000000
  7706. --- a/package/kernel/mac80211/patches/304-ath9k-allow-40MHz-radar-detection-width.patch
  7707. +++ /dev/null
  7708. @@ -1,19 +0,0 @@
  7709. -From: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  7710. -Date: Tue, 10 Mar 2015 17:49:31 +0100
  7711. -Subject: [PATCH] ath9k: allow 40MHz radar detection width
  7712. -
  7713. -Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
  7714. ----
  7715. -
  7716. ---- a/drivers/net/wireless/ath/ath9k/init.c
  7717. -+++ b/drivers/net/wireless/ath/ath9k/init.c
  7718. -@@ -763,7 +763,8 @@ static const struct ieee80211_iface_comb
  7719. - .num_different_channels = 1,
  7720. - .beacon_int_infra_match = true,
  7721. - .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
  7722. -- BIT(NL80211_CHAN_WIDTH_20),
  7723. -+ BIT(NL80211_CHAN_WIDTH_20) |
  7724. -+ BIT(NL80211_CHAN_WIDTH_40),
  7725. - }
  7726. - #endif
  7727. - };
  7728. diff --git a/package/kernel/mac80211/patches/304-ath9k-remove-struct-ath_atx_ac.patch b/package/kernel/mac80211/patches/304-ath9k-remove-struct-ath_atx_ac.patch
  7729. new file mode 100644
  7730. index 0000000..9f04276
  7731. --- /dev/null
  7732. +++ b/package/kernel/mac80211/patches/304-ath9k-remove-struct-ath_atx_ac.patch
  7733. @@ -0,0 +1,385 @@
  7734. +From: Felix Fietkau <nbd@openwrt.org>
  7735. +Date: Sat, 4 Apr 2015 18:39:06 +0200
  7736. +Subject: [PATCH] ath9k: remove struct ath_atx_ac
  7737. +
  7738. +struct ath_atx_ac contains a list of active TIDs belonging to one WMM AC.
  7739. +This patch changes the code to track active station TIDs in the txq directly.
  7740. +
  7741. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  7742. +---
  7743. +
  7744. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  7745. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  7746. +@@ -173,14 +173,6 @@ struct ath_txq {
  7747. + struct sk_buff_head complete_q;
  7748. + };
  7749. +
  7750. +-struct ath_atx_ac {
  7751. +- struct ath_txq *txq;
  7752. +- struct list_head list;
  7753. +- struct list_head tid_q;
  7754. +- bool clear_ps_filter;
  7755. +- bool sched;
  7756. +-};
  7757. +-
  7758. + struct ath_frame_info {
  7759. + struct ath_buf *bf;
  7760. + u16 framelen;
  7761. +@@ -243,7 +235,7 @@ struct ath_atx_tid {
  7762. + struct sk_buff_head buf_q;
  7763. + struct sk_buff_head retry_q;
  7764. + struct ath_node *an;
  7765. +- struct ath_atx_ac *ac;
  7766. ++ struct ath_txq *txq;
  7767. + unsigned long tx_buf[BITS_TO_LONGS(ATH_TID_MAX_BUFS)];
  7768. + u16 seq_start;
  7769. + u16 seq_next;
  7770. +@@ -255,6 +247,7 @@ struct ath_atx_tid {
  7771. + s8 bar_index;
  7772. + bool sched;
  7773. + bool active;
  7774. ++ bool clear_ps_filter;
  7775. + };
  7776. +
  7777. + struct ath_node {
  7778. +@@ -262,7 +255,6 @@ struct ath_node {
  7779. + struct ieee80211_sta *sta; /* station struct we're part of */
  7780. + struct ieee80211_vif *vif; /* interface with which we're associated */
  7781. + struct ath_atx_tid tid[IEEE80211_NUM_TIDS];
  7782. +- struct ath_atx_ac ac[IEEE80211_NUM_ACS];
  7783. +
  7784. + u16 maxampdu;
  7785. + u8 mpdudensity;
  7786. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  7787. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  7788. +@@ -106,7 +106,6 @@ void ath_txq_unlock_complete(struct ath_
  7789. + static void ath_tx_queue_tid(struct ath_softc *sc, struct ath_txq *txq,
  7790. + struct ath_atx_tid *tid)
  7791. + {
  7792. +- struct ath_atx_ac *ac = tid->ac;
  7793. + struct list_head *list;
  7794. + struct ath_vif *avp = (struct ath_vif *) tid->an->vif->drv_priv;
  7795. + struct ath_chanctx *ctx = avp->chanctx;
  7796. +@@ -118,15 +117,8 @@ static void ath_tx_queue_tid(struct ath_
  7797. + return;
  7798. +
  7799. + tid->sched = true;
  7800. +- list_add_tail(&tid->list, &ac->tid_q);
  7801. +-
  7802. +- if (ac->sched)
  7803. +- return;
  7804. +-
  7805. +- ac->sched = true;
  7806. +-
  7807. + list = &ctx->acq[TID_TO_WME_AC(tid->tidno)];
  7808. +- list_add_tail(&ac->list, list);
  7809. ++ list_add_tail(&tid->list, list);
  7810. + }
  7811. +
  7812. + static struct ath_frame_info *get_frame_info(struct sk_buff *skb)
  7813. +@@ -223,7 +215,7 @@ static struct sk_buff *ath_tid_dequeue(s
  7814. + static void
  7815. + ath_tx_tid_change_state(struct ath_softc *sc, struct ath_atx_tid *tid)
  7816. + {
  7817. +- struct ath_txq *txq = tid->ac->txq;
  7818. ++ struct ath_txq *txq = tid->txq;
  7819. + struct ieee80211_tx_info *tx_info;
  7820. + struct sk_buff *skb, *tskb;
  7821. + struct ath_buf *bf;
  7822. +@@ -252,7 +244,7 @@ ath_tx_tid_change_state(struct ath_softc
  7823. +
  7824. + static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
  7825. + {
  7826. +- struct ath_txq *txq = tid->ac->txq;
  7827. ++ struct ath_txq *txq = tid->txq;
  7828. + struct sk_buff *skb;
  7829. + struct ath_buf *bf;
  7830. + struct list_head bf_head;
  7831. +@@ -659,7 +651,7 @@ static void ath_tx_complete_aggr(struct
  7832. + ath_tx_queue_tid(sc, txq, tid);
  7833. +
  7834. + if (ts->ts_status & (ATH9K_TXERR_FILT | ATH9K_TXERR_XRETRY))
  7835. +- tid->ac->clear_ps_filter = true;
  7836. ++ tid->clear_ps_filter = true;
  7837. + }
  7838. + }
  7839. +
  7840. +@@ -749,7 +741,7 @@ static u32 ath_lookup_rate(struct ath_so
  7841. + struct ieee80211_tx_rate *rates;
  7842. + u32 max_4ms_framelen, frmlen;
  7843. + u16 aggr_limit, bt_aggr_limit, legacy = 0;
  7844. +- int q = tid->ac->txq->mac80211_qnum;
  7845. ++ int q = tid->txq->mac80211_qnum;
  7846. + int i;
  7847. +
  7848. + skb = bf->bf_mpdu;
  7849. +@@ -1486,8 +1478,8 @@ static bool ath_tx_sched_aggr(struct ath
  7850. + if (list_empty(&bf_q))
  7851. + return false;
  7852. +
  7853. +- if (tid->ac->clear_ps_filter || tid->an->no_ps_filter) {
  7854. +- tid->ac->clear_ps_filter = false;
  7855. ++ if (tid->clear_ps_filter || tid->an->no_ps_filter) {
  7856. ++ tid->clear_ps_filter = false;
  7857. + tx_info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
  7858. + }
  7859. +
  7860. +@@ -1506,7 +1498,7 @@ int ath_tx_aggr_start(struct ath_softc *
  7861. +
  7862. + an = (struct ath_node *)sta->drv_priv;
  7863. + txtid = ATH_AN_2_TID(an, tid);
  7864. +- txq = txtid->ac->txq;
  7865. ++ txq = txtid->txq;
  7866. +
  7867. + ath_txq_lock(sc, txq);
  7868. +
  7869. +@@ -1540,7 +1532,7 @@ void ath_tx_aggr_stop(struct ath_softc *
  7870. + {
  7871. + struct ath_node *an = (struct ath_node *)sta->drv_priv;
  7872. + struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid);
  7873. +- struct ath_txq *txq = txtid->ac->txq;
  7874. ++ struct ath_txq *txq = txtid->txq;
  7875. +
  7876. + ath_txq_lock(sc, txq);
  7877. + txtid->active = false;
  7878. +@@ -1553,7 +1545,6 @@ void ath_tx_aggr_sleep(struct ieee80211_
  7879. + struct ath_node *an)
  7880. + {
  7881. + struct ath_atx_tid *tid;
  7882. +- struct ath_atx_ac *ac;
  7883. + struct ath_txq *txq;
  7884. + bool buffered;
  7885. + int tidno;
  7886. +@@ -1561,8 +1552,7 @@ void ath_tx_aggr_sleep(struct ieee80211_
  7887. + for (tidno = 0, tid = &an->tid[tidno];
  7888. + tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
  7889. +
  7890. +- ac = tid->ac;
  7891. +- txq = ac->txq;
  7892. ++ txq = tid->txq;
  7893. +
  7894. + ath_txq_lock(sc, txq);
  7895. +
  7896. +@@ -1576,11 +1566,6 @@ void ath_tx_aggr_sleep(struct ieee80211_
  7897. + tid->sched = false;
  7898. + list_del(&tid->list);
  7899. +
  7900. +- if (ac->sched) {
  7901. +- ac->sched = false;
  7902. +- list_del(&ac->list);
  7903. +- }
  7904. +-
  7905. + ath_txq_unlock(sc, txq);
  7906. +
  7907. + ieee80211_sta_set_buffered(sta, tidno, buffered);
  7908. +@@ -1590,18 +1575,16 @@ void ath_tx_aggr_sleep(struct ieee80211_
  7909. + void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an)
  7910. + {
  7911. + struct ath_atx_tid *tid;
  7912. +- struct ath_atx_ac *ac;
  7913. + struct ath_txq *txq;
  7914. + int tidno;
  7915. +
  7916. + for (tidno = 0, tid = &an->tid[tidno];
  7917. + tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
  7918. +
  7919. +- ac = tid->ac;
  7920. +- txq = ac->txq;
  7921. ++ txq = tid->txq;
  7922. +
  7923. + ath_txq_lock(sc, txq);
  7924. +- ac->clear_ps_filter = true;
  7925. ++ tid->clear_ps_filter = true;
  7926. +
  7927. + if (ath_tid_has_buffered(tid)) {
  7928. + ath_tx_queue_tid(sc, txq, tid);
  7929. +@@ -1621,7 +1604,7 @@ void ath_tx_aggr_resume(struct ath_softc
  7930. +
  7931. + an = (struct ath_node *)sta->drv_priv;
  7932. + tid = ATH_AN_2_TID(an, tidno);
  7933. +- txq = tid->ac->txq;
  7934. ++ txq = tid->txq;
  7935. +
  7936. + ath_txq_lock(sc, txq);
  7937. +
  7938. +@@ -1660,7 +1643,7 @@ void ath9k_release_buffered_frames(struc
  7939. +
  7940. + tid = ATH_AN_2_TID(an, i);
  7941. +
  7942. +- ath_txq_lock(sc, tid->ac->txq);
  7943. ++ ath_txq_lock(sc, tid->txq);
  7944. + while (nframes > 0) {
  7945. + bf = ath_tx_get_tid_subframe(sc, sc->tx.uapsdq, tid, &tid_q);
  7946. + if (!bf)
  7947. +@@ -1684,7 +1667,7 @@ void ath9k_release_buffered_frames(struc
  7948. + if (an->sta && !ath_tid_has_buffered(tid))
  7949. + ieee80211_sta_set_buffered(an->sta, i, false);
  7950. + }
  7951. +- ath_txq_unlock_complete(sc, tid->ac->txq);
  7952. ++ ath_txq_unlock_complete(sc, tid->txq);
  7953. + }
  7954. +
  7955. + if (list_empty(&bf_q))
  7956. +@@ -1933,9 +1916,8 @@ void ath_tx_cleanupq(struct ath_softc *s
  7957. + void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq)
  7958. + {
  7959. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  7960. +- struct ath_atx_ac *ac, *last_ac;
  7961. + struct ath_atx_tid *tid, *last_tid;
  7962. +- struct list_head *ac_list;
  7963. ++ struct list_head *tid_list;
  7964. + bool sent = false;
  7965. +
  7966. + if (txq->mac80211_qnum < 0)
  7967. +@@ -1945,63 +1927,46 @@ void ath_txq_schedule(struct ath_softc *
  7968. + return;
  7969. +
  7970. + spin_lock_bh(&sc->chan_lock);
  7971. +- ac_list = &sc->cur_chan->acq[txq->mac80211_qnum];
  7972. ++ tid_list = &sc->cur_chan->acq[txq->mac80211_qnum];
  7973. +
  7974. +- if (list_empty(ac_list)) {
  7975. ++ if (list_empty(tid_list)) {
  7976. + spin_unlock_bh(&sc->chan_lock);
  7977. + return;
  7978. + }
  7979. +
  7980. + rcu_read_lock();
  7981. +
  7982. +- last_ac = list_entry(ac_list->prev, struct ath_atx_ac, list);
  7983. +- while (!list_empty(ac_list)) {
  7984. ++ last_tid = list_entry(tid_list->prev, struct ath_atx_tid, list);
  7985. ++ while (!list_empty(tid_list)) {
  7986. + bool stop = false;
  7987. +
  7988. + if (sc->cur_chan->stopped)
  7989. + break;
  7990. +
  7991. +- ac = list_first_entry(ac_list, struct ath_atx_ac, list);
  7992. +- last_tid = list_entry(ac->tid_q.prev, struct ath_atx_tid, list);
  7993. +- list_del(&ac->list);
  7994. +- ac->sched = false;
  7995. +-
  7996. +- while (!list_empty(&ac->tid_q)) {
  7997. +-
  7998. +- tid = list_first_entry(&ac->tid_q, struct ath_atx_tid,
  7999. +- list);
  8000. +- list_del(&tid->list);
  8001. +- tid->sched = false;
  8002. +-
  8003. +- if (ath_tx_sched_aggr(sc, txq, tid, &stop))
  8004. +- sent = true;
  8005. +-
  8006. +- /*
  8007. +- * add tid to round-robin queue if more frames
  8008. +- * are pending for the tid
  8009. +- */
  8010. +- if (ath_tid_has_buffered(tid))
  8011. +- ath_tx_queue_tid(sc, txq, tid);
  8012. ++ tid = list_first_entry(tid_list, struct ath_atx_tid, list);
  8013. ++ list_del(&tid->list);
  8014. ++ tid->sched = false;
  8015. +
  8016. +- if (stop || tid == last_tid)
  8017. +- break;
  8018. +- }
  8019. ++ if (ath_tx_sched_aggr(sc, txq, tid, &stop))
  8020. ++ sent = true;
  8021. +
  8022. +- if (!list_empty(&ac->tid_q) && !ac->sched) {
  8023. +- ac->sched = true;
  8024. +- list_add_tail(&ac->list, ac_list);
  8025. +- }
  8026. ++ /*
  8027. ++ * add tid to round-robin queue if more frames
  8028. ++ * are pending for the tid
  8029. ++ */
  8030. ++ if (ath_tid_has_buffered(tid))
  8031. ++ ath_tx_queue_tid(sc, txq, tid);
  8032. +
  8033. + if (stop)
  8034. + break;
  8035. +
  8036. +- if (ac == last_ac) {
  8037. ++ if (tid == last_tid) {
  8038. + if (!sent)
  8039. + break;
  8040. +
  8041. + sent = false;
  8042. +- last_ac = list_entry(ac_list->prev,
  8043. +- struct ath_atx_ac, list);
  8044. ++ last_tid = list_entry(tid_list->prev,
  8045. ++ struct ath_atx_tid, list);
  8046. + }
  8047. + }
  8048. +
  8049. +@@ -2391,10 +2356,10 @@ int ath_tx_start(struct ieee80211_hw *hw
  8050. + txq = sc->tx.uapsdq;
  8051. + ath_txq_lock(sc, txq);
  8052. + } else if (txctl->an && queue) {
  8053. +- WARN_ON(tid->ac->txq != txctl->txq);
  8054. ++ WARN_ON(tid->txq != txctl->txq);
  8055. +
  8056. + if (info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT)
  8057. +- tid->ac->clear_ps_filter = true;
  8058. ++ tid->clear_ps_filter = true;
  8059. +
  8060. + /*
  8061. + * Add this frame to software queue for scheduling later
  8062. +@@ -2888,7 +2853,6 @@ int ath_tx_init(struct ath_softc *sc, in
  8063. + void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an)
  8064. + {
  8065. + struct ath_atx_tid *tid;
  8066. +- struct ath_atx_ac *ac;
  8067. + int tidno, acno;
  8068. +
  8069. + for (tidno = 0, tid = &an->tid[tidno];
  8070. +@@ -2901,24 +2865,16 @@ void ath_tx_node_init(struct ath_softc *
  8071. + tid->baw_head = tid->baw_tail = 0;
  8072. + tid->sched = false;
  8073. + tid->active = false;
  8074. ++ tid->clear_ps_filter = true;
  8075. + __skb_queue_head_init(&tid->buf_q);
  8076. + __skb_queue_head_init(&tid->retry_q);
  8077. + acno = TID_TO_WME_AC(tidno);
  8078. +- tid->ac = &an->ac[acno];
  8079. +- }
  8080. +-
  8081. +- for (acno = 0, ac = &an->ac[acno];
  8082. +- acno < IEEE80211_NUM_ACS; acno++, ac++) {
  8083. +- ac->sched = false;
  8084. +- ac->clear_ps_filter = true;
  8085. +- ac->txq = sc->tx.txq_map[acno];
  8086. +- INIT_LIST_HEAD(&ac->tid_q);
  8087. ++ tid->txq = sc->tx.txq_map[acno];
  8088. + }
  8089. + }
  8090. +
  8091. + void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an)
  8092. + {
  8093. +- struct ath_atx_ac *ac;
  8094. + struct ath_atx_tid *tid;
  8095. + struct ath_txq *txq;
  8096. + int tidno;
  8097. +@@ -2926,8 +2882,7 @@ void ath_tx_node_cleanup(struct ath_soft
  8098. + for (tidno = 0, tid = &an->tid[tidno];
  8099. + tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
  8100. +
  8101. +- ac = tid->ac;
  8102. +- txq = ac->txq;
  8103. ++ txq = tid->txq;
  8104. +
  8105. + ath_txq_lock(sc, txq);
  8106. +
  8107. +@@ -2936,11 +2891,6 @@ void ath_tx_node_cleanup(struct ath_soft
  8108. + tid->sched = false;
  8109. + }
  8110. +
  8111. +- if (ac->sched) {
  8112. +- list_del(&ac->list);
  8113. +- tid->ac->sched = false;
  8114. +- }
  8115. +-
  8116. + ath_tid_drain(sc, txq, tid);
  8117. + tid->active = false;
  8118. +
  8119. diff --git a/package/kernel/mac80211/patches/305-ath5k-channel-change-fix.patch b/package/kernel/mac80211/patches/305-ath5k-channel-change-fix.patch
  8120. deleted file mode 100644
  8121. index 4cfa53f..0000000
  8122. --- a/package/kernel/mac80211/patches/305-ath5k-channel-change-fix.patch
  8123. +++ /dev/null
  8124. @@ -1,137 +0,0 @@
  8125. -From: Sergey Ryazanov <ryazanov.s.a@gmail.com>
  8126. -Date: Wed, 4 Mar 2015 05:12:10 +0300
  8127. -Subject: [PATCH] ath5k: channel change fix
  8128. -
  8129. -ath5k updates the channel pointer and after that it stops the Rx logic
  8130. -and apply channel to HW. In case of channel switch, such sequence
  8131. -creates a small window when a frame, which is received on the old
  8132. -channel is considered as a frame received on the new one.
  8133. -
  8134. -The most notable consequence of this situation occurs during the switch
  8135. -from 2 GHz band (CCK+OFDM) to the 5GHz band (OFDM-only). Frame received
  8136. -with CCK rate, e.g. beacon received at the 1mbps, causes the following
  8137. -warning:
  8138. -
  8139. - WARNING: at ath5k/base.c:589 ath5k_tasklet_rx+0x318/0x6ec [ath5k]()
  8140. - invalid hw_rix: 1a
  8141. - [..]
  8142. - Call Trace:
  8143. - [<802656a8>] show_stack+0x48/0x70
  8144. - [<802dd92c>] warn_slowpath_common+0x88/0xbc
  8145. - [<802dd98c>] warn_slowpath_fmt+0x2c/0x38
  8146. - [<81b51be8>] ath5k_tasklet_rx+0x318/0x6ec [ath5k]
  8147. - [<8028ac64>] tasklet_action+0x8c/0xf0
  8148. - [<80075804>] __do_softirq+0x180/0x32c
  8149. - [<80196ce8>] irq_exit+0x54/0x70
  8150. - [<80041848>] ret_from_irq+0x0/0x4
  8151. - [<80182fdc>] ioread32+0x4/0xc
  8152. - [<81b4c42c>] ath5k_hw_set_sleep_clock+0x2ec/0x474 [ath5k]
  8153. - [<81b4cf28>] ath5k_hw_reset+0x50/0xeb8 [ath5k]
  8154. - [<81b50900>] ath5k_reset+0xd4/0x310 [ath5k]
  8155. - [<81b557e8>] ath5k_config+0x4c/0x104 [ath5k]
  8156. - [<80d01770>] ieee80211_hw_config+0x2f4/0x35c [mac80211]
  8157. - [<80d09aa8>] ieee80211_scan_work+0x2e4/0x414 [mac80211]
  8158. - [<8022c3f4>] process_one_work+0x28c/0x400
  8159. - [<802df8f8>] worker_thread+0x258/0x3c0
  8160. - [<801b5710>] kthread+0xe0/0xec
  8161. - [<800418a8>] ret_from_kernel_thread+0x14/0x1c
  8162. -
  8163. -The easiest way to reproduce this warning is to run scan with dualband
  8164. -NIC in noisy environments, when the channel 11 runs multiple APs. In my
  8165. -tests if the APs num >= 12, the warning appears in the first few
  8166. -seconds of scanning.
  8167. -
  8168. -In order to fix this, the Rx disable code moved to a higher level and
  8169. -placed before the channel pointer update. This is also makes the code a
  8170. -bit more symmetrical, since we disable and enable the Rx in the same
  8171. -function.
  8172. -
  8173. -In fact, at the pointer update time new frames should not appear,
  8174. -because interrupt generation at this point should already be disabled.
  8175. -The next patch should address this issue.
  8176. -
  8177. -CC: Jiri Slaby <jirislaby@gmail.com>
  8178. -CC: Nick Kossifidis <mickflemm@gmail.com>
  8179. -CC: Luis R. Rodriguez <mcgrof@do-not-panic.com>
  8180. -Reported-by: Christophe Prevotaux <cprevotaux@nltinc.com>
  8181. -Tested-by: Christophe Prevotaux <cprevotaux@nltinc.com>
  8182. -Tested-by: Eric Bree <ebree@nltinc.com>
  8183. -Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
  8184. ----
  8185. -
  8186. ---- a/drivers/net/wireless/ath/ath5k/base.c
  8187. -+++ b/drivers/net/wireless/ath/ath5k/base.c
  8188. -@@ -2858,7 +2858,7 @@ ath5k_reset(struct ath5k_hw *ah, struct
  8189. - {
  8190. - struct ath_common *common = ath5k_hw_common(ah);
  8191. - int ret, ani_mode;
  8192. -- bool fast;
  8193. -+ bool fast = chan && modparam_fastchanswitch ? 1 : 0;
  8194. -
  8195. - ATH5K_DBG(ah, ATH5K_DEBUG_RESET, "resetting\n");
  8196. -
  8197. -@@ -2876,11 +2876,29 @@ ath5k_reset(struct ath5k_hw *ah, struct
  8198. - * so we should also free any remaining
  8199. - * tx buffers */
  8200. - ath5k_drain_tx_buffs(ah);
  8201. -+
  8202. -+ /* Stop PCU */
  8203. -+ ath5k_hw_stop_rx_pcu(ah);
  8204. -+
  8205. -+ /* Stop DMA
  8206. -+ *
  8207. -+ * Note: If DMA didn't stop continue
  8208. -+ * since only a reset will fix it.
  8209. -+ */
  8210. -+ ret = ath5k_hw_dma_stop(ah);
  8211. -+
  8212. -+ /* RF Bus grant won't work if we have pending
  8213. -+ * frames
  8214. -+ */
  8215. -+ if (ret && fast) {
  8216. -+ ATH5K_DBG(ah, ATH5K_DEBUG_RESET,
  8217. -+ "DMA didn't stop, falling back to normal reset\n");
  8218. -+ fast = false;
  8219. -+ }
  8220. -+
  8221. - if (chan)
  8222. - ah->curchan = chan;
  8223. -
  8224. -- fast = ((chan != NULL) && modparam_fastchanswitch) ? 1 : 0;
  8225. --
  8226. - ret = ath5k_hw_reset(ah, ah->opmode, ah->curchan, fast, skip_pcu);
  8227. - if (ret) {
  8228. - ATH5K_ERR(ah, "can't reset hardware (%d)\n", ret);
  8229. ---- a/drivers/net/wireless/ath/ath5k/reset.c
  8230. -+++ b/drivers/net/wireless/ath/ath5k/reset.c
  8231. -@@ -1169,30 +1169,6 @@ ath5k_hw_reset(struct ath5k_hw *ah, enum
  8232. - if (ah->ah_version == AR5K_AR5212)
  8233. - ath5k_hw_set_sleep_clock(ah, false);
  8234. -
  8235. -- /*
  8236. -- * Stop PCU
  8237. -- */
  8238. -- ath5k_hw_stop_rx_pcu(ah);
  8239. --
  8240. -- /*
  8241. -- * Stop DMA
  8242. -- *
  8243. -- * Note: If DMA didn't stop continue
  8244. -- * since only a reset will fix it.
  8245. -- */
  8246. -- ret = ath5k_hw_dma_stop(ah);
  8247. --
  8248. -- /* RF Bus grant won't work if we have pending
  8249. -- * frames */
  8250. -- if (ret && fast) {
  8251. -- ATH5K_DBG(ah, ATH5K_DEBUG_RESET,
  8252. -- "DMA didn't stop, falling back to normal reset\n");
  8253. -- fast = false;
  8254. -- /* Non fatal, just continue with
  8255. -- * normal reset */
  8256. -- ret = 0;
  8257. -- }
  8258. --
  8259. - mode = channel->hw_value;
  8260. - switch (mode) {
  8261. - case AR5K_MODE_11A:
  8262. diff --git a/package/kernel/mac80211/patches/305-ath9k-remove-the-sched-field-in-struct-ath_atx_tid.patch b/package/kernel/mac80211/patches/305-ath9k-remove-the-sched-field-in-struct-ath_atx_tid.patch
  8263. new file mode 100644
  8264. index 0000000..ec860dc
  8265. --- /dev/null
  8266. +++ b/package/kernel/mac80211/patches/305-ath9k-remove-the-sched-field-in-struct-ath_atx_tid.patch
  8267. @@ -0,0 +1,90 @@
  8268. +From: Felix Fietkau <nbd@openwrt.org>
  8269. +Date: Sat, 4 Apr 2015 18:42:33 +0200
  8270. +Subject: [PATCH] ath9k: remove the sched field in struct ath_atx_tid
  8271. +
  8272. +Use list_empty(&tid->list) instead
  8273. +
  8274. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8275. +---
  8276. +
  8277. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  8278. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  8279. +@@ -245,7 +245,6 @@ struct ath_atx_tid {
  8280. + int baw_tail; /* next unused tx buffer slot */
  8281. +
  8282. + s8 bar_index;
  8283. +- bool sched;
  8284. + bool active;
  8285. + bool clear_ps_filter;
  8286. + };
  8287. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  8288. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  8289. +@@ -113,12 +113,9 @@ static void ath_tx_queue_tid(struct ath_
  8290. + if (!ctx)
  8291. + return;
  8292. +
  8293. +- if (tid->sched)
  8294. +- return;
  8295. +-
  8296. +- tid->sched = true;
  8297. + list = &ctx->acq[TID_TO_WME_AC(tid->tidno)];
  8298. +- list_add_tail(&tid->list, list);
  8299. ++ if (list_empty(&tid->list))
  8300. ++ list_add_tail(&tid->list, list);
  8301. + }
  8302. +
  8303. + static struct ath_frame_info *get_frame_info(struct sk_buff *skb)
  8304. +@@ -1556,15 +1553,14 @@ void ath_tx_aggr_sleep(struct ieee80211_
  8305. +
  8306. + ath_txq_lock(sc, txq);
  8307. +
  8308. +- if (!tid->sched) {
  8309. ++ if (list_empty(&tid->list)) {
  8310. + ath_txq_unlock(sc, txq);
  8311. + continue;
  8312. + }
  8313. +
  8314. + buffered = ath_tid_has_buffered(tid);
  8315. +
  8316. +- tid->sched = false;
  8317. +- list_del(&tid->list);
  8318. ++ list_del_init(&tid->list);
  8319. +
  8320. + ath_txq_unlock(sc, txq);
  8321. +
  8322. +@@ -1944,8 +1940,7 @@ void ath_txq_schedule(struct ath_softc *
  8323. + break;
  8324. +
  8325. + tid = list_first_entry(tid_list, struct ath_atx_tid, list);
  8326. +- list_del(&tid->list);
  8327. +- tid->sched = false;
  8328. ++ list_del_init(&tid->list);
  8329. +
  8330. + if (ath_tx_sched_aggr(sc, txq, tid, &stop))
  8331. + sent = true;
  8332. +@@ -2863,11 +2858,11 @@ void ath_tx_node_init(struct ath_softc *
  8333. + tid->seq_start = tid->seq_next = 0;
  8334. + tid->baw_size = WME_MAX_BA;
  8335. + tid->baw_head = tid->baw_tail = 0;
  8336. +- tid->sched = false;
  8337. + tid->active = false;
  8338. + tid->clear_ps_filter = true;
  8339. + __skb_queue_head_init(&tid->buf_q);
  8340. + __skb_queue_head_init(&tid->retry_q);
  8341. ++ INIT_LIST_HEAD(&tid->list);
  8342. + acno = TID_TO_WME_AC(tidno);
  8343. + tid->txq = sc->tx.txq_map[acno];
  8344. + }
  8345. +@@ -2886,10 +2881,8 @@ void ath_tx_node_cleanup(struct ath_soft
  8346. +
  8347. + ath_txq_lock(sc, txq);
  8348. +
  8349. +- if (tid->sched) {
  8350. +- list_del(&tid->list);
  8351. +- tid->sched = false;
  8352. +- }
  8353. ++ if (!list_empty(&tid->list))
  8354. ++ list_del_init(&tid->list);
  8355. +
  8356. + ath_tid_drain(sc, txq, tid);
  8357. + tid->active = false;
  8358. diff --git a/package/kernel/mac80211/patches/306-ath5k-fix-reset-race.patch b/package/kernel/mac80211/patches/306-ath5k-fix-reset-race.patch
  8359. deleted file mode 100644
  8360. index 85a1904..0000000
  8361. --- a/package/kernel/mac80211/patches/306-ath5k-fix-reset-race.patch
  8362. +++ /dev/null
  8363. @@ -1,96 +0,0 @@
  8364. -From: Sergey Ryazanov <ryazanov.s.a@gmail.com>
  8365. -Date: Wed, 4 Mar 2015 05:12:11 +0300
  8366. -Subject: [PATCH] ath5k: fix reset race
  8367. -
  8368. -To prepare for reset ath5k should finish all asynchronous tasks. At
  8369. -first, it disables the interrupt generation, then it waits for the
  8370. -interrupt handler and tasklets completion, and then proceeds to the HW
  8371. -configuration update. But it does not consider that the interrupt
  8372. -handler or tasklet re-enables the interrupt generation. And we fall in a
  8373. -situation when ath5k assumes that interrupts are disabled, but it is
  8374. -not.
  8375. -
  8376. -This can lead to different consequences, such as reception of the frame,
  8377. -when we do not expect it. Under certain circumstances, this can lead to
  8378. -the following warning:
  8379. -
  8380. - WARNING: at ath5k/base.c:589 ath5k_tasklet_rx+0x318/0x6ec [ath5k]()
  8381. - invalid hw_rix: 1a
  8382. - [..]
  8383. - Call Trace:
  8384. - [<802656a8>] show_stack+0x48/0x70
  8385. - [<802dd92c>] warn_slowpath_common+0x88/0xbc
  8386. - [<802dd98c>] warn_slowpath_fmt+0x2c/0x38
  8387. - [<81b51be8>] ath5k_tasklet_rx+0x318/0x6ec [ath5k]
  8388. - [<8028ac64>] tasklet_action+0x8c/0xf0
  8389. - [<80075804>] __do_softirq+0x180/0x32c
  8390. - [<80196ce8>] irq_exit+0x54/0x70
  8391. - [<80041848>] ret_from_irq+0x0/0x4
  8392. - [<80182fdc>] ioread32+0x4/0xc
  8393. - [<81b4c42c>] ath5k_hw_set_sleep_clock+0x2ec/0x474 [ath5k]
  8394. - [<81b4cf28>] ath5k_hw_reset+0x50/0xeb8 [ath5k]
  8395. - [<81b50900>] ath5k_reset+0xd4/0x310 [ath5k]
  8396. - [<81b557e8>] ath5k_config+0x4c/0x104 [ath5k]
  8397. - [<80d01770>] ieee80211_hw_config+0x2f4/0x35c [mac80211]
  8398. - [<80d09aa8>] ieee80211_scan_work+0x2e4/0x414 [mac80211]
  8399. - [<8022c3f4>] process_one_work+0x28c/0x400
  8400. - [<802df8f8>] worker_thread+0x258/0x3c0
  8401. - [<801b5710>] kthread+0xe0/0xec
  8402. - [<800418a8>] ret_from_kernel_thread+0x14/0x1c
  8403. -
  8404. -Fix this issue by adding a new status flag, which forbids to re-enable
  8405. -the interrupt generation until the HW configuration is completed.
  8406. -
  8407. -Note: previous patch, which reorders the Rx disable code helps to avoid
  8408. -the above warning, but not fixes the root cause of unexpected frame
  8409. -receiving.
  8410. -
  8411. -CC: Jiri Slaby <jirislaby@gmail.com>
  8412. -CC: Nick Kossifidis <mickflemm@gmail.com>
  8413. -CC: Luis R. Rodriguez <mcgrof@do-not-panic.com>
  8414. -Reported-by: Christophe Prevotaux <cprevotaux@nltinc.com>
  8415. -Tested-by: Christophe Prevotaux <cprevotaux@nltinc.com>
  8416. -Tested-by: Eric Bree <ebree@nltinc.com>
  8417. -Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
  8418. ----
  8419. -
  8420. ---- a/drivers/net/wireless/ath/ath5k/ath5k.h
  8421. -+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
  8422. -@@ -1283,6 +1283,7 @@ struct ath5k_hw {
  8423. - #define ATH_STAT_PROMISC 1
  8424. - #define ATH_STAT_LEDSOFT 2 /* enable LED gpio status */
  8425. - #define ATH_STAT_STARTED 3 /* opened & irqs enabled */
  8426. -+#define ATH_STAT_RESET 4 /* hw reset */
  8427. -
  8428. - unsigned int filter_flags; /* HW flags, AR5K_RX_FILTER_* */
  8429. - unsigned int fif_filter_flags; /* Current FIF_* filter flags */
  8430. ---- a/drivers/net/wireless/ath/ath5k/base.c
  8431. -+++ b/drivers/net/wireless/ath/ath5k/base.c
  8432. -@@ -1523,6 +1523,9 @@ ath5k_set_current_imask(struct ath5k_hw
  8433. - enum ath5k_int imask;
  8434. - unsigned long flags;
  8435. -
  8436. -+ if (test_bit(ATH_STAT_RESET, ah->status))
  8437. -+ return;
  8438. -+
  8439. - spin_lock_irqsave(&ah->irqlock, flags);
  8440. - imask = ah->imask;
  8441. - if (ah->rx_pending)
  8442. -@@ -2862,6 +2865,8 @@ ath5k_reset(struct ath5k_hw *ah, struct
  8443. -
  8444. - ATH5K_DBG(ah, ATH5K_DEBUG_RESET, "resetting\n");
  8445. -
  8446. -+ __set_bit(ATH_STAT_RESET, ah->status);
  8447. -+
  8448. - ath5k_hw_set_imr(ah, 0);
  8449. - synchronize_irq(ah->irq);
  8450. - ath5k_stop_tasklets(ah);
  8451. -@@ -2952,6 +2957,8 @@ ath5k_reset(struct ath5k_hw *ah, struct
  8452. - */
  8453. - /* ath5k_chan_change(ah, c); */
  8454. -
  8455. -+ __clear_bit(ATH_STAT_RESET, ah->status);
  8456. -+
  8457. - ath5k_beacon_config(ah);
  8458. - /* intrs are enabled by ath5k_beacon_config */
  8459. -
  8460. diff --git a/package/kernel/mac80211/patches/306-mac80211-Deinline-rate_control_rate_init-rate_contro.patch b/package/kernel/mac80211/patches/306-mac80211-Deinline-rate_control_rate_init-rate_contro.patch
  8461. new file mode 100644
  8462. index 0000000..928c93b
  8463. --- /dev/null
  8464. +++ b/package/kernel/mac80211/patches/306-mac80211-Deinline-rate_control_rate_init-rate_contro.patch
  8465. @@ -0,0 +1,161 @@
  8466. +From: Denys Vlasenko <dvlasenk@redhat.com>
  8467. +Date: Wed, 15 Jul 2015 14:56:06 +0200
  8468. +Subject: [PATCH] mac80211: Deinline rate_control_rate_init,
  8469. + rate_control_rate_update
  8470. +
  8471. +With this .config: http://busybox.net/~vda/kernel_config,
  8472. +after deinlining these functions have sizes and callsite counts
  8473. +as follows:
  8474. +
  8475. +rate_control_rate_init: 554 bytes, 8 calls
  8476. +rate_control_rate_update: 1596 bytes, 5 calls
  8477. +
  8478. +Total size reduction: about 11 kbytes.
  8479. +
  8480. +Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
  8481. +CC: John Linville <linville@tuxdriver.com>
  8482. +CC: Michal Kazior <michal.kazior@tieto.com>
  8483. +CC: Johannes Berg <johannes.berg@intel.com>
  8484. +Cc: linux-wireless@vger.kernel.org
  8485. +Cc: netdev@vger.kernel.org
  8486. +CC: linux-kernel@vger.kernel.org
  8487. +---
  8488. +
  8489. +--- a/net/mac80211/rate.c
  8490. ++++ b/net/mac80211/rate.c
  8491. +@@ -29,6 +29,65 @@ module_param(ieee80211_default_rc_algo,
  8492. + MODULE_PARM_DESC(ieee80211_default_rc_algo,
  8493. + "Default rate control algorithm for mac80211 to use");
  8494. +
  8495. ++void rate_control_rate_init(struct sta_info *sta)
  8496. ++{
  8497. ++ struct ieee80211_local *local = sta->sdata->local;
  8498. ++ struct rate_control_ref *ref = sta->rate_ctrl;
  8499. ++ struct ieee80211_sta *ista = &sta->sta;
  8500. ++ void *priv_sta = sta->rate_ctrl_priv;
  8501. ++ struct ieee80211_supported_band *sband;
  8502. ++ struct ieee80211_chanctx_conf *chanctx_conf;
  8503. ++
  8504. ++ ieee80211_sta_set_rx_nss(sta);
  8505. ++
  8506. ++ if (!ref)
  8507. ++ return;
  8508. ++
  8509. ++ rcu_read_lock();
  8510. ++
  8511. ++ chanctx_conf = rcu_dereference(sta->sdata->vif.chanctx_conf);
  8512. ++ if (WARN_ON(!chanctx_conf)) {
  8513. ++ rcu_read_unlock();
  8514. ++ return;
  8515. ++ }
  8516. ++
  8517. ++ sband = local->hw.wiphy->bands[chanctx_conf->def.chan->band];
  8518. ++
  8519. ++ spin_lock_bh(&sta->rate_ctrl_lock);
  8520. ++ ref->ops->rate_init(ref->priv, sband, &chanctx_conf->def, ista,
  8521. ++ priv_sta);
  8522. ++ spin_unlock_bh(&sta->rate_ctrl_lock);
  8523. ++ rcu_read_unlock();
  8524. ++ set_sta_flag(sta, WLAN_STA_RATE_CONTROL);
  8525. ++}
  8526. ++
  8527. ++void rate_control_rate_update(struct ieee80211_local *local,
  8528. ++ struct ieee80211_supported_band *sband,
  8529. ++ struct sta_info *sta, u32 changed)
  8530. ++{
  8531. ++ struct rate_control_ref *ref = local->rate_ctrl;
  8532. ++ struct ieee80211_sta *ista = &sta->sta;
  8533. ++ void *priv_sta = sta->rate_ctrl_priv;
  8534. ++ struct ieee80211_chanctx_conf *chanctx_conf;
  8535. ++
  8536. ++ if (ref && ref->ops->rate_update) {
  8537. ++ rcu_read_lock();
  8538. ++
  8539. ++ chanctx_conf = rcu_dereference(sta->sdata->vif.chanctx_conf);
  8540. ++ if (WARN_ON(!chanctx_conf)) {
  8541. ++ rcu_read_unlock();
  8542. ++ return;
  8543. ++ }
  8544. ++
  8545. ++ spin_lock_bh(&sta->rate_ctrl_lock);
  8546. ++ ref->ops->rate_update(ref->priv, sband, &chanctx_conf->def,
  8547. ++ ista, priv_sta, changed);
  8548. ++ spin_unlock_bh(&sta->rate_ctrl_lock);
  8549. ++ rcu_read_unlock();
  8550. ++ }
  8551. ++ drv_sta_rc_update(local, sta->sdata, &sta->sta, changed);
  8552. ++}
  8553. ++
  8554. + int ieee80211_rate_control_register(const struct rate_control_ops *ops)
  8555. + {
  8556. + struct rate_control_alg *alg;
  8557. +--- a/net/mac80211/rate.h
  8558. ++++ b/net/mac80211/rate.h
  8559. +@@ -71,64 +71,10 @@ rate_control_tx_status_noskb(struct ieee
  8560. + spin_unlock_bh(&sta->rate_ctrl_lock);
  8561. + }
  8562. +
  8563. +-static inline void rate_control_rate_init(struct sta_info *sta)
  8564. +-{
  8565. +- struct ieee80211_local *local = sta->sdata->local;
  8566. +- struct rate_control_ref *ref = sta->rate_ctrl;
  8567. +- struct ieee80211_sta *ista = &sta->sta;
  8568. +- void *priv_sta = sta->rate_ctrl_priv;
  8569. +- struct ieee80211_supported_band *sband;
  8570. +- struct ieee80211_chanctx_conf *chanctx_conf;
  8571. +-
  8572. +- ieee80211_sta_set_rx_nss(sta);
  8573. +-
  8574. +- if (!ref)
  8575. +- return;
  8576. +-
  8577. +- rcu_read_lock();
  8578. +-
  8579. +- chanctx_conf = rcu_dereference(sta->sdata->vif.chanctx_conf);
  8580. +- if (WARN_ON(!chanctx_conf)) {
  8581. +- rcu_read_unlock();
  8582. +- return;
  8583. +- }
  8584. +-
  8585. +- sband = local->hw.wiphy->bands[chanctx_conf->def.chan->band];
  8586. +-
  8587. +- spin_lock_bh(&sta->rate_ctrl_lock);
  8588. +- ref->ops->rate_init(ref->priv, sband, &chanctx_conf->def, ista,
  8589. +- priv_sta);
  8590. +- spin_unlock_bh(&sta->rate_ctrl_lock);
  8591. +- rcu_read_unlock();
  8592. +- set_sta_flag(sta, WLAN_STA_RATE_CONTROL);
  8593. +-}
  8594. +-
  8595. +-static inline void rate_control_rate_update(struct ieee80211_local *local,
  8596. ++void rate_control_rate_init(struct sta_info *sta);
  8597. ++void rate_control_rate_update(struct ieee80211_local *local,
  8598. + struct ieee80211_supported_band *sband,
  8599. +- struct sta_info *sta, u32 changed)
  8600. +-{
  8601. +- struct rate_control_ref *ref = local->rate_ctrl;
  8602. +- struct ieee80211_sta *ista = &sta->sta;
  8603. +- void *priv_sta = sta->rate_ctrl_priv;
  8604. +- struct ieee80211_chanctx_conf *chanctx_conf;
  8605. +-
  8606. +- if (ref && ref->ops->rate_update) {
  8607. +- rcu_read_lock();
  8608. +-
  8609. +- chanctx_conf = rcu_dereference(sta->sdata->vif.chanctx_conf);
  8610. +- if (WARN_ON(!chanctx_conf)) {
  8611. +- rcu_read_unlock();
  8612. +- return;
  8613. +- }
  8614. +-
  8615. +- spin_lock_bh(&sta->rate_ctrl_lock);
  8616. +- ref->ops->rate_update(ref->priv, sband, &chanctx_conf->def,
  8617. +- ista, priv_sta, changed);
  8618. +- spin_unlock_bh(&sta->rate_ctrl_lock);
  8619. +- rcu_read_unlock();
  8620. +- }
  8621. +- drv_sta_rc_update(local, sta->sdata, &sta->sta, changed);
  8622. +-}
  8623. ++ struct sta_info *sta, u32 changed);
  8624. +
  8625. + static inline void *rate_control_alloc_sta(struct rate_control_ref *ref,
  8626. + struct sta_info *sta, gfp_t gfp)
  8627. 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
  8628. deleted file mode 100644
  8629. index ab9771e..0000000
  8630. --- a/package/kernel/mac80211/patches/307-ath9k-fix-tracking-of-enabled-AP-beacons.patch
  8631. +++ /dev/null
  8632. @@ -1,76 +0,0 @@
  8633. -From: Felix Fietkau <nbd@openwrt.org>
  8634. -Date: Thu, 12 Mar 2015 17:10:50 +0100
  8635. -Subject: [PATCH] ath9k: fix tracking of enabled AP beacons
  8636. -
  8637. -sc->nbcnvifs tracks assigned beacon slots, not enabled beacons.
  8638. -Therefore, it cannot be used to decide if cur_conf->enable_beacon (bool)
  8639. -should be updated, or if beacons have been enabled already.
  8640. -With the current code (depending on the order of calls), beacons often
  8641. -do not get enabled in an AP+STA setup.
  8642. -To fix tracking of enabled beacons, convert cur_conf->enable_beacon to a
  8643. -bitmask of enabled beacon slots.
  8644. -
  8645. -Cc: stable@vger.kernel.org
  8646. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8647. ----
  8648. -
  8649. ---- a/drivers/net/wireless/ath/ath9k/beacon.c
  8650. -+++ b/drivers/net/wireless/ath/ath9k/beacon.c
  8651. -@@ -219,12 +219,15 @@ void ath9k_beacon_remove_slot(struct ath
  8652. - struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  8653. - struct ath_vif *avp = (void *)vif->drv_priv;
  8654. - struct ath_buf *bf = avp->av_bcbuf;
  8655. -+ struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon;
  8656. -
  8657. - ath_dbg(common, CONFIG, "Removing interface at beacon slot: %d\n",
  8658. - avp->av_bslot);
  8659. -
  8660. - tasklet_disable(&sc->bcon_tasklet);
  8661. -
  8662. -+ cur_conf->enable_beacon &= ~BIT(avp->av_bslot);
  8663. -+
  8664. - if (bf && bf->bf_mpdu) {
  8665. - struct sk_buff *skb = bf->bf_mpdu;
  8666. - dma_unmap_single(sc->dev, bf->bf_buf_addr,
  8667. -@@ -521,8 +524,7 @@ static bool ath9k_allow_beacon_config(st
  8668. - }
  8669. -
  8670. - if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) {
  8671. -- if ((vif->type != NL80211_IFTYPE_AP) ||
  8672. -- (sc->nbcnvifs > 1)) {
  8673. -+ if (vif->type != NL80211_IFTYPE_AP) {
  8674. - ath_dbg(common, CONFIG,
  8675. - "An AP interface is already present !\n");
  8676. - return false;
  8677. -@@ -616,12 +618,14 @@ void ath9k_beacon_config(struct ath_soft
  8678. - * enabling/disabling SWBA.
  8679. - */
  8680. - if (changed & BSS_CHANGED_BEACON_ENABLED) {
  8681. -- if (!bss_conf->enable_beacon &&
  8682. -- (sc->nbcnvifs <= 1)) {
  8683. -- cur_conf->enable_beacon = false;
  8684. -- } else if (bss_conf->enable_beacon) {
  8685. -- cur_conf->enable_beacon = true;
  8686. -- ath9k_cache_beacon_config(sc, ctx, bss_conf);
  8687. -+ bool enabled = cur_conf->enable_beacon;
  8688. -+
  8689. -+ if (!bss_conf->enable_beacon) {
  8690. -+ cur_conf->enable_beacon &= ~BIT(avp->av_bslot);
  8691. -+ } else {
  8692. -+ cur_conf->enable_beacon |= BIT(avp->av_bslot);
  8693. -+ if (!enabled)
  8694. -+ ath9k_cache_beacon_config(sc, ctx, bss_conf);
  8695. - }
  8696. - }
  8697. -
  8698. ---- a/drivers/net/wireless/ath/ath9k/common.h
  8699. -+++ b/drivers/net/wireless/ath/ath9k/common.h
  8700. -@@ -54,7 +54,7 @@ struct ath_beacon_config {
  8701. - u16 dtim_period;
  8702. - u16 bmiss_timeout;
  8703. - u8 dtim_count;
  8704. -- bool enable_beacon;
  8705. -+ u8 enable_beacon;
  8706. - bool ibss_creator;
  8707. - u32 nexttbtt;
  8708. - u32 intval;
  8709. diff --git a/package/kernel/mac80211/patches/307-mac80211-Deinline-drv_sta_state.patch b/package/kernel/mac80211/patches/307-mac80211-Deinline-drv_sta_state.patch
  8710. new file mode 100644
  8711. index 0000000..474c409
  8712. --- /dev/null
  8713. +++ b/package/kernel/mac80211/patches/307-mac80211-Deinline-drv_sta_state.patch
  8714. @@ -0,0 +1,116 @@
  8715. +From: Denys Vlasenko <dvlasenk@redhat.com>
  8716. +Date: Wed, 15 Jul 2015 14:56:05 +0200
  8717. +Subject: [PATCH] mac80211: Deinline drv_sta_state
  8718. +
  8719. +With this .config: http://busybox.net/~vda/kernel_config,
  8720. +after deinlining the function size is 3132 bytes and there are
  8721. +7 callsites.
  8722. +
  8723. +Total size reduction: about 20 kbytes.
  8724. +
  8725. +Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
  8726. +CC: John Linville <linville@tuxdriver.com>
  8727. +CC: Michal Kazior <michal.kazior@tieto.com>
  8728. +Cc: Johannes Berg <johannes.berg@intel.com>
  8729. +Cc: linux-wireless@vger.kernel.org
  8730. +Cc: netdev@vger.kernel.org
  8731. +CC: linux-kernel@vger.kernel.org
  8732. +---
  8733. + create mode 100644 net/mac80211/driver-ops.c
  8734. +
  8735. +--- a/net/mac80211/Makefile
  8736. ++++ b/net/mac80211/Makefile
  8737. +@@ -3,6 +3,7 @@ obj-$(CPTCFG_MAC80211) += mac80211.o
  8738. + # mac80211 objects
  8739. + mac80211-y := \
  8740. + main.o status.o \
  8741. ++ driver-ops.o \
  8742. + sta_info.o \
  8743. + wep.o \
  8744. + wpa.o \
  8745. +--- /dev/null
  8746. ++++ b/net/mac80211/driver-ops.c
  8747. +@@ -0,0 +1,41 @@
  8748. ++/*
  8749. ++ * This program is free software; you can redistribute it and/or modify
  8750. ++ * it under the terms of the GNU General Public License version 2 as
  8751. ++ * published by the Free Software Foundation.
  8752. ++ */
  8753. ++#include <net/mac80211.h>
  8754. ++#include "ieee80211_i.h"
  8755. ++#include "trace.h"
  8756. ++#include "driver-ops.h"
  8757. ++
  8758. ++__must_check
  8759. ++int drv_sta_state(struct ieee80211_local *local,
  8760. ++ struct ieee80211_sub_if_data *sdata,
  8761. ++ struct sta_info *sta,
  8762. ++ enum ieee80211_sta_state old_state,
  8763. ++ enum ieee80211_sta_state new_state)
  8764. ++{
  8765. ++ int ret = 0;
  8766. ++
  8767. ++ might_sleep();
  8768. ++
  8769. ++ sdata = get_bss_sdata(sdata);
  8770. ++ if (!check_sdata_in_driver(sdata))
  8771. ++ return -EIO;
  8772. ++
  8773. ++ trace_drv_sta_state(local, sdata, &sta->sta, old_state, new_state);
  8774. ++ if (local->ops->sta_state) {
  8775. ++ ret = local->ops->sta_state(&local->hw, &sdata->vif, &sta->sta,
  8776. ++ old_state, new_state);
  8777. ++ } else if (old_state == IEEE80211_STA_AUTH &&
  8778. ++ new_state == IEEE80211_STA_ASSOC) {
  8779. ++ ret = drv_sta_add(local, sdata, &sta->sta);
  8780. ++ if (ret == 0)
  8781. ++ sta->uploaded = true;
  8782. ++ } else if (old_state == IEEE80211_STA_ASSOC &&
  8783. ++ new_state == IEEE80211_STA_AUTH) {
  8784. ++ drv_sta_remove(local, sdata, &sta->sta);
  8785. ++ }
  8786. ++ trace_drv_return_int(local, ret);
  8787. ++ return ret;
  8788. ++}
  8789. +--- a/net/mac80211/driver-ops.h
  8790. ++++ b/net/mac80211/driver-ops.h
  8791. +@@ -573,37 +573,12 @@ static inline void drv_sta_pre_rcu_remov
  8792. + trace_drv_return_void(local);
  8793. + }
  8794. +
  8795. +-static inline __must_check
  8796. ++__must_check
  8797. + int drv_sta_state(struct ieee80211_local *local,
  8798. + struct ieee80211_sub_if_data *sdata,
  8799. + struct sta_info *sta,
  8800. + enum ieee80211_sta_state old_state,
  8801. +- enum ieee80211_sta_state new_state)
  8802. +-{
  8803. +- int ret = 0;
  8804. +-
  8805. +- might_sleep();
  8806. +-
  8807. +- sdata = get_bss_sdata(sdata);
  8808. +- if (!check_sdata_in_driver(sdata))
  8809. +- return -EIO;
  8810. +-
  8811. +- trace_drv_sta_state(local, sdata, &sta->sta, old_state, new_state);
  8812. +- if (local->ops->sta_state) {
  8813. +- ret = local->ops->sta_state(&local->hw, &sdata->vif, &sta->sta,
  8814. +- old_state, new_state);
  8815. +- } else if (old_state == IEEE80211_STA_AUTH &&
  8816. +- new_state == IEEE80211_STA_ASSOC) {
  8817. +- ret = drv_sta_add(local, sdata, &sta->sta);
  8818. +- if (ret == 0)
  8819. +- sta->uploaded = true;
  8820. +- } else if (old_state == IEEE80211_STA_ASSOC &&
  8821. +- new_state == IEEE80211_STA_AUTH) {
  8822. +- drv_sta_remove(local, sdata, &sta->sta);
  8823. +- }
  8824. +- trace_drv_return_int(local, ret);
  8825. +- return ret;
  8826. +-}
  8827. ++ enum ieee80211_sta_state new_state);
  8828. +
  8829. + static inline void drv_sta_rc_update(struct ieee80211_local *local,
  8830. + struct ieee80211_sub_if_data *sdata,
  8831. diff --git a/package/kernel/mac80211/patches/308-ath9k-Fix-NF-CCA-limits-for-AR9287-and-AR9227.patch b/package/kernel/mac80211/patches/308-ath9k-Fix-NF-CCA-limits-for-AR9287-and-AR9227.patch
  8832. new file mode 100644
  8833. index 0000000..1a3a9d4
  8834. --- /dev/null
  8835. +++ b/package/kernel/mac80211/patches/308-ath9k-Fix-NF-CCA-limits-for-AR9287-and-AR9227.patch
  8836. @@ -0,0 +1,30 @@
  8837. +From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
  8838. +Date: Wed, 22 Jul 2015 10:42:43 +0200
  8839. +Subject: [PATCH] ath9k: Fix NF CCA limits for AR9287 and AR9227
  8840. +
  8841. +The FreeBSD driver [0] uses the same 2G values as for the AR9280 chips.
  8842. +Using the same values in ath9k results in much better throughput for me.
  8843. +
  8844. +Before this patch I had a huge amount of packet loss (sometimes up to
  8845. +40%) and the max transfer speed was somewhere around 5Mbit/s. With this
  8846. +patch applied I have zero packet loss and ten times the throughput.
  8847. +My device uses a AR9227 which is the PCI variant of the AR9287.
  8848. +
  8849. +[0] http://bxr.su/FreeBSD/sys/dev/ath/ath_hal/ar9002/ar9287.h
  8850. +
  8851. +Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
  8852. +---
  8853. +
  8854. +--- a/drivers/net/wireless/ath/ath9k/ar9002_phy.h
  8855. ++++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.h
  8856. +@@ -610,8 +610,8 @@
  8857. + #define AR_PHY_CCA_MIN_GOOD_VAL_9271_2GHZ -127
  8858. + #define AR_PHY_CCA_MAX_GOOD_VAL_9271_2GHZ -116
  8859. +
  8860. +-#define AR_PHY_CCA_NOM_VAL_9287_2GHZ -120
  8861. ++#define AR_PHY_CCA_NOM_VAL_9287_2GHZ -112
  8862. + #define AR_PHY_CCA_MIN_GOOD_VAL_9287_2GHZ -127
  8863. +-#define AR_PHY_CCA_MAX_GOOD_VAL_9287_2GHZ -110
  8864. ++#define AR_PHY_CCA_MAX_GOOD_VAL_9287_2GHZ -97
  8865. +
  8866. + #endif
  8867. 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
  8868. deleted file mode 100644
  8869. index d132636..0000000
  8870. --- a/package/kernel/mac80211/patches/308-mac80211-minstrel_ht-fix-rounding-issue-in-MCS-durat.patch
  8871. +++ /dev/null
  8872. @@ -1,43 +0,0 @@
  8873. -From: Felix Fietkau <nbd@openwrt.org>
  8874. -Date: Fri, 13 Mar 2015 10:49:40 +0100
  8875. -Subject: [PATCH] mac80211: minstrel_ht: fix rounding issue in MCS duration
  8876. - calculation
  8877. -
  8878. -On very high MCS bitrates, the calculated duration of rates that are
  8879. -next to each other can be very imprecise, due to the small packet size
  8880. -used as reference (1200 bytes).
  8881. -This is most visible in VHT80 nss=2 MCS8/9, for which minstrel shows the
  8882. -same throughput when the probability is also the same. This leads to a
  8883. -bad rate selection for such rates.
  8884. -
  8885. -Fix this issue by introducing an average A-MPDU size factor into the
  8886. -calculation.
  8887. -
  8888. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8889. ----
  8890. -
  8891. ---- a/net/mac80211/rc80211_minstrel_ht.c
  8892. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  8893. -@@ -17,10 +17,11 @@
  8894. - #include "rc80211_minstrel.h"
  8895. - #include "rc80211_minstrel_ht.h"
  8896. -
  8897. -+#define AVG_AMPDU_SIZE 16
  8898. - #define AVG_PKT_SIZE 1200
  8899. -
  8900. - /* Number of bits for an average sized packet */
  8901. --#define MCS_NBITS (AVG_PKT_SIZE << 3)
  8902. -+#define MCS_NBITS ((AVG_PKT_SIZE * AVG_AMPDU_SIZE) << 3)
  8903. -
  8904. - /* Number of symbols for a packet with (bps) bits per symbol */
  8905. - #define MCS_NSYMS(bps) DIV_ROUND_UP(MCS_NBITS, (bps))
  8906. -@@ -33,7 +34,8 @@
  8907. - )
  8908. -
  8909. - /* Transmit duration for the raw data part of an average sized packet */
  8910. --#define MCS_DURATION(streams, sgi, bps) MCS_SYMBOL_TIME(sgi, MCS_NSYMS((streams) * (bps)))
  8911. -+#define MCS_DURATION(streams, sgi, bps) \
  8912. -+ (MCS_SYMBOL_TIME(sgi, MCS_NSYMS((streams) * (bps))) / AVG_AMPDU_SIZE)
  8913. -
  8914. - #define BW_20 0
  8915. - #define BW_40 1
  8916. 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
  8917. deleted file mode 100644
  8918. index 945fbce..0000000
  8919. --- a/package/kernel/mac80211/patches/309-ath9k-disable-TPC-support-again-for-now.patch
  8920. +++ /dev/null
  8921. @@ -1,22 +0,0 @@
  8922. -From: Felix Fietkau <nbd@openwrt.org>
  8923. -Date: Sun, 15 Mar 2015 08:02:37 +0100
  8924. -Subject: [PATCH] ath9k: disable TPC support again (for now)
  8925. -
  8926. -TPC support has been observed to cause some tx power fluctuations on
  8927. -some devices with at least AR934x and AR938x chips.
  8928. -Disable it for now until the bugs have been found and fixed
  8929. -
  8930. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8931. ----
  8932. -
  8933. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  8934. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  8935. -@@ -424,7 +424,7 @@ static void ath9k_hw_init_defaults(struc
  8936. - ah->power_mode = ATH9K_PM_UNDEFINED;
  8937. - ah->htc_reset_init = true;
  8938. -
  8939. -- ah->tpc_enabled = true;
  8940. -+ ah->tpc_enabled = false;
  8941. -
  8942. - ah->ani_function = ATH9K_ANI_ALL;
  8943. - if (!AR_SREV_9300_20_OR_LATER(ah))
  8944. diff --git a/package/kernel/mac80211/patches/309-mac80211-make-local-tx_headroom-a-multiple-of-4.patch b/package/kernel/mac80211/patches/309-mac80211-make-local-tx_headroom-a-multiple-of-4.patch
  8945. new file mode 100644
  8946. index 0000000..e8e9617
  8947. --- /dev/null
  8948. +++ b/package/kernel/mac80211/patches/309-mac80211-make-local-tx_headroom-a-multiple-of-4.patch
  8949. @@ -0,0 +1,20 @@
  8950. +From: Felix Fietkau <nbd@openwrt.org>
  8951. +Date: Thu, 30 Jul 2015 14:12:25 +0200
  8952. +Subject: [PATCH] mac80211: make local->tx_headroom a multiple of 4
  8953. +
  8954. +This ensures that mac80211 generated management frames and beacons are
  8955. +aligned before being passed to the driver
  8956. +
  8957. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8958. +---
  8959. +
  8960. +--- a/net/mac80211/main.c
  8961. ++++ b/net/mac80211/main.c
  8962. +@@ -1031,6 +1031,7 @@ int ieee80211_register_hw(struct ieee802
  8963. + */
  8964. + local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom,
  8965. + IEEE80211_TX_STATUS_HEADROOM);
  8966. ++ local->tx_headroom = ALIGN(local->tx_headroom, 4);
  8967. +
  8968. + debugfs_hw_add(local);
  8969. +
  8970. 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
  8971. deleted file mode 100644
  8972. index bd3050e..0000000
  8973. --- a/package/kernel/mac80211/patches/310-mac80211-don-t-look-up-stations-for-multicast-addres.patch
  8974. +++ /dev/null
  8975. @@ -1,21 +0,0 @@
  8976. -From: Johannes Berg <johannes.berg@intel.com>
  8977. -Date: Tue, 24 Feb 2015 00:28:18 +0100
  8978. -Subject: [PATCH] mac80211: don't look up stations for multicast addresses
  8979. -
  8980. -Since multicast addresses don't exist as stations, don't attempt
  8981. -to look them up in the hashtable on TX.
  8982. -
  8983. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  8984. ----
  8985. -
  8986. ---- a/net/mac80211/tx.c
  8987. -+++ b/net/mac80211/tx.c
  8988. -@@ -1161,7 +1161,7 @@ ieee80211_tx_prepare(struct ieee80211_su
  8989. - tx->sdata->control_port_protocol == tx->skb->protocol) {
  8990. - tx->sta = sta_info_get_bss(sdata, hdr->addr1);
  8991. - }
  8992. -- if (!tx->sta)
  8993. -+ if (!tx->sta && !is_multicast_ether_addr(hdr->addr1))
  8994. - tx->sta = sta_info_get(sdata, hdr->addr1);
  8995. -
  8996. - if (tx->sta && ieee80211_is_data_qos(hdr->frame_control) &&
  8997. diff --git a/package/kernel/mac80211/patches/310-mac80211-fix-invalid-read-in-minstrel_sort_best_tp_r.patch b/package/kernel/mac80211/patches/310-mac80211-fix-invalid-read-in-minstrel_sort_best_tp_r.patch
  8998. new file mode 100644
  8999. index 0000000..51a315c
  9000. --- /dev/null
  9001. +++ b/package/kernel/mac80211/patches/310-mac80211-fix-invalid-read-in-minstrel_sort_best_tp_r.patch
  9002. @@ -0,0 +1,34 @@
  9003. +From: Adrien Schildknecht <adrien+dev@schischi.me>
  9004. +Date: Tue, 28 Jul 2015 10:30:16 +0200
  9005. +Subject: [PATCH] mac80211: fix invalid read in minstrel_sort_best_tp_rates()
  9006. +
  9007. +At the last iteration of the loop, j may equal zero and thus
  9008. +tp_list[j - 1] causes an invalid read.
  9009. +Changed the logic of the loop so that j - 1 is always >= 0.
  9010. +
  9011. +Signed-off-by: Adrien Schildknecht <adrien+dev@schischi.me>
  9012. +---
  9013. +
  9014. +--- a/net/mac80211/rc80211_minstrel.c
  9015. ++++ b/net/mac80211/rc80211_minstrel.c
  9016. +@@ -92,14 +92,15 @@ int minstrel_get_tp_avg(struct minstrel_
  9017. + static inline void
  9018. + minstrel_sort_best_tp_rates(struct minstrel_sta_info *mi, int i, u8 *tp_list)
  9019. + {
  9020. +- int j = MAX_THR_RATES;
  9021. +- struct minstrel_rate_stats *tmp_mrs = &mi->r[j - 1].stats;
  9022. ++ int j;
  9023. ++ struct minstrel_rate_stats *tmp_mrs;
  9024. + struct minstrel_rate_stats *cur_mrs = &mi->r[i].stats;
  9025. +
  9026. +- while (j > 0 && (minstrel_get_tp_avg(&mi->r[i], cur_mrs->prob_ewma) >
  9027. +- minstrel_get_tp_avg(&mi->r[tp_list[j - 1]], tmp_mrs->prob_ewma))) {
  9028. +- j--;
  9029. ++ for (j = MAX_THR_RATES; j > 0; --j) {
  9030. + tmp_mrs = &mi->r[tp_list[j - 1]].stats;
  9031. ++ if (minstrel_get_tp_avg(&mi->r[i], cur_mrs->prob_ewma) <=
  9032. ++ minstrel_get_tp_avg(&mi->r[tp_list[j - 1]], tmp_mrs->prob_ewma))
  9033. ++ break;
  9034. + }
  9035. +
  9036. + if (j < MAX_THR_RATES - 1)
  9037. diff --git a/package/kernel/mac80211/patches/311-brcmfmac-dhd_sdio.c-use-existing-atomic_or-primitive.patch b/package/kernel/mac80211/patches/311-brcmfmac-dhd_sdio.c-use-existing-atomic_or-primitive.patch
  9038. new file mode 100644
  9039. index 0000000..e44f121
  9040. --- /dev/null
  9041. +++ b/package/kernel/mac80211/patches/311-brcmfmac-dhd_sdio.c-use-existing-atomic_or-primitive.patch
  9042. @@ -0,0 +1,45 @@
  9043. +From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
  9044. +Date: Thu, 9 Jul 2015 13:43:18 +0530
  9045. +Subject: [PATCH] brcmfmac: dhd_sdio.c: use existing atomic_or primitive
  9046. +
  9047. +There's already a generic implementation so use that instead.
  9048. +
  9049. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9050. +---
  9051. +
  9052. +--- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  9053. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  9054. +@@ -2564,15 +2564,6 @@ static inline void brcmf_sdio_clrintr(st
  9055. + }
  9056. + }
  9057. +
  9058. +-static void atomic_orr(int val, atomic_t *v)
  9059. +-{
  9060. +- int old_val;
  9061. +-
  9062. +- old_val = atomic_read(v);
  9063. +- while (atomic_cmpxchg(v, old_val, val | old_val) != old_val)
  9064. +- old_val = atomic_read(v);
  9065. +-}
  9066. +-
  9067. + static int brcmf_sdio_intr_rstatus(struct brcmf_sdio *bus)
  9068. + {
  9069. + struct brcmf_core *buscore;
  9070. +@@ -2595,7 +2586,7 @@ static int brcmf_sdio_intr_rstatus(struc
  9071. + if (val) {
  9072. + brcmf_sdiod_regwl(bus->sdiodev, addr, val, &ret);
  9073. + bus->sdcnt.f1regdata++;
  9074. +- atomic_orr(val, &bus->intstatus);
  9075. ++ atomic_or(val, &bus->intstatus);
  9076. + }
  9077. +
  9078. + return ret;
  9079. +@@ -2712,7 +2703,7 @@ static void brcmf_sdio_dpc(struct brcmf_
  9080. +
  9081. + /* Keep still-pending events for next scheduling */
  9082. + if (intstatus)
  9083. +- atomic_orr(intstatus, &bus->intstatus);
  9084. ++ atomic_or(intstatus, &bus->intstatus);
  9085. +
  9086. + brcmf_sdio_clrintr(bus);
  9087. +
  9088. 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
  9089. deleted file mode 100644
  9090. index b2475b9..0000000
  9091. --- a/package/kernel/mac80211/patches/311-mac80211-remove-drop_unencrypted-code.patch
  9092. +++ /dev/null
  9093. @@ -1,130 +0,0 @@
  9094. -From: Johannes Berg <johannes.berg@intel.com>
  9095. -Date: Fri, 20 Mar 2015 11:41:58 +0100
  9096. -Subject: [PATCH] mac80211: remove drop_unencrypted code
  9097. -
  9098. -This mechanism was historic, and only ever used by IBSS, which
  9099. -also doesn't need to have it as it properly manages station's
  9100. -802.1X PAE state (or, with WEP, always has a key.)
  9101. -
  9102. -Remove the mechanism to clean up the code.
  9103. -
  9104. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9105. ----
  9106. -
  9107. ---- a/net/mac80211/debugfs.c
  9108. -+++ b/net/mac80211/debugfs.c
  9109. -@@ -274,8 +274,6 @@ void debugfs_hw_add(struct ieee80211_loc
  9110. - #ifdef CPTCFG_MAC80211_DEBUG_COUNTERS
  9111. - DEBUGFS_STATS_ADD(tx_handlers_drop, local->tx_handlers_drop);
  9112. - DEBUGFS_STATS_ADD(tx_handlers_queued, local->tx_handlers_queued);
  9113. -- DEBUGFS_STATS_ADD(tx_handlers_drop_unencrypted,
  9114. -- local->tx_handlers_drop_unencrypted);
  9115. - DEBUGFS_STATS_ADD(tx_handlers_drop_fragment,
  9116. - local->tx_handlers_drop_fragment);
  9117. - DEBUGFS_STATS_ADD(tx_handlers_drop_wep,
  9118. ---- a/net/mac80211/debugfs_netdev.c
  9119. -+++ b/net/mac80211/debugfs_netdev.c
  9120. -@@ -177,7 +177,6 @@ static ssize_t ieee80211_if_write_##name
  9121. - IEEE80211_IF_FILE_R(name)
  9122. -
  9123. - /* common attributes */
  9124. --IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC);
  9125. - IEEE80211_IF_FILE(rc_rateidx_mask_2ghz, rc_rateidx_mask[IEEE80211_BAND_2GHZ],
  9126. - HEX);
  9127. - IEEE80211_IF_FILE(rc_rateidx_mask_5ghz, rc_rateidx_mask[IEEE80211_BAND_5GHZ],
  9128. -@@ -562,7 +561,6 @@ IEEE80211_IF_FILE(dot11MeshAwakeWindowDu
  9129. -
  9130. - static void add_common_files(struct ieee80211_sub_if_data *sdata)
  9131. - {
  9132. -- DEBUGFS_ADD(drop_unencrypted);
  9133. - DEBUGFS_ADD(rc_rateidx_mask_2ghz);
  9134. - DEBUGFS_ADD(rc_rateidx_mask_5ghz);
  9135. - DEBUGFS_ADD(rc_rateidx_mcs_mask_2ghz);
  9136. ---- a/net/mac80211/ibss.c
  9137. -+++ b/net/mac80211/ibss.c
  9138. -@@ -249,8 +249,6 @@ static void __ieee80211_sta_join_ibss(st
  9139. - if (presp)
  9140. - kfree_rcu(presp, rcu_head);
  9141. -
  9142. -- sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0;
  9143. --
  9144. - /* make a copy of the chandef, it could be modified below. */
  9145. - chandef = *req_chandef;
  9146. - chan = chandef.chan;
  9147. -@@ -1289,8 +1287,6 @@ static void ieee80211_sta_create_ibss(st
  9148. -
  9149. - if (ifibss->privacy)
  9150. - capability |= WLAN_CAPABILITY_PRIVACY;
  9151. -- else
  9152. -- sdata->drop_unencrypted = 0;
  9153. -
  9154. - __ieee80211_sta_join_ibss(sdata, bssid, sdata->vif.bss_conf.beacon_int,
  9155. - &ifibss->chandef, ifibss->basic_rates,
  9156. ---- a/net/mac80211/ieee80211_i.h
  9157. -+++ b/net/mac80211/ieee80211_i.h
  9158. -@@ -842,8 +842,6 @@ struct ieee80211_sub_if_data {
  9159. -
  9160. - unsigned long state;
  9161. -
  9162. -- int drop_unencrypted;
  9163. --
  9164. - char name[IFNAMSIZ];
  9165. -
  9166. - /* Fragment table for host-based reassembly */
  9167. -@@ -1289,7 +1287,6 @@ struct ieee80211_local {
  9168. - /* TX/RX handler statistics */
  9169. - unsigned int tx_handlers_drop;
  9170. - unsigned int tx_handlers_queued;
  9171. -- unsigned int tx_handlers_drop_unencrypted;
  9172. - unsigned int tx_handlers_drop_fragment;
  9173. - unsigned int tx_handlers_drop_wep;
  9174. - unsigned int tx_handlers_drop_not_assoc;
  9175. ---- a/net/mac80211/iface.c
  9176. -+++ b/net/mac80211/iface.c
  9177. -@@ -1535,7 +1535,6 @@ int ieee80211_if_change_type(struct ieee
  9178. - }
  9179. -
  9180. - /* reset some values that shouldn't be kept across type changes */
  9181. -- sdata->drop_unencrypted = 0;
  9182. - if (type == NL80211_IFTYPE_STATION)
  9183. - sdata->u.mgd.use_4addr = false;
  9184. -
  9185. ---- a/net/mac80211/rx.c
  9186. -+++ b/net/mac80211/rx.c
  9187. -@@ -1897,8 +1897,7 @@ static int ieee80211_drop_unencrypted(st
  9188. - /* Drop unencrypted frames if key is set. */
  9189. - if (unlikely(!ieee80211_has_protected(fc) &&
  9190. - !ieee80211_is_nullfunc(fc) &&
  9191. -- ieee80211_is_data(fc) &&
  9192. -- (rx->key || rx->sdata->drop_unencrypted)))
  9193. -+ ieee80211_is_data(fc) && rx->key))
  9194. - return -EACCES;
  9195. -
  9196. - return 0;
  9197. ---- a/net/mac80211/tx.c
  9198. -+++ b/net/mac80211/tx.c
  9199. -@@ -594,23 +594,8 @@ ieee80211_tx_h_select_key(struct ieee802
  9200. - else if (!is_multicast_ether_addr(hdr->addr1) &&
  9201. - (key = rcu_dereference(tx->sdata->default_unicast_key)))
  9202. - tx->key = key;
  9203. -- else if (info->flags & IEEE80211_TX_CTL_INJECTED)
  9204. -+ else
  9205. - tx->key = NULL;
  9206. -- else if (!tx->sdata->drop_unencrypted)
  9207. -- tx->key = NULL;
  9208. -- else if (tx->skb->protocol == tx->sdata->control_port_protocol)
  9209. -- tx->key = NULL;
  9210. -- else if (ieee80211_is_robust_mgmt_frame(tx->skb) &&
  9211. -- !(ieee80211_is_action(hdr->frame_control) &&
  9212. -- tx->sta && test_sta_flag(tx->sta, WLAN_STA_MFP)))
  9213. -- tx->key = NULL;
  9214. -- else if (ieee80211_is_mgmt(hdr->frame_control) &&
  9215. -- !ieee80211_is_robust_mgmt_frame(tx->skb))
  9216. -- tx->key = NULL;
  9217. -- else {
  9218. -- I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted);
  9219. -- return TX_DROP;
  9220. -- }
  9221. -
  9222. - if (tx->key) {
  9223. - bool skip_hw = false;
  9224. diff --git a/package/kernel/mac80211/patches/312-brcmfmac-check-all-combinations-when-setting-wiphy-s.patch b/package/kernel/mac80211/patches/312-brcmfmac-check-all-combinations-when-setting-wiphy-s.patch
  9225. new file mode 100644
  9226. index 0000000..bb27115
  9227. --- /dev/null
  9228. +++ b/package/kernel/mac80211/patches/312-brcmfmac-check-all-combinations-when-setting-wiphy-s.patch
  9229. @@ -0,0 +1,46 @@
  9230. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  9231. +Date: Thu, 20 Aug 2015 00:16:42 +0200
  9232. +Subject: [PATCH] brcmfmac: check all combinations when setting wiphy's
  9233. + addresses
  9234. +MIME-Version: 1.0
  9235. +Content-Type: text/plain; charset=UTF-8
  9236. +Content-Transfer-Encoding: 8bit
  9237. +
  9238. +Broadcom is working on better reflection of interface combinations. With
  9239. +upcoming patches we may have 1st combination supporting less interfaces
  9240. +than others.
  9241. +To don't run out of addresses check all combinations to find the one
  9242. +with the greatest max_interfaces value.
  9243. +
  9244. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  9245. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9246. +---
  9247. +
  9248. +--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  9249. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  9250. +@@ -5786,7 +5786,9 @@ static void brcmf_wiphy_wowl_params(stru
  9251. + static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
  9252. + {
  9253. + struct brcmf_pub *drvr = ifp->drvr;
  9254. ++ const struct ieee80211_iface_combination *combo;
  9255. + struct ieee80211_supported_band *band;
  9256. ++ u16 max_interfaces = 0;
  9257. + __le32 bandlist[3];
  9258. + u32 n_bands;
  9259. + int err, i;
  9260. +@@ -5799,8 +5801,13 @@ static int brcmf_setup_wiphy(struct wiph
  9261. + if (err)
  9262. + return err;
  9263. +
  9264. +- for (i = 0; i < wiphy->iface_combinations->max_interfaces &&
  9265. +- i < ARRAY_SIZE(drvr->addresses); i++) {
  9266. ++ for (i = 0, combo = wiphy->iface_combinations;
  9267. ++ i < wiphy->n_iface_combinations; i++, combo++) {
  9268. ++ max_interfaces = max(max_interfaces, combo->max_interfaces);
  9269. ++ }
  9270. ++
  9271. ++ for (i = 0; i < max_interfaces && i < ARRAY_SIZE(drvr->addresses);
  9272. ++ i++) {
  9273. + u8 *addr = drvr->addresses[i].addr;
  9274. +
  9275. + memcpy(addr, drvr->mac, ETH_ALEN);
  9276. 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
  9277. deleted file mode 100644
  9278. index 02a7fab..0000000
  9279. --- a/package/kernel/mac80211/patches/312-mac80211-don-t-look-up-destination-station-twice.patch
  9280. +++ /dev/null
  9281. @@ -1,71 +0,0 @@
  9282. -From: Johannes Berg <johannes.berg@intel.com>
  9283. -Date: Fri, 20 Mar 2015 16:24:21 +0100
  9284. -Subject: [PATCH] mac80211: don't look up destination station twice
  9285. -
  9286. -There's no need to look up the destination station twice while
  9287. -building the 802.11 header for a given frame if the frame will
  9288. -actually be transmitted to the station we initially looked up.
  9289. -
  9290. -This happens for 4-addr VLAN interfaces and TDLS connections, which
  9291. -both directly send the frame to the station they looked up, though
  9292. -in the case of TDLS some station conditions need to be checked.
  9293. -
  9294. -To avoid that, add a variable indicating that we've looked up the
  9295. -station that the frame is going to be transmitted to, and avoid the
  9296. -lookup/flag checking if it already has been done.
  9297. -
  9298. -In the TDLS case, also move the authorized/wme_sta flag assignment
  9299. -to the correct place, i.e. only when that station is really used.
  9300. -Before this change, the new lookup should always have succeeded so
  9301. -that the potentially erroneous data would be overwritten.
  9302. -
  9303. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9304. ----
  9305. -
  9306. ---- a/net/mac80211/tx.c
  9307. -+++ b/net/mac80211/tx.c
  9308. -@@ -1894,6 +1894,7 @@ static struct sk_buff *ieee80211_build_h
  9309. - bool wme_sta = false, authorized = false, tdls_auth = false;
  9310. - bool tdls_peer = false, tdls_setup_frame = false;
  9311. - bool multicast;
  9312. -+ bool have_station = false;
  9313. - u16 info_id = 0;
  9314. - struct ieee80211_chanctx_conf *chanctx_conf;
  9315. - struct ieee80211_sub_if_data *ap_sdata;
  9316. -@@ -1918,6 +1919,7 @@ static struct sk_buff *ieee80211_build_h
  9317. - hdrlen = 30;
  9318. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  9319. - wme_sta = sta->sta.wme;
  9320. -+ have_station = true;
  9321. - }
  9322. - ap_sdata = container_of(sdata->bss, struct ieee80211_sub_if_data,
  9323. - u.ap);
  9324. -@@ -2034,9 +2036,6 @@ static struct sk_buff *ieee80211_build_h
  9325. - if (sdata->wdev.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) {
  9326. - sta = sta_info_get(sdata, skb->data);
  9327. - if (sta) {
  9328. -- authorized = test_sta_flag(sta,
  9329. -- WLAN_STA_AUTHORIZED);
  9330. -- wme_sta = sta->sta.wme;
  9331. - tdls_peer = test_sta_flag(sta,
  9332. - WLAN_STA_TDLS_PEER);
  9333. - tdls_auth = test_sta_flag(sta,
  9334. -@@ -2068,6 +2067,9 @@ static struct sk_buff *ieee80211_build_h
  9335. - memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN);
  9336. - memcpy(hdr.addr3, sdata->u.mgd.bssid, ETH_ALEN);
  9337. - hdrlen = 24;
  9338. -+ have_station = true;
  9339. -+ authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  9340. -+ wme_sta = sta->sta.wme;
  9341. - } else if (sdata->u.mgd.use_4addr &&
  9342. - cpu_to_be16(ethertype) != sdata->control_port_protocol) {
  9343. - fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS |
  9344. -@@ -2130,7 +2132,7 @@ static struct sk_buff *ieee80211_build_h
  9345. - * in AP mode)
  9346. - */
  9347. - multicast = is_multicast_ether_addr(hdr.addr1);
  9348. -- if (!multicast) {
  9349. -+ if (!multicast && !have_station) {
  9350. - sta = sta_info_get(sdata, hdr.addr1);
  9351. - if (sta) {
  9352. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  9353. diff --git a/package/kernel/mac80211/patches/313-brcmfmac-correct-interface-combination-info.patch b/package/kernel/mac80211/patches/313-brcmfmac-correct-interface-combination-info.patch
  9354. new file mode 100644
  9355. index 0000000..baee295
  9356. --- /dev/null
  9357. +++ b/package/kernel/mac80211/patches/313-brcmfmac-correct-interface-combination-info.patch
  9358. @@ -0,0 +1,204 @@
  9359. +From: Arend van Spriel <arend@broadcom.com>
  9360. +Date: Thu, 20 Aug 2015 22:06:03 +0200
  9361. +Subject: [PATCH] brcmfmac: correct interface combination info
  9362. +
  9363. +The interface combination provided by brcmfmac did not truly reflect
  9364. +the combinations supported by driver and/or firmware.
  9365. +
  9366. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  9367. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  9368. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9369. +Reviewed-by: Pontus Fuchs <pontusf@broadcom.com>
  9370. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9371. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9372. +---
  9373. +
  9374. +--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  9375. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  9376. +@@ -5695,63 +5695,132 @@ brcmf_txrx_stypes[NUM_NL80211_IFTYPES] =
  9377. + }
  9378. + };
  9379. +
  9380. ++/**
  9381. ++ * brcmf_setup_ifmodes() - determine interface modes and combinations.
  9382. ++ *
  9383. ++ * @wiphy: wiphy object.
  9384. ++ * @ifp: interface object needed for feat module api.
  9385. ++ *
  9386. ++ * The interface modes and combinations are determined dynamically here
  9387. ++ * based on firmware functionality.
  9388. ++ *
  9389. ++ * no p2p and no mbss:
  9390. ++ *
  9391. ++ * #STA <= 1, #AP <= 1, channels = 1, 2 total
  9392. ++ *
  9393. ++ * no p2p and mbss:
  9394. ++ *
  9395. ++ * #STA <= 1, #AP <= 1, channels = 1, 2 total
  9396. ++ * #AP <= 4, matching BI, channels = 1, 4 total
  9397. ++ *
  9398. ++ * p2p, no mchan, and mbss:
  9399. ++ *
  9400. ++ * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 1, 3 total
  9401. ++ * #STA <= 1, #P2P-DEV <= 1, #AP <= 1, #P2P-CL <= 1, channels = 1, 4 total
  9402. ++ * #AP <= 4, matching BI, channels = 1, 4 total
  9403. ++ *
  9404. ++ * p2p, mchan, and mbss:
  9405. ++ *
  9406. ++ * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 2, 3 total
  9407. ++ * #STA <= 1, #P2P-DEV <= 1, #AP <= 1, #P2P-CL <= 1, channels = 1, 4 total
  9408. ++ * #AP <= 4, matching BI, channels = 1, 4 total
  9409. ++ */
  9410. + static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp)
  9411. + {
  9412. + struct ieee80211_iface_combination *combo = NULL;
  9413. +- struct ieee80211_iface_limit *limits = NULL;
  9414. +- int i = 0, max_iface_cnt;
  9415. ++ struct ieee80211_iface_limit *c0_limits = NULL;
  9416. ++ struct ieee80211_iface_limit *p2p_limits = NULL;
  9417. ++ struct ieee80211_iface_limit *mbss_limits = NULL;
  9418. ++ bool mbss, p2p;
  9419. ++ int i, c, n_combos;
  9420. +
  9421. +- combo = kzalloc(sizeof(*combo), GFP_KERNEL);
  9422. ++ mbss = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS);
  9423. ++ p2p = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P);
  9424. ++
  9425. ++ n_combos = 1 + !!p2p + !!mbss;
  9426. ++ combo = kcalloc(n_combos, sizeof(*combo), GFP_KERNEL);
  9427. + if (!combo)
  9428. + goto err;
  9429. +
  9430. +- limits = kzalloc(sizeof(*limits) * 4, GFP_KERNEL);
  9431. +- if (!limits)
  9432. ++ c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
  9433. ++ if (!c0_limits)
  9434. + goto err;
  9435. +
  9436. ++ if (p2p) {
  9437. ++ p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
  9438. ++ if (!p2p_limits)
  9439. ++ goto err;
  9440. ++ }
  9441. ++
  9442. ++ if (mbss) {
  9443. ++ mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
  9444. ++ if (!mbss_limits)
  9445. ++ goto err;
  9446. ++ }
  9447. ++
  9448. + wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  9449. + BIT(NL80211_IFTYPE_ADHOC) |
  9450. + BIT(NL80211_IFTYPE_AP);
  9451. +
  9452. +- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  9453. +- combo->num_different_channels = 2;
  9454. +- else
  9455. +- combo->num_different_channels = 1;
  9456. +-
  9457. +- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) {
  9458. +- limits[i].max = 1;
  9459. +- limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  9460. +- limits[i].max = 4;
  9461. +- limits[i++].types = BIT(NL80211_IFTYPE_AP);
  9462. +- max_iface_cnt = 5;
  9463. +- } else {
  9464. +- limits[i].max = 2;
  9465. +- limits[i++].types = BIT(NL80211_IFTYPE_STATION) |
  9466. +- BIT(NL80211_IFTYPE_AP);
  9467. +- max_iface_cnt = 2;
  9468. +- }
  9469. +-
  9470. +- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P)) {
  9471. ++ c = 0;
  9472. ++ i = 0;
  9473. ++ combo[c].num_different_channels = 1;
  9474. ++ c0_limits[i].max = 1;
  9475. ++ c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  9476. ++ if (p2p) {
  9477. ++ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  9478. ++ combo[c].num_different_channels = 2;
  9479. + wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) |
  9480. + BIT(NL80211_IFTYPE_P2P_GO) |
  9481. + BIT(NL80211_IFTYPE_P2P_DEVICE);
  9482. +- limits[i].max = 1;
  9483. +- limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  9484. +- BIT(NL80211_IFTYPE_P2P_GO);
  9485. +- limits[i].max = 1;
  9486. +- limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  9487. +- max_iface_cnt += 2;
  9488. +- }
  9489. +- combo->max_interfaces = max_iface_cnt;
  9490. +- combo->limits = limits;
  9491. +- combo->n_limits = i;
  9492. ++ c0_limits[i].max = 1;
  9493. ++ c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  9494. ++ c0_limits[i].max = 1;
  9495. ++ c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  9496. ++ BIT(NL80211_IFTYPE_P2P_GO);
  9497. ++ } else {
  9498. ++ c0_limits[i].max = 1;
  9499. ++ c0_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  9500. ++ }
  9501. ++ combo[c].max_interfaces = i;
  9502. ++ combo[c].n_limits = i;
  9503. ++ combo[c].limits = c0_limits;
  9504. ++
  9505. ++ if (p2p) {
  9506. ++ c++;
  9507. ++ i = 0;
  9508. ++ combo[c].num_different_channels = 1;
  9509. ++ p2p_limits[i].max = 1;
  9510. ++ p2p_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  9511. ++ p2p_limits[i].max = 1;
  9512. ++ p2p_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  9513. ++ p2p_limits[i].max = 1;
  9514. ++ p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT);
  9515. ++ p2p_limits[i].max = 1;
  9516. ++ p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  9517. ++ combo[c].max_interfaces = i;
  9518. ++ combo[c].n_limits = i;
  9519. ++ combo[c].limits = p2p_limits;
  9520. ++ }
  9521. +
  9522. ++ if (mbss) {
  9523. ++ c++;
  9524. ++ combo[c].beacon_int_infra_match = true;
  9525. ++ combo[c].num_different_channels = 1;
  9526. ++ mbss_limits[0].max = 4;
  9527. ++ mbss_limits[0].types = BIT(NL80211_IFTYPE_AP);
  9528. ++ combo[c].max_interfaces = 4;
  9529. ++ combo[c].n_limits = 1;
  9530. ++ combo[c].limits = mbss_limits;
  9531. ++ }
  9532. ++ wiphy->n_iface_combinations = n_combos;
  9533. + wiphy->iface_combinations = combo;
  9534. +- wiphy->n_iface_combinations = 1;
  9535. + return 0;
  9536. +
  9537. + err:
  9538. +- kfree(limits);
  9539. ++ kfree(c0_limits);
  9540. ++ kfree(p2p_limits);
  9541. ++ kfree(mbss_limits);
  9542. + kfree(combo);
  9543. + return -ENOMEM;
  9544. + }
  9545. +@@ -6080,11 +6149,15 @@ static void brcmf_cfg80211_reg_notifier(
  9546. +
  9547. + static void brcmf_free_wiphy(struct wiphy *wiphy)
  9548. + {
  9549. ++ int i;
  9550. ++
  9551. + if (!wiphy)
  9552. + return;
  9553. +
  9554. +- if (wiphy->iface_combinations)
  9555. +- kfree(wiphy->iface_combinations->limits);
  9556. ++ if (wiphy->iface_combinations) {
  9557. ++ for (i = 0; i < wiphy->n_iface_combinations; i++)
  9558. ++ kfree(wiphy->iface_combinations[i].limits);
  9559. ++ }
  9560. + kfree(wiphy->iface_combinations);
  9561. + if (wiphy->bands[IEEE80211_BAND_2GHZ]) {
  9562. + kfree(wiphy->bands[IEEE80211_BAND_2GHZ]->channels);
  9563. 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
  9564. deleted file mode 100644
  9565. index 4125351..0000000
  9566. --- a/package/kernel/mac80211/patches/313-mac80211-drop-4-addr-VLAN-frames-earlier-if-not-conn.patch
  9567. +++ /dev/null
  9568. @@ -1,27 +0,0 @@
  9569. -From: Johannes Berg <johannes.berg@intel.com>
  9570. -Date: Fri, 20 Mar 2015 16:24:22 +0100
  9571. -Subject: [PATCH] mac80211: drop 4-addr VLAN frames earlier if not
  9572. - connected
  9573. -
  9574. -If there's no station on the 4-addr VLAN interface, then frames
  9575. -cannot be transmitted. Drop such frames earlier, before setting
  9576. -up all the information for them.
  9577. -
  9578. -We should keep the old check though since that code might be used
  9579. -for other internally-generated frames.
  9580. -
  9581. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9582. ----
  9583. -
  9584. ---- a/net/mac80211/tx.c
  9585. -+++ b/net/mac80211/tx.c
  9586. -@@ -1920,6 +1920,9 @@ static struct sk_buff *ieee80211_build_h
  9587. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  9588. - wme_sta = sta->sta.wme;
  9589. - have_station = true;
  9590. -+ } else if (sdata->wdev.use_4addr) {
  9591. -+ ret = -ENOLINK;
  9592. -+ goto free;
  9593. - }
  9594. - ap_sdata = container_of(sdata->bss, struct ieee80211_sub_if_data,
  9595. - u.ap);
  9596. diff --git a/package/kernel/mac80211/patches/314-brcmfmac-add-debugfs-entry-for-msgbuf-statistics.patch b/package/kernel/mac80211/patches/314-brcmfmac-add-debugfs-entry-for-msgbuf-statistics.patch
  9597. new file mode 100644
  9598. index 0000000..9768ef2
  9599. --- /dev/null
  9600. +++ b/package/kernel/mac80211/patches/314-brcmfmac-add-debugfs-entry-for-msgbuf-statistics.patch
  9601. @@ -0,0 +1,87 @@
  9602. +From: Franky Lin <frankyl@broadcom.com>
  9603. +Date: Thu, 20 Aug 2015 22:06:04 +0200
  9604. +Subject: [PATCH] brcmfmac: add debugfs entry for msgbuf statistics
  9605. +
  9606. +Expose ring buffer read/write pointers and other useful statistics
  9607. +through debugfs.
  9608. +
  9609. +Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  9610. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  9611. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9612. +Signed-off-by: Franky Lin <frankyl@broadcom.com>
  9613. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9614. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9615. +---
  9616. +
  9617. +--- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  9618. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  9619. +@@ -1360,6 +1360,60 @@ void brcmf_msgbuf_delete_flowring(struct
  9620. + }
  9621. + }
  9622. +
  9623. ++#ifdef DEBUG
  9624. ++static int brcmf_msgbuf_stats_read(struct seq_file *seq, void *data)
  9625. ++{
  9626. ++ struct brcmf_bus *bus_if = dev_get_drvdata(seq->private);
  9627. ++ struct brcmf_pub *drvr = bus_if->drvr;
  9628. ++ struct brcmf_msgbuf *msgbuf = (struct brcmf_msgbuf *)drvr->proto->pd;
  9629. ++ struct brcmf_commonring *commonring;
  9630. ++ u16 i;
  9631. ++ struct brcmf_flowring_ring *ring;
  9632. ++ struct brcmf_flowring_hash *hash;
  9633. ++
  9634. ++ commonring = msgbuf->commonrings[BRCMF_H2D_MSGRING_CONTROL_SUBMIT];
  9635. ++ seq_printf(seq, "h2d_ctl_submit: rp %4u, wp %4u, depth %4u\n",
  9636. ++ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  9637. ++ commonring = msgbuf->commonrings[BRCMF_H2D_MSGRING_RXPOST_SUBMIT];
  9638. ++ seq_printf(seq, "h2d_rx_submit: rp %4u, wp %4u, depth %4u\n",
  9639. ++ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  9640. ++ commonring = msgbuf->commonrings[BRCMF_D2H_MSGRING_CONTROL_COMPLETE];
  9641. ++ seq_printf(seq, "d2h_ctl_cmplt: rp %4u, wp %4u, depth %4u\n",
  9642. ++ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  9643. ++ commonring = msgbuf->commonrings[BRCMF_D2H_MSGRING_TX_COMPLETE];
  9644. ++ seq_printf(seq, "d2h_tx_cmplt: rp %4u, wp %4u, depth %4u\n",
  9645. ++ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  9646. ++ commonring = msgbuf->commonrings[BRCMF_D2H_MSGRING_RX_COMPLETE];
  9647. ++ seq_printf(seq, "d2h_rx_cmplt: rp %4u, wp %4u, depth %4u\n",
  9648. ++ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  9649. ++
  9650. ++ seq_printf(seq, "\nh2d_flowrings: depth %u\n",
  9651. ++ BRCMF_H2D_TXFLOWRING_MAX_ITEM);
  9652. ++ seq_puts(seq, "Active flowrings:\n");
  9653. ++ hash = msgbuf->flow->hash;
  9654. ++ for (i = 0; i < msgbuf->flow->nrofrings; i++) {
  9655. ++ if (!msgbuf->flow->rings[i])
  9656. ++ continue;
  9657. ++ ring = msgbuf->flow->rings[i];
  9658. ++ if (ring->status != RING_OPEN)
  9659. ++ continue;
  9660. ++ commonring = msgbuf->flowrings[i];
  9661. ++ hash = &msgbuf->flow->hash[ring->hash_id];
  9662. ++ seq_printf(seq, "id %3u: rp %4u, wp %4u, qlen %4u, blocked %u\n"
  9663. ++ " ifidx %u, fifo %u, da %pM\n",
  9664. ++ i, commonring->r_ptr, commonring->w_ptr,
  9665. ++ skb_queue_len(&ring->skblist), ring->blocked,
  9666. ++ hash->ifidx, hash->fifo, hash->mac);
  9667. ++ }
  9668. ++
  9669. ++ return 0;
  9670. ++}
  9671. ++#else
  9672. ++static int brcmf_msgbuf_stats_read(struct seq_file *seq, void *data)
  9673. ++{
  9674. ++ return 0;
  9675. ++}
  9676. ++#endif
  9677. +
  9678. + int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr)
  9679. + {
  9680. +@@ -1460,6 +1514,8 @@ int brcmf_proto_msgbuf_attach(struct brc
  9681. + spin_lock_init(&msgbuf->flowring_work_lock);
  9682. + INIT_LIST_HEAD(&msgbuf->work_queue);
  9683. +
  9684. ++ brcmf_debugfs_add_entry(drvr, "msgbuf_stats", brcmf_msgbuf_stats_read);
  9685. ++
  9686. + return 0;
  9687. +
  9688. + fail:
  9689. 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
  9690. deleted file mode 100644
  9691. index 9105a64..0000000
  9692. --- a/package/kernel/mac80211/patches/314-mac80211-mesh-avoid-pointless-station-lookup.patch
  9693. +++ /dev/null
  9694. @@ -1,33 +0,0 @@
  9695. -From: Johannes Berg <johannes.berg@intel.com>
  9696. -Date: Fri, 20 Mar 2015 16:24:23 +0100
  9697. -Subject: [PATCH] mac80211: mesh: avoid pointless station lookup
  9698. -
  9699. -In ieee80211_build_hdr(), the station is looked up to build the
  9700. -header correctly (QoS field) and to check for authorization. For
  9701. -mesh, authorization isn't checked here, and QoS capability is
  9702. -mandatory, so the station lookup can be avoided.
  9703. -
  9704. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9705. ----
  9706. -
  9707. ---- a/net/mac80211/tx.c
  9708. -+++ b/net/mac80211/tx.c
  9709. -@@ -2130,12 +2130,14 @@ static struct sk_buff *ieee80211_build_h
  9710. - }
  9711. -
  9712. - /*
  9713. -- * There's no need to try to look up the destination
  9714. -- * if it is a multicast address (which can only happen
  9715. -- * in AP mode)
  9716. -+ * There's no need to try to look up the destination station
  9717. -+ * if it is a multicast address. In mesh, there's no need to
  9718. -+ * look up the station at all as it always must be QoS capable
  9719. -+ * and mesh mode checks authorization later.
  9720. - */
  9721. - multicast = is_multicast_ether_addr(hdr.addr1);
  9722. -- if (!multicast && !have_station) {
  9723. -+ if (!multicast && !have_station &&
  9724. -+ !ieee80211_vif_is_mesh(&sdata->vif)) {
  9725. - sta = sta_info_get(sdata, hdr.addr1);
  9726. - if (sta) {
  9727. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  9728. diff --git a/package/kernel/mac80211/patches/315-brcmfmac-make-use-of-cfg80211_check_combinations.patch b/package/kernel/mac80211/patches/315-brcmfmac-make-use-of-cfg80211_check_combinations.patch
  9729. new file mode 100644
  9730. index 0000000..281f02b
  9731. --- /dev/null
  9732. +++ b/package/kernel/mac80211/patches/315-brcmfmac-make-use-of-cfg80211_check_combinations.patch
  9733. @@ -0,0 +1,83 @@
  9734. +From: Arend van Spriel <arend@broadcom.com>
  9735. +Date: Thu, 20 Aug 2015 22:06:05 +0200
  9736. +Subject: [PATCH] brcmfmac: make use of cfg80211_check_combinations()
  9737. +
  9738. +Use cfg80211_check_combinations() so we can bail out early when an
  9739. +interface add or change results in an invalid combination.
  9740. +
  9741. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  9742. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  9743. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  9744. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  9745. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9746. +---
  9747. +
  9748. +--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  9749. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  9750. +@@ -469,6 +469,36 @@ brcmf_find_wpsie(const u8 *parse, u32 le
  9751. + return NULL;
  9752. + }
  9753. +
  9754. ++static int brcmf_vif_change_validate(struct brcmf_cfg80211_info *cfg,
  9755. ++ struct brcmf_cfg80211_vif *vif,
  9756. ++ enum nl80211_iftype new_type)
  9757. ++{
  9758. ++ int iftype_num[NUM_NL80211_IFTYPES];
  9759. ++ struct brcmf_cfg80211_vif *pos;
  9760. ++
  9761. ++ memset(&iftype_num[0], 0, sizeof(iftype_num));
  9762. ++ list_for_each_entry(pos, &cfg->vif_list, list)
  9763. ++ if (pos == vif)
  9764. ++ iftype_num[new_type]++;
  9765. ++ else
  9766. ++ iftype_num[pos->wdev.iftype]++;
  9767. ++
  9768. ++ return cfg80211_check_combinations(cfg->wiphy, 1, 0, iftype_num);
  9769. ++}
  9770. ++
  9771. ++static int brcmf_vif_add_validate(struct brcmf_cfg80211_info *cfg,
  9772. ++ enum nl80211_iftype new_type)
  9773. ++{
  9774. ++ int iftype_num[NUM_NL80211_IFTYPES];
  9775. ++ struct brcmf_cfg80211_vif *pos;
  9776. ++
  9777. ++ memset(&iftype_num[0], 0, sizeof(iftype_num));
  9778. ++ list_for_each_entry(pos, &cfg->vif_list, list)
  9779. ++ iftype_num[pos->wdev.iftype]++;
  9780. ++
  9781. ++ iftype_num[new_type]++;
  9782. ++ return cfg80211_check_combinations(cfg->wiphy, 1, 0, iftype_num);
  9783. ++}
  9784. +
  9785. + static void convert_key_from_CPU(struct brcmf_wsec_key *key,
  9786. + struct brcmf_wsec_key_le *key_le)
  9787. +@@ -663,8 +693,14 @@ static struct wireless_dev *brcmf_cfg802
  9788. + struct vif_params *params)
  9789. + {
  9790. + struct wireless_dev *wdev;
  9791. ++ int err;
  9792. +
  9793. + brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
  9794. ++ err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
  9795. ++ if (err) {
  9796. ++ brcmf_err("iface validation failed: err=%d\n", err);
  9797. ++ return ERR_PTR(err);
  9798. ++ }
  9799. + switch (type) {
  9800. + case NL80211_IFTYPE_ADHOC:
  9801. + case NL80211_IFTYPE_STATION:
  9802. +@@ -823,8 +859,12 @@ brcmf_cfg80211_change_iface(struct wiphy
  9803. + s32 ap = 0;
  9804. + s32 err = 0;
  9805. +
  9806. +- brcmf_dbg(TRACE, "Enter, ndev=%p, type=%d\n", ndev, type);
  9807. +-
  9808. ++ brcmf_dbg(TRACE, "Enter, idx=%d, type=%d\n", ifp->bssidx, type);
  9809. ++ err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type);
  9810. ++ if (err) {
  9811. ++ brcmf_err("iface validation failed: err=%d\n", err);
  9812. ++ return err;
  9813. ++ }
  9814. + switch (type) {
  9815. + case NL80211_IFTYPE_MONITOR:
  9816. + case NL80211_IFTYPE_WDS:
  9817. 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
  9818. deleted file mode 100644
  9819. index d143025..0000000
  9820. --- a/package/kernel/mac80211/patches/315-mac80211-avoid-duplicate-TX-path-station-lookup.patch
  9821. +++ /dev/null
  9822. @@ -1,267 +0,0 @@
  9823. -From: Johannes Berg <johannes.berg@intel.com>
  9824. -Date: Fri, 20 Mar 2015 14:18:27 +0100
  9825. -Subject: [PATCH] mac80211: avoid duplicate TX path station lookup
  9826. -
  9827. -Instead of looking up the destination station twice in the TX path
  9828. -(first to build the header, and then for control processing), save
  9829. -it when building the header and use it later in the TX path.
  9830. -
  9831. -To avoid having to look up the station in the many callers, allow
  9832. -those to pass %NULL which keeps the existing lookup.
  9833. -
  9834. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9835. ----
  9836. -
  9837. ---- a/net/mac80211/cfg.c
  9838. -+++ b/net/mac80211/cfg.c
  9839. -@@ -3565,7 +3565,7 @@ static int ieee80211_probe_client(struct
  9840. - nullfunc->qos_ctrl = cpu_to_le16(7);
  9841. -
  9842. - local_bh_disable();
  9843. -- ieee80211_xmit(sdata, skb);
  9844. -+ ieee80211_xmit(sdata, sta, skb);
  9845. - local_bh_enable();
  9846. - rcu_read_unlock();
  9847. -
  9848. ---- a/net/mac80211/ieee80211_i.h
  9849. -+++ b/net/mac80211/ieee80211_i.h
  9850. -@@ -1775,7 +1775,8 @@ void mac80211_ev_michael_mic_failure(str
  9851. - gfp_t gfp);
  9852. - void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata,
  9853. - bool bss_notify);
  9854. --void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb);
  9855. -+void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
  9856. -+ struct sta_info *sta, struct sk_buff *skb);
  9857. -
  9858. - void __ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata,
  9859. - struct sk_buff *skb, int tid,
  9860. ---- a/net/mac80211/sta_info.c
  9861. -+++ b/net/mac80211/sta_info.c
  9862. -@@ -1279,7 +1279,7 @@ static void ieee80211_send_null_response
  9863. - }
  9864. -
  9865. - info->band = chanctx_conf->def.chan->band;
  9866. -- ieee80211_xmit(sdata, skb);
  9867. -+ ieee80211_xmit(sdata, sta, skb);
  9868. - rcu_read_unlock();
  9869. - }
  9870. -
  9871. ---- a/net/mac80211/tx.c
  9872. -+++ b/net/mac80211/tx.c
  9873. -@@ -1110,11 +1110,13 @@ static bool ieee80211_tx_prep_agg(struct
  9874. -
  9875. - /*
  9876. - * initialises @tx
  9877. -+ * pass %NULL for the station if unknown, a valid pointer if known
  9878. -+ * or an ERR_PTR() if the station is known not to exist
  9879. - */
  9880. - static ieee80211_tx_result
  9881. - ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata,
  9882. - struct ieee80211_tx_data *tx,
  9883. -- struct sk_buff *skb)
  9884. -+ struct sta_info *sta, struct sk_buff *skb)
  9885. - {
  9886. - struct ieee80211_local *local = sdata->local;
  9887. - struct ieee80211_hdr *hdr;
  9888. -@@ -1137,17 +1139,22 @@ ieee80211_tx_prepare(struct ieee80211_su
  9889. -
  9890. - hdr = (struct ieee80211_hdr *) skb->data;
  9891. -
  9892. -- if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
  9893. -- tx->sta = rcu_dereference(sdata->u.vlan.sta);
  9894. -- if (!tx->sta && sdata->dev->ieee80211_ptr->use_4addr)
  9895. -- return TX_DROP;
  9896. -- } else if (info->flags & (IEEE80211_TX_CTL_INJECTED |
  9897. -- IEEE80211_TX_INTFL_NL80211_FRAME_TX) ||
  9898. -- tx->sdata->control_port_protocol == tx->skb->protocol) {
  9899. -- tx->sta = sta_info_get_bss(sdata, hdr->addr1);
  9900. -+ if (likely(sta)) {
  9901. -+ if (!IS_ERR(sta))
  9902. -+ tx->sta = sta;
  9903. -+ } else {
  9904. -+ if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
  9905. -+ tx->sta = rcu_dereference(sdata->u.vlan.sta);
  9906. -+ if (!tx->sta && sdata->wdev.use_4addr)
  9907. -+ return TX_DROP;
  9908. -+ } else if (info->flags & (IEEE80211_TX_INTFL_NL80211_FRAME_TX |
  9909. -+ IEEE80211_TX_CTL_INJECTED) ||
  9910. -+ tx->sdata->control_port_protocol == tx->skb->protocol) {
  9911. -+ tx->sta = sta_info_get_bss(sdata, hdr->addr1);
  9912. -+ }
  9913. -+ if (!tx->sta && !is_multicast_ether_addr(hdr->addr1))
  9914. -+ tx->sta = sta_info_get(sdata, hdr->addr1);
  9915. - }
  9916. -- if (!tx->sta && !is_multicast_ether_addr(hdr->addr1))
  9917. -- tx->sta = sta_info_get(sdata, hdr->addr1);
  9918. -
  9919. - if (tx->sta && ieee80211_is_data_qos(hdr->frame_control) &&
  9920. - !ieee80211_is_qos_nullfunc(hdr->frame_control) &&
  9921. -@@ -1485,7 +1492,7 @@ bool ieee80211_tx_prepare_skb(struct iee
  9922. - struct ieee80211_tx_data tx;
  9923. - struct sk_buff *skb2;
  9924. -
  9925. -- if (ieee80211_tx_prepare(sdata, &tx, skb) == TX_DROP)
  9926. -+ if (ieee80211_tx_prepare(sdata, &tx, NULL, skb) == TX_DROP)
  9927. - return false;
  9928. -
  9929. - info->band = band;
  9930. -@@ -1518,7 +1525,8 @@ EXPORT_SYMBOL(ieee80211_tx_prepare_skb);
  9931. - * Returns false if the frame couldn't be transmitted but was queued instead.
  9932. - */
  9933. - static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata,
  9934. -- struct sk_buff *skb, bool txpending)
  9935. -+ struct sta_info *sta, struct sk_buff *skb,
  9936. -+ bool txpending)
  9937. - {
  9938. - struct ieee80211_local *local = sdata->local;
  9939. - struct ieee80211_tx_data tx;
  9940. -@@ -1534,7 +1542,7 @@ static bool ieee80211_tx(struct ieee8021
  9941. -
  9942. - /* initialises tx */
  9943. - led_len = skb->len;
  9944. -- res_prepare = ieee80211_tx_prepare(sdata, &tx, skb);
  9945. -+ res_prepare = ieee80211_tx_prepare(sdata, &tx, sta, skb);
  9946. -
  9947. - if (unlikely(res_prepare == TX_DROP)) {
  9948. - ieee80211_free_txskb(&local->hw, skb);
  9949. -@@ -1590,7 +1598,8 @@ static int ieee80211_skb_resize(struct i
  9950. - return 0;
  9951. - }
  9952. -
  9953. --void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb)
  9954. -+void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
  9955. -+ struct sta_info *sta, struct sk_buff *skb)
  9956. - {
  9957. - struct ieee80211_local *local = sdata->local;
  9958. - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  9959. -@@ -1625,7 +1634,7 @@ void ieee80211_xmit(struct ieee80211_sub
  9960. - }
  9961. -
  9962. - ieee80211_set_qos_hdr(sdata, skb);
  9963. -- ieee80211_tx(sdata, skb, false);
  9964. -+ ieee80211_tx(sdata, sta, skb, false);
  9965. - }
  9966. -
  9967. - static bool ieee80211_parse_tx_radiotap(struct sk_buff *skb)
  9968. -@@ -1846,7 +1855,7 @@ netdev_tx_t ieee80211_monitor_start_xmit
  9969. - goto fail_rcu;
  9970. -
  9971. - info->band = chandef->chan->band;
  9972. -- ieee80211_xmit(sdata, skb);
  9973. -+ ieee80211_xmit(sdata, NULL, skb);
  9974. - rcu_read_unlock();
  9975. -
  9976. - return NETDEV_TX_OK;
  9977. -@@ -1877,7 +1886,8 @@ fail:
  9978. - * Returns: the (possibly reallocated) skb or an ERR_PTR() code
  9979. - */
  9980. - static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
  9981. -- struct sk_buff *skb, u32 info_flags)
  9982. -+ struct sk_buff *skb, u32 info_flags,
  9983. -+ struct sta_info **sta_out)
  9984. - {
  9985. - struct ieee80211_local *local = sdata->local;
  9986. - struct ieee80211_tx_info *info;
  9987. -@@ -1920,6 +1930,7 @@ static struct sk_buff *ieee80211_build_h
  9988. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  9989. - wme_sta = sta->sta.wme;
  9990. - have_station = true;
  9991. -+ *sta_out = sta;
  9992. - } else if (sdata->wdev.use_4addr) {
  9993. - ret = -ENOLINK;
  9994. - goto free;
  9995. -@@ -2073,6 +2084,7 @@ static struct sk_buff *ieee80211_build_h
  9996. - have_station = true;
  9997. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  9998. - wme_sta = sta->sta.wme;
  9999. -+ *sta_out = sta;
  10000. - } else if (sdata->u.mgd.use_4addr &&
  10001. - cpu_to_be16(ethertype) != sdata->control_port_protocol) {
  10002. - fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS |
  10003. -@@ -2136,13 +2148,18 @@ static struct sk_buff *ieee80211_build_h
  10004. - * and mesh mode checks authorization later.
  10005. - */
  10006. - multicast = is_multicast_ether_addr(hdr.addr1);
  10007. -- if (!multicast && !have_station &&
  10008. -- !ieee80211_vif_is_mesh(&sdata->vif)) {
  10009. -- sta = sta_info_get(sdata, hdr.addr1);
  10010. -+ if (multicast) {
  10011. -+ *sta_out = ERR_PTR(-ENOENT);
  10012. -+ } else if (!have_station && !ieee80211_vif_is_mesh(&sdata->vif)) {
  10013. -+ if (sdata->control_port_protocol == skb->protocol)
  10014. -+ sta = sta_info_get_bss(sdata, hdr.addr1);
  10015. -+ else
  10016. -+ sta = sta_info_get(sdata, hdr.addr1);
  10017. - if (sta) {
  10018. - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
  10019. - wme_sta = sta->sta.wme;
  10020. - }
  10021. -+ *sta_out = sta ?: ERR_PTR(-ENOENT);
  10022. - }
  10023. -
  10024. - /* For mesh, the use of the QoS header is mandatory */
  10025. -@@ -2320,6 +2337,7 @@ void __ieee80211_subif_start_xmit(struct
  10026. - u32 info_flags)
  10027. - {
  10028. - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  10029. -+ struct sta_info *sta = NULL;
  10030. -
  10031. - if (unlikely(skb->len < ETH_HLEN)) {
  10032. - kfree_skb(skb);
  10033. -@@ -2328,7 +2346,7 @@ void __ieee80211_subif_start_xmit(struct
  10034. -
  10035. - rcu_read_lock();
  10036. -
  10037. -- skb = ieee80211_build_hdr(sdata, skb, info_flags);
  10038. -+ skb = ieee80211_build_hdr(sdata, skb, info_flags, &sta);
  10039. - if (IS_ERR(skb))
  10040. - goto out;
  10041. -
  10042. -@@ -2336,7 +2354,7 @@ void __ieee80211_subif_start_xmit(struct
  10043. - dev->stats.tx_bytes += skb->len;
  10044. - dev->trans_start = jiffies;
  10045. -
  10046. -- ieee80211_xmit(sdata, skb);
  10047. -+ ieee80211_xmit(sdata, sta, skb);
  10048. - out:
  10049. - rcu_read_unlock();
  10050. - }
  10051. -@@ -2364,10 +2382,11 @@ ieee80211_build_data_template(struct iee
  10052. - .local = sdata->local,
  10053. - .sdata = sdata,
  10054. - };
  10055. -+ struct sta_info *sta_ignore;
  10056. -
  10057. - rcu_read_lock();
  10058. -
  10059. -- skb = ieee80211_build_hdr(sdata, skb, info_flags);
  10060. -+ skb = ieee80211_build_hdr(sdata, skb, info_flags, &sta_ignore);
  10061. - if (IS_ERR(skb))
  10062. - goto out;
  10063. -
  10064. -@@ -2425,7 +2444,7 @@ static bool ieee80211_tx_pending_skb(str
  10065. - return true;
  10066. - }
  10067. - info->band = chanctx_conf->def.chan->band;
  10068. -- result = ieee80211_tx(sdata, skb, true);
  10069. -+ result = ieee80211_tx(sdata, NULL, skb, true);
  10070. - } else {
  10071. - struct sk_buff_head skbs;
  10072. -
  10073. -@@ -3163,7 +3182,7 @@ ieee80211_get_buffered_bc(struct ieee802
  10074. -
  10075. - if (sdata->vif.type == NL80211_IFTYPE_AP)
  10076. - sdata = IEEE80211_DEV_TO_SUB_IF(skb->dev);
  10077. -- if (!ieee80211_tx_prepare(sdata, &tx, skb))
  10078. -+ if (!ieee80211_tx_prepare(sdata, &tx, NULL, skb))
  10079. - break;
  10080. - dev_kfree_skb_any(skb);
  10081. - }
  10082. -@@ -3295,6 +3314,6 @@ void __ieee80211_tx_skb_tid_band(struct
  10083. - */
  10084. - local_bh_disable();
  10085. - IEEE80211_SKB_CB(skb)->band = band;
  10086. -- ieee80211_xmit(sdata, skb);
  10087. -+ ieee80211_xmit(sdata, NULL, skb);
  10088. - local_bh_enable();
  10089. - }
  10090. diff --git a/package/kernel/mac80211/patches/316-brcmfmac-block-the-correct-flowring-when-backup-queu.patch b/package/kernel/mac80211/patches/316-brcmfmac-block-the-correct-flowring-when-backup-queu.patch
  10091. new file mode 100644
  10092. index 0000000..2d5f7b9
  10093. --- /dev/null
  10094. +++ b/package/kernel/mac80211/patches/316-brcmfmac-block-the-correct-flowring-when-backup-queu.patch
  10095. @@ -0,0 +1,48 @@
  10096. +From: Franky Lin <frankyl@broadcom.com>
  10097. +Date: Thu, 20 Aug 2015 22:06:06 +0200
  10098. +Subject: [PATCH] brcmfmac: block the correct flowring when backup queue
  10099. + overflow
  10100. +
  10101. +brcmf_flowring_block blocks the last active flowring under the same
  10102. +interface instead of the one provided by caller. This could lead to a
  10103. +dead lock of netif stop if there are more than one flowring under the
  10104. +interface and the traffic is high enough so brcmf_flowring_enqueue can
  10105. +not unblock the ring right away.
  10106. +
  10107. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10108. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  10109. +Signed-off-by: Franky Lin <frankyl@broadcom.com>
  10110. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10111. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10112. +---
  10113. +
  10114. +--- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  10115. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  10116. +@@ -194,11 +194,15 @@ static void brcmf_flowring_block(struct
  10117. + spin_lock_irqsave(&flow->block_lock, flags);
  10118. +
  10119. + ring = flow->rings[flowid];
  10120. ++ if (ring->blocked == blocked) {
  10121. ++ spin_unlock_irqrestore(&flow->block_lock, flags);
  10122. ++ return;
  10123. ++ }
  10124. + ifidx = brcmf_flowring_ifidx_get(flow, flowid);
  10125. +
  10126. + currently_blocked = false;
  10127. + for (i = 0; i < flow->nrofrings; i++) {
  10128. +- if (flow->rings[i]) {
  10129. ++ if ((flow->rings[i]) && (i != flowid)) {
  10130. + ring = flow->rings[i];
  10131. + if ((ring->status == RING_OPEN) &&
  10132. + (brcmf_flowring_ifidx_get(flow, i) == ifidx)) {
  10133. +@@ -209,8 +213,8 @@ static void brcmf_flowring_block(struct
  10134. + }
  10135. + }
  10136. + }
  10137. +- ring->blocked = blocked;
  10138. +- if (currently_blocked == blocked) {
  10139. ++ flow->rings[flowid]->blocked = blocked;
  10140. ++ if (currently_blocked) {
  10141. + spin_unlock_irqrestore(&flow->block_lock, flags);
  10142. + return;
  10143. + }
  10144. 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
  10145. deleted file mode 100644
  10146. index 77a82c2..0000000
  10147. --- a/package/kernel/mac80211/patches/316-mac80211-reduce-log-spam-from-ieee80211_handle_pwr_c.patch
  10148. +++ /dev/null
  10149. @@ -1,38 +0,0 @@
  10150. -From: John Linville <linville@tuxdriver.com>
  10151. -Date: Tue, 31 Mar 2015 10:49:14 -0400
  10152. -Subject: [PATCH] mac80211: reduce log spam from ieee80211_handle_pwr_constr
  10153. -
  10154. -This changes a couple of messages from sdata_info to sdata_dbg.
  10155. -This should reduce some log spam, as reported here:
  10156. -
  10157. - https://bugzilla.redhat.com/show_bug.cgi?id=1206468
  10158. -
  10159. -Signed-off-by: John W. Linville <linville@tuxdriver.com>
  10160. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  10161. ----
  10162. -
  10163. ---- a/net/mac80211/mlme.c
  10164. -+++ b/net/mac80211/mlme.c
  10165. -@@ -1347,15 +1347,15 @@ static u32 ieee80211_handle_pwr_constr(s
  10166. - */
  10167. - if (has_80211h_pwr &&
  10168. - (!has_cisco_pwr || pwr_level_80211h <= pwr_level_cisco)) {
  10169. -- sdata_info(sdata,
  10170. -- "Limiting TX power to %d (%d - %d) dBm as advertised by %pM\n",
  10171. -- pwr_level_80211h, chan_pwr, pwr_reduction_80211h,
  10172. -- sdata->u.mgd.bssid);
  10173. -+ sdata_dbg(sdata,
  10174. -+ "Limiting TX power to %d (%d - %d) dBm as advertised by %pM\n",
  10175. -+ pwr_level_80211h, chan_pwr, pwr_reduction_80211h,
  10176. -+ sdata->u.mgd.bssid);
  10177. - new_ap_level = pwr_level_80211h;
  10178. - } else { /* has_cisco_pwr is always true here. */
  10179. -- sdata_info(sdata,
  10180. -- "Limiting TX power to %d dBm as advertised by %pM\n",
  10181. -- pwr_level_cisco, sdata->u.mgd.bssid);
  10182. -+ sdata_dbg(sdata,
  10183. -+ "Limiting TX power to %d dBm as advertised by %pM\n",
  10184. -+ pwr_level_cisco, sdata->u.mgd.bssid);
  10185. - new_ap_level = pwr_level_cisco;
  10186. - }
  10187. -
  10188. 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
  10189. deleted file mode 100644
  10190. index e005fe7..0000000
  10191. --- a/package/kernel/mac80211/patches/317-brcmfmac-Fix-race-condition-in-msgbuf-ioctl-processi.patch
  10192. +++ /dev/null
  10193. @@ -1,35 +0,0 @@
  10194. -From: Hante Meuleman <meuleman@broadcom.com>
  10195. -Date: Fri, 6 Mar 2015 18:40:41 +0100
  10196. -Subject: [PATCH] brcmfmac: Fix race condition in msgbuf ioctl processing.
  10197. -
  10198. -Msgbuf is using a wait_event_timeout to wait for the response on
  10199. -an ioctl. The wakeup routine uses waitqueue_active to see if
  10200. -wait_event_timeout has been called. There is a chance that the
  10201. -response arrives before wait_event_timeout is called, this
  10202. -will result in situation that wait_event_timeout never gets
  10203. -woken again and assumed result will be a timeout. This patch
  10204. -removes that errornous situation by always setting the
  10205. -ctl_completed var before checking for queue active.
  10206. -
  10207. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  10208. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10209. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  10210. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10211. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10212. ----
  10213. -
  10214. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  10215. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  10216. -@@ -481,10 +481,9 @@ static int brcmf_msgbuf_ioctl_resp_wait(
  10217. -
  10218. - static void brcmf_msgbuf_ioctl_resp_wake(struct brcmf_msgbuf *msgbuf)
  10219. - {
  10220. -- if (waitqueue_active(&msgbuf->ioctl_resp_wait)) {
  10221. -- msgbuf->ctl_completed = true;
  10222. -+ msgbuf->ctl_completed = true;
  10223. -+ if (waitqueue_active(&msgbuf->ioctl_resp_wait))
  10224. - wake_up(&msgbuf->ioctl_resp_wait);
  10225. -- }
  10226. - }
  10227. -
  10228. -
  10229. diff --git a/package/kernel/mac80211/patches/317-brcmfmac-bump-highest-event-number-for-4339-firmware.patch b/package/kernel/mac80211/patches/317-brcmfmac-bump-highest-event-number-for-4339-firmware.patch
  10230. new file mode 100644
  10231. index 0000000..7378401
  10232. --- /dev/null
  10233. +++ b/package/kernel/mac80211/patches/317-brcmfmac-bump-highest-event-number-for-4339-firmware.patch
  10234. @@ -0,0 +1,52 @@
  10235. +From: Arend van Spriel <arend@broadcom.com>
  10236. +Date: Thu, 20 Aug 2015 22:06:07 +0200
  10237. +Subject: [PATCH] brcmfmac: bump highest event number for 4339 firmware
  10238. +
  10239. +The event mask length is determined by the highest event number
  10240. +that is specified in the driver. When this length is shorter than
  10241. +firmware expects setting event mask will fail and device becomes
  10242. +pretty useless. This issue was reported with bcm4339 firmware that
  10243. +was recently released.
  10244. +
  10245. +Reported-by: Pontus Fuchs <pontusf@broadcom.com>
  10246. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  10247. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  10248. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10249. +Reviewed-by: Pontus Fuchs <pontusf@broadcom.com>
  10250. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10251. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10252. +---
  10253. +
  10254. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  10255. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  10256. +@@ -85,7 +85,6 @@ struct brcmf_event;
  10257. + BRCMF_ENUM_DEF(IF, 54) \
  10258. + BRCMF_ENUM_DEF(P2P_DISC_LISTEN_COMPLETE, 55) \
  10259. + BRCMF_ENUM_DEF(RSSI, 56) \
  10260. +- BRCMF_ENUM_DEF(PFN_SCAN_COMPLETE, 57) \
  10261. + BRCMF_ENUM_DEF(EXTLOG_MSG, 58) \
  10262. + BRCMF_ENUM_DEF(ACTION_FRAME, 59) \
  10263. + BRCMF_ENUM_DEF(ACTION_FRAME_COMPLETE, 60) \
  10264. +@@ -103,8 +102,7 @@ struct brcmf_event;
  10265. + BRCMF_ENUM_DEF(FIFO_CREDIT_MAP, 74) \
  10266. + BRCMF_ENUM_DEF(ACTION_FRAME_RX, 75) \
  10267. + BRCMF_ENUM_DEF(TDLS_PEER_EVENT, 92) \
  10268. +- BRCMF_ENUM_DEF(BCMC_CREDIT_SUPPORT, 127) \
  10269. +- BRCMF_ENUM_DEF(PSTA_PRIMARY_INTF_IND, 128)
  10270. ++ BRCMF_ENUM_DEF(BCMC_CREDIT_SUPPORT, 127)
  10271. +
  10272. + #define BRCMF_ENUM_DEF(id, val) \
  10273. + BRCMF_E_##id = (val),
  10274. +@@ -112,7 +110,11 @@ struct brcmf_event;
  10275. + /* firmware event codes sent by the dongle */
  10276. + enum brcmf_fweh_event_code {
  10277. + BRCMF_FWEH_EVENT_ENUM_DEFLIST
  10278. +- BRCMF_E_LAST
  10279. ++ /* this determines event mask length which must match
  10280. ++ * minimum length check in device firmware so it is
  10281. ++ * hard-coded here.
  10282. ++ */
  10283. ++ BRCMF_E_LAST = 139
  10284. + };
  10285. + #undef BRCMF_ENUM_DEF
  10286. +
  10287. 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
  10288. deleted file mode 100644
  10289. index c2cd1c5..0000000
  10290. --- a/package/kernel/mac80211/patches/318-brcmfmac-Update-msgbuf-commonring-size-for-improved-.patch
  10291. +++ /dev/null
  10292. @@ -1,30 +0,0 @@
  10293. -From: Hante Meuleman <meuleman@broadcom.com>
  10294. -Date: Wed, 18 Mar 2015 13:25:23 +0100
  10295. -Subject: [PATCH] brcmfmac: Update msgbuf commonring size for improved
  10296. - throughput.
  10297. -
  10298. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  10299. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10300. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  10301. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10302. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10303. ----
  10304. -
  10305. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h
  10306. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h
  10307. -@@ -17,11 +17,11 @@
  10308. -
  10309. - #ifdef CPTCFG_BRCMFMAC_PROTO_MSGBUF
  10310. -
  10311. --#define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_MAX_ITEM 20
  10312. --#define BRCMF_H2D_MSGRING_RXPOST_SUBMIT_MAX_ITEM 256
  10313. --#define BRCMF_D2H_MSGRING_CONTROL_COMPLETE_MAX_ITEM 20
  10314. -+#define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_MAX_ITEM 64
  10315. -+#define BRCMF_H2D_MSGRING_RXPOST_SUBMIT_MAX_ITEM 512
  10316. -+#define BRCMF_D2H_MSGRING_CONTROL_COMPLETE_MAX_ITEM 64
  10317. - #define BRCMF_D2H_MSGRING_TX_COMPLETE_MAX_ITEM 1024
  10318. --#define BRCMF_D2H_MSGRING_RX_COMPLETE_MAX_ITEM 256
  10319. -+#define BRCMF_D2H_MSGRING_RX_COMPLETE_MAX_ITEM 512
  10320. - #define BRCMF_H2D_TXFLOWRING_MAX_ITEM 512
  10321. -
  10322. - #define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_ITEMSIZE 40
  10323. 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
  10324. deleted file mode 100644
  10325. index 6af69eb..0000000
  10326. --- a/package/kernel/mac80211/patches/319-ath9k_htc-add-new-WMI_REG_RMW_CMDID-command.patch
  10327. +++ /dev/null
  10328. @@ -1,307 +0,0 @@
  10329. -From: Oleksij Rempel <linux@rempel-privat.de>
  10330. -Date: Sun, 22 Mar 2015 19:29:46 +0100
  10331. -Subject: [PATCH] ath9k_htc: add new WMI_REG_RMW_CMDID command
  10332. -
  10333. -Since usb bus add extra delay on each request, a command
  10334. -with read + write requests is too expensive. We can dramtically
  10335. -reduce usb load by moving this command to firmware.
  10336. -
  10337. -In my tests, this patch will reduce channel scan time
  10338. -for about 5-10 seconds.
  10339. -
  10340. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  10341. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10342. ----
  10343. -
  10344. ---- a/drivers/net/wireless/ath/ath.h
  10345. -+++ b/drivers/net/wireless/ath/ath.h
  10346. -@@ -131,6 +131,9 @@ struct ath_ops {
  10347. - void (*enable_write_buffer)(void *);
  10348. - void (*write_flush) (void *);
  10349. - u32 (*rmw)(void *, u32 reg_offset, u32 set, u32 clr);
  10350. -+ void (*enable_rmw_buffer)(void *);
  10351. -+ void (*rmw_flush) (void *);
  10352. -+
  10353. - };
  10354. -
  10355. - struct ath_common;
  10356. ---- a/drivers/net/wireless/ath/ath9k/htc.h
  10357. -+++ b/drivers/net/wireless/ath/ath9k/htc.h
  10358. -@@ -444,6 +444,10 @@ static inline void ath9k_htc_stop_btcoex
  10359. - #define OP_BT_SCAN BIT(4)
  10360. - #define OP_TSF_RESET BIT(6)
  10361. -
  10362. -+enum htc_op_flags {
  10363. -+ HTC_FWFLAG_NO_RMW,
  10364. -+};
  10365. -+
  10366. - struct ath9k_htc_priv {
  10367. - struct device *dev;
  10368. - struct ieee80211_hw *hw;
  10369. -@@ -482,6 +486,7 @@ struct ath9k_htc_priv {
  10370. - bool reconfig_beacon;
  10371. - unsigned int rxfilter;
  10372. - unsigned long op_flags;
  10373. -+ unsigned long fw_flags;
  10374. -
  10375. - struct ath9k_hw_cal_data caldata;
  10376. - struct ath_spec_scan_priv spec_priv;
  10377. ---- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
  10378. -+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
  10379. -@@ -376,17 +376,139 @@ static void ath9k_regwrite_flush(void *h
  10380. - mutex_unlock(&priv->wmi->multi_write_mutex);
  10381. - }
  10382. -
  10383. --static u32 ath9k_reg_rmw(void *hw_priv, u32 reg_offset, u32 set, u32 clr)
  10384. -+static void ath9k_reg_rmw_buffer(void *hw_priv,
  10385. -+ u32 reg_offset, u32 set, u32 clr)
  10386. -+{
  10387. -+ struct ath_hw *ah = (struct ath_hw *) hw_priv;
  10388. -+ struct ath_common *common = ath9k_hw_common(ah);
  10389. -+ struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
  10390. -+ u32 rsp_status;
  10391. -+ int r;
  10392. -+
  10393. -+ mutex_lock(&priv->wmi->multi_rmw_mutex);
  10394. -+
  10395. -+ /* Store the register/value */
  10396. -+ priv->wmi->multi_rmw[priv->wmi->multi_rmw_idx].reg =
  10397. -+ cpu_to_be32(reg_offset);
  10398. -+ priv->wmi->multi_rmw[priv->wmi->multi_rmw_idx].set =
  10399. -+ cpu_to_be32(set);
  10400. -+ priv->wmi->multi_rmw[priv->wmi->multi_rmw_idx].clr =
  10401. -+ cpu_to_be32(clr);
  10402. -+
  10403. -+ priv->wmi->multi_rmw_idx++;
  10404. -+
  10405. -+ /* If the buffer is full, send it out. */
  10406. -+ if (priv->wmi->multi_rmw_idx == MAX_RMW_CMD_NUMBER) {
  10407. -+ r = ath9k_wmi_cmd(priv->wmi, WMI_REG_RMW_CMDID,
  10408. -+ (u8 *) &priv->wmi->multi_rmw,
  10409. -+ sizeof(struct register_write) * priv->wmi->multi_rmw_idx,
  10410. -+ (u8 *) &rsp_status, sizeof(rsp_status),
  10411. -+ 100);
  10412. -+ if (unlikely(r)) {
  10413. -+ ath_dbg(common, WMI,
  10414. -+ "REGISTER RMW FAILED, multi len: %d\n",
  10415. -+ priv->wmi->multi_rmw_idx);
  10416. -+ }
  10417. -+ priv->wmi->multi_rmw_idx = 0;
  10418. -+ }
  10419. -+
  10420. -+ mutex_unlock(&priv->wmi->multi_rmw_mutex);
  10421. -+}
  10422. -+
  10423. -+static void ath9k_reg_rmw_flush(void *hw_priv)
  10424. - {
  10425. -- u32 val;
  10426. -+ struct ath_hw *ah = (struct ath_hw *) hw_priv;
  10427. -+ struct ath_common *common = ath9k_hw_common(ah);
  10428. -+ struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
  10429. -+ u32 rsp_status;
  10430. -+ int r;
  10431. -+
  10432. -+ if (test_bit(HTC_FWFLAG_NO_RMW, &priv->fw_flags))
  10433. -+ return;
  10434. -+
  10435. -+ atomic_dec(&priv->wmi->m_rmw_cnt);
  10436. -+
  10437. -+ mutex_lock(&priv->wmi->multi_rmw_mutex);
  10438. -+
  10439. -+ if (priv->wmi->multi_rmw_idx) {
  10440. -+ r = ath9k_wmi_cmd(priv->wmi, WMI_REG_RMW_CMDID,
  10441. -+ (u8 *) &priv->wmi->multi_rmw,
  10442. -+ sizeof(struct register_rmw) * priv->wmi->multi_rmw_idx,
  10443. -+ (u8 *) &rsp_status, sizeof(rsp_status),
  10444. -+ 100);
  10445. -+ if (unlikely(r)) {
  10446. -+ ath_dbg(common, WMI,
  10447. -+ "REGISTER RMW FAILED, multi len: %d\n",
  10448. -+ priv->wmi->multi_rmw_idx);
  10449. -+ }
  10450. -+ priv->wmi->multi_rmw_idx = 0;
  10451. -+ }
  10452. -
  10453. -- val = ath9k_regread(hw_priv, reg_offset);
  10454. -- val &= ~clr;
  10455. -- val |= set;
  10456. -- ath9k_regwrite(hw_priv, val, reg_offset);
  10457. -+ mutex_unlock(&priv->wmi->multi_rmw_mutex);
  10458. -+}
  10459. -+
  10460. -+static void ath9k_enable_rmw_buffer(void *hw_priv)
  10461. -+{
  10462. -+ struct ath_hw *ah = (struct ath_hw *) hw_priv;
  10463. -+ struct ath_common *common = ath9k_hw_common(ah);
  10464. -+ struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
  10465. -+
  10466. -+ if (test_bit(HTC_FWFLAG_NO_RMW, &priv->fw_flags))
  10467. -+ return;
  10468. -+
  10469. -+ atomic_inc(&priv->wmi->m_rmw_cnt);
  10470. -+}
  10471. -+
  10472. -+static u32 ath9k_reg_rmw_single(void *hw_priv,
  10473. -+ u32 reg_offset, u32 set, u32 clr)
  10474. -+{
  10475. -+ struct ath_hw *ah = (struct ath_hw *) hw_priv;
  10476. -+ struct ath_common *common = ath9k_hw_common(ah);
  10477. -+ struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
  10478. -+ struct register_rmw buf, buf_ret;
  10479. -+ int ret;
  10480. -+ u32 val = 0;
  10481. -+
  10482. -+ buf.reg = cpu_to_be32(reg_offset);
  10483. -+ buf.set = cpu_to_be32(set);
  10484. -+ buf.clr = cpu_to_be32(clr);
  10485. -+
  10486. -+ ret = ath9k_wmi_cmd(priv->wmi, WMI_REG_RMW_CMDID,
  10487. -+ (u8 *) &buf, sizeof(buf),
  10488. -+ (u8 *) &buf_ret, sizeof(buf_ret),
  10489. -+ 100);
  10490. -+ if (unlikely(ret)) {
  10491. -+ ath_dbg(common, WMI, "REGISTER RMW FAILED:(0x%04x, %d)\n",
  10492. -+ reg_offset, ret);
  10493. -+ }
  10494. - return val;
  10495. - }
  10496. -
  10497. -+static u32 ath9k_reg_rmw(void *hw_priv, u32 reg_offset, u32 set, u32 clr)
  10498. -+{
  10499. -+ struct ath_hw *ah = (struct ath_hw *) hw_priv;
  10500. -+ struct ath_common *common = ath9k_hw_common(ah);
  10501. -+ struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
  10502. -+
  10503. -+ if (test_bit(HTC_FWFLAG_NO_RMW, &priv->fw_flags)) {
  10504. -+ u32 val;
  10505. -+
  10506. -+ val = REG_READ(ah, reg_offset);
  10507. -+ val &= ~clr;
  10508. -+ val |= set;
  10509. -+ REG_WRITE(ah, reg_offset, val);
  10510. -+
  10511. -+ return 0;
  10512. -+ }
  10513. -+
  10514. -+ if (atomic_read(&priv->wmi->m_rmw_cnt))
  10515. -+ ath9k_reg_rmw_buffer(hw_priv, reg_offset, set, clr);
  10516. -+ else
  10517. -+ ath9k_reg_rmw_single(hw_priv, reg_offset, set, clr);
  10518. -+
  10519. -+ return 0;
  10520. -+}
  10521. -+
  10522. - static void ath_usb_read_cachesize(struct ath_common *common, int *csz)
  10523. - {
  10524. - *csz = L1_CACHE_BYTES >> 2;
  10525. -@@ -501,6 +623,8 @@ static int ath9k_init_priv(struct ath9k_
  10526. - ah->reg_ops.write = ath9k_regwrite;
  10527. - ah->reg_ops.enable_write_buffer = ath9k_enable_regwrite_buffer;
  10528. - ah->reg_ops.write_flush = ath9k_regwrite_flush;
  10529. -+ ah->reg_ops.enable_rmw_buffer = ath9k_enable_rmw_buffer;
  10530. -+ ah->reg_ops.rmw_flush = ath9k_reg_rmw_flush;
  10531. - ah->reg_ops.rmw = ath9k_reg_rmw;
  10532. - priv->ah = ah;
  10533. -
  10534. -@@ -686,6 +810,12 @@ static int ath9k_init_firmware_version(s
  10535. - return -EINVAL;
  10536. - }
  10537. -
  10538. -+ if (priv->fw_version_major == 1 && priv->fw_version_minor < 4)
  10539. -+ set_bit(HTC_FWFLAG_NO_RMW, &priv->fw_flags);
  10540. -+
  10541. -+ dev_info(priv->dev, "FW RMW support: %s\n",
  10542. -+ test_bit(HTC_FWFLAG_NO_RMW, &priv->fw_flags) ? "Off" : "On");
  10543. -+
  10544. - return 0;
  10545. - }
  10546. -
  10547. ---- a/drivers/net/wireless/ath/ath9k/hw.h
  10548. -+++ b/drivers/net/wireless/ath/ath9k/hw.h
  10549. -@@ -100,6 +100,18 @@
  10550. - (_ah)->reg_ops.write_flush((_ah)); \
  10551. - } while (0)
  10552. -
  10553. -+#define ENABLE_REG_RMW_BUFFER(_ah) \
  10554. -+ do { \
  10555. -+ if ((_ah)->reg_ops.enable_rmw_buffer) \
  10556. -+ (_ah)->reg_ops.enable_rmw_buffer((_ah)); \
  10557. -+ } while (0)
  10558. -+
  10559. -+#define REG_RMW_BUFFER_FLUSH(_ah) \
  10560. -+ do { \
  10561. -+ if ((_ah)->reg_ops.rmw_flush) \
  10562. -+ (_ah)->reg_ops.rmw_flush((_ah)); \
  10563. -+ } while (0)
  10564. -+
  10565. - #define PR_EEP(_s, _val) \
  10566. - do { \
  10567. - len += scnprintf(buf + len, size - len, "%20s : %10d\n",\
  10568. ---- a/drivers/net/wireless/ath/ath9k/wmi.c
  10569. -+++ b/drivers/net/wireless/ath/ath9k/wmi.c
  10570. -@@ -61,6 +61,8 @@ static const char *wmi_cmd_to_name(enum
  10571. - return "WMI_REG_READ_CMDID";
  10572. - case WMI_REG_WRITE_CMDID:
  10573. - return "WMI_REG_WRITE_CMDID";
  10574. -+ case WMI_REG_RMW_CMDID:
  10575. -+ return "WMI_REG_RMW_CMDID";
  10576. - case WMI_RC_STATE_CHANGE_CMDID:
  10577. - return "WMI_RC_STATE_CHANGE_CMDID";
  10578. - case WMI_RC_RATE_UPDATE_CMDID:
  10579. -@@ -101,6 +103,7 @@ struct wmi *ath9k_init_wmi(struct ath9k_
  10580. - spin_lock_init(&wmi->event_lock);
  10581. - mutex_init(&wmi->op_mutex);
  10582. - mutex_init(&wmi->multi_write_mutex);
  10583. -+ mutex_init(&wmi->multi_rmw_mutex);
  10584. - init_completion(&wmi->cmd_wait);
  10585. - INIT_LIST_HEAD(&wmi->pending_tx_events);
  10586. - tasklet_init(&wmi->wmi_event_tasklet, ath9k_wmi_event_tasklet,
  10587. ---- a/drivers/net/wireless/ath/ath9k/wmi.h
  10588. -+++ b/drivers/net/wireless/ath/ath9k/wmi.h
  10589. -@@ -112,6 +112,7 @@ enum wmi_cmd_id {
  10590. - WMI_TX_STATS_CMDID,
  10591. - WMI_RX_STATS_CMDID,
  10592. - WMI_BITRATE_MASK_CMDID,
  10593. -+ WMI_REG_RMW_CMDID,
  10594. - };
  10595. -
  10596. - enum wmi_event_id {
  10597. -@@ -125,12 +126,19 @@ enum wmi_event_id {
  10598. - };
  10599. -
  10600. - #define MAX_CMD_NUMBER 62
  10601. -+#define MAX_RMW_CMD_NUMBER 15
  10602. -
  10603. - struct register_write {
  10604. - __be32 reg;
  10605. - __be32 val;
  10606. - };
  10607. -
  10608. -+struct register_rmw {
  10609. -+ __be32 reg;
  10610. -+ __be32 set;
  10611. -+ __be32 clr;
  10612. -+} __packed;
  10613. -+
  10614. - struct ath9k_htc_tx_event {
  10615. - int count;
  10616. - struct __wmi_event_txstatus txs;
  10617. -@@ -156,10 +164,18 @@ struct wmi {
  10618. -
  10619. - spinlock_t wmi_lock;
  10620. -
  10621. -+ /* multi write section */
  10622. - atomic_t mwrite_cnt;
  10623. - struct register_write multi_write[MAX_CMD_NUMBER];
  10624. - u32 multi_write_idx;
  10625. - struct mutex multi_write_mutex;
  10626. -+
  10627. -+ /* multi rmw section */
  10628. -+ atomic_t m_rmw_cnt;
  10629. -+ struct register_rmw multi_rmw[MAX_RMW_CMD_NUMBER];
  10630. -+ u32 multi_rmw_idx;
  10631. -+ struct mutex multi_rmw_mutex;
  10632. -+
  10633. - };
  10634. -
  10635. - struct wmi *ath9k_init_wmi(struct ath9k_htc_priv *priv);
  10636. diff --git a/package/kernel/mac80211/patches/319-brcmfmac-consolidate-ifp-lookup-in-driver-core.patch b/package/kernel/mac80211/patches/319-brcmfmac-consolidate-ifp-lookup-in-driver-core.patch
  10637. new file mode 100644
  10638. index 0000000..97444b3
  10639. --- /dev/null
  10640. +++ b/package/kernel/mac80211/patches/319-brcmfmac-consolidate-ifp-lookup-in-driver-core.patch
  10641. @@ -0,0 +1,138 @@
  10642. +From: Arend van Spriel <arend@broadcom.com>
  10643. +Date: Wed, 26 Aug 2015 22:14:53 +0200
  10644. +Subject: [PATCH] brcmfmac: consolidate ifp lookup in driver core
  10645. +
  10646. +In rx path the firmware provide an interface index which is used to
  10647. +map to a struct brcmf_if instance. However, this involves some trick
  10648. +that is done in two places. This is changed by having driver core
  10649. +providing brcmf_get_ifp() function.
  10650. +
  10651. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  10652. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  10653. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10654. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10655. +---
  10656. +
  10657. +--- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  10658. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  10659. +@@ -276,6 +276,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  10660. + struct sk_buff *pktbuf)
  10661. + {
  10662. + struct brcmf_proto_bcdc_header *h;
  10663. ++ struct brcmf_if *ifp;
  10664. +
  10665. + brcmf_dbg(BCDC, "Enter\n");
  10666. +
  10667. +@@ -289,30 +290,21 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  10668. + trace_brcmf_bcdchdr(pktbuf->data);
  10669. + h = (struct brcmf_proto_bcdc_header *)(pktbuf->data);
  10670. +
  10671. +- *ifidx = BCDC_GET_IF_IDX(h);
  10672. +- if (*ifidx >= BRCMF_MAX_IFS) {
  10673. +- brcmf_err("rx data ifnum out of range (%d)\n", *ifidx);
  10674. ++ ifp = brcmf_get_ifp(drvr, BCDC_GET_IF_IDX(h));
  10675. ++ if (IS_ERR_OR_NULL(ifp)) {
  10676. ++ brcmf_dbg(INFO, "no matching ifp found\n");
  10677. + return -EBADE;
  10678. + }
  10679. +- /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  10680. +- * events this is easy because it contains the bssidx which maps
  10681. +- * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  10682. +- * bssidx 1 is used for p2p0 and no data can be received or
  10683. +- * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  10684. +- */
  10685. +- if (*ifidx)
  10686. +- (*ifidx)++;
  10687. +-
  10688. + if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) !=
  10689. + BCDC_PROTO_VER) {
  10690. + brcmf_err("%s: non-BCDC packet received, flags 0x%x\n",
  10691. +- brcmf_ifname(drvr, *ifidx), h->flags);
  10692. ++ brcmf_ifname(drvr, ifp->ifidx), h->flags);
  10693. + return -EBADE;
  10694. + }
  10695. +
  10696. + if (h->flags & BCDC_FLAG_SUM_GOOD) {
  10697. + brcmf_dbg(BCDC, "%s: BDC rcv, good checksum, flags 0x%x\n",
  10698. +- brcmf_ifname(drvr, *ifidx), h->flags);
  10699. ++ brcmf_ifname(drvr, ifp->ifidx), h->flags);
  10700. + pktbuf->ip_summed = CHECKSUM_UNNECESSARY;
  10701. + }
  10702. +
  10703. +@@ -320,12 +312,15 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  10704. +
  10705. + skb_pull(pktbuf, BCDC_HEADER_LEN);
  10706. + if (do_fws)
  10707. +- brcmf_fws_hdrpull(drvr, *ifidx, h->data_offset << 2, pktbuf);
  10708. ++ brcmf_fws_hdrpull(drvr, ifp->ifidx, h->data_offset << 2,
  10709. ++ pktbuf);
  10710. + else
  10711. + skb_pull(pktbuf, h->data_offset << 2);
  10712. +
  10713. + if (pktbuf->len == 0)
  10714. + return -ENODATA;
  10715. ++
  10716. ++ *ifidx = ifp->ifidx;
  10717. + return 0;
  10718. + }
  10719. +
  10720. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  10721. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  10722. +@@ -83,6 +83,25 @@ char *brcmf_ifname(struct brcmf_pub *drv
  10723. + return "<if_none>";
  10724. + }
  10725. +
  10726. ++struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx)
  10727. ++{
  10728. ++ if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  10729. ++ brcmf_err("ifidx %d out of range\n", ifidx);
  10730. ++ return ERR_PTR(-ERANGE);
  10731. ++ }
  10732. ++
  10733. ++ /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  10734. ++ * events this is easy because it contains the bssidx which maps
  10735. ++ * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  10736. ++ * bssidx 1 is used for p2p0 and no data can be received or
  10737. ++ * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  10738. ++ */
  10739. ++ if (ifidx)
  10740. ++ ifidx++;
  10741. ++
  10742. ++ return drvr->iflist[ifidx];
  10743. ++}
  10744. ++
  10745. + static void _brcmf_set_multicast_list(struct work_struct *work)
  10746. + {
  10747. + struct brcmf_if *ifp;
  10748. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  10749. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  10750. +@@ -202,7 +202,7 @@ int brcmf_netdev_wait_pend8021x(struct b
  10751. +
  10752. + /* Return pointer to interface name */
  10753. + char *brcmf_ifname(struct brcmf_pub *drvr, int idx);
  10754. +-
  10755. ++struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  10756. + int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  10757. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  10758. + char *name, u8 *mac_addr);
  10759. +--- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  10760. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  10761. +@@ -1081,16 +1081,8 @@ brcmf_msgbuf_rx_skb(struct brcmf_msgbuf
  10762. + {
  10763. + struct brcmf_if *ifp;
  10764. +
  10765. +- /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  10766. +- * events this is easy because it contains the bssidx which maps
  10767. +- * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  10768. +- * bssidx 1 is used for p2p0 and no data can be received or
  10769. +- * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  10770. +- */
  10771. +- if (ifidx)
  10772. +- (ifidx)++;
  10773. +- ifp = msgbuf->drvr->iflist[ifidx];
  10774. +- if (!ifp || !ifp->ndev) {
  10775. ++ ifp = brcmf_get_ifp(msgbuf->drvr, ifidx);
  10776. ++ if (IS_ERR_OR_NULL(ifp) || !ifp->ndev) {
  10777. + brcmf_err("Received pkt for invalid ifidx %d\n", ifidx);
  10778. + brcmu_pkt_buf_free_skb(skb);
  10779. + return;
  10780. 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
  10781. deleted file mode 100644
  10782. index c4dd1af..0000000
  10783. --- a/package/kernel/mac80211/patches/320-ath9k-ar9271_hw_pa_cal-use-defs-instead-of-magin-num.patch
  10784. +++ /dev/null
  10785. @@ -1,89 +0,0 @@
  10786. -From: Oleksij Rempel <linux@rempel-privat.de>
  10787. -Date: Sun, 22 Mar 2015 19:29:47 +0100
  10788. -Subject: [PATCH] ath9k: ar9271_hw_pa_cal - use defs instead of magin
  10789. - numbers
  10790. -
  10791. -This function uses mixed styles for register names/numbers which
  10792. -is make harder reading and optimisation.
  10793. -
  10794. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  10795. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  10796. ----
  10797. -
  10798. ---- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  10799. -+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  10800. -@@ -430,22 +430,22 @@ static void ar9271_hw_pa_cal(struct ath_
  10801. - u32 regVal;
  10802. - unsigned int i;
  10803. - u32 regList[][2] = {
  10804. -- { 0x786c, 0 },
  10805. -- { 0x7854, 0 },
  10806. -- { 0x7820, 0 },
  10807. -- { 0x7824, 0 },
  10808. -- { 0x7868, 0 },
  10809. -- { 0x783c, 0 },
  10810. -- { 0x7838, 0 } ,
  10811. -- { 0x7828, 0 } ,
  10812. -+ { AR9285_AN_TOP3, 0 },
  10813. -+ { AR9285_AN_RXTXBB1, 0 },
  10814. -+ { AR9285_AN_RF2G1, 0 },
  10815. -+ { AR9285_AN_RF2G2, 0 },
  10816. -+ { AR9285_AN_TOP2, 0 },
  10817. -+ { AR9285_AN_RF2G8, 0 },
  10818. -+ { AR9285_AN_RF2G7, 0 } ,
  10819. -+ { AR9285_AN_RF2G3, 0 } ,
  10820. - };
  10821. -
  10822. - for (i = 0; i < ARRAY_SIZE(regList); i++)
  10823. - regList[i][1] = REG_READ(ah, regList[i][0]);
  10824. -
  10825. -- regVal = REG_READ(ah, 0x7834);
  10826. -+ regVal = REG_READ(ah, AR9285_AN_RF2G6);
  10827. - regVal &= (~(0x1));
  10828. -- REG_WRITE(ah, 0x7834, regVal);
  10829. -+ REG_WRITE(ah, AR9285_AN_RF2G6, regVal);
  10830. - regVal = REG_READ(ah, 0x9808);
  10831. - regVal |= (0x1 << 27);
  10832. - REG_WRITE(ah, 0x9808, regVal);
  10833. -@@ -477,7 +477,7 @@ static void ar9271_hw_pa_cal(struct ath_
  10834. - * does not matter since we turn it off
  10835. - */
  10836. - REG_RMW_FIELD(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PADRVGN2TAB0, 0);
  10837. --
  10838. -+ /* 7828, b0-11, ccom=fff */
  10839. - REG_RMW_FIELD(ah, AR9285_AN_RF2G3, AR9271_AN_RF2G3_CCOMP, 0xfff);
  10840. -
  10841. - /* Set:
  10842. -@@ -490,15 +490,16 @@ static void ar9271_hw_pa_cal(struct ath_
  10843. -
  10844. - /* find off_6_1; */
  10845. - for (i = 6; i > 0; i--) {
  10846. -- regVal = REG_READ(ah, 0x7834);
  10847. -+ regVal = REG_READ(ah, AR9285_AN_RF2G6);
  10848. - regVal |= (1 << (20 + i));
  10849. -- REG_WRITE(ah, 0x7834, regVal);
  10850. -+ REG_WRITE(ah, AR9285_AN_RF2G6, regVal);
  10851. - udelay(1);
  10852. - /* regVal = REG_READ(ah, 0x7834); */
  10853. - regVal &= (~(0x1 << (20 + i)));
  10854. -- regVal |= (MS(REG_READ(ah, 0x7840), AR9285_AN_RXTXBB1_SPARE9)
  10855. -+ regVal |= (MS(REG_READ(ah, AR9285_AN_RF2G9),
  10856. -+ AR9285_AN_RXTXBB1_SPARE9)
  10857. - << (20 + i));
  10858. -- REG_WRITE(ah, 0x7834, regVal);
  10859. -+ REG_WRITE(ah, AR9285_AN_RF2G6, regVal);
  10860. - }
  10861. -
  10862. - regVal = (regVal >> 20) & 0x7f;
  10863. -@@ -517,9 +518,9 @@ static void ar9271_hw_pa_cal(struct ath_
  10864. -
  10865. - ENABLE_REGWRITE_BUFFER(ah);
  10866. -
  10867. -- regVal = REG_READ(ah, 0x7834);
  10868. -+ regVal = REG_READ(ah, AR_AN_RF2G1_CH1);
  10869. - regVal |= 0x1;
  10870. -- REG_WRITE(ah, 0x7834, regVal);
  10871. -+ REG_WRITE(ah, AR_AN_RF2G1_CH1, regVal);
  10872. - regVal = REG_READ(ah, 0x9808);
  10873. - regVal &= (~(0x1 << 27));
  10874. - REG_WRITE(ah, 0x9808, regVal);
  10875. diff --git a/package/kernel/mac80211/patches/320-brcmfmac-make-brcmf_proto_hdrpull-return-struct-brcm.patch b/package/kernel/mac80211/patches/320-brcmfmac-make-brcmf_proto_hdrpull-return-struct-brcm.patch
  10876. new file mode 100644
  10877. index 0000000..632714c
  10878. --- /dev/null
  10879. +++ b/package/kernel/mac80211/patches/320-brcmfmac-make-brcmf_proto_hdrpull-return-struct-brcm.patch
  10880. @@ -0,0 +1,222 @@
  10881. +From: Arend van Spriel <arend@broadcom.com>
  10882. +Date: Wed, 26 Aug 2015 22:14:54 +0200
  10883. +Subject: [PATCH] brcmfmac: make brcmf_proto_hdrpull() return struct
  10884. + brcmf_if instance
  10885. +
  10886. +Avoid spreading the ifidx in the driver, but have it return the
  10887. +struct brcmf_if instance.
  10888. +
  10889. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  10890. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  10891. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  10892. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  10893. +---
  10894. +
  10895. +--- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  10896. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  10897. +@@ -272,11 +272,11 @@ brcmf_proto_bcdc_hdrpush(struct brcmf_pu
  10898. + }
  10899. +
  10900. + static int
  10901. +-brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool do_fws, u8 *ifidx,
  10902. +- struct sk_buff *pktbuf)
  10903. ++brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool do_fws,
  10904. ++ struct sk_buff *pktbuf, struct brcmf_if **ifp)
  10905. + {
  10906. + struct brcmf_proto_bcdc_header *h;
  10907. +- struct brcmf_if *ifp;
  10908. ++ struct brcmf_if *tmp_if;
  10909. +
  10910. + brcmf_dbg(BCDC, "Enter\n");
  10911. +
  10912. +@@ -290,21 +290,21 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  10913. + trace_brcmf_bcdchdr(pktbuf->data);
  10914. + h = (struct brcmf_proto_bcdc_header *)(pktbuf->data);
  10915. +
  10916. +- ifp = brcmf_get_ifp(drvr, BCDC_GET_IF_IDX(h));
  10917. +- if (IS_ERR_OR_NULL(ifp)) {
  10918. ++ tmp_if = brcmf_get_ifp(drvr, BCDC_GET_IF_IDX(h));
  10919. ++ if (!tmp_if) {
  10920. + brcmf_dbg(INFO, "no matching ifp found\n");
  10921. + return -EBADE;
  10922. + }
  10923. + if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) !=
  10924. + BCDC_PROTO_VER) {
  10925. + brcmf_err("%s: non-BCDC packet received, flags 0x%x\n",
  10926. +- brcmf_ifname(drvr, ifp->ifidx), h->flags);
  10927. ++ brcmf_ifname(drvr, tmp_if->ifidx), h->flags);
  10928. + return -EBADE;
  10929. + }
  10930. +
  10931. + if (h->flags & BCDC_FLAG_SUM_GOOD) {
  10932. + brcmf_dbg(BCDC, "%s: BDC rcv, good checksum, flags 0x%x\n",
  10933. +- brcmf_ifname(drvr, ifp->ifidx), h->flags);
  10934. ++ brcmf_ifname(drvr, tmp_if->ifidx), h->flags);
  10935. + pktbuf->ip_summed = CHECKSUM_UNNECESSARY;
  10936. + }
  10937. +
  10938. +@@ -312,7 +312,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  10939. +
  10940. + skb_pull(pktbuf, BCDC_HEADER_LEN);
  10941. + if (do_fws)
  10942. +- brcmf_fws_hdrpull(drvr, ifp->ifidx, h->data_offset << 2,
  10943. ++ brcmf_fws_hdrpull(drvr, tmp_if->ifidx, h->data_offset << 2,
  10944. + pktbuf);
  10945. + else
  10946. + skb_pull(pktbuf, h->data_offset << 2);
  10947. +@@ -320,7 +320,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  10948. + if (pktbuf->len == 0)
  10949. + return -ENODATA;
  10950. +
  10951. +- *ifidx = ifp->ifidx;
  10952. ++ *ifp = tmp_if;
  10953. + return 0;
  10954. + }
  10955. +
  10956. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  10957. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  10958. +@@ -87,7 +87,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
  10959. + {
  10960. + if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  10961. + brcmf_err("ifidx %d out of range\n", ifidx);
  10962. +- return ERR_PTR(-ERANGE);
  10963. ++ return NULL;
  10964. + }
  10965. +
  10966. + /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  10967. +@@ -539,17 +539,15 @@ void brcmf_rx_frame(struct device *dev,
  10968. + struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  10969. + struct brcmf_pub *drvr = bus_if->drvr;
  10970. + struct brcmf_skb_reorder_data *rd;
  10971. +- u8 ifidx;
  10972. + int ret;
  10973. +
  10974. + brcmf_dbg(DATA, "Enter: %s: rxp=%p\n", dev_name(dev), skb);
  10975. +
  10976. + /* process and remove protocol-specific header */
  10977. +- ret = brcmf_proto_hdrpull(drvr, true, &ifidx, skb);
  10978. +- ifp = drvr->iflist[ifidx];
  10979. ++ ret = brcmf_proto_hdrpull(drvr, true, skb, &ifp);
  10980. +
  10981. + if (ret || !ifp || !ifp->ndev) {
  10982. +- if ((ret != -ENODATA) && ifp)
  10983. ++ if (ret != -ENODATA && ifp)
  10984. + ifp->stats.rx_errors++;
  10985. + brcmu_pkt_buf_free_skb(skb);
  10986. + return;
  10987. +@@ -592,17 +590,17 @@ void brcmf_txcomplete(struct device *dev
  10988. + {
  10989. + struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  10990. + struct brcmf_pub *drvr = bus_if->drvr;
  10991. +- u8 ifidx;
  10992. ++ struct brcmf_if *ifp;
  10993. +
  10994. + /* await txstatus signal for firmware if active */
  10995. + if (brcmf_fws_fc_active(drvr->fws)) {
  10996. + if (!success)
  10997. + brcmf_fws_bustxfail(drvr->fws, txp);
  10998. + } else {
  10999. +- if (brcmf_proto_hdrpull(drvr, false, &ifidx, txp))
  11000. ++ if (brcmf_proto_hdrpull(drvr, false, txp, &ifp))
  11001. + brcmu_pkt_buf_free_skb(txp);
  11002. + else
  11003. +- brcmf_txfinalize(drvr, txp, ifidx, success);
  11004. ++ brcmf_txfinalize(drvr, txp, ifp->ifidx, success);
  11005. + }
  11006. + }
  11007. +
  11008. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  11009. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  11010. +@@ -1448,7 +1448,7 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  11011. + struct sk_buff *skb;
  11012. + struct brcmf_skbuff_cb *skcb;
  11013. + struct brcmf_fws_mac_descriptor *entry = NULL;
  11014. +- u8 ifidx;
  11015. ++ struct brcmf_if *ifp;
  11016. +
  11017. + brcmf_dbg(DATA, "flags %d\n", flags);
  11018. +
  11019. +@@ -1497,15 +1497,16 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  11020. + }
  11021. + brcmf_fws_macdesc_return_req_credit(skb);
  11022. +
  11023. +- if (brcmf_proto_hdrpull(fws->drvr, false, &ifidx, skb)) {
  11024. ++ ret = brcmf_proto_hdrpull(fws->drvr, false, skb, &ifp);
  11025. ++ if (ret) {
  11026. + brcmu_pkt_buf_free_skb(skb);
  11027. + return -EINVAL;
  11028. + }
  11029. + if (!remove_from_hanger)
  11030. +- ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifidx,
  11031. ++ ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
  11032. + genbit, seq);
  11033. + if (remove_from_hanger || ret)
  11034. +- brcmf_txfinalize(fws->drvr, skb, ifidx, true);
  11035. ++ brcmf_txfinalize(fws->drvr, skb, ifp->ifidx, true);
  11036. +
  11037. + return 0;
  11038. + }
  11039. +@@ -1848,7 +1849,7 @@ static int brcmf_fws_commit_skb(struct b
  11040. + entry->transit_count--;
  11041. + if (entry->suppressed)
  11042. + entry->suppr_transit_count--;
  11043. +- brcmf_proto_hdrpull(fws->drvr, false, &ifidx, skb);
  11044. ++ (void)brcmf_proto_hdrpull(fws->drvr, false, skb, NULL);
  11045. + goto rollback;
  11046. + }
  11047. +
  11048. +--- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  11049. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  11050. +@@ -522,7 +522,7 @@ static int brcmf_msgbuf_set_dcmd(struct
  11051. +
  11052. +
  11053. + static int brcmf_msgbuf_hdrpull(struct brcmf_pub *drvr, bool do_fws,
  11054. +- u8 *ifidx, struct sk_buff *skb)
  11055. ++ struct sk_buff *skb, struct brcmf_if **ifp)
  11056. + {
  11057. + return -ENODEV;
  11058. + }
  11059. +@@ -1082,7 +1082,7 @@ brcmf_msgbuf_rx_skb(struct brcmf_msgbuf
  11060. + struct brcmf_if *ifp;
  11061. +
  11062. + ifp = brcmf_get_ifp(msgbuf->drvr, ifidx);
  11063. +- if (IS_ERR_OR_NULL(ifp) || !ifp->ndev) {
  11064. ++ if (!ifp || !ifp->ndev) {
  11065. + brcmf_err("Received pkt for invalid ifidx %d\n", ifidx);
  11066. + brcmu_pkt_buf_free_skb(skb);
  11067. + return;
  11068. +--- a/drivers/net/wireless/brcm80211/brcmfmac/proto.h
  11069. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/proto.h
  11070. +@@ -24,8 +24,8 @@ enum proto_addr_mode {
  11071. +
  11072. +
  11073. + struct brcmf_proto {
  11074. +- int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws, u8 *ifidx,
  11075. +- struct sk_buff *skb);
  11076. ++ int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws,
  11077. ++ struct sk_buff *skb, struct brcmf_if **ifp);
  11078. + int (*query_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd,
  11079. + void *buf, uint len);
  11080. + int (*set_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd, void *buf,
  11081. +@@ -46,9 +46,19 @@ int brcmf_proto_attach(struct brcmf_pub
  11082. + void brcmf_proto_detach(struct brcmf_pub *drvr);
  11083. +
  11084. + static inline int brcmf_proto_hdrpull(struct brcmf_pub *drvr, bool do_fws,
  11085. +- u8 *ifidx, struct sk_buff *skb)
  11086. ++ struct sk_buff *skb,
  11087. ++ struct brcmf_if **ifp)
  11088. + {
  11089. +- return drvr->proto->hdrpull(drvr, do_fws, ifidx, skb);
  11090. ++ struct brcmf_if *tmp = NULL;
  11091. ++
  11092. ++ /* assure protocol is always called with
  11093. ++ * non-null initialized pointer.
  11094. ++ */
  11095. ++ if (ifp)
  11096. ++ *ifp = NULL;
  11097. ++ else
  11098. ++ ifp = &tmp;
  11099. ++ return drvr->proto->hdrpull(drvr, do_fws, skb, ifp);
  11100. + }
  11101. + static inline int brcmf_proto_query_dcmd(struct brcmf_pub *drvr, int ifidx,
  11102. + uint cmd, void *buf, uint len)
  11103. 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
  11104. deleted file mode 100644
  11105. index f05287d..0000000
  11106. --- a/package/kernel/mac80211/patches/321-ath9k-ar9271_hw_pa_cal-use-proper-makroses.patch
  11107. +++ /dev/null
  11108. @@ -1,79 +0,0 @@
  11109. -From: Oleksij Rempel <linux@rempel-privat.de>
  11110. -Date: Sun, 22 Mar 2015 19:29:48 +0100
  11111. -Subject: [PATCH] ath9k: ar9271_hw_pa_cal: use proper makroses.
  11112. -
  11113. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  11114. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11115. ----
  11116. -
  11117. ---- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  11118. -+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  11119. -@@ -443,33 +443,30 @@ static void ar9271_hw_pa_cal(struct ath_
  11120. - for (i = 0; i < ARRAY_SIZE(regList); i++)
  11121. - regList[i][1] = REG_READ(ah, regList[i][0]);
  11122. -
  11123. -- regVal = REG_READ(ah, AR9285_AN_RF2G6);
  11124. -- regVal &= (~(0x1));
  11125. -- REG_WRITE(ah, AR9285_AN_RF2G6, regVal);
  11126. -- regVal = REG_READ(ah, 0x9808);
  11127. -- regVal |= (0x1 << 27);
  11128. -- REG_WRITE(ah, 0x9808, regVal);
  11129. --
  11130. -+ /* 7834, b1=0 */
  11131. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G6, 1 << 0);
  11132. -+ /* 9808, b27=1 */
  11133. -+ REG_SET_BIT(ah, 0x9808, 1 << 27);
  11134. - /* 786c,b23,1, pwddac=1 */
  11135. -- REG_RMW_FIELD(ah, AR9285_AN_TOP3, AR9285_AN_TOP3_PWDDAC, 1);
  11136. -+ REG_SET_BIT(ah, AR9285_AN_TOP3, AR9285_AN_TOP3_PWDDAC);
  11137. - /* 7854, b5,1, pdrxtxbb=1 */
  11138. -- REG_RMW_FIELD(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDRXTXBB1, 1);
  11139. -+ REG_SET_BIT(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDRXTXBB1);
  11140. - /* 7854, b7,1, pdv2i=1 */
  11141. -- REG_RMW_FIELD(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDV2I, 1);
  11142. -+ REG_SET_BIT(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDV2I);
  11143. - /* 7854, b8,1, pddacinterface=1 */
  11144. -- REG_RMW_FIELD(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDDACIF, 1);
  11145. -+ REG_SET_BIT(ah, AR9285_AN_RXTXBB1, AR9285_AN_RXTXBB1_PDDACIF);
  11146. - /* 7824,b12,0, offcal=0 */
  11147. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G2, AR9285_AN_RF2G2_OFFCAL, 0);
  11148. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G2, AR9285_AN_RF2G2_OFFCAL);
  11149. - /* 7838, b1,0, pwddb=0 */
  11150. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PWDDB, 0);
  11151. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PWDDB);
  11152. - /* 7820,b11,0, enpacal=0 */
  11153. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_ENPACAL, 0);
  11154. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_ENPACAL);
  11155. - /* 7820,b25,1, pdpadrv1=0 */
  11156. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPADRV1, 0);
  11157. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPADRV1);
  11158. - /* 7820,b24,0, pdpadrv2=0 */
  11159. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPADRV2, 0);
  11160. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPADRV2);
  11161. - /* 7820,b23,0, pdpaout=0 */
  11162. -- REG_RMW_FIELD(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPAOUT, 0);
  11163. -+ REG_CLR_BIT(ah, AR9285_AN_RF2G1, AR9285_AN_RF2G1_PDPAOUT);
  11164. - /* 783c,b14-16,7, padrvgn2tab_0=7 */
  11165. - REG_RMW_FIELD(ah, AR9285_AN_RF2G8, AR9285_AN_RF2G8_PADRVGN2TAB0, 7);
  11166. - /*
  11167. -@@ -516,15 +513,13 @@ static void ar9271_hw_pa_cal(struct ath_
  11168. - ah->pacal_info.prev_offset = regVal;
  11169. - }
  11170. -
  11171. -- ENABLE_REGWRITE_BUFFER(ah);
  11172. -
  11173. -- regVal = REG_READ(ah, AR_AN_RF2G1_CH1);
  11174. -- regVal |= 0x1;
  11175. -- REG_WRITE(ah, AR_AN_RF2G1_CH1, regVal);
  11176. -- regVal = REG_READ(ah, 0x9808);
  11177. -- regVal &= (~(0x1 << 27));
  11178. -- REG_WRITE(ah, 0x9808, regVal);
  11179. -+ /* 7834, b1=1 */
  11180. -+ REG_SET_BIT(ah, AR9285_AN_RF2G6, 1 << 0);
  11181. -+ /* 9808, b27=0 */
  11182. -+ REG_CLR_BIT(ah, 0x9808, 1 << 27);
  11183. -
  11184. -+ ENABLE_REGWRITE_BUFFER(ah);
  11185. - for (i = 0; i < ARRAY_SIZE(regList); i++)
  11186. - REG_WRITE(ah, regList[i][0], regList[i][1]);
  11187. -
  11188. diff --git a/package/kernel/mac80211/patches/321-brcmfmac-change-parameters-for-brcmf_remove_interfac.patch b/package/kernel/mac80211/patches/321-brcmfmac-change-parameters-for-brcmf_remove_interfac.patch
  11189. new file mode 100644
  11190. index 0000000..3360cbc
  11191. --- /dev/null
  11192. +++ b/package/kernel/mac80211/patches/321-brcmfmac-change-parameters-for-brcmf_remove_interfac.patch
  11193. @@ -0,0 +1,87 @@
  11194. +From: Arend van Spriel <arend@broadcom.com>
  11195. +Date: Wed, 26 Aug 2015 22:14:55 +0200
  11196. +Subject: [PATCH] brcmfmac: change parameters for
  11197. + brcmf_remove_interface()
  11198. +
  11199. +Just pass the interface to be removed, ie. the struct brcmf_if instance.
  11200. +
  11201. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  11202. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11203. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11204. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11205. +---
  11206. +
  11207. +--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  11208. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  11209. +@@ -4983,7 +4983,7 @@ brcmf_notify_connect_status_ap(struct br
  11210. + brcmf_dbg(CONN, "AP mode link down\n");
  11211. + complete(&cfg->vif_disabled);
  11212. + if (ifp->vif->mbss)
  11213. +- brcmf_remove_interface(ifp->drvr, ifp->bssidx);
  11214. ++ brcmf_remove_interface(ifp);
  11215. + return 0;
  11216. + }
  11217. +
  11218. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  11219. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  11220. +@@ -887,12 +887,13 @@ static void brcmf_del_if(struct brcmf_pu
  11221. + }
  11222. + }
  11223. +
  11224. +-void brcmf_remove_interface(struct brcmf_pub *drvr, u32 bssidx)
  11225. ++void brcmf_remove_interface(struct brcmf_if *ifp)
  11226. + {
  11227. +- if (drvr->iflist[bssidx]) {
  11228. +- brcmf_fws_del_interface(drvr->iflist[bssidx]);
  11229. +- brcmf_del_if(drvr, bssidx);
  11230. +- }
  11231. ++ if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bssidx] != ifp))
  11232. ++ return;
  11233. ++
  11234. ++ brcmf_fws_del_interface(ifp);
  11235. ++ brcmf_del_if(ifp->drvr, ifp->bssidx);
  11236. + }
  11237. +
  11238. + int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr)
  11239. +@@ -1122,7 +1123,7 @@ void brcmf_detach(struct device *dev)
  11240. +
  11241. + /* make sure primary interface removed last */
  11242. + for (i = BRCMF_MAX_IFS-1; i > -1; i--)
  11243. +- brcmf_remove_interface(drvr, i);
  11244. ++ brcmf_remove_interface(drvr->iflist[i]);
  11245. +
  11246. + brcmf_cfg80211_detach(drvr->config);
  11247. +
  11248. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  11249. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  11250. +@@ -206,7 +206,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
  11251. + int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  11252. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  11253. + char *name, u8 *mac_addr);
  11254. +-void brcmf_remove_interface(struct brcmf_pub *drvr, u32 bssidx);
  11255. ++void brcmf_remove_interface(struct brcmf_if *ifp);
  11256. + int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  11257. + void brcmf_txflowblock_if(struct brcmf_if *ifp,
  11258. + enum brcmf_netif_stop_reason reason, bool state);
  11259. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  11260. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  11261. +@@ -222,7 +222,7 @@ static void brcmf_fweh_handle_if_event(s
  11262. + err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
  11263. +
  11264. + if (ifp && ifevent->action == BRCMF_E_IF_DEL)
  11265. +- brcmf_remove_interface(drvr, ifevent->bssidx);
  11266. ++ brcmf_remove_interface(ifp);
  11267. + }
  11268. +
  11269. + /**
  11270. +--- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  11271. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  11272. +@@ -2140,7 +2140,7 @@ static void brcmf_p2p_delete_p2pdev(stru
  11273. + {
  11274. + cfg80211_unregister_wdev(&vif->wdev);
  11275. + p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  11276. +- brcmf_remove_interface(vif->ifp->drvr, vif->ifp->bssidx);
  11277. ++ brcmf_remove_interface(vif->ifp);
  11278. + brcmf_free_vif(vif);
  11279. + }
  11280. +
  11281. 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
  11282. deleted file mode 100644
  11283. index 7247369..0000000
  11284. --- a/package/kernel/mac80211/patches/322-ath9k-ar9271_hw_pa_cal-use-RMW-buffer.patch
  11285. +++ /dev/null
  11286. @@ -1,48 +0,0 @@
  11287. -From: Oleksij Rempel <linux@rempel-privat.de>
  11288. -Date: Sun, 22 Mar 2015 19:29:49 +0100
  11289. -Subject: [PATCH] ath9k: ar9271_hw_pa_cal: use RMW buffer
  11290. -
  11291. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  11292. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11293. ----
  11294. -
  11295. ---- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  11296. -+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  11297. -@@ -436,13 +436,14 @@ static void ar9271_hw_pa_cal(struct ath_
  11298. - { AR9285_AN_RF2G2, 0 },
  11299. - { AR9285_AN_TOP2, 0 },
  11300. - { AR9285_AN_RF2G8, 0 },
  11301. -- { AR9285_AN_RF2G7, 0 } ,
  11302. -- { AR9285_AN_RF2G3, 0 } ,
  11303. -+ { AR9285_AN_RF2G7, 0 },
  11304. -+ { AR9285_AN_RF2G3, 0 },
  11305. - };
  11306. -
  11307. - for (i = 0; i < ARRAY_SIZE(regList); i++)
  11308. - regList[i][1] = REG_READ(ah, regList[i][0]);
  11309. -
  11310. -+ ENABLE_REG_RMW_BUFFER(ah);
  11311. - /* 7834, b1=0 */
  11312. - REG_CLR_BIT(ah, AR9285_AN_RF2G6, 1 << 0);
  11313. - /* 9808, b27=1 */
  11314. -@@ -476,6 +477,7 @@ static void ar9271_hw_pa_cal(struct ath_
  11315. - REG_RMW_FIELD(ah, AR9285_AN_RF2G7, AR9285_AN_RF2G7_PADRVGN2TAB0, 0);
  11316. - /* 7828, b0-11, ccom=fff */
  11317. - REG_RMW_FIELD(ah, AR9285_AN_RF2G3, AR9271_AN_RF2G3_CCOMP, 0xfff);
  11318. -+ REG_RMW_BUFFER_FLUSH(ah);
  11319. -
  11320. - /* Set:
  11321. - * localmode=1,bmode=1,bmoderxtx=1,synthon=1,
  11322. -@@ -514,10 +516,12 @@ static void ar9271_hw_pa_cal(struct ath_
  11323. - }
  11324. -
  11325. -
  11326. -+ ENABLE_REG_RMW_BUFFER(ah);
  11327. - /* 7834, b1=1 */
  11328. - REG_SET_BIT(ah, AR9285_AN_RF2G6, 1 << 0);
  11329. - /* 9808, b27=0 */
  11330. - REG_CLR_BIT(ah, 0x9808, 1 << 27);
  11331. -+ REG_RMW_BUFFER_FLUSH(ah);
  11332. -
  11333. - ENABLE_REGWRITE_BUFFER(ah);
  11334. - for (i = 0; i < ARRAY_SIZE(regList); i++)
  11335. diff --git a/package/kernel/mac80211/patches/322-brcmfmac-only-call-brcmf_cfg80211_detach-when-attach.patch b/package/kernel/mac80211/patches/322-brcmfmac-only-call-brcmf_cfg80211_detach-when-attach.patch
  11336. new file mode 100644
  11337. index 0000000..2b61f4e
  11338. --- /dev/null
  11339. +++ b/package/kernel/mac80211/patches/322-brcmfmac-only-call-brcmf_cfg80211_detach-when-attach.patch
  11340. @@ -0,0 +1,92 @@
  11341. +From: Arend van Spriel <arend@broadcom.com>
  11342. +Date: Wed, 26 Aug 2015 22:14:56 +0200
  11343. +Subject: [PATCH] brcmfmac: only call brcmf_cfg80211_detach() when attach
  11344. + was successful
  11345. +
  11346. +In brcmf_bus_start() the function brcmf_cfg80211_attach() is called which
  11347. +may fail. If this happens we should not call brcmf_cfg80211_detach() in
  11348. +the failure path as it will result in NULL pointer dereference:
  11349. +
  11350. + brcmf_fweh_activate_events: Set event_msgs error (-5)
  11351. + brcmf_bus_start: failed: -5
  11352. + brcmf_sdio_firmware_callback: dongle is not responding
  11353. + BUG: unable to handle kernel NULL pointer dereference at 0000000000000068
  11354. + IP: [<ffffffff811e8f08>] kernfs_find_ns+0x18/0xd0
  11355. + PGD 0
  11356. + Oops: 0000 [#1] SMP
  11357. + Modules linked in: brcmfmac(O) brcmutil(O) cfg80211 auth_rpcgss
  11358. + CPU: 1 PID: 45 Comm: kworker/1:1 Tainted: G O
  11359. + Hardware name: Dell Inc. Latitude E6410/07XJP9, BIOS A07 02/15/2011
  11360. + Workqueue: events request_firmware_work_func
  11361. + task: ffff880036c09ac0 ti: ffff880036dd4000 task.ti: ffff880036dd4000
  11362. + RIP: 0010:[<ffffffff811e8f08>] [<ffffffff811e8f08>] kernfs_find_ns+0x18/0xd0
  11363. + RSP: 0018:ffff880036dd7a28 EFLAGS: 00010246
  11364. + RAX: ffff880036c09ac0 RBX: 0000000000000000 RCX: 000000007fffffff
  11365. + RDX: 0000000000000000 RSI: ffffffff816578b9 RDI: 0000000000000000
  11366. + RBP: ffff880036dd7a48 R08: 0000000000000000 R09: ffff880036c0b340
  11367. + R10: 00000000000002ec R11: ffff880036dd7b08 R12: ffffffff816578b9
  11368. + R13: 0000000000000000 R14: ffffffff816578b9 R15: ffff8800c6c87000
  11369. + FS: 0000000000000000(0000) GS:ffff88012bc40000(0000) knlGS:0000000000000000
  11370. + CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
  11371. + CR2: 0000000000000068 CR3: 0000000001a0b000 CR4: 00000000000006e0
  11372. + Stack:
  11373. + 0000000000000000 ffffffff816578b9 0000000000000000 ffff8800c0d003c8
  11374. + ffff880036dd7a78 ffffffff811e8ff5 0000000ffffffff1 ffffffff81a9b060
  11375. + ffff8800c789f880 ffff8800c0d00000 ffff880036dd7a98 ffffffff811ebe0d
  11376. + Call Trace:
  11377. + [<ffffffff811e8ff5>] kernfs_find_and_get_ns+0x35/0x60
  11378. + [<ffffffff811ebe0d>] sysfs_unmerge_group+0x1d/0x60
  11379. + [<ffffffff81404ef2>] dpm_sysfs_remove+0x22/0x60
  11380. + [<ffffffff813f9db9>] device_del+0x49/0x240
  11381. + [<ffffffff815da768>] rfkill_unregister+0x58/0xc0
  11382. + [<ffffffffa06bd91b>] wiphy_unregister+0xab/0x2f0 [cfg80211]
  11383. + [<ffffffffa0742fe3>] brcmf_cfg80211_detach+0x23/0x50 [brcmfmac]
  11384. + [<ffffffffa074d986>] brcmf_detach+0x86/0xe0 [brcmfmac]
  11385. + [<ffffffffa0757de8>] brcmf_sdio_remove+0x48/0x120 [brcmfmac]
  11386. + [<ffffffffa0758ed9>] brcmf_sdiod_remove+0x29/0xd0 [brcmfmac]
  11387. + [<ffffffffa0759031>] brcmf_ops_sdio_remove+0xb1/0x110 [brcmfmac]
  11388. + [<ffffffffa001c267>] sdio_bus_remove+0x37/0x100 [mmc_core]
  11389. + [<ffffffff813fe026>] __device_release_driver+0x96/0x130
  11390. + [<ffffffff813fe0e3>] device_release_driver+0x23/0x30
  11391. + [<ffffffffa0754bc8>] brcmf_sdio_firmware_callback+0x2a8/0x5d0 [brcmfmac]
  11392. + [<ffffffffa074deaf>] brcmf_fw_request_nvram_done+0x15f/0x5e0 [brcmfmac]
  11393. + [<ffffffff8140142f>] ? devres_add+0x3f/0x50
  11394. + [<ffffffff810642b5>] ? usermodehelper_read_unlock+0x15/0x20
  11395. + [<ffffffff81400000>] ? platform_match+0x70/0xa0
  11396. + [<ffffffff8140f400>] request_firmware_work_func+0x30/0x60
  11397. + [<ffffffff8106828c>] process_one_work+0x14c/0x3d0
  11398. + [<ffffffff8106862a>] worker_thread+0x11a/0x450
  11399. + [<ffffffff81068510>] ? process_one_work+0x3d0/0x3d0
  11400. + [<ffffffff8106d692>] kthread+0xd2/0xf0
  11401. + [<ffffffff8106d5c0>] ? kthread_create_on_node+0x180/0x180
  11402. + [<ffffffff815ed35f>] ret_from_fork+0x3f/0x70
  11403. + [<ffffffff8106d5c0>] ? kthread_create_on_node+0x180/0x180
  11404. + Code: e9 40 fe ff ff 48 89 d8 eb 87 66 0f 1f 84 00 00 00 00 00 66 66 66 66
  11405. + 90 55 48 89 e5 41 56 49 89 f6 41 55 49 89 d5 31 d2 41 54 53 <0f> b7
  11406. + 47 68 48 8b 5f 48 66 c1 e8 05 83 e0 01 4d 85 ed 0f b6 c8
  11407. + RIP [<ffffffff811e8f08>] kernfs_find_ns+0x18/0xd0
  11408. + RSP <ffff880036dd7a28>
  11409. + CR2: 0000000000000068
  11410. + ---[ end trace 87d6ec0d3fe46740 ]---
  11411. +
  11412. +Reported-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  11413. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  11414. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11415. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11416. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11417. +---
  11418. +
  11419. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  11420. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  11421. +@@ -1049,7 +1049,10 @@ int brcmf_bus_start(struct device *dev)
  11422. + fail:
  11423. + if (ret < 0) {
  11424. + brcmf_err("failed: %d\n", ret);
  11425. +- brcmf_cfg80211_detach(drvr->config);
  11426. ++ if (drvr->config) {
  11427. ++ brcmf_cfg80211_detach(drvr->config);
  11428. ++ drvr->config = NULL;
  11429. ++ }
  11430. + if (drvr->fws) {
  11431. + brcmf_fws_del_interface(ifp);
  11432. + brcmf_fws_deinit(drvr);
  11433. 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
  11434. deleted file mode 100644
  11435. index 246bb9d..0000000
  11436. --- a/package/kernel/mac80211/patches/323-ath9k-add-multi_read-to-be-compatible-with-ath9k_htc.patch
  11437. +++ /dev/null
  11438. @@ -1,35 +0,0 @@
  11439. -From: Oleksij Rempel <linux@rempel-privat.de>
  11440. -Date: Sun, 22 Mar 2015 19:29:50 +0100
  11441. -Subject: [PATCH] ath9k: add multi_read to be compatible with ath9k_htc
  11442. -
  11443. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  11444. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11445. ----
  11446. -
  11447. ---- a/drivers/net/wireless/ath/ath9k/init.c
  11448. -+++ b/drivers/net/wireless/ath/ath9k/init.c
  11449. -@@ -141,6 +141,16 @@ static unsigned int ath9k_ioread32(void
  11450. - return val;
  11451. - }
  11452. -
  11453. -+static void ath9k_multi_ioread32(void *hw_priv, u32 *addr,
  11454. -+ u32 *val, u16 count)
  11455. -+{
  11456. -+ int i;
  11457. -+
  11458. -+ for (i = 0; i < count; i++)
  11459. -+ val[i] = ath9k_ioread32(hw_priv, addr[i]);
  11460. -+}
  11461. -+
  11462. -+
  11463. - static unsigned int __ath9k_reg_rmw(struct ath_softc *sc, u32 reg_offset,
  11464. - u32 set, u32 clr)
  11465. - {
  11466. -@@ -530,6 +540,7 @@ static int ath9k_init_softc(u16 devid, s
  11467. - ah->hw = sc->hw;
  11468. - ah->hw_version.devid = devid;
  11469. - ah->reg_ops.read = ath9k_ioread32;
  11470. -+ ah->reg_ops.multi_read = ath9k_multi_ioread32;
  11471. - ah->reg_ops.write = ath9k_iowrite32;
  11472. - ah->reg_ops.rmw = ath9k_reg_rmw;
  11473. - pCap = &ah->caps;
  11474. diff --git a/package/kernel/mac80211/patches/323-brcmfmac-correct-detection-of-p2pdev-interface-event.patch b/package/kernel/mac80211/patches/323-brcmfmac-correct-detection-of-p2pdev-interface-event.patch
  11475. new file mode 100644
  11476. index 0000000..868b0a8
  11477. --- /dev/null
  11478. +++ b/package/kernel/mac80211/patches/323-brcmfmac-correct-detection-of-p2pdev-interface-event.patch
  11479. @@ -0,0 +1,105 @@
  11480. +From: Arend van Spriel <arend@broadcom.com>
  11481. +Date: Wed, 26 Aug 2015 22:14:57 +0200
  11482. +Subject: [PATCH] brcmfmac: correct detection of p2pdev interface event
  11483. +
  11484. +The p2pdev interface is setup in firmware resulting in a interface
  11485. +event. This event has role and no-if flag. When role is p2p client
  11486. +and no-if flag is set it indicates that this is the p2pdev interface.
  11487. +This info is used in handling the event and adding interface in the
  11488. +driver.
  11489. +
  11490. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  11491. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11492. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11493. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11494. +---
  11495. +
  11496. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  11497. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  11498. +@@ -795,7 +795,7 @@ fail:
  11499. + }
  11500. +
  11501. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  11502. +- char *name, u8 *mac_addr)
  11503. ++ bool is_p2pdev, char *name, u8 *mac_addr)
  11504. + {
  11505. + struct brcmf_if *ifp;
  11506. + struct net_device *ndev;
  11507. +@@ -821,7 +821,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  11508. + }
  11509. + }
  11510. +
  11511. +- if (!brcmf_p2p_enable && bssidx == 1) {
  11512. ++ if (!brcmf_p2p_enable && is_p2pdev) {
  11513. + /* this is P2P_DEVICE interface */
  11514. + brcmf_dbg(INFO, "allocate non-netdev interface\n");
  11515. + ifp = kzalloc(sizeof(*ifp), GFP_KERNEL);
  11516. +@@ -999,12 +999,12 @@ int brcmf_bus_start(struct device *dev)
  11517. + brcmf_dbg(TRACE, "\n");
  11518. +
  11519. + /* add primary networking interface */
  11520. +- ifp = brcmf_add_if(drvr, 0, 0, "wlan%d", NULL);
  11521. ++ ifp = brcmf_add_if(drvr, 0, 0, false, "wlan%d", NULL);
  11522. + if (IS_ERR(ifp))
  11523. + return PTR_ERR(ifp);
  11524. +
  11525. + if (brcmf_p2p_enable)
  11526. +- p2p_ifp = brcmf_add_if(drvr, 1, 0, "p2p%d", NULL);
  11527. ++ p2p_ifp = brcmf_add_if(drvr, 1, 0, false, "p2p%d", NULL);
  11528. + else
  11529. + p2p_ifp = NULL;
  11530. + if (IS_ERR(p2p_ifp))
  11531. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  11532. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  11533. +@@ -205,7 +205,7 @@ char *brcmf_ifname(struct brcmf_pub *drv
  11534. + struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  11535. + int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  11536. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  11537. +- char *name, u8 *mac_addr);
  11538. ++ bool is_p2pdev, char *name, u8 *mac_addr);
  11539. + void brcmf_remove_interface(struct brcmf_if *ifp);
  11540. + int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  11541. + void brcmf_txflowblock_if(struct brcmf_if *ifp,
  11542. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  11543. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  11544. +@@ -179,6 +179,7 @@ static void brcmf_fweh_handle_if_event(s
  11545. + {
  11546. + struct brcmf_if_event *ifevent = data;
  11547. + struct brcmf_if *ifp;
  11548. ++ bool is_p2pdev;
  11549. + int err = 0;
  11550. +
  11551. + brcmf_dbg(EVENT, "action: %u idx: %u bsscfg: %u flags: %u role: %u\n",
  11552. +@@ -186,18 +187,16 @@ static void brcmf_fweh_handle_if_event(s
  11553. + ifevent->flags, ifevent->role);
  11554. +
  11555. + /* The P2P Device interface event must not be ignored
  11556. +- * contrary to what firmware tells us. The only way to
  11557. +- * distinguish the P2P Device is by looking at the ifidx
  11558. +- * and bssidx received.
  11559. ++ * contrary to what firmware tells us.
  11560. + */
  11561. +- if (!(ifevent->ifidx == 0 && ifevent->bssidx == 1) &&
  11562. +- (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) {
  11563. ++ is_p2pdev = (ifevent->flags & BRCMF_E_IF_FLAG_NOIF) &&
  11564. ++ ifevent->role == BRCMF_E_IF_ROLE_P2P_CLIENT;
  11565. ++ if (!is_p2pdev && (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) {
  11566. + brcmf_dbg(EVENT, "event can be ignored\n");
  11567. + return;
  11568. + }
  11569. + if (ifevent->ifidx >= BRCMF_MAX_IFS) {
  11570. +- brcmf_err("invalid interface index: %u\n",
  11571. +- ifevent->ifidx);
  11572. ++ brcmf_err("invalid interface index: %u\n", ifevent->ifidx);
  11573. + return;
  11574. + }
  11575. +
  11576. +@@ -207,7 +206,7 @@ static void brcmf_fweh_handle_if_event(s
  11577. + brcmf_dbg(EVENT, "adding %s (%pM)\n", emsg->ifname,
  11578. + emsg->addr);
  11579. + ifp = brcmf_add_if(drvr, ifevent->bssidx, ifevent->ifidx,
  11580. +- emsg->ifname, emsg->addr);
  11581. ++ is_p2pdev, emsg->ifname, emsg->addr);
  11582. + if (IS_ERR(ifp))
  11583. + return;
  11584. + brcmf_fws_add_interface(ifp);
  11585. 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
  11586. deleted file mode 100644
  11587. index 2eda1c9..0000000
  11588. --- a/package/kernel/mac80211/patches/324-ath9k-add-new-function-ath9k_hw_read_array.patch
  11589. +++ /dev/null
  11590. @@ -1,69 +0,0 @@
  11591. -From: Oleksij Rempel <linux@rempel-privat.de>
  11592. -Date: Sun, 22 Mar 2015 19:29:51 +0100
  11593. -Subject: [PATCH] ath9k: add new function ath9k_hw_read_array
  11594. -
  11595. -REG_READ generate most overhead on usb bus. It send and read micro packages
  11596. -and reduce usb bandwidth. To reduce this overhead we should read in batches.
  11597. -
  11598. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  11599. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11600. ----
  11601. -
  11602. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  11603. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  11604. -@@ -121,6 +121,36 @@ void ath9k_hw_write_array(struct ath_hw
  11605. - REGWRITE_BUFFER_FLUSH(ah);
  11606. - }
  11607. -
  11608. -+void ath9k_hw_read_array(struct ath_hw *ah, u32 array[][2], int size)
  11609. -+{
  11610. -+ u32 *tmp_reg_list, *tmp_data;
  11611. -+ int i;
  11612. -+
  11613. -+ tmp_reg_list = kmalloc(size * sizeof(u32), GFP_KERNEL);
  11614. -+ if (!tmp_reg_list) {
  11615. -+ dev_err(ah->dev, "%s: tmp_reg_list: alloc filed\n", __func__);
  11616. -+ return;
  11617. -+ }
  11618. -+
  11619. -+ tmp_data = kmalloc(size * sizeof(u32), GFP_KERNEL);
  11620. -+ if (!tmp_data) {
  11621. -+ dev_err(ah->dev, "%s tmp_data: alloc filed\n", __func__);
  11622. -+ goto error_tmp_data;
  11623. -+ }
  11624. -+
  11625. -+ for (i = 0; i < size; i++)
  11626. -+ tmp_reg_list[i] = array[i][0];
  11627. -+
  11628. -+ REG_READ_MULTI(ah, tmp_reg_list, tmp_data, size);
  11629. -+
  11630. -+ for (i = 0; i < size; i++)
  11631. -+ array[i][1] = tmp_data[i];
  11632. -+
  11633. -+ kfree(tmp_data);
  11634. -+error_tmp_data:
  11635. -+ kfree(tmp_reg_list);
  11636. -+}
  11637. -+
  11638. - u32 ath9k_hw_reverse_bits(u32 val, u32 n)
  11639. - {
  11640. - u32 retval;
  11641. ---- a/drivers/net/wireless/ath/ath9k/hw.h
  11642. -+++ b/drivers/net/wireless/ath/ath9k/hw.h
  11643. -@@ -138,6 +138,8 @@
  11644. -
  11645. - #define REG_WRITE_ARRAY(iniarray, column, regWr) \
  11646. - ath9k_hw_write_array(ah, iniarray, column, &(regWr))
  11647. -+#define REG_READ_ARRAY(ah, array, size) \
  11648. -+ ath9k_hw_read_array(ah, array, size)
  11649. -
  11650. - #define AR_GPIO_OUTPUT_MUX_AS_OUTPUT 0
  11651. - #define AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED 1
  11652. -@@ -1020,6 +1022,7 @@ void ath9k_hw_synth_delay(struct ath_hw
  11653. - bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout);
  11654. - void ath9k_hw_write_array(struct ath_hw *ah, const struct ar5416IniArray *array,
  11655. - int column, unsigned int *writecnt);
  11656. -+void ath9k_hw_read_array(struct ath_hw *ah, u32 array[][2], int size);
  11657. - u32 ath9k_hw_reverse_bits(u32 val, u32 n);
  11658. - u16 ath9k_hw_computetxtime(struct ath_hw *ah,
  11659. - u8 phy, int kbps,
  11660. diff --git a/package/kernel/mac80211/patches/324-brcmfmac-use-brcmf_get_ifp-to-map-ifidx-to-struct-br.patch b/package/kernel/mac80211/patches/324-brcmfmac-use-brcmf_get_ifp-to-map-ifidx-to-struct-br.patch
  11661. new file mode 100644
  11662. index 0000000..abd6681
  11663. --- /dev/null
  11664. +++ b/package/kernel/mac80211/patches/324-brcmfmac-use-brcmf_get_ifp-to-map-ifidx-to-struct-br.patch
  11665. @@ -0,0 +1,126 @@
  11666. +From: Arend van Spriel <arend@broadcom.com>
  11667. +Date: Wed, 26 Aug 2015 22:14:58 +0200
  11668. +Subject: [PATCH] brcmfmac: use brcmf_get_ifp() to map ifidx to struct
  11669. + brcmf_if instance
  11670. +
  11671. +The knowledge on how to map the interface index to a struct brcmf_if
  11672. +instance is in brcmf_get_ifp() so use that function when only the
  11673. +interface index is known instead of accessing brcmf_pub::iflist
  11674. +directly.
  11675. +
  11676. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  11677. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11678. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11679. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11680. +---
  11681. +
  11682. +--- a/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c
  11683. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c
  11684. +@@ -149,7 +149,7 @@ static s32 brcmf_btcoex_params_read(stru
  11685. + static void brcmf_btcoex_boost_wifi(struct brcmf_btcoex_info *btci,
  11686. + bool trump_sco)
  11687. + {
  11688. +- struct brcmf_if *ifp = btci->cfg->pub->iflist[0];
  11689. ++ struct brcmf_if *ifp = brcmf_get_ifp(btci->cfg->pub, 0);
  11690. +
  11691. + if (trump_sco && !btci->saved_regs_part2) {
  11692. + /* this should reduce eSCO agressive
  11693. +@@ -468,7 +468,7 @@ int brcmf_btcoex_set_mode(struct brcmf_c
  11694. + {
  11695. + struct brcmf_cfg80211_info *cfg = wiphy_priv(vif->wdev.wiphy);
  11696. + struct brcmf_btcoex_info *btci = cfg->btcoex;
  11697. +- struct brcmf_if *ifp = cfg->pub->iflist[0];
  11698. ++ struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
  11699. +
  11700. + switch (mode) {
  11701. + case BRCMF_BTCOEX_DISABLED:
  11702. +--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  11703. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  11704. +@@ -6213,7 +6213,7 @@ static void brcmf_free_wiphy(struct wiph
  11705. + struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
  11706. + struct device *busdev)
  11707. + {
  11708. +- struct net_device *ndev = drvr->iflist[0]->ndev;
  11709. ++ struct net_device *ndev = brcmf_get_ifp(drvr, 0)->ndev;
  11710. + struct brcmf_cfg80211_info *cfg;
  11711. + struct wiphy *wiphy;
  11712. + struct brcmf_cfg80211_vif *vif;
  11713. +--- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  11714. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  11715. +@@ -121,7 +121,7 @@ static void brcmf_feat_iovar_int_set(str
  11716. +
  11717. + void brcmf_feat_attach(struct brcmf_pub *drvr)
  11718. + {
  11719. +- struct brcmf_if *ifp = drvr->iflist[0];
  11720. ++ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
  11721. +
  11722. + brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_MCHAN, "mchan");
  11723. + brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_PNO, "pfn");
  11724. +--- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  11725. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  11726. +@@ -221,7 +221,7 @@ static void brcmf_flowring_block(struct
  11727. +
  11728. + bus_if = dev_get_drvdata(flow->dev);
  11729. + drvr = bus_if->drvr;
  11730. +- ifp = drvr->iflist[ifidx];
  11731. ++ ifp = brcmf_get_ifp(drvr, ifidx);
  11732. + brcmf_txflowblock_if(ifp, BRCMF_NETIF_STOP_REASON_FLOW, blocked);
  11733. +
  11734. + spin_unlock_irqrestore(&flow->block_lock, flags);
  11735. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  11736. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  11737. +@@ -334,7 +334,7 @@ void brcmf_fweh_attach(struct brcmf_pub
  11738. + void brcmf_fweh_detach(struct brcmf_pub *drvr)
  11739. + {
  11740. + struct brcmf_fweh_info *fweh = &drvr->fweh;
  11741. +- struct brcmf_if *ifp = drvr->iflist[0];
  11742. ++ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
  11743. + s8 eventmask[BRCMF_EVENTING_MASK_LEN];
  11744. +
  11745. + if (ifp) {
  11746. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  11747. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  11748. +@@ -972,7 +972,7 @@ static void
  11749. + brcmf_fws_flow_control_check(struct brcmf_fws_info *fws, struct pktq *pq,
  11750. + u8 if_id)
  11751. + {
  11752. +- struct brcmf_if *ifp = fws->drvr->iflist[!if_id ? 0 : if_id + 1];
  11753. ++ struct brcmf_if *ifp = brcmf_get_ifp(fws->drvr, if_id);
  11754. +
  11755. + if (WARN_ON(!ifp))
  11756. + return;
  11757. +@@ -2118,6 +2118,7 @@ static int brcmf_debugfs_fws_stats_read(
  11758. + int brcmf_fws_init(struct brcmf_pub *drvr)
  11759. + {
  11760. + struct brcmf_fws_info *fws;
  11761. ++ struct brcmf_if *ifp;
  11762. + u32 tlv = BRCMF_FWS_FLAGS_RSSI_SIGNALS;
  11763. + int rc;
  11764. + u32 mode;
  11765. +@@ -2177,21 +2178,22 @@ int brcmf_fws_init(struct brcmf_pub *drv
  11766. + * continue. Set mode back to none indicating not enabled.
  11767. + */
  11768. + fws->fw_signals = true;
  11769. +- if (brcmf_fil_iovar_int_set(drvr->iflist[0], "tlv", tlv)) {
  11770. ++ ifp = brcmf_get_ifp(drvr, 0);
  11771. ++ if (brcmf_fil_iovar_int_set(ifp, "tlv", tlv)) {
  11772. + brcmf_err("failed to set bdcv2 tlv signaling\n");
  11773. + fws->fcmode = BRCMF_FWS_FCMODE_NONE;
  11774. + fws->fw_signals = false;
  11775. + }
  11776. +
  11777. +- if (brcmf_fil_iovar_int_set(drvr->iflist[0], "ampdu_hostreorder", 1))
  11778. ++ if (brcmf_fil_iovar_int_set(ifp, "ampdu_hostreorder", 1))
  11779. + brcmf_dbg(INFO, "enabling AMPDU host-reorder failed\n");
  11780. +
  11781. + /* Enable seq number reuse, if supported */
  11782. +- if (brcmf_fil_iovar_int_get(drvr->iflist[0], "wlfc_mode", &mode) == 0) {
  11783. ++ if (brcmf_fil_iovar_int_get(ifp, "wlfc_mode", &mode) == 0) {
  11784. + if (BRCMF_FWS_MODE_GET_REUSESEQ(mode)) {
  11785. + mode = 0;
  11786. + BRCMF_FWS_MODE_SET_REUSESEQ(mode, 1);
  11787. +- if (brcmf_fil_iovar_int_set(drvr->iflist[0],
  11788. ++ if (brcmf_fil_iovar_int_set(ifp,
  11789. + "wlfc_mode", mode) == 0) {
  11790. + BRCMF_FWS_MODE_SET_REUSESEQ(fws->mode, 1);
  11791. + }
  11792. 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
  11793. deleted file mode 100644
  11794. index 4e4888f..0000000
  11795. --- a/package/kernel/mac80211/patches/325-ath9k-ar9271_hw_pa_cal-use-REG_READ_ARRAY.patch
  11796. +++ /dev/null
  11797. @@ -1,24 +0,0 @@
  11798. -From: Oleksij Rempel <linux@rempel-privat.de>
  11799. -Date: Sun, 22 Mar 2015 19:29:52 +0100
  11800. -Subject: [PATCH] ath9k: ar9271_hw_pa_cal: use REG_READ_ARRAY
  11801. -
  11802. -insted of reading each register separatly
  11803. -and waste 4ms on each operation, we can
  11804. -use one shot read.
  11805. -
  11806. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  11807. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11808. ----
  11809. -
  11810. ---- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  11811. -+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
  11812. -@@ -440,8 +440,7 @@ static void ar9271_hw_pa_cal(struct ath_
  11813. - { AR9285_AN_RF2G3, 0 },
  11814. - };
  11815. -
  11816. -- for (i = 0; i < ARRAY_SIZE(regList); i++)
  11817. -- regList[i][1] = REG_READ(ah, regList[i][0]);
  11818. -+ REG_READ_ARRAY(ah, regList, ARRAY_SIZE(regList));
  11819. -
  11820. - ENABLE_REG_RMW_BUFFER(ah);
  11821. - /* 7834, b1=0 */
  11822. diff --git a/package/kernel/mac80211/patches/325-brcmfmac-pass-struct-brcmf_if-instance-in-brcmf_txfi.patch b/package/kernel/mac80211/patches/325-brcmfmac-pass-struct-brcmf_if-instance-in-brcmf_txfi.patch
  11823. new file mode 100644
  11824. index 0000000..23a7b6f
  11825. --- /dev/null
  11826. +++ b/package/kernel/mac80211/patches/325-brcmfmac-pass-struct-brcmf_if-instance-in-brcmf_txfi.patch
  11827. @@ -0,0 +1,122 @@
  11828. +From: Arend van Spriel <arend@broadcom.com>
  11829. +Date: Wed, 26 Aug 2015 22:14:59 +0200
  11830. +Subject: [PATCH] brcmfmac: pass struct brcmf_if instance in
  11831. + brcmf_txfinalize()
  11832. +
  11833. +Most call sites of brcmf_txfinalize already have struct brcmf_if
  11834. +instance so pass that to brcmf_txfinalize() as the function
  11835. +needs it anyway.
  11836. +
  11837. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  11838. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11839. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11840. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11841. +---
  11842. +
  11843. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  11844. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  11845. +@@ -560,17 +560,11 @@ void brcmf_rx_frame(struct device *dev,
  11846. + brcmf_netif_rx(ifp, skb);
  11847. + }
  11848. +
  11849. +-void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, u8 ifidx,
  11850. +- bool success)
  11851. ++void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success)
  11852. + {
  11853. +- struct brcmf_if *ifp;
  11854. + struct ethhdr *eh;
  11855. + u16 type;
  11856. +
  11857. +- ifp = drvr->iflist[ifidx];
  11858. +- if (!ifp)
  11859. +- goto done;
  11860. +-
  11861. + eh = (struct ethhdr *)(txp->data);
  11862. + type = ntohs(eh->h_proto);
  11863. +
  11864. +@@ -582,7 +576,7 @@ void brcmf_txfinalize(struct brcmf_pub *
  11865. +
  11866. + if (!success)
  11867. + ifp->stats.tx_errors++;
  11868. +-done:
  11869. ++
  11870. + brcmu_pkt_buf_free_skb(txp);
  11871. + }
  11872. +
  11873. +@@ -600,7 +594,7 @@ void brcmf_txcomplete(struct device *dev
  11874. + if (brcmf_proto_hdrpull(drvr, false, txp, &ifp))
  11875. + brcmu_pkt_buf_free_skb(txp);
  11876. + else
  11877. +- brcmf_txfinalize(drvr, txp, ifp->ifidx, success);
  11878. ++ brcmf_txfinalize(ifp, txp, success);
  11879. + }
  11880. + }
  11881. +
  11882. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  11883. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  11884. +@@ -210,8 +210,7 @@ void brcmf_remove_interface(struct brcmf
  11885. + int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  11886. + void brcmf_txflowblock_if(struct brcmf_if *ifp,
  11887. + enum brcmf_netif_stop_reason reason, bool state);
  11888. +-void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, u8 ifidx,
  11889. +- bool success);
  11890. ++void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  11891. + void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);
  11892. +
  11893. + /* Sets dongle media info (drv_version, mac address). */
  11894. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  11895. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  11896. +@@ -1506,7 +1506,7 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  11897. + ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
  11898. + genbit, seq);
  11899. + if (remove_from_hanger || ret)
  11900. +- brcmf_txfinalize(fws->drvr, skb, ifp->ifidx, true);
  11901. ++ brcmf_txfinalize(ifp, skb, true);
  11902. +
  11903. + return 0;
  11904. + }
  11905. +@@ -1905,7 +1905,7 @@ int brcmf_fws_process_skb(struct brcmf_i
  11906. + if (fws->avoid_queueing) {
  11907. + rc = brcmf_proto_txdata(drvr, ifp->ifidx, 0, skb);
  11908. + if (rc < 0)
  11909. +- brcmf_txfinalize(drvr, skb, ifp->ifidx, false);
  11910. ++ brcmf_txfinalize(ifp, skb, false);
  11911. + return rc;
  11912. + }
  11913. +
  11914. +@@ -1929,7 +1929,7 @@ int brcmf_fws_process_skb(struct brcmf_i
  11915. + brcmf_fws_schedule_deq(fws);
  11916. + } else {
  11917. + brcmf_err("drop skb: no hanger slot\n");
  11918. +- brcmf_txfinalize(drvr, skb, ifp->ifidx, false);
  11919. ++ brcmf_txfinalize(ifp, skb, false);
  11920. + rc = -ENOMEM;
  11921. + }
  11922. + brcmf_fws_unlock(fws);
  11923. +@@ -2009,8 +2009,9 @@ static void brcmf_fws_dequeue_worker(str
  11924. + ret = brcmf_proto_txdata(drvr, ifidx, 0, skb);
  11925. + brcmf_fws_lock(fws);
  11926. + if (ret < 0)
  11927. +- brcmf_txfinalize(drvr, skb, ifidx,
  11928. +- false);
  11929. ++ brcmf_txfinalize(brcmf_get_ifp(drvr,
  11930. ++ ifidx),
  11931. ++ skb, false);
  11932. + if (fws->bus_flow_blocked)
  11933. + break;
  11934. + }
  11935. +--- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  11936. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  11937. +@@ -873,7 +873,11 @@ brcmf_msgbuf_process_txstatus(struct brc
  11938. + commonring = msgbuf->flowrings[flowid];
  11939. + atomic_dec(&commonring->outstanding_tx);
  11940. +
  11941. +- brcmf_txfinalize(msgbuf->drvr, skb, tx_status->msg.ifidx, true);
  11942. ++ /* Hante: i believe this was a bug as tx_status->msg.ifidx was used
  11943. ++ * in brcmf_txfinalize as index in drvr->iflist. Can you confirm/deny?
  11944. ++ */
  11945. ++ brcmf_txfinalize(brcmf_get_ifp(msgbuf->drvr, tx_status->msg.ifidx),
  11946. ++ skb, true);
  11947. + }
  11948. +
  11949. +
  11950. 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
  11951. deleted file mode 100644
  11952. index a22cd1d..0000000
  11953. --- a/package/kernel/mac80211/patches/326-ath9k-use-one-shot-read-in-ath9k_hw_update_mibstats.patch
  11954. +++ /dev/null
  11955. @@ -1,39 +0,0 @@
  11956. -From: Oleksij Rempel <linux@rempel-privat.de>
  11957. -Date: Sun, 22 Mar 2015 19:29:53 +0100
  11958. -Subject: [PATCH] ath9k: use one shot read in ath9k_hw_update_mibstats
  11959. -
  11960. -this will reduce some overhead on usb bus.
  11961. -
  11962. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  11963. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11964. ----
  11965. -
  11966. ---- a/drivers/net/wireless/ath/ath9k/ani.c
  11967. -+++ b/drivers/net/wireless/ath/ath9k/ani.c
  11968. -@@ -107,11 +107,21 @@ static const struct ani_cck_level_entry
  11969. - static void ath9k_hw_update_mibstats(struct ath_hw *ah,
  11970. - struct ath9k_mib_stats *stats)
  11971. - {
  11972. -- stats->ackrcv_bad += REG_READ(ah, AR_ACK_FAIL);
  11973. -- stats->rts_bad += REG_READ(ah, AR_RTS_FAIL);
  11974. -- stats->fcs_bad += REG_READ(ah, AR_FCS_FAIL);
  11975. -- stats->rts_good += REG_READ(ah, AR_RTS_OK);
  11976. -- stats->beacons += REG_READ(ah, AR_BEACON_CNT);
  11977. -+ u32 addr[5] = {AR_RTS_OK, AR_RTS_FAIL, AR_ACK_FAIL,
  11978. -+ AR_FCS_FAIL, AR_BEACON_CNT};
  11979. -+ u32 data[5];
  11980. -+
  11981. -+ REG_READ_MULTI(ah, &addr[0], &data[0], 5);
  11982. -+ /* AR_RTS_OK */
  11983. -+ stats->rts_good += data[0];
  11984. -+ /* AR_RTS_FAIL */
  11985. -+ stats->rts_bad += data[1];
  11986. -+ /* AR_ACK_FAIL */
  11987. -+ stats->ackrcv_bad += data[2];
  11988. -+ /* AR_FCS_FAIL */
  11989. -+ stats->fcs_bad += data[3];
  11990. -+ /* AR_BEACON_CNT */
  11991. -+ stats->beacons += data[4];
  11992. - }
  11993. -
  11994. - static void ath9k_ani_restart(struct ath_hw *ah)
  11995. diff --git a/package/kernel/mac80211/patches/326-brcmfmac-add-mapping-for-interface-index-to-bsscfg-i.patch b/package/kernel/mac80211/patches/326-brcmfmac-add-mapping-for-interface-index-to-bsscfg-i.patch
  11996. new file mode 100644
  11997. index 0000000..8ddc0a6
  11998. --- /dev/null
  11999. +++ b/package/kernel/mac80211/patches/326-brcmfmac-add-mapping-for-interface-index-to-bsscfg-i.patch
  12000. @@ -0,0 +1,92 @@
  12001. +From: Arend van Spriel <arend@broadcom.com>
  12002. +Date: Wed, 26 Aug 2015 22:15:00 +0200
  12003. +Subject: [PATCH] brcmfmac: add mapping for interface index to bsscfg
  12004. + index
  12005. +
  12006. +Because the P2P Device interface in firmware uses the same interface
  12007. +index as the primary interface we use the bsscfg index as index in the
  12008. +struct brcmf_pub::iflist. However, in the data path we get the interface
  12009. +index and not the bsscfg index. So we need a mapping of interface index
  12010. +to bsscfg index, which can be determined upon handle adding the interface.
  12011. +
  12012. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  12013. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  12014. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12015. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12016. +---
  12017. +
  12018. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  12019. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  12020. +@@ -85,21 +85,20 @@ char *brcmf_ifname(struct brcmf_pub *drv
  12021. +
  12022. + struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx)
  12023. + {
  12024. ++ struct brcmf_if *ifp;
  12025. ++ s32 bssidx;
  12026. ++
  12027. + if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  12028. + brcmf_err("ifidx %d out of range\n", ifidx);
  12029. + return NULL;
  12030. + }
  12031. +
  12032. +- /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  12033. +- * events this is easy because it contains the bssidx which maps
  12034. +- * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  12035. +- * bssidx 1 is used for p2p0 and no data can be received or
  12036. +- * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  12037. +- */
  12038. +- if (ifidx)
  12039. +- ifidx++;
  12040. ++ ifp = NULL;
  12041. ++ bssidx = drvr->if2bss[ifidx];
  12042. ++ if (bssidx >= 0)
  12043. ++ ifp = drvr->iflist[bssidx];
  12044. +
  12045. +- return drvr->iflist[ifidx];
  12046. ++ return ifp;
  12047. + }
  12048. +
  12049. + static void _brcmf_set_multicast_list(struct work_struct *work)
  12050. +@@ -831,6 +830,8 @@ struct brcmf_if *brcmf_add_if(struct brc
  12051. +
  12052. + ifp = netdev_priv(ndev);
  12053. + ifp->ndev = ndev;
  12054. ++ /* store mapping ifidx to bssidx */
  12055. ++ drvr->if2bss[ifidx] = bssidx;
  12056. + }
  12057. +
  12058. + ifp->drvr = drvr;
  12059. +@@ -855,6 +856,7 @@ static void brcmf_del_if(struct brcmf_pu
  12060. + struct brcmf_if *ifp;
  12061. +
  12062. + ifp = drvr->iflist[bssidx];
  12063. ++ drvr->if2bss[ifp->ifidx] = -1;
  12064. + drvr->iflist[bssidx] = NULL;
  12065. + if (!ifp) {
  12066. + brcmf_err("Null interface, idx=%d\n", bssidx);
  12067. +@@ -862,6 +864,7 @@ static void brcmf_del_if(struct brcmf_pu
  12068. + }
  12069. + brcmf_dbg(TRACE, "Enter, idx=%d, ifidx=%d\n", bssidx, ifp->ifidx);
  12070. + if (ifp->ndev) {
  12071. ++ drvr->if2bss[ifp->ifidx] = -1;
  12072. + if (bssidx == 0) {
  12073. + if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) {
  12074. + rtnl_lock();
  12075. +@@ -926,6 +929,7 @@ int brcmf_attach(struct device *dev)
  12076. + if (!drvr)
  12077. + return -ENOMEM;
  12078. +
  12079. ++ memset(drvr->if2bss, 0xFF, sizeof(drvr->if2bss));
  12080. + mutex_init(&drvr->proto_block);
  12081. +
  12082. + /* Link to bus module */
  12083. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  12084. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  12085. +@@ -122,6 +122,7 @@ struct brcmf_pub {
  12086. + struct mac_address addresses[BRCMF_MAX_IFS];
  12087. +
  12088. + struct brcmf_if *iflist[BRCMF_MAX_IFS];
  12089. ++ s32 if2bss[BRCMF_MAX_IFS];
  12090. +
  12091. + struct mutex proto_block;
  12092. + unsigned char proto_buf[BRCMF_DCMD_MAXLEN];
  12093. 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
  12094. deleted file mode 100644
  12095. index e5a362f..0000000
  12096. --- a/package/kernel/mac80211/patches/327-ath9k-ath9k_hw_loadnf-use-REG_RMW.patch
  12097. +++ /dev/null
  12098. @@ -1,71 +0,0 @@
  12099. -From: Oleksij Rempel <linux@rempel-privat.de>
  12100. -Date: Sun, 22 Mar 2015 19:29:54 +0100
  12101. -Subject: [PATCH] ath9k: ath9k_hw_loadnf: use REG_RMW
  12102. -
  12103. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12104. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12105. ----
  12106. -
  12107. ---- a/drivers/net/wireless/ath/ath9k/calib.c
  12108. -+++ b/drivers/net/wireless/ath/ath9k/calib.c
  12109. -@@ -238,7 +238,6 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  12110. - {
  12111. - struct ath9k_nfcal_hist *h = NULL;
  12112. - unsigned i, j;
  12113. -- int32_t val;
  12114. - u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask;
  12115. - struct ath_common *common = ath9k_hw_common(ah);
  12116. - s16 default_nf = ath9k_hw_get_default_nf(ah, chan);
  12117. -@@ -246,6 +245,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  12118. - if (ah->caldata)
  12119. - h = ah->caldata->nfCalHist;
  12120. -
  12121. -+ ENABLE_REG_RMW_BUFFER(ah);
  12122. - for (i = 0; i < NUM_NF_READINGS; i++) {
  12123. - if (chainmask & (1 << i)) {
  12124. - s16 nfval;
  12125. -@@ -258,10 +258,8 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  12126. - else
  12127. - nfval = default_nf;
  12128. -
  12129. -- val = REG_READ(ah, ah->nf_regs[i]);
  12130. -- val &= 0xFFFFFE00;
  12131. -- val |= (((u32) nfval << 1) & 0x1ff);
  12132. -- REG_WRITE(ah, ah->nf_regs[i], val);
  12133. -+ REG_RMW(ah, ah->nf_regs[i],
  12134. -+ (((u32) nfval << 1) & 0x1ff), 0x1ff);
  12135. - }
  12136. - }
  12137. -
  12138. -@@ -274,6 +272,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  12139. - REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL,
  12140. - AR_PHY_AGC_CONTROL_NO_UPDATE_NF);
  12141. - REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
  12142. -+ REG_RMW_BUFFER_FLUSH(ah);
  12143. -
  12144. - /*
  12145. - * Wait for load to complete, should be fast, a few 10s of us.
  12146. -@@ -309,19 +308,17 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  12147. - * by the median we just loaded. This will be initial (and max) value
  12148. - * of next noise floor calibration the baseband does.
  12149. - */
  12150. -- ENABLE_REGWRITE_BUFFER(ah);
  12151. -+ ENABLE_REG_RMW_BUFFER(ah);
  12152. - for (i = 0; i < NUM_NF_READINGS; i++) {
  12153. - if (chainmask & (1 << i)) {
  12154. - if ((i >= AR5416_MAX_CHAINS) && !IS_CHAN_HT40(chan))
  12155. - continue;
  12156. -
  12157. -- val = REG_READ(ah, ah->nf_regs[i]);
  12158. -- val &= 0xFFFFFE00;
  12159. -- val |= (((u32) (-50) << 1) & 0x1ff);
  12160. -- REG_WRITE(ah, ah->nf_regs[i], val);
  12161. -+ REG_RMW(ah, ah->nf_regs[i],
  12162. -+ (((u32) (-50) << 1) & 0x1ff), 0x1ff);
  12163. - }
  12164. - }
  12165. -- REGWRITE_BUFFER_FLUSH(ah);
  12166. -+ REG_RMW_BUFFER_FLUSH(ah);
  12167. -
  12168. - return 0;
  12169. - }
  12170. diff --git a/package/kernel/mac80211/patches/327-brcmfmac-add-dedicated-debug-level-for-firmware-cons.patch b/package/kernel/mac80211/patches/327-brcmfmac-add-dedicated-debug-level-for-firmware-cons.patch
  12171. new file mode 100644
  12172. index 0000000..a0a798b
  12173. --- /dev/null
  12174. +++ b/package/kernel/mac80211/patches/327-brcmfmac-add-dedicated-debug-level-for-firmware-cons.patch
  12175. @@ -0,0 +1,103 @@
  12176. +From: Arend van Spriel <arend@broadcom.com>
  12177. +Date: Wed, 26 Aug 2015 22:15:01 +0200
  12178. +Subject: [PATCH] brcmfmac: add dedicated debug level for firmware
  12179. + console logging
  12180. +
  12181. +Both PCIe and SDIO devices have the possibility to log the firmware
  12182. +console output in kernel log. For PCIe it is logged when PCIE debug
  12183. +level is enabled. For SDIO it is logged when user specifies a non-zero
  12184. +console interval through debugfs. This patch tries to make it a
  12185. +bit more consistent. The firmware console output is only logged when
  12186. +FWCON debug level is enabled.
  12187. +
  12188. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  12189. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  12190. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12191. +Reviewed-by: Pontus Fuchs <pontusf@broadcom.com>
  12192. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12193. +---
  12194. +
  12195. +--- a/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  12196. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  12197. +@@ -37,6 +37,7 @@
  12198. + #define BRCMF_SDIO_VAL 0x00020000
  12199. + #define BRCMF_MSGBUF_VAL 0x00040000
  12200. + #define BRCMF_PCIE_VAL 0x00080000
  12201. ++#define BRCMF_FWCON_VAL 0x00100000
  12202. +
  12203. + /* set default print format */
  12204. + #undef pr_fmt
  12205. +@@ -78,6 +79,7 @@ do { \
  12206. + #define BRCMF_GLOM_ON() (brcmf_msg_level & BRCMF_GLOM_VAL)
  12207. + #define BRCMF_EVENT_ON() (brcmf_msg_level & BRCMF_EVENT_VAL)
  12208. + #define BRCMF_FIL_ON() (brcmf_msg_level & BRCMF_FIL_VAL)
  12209. ++#define BRCMF_FWCON_ON() (brcmf_msg_level & BRCMF_FWCON_VAL)
  12210. +
  12211. + #else /* defined(DEBUG) || defined(CPTCFG_BRCM_TRACING) */
  12212. +
  12213. +@@ -90,6 +92,7 @@ do { \
  12214. + #define BRCMF_GLOM_ON() 0
  12215. + #define BRCMF_EVENT_ON() 0
  12216. + #define BRCMF_FIL_ON() 0
  12217. ++#define BRCMF_FWCON_ON() 0
  12218. +
  12219. + #endif /* defined(DEBUG) || defined(CPTCFG_BRCM_TRACING) */
  12220. +
  12221. +--- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  12222. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  12223. +@@ -644,7 +644,7 @@ static void brcmf_pcie_bus_console_init(
  12224. + addr = console->base_addr + BRCMF_CONSOLE_BUFSIZE_OFFSET;
  12225. + console->bufsize = brcmf_pcie_read_tcm32(devinfo, addr);
  12226. +
  12227. +- brcmf_dbg(PCIE, "Console: base %x, buf %x, size %d\n",
  12228. ++ brcmf_dbg(FWCON, "Console: base %x, buf %x, size %d\n",
  12229. + console->base_addr, console->buf_addr, console->bufsize);
  12230. + }
  12231. +
  12232. +@@ -656,6 +656,9 @@ static void brcmf_pcie_bus_console_read(
  12233. + u8 ch;
  12234. + u32 newidx;
  12235. +
  12236. ++ if (!BRCMF_FWCON_ON())
  12237. ++ return;
  12238. ++
  12239. + console = &devinfo->shared.console;
  12240. + addr = console->base_addr + BRCMF_CONSOLE_WRITEIDX_OFFSET;
  12241. + newidx = brcmf_pcie_read_tcm32(devinfo, addr);
  12242. +@@ -677,7 +680,7 @@ static void brcmf_pcie_bus_console_read(
  12243. + }
  12244. + if (ch == '\n') {
  12245. + console->log_str[console->log_idx] = 0;
  12246. +- brcmf_dbg(PCIE, "CONSOLE: %s", console->log_str);
  12247. ++ pr_debug("CONSOLE: %s", console->log_str);
  12248. + console->log_idx = 0;
  12249. + }
  12250. + }
  12251. +--- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  12252. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  12253. +@@ -123,6 +123,7 @@ struct rte_console {
  12254. +
  12255. + #define BRCMF_FIRSTREAD (1 << 6)
  12256. +
  12257. ++#define BRCMF_CONSOLE 10 /* watchdog interval to poll console */
  12258. +
  12259. + /* SBSDIO_DEVICE_CTL */
  12260. +
  12261. +@@ -3204,6 +3205,8 @@ static void brcmf_sdio_debugfs_create(st
  12262. + if (IS_ERR_OR_NULL(dentry))
  12263. + return;
  12264. +
  12265. ++ bus->console_interval = BRCMF_CONSOLE;
  12266. ++
  12267. + brcmf_debugfs_add_entry(drvr, "forensics", brcmf_sdio_forensic_read);
  12268. + brcmf_debugfs_add_entry(drvr, "counters",
  12269. + brcmf_debugfs_sdio_count_read);
  12270. +@@ -3613,7 +3616,7 @@ static void brcmf_sdio_bus_watchdog(stru
  12271. + }
  12272. + #ifdef DEBUG
  12273. + /* Poll for console output periodically */
  12274. +- if (bus->sdiodev->state == BRCMF_SDIOD_DATA &&
  12275. ++ if (bus->sdiodev->state == BRCMF_SDIOD_DATA && BRCMF_FWCON_ON() &&
  12276. + bus->console_interval != 0) {
  12277. + bus->console.count += BRCMF_WD_POLL_MS;
  12278. + if (bus->console.count >= bus->console_interval) {
  12279. 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
  12280. deleted file mode 100644
  12281. index 01c8011..0000000
  12282. --- a/package/kernel/mac80211/patches/328-ath9k-write-buffer-related-optimisation-in-ar5008_hw.patch
  12283. +++ /dev/null
  12284. @@ -1,27 +0,0 @@
  12285. -From: Oleksij Rempel <linux@rempel-privat.de>
  12286. -Date: Sun, 22 Mar 2015 19:29:55 +0100
  12287. -Subject: [PATCH] ath9k: write buffer related optimisation in
  12288. - ar5008_hw_set_channel_regs
  12289. -
  12290. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12291. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12292. ----
  12293. -
  12294. ---- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  12295. -+++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  12296. -@@ -681,12 +681,13 @@ static void ar5008_hw_set_channel_regs(s
  12297. - phymode |= AR_PHY_FC_DYN2040_PRI_CH;
  12298. -
  12299. - }
  12300. -+ ENABLE_REGWRITE_BUFFER(ah);
  12301. - REG_WRITE(ah, AR_PHY_TURBO, phymode);
  12302. -
  12303. -+ /* This function do only REG_WRITE, so
  12304. -+ * we can include it to REGWRITE_BUFFER. */
  12305. - ath9k_hw_set11nmac2040(ah, chan);
  12306. -
  12307. -- ENABLE_REGWRITE_BUFFER(ah);
  12308. --
  12309. - REG_WRITE(ah, AR_GTXTO, 25 << AR_GTXTO_TIMEOUT_LIMIT_S);
  12310. - REG_WRITE(ah, AR_CST, 0xF << AR_CST_TIMEOUT_LIMIT_S);
  12311. -
  12312. diff --git a/package/kernel/mac80211/patches/328-brcmfmac-remove-ifidx-parameter-from-brcmf_fws_txsta.patch b/package/kernel/mac80211/patches/328-brcmfmac-remove-ifidx-parameter-from-brcmf_fws_txsta.patch
  12313. new file mode 100644
  12314. index 0000000..53e7ede
  12315. --- /dev/null
  12316. +++ b/package/kernel/mac80211/patches/328-brcmfmac-remove-ifidx-parameter-from-brcmf_fws_txsta.patch
  12317. @@ -0,0 +1,34 @@
  12318. +From: Arend van Spriel <arend@broadcom.com>
  12319. +Date: Wed, 26 Aug 2015 22:15:02 +0200
  12320. +Subject: [PATCH] brcmfmac: remove ifidx parameter from
  12321. + brcmf_fws_txstatus_suppressed()
  12322. +
  12323. +The brcmf_fws_txstatus_suppressed() function prototype specifies an
  12324. +ifidx parameter which is not used within the function implementation.
  12325. +
  12326. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  12327. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  12328. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12329. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12330. +---
  12331. +
  12332. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  12333. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  12334. +@@ -1398,7 +1398,7 @@ done:
  12335. + }
  12336. +
  12337. + static int brcmf_fws_txstatus_suppressed(struct brcmf_fws_info *fws, int fifo,
  12338. +- struct sk_buff *skb, u8 ifidx,
  12339. ++ struct sk_buff *skb,
  12340. + u32 genbit, u16 seq)
  12341. + {
  12342. + struct brcmf_fws_mac_descriptor *entry = brcmf_skbcb(skb)->mac;
  12343. +@@ -1503,7 +1503,7 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  12344. + return -EINVAL;
  12345. + }
  12346. + if (!remove_from_hanger)
  12347. +- ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
  12348. ++ ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb,
  12349. + genbit, seq);
  12350. + if (remove_from_hanger || ret)
  12351. + brcmf_txfinalize(ifp, skb, true);
  12352. 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
  12353. deleted file mode 100644
  12354. index e5219f2..0000000
  12355. --- a/package/kernel/mac80211/patches/329-ath9k-ath9k_hw_set_4k_power_cal_tabl-use-rmw-buffer.patch
  12356. +++ /dev/null
  12357. @@ -1,26 +0,0 @@
  12358. -From: Oleksij Rempel <linux@rempel-privat.de>
  12359. -Date: Sun, 22 Mar 2015 19:29:56 +0100
  12360. -Subject: [PATCH] ath9k: ath9k_hw_set_4k_power_cal_tabl: use rmw buffer
  12361. -
  12362. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12363. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12364. ----
  12365. -
  12366. ---- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  12367. -+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  12368. -@@ -389,6 +389,7 @@ static void ath9k_hw_set_4k_power_cal_ta
  12369. - }
  12370. - }
  12371. -
  12372. -+ ENABLE_REG_RMW_BUFFER(ah);
  12373. - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_NUM_PD_GAIN,
  12374. - (numXpdGain - 1) & 0x3);
  12375. - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_1,
  12376. -@@ -396,6 +397,7 @@ static void ath9k_hw_set_4k_power_cal_ta
  12377. - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_2,
  12378. - xpdGainValues[1]);
  12379. - REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_3, 0);
  12380. -+ REG_RMW_BUFFER_FLUSH(ah);
  12381. -
  12382. - for (i = 0; i < AR5416_EEP4K_MAX_CHAINS; i++) {
  12383. - regChainOffset = i * 0x1000;
  12384. diff --git a/package/kernel/mac80211/patches/329-brcmfmac-change-prototype-for-brcmf_fws_hdrpull.patch b/package/kernel/mac80211/patches/329-brcmfmac-change-prototype-for-brcmf_fws_hdrpull.patch
  12385. new file mode 100644
  12386. index 0000000..bb05235
  12387. --- /dev/null
  12388. +++ b/package/kernel/mac80211/patches/329-brcmfmac-change-prototype-for-brcmf_fws_hdrpull.patch
  12389. @@ -0,0 +1,97 @@
  12390. +From: Arend van Spriel <arend@broadcom.com>
  12391. +Date: Wed, 26 Aug 2015 22:15:03 +0200
  12392. +Subject: [PATCH] brcmfmac: change prototype for brcmf_fws_hdrpull()
  12393. +
  12394. +Instead of passing ifidx and drvr just pass struct brcmf_if pointer
  12395. +which holds both parameters.
  12396. +
  12397. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  12398. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  12399. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12400. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12401. +---
  12402. +
  12403. +--- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  12404. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  12405. +@@ -312,8 +312,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  12406. +
  12407. + skb_pull(pktbuf, BCDC_HEADER_LEN);
  12408. + if (do_fws)
  12409. +- brcmf_fws_hdrpull(drvr, tmp_if->ifidx, h->data_offset << 2,
  12410. +- pktbuf);
  12411. ++ brcmf_fws_hdrpull(tmp_if, h->data_offset << 2, pktbuf);
  12412. + else
  12413. + skb_pull(pktbuf, h->data_offset << 2);
  12414. +
  12415. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  12416. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  12417. +@@ -1616,11 +1616,10 @@ static int brcmf_fws_notify_bcmc_credit_
  12418. + return 0;
  12419. + }
  12420. +
  12421. +-int brcmf_fws_hdrpull(struct brcmf_pub *drvr, int ifidx, s16 signal_len,
  12422. +- struct sk_buff *skb)
  12423. ++void brcmf_fws_hdrpull(struct brcmf_if *ifp, s16 siglen, struct sk_buff *skb)
  12424. + {
  12425. + struct brcmf_skb_reorder_data *rd;
  12426. +- struct brcmf_fws_info *fws = drvr->fws;
  12427. ++ struct brcmf_fws_info *fws = ifp->drvr->fws;
  12428. + u8 *signal_data;
  12429. + s16 data_len;
  12430. + u8 type;
  12431. +@@ -1630,20 +1629,20 @@ int brcmf_fws_hdrpull(struct brcmf_pub *
  12432. + s32 err;
  12433. +
  12434. + brcmf_dbg(HDRS, "enter: ifidx %d, skblen %u, sig %d\n",
  12435. +- ifidx, skb->len, signal_len);
  12436. ++ ifp->ifidx, skb->len, siglen);
  12437. +
  12438. +- WARN_ON(signal_len > skb->len);
  12439. ++ WARN_ON(siglen > skb->len);
  12440. +
  12441. +- if (!signal_len)
  12442. +- return 0;
  12443. ++ if (!siglen)
  12444. ++ return;
  12445. + /* if flow control disabled, skip to packet data and leave */
  12446. + if ((!fws) || (!fws->fw_signals)) {
  12447. +- skb_pull(skb, signal_len);
  12448. +- return 0;
  12449. ++ skb_pull(skb, siglen);
  12450. ++ return;
  12451. + }
  12452. +
  12453. + fws->stats.header_pulls++;
  12454. +- data_len = signal_len;
  12455. ++ data_len = siglen;
  12456. + signal_data = skb->data;
  12457. +
  12458. + status = BRCMF_FWS_RET_OK_NOSCHEDULE;
  12459. +@@ -1731,14 +1730,12 @@ int brcmf_fws_hdrpull(struct brcmf_pub *
  12460. + /* signalling processing result does
  12461. + * not affect the actual ethernet packet.
  12462. + */
  12463. +- skb_pull(skb, signal_len);
  12464. ++ skb_pull(skb, siglen);
  12465. +
  12466. + /* this may be a signal-only packet
  12467. + */
  12468. + if (skb->len == 0)
  12469. + fws->stats.header_only_pkt++;
  12470. +-
  12471. +- return 0;
  12472. + }
  12473. +
  12474. + static u8 brcmf_fws_precommit_skb(struct brcmf_fws_info *fws, int fifo,
  12475. +--- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.h
  12476. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.h
  12477. +@@ -21,8 +21,7 @@
  12478. + int brcmf_fws_init(struct brcmf_pub *drvr);
  12479. + void brcmf_fws_deinit(struct brcmf_pub *drvr);
  12480. + bool brcmf_fws_fc_active(struct brcmf_fws_info *fws);
  12481. +-int brcmf_fws_hdrpull(struct brcmf_pub *drvr, int ifidx, s16 signal_len,
  12482. +- struct sk_buff *skb);
  12483. ++void brcmf_fws_hdrpull(struct brcmf_if *ifp, s16 siglen, struct sk_buff *skb);
  12484. + int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb);
  12485. +
  12486. + void brcmf_fws_reset_interface(struct brcmf_if *ifp);
  12487. 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
  12488. deleted file mode 100644
  12489. index 6ce3f40..0000000
  12490. --- a/package/kernel/mac80211/patches/330-ath9k-use-rmw-buffer-in-ath9k_hw_set_operating_mode-.patch
  12491. +++ /dev/null
  12492. @@ -1,43 +0,0 @@
  12493. -From: Oleksij Rempel <linux@rempel-privat.de>
  12494. -Date: Sun, 22 Mar 2015 19:29:57 +0100
  12495. -Subject: [PATCH] ath9k: use rmw buffer in ath9k_hw_set_operating_mode
  12496. - and ath9k_hw_reset
  12497. -
  12498. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12499. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12500. ----
  12501. -
  12502. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  12503. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  12504. -@@ -1227,6 +1227,7 @@ static void ath9k_hw_set_operating_mode(
  12505. - u32 mask = AR_STA_ID1_STA_AP | AR_STA_ID1_ADHOC;
  12506. - u32 set = AR_STA_ID1_KSRCH_MODE;
  12507. -
  12508. -+ ENABLE_REG_RMW_BUFFER(ah);
  12509. - switch (opmode) {
  12510. - case NL80211_IFTYPE_ADHOC:
  12511. - if (!AR_SREV_9340_13(ah)) {
  12512. -@@ -1248,6 +1249,7 @@ static void ath9k_hw_set_operating_mode(
  12513. - break;
  12514. - }
  12515. - REG_RMW(ah, AR_STA_ID1, set, mask);
  12516. -+ REG_RMW_BUFFER_FLUSH(ah);
  12517. - }
  12518. -
  12519. - void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled,
  12520. -@@ -1960,6 +1962,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  12521. - if (!ath9k_hw_mci_is_enabled(ah))
  12522. - REG_WRITE(ah, AR_OBS, 8);
  12523. -
  12524. -+ ENABLE_REG_RMW_BUFFER(ah);
  12525. - if (ah->config.rx_intr_mitigation) {
  12526. - REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_LAST, ah->config.rimt_last);
  12527. - REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_FIRST, ah->config.rimt_first);
  12528. -@@ -1969,6 +1972,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  12529. - REG_RMW_FIELD(ah, AR_TIMT, AR_TIMT_LAST, 300);
  12530. - REG_RMW_FIELD(ah, AR_TIMT, AR_TIMT_FIRST, 750);
  12531. - }
  12532. -+ REG_RMW_BUFFER_FLUSH(ah);
  12533. -
  12534. - ath9k_hw_init_bb(ah, chan);
  12535. -
  12536. diff --git a/package/kernel/mac80211/patches/330-brcmfmac-introduce-brcmf_net_detach-function.patch b/package/kernel/mac80211/patches/330-brcmfmac-introduce-brcmf_net_detach-function.patch
  12537. new file mode 100644
  12538. index 0000000..0651a2f
  12539. --- /dev/null
  12540. +++ b/package/kernel/mac80211/patches/330-brcmfmac-introduce-brcmf_net_detach-function.patch
  12541. @@ -0,0 +1,99 @@
  12542. +From: Arend van Spriel <arend@broadcom.com>
  12543. +Date: Wed, 26 Aug 2015 22:15:04 +0200
  12544. +Subject: [PATCH] brcmfmac: introduce brcmf_net_detach() function
  12545. +
  12546. +In case of error during brcmf_bus_start() the network interfaces were
  12547. +freed using free_netdev(). However, the interfaces may have additional
  12548. +memory allocated which is not freed. The netdev has destructor set to
  12549. +brcmf_cfg80211_free_netdev() which frees the additional memory if
  12550. +allocated and call free_netdev(). The brcmf_net_detach() either calls
  12551. +brcmf_cfg80211_free_netdev() directly or uses unregister_netdev() when
  12552. +struct net_device::reg_state indicates the netdev was registered.
  12553. +
  12554. +Reported-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  12555. +Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  12556. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  12557. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12558. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12559. +---
  12560. +
  12561. +--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  12562. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  12563. +@@ -4747,7 +4747,8 @@ void brcmf_cfg80211_free_netdev(struct n
  12564. + ifp = netdev_priv(ndev);
  12565. + vif = ifp->vif;
  12566. +
  12567. +- brcmf_free_vif(vif);
  12568. ++ if (vif)
  12569. ++ brcmf_free_vif(vif);
  12570. + free_netdev(ndev);
  12571. + }
  12572. +
  12573. +--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  12574. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  12575. +@@ -718,8 +718,6 @@ int brcmf_net_attach(struct brcmf_if *if
  12576. + }
  12577. +
  12578. + brcmf_dbg(INFO, "%s: Broadcom Dongle Host Driver\n", ndev->name);
  12579. +-
  12580. +- ndev->destructor = brcmf_cfg80211_free_netdev;
  12581. + return 0;
  12582. +
  12583. + fail:
  12584. +@@ -729,6 +727,14 @@ fail:
  12585. + return -EBADE;
  12586. + }
  12587. +
  12588. ++static void brcmf_net_detach(struct net_device *ndev)
  12589. ++{
  12590. ++ if (ndev->reg_state == NETREG_REGISTERED)
  12591. ++ unregister_netdev(ndev);
  12592. ++ else
  12593. ++ brcmf_cfg80211_free_netdev(ndev);
  12594. ++}
  12595. ++
  12596. + static int brcmf_net_p2p_open(struct net_device *ndev)
  12597. + {
  12598. + brcmf_dbg(TRACE, "Enter\n");
  12599. +@@ -805,8 +811,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  12600. + ifp->ndev->name);
  12601. + if (ifidx) {
  12602. + netif_stop_queue(ifp->ndev);
  12603. +- unregister_netdev(ifp->ndev);
  12604. +- free_netdev(ifp->ndev);
  12605. ++ brcmf_net_detach(ifp->ndev);
  12606. + drvr->iflist[bssidx] = NULL;
  12607. + } else {
  12608. + brcmf_err("ignore IF event\n");
  12609. +@@ -828,6 +833,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  12610. + if (!ndev)
  12611. + return ERR_PTR(-ENOMEM);
  12612. +
  12613. ++ ndev->destructor = brcmf_cfg80211_free_netdev;
  12614. + ifp = netdev_priv(ndev);
  12615. + ifp->ndev = ndev;
  12616. + /* store mapping ifidx to bssidx */
  12617. +@@ -879,8 +885,7 @@ static void brcmf_del_if(struct brcmf_pu
  12618. + cancel_work_sync(&ifp->setmacaddr_work);
  12619. + cancel_work_sync(&ifp->multicast_work);
  12620. + }
  12621. +- /* unregister will take care of freeing it */
  12622. +- unregister_netdev(ifp->ndev);
  12623. ++ brcmf_net_detach(ifp->ndev);
  12624. + }
  12625. + }
  12626. +
  12627. +@@ -1056,11 +1061,11 @@ fail:
  12628. + brcmf_fws_deinit(drvr);
  12629. + }
  12630. + if (drvr->iflist[0]) {
  12631. +- free_netdev(ifp->ndev);
  12632. ++ brcmf_net_detach(ifp->ndev);
  12633. + drvr->iflist[0] = NULL;
  12634. + }
  12635. + if (p2p_ifp) {
  12636. +- free_netdev(p2p_ifp->ndev);
  12637. ++ brcmf_net_detach(p2p_ifp->ndev);
  12638. + drvr->iflist[1] = NULL;
  12639. + }
  12640. + return ret;
  12641. 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
  12642. deleted file mode 100644
  12643. index edd6160..0000000
  12644. --- a/package/kernel/mac80211/patches/331-ath9k-ath9k_hw_4k_set_board_values-use-rmw-buffer.patch
  12645. +++ /dev/null
  12646. @@ -1,26 +0,0 @@
  12647. -From: Oleksij Rempel <linux@rempel-privat.de>
  12648. -Date: Sun, 22 Mar 2015 19:29:58 +0100
  12649. -Subject: [PATCH] ath9k: ath9k_hw_4k_set_board_values: use rmw buffer
  12650. -
  12651. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12652. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12653. ----
  12654. -
  12655. ---- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  12656. -+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  12657. -@@ -1082,6 +1082,7 @@ static void ath9k_hw_4k_set_board_values
  12658. - mask = BIT(0)|BIT(5)|BIT(10)|BIT(15)|BIT(20)|BIT(25);
  12659. - pwrctrl = mask * bb_desired_scale;
  12660. - clr = mask * 0x1f;
  12661. -+ ENABLE_REG_RMW_BUFFER(ah);
  12662. - REG_RMW(ah, AR_PHY_TX_PWRCTRL8, pwrctrl, clr);
  12663. - REG_RMW(ah, AR_PHY_TX_PWRCTRL10, pwrctrl, clr);
  12664. - REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL12, pwrctrl, clr);
  12665. -@@ -1096,6 +1097,7 @@ static void ath9k_hw_4k_set_board_values
  12666. - clr = mask * 0x1f;
  12667. - REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL11, pwrctrl, clr);
  12668. - REG_RMW(ah, AR_PHY_CH0_TX_PWRCTRL13, pwrctrl, clr);
  12669. -+ REG_RMW_BUFFER_FLUSH(ah);
  12670. - }
  12671. - }
  12672. -
  12673. diff --git a/package/kernel/mac80211/patches/331-brcmfmac-Reset-PCIE-devices-after-recognition.patch b/package/kernel/mac80211/patches/331-brcmfmac-Reset-PCIE-devices-after-recognition.patch
  12674. new file mode 100644
  12675. index 0000000..5a7e447
  12676. --- /dev/null
  12677. +++ b/package/kernel/mac80211/patches/331-brcmfmac-Reset-PCIE-devices-after-recognition.patch
  12678. @@ -0,0 +1,193 @@
  12679. +From: Hante Meuleman <meuleman@broadcom.com>
  12680. +Date: Thu, 27 Aug 2015 16:14:06 +0200
  12681. +Subject: [PATCH] brcmfmac: Reset PCIE devices after recognition.
  12682. +
  12683. +When PCIE type devices are being FW reloaded without being properly
  12684. +reset then the device ends up in a locked state, requiring the
  12685. +device to be completely powered down. This patch adds a reset
  12686. +through watchdog at the moment the device (cores) has been
  12687. +recognized. This will solve warm reboot issues.
  12688. +
  12689. +Cc: Rafal Milecki <zajec5@gmail.com>
  12690. +Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  12691. +Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  12692. +Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  12693. +Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  12694. +Signed-off-by: Arend van Spriel <arend@broadcom.com>
  12695. +---
  12696. +
  12697. +--- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  12698. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  12699. +@@ -101,6 +101,9 @@
  12700. + /* ARM Cortex M3 core, ID 0x82a */
  12701. + #define BCM4329_CORE_ARM_BASE 0x18002000
  12702. +
  12703. ++/* Max possibly supported memory size (limited by IO mapped memory) */
  12704. ++#define BRCMF_CHIP_MAX_MEMSIZE (4 * 1024 * 1024)
  12705. ++
  12706. + #define CORE_SB(base, field) \
  12707. + (base + SBCONFIGOFF + offsetof(struct sbconfig, field))
  12708. + #define SBCOREREV(sbidh) \
  12709. +@@ -687,6 +690,12 @@ static int brcmf_chip_get_raminfo(struct
  12710. + brcmf_err("RAM size is undetermined\n");
  12711. + return -ENOMEM;
  12712. + }
  12713. ++
  12714. ++ if (ci->pub.ramsize > BRCMF_CHIP_MAX_MEMSIZE) {
  12715. ++ brcmf_err("RAM size is incorrect\n");
  12716. ++ return -ENOMEM;
  12717. ++ }
  12718. ++
  12719. + return 0;
  12720. + }
  12721. +
  12722. +@@ -899,6 +908,15 @@ static int brcmf_chip_recognition(struct
  12723. +
  12724. + /* assure chip is passive for core access */
  12725. + brcmf_chip_set_passive(&ci->pub);
  12726. ++
  12727. ++ /* Call bus specific reset function now. Cores have been determined
  12728. ++ * but further access may require a chip specific reset at this point.
  12729. ++ */
  12730. ++ if (ci->ops->reset) {
  12731. ++ ci->ops->reset(ci->ctx, &ci->pub);
  12732. ++ brcmf_chip_set_passive(&ci->pub);
  12733. ++ }
  12734. ++
  12735. + return brcmf_chip_get_raminfo(ci);
  12736. + }
  12737. +
  12738. +--- a/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  12739. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  12740. +@@ -73,6 +73,7 @@ struct brcmf_buscore_ops {
  12741. + u32 (*read32)(void *ctx, u32 addr);
  12742. + void (*write32)(void *ctx, u32 addr, u32 value);
  12743. + int (*prepare)(void *ctx);
  12744. ++ int (*reset)(void *ctx, struct brcmf_chip *chip);
  12745. + int (*setup)(void *ctx, struct brcmf_chip *chip);
  12746. + void (*activate)(void *ctx, struct brcmf_chip *chip, u32 rstvec);
  12747. + };
  12748. +--- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  12749. ++++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  12750. +@@ -74,6 +74,8 @@ enum brcmf_pcie_state {
  12751. + #define BRCMF_PCIE_REG_INTMASK 0x94
  12752. + #define BRCMF_PCIE_REG_SBMBX 0x98
  12753. +
  12754. ++#define BRCMF_PCIE_REG_LINK_STATUS_CTRL 0xBC
  12755. ++
  12756. + #define BRCMF_PCIE_PCIE2REG_INTMASK 0x24
  12757. + #define BRCMF_PCIE_PCIE2REG_MAILBOXINT 0x48
  12758. + #define BRCMF_PCIE_PCIE2REG_MAILBOXMASK 0x4C
  12759. +@@ -466,6 +468,7 @@ brcmf_pcie_select_core(struct brcmf_pcie
  12760. +
  12761. + static void brcmf_pcie_reset_device(struct brcmf_pciedev_info *devinfo)
  12762. + {
  12763. ++ struct brcmf_core *core;
  12764. + u16 cfg_offset[] = { BRCMF_PCIE_CFGREG_STATUS_CMD,
  12765. + BRCMF_PCIE_CFGREG_PM_CSR,
  12766. + BRCMF_PCIE_CFGREG_MSI_CAP,
  12767. +@@ -484,32 +487,38 @@ static void brcmf_pcie_reset_device(stru
  12768. + if (!devinfo->ci)
  12769. + return;
  12770. +
  12771. ++ /* Disable ASPM */
  12772. + brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  12773. +- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  12774. +- BRCMF_PCIE_CFGREG_LINK_STATUS_CTRL);
  12775. +- lsc = brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA);
  12776. ++ pci_read_config_dword(devinfo->pdev, BRCMF_PCIE_REG_LINK_STATUS_CTRL,
  12777. ++ &lsc);
  12778. + val = lsc & (~BRCMF_PCIE_LINK_STATUS_CTRL_ASPM_ENAB);
  12779. +- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA, val);
  12780. ++ pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_LINK_STATUS_CTRL,
  12781. ++ val);
  12782. +
  12783. ++ /* Watchdog reset */
  12784. + brcmf_pcie_select_core(devinfo, BCMA_CORE_CHIPCOMMON);
  12785. + WRITECC32(devinfo, watchdog, 4);
  12786. + msleep(100);
  12787. +
  12788. ++ /* Restore ASPM */
  12789. + brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  12790. +- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  12791. +- BRCMF_PCIE_CFGREG_LINK_STATUS_CTRL);
  12792. +- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA, lsc);
  12793. ++ pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_LINK_STATUS_CTRL,
  12794. ++ lsc);
  12795. +
  12796. +- brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  12797. +- for (i = 0; i < ARRAY_SIZE(cfg_offset); i++) {
  12798. +- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  12799. +- cfg_offset[i]);
  12800. +- val = brcmf_pcie_read_reg32(devinfo,
  12801. +- BRCMF_PCIE_PCIE2REG_CONFIGDATA);
  12802. +- brcmf_dbg(PCIE, "config offset 0x%04x, value 0x%04x\n",
  12803. +- cfg_offset[i], val);
  12804. +- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA,
  12805. +- val);
  12806. ++ core = brcmf_chip_get_core(devinfo->ci, BCMA_CORE_PCIE2);
  12807. ++ if (core->rev <= 13) {
  12808. ++ for (i = 0; i < ARRAY_SIZE(cfg_offset); i++) {
  12809. ++ brcmf_pcie_write_reg32(devinfo,
  12810. ++ BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  12811. ++ cfg_offset[i]);
  12812. ++ val = brcmf_pcie_read_reg32(devinfo,
  12813. ++ BRCMF_PCIE_PCIE2REG_CONFIGDATA);
  12814. ++ brcmf_dbg(PCIE, "config offset 0x%04x, value 0x%04x\n",
  12815. ++ cfg_offset[i], val);
  12816. ++ brcmf_pcie_write_reg32(devinfo,
  12817. ++ BRCMF_PCIE_PCIE2REG_CONFIGDATA,
  12818. ++ val);
  12819. ++ }
  12820. + }
  12821. + }
  12822. +
  12823. +@@ -519,8 +528,6 @@ static void brcmf_pcie_attach(struct brc
  12824. + u32 config;
  12825. +
  12826. + brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  12827. +- if (brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_INTMASK) != 0)
  12828. +- brcmf_pcie_reset_device(devinfo);
  12829. + /* BAR1 window may not be sized properly */
  12830. + brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  12831. + brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR, 0x4e0);
  12832. +@@ -1636,6 +1643,23 @@ static int brcmf_pcie_buscoreprep(void *
  12833. + }
  12834. +
  12835. +
  12836. ++static int brcmf_pcie_buscore_reset(void *ctx, struct brcmf_chip *chip)
  12837. ++{
  12838. ++ struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)ctx;
  12839. ++ u32 val;
  12840. ++
  12841. ++ devinfo->ci = chip;
  12842. ++ brcmf_pcie_reset_device(devinfo);
  12843. ++
  12844. ++ val = brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT);
  12845. ++ if (val != 0xffffffff)
  12846. ++ brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT,
  12847. ++ val);
  12848. ++
  12849. ++ return 0;
  12850. ++}
  12851. ++
  12852. ++
  12853. + static void brcmf_pcie_buscore_activate(void *ctx, struct brcmf_chip *chip,
  12854. + u32 rstvec)
  12855. + {
  12856. +@@ -1647,6 +1671,7 @@ static void brcmf_pcie_buscore_activate(
  12857. +
  12858. + static const struct brcmf_buscore_ops brcmf_pcie_buscore_ops = {
  12859. + .prepare = brcmf_pcie_buscoreprep,
  12860. ++ .reset = brcmf_pcie_buscore_reset,
  12861. + .activate = brcmf_pcie_buscore_activate,
  12862. + .read32 = brcmf_pcie_buscore_read32,
  12863. + .write32 = brcmf_pcie_buscore_write32,
  12864. +@@ -1814,7 +1839,6 @@ brcmf_pcie_remove(struct pci_dev *pdev)
  12865. + brcmf_pcie_intr_disable(devinfo);
  12866. +
  12867. + brcmf_detach(&pdev->dev);
  12868. +- brcmf_pcie_reset_device(devinfo);
  12869. +
  12870. + kfree(bus->bus_priv.pcie);
  12871. + kfree(bus->msgbuf->flowrings);
  12872. diff --git a/package/kernel/mac80211/patches/332-ath10k-fix-DMA-related-firmware-crashes-on-multiple-.patch b/package/kernel/mac80211/patches/332-ath10k-fix-DMA-related-firmware-crashes-on-multiple-.patch
  12873. new file mode 100644
  12874. index 0000000..52b7fa9
  12875. --- /dev/null
  12876. +++ b/package/kernel/mac80211/patches/332-ath10k-fix-DMA-related-firmware-crashes-on-multiple-.patch
  12877. @@ -0,0 +1,33 @@
  12878. +From: Felix Fietkau <nbd@openwrt.org>
  12879. +Date: Sun, 13 Sep 2015 22:26:10 +0200
  12880. +Subject: [PATCH] ath10k: fix DMA related firmware crashes on multiple devices
  12881. +
  12882. +Some platforms really don't like DMA bursts of 256 bytes, and this
  12883. +causes the firmware to crash when sending beacons.
  12884. +Also, changing this based on the firmware version does not seem to make
  12885. +much sense, so use 128 bytes for all versions.
  12886. +
  12887. +Cc: stable@vger.kernel.org
  12888. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  12889. +---
  12890. +
  12891. +--- a/drivers/net/wireless/ath/ath10k/hw.h
  12892. ++++ b/drivers/net/wireless/ath/ath10k/hw.h
  12893. +@@ -340,7 +340,7 @@ enum ath10k_hw_rate_cck {
  12894. + #define TARGET_10X_MAX_FRAG_ENTRIES 0
  12895. +
  12896. + /* 10.2 parameters */
  12897. +-#define TARGET_10_2_DMA_BURST_SIZE 1
  12898. ++#define TARGET_10_2_DMA_BURST_SIZE 0
  12899. +
  12900. + /* Target specific defines for WMI-TLV firmware */
  12901. + #define TARGET_TLV_NUM_VDEVS 4
  12902. +@@ -397,7 +397,7 @@ enum ath10k_hw_rate_cck {
  12903. +
  12904. + #define TARGET_10_4_TX_DBG_LOG_SIZE 1024
  12905. + #define TARGET_10_4_NUM_WDS_ENTRIES 32
  12906. +-#define TARGET_10_4_DMA_BURST_SIZE 1
  12907. ++#define TARGET_10_4_DMA_BURST_SIZE 0
  12908. + #define TARGET_10_4_MAC_AGGR_DELIM 0
  12909. + #define TARGET_10_4_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK 1
  12910. + #define TARGET_10_4_VOW_CONFIG 0
  12911. 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
  12912. deleted file mode 100644
  12913. index 3ce4428..0000000
  12914. --- a/package/kernel/mac80211/patches/332-ath9k-ath9k_hw_analog_shift_rmw-use-REG_RMW.patch
  12915. +++ /dev/null
  12916. @@ -1,27 +0,0 @@
  12917. -From: Oleksij Rempel <linux@rempel-privat.de>
  12918. -Date: Sun, 22 Mar 2015 19:29:59 +0100
  12919. -Subject: [PATCH] ath9k: ath9k_hw_analog_shift_rmw: use REG_RMW
  12920. -
  12921. -use REG_RMW in ath9k_hw_analog_shift_rmw.
  12922. -It will double execution speed on usb bus.
  12923. -
  12924. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12925. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  12926. ----
  12927. -
  12928. ---- a/drivers/net/wireless/ath/ath9k/eeprom.c
  12929. -+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
  12930. -@@ -27,12 +27,7 @@ void ath9k_hw_analog_shift_regwrite(stru
  12931. - void ath9k_hw_analog_shift_rmw(struct ath_hw *ah, u32 reg, u32 mask,
  12932. - u32 shift, u32 val)
  12933. - {
  12934. -- u32 regVal;
  12935. --
  12936. -- regVal = REG_READ(ah, reg) & ~mask;
  12937. -- regVal |= (val << shift) & mask;
  12938. --
  12939. -- REG_WRITE(ah, reg, regVal);
  12940. -+ REG_RMW(ah, reg, ((val << shift) & mask), mask);
  12941. -
  12942. - if (ah->config.analog_shiftreg)
  12943. - udelay(100);
  12944. diff --git a/package/kernel/mac80211/patches/333-ath9k-enable-hw-manual-peak-calibration-for-QCA9561.patch b/package/kernel/mac80211/patches/333-ath9k-enable-hw-manual-peak-calibration-for-QCA9561.patch
  12945. new file mode 100644
  12946. index 0000000..faf6cdc
  12947. --- /dev/null
  12948. +++ b/package/kernel/mac80211/patches/333-ath9k-enable-hw-manual-peak-calibration-for-QCA9561.patch
  12949. @@ -0,0 +1,33 @@
  12950. +From: Miaoqing Pan <miaoqing@qca.qualcomm.com>
  12951. +Date: Tue, 1 Sep 2015 10:56:09 +0800
  12952. +Subject: [PATCH] ath9k: enable hw manual peak calibration for QCA9561
  12953. +
  12954. +This patch fix https://lists.openwrt.org/pipermail/openwrt-devel/
  12955. +2015-August/034979.html. As the peak detect calibration is set
  12956. +incorrectly.
  12957. +
  12958. +Signed-off-by: Miaoqing Pan <miaoqing@qca.qualcomm.com>
  12959. +---
  12960. +
  12961. +--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  12962. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  12963. +@@ -1249,7 +1249,8 @@ static void ar9003_hw_manual_peak_cal(st
  12964. + REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_AGC(chain),
  12965. + AR_PHY_65NM_RXRF_AGC_AGC2G_CALDAC_OVR, 0x0);
  12966. +
  12967. +- if (AR_SREV_9003_PCOEM(ah) || AR_SREV_9550(ah) || AR_SREV_9531(ah)) {
  12968. ++ if (AR_SREV_9003_PCOEM(ah) || AR_SREV_9550(ah) || AR_SREV_9531(ah) ||
  12969. ++ AR_SREV_9561(ah)) {
  12970. + if (is_2g)
  12971. + REG_RMW_FIELD(ah, AR_PHY_65NM_RXRF_AGC(chain),
  12972. + AR_PHY_65NM_RXRF_AGC_AGC2G_DBDAC_OVR,
  12973. +@@ -1640,7 +1641,8 @@ static bool ar9003_hw_init_cal_soc(struc
  12974. +
  12975. + skip_tx_iqcal:
  12976. + if (run_agc_cal || !(ah->ah_flags & AH_FASTCC)) {
  12977. +- if (AR_SREV_9330_11(ah) || AR_SREV_9531(ah) || AR_SREV_9550(ah)) {
  12978. ++ if (AR_SREV_9330_11(ah) || AR_SREV_9531(ah) || AR_SREV_9550(ah) ||
  12979. ++ AR_SREV_9561(ah)) {
  12980. + for (i = 0; i < AR9300_MAX_CHAINS; i++) {
  12981. + if (!(ah->rxchainmask & (1 << i)))
  12982. + continue;
  12983. 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
  12984. deleted file mode 100644
  12985. index 8f12b36..0000000
  12986. --- a/package/kernel/mac80211/patches/333-ath9k-use-REG_RMW-and-rmw-buffer-in-ath9k_hw_4k_set_.patch
  12987. +++ /dev/null
  12988. @@ -1,47 +0,0 @@
  12989. -From: Oleksij Rempel <linux@rempel-privat.de>
  12990. -Date: Sun, 22 Mar 2015 19:30:01 +0100
  12991. -Subject: [PATCH] ath9k: use REG_RMW and rmw buffer in
  12992. - ath9k_hw_4k_set_gain
  12993. -
  12994. -it is possible to reduce time needed for this function
  12995. -by rplacing REG_WRITE with REG_RMW (plus dummy 0) and putt all commands
  12996. -in same buffer.
  12997. -
  12998. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  12999. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13000. ----
  13001. -
  13002. ---- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  13003. -+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
  13004. -@@ -772,15 +772,14 @@ static void ath9k_hw_4k_set_gain(struct
  13005. - struct ar5416_eeprom_4k *eep,
  13006. - u8 txRxAttenLocal)
  13007. - {
  13008. -- REG_WRITE(ah, AR_PHY_SWITCH_CHAIN_0,
  13009. -- pModal->antCtrlChain[0]);
  13010. --
  13011. -- REG_WRITE(ah, AR_PHY_TIMING_CTRL4(0),
  13012. -- (REG_READ(ah, AR_PHY_TIMING_CTRL4(0)) &
  13013. -- ~(AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF |
  13014. -- AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF)) |
  13015. -- SM(pModal->iqCalICh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF) |
  13016. -- SM(pModal->iqCalQCh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF));
  13017. -+ ENABLE_REG_RMW_BUFFER(ah);
  13018. -+ REG_RMW(ah, AR_PHY_SWITCH_CHAIN_0,
  13019. -+ pModal->antCtrlChain[0], 0);
  13020. -+
  13021. -+ REG_RMW(ah, AR_PHY_TIMING_CTRL4(0),
  13022. -+ SM(pModal->iqCalICh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF) |
  13023. -+ SM(pModal->iqCalQCh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF),
  13024. -+ AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF | AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF);
  13025. -
  13026. - if ((eep->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >=
  13027. - AR5416_EEP_MINOR_VER_3) {
  13028. -@@ -819,6 +818,7 @@ static void ath9k_hw_4k_set_gain(struct
  13029. - AR9280_PHY_RXGAIN_TXRX_ATTEN, txRxAttenLocal);
  13030. - REG_RMW_FIELD(ah, AR_PHY_RXGAIN + 0x1000,
  13031. - AR9280_PHY_RXGAIN_TXRX_MARGIN, pModal->rxTxMarginCh[0]);
  13032. -+ REG_RMW_BUFFER_FLUSH(ah);
  13033. - }
  13034. -
  13035. - /*
  13036. 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
  13037. deleted file mode 100644
  13038. index f26e059..0000000
  13039. --- a/package/kernel/mac80211/patches/334-ath9k-use-REG_RMW-and-rmw-buffer-in-ath9k_hw_def_set.patch
  13040. +++ /dev/null
  13041. @@ -1,67 +0,0 @@
  13042. -From: Oleksij Rempel <linux@rempel-privat.de>
  13043. -Date: Sun, 22 Mar 2015 19:30:03 +0100
  13044. -Subject: [PATCH] ath9k: use REG_RMW and rmw buffer in
  13045. - ath9k_hw_def_set_gain
  13046. -
  13047. -Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  13048. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13049. ----
  13050. -
  13051. ---- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
  13052. -+++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
  13053. -@@ -466,6 +466,7 @@ static void ath9k_hw_def_set_gain(struct
  13054. - struct ar5416_eeprom_def *eep,
  13055. - u8 txRxAttenLocal, int regChainOffset, int i)
  13056. - {
  13057. -+ ENABLE_REG_RMW_BUFFER(ah);
  13058. - if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_3) {
  13059. - txRxAttenLocal = pModal->txRxAttenCh[i];
  13060. -
  13061. -@@ -483,16 +484,12 @@ static void ath9k_hw_def_set_gain(struct
  13062. - AR_PHY_GAIN_2GHZ_XATTEN2_DB,
  13063. - pModal->xatten2Db[i]);
  13064. - } else {
  13065. -- REG_WRITE(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  13066. -- (REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) &
  13067. -- ~AR_PHY_GAIN_2GHZ_BSW_MARGIN)
  13068. -- | SM(pModal-> bswMargin[i],
  13069. -- AR_PHY_GAIN_2GHZ_BSW_MARGIN));
  13070. -- REG_WRITE(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  13071. -- (REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) &
  13072. -- ~AR_PHY_GAIN_2GHZ_BSW_ATTEN)
  13073. -- | SM(pModal->bswAtten[i],
  13074. -- AR_PHY_GAIN_2GHZ_BSW_ATTEN));
  13075. -+ REG_RMW(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  13076. -+ SM(pModal-> bswMargin[i], AR_PHY_GAIN_2GHZ_BSW_MARGIN),
  13077. -+ AR_PHY_GAIN_2GHZ_BSW_MARGIN);
  13078. -+ REG_RMW(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  13079. -+ SM(pModal->bswAtten[i], AR_PHY_GAIN_2GHZ_BSW_ATTEN),
  13080. -+ AR_PHY_GAIN_2GHZ_BSW_ATTEN);
  13081. - }
  13082. - }
  13083. -
  13084. -@@ -504,17 +501,14 @@ static void ath9k_hw_def_set_gain(struct
  13085. - AR_PHY_RXGAIN + regChainOffset,
  13086. - AR9280_PHY_RXGAIN_TXRX_MARGIN, pModal->rxTxMarginCh[i]);
  13087. - } else {
  13088. -- REG_WRITE(ah,
  13089. -- AR_PHY_RXGAIN + regChainOffset,
  13090. -- (REG_READ(ah, AR_PHY_RXGAIN + regChainOffset) &
  13091. -- ~AR_PHY_RXGAIN_TXRX_ATTEN)
  13092. -- | SM(txRxAttenLocal, AR_PHY_RXGAIN_TXRX_ATTEN));
  13093. -- REG_WRITE(ah,
  13094. -- AR_PHY_GAIN_2GHZ + regChainOffset,
  13095. -- (REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) &
  13096. -- ~AR_PHY_GAIN_2GHZ_RXTX_MARGIN) |
  13097. -- SM(pModal->rxTxMarginCh[i], AR_PHY_GAIN_2GHZ_RXTX_MARGIN));
  13098. -+ REG_RMW(ah, AR_PHY_RXGAIN + regChainOffset,
  13099. -+ SM(txRxAttenLocal, AR_PHY_RXGAIN_TXRX_ATTEN),
  13100. -+ AR_PHY_RXGAIN_TXRX_ATTEN);
  13101. -+ REG_RMW(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
  13102. -+ SM(pModal->rxTxMarginCh[i], AR_PHY_GAIN_2GHZ_RXTX_MARGIN),
  13103. -+ AR_PHY_GAIN_2GHZ_RXTX_MARGIN);
  13104. - }
  13105. -+ REG_RMW_BUFFER_FLUSH(ah);
  13106. - }
  13107. -
  13108. - static void ath9k_hw_def_set_board_values(struct ath_hw *ah,
  13109. diff --git a/package/kernel/mac80211/patches/334-mac80211-fix-tx-sequence-number-assignment-with-soft.patch b/package/kernel/mac80211/patches/334-mac80211-fix-tx-sequence-number-assignment-with-soft.patch
  13110. new file mode 100644
  13111. index 0000000..b19e7ee
  13112. --- /dev/null
  13113. +++ b/package/kernel/mac80211/patches/334-mac80211-fix-tx-sequence-number-assignment-with-soft.patch
  13114. @@ -0,0 +1,23 @@
  13115. +From: Felix Fietkau <nbd@openwrt.org>
  13116. +Date: Thu, 24 Sep 2015 14:10:07 +0200
  13117. +Subject: [PATCH] mac80211: fix tx sequence number assignment with software
  13118. + queue + fast-xmit
  13119. +
  13120. +When using software queueing, tx sequence number assignment happens at
  13121. +ieee80211_tx_dequeue time, so the fast-xmit codepath must not do that.
  13122. +
  13123. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  13124. +---
  13125. +
  13126. +--- a/net/mac80211/tx.c
  13127. ++++ b/net/mac80211/tx.c
  13128. +@@ -2766,7 +2766,8 @@ static bool ieee80211_xmit_fast(struct i
  13129. +
  13130. + if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) {
  13131. + *ieee80211_get_qos_ctl(hdr) = tid;
  13132. +- hdr->seq_ctrl = ieee80211_tx_next_seq(sta, tid);
  13133. ++ if (!sta->sta.txq[0])
  13134. ++ hdr->seq_ctrl = ieee80211_tx_next_seq(sta, tid);
  13135. + } else {
  13136. + info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ;
  13137. + hdr->seq_ctrl = cpu_to_le16(sdata->sequence_number);
  13138. 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
  13139. deleted file mode 100644
  13140. index 5e63a80..0000000
  13141. --- a/package/kernel/mac80211/patches/335-0001-brcmfmac-Fix-oops-when-SDIO-device-is-removed.patch
  13142. +++ /dev/null
  13143. @@ -1,44 +0,0 @@
  13144. -From: Hante Meuleman <meuleman@broadcom.com>
  13145. -Date: Fri, 6 Mar 2015 18:40:38 +0100
  13146. -Subject: [PATCH] brcmfmac: Fix oops when SDIO device is removed.
  13147. -
  13148. -On removal of SDIO card both functions of card will be getting
  13149. -a remove call. When the first is hanging in ctrl frame xmit then
  13150. -the second will cause oops. This patch fixes the xmit ctrl
  13151. -handling in case of serious errors and also limits the handling
  13152. -for remove to function 1 only.
  13153. -
  13154. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  13155. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  13156. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13157. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  13158. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  13159. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13160. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13161. ----
  13162. -
  13163. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  13164. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  13165. -@@ -1194,7 +1194,7 @@ static void brcmf_ops_sdio_remove(struct
  13166. - brcmf_dbg(SDIO, "sdio device ID: 0x%04x\n", func->device);
  13167. - brcmf_dbg(SDIO, "Function: %d\n", func->num);
  13168. -
  13169. -- if (func->num != 1 && func->num != 2)
  13170. -+ if (func->num != 1)
  13171. - return;
  13172. -
  13173. - bus_if = dev_get_drvdata(&func->dev);
  13174. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13175. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13176. -@@ -2740,6 +2740,11 @@ static void brcmf_sdio_dpc(struct brcmf_
  13177. - if ((bus->sdiodev->state != BRCMF_SDIOD_DATA) || (err != 0)) {
  13178. - brcmf_err("failed backplane access over SDIO, halting operation\n");
  13179. - atomic_set(&bus->intstatus, 0);
  13180. -+ if (bus->ctrl_frame_stat) {
  13181. -+ bus->ctrl_frame_err = -ENODEV;
  13182. -+ bus->ctrl_frame_stat = false;
  13183. -+ brcmf_sdio_wait_event_wakeup(bus);
  13184. -+ }
  13185. - } else if (atomic_read(&bus->intstatus) ||
  13186. - atomic_read(&bus->ipend) > 0 ||
  13187. - (!atomic_read(&bus->fcstate) &&
  13188. 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
  13189. deleted file mode 100644
  13190. index 201da75..0000000
  13191. --- a/package/kernel/mac80211/patches/335-0002-brcmfmac-Simplify-watchdog-sleep.patch
  13192. +++ /dev/null
  13193. @@ -1,157 +0,0 @@
  13194. -From: Hante Meuleman <meuleman@broadcom.com>
  13195. -Date: Fri, 6 Mar 2015 18:40:39 +0100
  13196. -Subject: [PATCH] brcmfmac: Simplify watchdog sleep.
  13197. -
  13198. -The watchdog thread is used to put the SDIO bus to sleep when the
  13199. -system is idling. This patch simplifies the way it is determined
  13200. -when sleep can be entered.
  13201. -
  13202. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  13203. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  13204. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13205. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  13206. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  13207. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13208. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13209. ----
  13210. -
  13211. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13212. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13213. -@@ -485,10 +485,9 @@ struct brcmf_sdio {
  13214. - #endif /* DEBUG */
  13215. -
  13216. - uint clkstate; /* State of sd and backplane clock(s) */
  13217. -- bool activity; /* Activity flag for clock down */
  13218. - s32 idletime; /* Control for activity timeout */
  13219. -- s32 idlecount; /* Activity timeout counter */
  13220. -- s32 idleclock; /* How to set bus driver when idle */
  13221. -+ s32 idlecount; /* Activity timeout counter */
  13222. -+ s32 idleclock; /* How to set bus driver when idle */
  13223. - bool rxflow_mode; /* Rx flow control mode */
  13224. - bool rxflow; /* Is rx flow control on */
  13225. - bool alp_only; /* Don't use HT clock (ALP only) */
  13226. -@@ -511,6 +510,7 @@ struct brcmf_sdio {
  13227. - struct workqueue_struct *brcmf_wq;
  13228. - struct work_struct datawork;
  13229. - atomic_t dpc_tskcnt;
  13230. -+ atomic_t dpc_running;
  13231. -
  13232. - bool txoff; /* Transmit flow-controlled */
  13233. - struct brcmf_sdio_count sdcnt;
  13234. -@@ -959,13 +959,8 @@ static int brcmf_sdio_clkctl(struct brcm
  13235. - brcmf_dbg(SDIO, "Enter\n");
  13236. -
  13237. - /* Early exit if we're already there */
  13238. -- if (bus->clkstate == target) {
  13239. -- if (target == CLK_AVAIL) {
  13240. -- brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  13241. -- bus->activity = true;
  13242. -- }
  13243. -+ if (bus->clkstate == target)
  13244. - return 0;
  13245. -- }
  13246. -
  13247. - switch (target) {
  13248. - case CLK_AVAIL:
  13249. -@@ -975,7 +970,6 @@ static int brcmf_sdio_clkctl(struct brcm
  13250. - /* Now request HT Avail on the backplane */
  13251. - brcmf_sdio_htclk(bus, true, pendok);
  13252. - brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  13253. -- bus->activity = true;
  13254. - break;
  13255. -
  13256. - case CLK_SDONLY:
  13257. -@@ -1024,17 +1018,6 @@ brcmf_sdio_bus_sleep(struct brcmf_sdio *
  13258. -
  13259. - /* Going to sleep */
  13260. - if (sleep) {
  13261. -- /* Don't sleep if something is pending */
  13262. -- if (atomic_read(&bus->intstatus) ||
  13263. -- atomic_read(&bus->ipend) > 0 ||
  13264. -- bus->ctrl_frame_stat ||
  13265. -- (!atomic_read(&bus->fcstate) &&
  13266. -- brcmu_pktq_mlen(&bus->txq, ~bus->flowcontrol) &&
  13267. -- data_ok(bus))) {
  13268. -- err = -EBUSY;
  13269. -- goto done;
  13270. -- }
  13271. --
  13272. - clkcsr = brcmf_sdiod_regrb(bus->sdiodev,
  13273. - SBSDIO_FUNC1_CHIPCLKCSR,
  13274. - &err);
  13275. -@@ -1045,11 +1028,7 @@ brcmf_sdio_bus_sleep(struct brcmf_sdio *
  13276. - SBSDIO_ALP_AVAIL_REQ, &err);
  13277. - }
  13278. - err = brcmf_sdio_kso_control(bus, false);
  13279. -- /* disable watchdog */
  13280. -- if (!err)
  13281. -- brcmf_sdio_wd_timer(bus, 0);
  13282. - } else {
  13283. -- bus->idlecount = 0;
  13284. - err = brcmf_sdio_kso_control(bus, true);
  13285. - }
  13286. - if (err) {
  13287. -@@ -3566,7 +3545,7 @@ void brcmf_sdio_isr(struct brcmf_sdio *b
  13288. - queue_work(bus->brcmf_wq, &bus->datawork);
  13289. - }
  13290. -
  13291. --static bool brcmf_sdio_bus_watchdog(struct brcmf_sdio *bus)
  13292. -+static void brcmf_sdio_bus_watchdog(struct brcmf_sdio *bus)
  13293. - {
  13294. - brcmf_dbg(TIMER, "Enter\n");
  13295. -
  13296. -@@ -3627,22 +3606,21 @@ static bool brcmf_sdio_bus_watchdog(stru
  13297. - #endif /* DEBUG */
  13298. -
  13299. - /* On idle timeout clear activity flag and/or turn off clock */
  13300. -- if ((bus->idletime > 0) && (bus->clkstate == CLK_AVAIL)) {
  13301. -- if (++bus->idlecount >= bus->idletime) {
  13302. -+ if ((atomic_read(&bus->dpc_tskcnt) == 0) &&
  13303. -+ (atomic_read(&bus->dpc_running) == 0) &&
  13304. -+ (bus->idletime > 0) && (bus->clkstate == CLK_AVAIL)) {
  13305. -+ bus->idlecount++;
  13306. -+ if (bus->idlecount > bus->idletime) {
  13307. -+ brcmf_dbg(SDIO, "idle\n");
  13308. -+ sdio_claim_host(bus->sdiodev->func[1]);
  13309. -+ brcmf_sdio_wd_timer(bus, 0);
  13310. - bus->idlecount = 0;
  13311. -- if (bus->activity) {
  13312. -- bus->activity = false;
  13313. -- brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  13314. -- } else {
  13315. -- brcmf_dbg(SDIO, "idle\n");
  13316. -- sdio_claim_host(bus->sdiodev->func[1]);
  13317. -- brcmf_sdio_bus_sleep(bus, true, false);
  13318. -- sdio_release_host(bus->sdiodev->func[1]);
  13319. -- }
  13320. -+ brcmf_sdio_bus_sleep(bus, true, false);
  13321. -+ sdio_release_host(bus->sdiodev->func[1]);
  13322. - }
  13323. -+ } else {
  13324. -+ bus->idlecount = 0;
  13325. - }
  13326. --
  13327. -- return (atomic_read(&bus->ipend) > 0);
  13328. - }
  13329. -
  13330. - static void brcmf_sdio_dataworker(struct work_struct *work)
  13331. -@@ -3651,8 +3629,11 @@ static void brcmf_sdio_dataworker(struct
  13332. - datawork);
  13333. -
  13334. - while (atomic_read(&bus->dpc_tskcnt)) {
  13335. -+ atomic_set(&bus->dpc_running, 1);
  13336. - atomic_set(&bus->dpc_tskcnt, 0);
  13337. - brcmf_sdio_dpc(bus);
  13338. -+ bus->idlecount = 0;
  13339. -+ atomic_set(&bus->dpc_running, 0);
  13340. - }
  13341. - if (brcmf_sdiod_freezing(bus->sdiodev)) {
  13342. - brcmf_sdiod_change_state(bus->sdiodev, BRCMF_SDIOD_DOWN);
  13343. -@@ -4154,6 +4135,7 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
  13344. - }
  13345. - /* Initialize DPC thread */
  13346. - atomic_set(&bus->dpc_tskcnt, 0);
  13347. -+ atomic_set(&bus->dpc_running, 0);
  13348. -
  13349. - /* Assign bus interface call back */
  13350. - bus->sdiodev->bus_if->dev = bus->sdiodev->dev;
  13351. 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
  13352. deleted file mode 100644
  13353. index 3a2de7a..0000000
  13354. --- a/package/kernel/mac80211/patches/335-0003-brcmfmac-Fix-possible-race-condition.patch
  13355. +++ /dev/null
  13356. @@ -1,83 +0,0 @@
  13357. -From: Hante Meuleman <meuleman@broadcom.com>
  13358. -Date: Fri, 6 Mar 2015 18:40:40 +0100
  13359. -Subject: [PATCH] brcmfmac: Fix possible race-condition.
  13360. -
  13361. -SDIO is using a "shared" variable to handoff ctl frames to DPC
  13362. -and to see when they are done. In a timeout situation this can
  13363. -lead to erroneous situation where DPC started to handle the ctl
  13364. -frame while the timeout expired. This patch will fix this by
  13365. -adding locking around the shared variable.
  13366. -
  13367. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  13368. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  13369. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13370. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  13371. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  13372. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13373. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13374. ----
  13375. -
  13376. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13377. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13378. -@@ -2700,11 +2700,13 @@ static void brcmf_sdio_dpc(struct brcmf_
  13379. - if (bus->ctrl_frame_stat && (bus->clkstate == CLK_AVAIL) &&
  13380. - data_ok(bus)) {
  13381. - sdio_claim_host(bus->sdiodev->func[1]);
  13382. -- err = brcmf_sdio_tx_ctrlframe(bus, bus->ctrl_frame_buf,
  13383. -- bus->ctrl_frame_len);
  13384. -+ if (bus->ctrl_frame_stat) {
  13385. -+ err = brcmf_sdio_tx_ctrlframe(bus, bus->ctrl_frame_buf,
  13386. -+ bus->ctrl_frame_len);
  13387. -+ bus->ctrl_frame_err = err;
  13388. -+ bus->ctrl_frame_stat = false;
  13389. -+ }
  13390. - sdio_release_host(bus->sdiodev->func[1]);
  13391. -- bus->ctrl_frame_err = err;
  13392. -- bus->ctrl_frame_stat = false;
  13393. - brcmf_sdio_wait_event_wakeup(bus);
  13394. - }
  13395. - /* Send queued frames (limit 1 if rx may still be pending) */
  13396. -@@ -2720,9 +2722,13 @@ static void brcmf_sdio_dpc(struct brcmf_
  13397. - brcmf_err("failed backplane access over SDIO, halting operation\n");
  13398. - atomic_set(&bus->intstatus, 0);
  13399. - if (bus->ctrl_frame_stat) {
  13400. -- bus->ctrl_frame_err = -ENODEV;
  13401. -- bus->ctrl_frame_stat = false;
  13402. -- brcmf_sdio_wait_event_wakeup(bus);
  13403. -+ sdio_claim_host(bus->sdiodev->func[1]);
  13404. -+ if (bus->ctrl_frame_stat) {
  13405. -+ bus->ctrl_frame_err = -ENODEV;
  13406. -+ bus->ctrl_frame_stat = false;
  13407. -+ brcmf_sdio_wait_event_wakeup(bus);
  13408. -+ }
  13409. -+ sdio_release_host(bus->sdiodev->func[1]);
  13410. - }
  13411. - } else if (atomic_read(&bus->intstatus) ||
  13412. - atomic_read(&bus->ipend) > 0 ||
  13413. -@@ -2930,15 +2936,20 @@ brcmf_sdio_bus_txctl(struct device *dev,
  13414. - brcmf_sdio_trigger_dpc(bus);
  13415. - wait_event_interruptible_timeout(bus->ctrl_wait, !bus->ctrl_frame_stat,
  13416. - msecs_to_jiffies(CTL_DONE_TIMEOUT));
  13417. --
  13418. -- if (!bus->ctrl_frame_stat) {
  13419. -+ ret = 0;
  13420. -+ if (bus->ctrl_frame_stat) {
  13421. -+ sdio_claim_host(bus->sdiodev->func[1]);
  13422. -+ if (bus->ctrl_frame_stat) {
  13423. -+ brcmf_dbg(SDIO, "ctrl_frame timeout\n");
  13424. -+ bus->ctrl_frame_stat = false;
  13425. -+ ret = -ETIMEDOUT;
  13426. -+ }
  13427. -+ sdio_release_host(bus->sdiodev->func[1]);
  13428. -+ }
  13429. -+ if (!ret) {
  13430. - brcmf_dbg(SDIO, "ctrl_frame complete, err=%d\n",
  13431. - bus->ctrl_frame_err);
  13432. - ret = bus->ctrl_frame_err;
  13433. -- } else {
  13434. -- brcmf_dbg(SDIO, "ctrl_frame timeout\n");
  13435. -- bus->ctrl_frame_stat = false;
  13436. -- ret = -ETIMEDOUT;
  13437. - }
  13438. -
  13439. - if (ret)
  13440. 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
  13441. deleted file mode 100644
  13442. index c9eb900..0000000
  13443. --- a/package/kernel/mac80211/patches/335-0004-brcmfmac-Add-support-for-BCM4345-SDIO-chipset.patch
  13444. +++ /dev/null
  13445. @@ -1,86 +0,0 @@
  13446. -From: Syed Asifful Dayyan <syedd@broadcom.com>
  13447. -Date: Fri, 6 Mar 2015 18:40:42 +0100
  13448. -Subject: [PATCH] brcmfmac: Add support for BCM4345 SDIO chipset.
  13449. -
  13450. -These changes add support for BCM4345 SDIO chipset.
  13451. -
  13452. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13453. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  13454. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  13455. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  13456. -Signed-off-by: Syed Asifful Dayyan <syedd@broadcom.com>
  13457. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13458. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13459. ----
  13460. -
  13461. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  13462. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  13463. -@@ -1096,6 +1096,7 @@ static const struct sdio_device_id brcmf
  13464. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43341),
  13465. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43362),
  13466. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4335_4339),
  13467. -+ BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4345),
  13468. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4354),
  13469. - { /* end: all zeroes */ }
  13470. - };
  13471. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  13472. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  13473. -@@ -491,6 +491,10 @@ static void brcmf_chip_get_raminfo(struc
  13474. - case BRCM_CC_43362_CHIP_ID:
  13475. - ci->pub.ramsize = 0x3c000;
  13476. - break;
  13477. -+ case BRCM_CC_4345_CHIP_ID:
  13478. -+ ci->pub.ramsize = 0xc8000;
  13479. -+ ci->pub.rambase = 0x198000;
  13480. -+ break;
  13481. - case BRCM_CC_4339_CHIP_ID:
  13482. - case BRCM_CC_4354_CHIP_ID:
  13483. - case BRCM_CC_4356_CHIP_ID:
  13484. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13485. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13486. -@@ -617,6 +617,8 @@ static const struct sdiod_drive_str sdio
  13487. - #define BCM43362_NVRAM_NAME "brcm/brcmfmac43362-sdio.txt"
  13488. - #define BCM4339_FIRMWARE_NAME "brcm/brcmfmac4339-sdio.bin"
  13489. - #define BCM4339_NVRAM_NAME "brcm/brcmfmac4339-sdio.txt"
  13490. -+#define BCM4345_FIRMWARE_NAME "brcm/brcmfmac4345-sdio.bin"
  13491. -+#define BCM4345_NVRAM_NAME "brcm/brcmfmac4345-sdio.txt"
  13492. - #define BCM4354_FIRMWARE_NAME "brcm/brcmfmac4354-sdio.bin"
  13493. - #define BCM4354_NVRAM_NAME "brcm/brcmfmac4354-sdio.txt"
  13494. -
  13495. -@@ -640,6 +642,8 @@ MODULE_FIRMWARE(BCM43362_FIRMWARE_NAME);
  13496. - MODULE_FIRMWARE(BCM43362_NVRAM_NAME);
  13497. - MODULE_FIRMWARE(BCM4339_FIRMWARE_NAME);
  13498. - MODULE_FIRMWARE(BCM4339_NVRAM_NAME);
  13499. -+MODULE_FIRMWARE(BCM4345_FIRMWARE_NAME);
  13500. -+MODULE_FIRMWARE(BCM4345_NVRAM_NAME);
  13501. - MODULE_FIRMWARE(BCM4354_FIRMWARE_NAME);
  13502. - MODULE_FIRMWARE(BCM4354_NVRAM_NAME);
  13503. -
  13504. -@@ -669,6 +673,7 @@ static const struct brcmf_firmware_names
  13505. - { BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4335) },
  13506. - { BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, BRCMF_FIRMWARE_NVRAM(BCM43362) },
  13507. - { BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4339) },
  13508. -+ { BRCM_CC_4345_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4345) },
  13509. - { BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4354) }
  13510. - };
  13511. -
  13512. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  13513. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  13514. -@@ -37,6 +37,7 @@
  13515. - #define BRCM_CC_43362_CHIP_ID 43362
  13516. - #define BRCM_CC_4335_CHIP_ID 0x4335
  13517. - #define BRCM_CC_4339_CHIP_ID 0x4339
  13518. -+#define BRCM_CC_4345_CHIP_ID 0x4345
  13519. - #define BRCM_CC_4354_CHIP_ID 0x4354
  13520. - #define BRCM_CC_4356_CHIP_ID 0x4356
  13521. - #define BRCM_CC_43566_CHIP_ID 43566
  13522. ---- a/include/linux/mmc/sdio_ids.h
  13523. -+++ b/include/linux/mmc/sdio_ids.h
  13524. -@@ -33,6 +33,7 @@
  13525. - #define SDIO_DEVICE_ID_BROADCOM_43341 0xa94d
  13526. - #define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335
  13527. - #define SDIO_DEVICE_ID_BROADCOM_43362 0xa962
  13528. -+#define SDIO_DEVICE_ID_BROADCOM_4345 0x4345
  13529. - #define SDIO_DEVICE_ID_BROADCOM_4354 0x4354
  13530. -
  13531. - #define SDIO_VENDOR_ID_INTEL 0x0089
  13532. diff --git a/package/kernel/mac80211/patches/335-mac80211-fix-handling-of-PS-filtering-with-fast-xmit.patch b/package/kernel/mac80211/patches/335-mac80211-fix-handling-of-PS-filtering-with-fast-xmit.patch
  13533. new file mode 100644
  13534. index 0000000..7aef205
  13535. --- /dev/null
  13536. +++ b/package/kernel/mac80211/patches/335-mac80211-fix-handling-of-PS-filtering-with-fast-xmit.patch
  13537. @@ -0,0 +1,45 @@
  13538. +From: Felix Fietkau <nbd@openwrt.org>
  13539. +Date: Thu, 24 Sep 2015 14:11:40 +0200
  13540. +Subject: [PATCH] mac80211: fix handling of PS filtering with fast-xmit
  13541. +
  13542. +Fixes dropped packets in the tx path in case a non-PS station triggers
  13543. +the tx filter.
  13544. +
  13545. +Cc: stable@vger.kernel.org # 4.2
  13546. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  13547. +---
  13548. +
  13549. +--- a/net/mac80211/status.c
  13550. ++++ b/net/mac80211/status.c
  13551. +@@ -101,6 +101,7 @@ static void ieee80211_handle_filtered_fr
  13552. + * when it wakes up for the next time.
  13553. + */
  13554. + set_sta_flag(sta, WLAN_STA_CLEAR_PS_FILT);
  13555. ++ ieee80211_clear_fast_xmit(sta);
  13556. +
  13557. + /*
  13558. + * This code races in the following way:
  13559. +--- a/net/mac80211/tx.c
  13560. ++++ b/net/mac80211/tx.c
  13561. +@@ -1217,8 +1217,10 @@ ieee80211_tx_prepare(struct ieee80211_su
  13562. +
  13563. + if (!tx->sta)
  13564. + info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
  13565. +- else if (test_and_clear_sta_flag(tx->sta, WLAN_STA_CLEAR_PS_FILT))
  13566. ++ else if (test_and_clear_sta_flag(tx->sta, WLAN_STA_CLEAR_PS_FILT)) {
  13567. + info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
  13568. ++ ieee80211_check_fast_xmit(tx->sta);
  13569. ++ }
  13570. +
  13571. + info->flags |= IEEE80211_TX_CTL_FIRST_FRAGMENT;
  13572. +
  13573. +@@ -2450,7 +2452,8 @@ void ieee80211_check_fast_xmit(struct st
  13574. +
  13575. + if (test_sta_flag(sta, WLAN_STA_PS_STA) ||
  13576. + test_sta_flag(sta, WLAN_STA_PS_DRIVER) ||
  13577. +- test_sta_flag(sta, WLAN_STA_PS_DELIVER))
  13578. ++ test_sta_flag(sta, WLAN_STA_PS_DELIVER) ||
  13579. ++ test_sta_flag(sta, WLAN_STA_CLEAR_PS_FILT))
  13580. + goto out;
  13581. +
  13582. + if (sdata->noack_map)
  13583. 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
  13584. deleted file mode 100644
  13585. index 7a688c4..0000000
  13586. --- a/package/kernel/mac80211/patches/336-0001-brcmfmac-remove-duplication-of-ramsize-info.patch
  13587. +++ /dev/null
  13588. @@ -1,48 +0,0 @@
  13589. -From: Arend van Spriel <arend@broadcom.com>
  13590. -Date: Wed, 11 Mar 2015 16:11:27 +0100
  13591. -Subject: [PATCH] brcmfmac: remove duplication of ramsize info
  13592. -
  13593. -Removing the ramsize from the brcmf_sdio structure to avoid
  13594. -duplication. The information is available in brcmf_chip
  13595. -structure.
  13596. -
  13597. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  13598. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13599. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13600. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13601. ----
  13602. -
  13603. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13604. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13605. -@@ -432,8 +432,6 @@ struct brcmf_sdio {
  13606. - struct brcmf_sdio_dev *sdiodev; /* sdio device handler */
  13607. - struct brcmf_chip *ci; /* Chip info struct */
  13608. -
  13609. -- u32 ramsize; /* Size of RAM in SOCRAM (bytes) */
  13610. --
  13611. - u32 hostintmask; /* Copy of Host Interrupt Mask */
  13612. - atomic_t intstatus; /* Intstatus bits (events) pending */
  13613. - atomic_t fcstate; /* State of dongle flow-control */
  13614. -@@ -1075,7 +1073,7 @@ static int brcmf_sdio_readshared(struct
  13615. - struct sdpcm_shared_le sh_le;
  13616. - __le32 addr_le;
  13617. -
  13618. -- shaddr = bus->ci->rambase + bus->ramsize - 4;
  13619. -+ shaddr = bus->ci->rambase + bus->ci->ramsize - 4;
  13620. -
  13621. - /*
  13622. - * Read last word in socram to determine
  13623. -@@ -3871,13 +3869,6 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
  13624. - drivestrength = DEFAULT_SDIO_DRIVE_STRENGTH;
  13625. - brcmf_sdio_drivestrengthinit(bus->sdiodev, bus->ci, drivestrength);
  13626. -
  13627. -- /* Get info on the SOCRAM cores... */
  13628. -- bus->ramsize = bus->ci->ramsize;
  13629. -- if (!(bus->ramsize)) {
  13630. -- brcmf_err("failed to find SOCRAM memory!\n");
  13631. -- goto fail;
  13632. -- }
  13633. --
  13634. - /* Set card control so an SDIO card reset does a WLAN backplane reset */
  13635. - reg_val = brcmf_sdiod_regrb(bus->sdiodev,
  13636. - SDIO_CCCR_BRCM_CARDCTRL, &err);
  13637. 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
  13638. deleted file mode 100644
  13639. index e2a2074..0000000
  13640. --- a/package/kernel/mac80211/patches/336-0002-brcmfmac-always-perform-cores-checks.patch
  13641. +++ /dev/null
  13642. @@ -1,74 +0,0 @@
  13643. -From: Arend van Spriel <arend@broadcom.com>
  13644. -Date: Wed, 11 Mar 2015 16:11:28 +0100
  13645. -Subject: [PATCH] brcmfmac: always perform cores checks
  13646. -
  13647. -Instead of checking the cores in the chip only if CONFIG_BRCMDBG
  13648. -is selected perform the check always and extend it with more sanity
  13649. -checking.
  13650. -
  13651. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  13652. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13653. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13654. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13655. ----
  13656. -
  13657. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  13658. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  13659. -@@ -419,13 +419,13 @@ static struct brcmf_core *brcmf_chip_add
  13660. - return &core->pub;
  13661. - }
  13662. -
  13663. --#ifdef DEBUG
  13664. - /* safety check for chipinfo */
  13665. - static int brcmf_chip_cores_check(struct brcmf_chip_priv *ci)
  13666. - {
  13667. - struct brcmf_core_priv *core;
  13668. - bool need_socram = false;
  13669. - bool has_socram = false;
  13670. -+ bool cpu_found = false;
  13671. - int idx = 1;
  13672. -
  13673. - list_for_each_entry(core, &ci->cores, list) {
  13674. -@@ -435,12 +435,14 @@ static int brcmf_chip_cores_check(struct
  13675. -
  13676. - switch (core->pub.id) {
  13677. - case BCMA_CORE_ARM_CM3:
  13678. -+ cpu_found = true;
  13679. - need_socram = true;
  13680. - break;
  13681. - case BCMA_CORE_INTERNAL_MEM:
  13682. - has_socram = true;
  13683. - break;
  13684. - case BCMA_CORE_ARM_CR4:
  13685. -+ cpu_found = true;
  13686. - if (ci->pub.rambase == 0) {
  13687. - brcmf_err("RAM base not provided with ARM CR4 core\n");
  13688. - return -ENOMEM;
  13689. -@@ -451,19 +453,21 @@ static int brcmf_chip_cores_check(struct
  13690. - }
  13691. - }
  13692. -
  13693. -+ if (!cpu_found) {
  13694. -+ brcmf_err("CPU core not detected\n");
  13695. -+ return -ENXIO;
  13696. -+ }
  13697. - /* check RAM core presence for ARM CM3 core */
  13698. - if (need_socram && !has_socram) {
  13699. - brcmf_err("RAM core not provided with ARM CM3 core\n");
  13700. - return -ENODEV;
  13701. - }
  13702. -+ if (!ci->pub.ramsize) {
  13703. -+ brcmf_err("RAM size is undetermined\n");
  13704. -+ return -ENOMEM;
  13705. -+ }
  13706. - return 0;
  13707. - }
  13708. --#else /* DEBUG */
  13709. --static inline int brcmf_chip_cores_check(struct brcmf_chip_priv *ci)
  13710. --{
  13711. -- return 0;
  13712. --}
  13713. --#endif
  13714. -
  13715. - static void brcmf_chip_get_raminfo(struct brcmf_chip_priv *ci)
  13716. - {
  13717. 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
  13718. deleted file mode 100644
  13719. index a272800..0000000
  13720. --- a/package/kernel/mac80211/patches/336-0003-brcmfmac-rename-chip-download-functions.patch
  13721. +++ /dev/null
  13722. @@ -1,240 +0,0 @@
  13723. -From: Arend van Spriel <arend@broadcom.com>
  13724. -Date: Wed, 11 Mar 2015 16:11:29 +0100
  13725. -Subject: [PATCH] brcmfmac: rename chip download functions
  13726. -
  13727. -The functions brcmf_chip_[enter/exit]_download() are not exclusively
  13728. -used for firmware download so rename these more appropriate.
  13729. -
  13730. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  13731. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13732. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13733. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13734. ----
  13735. -
  13736. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  13737. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  13738. -@@ -807,7 +807,7 @@ struct brcmf_chip *brcmf_chip_attach(voi
  13739. - err = -EINVAL;
  13740. - if (WARN_ON(!ops->prepare))
  13741. - err = -EINVAL;
  13742. -- if (WARN_ON(!ops->exit_dl))
  13743. -+ if (WARN_ON(!ops->activate))
  13744. - err = -EINVAL;
  13745. - if (err < 0)
  13746. - return ERR_PTR(-EINVAL);
  13747. -@@ -905,7 +905,7 @@ void brcmf_chip_resetcore(struct brcmf_c
  13748. - }
  13749. -
  13750. - static void
  13751. --brcmf_chip_cm3_enterdl(struct brcmf_chip_priv *chip)
  13752. -+brcmf_chip_cm3_set_passive(struct brcmf_chip_priv *chip)
  13753. - {
  13754. - struct brcmf_core *core;
  13755. -
  13756. -@@ -919,7 +919,7 @@ brcmf_chip_cm3_enterdl(struct brcmf_chip
  13757. - brcmf_chip_resetcore(core, 0, 0, 0);
  13758. - }
  13759. -
  13760. --static bool brcmf_chip_cm3_exitdl(struct brcmf_chip_priv *chip)
  13761. -+static bool brcmf_chip_cm3_set_active(struct brcmf_chip_priv *chip)
  13762. - {
  13763. - struct brcmf_core *core;
  13764. -
  13765. -@@ -929,7 +929,7 @@ static bool brcmf_chip_cm3_exitdl(struct
  13766. - return false;
  13767. - }
  13768. -
  13769. -- chip->ops->exit_dl(chip->ctx, &chip->pub, 0);
  13770. -+ chip->ops->activate(chip->ctx, &chip->pub, 0);
  13771. -
  13772. - core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_ARM_CM3);
  13773. - brcmf_chip_resetcore(core, 0, 0, 0);
  13774. -@@ -938,7 +938,7 @@ static bool brcmf_chip_cm3_exitdl(struct
  13775. - }
  13776. -
  13777. - static inline void
  13778. --brcmf_chip_cr4_enterdl(struct brcmf_chip_priv *chip)
  13779. -+brcmf_chip_cr4_set_passive(struct brcmf_chip_priv *chip)
  13780. - {
  13781. - struct brcmf_core *core;
  13782. -
  13783. -@@ -951,11 +951,11 @@ brcmf_chip_cr4_enterdl(struct brcmf_chip
  13784. - D11_BCMA_IOCTL_PHYCLOCKEN);
  13785. - }
  13786. -
  13787. --static bool brcmf_chip_cr4_exitdl(struct brcmf_chip_priv *chip, u32 rstvec)
  13788. -+static bool brcmf_chip_cr4_set_active(struct brcmf_chip_priv *chip, u32 rstvec)
  13789. - {
  13790. - struct brcmf_core *core;
  13791. -
  13792. -- chip->ops->exit_dl(chip->ctx, &chip->pub, rstvec);
  13793. -+ chip->ops->activate(chip->ctx, &chip->pub, rstvec);
  13794. -
  13795. - /* restore ARM */
  13796. - core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_ARM_CR4);
  13797. -@@ -964,7 +964,7 @@ static bool brcmf_chip_cr4_exitdl(struct
  13798. - return true;
  13799. - }
  13800. -
  13801. --void brcmf_chip_enter_download(struct brcmf_chip *pub)
  13802. -+void brcmf_chip_set_passive(struct brcmf_chip *pub)
  13803. - {
  13804. - struct brcmf_chip_priv *chip;
  13805. - struct brcmf_core *arm;
  13806. -@@ -974,14 +974,14 @@ void brcmf_chip_enter_download(struct br
  13807. - chip = container_of(pub, struct brcmf_chip_priv, pub);
  13808. - arm = brcmf_chip_get_core(pub, BCMA_CORE_ARM_CR4);
  13809. - if (arm) {
  13810. -- brcmf_chip_cr4_enterdl(chip);
  13811. -+ brcmf_chip_cr4_set_passive(chip);
  13812. - return;
  13813. - }
  13814. -
  13815. -- brcmf_chip_cm3_enterdl(chip);
  13816. -+ brcmf_chip_cm3_set_passive(chip);
  13817. - }
  13818. -
  13819. --bool brcmf_chip_exit_download(struct brcmf_chip *pub, u32 rstvec)
  13820. -+bool brcmf_chip_set_active(struct brcmf_chip *pub, u32 rstvec)
  13821. - {
  13822. - struct brcmf_chip_priv *chip;
  13823. - struct brcmf_core *arm;
  13824. -@@ -991,9 +991,9 @@ bool brcmf_chip_exit_download(struct brc
  13825. - chip = container_of(pub, struct brcmf_chip_priv, pub);
  13826. - arm = brcmf_chip_get_core(pub, BCMA_CORE_ARM_CR4);
  13827. - if (arm)
  13828. -- return brcmf_chip_cr4_exitdl(chip, rstvec);
  13829. -+ return brcmf_chip_cr4_set_active(chip, rstvec);
  13830. -
  13831. -- return brcmf_chip_cm3_exitdl(chip);
  13832. -+ return brcmf_chip_cm3_set_active(chip);
  13833. - }
  13834. -
  13835. - bool brcmf_chip_sr_capable(struct brcmf_chip *pub)
  13836. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  13837. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  13838. -@@ -64,7 +64,7 @@ struct brcmf_core {
  13839. - * @write32: write 32-bit value over bus.
  13840. - * @prepare: prepare bus for core configuration.
  13841. - * @setup: bus-specific core setup.
  13842. -- * @exit_dl: exit download state.
  13843. -+ * @active: chip becomes active.
  13844. - * The callback should use the provided @rstvec when non-zero.
  13845. - */
  13846. - struct brcmf_buscore_ops {
  13847. -@@ -72,7 +72,7 @@ struct brcmf_buscore_ops {
  13848. - void (*write32)(void *ctx, u32 addr, u32 value);
  13849. - int (*prepare)(void *ctx);
  13850. - int (*setup)(void *ctx, struct brcmf_chip *chip);
  13851. -- void (*exit_dl)(void *ctx, struct brcmf_chip *chip, u32 rstvec);
  13852. -+ void (*activate)(void *ctx, struct brcmf_chip *chip, u32 rstvec);
  13853. - };
  13854. -
  13855. - struct brcmf_chip *brcmf_chip_attach(void *ctx,
  13856. -@@ -84,8 +84,8 @@ bool brcmf_chip_iscoreup(struct brcmf_co
  13857. - void brcmf_chip_coredisable(struct brcmf_core *core, u32 prereset, u32 reset);
  13858. - void brcmf_chip_resetcore(struct brcmf_core *core, u32 prereset, u32 reset,
  13859. - u32 postreset);
  13860. --void brcmf_chip_enter_download(struct brcmf_chip *ci);
  13861. --bool brcmf_chip_exit_download(struct brcmf_chip *ci, u32 rstvec);
  13862. -+void brcmf_chip_set_passive(struct brcmf_chip *ci);
  13863. -+bool brcmf_chip_set_active(struct brcmf_chip *ci, u32 rstvec);
  13864. - bool brcmf_chip_sr_capable(struct brcmf_chip *pub);
  13865. -
  13866. - #endif /* BRCMF_AXIDMP_H */
  13867. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  13868. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  13869. -@@ -509,7 +509,7 @@ static void brcmf_pcie_attach(struct brc
  13870. -
  13871. - static int brcmf_pcie_enter_download_state(struct brcmf_pciedev_info *devinfo)
  13872. - {
  13873. -- brcmf_chip_enter_download(devinfo->ci);
  13874. -+ brcmf_chip_set_passive(devinfo->ci);
  13875. -
  13876. - if (devinfo->ci->chip == BRCM_CC_43602_CHIP_ID) {
  13877. - brcmf_pcie_select_core(devinfo, BCMA_CORE_ARM_CR4);
  13878. -@@ -536,7 +536,7 @@ static int brcmf_pcie_exit_download_stat
  13879. - brcmf_chip_resetcore(core, 0, 0, 0);
  13880. - }
  13881. -
  13882. -- return !brcmf_chip_exit_download(devinfo->ci, resetintr);
  13883. -+ return !brcmf_chip_set_active(devinfo->ci, resetintr);
  13884. - }
  13885. -
  13886. -
  13887. -@@ -1566,8 +1566,8 @@ static int brcmf_pcie_buscoreprep(void *
  13888. - }
  13889. -
  13890. -
  13891. --static void brcmf_pcie_buscore_exitdl(void *ctx, struct brcmf_chip *chip,
  13892. -- u32 rstvec)
  13893. -+static void brcmf_pcie_buscore_activate(void *ctx, struct brcmf_chip *chip,
  13894. -+ u32 rstvec)
  13895. - {
  13896. - struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)ctx;
  13897. -
  13898. -@@ -1577,7 +1577,7 @@ static void brcmf_pcie_buscore_exitdl(vo
  13899. -
  13900. - static const struct brcmf_buscore_ops brcmf_pcie_buscore_ops = {
  13901. - .prepare = brcmf_pcie_buscoreprep,
  13902. -- .exit_dl = brcmf_pcie_buscore_exitdl,
  13903. -+ .activate = brcmf_pcie_buscore_activate,
  13904. - .read32 = brcmf_pcie_buscore_read32,
  13905. - .write32 = brcmf_pcie_buscore_write32,
  13906. - };
  13907. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13908. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  13909. -@@ -3357,7 +3357,7 @@ static int brcmf_sdio_download_firmware(
  13910. - brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
  13911. -
  13912. - /* Keep arm in reset */
  13913. -- brcmf_chip_enter_download(bus->ci);
  13914. -+ brcmf_chip_set_passive(bus->ci);
  13915. -
  13916. - rstvec = get_unaligned_le32(fw->data);
  13917. - brcmf_dbg(SDIO, "firmware rstvec: %x\n", rstvec);
  13918. -@@ -3378,7 +3378,7 @@ static int brcmf_sdio_download_firmware(
  13919. - }
  13920. -
  13921. - /* Take arm out of reset */
  13922. -- if (!brcmf_chip_exit_download(bus->ci, rstvec)) {
  13923. -+ if (!brcmf_chip_set_active(bus->ci, rstvec)) {
  13924. - brcmf_err("error getting out of ARM core reset\n");
  13925. - goto err;
  13926. - }
  13927. -@@ -3771,8 +3771,8 @@ static int brcmf_sdio_buscoreprep(void *
  13928. - return 0;
  13929. - }
  13930. -
  13931. --static void brcmf_sdio_buscore_exitdl(void *ctx, struct brcmf_chip *chip,
  13932. -- u32 rstvec)
  13933. -+static void brcmf_sdio_buscore_activate(void *ctx, struct brcmf_chip *chip,
  13934. -+ u32 rstvec)
  13935. - {
  13936. - struct brcmf_sdio_dev *sdiodev = ctx;
  13937. - struct brcmf_core *core;
  13938. -@@ -3815,7 +3815,7 @@ static void brcmf_sdio_buscore_write32(v
  13939. -
  13940. - static const struct brcmf_buscore_ops brcmf_sdio_buscore_ops = {
  13941. - .prepare = brcmf_sdio_buscoreprep,
  13942. -- .exit_dl = brcmf_sdio_buscore_exitdl,
  13943. -+ .activate = brcmf_sdio_buscore_activate,
  13944. - .read32 = brcmf_sdio_buscore_read32,
  13945. - .write32 = brcmf_sdio_buscore_write32,
  13946. - };
  13947. -@@ -4239,12 +4239,11 @@ void brcmf_sdio_remove(struct brcmf_sdio
  13948. - sdio_claim_host(bus->sdiodev->func[1]);
  13949. - brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
  13950. - /* Leave the device in state where it is
  13951. -- * 'quiet'. This is done by putting it in
  13952. -- * download_state which essentially resets
  13953. -- * all necessary cores.
  13954. -+ * 'passive'. This is done by resetting all
  13955. -+ * necessary cores.
  13956. - */
  13957. - msleep(20);
  13958. -- brcmf_chip_enter_download(bus->ci);
  13959. -+ brcmf_chip_set_passive(bus->ci);
  13960. - brcmf_sdio_clkctl(bus, CLK_NONE, false);
  13961. - sdio_release_host(bus->sdiodev->func[1]);
  13962. - }
  13963. 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
  13964. deleted file mode 100644
  13965. index 6b1dd81..0000000
  13966. --- a/package/kernel/mac80211/patches/336-0004-brcmfmac-assure-device-is-ready-for-download-after-b.patch
  13967. +++ /dev/null
  13968. @@ -1,61 +0,0 @@
  13969. -From: Arend van Spriel <arend@broadcom.com>
  13970. -Date: Wed, 11 Mar 2015 16:11:30 +0100
  13971. -Subject: [PATCH] brcmfmac: assure device is ready for download after
  13972. - brcmf_chip_attach()
  13973. -
  13974. -Make the brcmf_chip_attach() function responsible for putting the
  13975. -device in a state where it is accessible for firmware download.
  13976. -
  13977. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  13978. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  13979. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  13980. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13981. ----
  13982. -
  13983. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  13984. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  13985. -@@ -786,12 +786,6 @@ static int brcmf_chip_setup(struct brcmf
  13986. - if (chip->ops->setup)
  13987. - ret = chip->ops->setup(chip->ctx, pub);
  13988. -
  13989. -- /*
  13990. -- * Make sure any on-chip ARM is off (in case strapping is wrong),
  13991. -- * or downloaded code was already running.
  13992. -- */
  13993. -- brcmf_chip_disable_arm(chip, BCMA_CORE_ARM_CM3);
  13994. -- brcmf_chip_disable_arm(chip, BCMA_CORE_ARM_CR4);
  13995. - return ret;
  13996. - }
  13997. -
  13998. -@@ -833,6 +827,8 @@ struct brcmf_chip *brcmf_chip_attach(voi
  13999. - if (err < 0)
  14000. - goto fail;
  14001. -
  14002. -+ /* assure chip is passive for download */
  14003. -+ brcmf_chip_set_passive(&chip->pub);
  14004. - return &chip->pub;
  14005. -
  14006. - fail:
  14007. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  14008. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  14009. -@@ -509,8 +509,6 @@ static void brcmf_pcie_attach(struct brc
  14010. -
  14011. - static int brcmf_pcie_enter_download_state(struct brcmf_pciedev_info *devinfo)
  14012. - {
  14013. -- brcmf_chip_set_passive(devinfo->ci);
  14014. --
  14015. - if (devinfo->ci->chip == BRCM_CC_43602_CHIP_ID) {
  14016. - brcmf_pcie_select_core(devinfo, BCMA_CORE_ARM_CR4);
  14017. - brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_ARMCR4REG_BANKIDX,
  14018. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14019. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14020. -@@ -3356,9 +3356,6 @@ static int brcmf_sdio_download_firmware(
  14021. - sdio_claim_host(bus->sdiodev->func[1]);
  14022. - brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
  14023. -
  14024. -- /* Keep arm in reset */
  14025. -- brcmf_chip_set_passive(bus->ci);
  14026. --
  14027. - rstvec = get_unaligned_le32(fw->data);
  14028. - brcmf_dbg(SDIO, "firmware rstvec: %x\n", rstvec);
  14029. -
  14030. 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
  14031. deleted file mode 100644
  14032. index bcc2ed4..0000000
  14033. --- a/package/kernel/mac80211/patches/336-0005-brcmfmac-extract-ram-size-info-from-internal-memory-.patch
  14034. +++ /dev/null
  14035. @@ -1,367 +0,0 @@
  14036. -From: Arend van Spriel <arend@broadcom.com>
  14037. -Date: Wed, 11 Mar 2015 16:11:31 +0100
  14038. -Subject: [PATCH] brcmfmac: extract ram size info from internal memory
  14039. - registers
  14040. -
  14041. -Instead of hard-coded memory sizes it is possible to obtain that
  14042. -information from the internal memory registers.
  14043. -
  14044. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14045. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  14046. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14047. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14048. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14049. ----
  14050. -
  14051. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  14052. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  14053. -@@ -100,9 +100,6 @@
  14054. - #define BCM4329_CORE_SOCRAM_BASE 0x18003000
  14055. - /* ARM Cortex M3 core, ID 0x82a */
  14056. - #define BCM4329_CORE_ARM_BASE 0x18002000
  14057. --#define BCM4329_RAMSIZE 0x48000
  14058. --/* bcm43143 */
  14059. --#define BCM43143_RAMSIZE 0x70000
  14060. -
  14061. - #define CORE_SB(base, field) \
  14062. - (base + SBCONFIGOFF + offsetof(struct sbconfig, field))
  14063. -@@ -150,6 +147,78 @@ struct sbconfig {
  14064. - u32 sbidhigh; /* identification */
  14065. - };
  14066. -
  14067. -+/* bankidx and bankinfo reg defines corerev >= 8 */
  14068. -+#define SOCRAM_BANKINFO_RETNTRAM_MASK 0x00010000
  14069. -+#define SOCRAM_BANKINFO_SZMASK 0x0000007f
  14070. -+#define SOCRAM_BANKIDX_ROM_MASK 0x00000100
  14071. -+
  14072. -+#define SOCRAM_BANKIDX_MEMTYPE_SHIFT 8
  14073. -+/* socram bankinfo memtype */
  14074. -+#define SOCRAM_MEMTYPE_RAM 0
  14075. -+#define SOCRAM_MEMTYPE_R0M 1
  14076. -+#define SOCRAM_MEMTYPE_DEVRAM 2
  14077. -+
  14078. -+#define SOCRAM_BANKINFO_SZBASE 8192
  14079. -+#define SRCI_LSS_MASK 0x00f00000
  14080. -+#define SRCI_LSS_SHIFT 20
  14081. -+#define SRCI_SRNB_MASK 0xf0
  14082. -+#define SRCI_SRNB_SHIFT 4
  14083. -+#define SRCI_SRBSZ_MASK 0xf
  14084. -+#define SRCI_SRBSZ_SHIFT 0
  14085. -+#define SR_BSZ_BASE 14
  14086. -+
  14087. -+struct sbsocramregs {
  14088. -+ u32 coreinfo;
  14089. -+ u32 bwalloc;
  14090. -+ u32 extracoreinfo;
  14091. -+ u32 biststat;
  14092. -+ u32 bankidx;
  14093. -+ u32 standbyctrl;
  14094. -+
  14095. -+ u32 errlogstatus; /* rev 6 */
  14096. -+ u32 errlogaddr; /* rev 6 */
  14097. -+ /* used for patching rev 3 & 5 */
  14098. -+ u32 cambankidx;
  14099. -+ u32 cambankstandbyctrl;
  14100. -+ u32 cambankpatchctrl;
  14101. -+ u32 cambankpatchtblbaseaddr;
  14102. -+ u32 cambankcmdreg;
  14103. -+ u32 cambankdatareg;
  14104. -+ u32 cambankmaskreg;
  14105. -+ u32 PAD[1];
  14106. -+ u32 bankinfo; /* corev 8 */
  14107. -+ u32 bankpda;
  14108. -+ u32 PAD[14];
  14109. -+ u32 extmemconfig;
  14110. -+ u32 extmemparitycsr;
  14111. -+ u32 extmemparityerrdata;
  14112. -+ u32 extmemparityerrcnt;
  14113. -+ u32 extmemwrctrlandsize;
  14114. -+ u32 PAD[84];
  14115. -+ u32 workaround;
  14116. -+ u32 pwrctl; /* corerev >= 2 */
  14117. -+ u32 PAD[133];
  14118. -+ u32 sr_control; /* corerev >= 15 */
  14119. -+ u32 sr_status; /* corerev >= 15 */
  14120. -+ u32 sr_address; /* corerev >= 15 */
  14121. -+ u32 sr_data; /* corerev >= 15 */
  14122. -+};
  14123. -+
  14124. -+#define SOCRAMREGOFFS(_f) offsetof(struct sbsocramregs, _f)
  14125. -+
  14126. -+#define ARMCR4_CAP (0x04)
  14127. -+#define ARMCR4_BANKIDX (0x40)
  14128. -+#define ARMCR4_BANKINFO (0x44)
  14129. -+#define ARMCR4_BANKPDA (0x4C)
  14130. -+
  14131. -+#define ARMCR4_TCBBNB_MASK 0xf0
  14132. -+#define ARMCR4_TCBBNB_SHIFT 4
  14133. -+#define ARMCR4_TCBANB_MASK 0xf
  14134. -+#define ARMCR4_TCBANB_SHIFT 0
  14135. -+
  14136. -+#define ARMCR4_BSZ_MASK 0x3f
  14137. -+#define ARMCR4_BSZ_MULT 8192
  14138. -+
  14139. - struct brcmf_core_priv {
  14140. - struct brcmf_core pub;
  14141. - u32 wrapbase;
  14142. -@@ -443,10 +512,6 @@ static int brcmf_chip_cores_check(struct
  14143. - break;
  14144. - case BCMA_CORE_ARM_CR4:
  14145. - cpu_found = true;
  14146. -- if (ci->pub.rambase == 0) {
  14147. -- brcmf_err("RAM base not provided with ARM CR4 core\n");
  14148. -- return -ENOMEM;
  14149. -- }
  14150. - break;
  14151. - default:
  14152. - break;
  14153. -@@ -462,60 +527,160 @@ static int brcmf_chip_cores_check(struct
  14154. - brcmf_err("RAM core not provided with ARM CM3 core\n");
  14155. - return -ENODEV;
  14156. - }
  14157. -- if (!ci->pub.ramsize) {
  14158. -- brcmf_err("RAM size is undetermined\n");
  14159. -- return -ENOMEM;
  14160. -- }
  14161. - return 0;
  14162. - }
  14163. -
  14164. --static void brcmf_chip_get_raminfo(struct brcmf_chip_priv *ci)
  14165. -+static u32 brcmf_chip_core_read32(struct brcmf_core_priv *core, u16 reg)
  14166. - {
  14167. -- switch (ci->pub.chip) {
  14168. -- case BRCM_CC_4329_CHIP_ID:
  14169. -- ci->pub.ramsize = BCM4329_RAMSIZE;
  14170. -- break;
  14171. -- case BRCM_CC_43143_CHIP_ID:
  14172. -- ci->pub.ramsize = BCM43143_RAMSIZE;
  14173. -- break;
  14174. -- case BRCM_CC_43241_CHIP_ID:
  14175. -- ci->pub.ramsize = 0x90000;
  14176. -- break;
  14177. -- case BRCM_CC_4330_CHIP_ID:
  14178. -- ci->pub.ramsize = 0x48000;
  14179. -- break;
  14180. -+ return core->chip->ops->read32(core->chip->ctx, core->pub.base + reg);
  14181. -+}
  14182. -+
  14183. -+static void brcmf_chip_core_write32(struct brcmf_core_priv *core,
  14184. -+ u16 reg, u32 val)
  14185. -+{
  14186. -+ core->chip->ops->write32(core->chip->ctx, core->pub.base + reg, val);
  14187. -+}
  14188. -+
  14189. -+static bool brcmf_chip_socram_banksize(struct brcmf_core_priv *core, u8 idx,
  14190. -+ u32 *banksize)
  14191. -+{
  14192. -+ u32 bankinfo;
  14193. -+ u32 bankidx = (SOCRAM_MEMTYPE_RAM << SOCRAM_BANKIDX_MEMTYPE_SHIFT);
  14194. -+
  14195. -+ bankidx |= idx;
  14196. -+ brcmf_chip_core_write32(core, SOCRAMREGOFFS(bankidx), bankidx);
  14197. -+ bankinfo = brcmf_chip_core_read32(core, SOCRAMREGOFFS(bankinfo));
  14198. -+ *banksize = (bankinfo & SOCRAM_BANKINFO_SZMASK) + 1;
  14199. -+ *banksize *= SOCRAM_BANKINFO_SZBASE;
  14200. -+ return !!(bankinfo & SOCRAM_BANKINFO_RETNTRAM_MASK);
  14201. -+}
  14202. -+
  14203. -+static void brcmf_chip_socram_ramsize(struct brcmf_core_priv *sr, u32 *ramsize,
  14204. -+ u32 *srsize)
  14205. -+{
  14206. -+ u32 coreinfo;
  14207. -+ uint nb, banksize, lss;
  14208. -+ bool retent;
  14209. -+ int i;
  14210. -+
  14211. -+ *ramsize = 0;
  14212. -+ *srsize = 0;
  14213. -+
  14214. -+ if (WARN_ON(sr->pub.rev < 4))
  14215. -+ return;
  14216. -+
  14217. -+ if (!brcmf_chip_iscoreup(&sr->pub))
  14218. -+ brcmf_chip_resetcore(&sr->pub, 0, 0, 0);
  14219. -+
  14220. -+ /* Get info for determining size */
  14221. -+ coreinfo = brcmf_chip_core_read32(sr, SOCRAMREGOFFS(coreinfo));
  14222. -+ nb = (coreinfo & SRCI_SRNB_MASK) >> SRCI_SRNB_SHIFT;
  14223. -+
  14224. -+ if ((sr->pub.rev <= 7) || (sr->pub.rev == 12)) {
  14225. -+ banksize = (coreinfo & SRCI_SRBSZ_MASK);
  14226. -+ lss = (coreinfo & SRCI_LSS_MASK) >> SRCI_LSS_SHIFT;
  14227. -+ if (lss != 0)
  14228. -+ nb--;
  14229. -+ *ramsize = nb * (1 << (banksize + SR_BSZ_BASE));
  14230. -+ if (lss != 0)
  14231. -+ *ramsize += (1 << ((lss - 1) + SR_BSZ_BASE));
  14232. -+ } else {
  14233. -+ nb = (coreinfo & SRCI_SRNB_MASK) >> SRCI_SRNB_SHIFT;
  14234. -+ for (i = 0; i < nb; i++) {
  14235. -+ retent = brcmf_chip_socram_banksize(sr, i, &banksize);
  14236. -+ *ramsize += banksize;
  14237. -+ if (retent)
  14238. -+ *srsize += banksize;
  14239. -+ }
  14240. -+ }
  14241. -+
  14242. -+ /* hardcoded save&restore memory sizes */
  14243. -+ switch (sr->chip->pub.chip) {
  14244. - case BRCM_CC_4334_CHIP_ID:
  14245. -- case BRCM_CC_43340_CHIP_ID:
  14246. -- ci->pub.ramsize = 0x80000;
  14247. -+ if (sr->chip->pub.chiprev < 2)
  14248. -+ *srsize = (32 * 1024);
  14249. - break;
  14250. -- case BRCM_CC_4335_CHIP_ID:
  14251. -- ci->pub.ramsize = 0xc0000;
  14252. -- ci->pub.rambase = 0x180000;
  14253. -- break;
  14254. -- case BRCM_CC_43362_CHIP_ID:
  14255. -- ci->pub.ramsize = 0x3c000;
  14256. -+ default:
  14257. - break;
  14258. -+ }
  14259. -+}
  14260. -+
  14261. -+/** Return the TCM-RAM size of the ARMCR4 core. */
  14262. -+static u32 brcmf_chip_tcm_ramsize(struct brcmf_core_priv *cr4)
  14263. -+{
  14264. -+ u32 corecap;
  14265. -+ u32 memsize = 0;
  14266. -+ u32 nab;
  14267. -+ u32 nbb;
  14268. -+ u32 totb;
  14269. -+ u32 bxinfo;
  14270. -+ u32 idx;
  14271. -+
  14272. -+ corecap = brcmf_chip_core_read32(cr4, ARMCR4_CAP);
  14273. -+
  14274. -+ nab = (corecap & ARMCR4_TCBANB_MASK) >> ARMCR4_TCBANB_SHIFT;
  14275. -+ nbb = (corecap & ARMCR4_TCBBNB_MASK) >> ARMCR4_TCBBNB_SHIFT;
  14276. -+ totb = nab + nbb;
  14277. -+
  14278. -+ for (idx = 0; idx < totb; idx++) {
  14279. -+ brcmf_chip_core_write32(cr4, ARMCR4_BANKIDX, idx);
  14280. -+ bxinfo = brcmf_chip_core_read32(cr4, ARMCR4_BANKINFO);
  14281. -+ memsize += ((bxinfo & ARMCR4_BSZ_MASK) + 1) * ARMCR4_BSZ_MULT;
  14282. -+ }
  14283. -+
  14284. -+ return memsize;
  14285. -+}
  14286. -+
  14287. -+static u32 brcmf_chip_tcm_rambase(struct brcmf_chip_priv *ci)
  14288. -+{
  14289. -+ switch (ci->pub.chip) {
  14290. - case BRCM_CC_4345_CHIP_ID:
  14291. -- ci->pub.ramsize = 0xc8000;
  14292. -- ci->pub.rambase = 0x198000;
  14293. -- break;
  14294. -+ return 0x198000;
  14295. -+ case BRCM_CC_4335_CHIP_ID:
  14296. - case BRCM_CC_4339_CHIP_ID:
  14297. - case BRCM_CC_4354_CHIP_ID:
  14298. - case BRCM_CC_4356_CHIP_ID:
  14299. - case BRCM_CC_43567_CHIP_ID:
  14300. - case BRCM_CC_43569_CHIP_ID:
  14301. - case BRCM_CC_43570_CHIP_ID:
  14302. -- ci->pub.ramsize = 0xc0000;
  14303. -- ci->pub.rambase = 0x180000;
  14304. -- break;
  14305. - case BRCM_CC_43602_CHIP_ID:
  14306. -- ci->pub.ramsize = 0xf0000;
  14307. -- ci->pub.rambase = 0x180000;
  14308. -- break;
  14309. -+ return 0x180000;
  14310. - default:
  14311. - brcmf_err("unknown chip: %s\n", ci->pub.name);
  14312. - break;
  14313. - }
  14314. -+ return 0;
  14315. -+}
  14316. -+
  14317. -+static int brcmf_chip_get_raminfo(struct brcmf_chip_priv *ci)
  14318. -+{
  14319. -+ struct brcmf_core_priv *mem_core;
  14320. -+ struct brcmf_core *mem;
  14321. -+
  14322. -+ mem = brcmf_chip_get_core(&ci->pub, BCMA_CORE_ARM_CR4);
  14323. -+ if (mem) {
  14324. -+ mem_core = container_of(mem, struct brcmf_core_priv, pub);
  14325. -+ ci->pub.ramsize = brcmf_chip_tcm_ramsize(mem_core);
  14326. -+ ci->pub.rambase = brcmf_chip_tcm_rambase(ci);
  14327. -+ if (!ci->pub.rambase) {
  14328. -+ brcmf_err("RAM base not provided with ARM CR4 core\n");
  14329. -+ return -EINVAL;
  14330. -+ }
  14331. -+ } else {
  14332. -+ mem = brcmf_chip_get_core(&ci->pub, BCMA_CORE_INTERNAL_MEM);
  14333. -+ mem_core = container_of(mem, struct brcmf_core_priv, pub);
  14334. -+ brcmf_chip_socram_ramsize(mem_core, &ci->pub.ramsize,
  14335. -+ &ci->pub.srsize);
  14336. -+ }
  14337. -+ brcmf_dbg(INFO, "RAM: base=0x%x size=%d (0x%x) sr=%d (0x%x)\n",
  14338. -+ ci->pub.rambase, ci->pub.ramsize, ci->pub.ramsize,
  14339. -+ ci->pub.srsize, ci->pub.srsize);
  14340. -+
  14341. -+ if (!ci->pub.ramsize) {
  14342. -+ brcmf_err("RAM size is undetermined\n");
  14343. -+ return -ENOMEM;
  14344. -+ }
  14345. -+ return 0;
  14346. - }
  14347. -
  14348. - static u32 brcmf_chip_dmp_get_desc(struct brcmf_chip_priv *ci, u32 *eromaddr,
  14349. -@@ -668,6 +833,7 @@ static int brcmf_chip_recognition(struct
  14350. - struct brcmf_core *core;
  14351. - u32 regdata;
  14352. - u32 socitype;
  14353. -+ int ret;
  14354. -
  14355. - /* Get CC core rev
  14356. - * Chipid is assume to be at offset 0 from SI_ENUM_BASE
  14357. -@@ -720,9 +886,13 @@ static int brcmf_chip_recognition(struct
  14358. - return -ENODEV;
  14359. - }
  14360. -
  14361. -- brcmf_chip_get_raminfo(ci);
  14362. --
  14363. -- return brcmf_chip_cores_check(ci);
  14364. -+ ret = brcmf_chip_cores_check(ci);
  14365. -+ if (ret)
  14366. -+ return ret;
  14367. -+
  14368. -+ /* assure chip is passive for core access */
  14369. -+ brcmf_chip_set_passive(&ci->pub);
  14370. -+ return brcmf_chip_get_raminfo(ci);
  14371. - }
  14372. -
  14373. - static void brcmf_chip_disable_arm(struct brcmf_chip_priv *chip, u16 id)
  14374. -@@ -827,8 +997,6 @@ struct brcmf_chip *brcmf_chip_attach(voi
  14375. - if (err < 0)
  14376. - goto fail;
  14377. -
  14378. -- /* assure chip is passive for download */
  14379. -- brcmf_chip_set_passive(&chip->pub);
  14380. - return &chip->pub;
  14381. -
  14382. - fail:
  14383. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  14384. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  14385. -@@ -30,7 +30,8 @@
  14386. - * @pmucaps: PMU capabilities.
  14387. - * @pmurev: PMU revision.
  14388. - * @rambase: RAM base address (only applicable for ARM CR4 chips).
  14389. -- * @ramsize: amount of RAM on chip.
  14390. -+ * @ramsize: amount of RAM on chip including retention.
  14391. -+ * @srsize: amount of retention RAM on chip.
  14392. - * @name: string representation of the chip identifier.
  14393. - */
  14394. - struct brcmf_chip {
  14395. -@@ -41,6 +42,7 @@ struct brcmf_chip {
  14396. - u32 pmurev;
  14397. - u32 rambase;
  14398. - u32 ramsize;
  14399. -+ u32 srsize;
  14400. - char name[8];
  14401. - };
  14402. -
  14403. 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
  14404. deleted file mode 100644
  14405. index 69618a7..0000000
  14406. --- a/package/kernel/mac80211/patches/336-0006-brcmfmac-take-save-restore-memory-into-account-for-S.patch
  14407. +++ /dev/null
  14408. @@ -1,96 +0,0 @@
  14409. -From: Arend van Spriel <arend@broadcom.com>
  14410. -Date: Wed, 11 Mar 2015 16:11:32 +0100
  14411. -Subject: [PATCH] brcmfmac: take save&restore memory into account for SDIO
  14412. - shared info
  14413. -
  14414. -The firmware provides pointer to SDIO shared information at end of
  14415. -RAM during firmware initialization. End of RAM is obviously determined
  14416. -by the actual ram size, but part of that may be used for save&restore
  14417. -memory. In that case another location in RAM will hold the pointer.
  14418. -
  14419. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14420. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14421. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14422. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14423. ----
  14424. -
  14425. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14426. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14427. -@@ -1067,44 +1067,47 @@ static inline bool brcmf_sdio_valid_shar
  14428. - static int brcmf_sdio_readshared(struct brcmf_sdio *bus,
  14429. - struct sdpcm_shared *sh)
  14430. - {
  14431. -- u32 addr;
  14432. -+ u32 addr = 0;
  14433. - int rv;
  14434. - u32 shaddr = 0;
  14435. - struct sdpcm_shared_le sh_le;
  14436. - __le32 addr_le;
  14437. -
  14438. -- shaddr = bus->ci->rambase + bus->ci->ramsize - 4;
  14439. -+ sdio_claim_host(bus->sdiodev->func[1]);
  14440. -+ brcmf_sdio_bus_sleep(bus, false, false);
  14441. -
  14442. - /*
  14443. - * Read last word in socram to determine
  14444. - * address of sdpcm_shared structure
  14445. - */
  14446. -- sdio_claim_host(bus->sdiodev->func[1]);
  14447. -- brcmf_sdio_bus_sleep(bus, false, false);
  14448. -- rv = brcmf_sdiod_ramrw(bus->sdiodev, false, shaddr, (u8 *)&addr_le, 4);
  14449. -- sdio_release_host(bus->sdiodev->func[1]);
  14450. -+ shaddr = bus->ci->rambase + bus->ci->ramsize - 4;
  14451. -+ if (!bus->ci->rambase && brcmf_chip_sr_capable(bus->ci))
  14452. -+ shaddr -= bus->ci->srsize;
  14453. -+ rv = brcmf_sdiod_ramrw(bus->sdiodev, false, shaddr,
  14454. -+ (u8 *)&addr_le, 4);
  14455. - if (rv < 0)
  14456. -- return rv;
  14457. --
  14458. -- addr = le32_to_cpu(addr_le);
  14459. --
  14460. -- brcmf_dbg(SDIO, "sdpcm_shared address 0x%08X\n", addr);
  14461. -+ goto fail;
  14462. -
  14463. - /*
  14464. - * Check if addr is valid.
  14465. - * NVRAM length at the end of memory should have been overwritten.
  14466. - */
  14467. -+ addr = le32_to_cpu(addr_le);
  14468. - if (!brcmf_sdio_valid_shared_address(addr)) {
  14469. -- brcmf_err("invalid sdpcm_shared address 0x%08X\n",
  14470. -- addr);
  14471. -- return -EINVAL;
  14472. -+ brcmf_err("invalid sdpcm_shared address 0x%08X\n", addr);
  14473. -+ rv = -EINVAL;
  14474. -+ goto fail;
  14475. - }
  14476. -
  14477. -+ brcmf_dbg(INFO, "sdpcm_shared address 0x%08X\n", addr);
  14478. -+
  14479. - /* Read hndrte_shared structure */
  14480. - rv = brcmf_sdiod_ramrw(bus->sdiodev, false, addr, (u8 *)&sh_le,
  14481. - sizeof(struct sdpcm_shared_le));
  14482. - if (rv < 0)
  14483. -- return rv;
  14484. -+ goto fail;
  14485. -+
  14486. -+ sdio_release_host(bus->sdiodev->func[1]);
  14487. -
  14488. - /* Endianness */
  14489. - sh->flags = le32_to_cpu(sh_le.flags);
  14490. -@@ -1121,8 +1124,13 @@ static int brcmf_sdio_readshared(struct
  14491. - sh->flags & SDPCM_SHARED_VERSION_MASK);
  14492. - return -EPROTO;
  14493. - }
  14494. --
  14495. - return 0;
  14496. -+
  14497. -+fail:
  14498. -+ brcmf_err("unable to obtain sdpcm_shared info: rv=%d (addr=0x%x)\n",
  14499. -+ rv, addr);
  14500. -+ sdio_release_host(bus->sdiodev->func[1]);
  14501. -+ return rv;
  14502. - }
  14503. -
  14504. - static void brcmf_sdio_get_console_addr(struct brcmf_sdio *bus)
  14505. 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
  14506. deleted file mode 100644
  14507. index 1b10dbb..0000000
  14508. --- a/package/kernel/mac80211/patches/336-0007-brcmfmac-fix-watchdog-timer-regression.patch
  14509. +++ /dev/null
  14510. @@ -1,59 +0,0 @@
  14511. -From: Arend van Spriel <arend@broadcom.com>
  14512. -Date: Wed, 11 Mar 2015 16:11:33 +0100
  14513. -Subject: [PATCH] brcmfmac: fix watchdog timer regression
  14514. -
  14515. -The watchdog timer is used to put the device in a low-power mode when
  14516. -it is idle for some time. This timer is stopped during that mode and
  14517. -should be restarted upon activity. This has been broken by commit
  14518. -d4150fced0365 ("brcmfmac: Simplify watchdog sleep."). This patch
  14519. -restores the behaviour as it was before that commit.
  14520. -
  14521. -Reported-by: Pontus Fuchs <pontusf@broadcom.com>
  14522. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14523. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14524. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14525. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14526. ----
  14527. -
  14528. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14529. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14530. -@@ -972,7 +972,6 @@ static int brcmf_sdio_clkctl(struct brcm
  14531. - brcmf_sdio_sdclk(bus, true);
  14532. - /* Now request HT Avail on the backplane */
  14533. - brcmf_sdio_htclk(bus, true, pendok);
  14534. -- brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  14535. - break;
  14536. -
  14537. - case CLK_SDONLY:
  14538. -@@ -984,7 +983,6 @@ static int brcmf_sdio_clkctl(struct brcm
  14539. - else
  14540. - brcmf_err("request for %d -> %d\n",
  14541. - bus->clkstate, target);
  14542. -- brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  14543. - break;
  14544. -
  14545. - case CLK_NONE:
  14546. -@@ -993,7 +991,6 @@ static int brcmf_sdio_clkctl(struct brcm
  14547. - brcmf_sdio_htclk(bus, false, false);
  14548. - /* Now remove the SD clock */
  14549. - brcmf_sdio_sdclk(bus, false);
  14550. -- brcmf_sdio_wd_timer(bus, 0);
  14551. - break;
  14552. - }
  14553. - #ifdef DEBUG
  14554. -@@ -1048,6 +1045,7 @@ end:
  14555. - brcmf_sdio_clkctl(bus, CLK_NONE, pendok);
  14556. - } else {
  14557. - brcmf_sdio_clkctl(bus, CLK_AVAIL, pendok);
  14558. -+ brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS);
  14559. - }
  14560. - bus->sleeping = sleep;
  14561. - brcmf_dbg(SDIO, "new state %s\n",
  14562. -@@ -4242,6 +4240,7 @@ void brcmf_sdio_remove(struct brcmf_sdio
  14563. - if (bus->ci) {
  14564. - if (bus->sdiodev->state != BRCMF_SDIOD_NOMEDIUM) {
  14565. - sdio_claim_host(bus->sdiodev->func[1]);
  14566. -+ brcmf_sdio_wd_timer(bus, 0);
  14567. - brcmf_sdio_clkctl(bus, CLK_AVAIL, false);
  14568. - /* Leave the device in state where it is
  14569. - * 'passive'. This is done by resetting all
  14570. diff --git a/package/kernel/mac80211/patches/336-ath9k-declare-required-extra-tx-headroom.patch b/package/kernel/mac80211/patches/336-ath9k-declare-required-extra-tx-headroom.patch
  14571. new file mode 100644
  14572. index 0000000..4d88591
  14573. --- /dev/null
  14574. +++ b/package/kernel/mac80211/patches/336-ath9k-declare-required-extra-tx-headroom.patch
  14575. @@ -0,0 +1,22 @@
  14576. +From: Felix Fietkau <nbd@openwrt.org>
  14577. +Date: Thu, 24 Sep 2015 16:57:37 +0200
  14578. +Subject: [PATCH] ath9k: declare required extra tx headroom
  14579. +
  14580. +ath9k inserts padding between the 802.11 header and the data area (to
  14581. +align it). Since it didn't declare this extra required headroom, this
  14582. +led to some nasty issues like randomly dropped packets in some setups.
  14583. +
  14584. +Cc: stable@vger.kernel.org
  14585. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  14586. +---
  14587. +
  14588. +--- a/drivers/net/wireless/ath/ath9k/init.c
  14589. ++++ b/drivers/net/wireless/ath/ath9k/init.c
  14590. +@@ -875,6 +875,7 @@ static void ath9k_set_hw_capab(struct at
  14591. + hw->max_rate_tries = 10;
  14592. + hw->sta_data_size = sizeof(struct ath_node);
  14593. + hw->vif_data_size = sizeof(struct ath_vif);
  14594. ++ hw->extra_tx_headroom = 4;
  14595. +
  14596. + hw->wiphy->available_antennas_rx = BIT(ah->caps.max_rxchains) - 1;
  14597. + hw->wiphy->available_antennas_tx = BIT(ah->caps.max_txchains) - 1;
  14598. 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
  14599. deleted file mode 100644
  14600. index af76f13..0000000
  14601. --- a/package/kernel/mac80211/patches/337-0001-brcmfmac-avoid-runtime-pm-for-sdio-host-controller.patch
  14602. +++ /dev/null
  14603. @@ -1,44 +0,0 @@
  14604. -From: Arend van Spriel <arend@broadcom.com>
  14605. -Date: Wed, 18 Mar 2015 13:25:21 +0100
  14606. -Subject: [PATCH] brcmfmac: avoid runtime-pm for sdio host controller
  14607. -
  14608. -Several host controllers supporting runtime-pm are causing issues
  14609. -with our sdio wireless cards because they disable the sdio interrupt
  14610. -upon going into runtime suspend. This patch avoids that by doing
  14611. -a pm_runtime_forbid() call during the probe. Tested with Sony Vaio
  14612. -Duo 13 which uses sdhci-acpi host controller.
  14613. -
  14614. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14615. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  14616. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14617. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14618. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14619. ----
  14620. -
  14621. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  14622. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  14623. -@@ -29,6 +29,7 @@
  14624. - #include <linux/mmc/host.h>
  14625. - #include <linux/platform_device.h>
  14626. - #include <linux/platform_data/brcmfmac-sdio.h>
  14627. -+#include <linux/pm_runtime.h>
  14628. - #include <linux/suspend.h>
  14629. - #include <linux/errno.h>
  14630. - #include <linux/module.h>
  14631. -@@ -1006,6 +1007,7 @@ static int brcmf_sdiod_remove(struct brc
  14632. - sg_free_table(&sdiodev->sgtable);
  14633. - sdiodev->sbwad = 0;
  14634. -
  14635. -+ pm_runtime_allow(sdiodev->func[1]->card->host->parent);
  14636. - return 0;
  14637. - }
  14638. -
  14639. -@@ -1074,7 +1076,7 @@ static int brcmf_sdiod_probe(struct brcm
  14640. - ret = -ENODEV;
  14641. - goto out;
  14642. - }
  14643. --
  14644. -+ pm_runtime_forbid(host->parent);
  14645. - out:
  14646. - if (ret)
  14647. - brcmf_sdiod_remove(sdiodev);
  14648. 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
  14649. deleted file mode 100644
  14650. index c419cc6..0000000
  14651. --- a/package/kernel/mac80211/patches/337-0002-brcmfmac-Add-necessary-memory-barriers-for-SDIO.patch
  14652. +++ /dev/null
  14653. @@ -1,171 +0,0 @@
  14654. -From: Hante Meuleman <meuleman@broadcom.com>
  14655. -Date: Wed, 18 Mar 2015 13:25:22 +0100
  14656. -Subject: [PATCH] brcmfmac: Add necessary memory barriers for SDIO.
  14657. -
  14658. -SDIO uses a thread to handle all communication with the device,
  14659. -for this data is exchanged between threads. This data needs proper
  14660. -memory barriers to make sure that data "exchange" is going correct.
  14661. -
  14662. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  14663. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  14664. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14665. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  14666. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  14667. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14668. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14669. ----
  14670. -
  14671. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14672. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14673. -@@ -507,8 +507,8 @@ struct brcmf_sdio {
  14674. -
  14675. - struct workqueue_struct *brcmf_wq;
  14676. - struct work_struct datawork;
  14677. -- atomic_t dpc_tskcnt;
  14678. -- atomic_t dpc_running;
  14679. -+ bool dpc_triggered;
  14680. -+ bool dpc_running;
  14681. -
  14682. - bool txoff; /* Transmit flow-controlled */
  14683. - struct brcmf_sdio_count sdcnt;
  14684. -@@ -2713,6 +2713,7 @@ static void brcmf_sdio_dpc(struct brcmf_
  14685. - err = brcmf_sdio_tx_ctrlframe(bus, bus->ctrl_frame_buf,
  14686. - bus->ctrl_frame_len);
  14687. - bus->ctrl_frame_err = err;
  14688. -+ wmb();
  14689. - bus->ctrl_frame_stat = false;
  14690. - }
  14691. - sdio_release_host(bus->sdiodev->func[1]);
  14692. -@@ -2734,6 +2735,7 @@ static void brcmf_sdio_dpc(struct brcmf_
  14693. - sdio_claim_host(bus->sdiodev->func[1]);
  14694. - if (bus->ctrl_frame_stat) {
  14695. - bus->ctrl_frame_err = -ENODEV;
  14696. -+ wmb();
  14697. - bus->ctrl_frame_stat = false;
  14698. - brcmf_sdio_wait_event_wakeup(bus);
  14699. - }
  14700. -@@ -2744,7 +2746,7 @@ static void brcmf_sdio_dpc(struct brcmf_
  14701. - (!atomic_read(&bus->fcstate) &&
  14702. - brcmu_pktq_mlen(&bus->txq, ~bus->flowcontrol) &&
  14703. - data_ok(bus))) {
  14704. -- atomic_inc(&bus->dpc_tskcnt);
  14705. -+ bus->dpc_triggered = true;
  14706. - }
  14707. - }
  14708. -
  14709. -@@ -2940,6 +2942,7 @@ brcmf_sdio_bus_txctl(struct device *dev,
  14710. - /* Send from dpc */
  14711. - bus->ctrl_frame_buf = msg;
  14712. - bus->ctrl_frame_len = msglen;
  14713. -+ wmb();
  14714. - bus->ctrl_frame_stat = true;
  14715. -
  14716. - brcmf_sdio_trigger_dpc(bus);
  14717. -@@ -2958,6 +2961,7 @@ brcmf_sdio_bus_txctl(struct device *dev,
  14718. - if (!ret) {
  14719. - brcmf_dbg(SDIO, "ctrl_frame complete, err=%d\n",
  14720. - bus->ctrl_frame_err);
  14721. -+ rmb();
  14722. - ret = bus->ctrl_frame_err;
  14723. - }
  14724. -
  14725. -@@ -3526,8 +3530,8 @@ done:
  14726. -
  14727. - void brcmf_sdio_trigger_dpc(struct brcmf_sdio *bus)
  14728. - {
  14729. -- if (atomic_read(&bus->dpc_tskcnt) == 0) {
  14730. -- atomic_inc(&bus->dpc_tskcnt);
  14731. -+ if (!bus->dpc_triggered) {
  14732. -+ bus->dpc_triggered = true;
  14733. - queue_work(bus->brcmf_wq, &bus->datawork);
  14734. - }
  14735. - }
  14736. -@@ -3558,7 +3562,7 @@ void brcmf_sdio_isr(struct brcmf_sdio *b
  14737. - if (!bus->intr)
  14738. - brcmf_err("isr w/o interrupt configured!\n");
  14739. -
  14740. -- atomic_inc(&bus->dpc_tskcnt);
  14741. -+ bus->dpc_triggered = true;
  14742. - queue_work(bus->brcmf_wq, &bus->datawork);
  14743. - }
  14744. -
  14745. -@@ -3578,7 +3582,7 @@ static void brcmf_sdio_bus_watchdog(stru
  14746. - if (!bus->intr ||
  14747. - (bus->sdcnt.intrcount == bus->sdcnt.lastintrs)) {
  14748. -
  14749. -- if (atomic_read(&bus->dpc_tskcnt) == 0) {
  14750. -+ if (!bus->dpc_triggered) {
  14751. - u8 devpend;
  14752. -
  14753. - sdio_claim_host(bus->sdiodev->func[1]);
  14754. -@@ -3596,7 +3600,7 @@ static void brcmf_sdio_bus_watchdog(stru
  14755. - bus->sdcnt.pollcnt++;
  14756. - atomic_set(&bus->ipend, 1);
  14757. -
  14758. -- atomic_inc(&bus->dpc_tskcnt);
  14759. -+ bus->dpc_triggered = true;
  14760. - queue_work(bus->brcmf_wq, &bus->datawork);
  14761. - }
  14762. - }
  14763. -@@ -3623,17 +3627,21 @@ static void brcmf_sdio_bus_watchdog(stru
  14764. - #endif /* DEBUG */
  14765. -
  14766. - /* On idle timeout clear activity flag and/or turn off clock */
  14767. -- if ((atomic_read(&bus->dpc_tskcnt) == 0) &&
  14768. -- (atomic_read(&bus->dpc_running) == 0) &&
  14769. -- (bus->idletime > 0) && (bus->clkstate == CLK_AVAIL)) {
  14770. -- bus->idlecount++;
  14771. -- if (bus->idlecount > bus->idletime) {
  14772. -- brcmf_dbg(SDIO, "idle\n");
  14773. -- sdio_claim_host(bus->sdiodev->func[1]);
  14774. -- brcmf_sdio_wd_timer(bus, 0);
  14775. -+ if (!bus->dpc_triggered) {
  14776. -+ rmb();
  14777. -+ if ((!bus->dpc_running) && (bus->idletime > 0) &&
  14778. -+ (bus->clkstate == CLK_AVAIL)) {
  14779. -+ bus->idlecount++;
  14780. -+ if (bus->idlecount > bus->idletime) {
  14781. -+ brcmf_dbg(SDIO, "idle\n");
  14782. -+ sdio_claim_host(bus->sdiodev->func[1]);
  14783. -+ brcmf_sdio_wd_timer(bus, 0);
  14784. -+ bus->idlecount = 0;
  14785. -+ brcmf_sdio_bus_sleep(bus, true, false);
  14786. -+ sdio_release_host(bus->sdiodev->func[1]);
  14787. -+ }
  14788. -+ } else {
  14789. - bus->idlecount = 0;
  14790. -- brcmf_sdio_bus_sleep(bus, true, false);
  14791. -- sdio_release_host(bus->sdiodev->func[1]);
  14792. - }
  14793. - } else {
  14794. - bus->idlecount = 0;
  14795. -@@ -3645,13 +3653,14 @@ static void brcmf_sdio_dataworker(struct
  14796. - struct brcmf_sdio *bus = container_of(work, struct brcmf_sdio,
  14797. - datawork);
  14798. -
  14799. -- while (atomic_read(&bus->dpc_tskcnt)) {
  14800. -- atomic_set(&bus->dpc_running, 1);
  14801. -- atomic_set(&bus->dpc_tskcnt, 0);
  14802. -+ bus->dpc_running = true;
  14803. -+ wmb();
  14804. -+ while (ACCESS_ONCE(bus->dpc_triggered)) {
  14805. -+ bus->dpc_triggered = false;
  14806. - brcmf_sdio_dpc(bus);
  14807. - bus->idlecount = 0;
  14808. -- atomic_set(&bus->dpc_running, 0);
  14809. - }
  14810. -+ bus->dpc_running = false;
  14811. - if (brcmf_sdiod_freezing(bus->sdiodev)) {
  14812. - brcmf_sdiod_change_state(bus->sdiodev, BRCMF_SDIOD_DOWN);
  14813. - brcmf_sdiod_try_freeze(bus->sdiodev);
  14814. -@@ -4144,8 +4153,8 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
  14815. - bus->watchdog_tsk = NULL;
  14816. - }
  14817. - /* Initialize DPC thread */
  14818. -- atomic_set(&bus->dpc_tskcnt, 0);
  14819. -- atomic_set(&bus->dpc_running, 0);
  14820. -+ bus->dpc_triggered = false;
  14821. -+ bus->dpc_running = false;
  14822. -
  14823. - /* Assign bus interface call back */
  14824. - bus->sdiodev->bus_if->dev = bus->sdiodev->dev;
  14825. 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
  14826. deleted file mode 100644
  14827. index 1bc98a0..0000000
  14828. --- a/package/kernel/mac80211/patches/337-0003-brcmfmac-Remove-unnecessary-new-line-in-pcie-console.patch
  14829. +++ /dev/null
  14830. @@ -1,26 +0,0 @@
  14831. -From: Hante Meuleman <meuleman@broadcom.com>
  14832. -Date: Wed, 18 Mar 2015 13:25:24 +0100
  14833. -Subject: [PATCH] brcmfmac: Remove unnecessary new-line in pcie console
  14834. - logging.
  14835. -
  14836. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  14837. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14838. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  14839. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14840. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14841. ----
  14842. -
  14843. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  14844. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  14845. -@@ -651,10 +651,9 @@ static void brcmf_pcie_bus_console_read(
  14846. - console->log_str[console->log_idx] = ch;
  14847. - console->log_idx++;
  14848. - }
  14849. --
  14850. - if (ch == '\n') {
  14851. - console->log_str[console->log_idx] = 0;
  14852. -- brcmf_dbg(PCIE, "CONSOLE: %s\n", console->log_str);
  14853. -+ brcmf_dbg(PCIE, "CONSOLE: %s", console->log_str);
  14854. - console->log_idx = 0;
  14855. - }
  14856. - }
  14857. 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
  14858. deleted file mode 100644
  14859. index fcf0bf3..0000000
  14860. --- a/package/kernel/mac80211/patches/337-0004-brcmfmac-add-MODULE_FIRMWARE-macros-for-bcm4356-PCIe.patch
  14861. +++ /dev/null
  14862. @@ -1,26 +0,0 @@
  14863. -From: Arend van Spriel <arend@broadcom.com>
  14864. -Date: Wed, 18 Mar 2015 13:25:25 +0100
  14865. -Subject: [PATCH] brcmfmac: add MODULE_FIRMWARE() macros for bcm4356 PCIe
  14866. - device
  14867. -
  14868. -The BCM4356 PCIe wireless device was added recently but overlooked
  14869. -the fact that the MODULE_FIRMWARE() macros were missing for the
  14870. -firmwares needed by this device.
  14871. -
  14872. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14873. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14874. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14875. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14876. ----
  14877. -
  14878. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  14879. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  14880. -@@ -189,6 +189,8 @@ MODULE_FIRMWARE(BRCMF_PCIE_43602_FW_NAME
  14881. - MODULE_FIRMWARE(BRCMF_PCIE_43602_NVRAM_NAME);
  14882. - MODULE_FIRMWARE(BRCMF_PCIE_4354_FW_NAME);
  14883. - MODULE_FIRMWARE(BRCMF_PCIE_4354_NVRAM_NAME);
  14884. -+MODULE_FIRMWARE(BRCMF_PCIE_4356_FW_NAME);
  14885. -+MODULE_FIRMWARE(BRCMF_PCIE_4356_NVRAM_NAME);
  14886. - MODULE_FIRMWARE(BRCMF_PCIE_43570_FW_NAME);
  14887. - MODULE_FIRMWARE(BRCMF_PCIE_43570_NVRAM_NAME);
  14888. -
  14889. 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
  14890. deleted file mode 100644
  14891. index b3e9bc9..0000000
  14892. --- a/package/kernel/mac80211/patches/337-0005-brcmfmac-add-support-for-BCM43430-SDIO-chipset.patch
  14893. +++ /dev/null
  14894. @@ -1,138 +0,0 @@
  14895. -From: Arend van Spriel <arend@broadcom.com>
  14896. -Date: Wed, 18 Mar 2015 13:25:26 +0100
  14897. -Subject: [PATCH] brcmfmac: add support for BCM43430 SDIO chipset
  14898. -
  14899. -This patch added support for the BCM43430 802.11n SDIO chipset.
  14900. -
  14901. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  14902. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  14903. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  14904. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  14905. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  14906. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14907. ----
  14908. -
  14909. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  14910. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  14911. -@@ -1098,6 +1098,7 @@ static const struct sdio_device_id brcmf
  14912. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43341),
  14913. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43362),
  14914. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4335_4339),
  14915. -+ BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43430),
  14916. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4345),
  14917. - BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4354),
  14918. - { /* end: all zeroes */ }
  14919. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  14920. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  14921. -@@ -600,6 +600,12 @@ static void brcmf_chip_socram_ramsize(st
  14922. - if (sr->chip->pub.chiprev < 2)
  14923. - *srsize = (32 * 1024);
  14924. - break;
  14925. -+ case BRCM_CC_43430_CHIP_ID:
  14926. -+ /* assume sr for now as we can not check
  14927. -+ * firmware sr capability at this point.
  14928. -+ */
  14929. -+ *srsize = (64 * 1024);
  14930. -+ break;
  14931. - default:
  14932. - break;
  14933. - }
  14934. -@@ -1072,6 +1078,7 @@ static void
  14935. - brcmf_chip_cm3_set_passive(struct brcmf_chip_priv *chip)
  14936. - {
  14937. - struct brcmf_core *core;
  14938. -+ struct brcmf_core_priv *sr;
  14939. -
  14940. - brcmf_chip_disable_arm(chip, BCMA_CORE_ARM_CM3);
  14941. - core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_80211);
  14942. -@@ -1081,6 +1088,13 @@ brcmf_chip_cm3_set_passive(struct brcmf_
  14943. - D11_BCMA_IOCTL_PHYCLOCKEN);
  14944. - core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_INTERNAL_MEM);
  14945. - brcmf_chip_resetcore(core, 0, 0, 0);
  14946. -+
  14947. -+ /* disable bank #3 remap for this device */
  14948. -+ if (chip->pub.chip == BRCM_CC_43430_CHIP_ID) {
  14949. -+ sr = container_of(core, struct brcmf_core_priv, pub);
  14950. -+ brcmf_chip_core_write32(sr, SOCRAMREGOFFS(bankidx), 3);
  14951. -+ brcmf_chip_core_write32(sr, SOCRAMREGOFFS(bankpda), 0);
  14952. -+ }
  14953. - }
  14954. -
  14955. - static bool brcmf_chip_cm3_set_active(struct brcmf_chip_priv *chip)
  14956. -@@ -1188,6 +1202,10 @@ bool brcmf_chip_sr_capable(struct brcmf_
  14957. - addr = CORE_CC_REG(base, chipcontrol_data);
  14958. - reg = chip->ops->read32(chip->ctx, addr);
  14959. - return (reg & pmu_cc3_mask) != 0;
  14960. -+ case BRCM_CC_43430_CHIP_ID:
  14961. -+ addr = CORE_CC_REG(base, sr_control1);
  14962. -+ reg = chip->ops->read32(chip->ctx, addr);
  14963. -+ return reg != 0;
  14964. - default:
  14965. - addr = CORE_CC_REG(base, pmucapabilities_ext);
  14966. - reg = chip->ops->read32(chip->ctx, addr);
  14967. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14968. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  14969. -@@ -615,6 +615,8 @@ static const struct sdiod_drive_str sdio
  14970. - #define BCM43362_NVRAM_NAME "brcm/brcmfmac43362-sdio.txt"
  14971. - #define BCM4339_FIRMWARE_NAME "brcm/brcmfmac4339-sdio.bin"
  14972. - #define BCM4339_NVRAM_NAME "brcm/brcmfmac4339-sdio.txt"
  14973. -+#define BCM43430_FIRMWARE_NAME "brcm/brcmfmac43430-sdio.bin"
  14974. -+#define BCM43430_NVRAM_NAME "brcm/brcmfmac43430-sdio.txt"
  14975. - #define BCM4345_FIRMWARE_NAME "brcm/brcmfmac4345-sdio.bin"
  14976. - #define BCM4345_NVRAM_NAME "brcm/brcmfmac4345-sdio.txt"
  14977. - #define BCM4354_FIRMWARE_NAME "brcm/brcmfmac4354-sdio.bin"
  14978. -@@ -640,6 +642,8 @@ MODULE_FIRMWARE(BCM43362_FIRMWARE_NAME);
  14979. - MODULE_FIRMWARE(BCM43362_NVRAM_NAME);
  14980. - MODULE_FIRMWARE(BCM4339_FIRMWARE_NAME);
  14981. - MODULE_FIRMWARE(BCM4339_NVRAM_NAME);
  14982. -+MODULE_FIRMWARE(BCM43430_FIRMWARE_NAME);
  14983. -+MODULE_FIRMWARE(BCM43430_NVRAM_NAME);
  14984. - MODULE_FIRMWARE(BCM4345_FIRMWARE_NAME);
  14985. - MODULE_FIRMWARE(BCM4345_NVRAM_NAME);
  14986. - MODULE_FIRMWARE(BCM4354_FIRMWARE_NAME);
  14987. -@@ -671,6 +675,7 @@ static const struct brcmf_firmware_names
  14988. - { BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4335) },
  14989. - { BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, BRCMF_FIRMWARE_NVRAM(BCM43362) },
  14990. - { BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4339) },
  14991. -+ { BRCM_CC_43430_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM43430) },
  14992. - { BRCM_CC_4345_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4345) },
  14993. - { BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4354) }
  14994. - };
  14995. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  14996. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  14997. -@@ -37,6 +37,7 @@
  14998. - #define BRCM_CC_43362_CHIP_ID 43362
  14999. - #define BRCM_CC_4335_CHIP_ID 0x4335
  15000. - #define BRCM_CC_4339_CHIP_ID 0x4339
  15001. -+#define BRCM_CC_43430_CHIP_ID 43430
  15002. - #define BRCM_CC_4345_CHIP_ID 0x4345
  15003. - #define BRCM_CC_4354_CHIP_ID 0x4354
  15004. - #define BRCM_CC_4356_CHIP_ID 0x4356
  15005. ---- a/drivers/net/wireless/brcm80211/include/chipcommon.h
  15006. -+++ b/drivers/net/wireless/brcm80211/include/chipcommon.h
  15007. -@@ -183,7 +183,14 @@ struct chipcregs {
  15008. - u8 uart1lsr;
  15009. - u8 uart1msr;
  15010. - u8 uart1scratch;
  15011. -- u32 PAD[126];
  15012. -+ u32 PAD[62];
  15013. -+
  15014. -+ /* save/restore, corerev >= 48 */
  15015. -+ u32 sr_capability; /* 0x500 */
  15016. -+ u32 sr_control0; /* 0x504 */
  15017. -+ u32 sr_control1; /* 0x508 */
  15018. -+ u32 gpio_control; /* 0x50C */
  15019. -+ u32 PAD[60];
  15020. -
  15021. - /* PMU registers (corerev >= 20) */
  15022. - u32 pmucontrol; /* 0x600 */
  15023. ---- a/include/linux/mmc/sdio_ids.h
  15024. -+++ b/include/linux/mmc/sdio_ids.h
  15025. -@@ -33,6 +33,7 @@
  15026. - #define SDIO_DEVICE_ID_BROADCOM_43341 0xa94d
  15027. - #define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335
  15028. - #define SDIO_DEVICE_ID_BROADCOM_43362 0xa962
  15029. -+#define SDIO_DEVICE_ID_BROADCOM_43430 0xa9a6
  15030. - #define SDIO_DEVICE_ID_BROADCOM_4345 0x4345
  15031. - #define SDIO_DEVICE_ID_BROADCOM_4354 0x4354
  15032. -
  15033. 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
  15034. deleted file mode 100644
  15035. index c3d7bc2..0000000
  15036. --- a/package/kernel/mac80211/patches/337-0006-brcmfmac-only-support-the-BCM43455-7-device.patch
  15037. +++ /dev/null
  15038. @@ -1,50 +0,0 @@
  15039. -From: Arend van Spriel <arend@broadcom.com>
  15040. -Date: Wed, 18 Mar 2015 13:25:27 +0100
  15041. -Subject: [PATCH] brcmfmac: only support the BCM43455/7 device
  15042. -
  15043. -Recently support was added for the BCM4345 SDIO chipset by
  15044. -commit 9c51026509d7 ("brcmfmac: Add support for BCM4345 SDIO chipset")
  15045. -however this was verified using a BCM43455 device, which is
  15046. -a more recent revision of the chip. This patch assure that
  15047. -older revisions are not probed as they would fail.
  15048. -
  15049. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15050. -Reviewed-by: Syed Asifful Dayyan <syedd@broadcom.com>
  15051. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15052. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15053. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15054. ----
  15055. -
  15056. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15057. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15058. -@@ -617,8 +617,8 @@ static const struct sdiod_drive_str sdio
  15059. - #define BCM4339_NVRAM_NAME "brcm/brcmfmac4339-sdio.txt"
  15060. - #define BCM43430_FIRMWARE_NAME "brcm/brcmfmac43430-sdio.bin"
  15061. - #define BCM43430_NVRAM_NAME "brcm/brcmfmac43430-sdio.txt"
  15062. --#define BCM4345_FIRMWARE_NAME "brcm/brcmfmac4345-sdio.bin"
  15063. --#define BCM4345_NVRAM_NAME "brcm/brcmfmac4345-sdio.txt"
  15064. -+#define BCM43455_FIRMWARE_NAME "brcm/brcmfmac43455-sdio.bin"
  15065. -+#define BCM43455_NVRAM_NAME "brcm/brcmfmac43455-sdio.txt"
  15066. - #define BCM4354_FIRMWARE_NAME "brcm/brcmfmac4354-sdio.bin"
  15067. - #define BCM4354_NVRAM_NAME "brcm/brcmfmac4354-sdio.txt"
  15068. -
  15069. -@@ -644,8 +644,8 @@ MODULE_FIRMWARE(BCM4339_FIRMWARE_NAME);
  15070. - MODULE_FIRMWARE(BCM4339_NVRAM_NAME);
  15071. - MODULE_FIRMWARE(BCM43430_FIRMWARE_NAME);
  15072. - MODULE_FIRMWARE(BCM43430_NVRAM_NAME);
  15073. --MODULE_FIRMWARE(BCM4345_FIRMWARE_NAME);
  15074. --MODULE_FIRMWARE(BCM4345_NVRAM_NAME);
  15075. -+MODULE_FIRMWARE(BCM43455_FIRMWARE_NAME);
  15076. -+MODULE_FIRMWARE(BCM43455_NVRAM_NAME);
  15077. - MODULE_FIRMWARE(BCM4354_FIRMWARE_NAME);
  15078. - MODULE_FIRMWARE(BCM4354_NVRAM_NAME);
  15079. -
  15080. -@@ -676,7 +676,7 @@ static const struct brcmf_firmware_names
  15081. - { BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, BRCMF_FIRMWARE_NVRAM(BCM43362) },
  15082. - { BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4339) },
  15083. - { BRCM_CC_43430_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM43430) },
  15084. -- { BRCM_CC_4345_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4345) },
  15085. -+ { BRCM_CC_4345_CHIP_ID, 0xFFFFFFC0, BRCMF_FIRMWARE_NVRAM(BCM43455) },
  15086. - { BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4354) }
  15087. - };
  15088. -
  15089. 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
  15090. deleted file mode 100644
  15091. index a62cfdf..0000000
  15092. --- a/package/kernel/mac80211/patches/337-0007-brcmfmac-remove-support-for-unreleased-BCM4354-PCIe.patch
  15093. +++ /dev/null
  15094. @@ -1,52 +0,0 @@
  15095. -From: Arend van Spriel <arend@broadcom.com>
  15096. -Date: Wed, 18 Mar 2015 13:25:28 +0100
  15097. -Subject: [PATCH] brcmfmac: remove support for unreleased BCM4354 PCIe
  15098. -
  15099. -There are no known BCM4354 PCIe devices released so removing
  15100. -support from the driver until proven otherwise.
  15101. -
  15102. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15103. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15104. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15105. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15106. ----
  15107. -
  15108. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  15109. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  15110. -@@ -47,8 +47,6 @@ enum brcmf_pcie_state {
  15111. -
  15112. - #define BRCMF_PCIE_43602_FW_NAME "brcm/brcmfmac43602-pcie.bin"
  15113. - #define BRCMF_PCIE_43602_NVRAM_NAME "brcm/brcmfmac43602-pcie.txt"
  15114. --#define BRCMF_PCIE_4354_FW_NAME "brcm/brcmfmac4354-pcie.bin"
  15115. --#define BRCMF_PCIE_4354_NVRAM_NAME "brcm/brcmfmac4354-pcie.txt"
  15116. - #define BRCMF_PCIE_4356_FW_NAME "brcm/brcmfmac4356-pcie.bin"
  15117. - #define BRCMF_PCIE_4356_NVRAM_NAME "brcm/brcmfmac4356-pcie.txt"
  15118. - #define BRCMF_PCIE_43570_FW_NAME "brcm/brcmfmac43570-pcie.bin"
  15119. -@@ -187,8 +185,6 @@ enum brcmf_pcie_state {
  15120. -
  15121. - MODULE_FIRMWARE(BRCMF_PCIE_43602_FW_NAME);
  15122. - MODULE_FIRMWARE(BRCMF_PCIE_43602_NVRAM_NAME);
  15123. --MODULE_FIRMWARE(BRCMF_PCIE_4354_FW_NAME);
  15124. --MODULE_FIRMWARE(BRCMF_PCIE_4354_NVRAM_NAME);
  15125. - MODULE_FIRMWARE(BRCMF_PCIE_4356_FW_NAME);
  15126. - MODULE_FIRMWARE(BRCMF_PCIE_4356_NVRAM_NAME);
  15127. - MODULE_FIRMWARE(BRCMF_PCIE_43570_FW_NAME);
  15128. -@@ -1327,10 +1323,6 @@ static int brcmf_pcie_get_fwnames(struct
  15129. - fw_name = BRCMF_PCIE_43602_FW_NAME;
  15130. - nvram_name = BRCMF_PCIE_43602_NVRAM_NAME;
  15131. - break;
  15132. -- case BRCM_CC_4354_CHIP_ID:
  15133. -- fw_name = BRCMF_PCIE_4354_FW_NAME;
  15134. -- nvram_name = BRCMF_PCIE_4354_NVRAM_NAME;
  15135. -- break;
  15136. - case BRCM_CC_4356_CHIP_ID:
  15137. - fw_name = BRCMF_PCIE_4356_FW_NAME;
  15138. - nvram_name = BRCMF_PCIE_4356_NVRAM_NAME;
  15139. -@@ -1855,7 +1847,6 @@ cleanup:
  15140. - PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 }
  15141. -
  15142. - static struct pci_device_id brcmf_pcie_devid_table[] = {
  15143. -- BRCMF_PCIE_DEVICE(BRCM_PCIE_4354_DEVICE_ID),
  15144. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4356_DEVICE_ID),
  15145. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43567_DEVICE_ID),
  15146. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43570_DEVICE_ID),
  15147. diff --git a/package/kernel/mac80211/patches/337-nl80211-put-current-TX-power-in-interface-info.patch b/package/kernel/mac80211/patches/337-nl80211-put-current-TX-power-in-interface-info.patch
  15148. new file mode 100644
  15149. index 0000000..df2cc4b
  15150. --- /dev/null
  15151. +++ b/package/kernel/mac80211/patches/337-nl80211-put-current-TX-power-in-interface-info.patch
  15152. @@ -0,0 +1,37 @@
  15153. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  15154. +Date: Mon, 31 Aug 2015 22:59:38 +0200
  15155. +Subject: [PATCH] nl80211: put current TX power in interface info
  15156. +MIME-Version: 1.0
  15157. +Content-Type: text/plain; charset=UTF-8
  15158. +Content-Transfer-Encoding: 8bit
  15159. +
  15160. +Many drivers implement reading current TX power (using either cfg80211
  15161. +or ieee80211 op) but userspace can't get it using nl80211. Right now the
  15162. +only way to access it is to call some wext ioctl.
  15163. +Let's put TX power in interface info reply (callback is wdev specific)
  15164. +just like we do with current channel.
  15165. +To be consistent (e.g. NL80211_CMD_SET_WIPHY) let's use mBm as na unit.
  15166. +
  15167. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  15168. +Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  15169. +---
  15170. +
  15171. +--- a/net/wireless/nl80211.c
  15172. ++++ b/net/wireless/nl80211.c
  15173. +@@ -2406,6 +2406,16 @@ static int nl80211_send_iface(struct sk_
  15174. + }
  15175. + }
  15176. +
  15177. ++ if (rdev->ops->get_tx_power) {
  15178. ++ int dbm, ret;
  15179. ++
  15180. ++ ret = rdev_get_tx_power(rdev, wdev, &dbm);
  15181. ++ if (ret == 0 &&
  15182. ++ nla_put_u32(msg, NL80211_ATTR_WIPHY_TX_POWER_LEVEL,
  15183. ++ DBM_TO_MBM(dbm)))
  15184. ++ goto nla_put_failure;
  15185. ++ }
  15186. ++
  15187. + if (wdev->ssid_len) {
  15188. + if (nla_put(msg, NL80211_ATTR_SSID, wdev->ssid_len, wdev->ssid))
  15189. + goto nla_put_failure;
  15190. 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
  15191. deleted file mode 100644
  15192. index 366ff85..0000000
  15193. --- a/package/kernel/mac80211/patches/338-brcmfmac-disable-MBSS-feature-for-BCM43362.patch
  15194. +++ /dev/null
  15195. @@ -1,28 +0,0 @@
  15196. -From: Arend van Spriel <arend@broadcom.com>
  15197. -Date: Fri, 20 Mar 2015 22:18:17 +0100
  15198. -Subject: [PATCH] brcmfmac: disable MBSS feature for BCM43362
  15199. -
  15200. -The BCM43362 firmware falsely reports it is capable of providing
  15201. -MBSS. As a result AP mode no longer works for this device. Therefor
  15202. -disable MBSS in the driver for this chipset.
  15203. -
  15204. -Cc: stable@vger.kernel.org # 3.19.y
  15205. -Reported-by: Jorg Krause <jkrause@posteo.de>
  15206. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15207. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15208. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15209. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15210. ----
  15211. -
  15212. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  15213. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  15214. -@@ -126,7 +126,8 @@ void brcmf_feat_attach(struct brcmf_pub
  15215. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_MCHAN, "mchan");
  15216. - if (drvr->bus_if->wowl_supported)
  15217. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_WOWL, "wowl");
  15218. -- brcmf_feat_iovar_int_set(ifp, BRCMF_FEAT_MBSS, "mbss", 0);
  15219. -+ if (drvr->bus_if->chip != BRCM_CC_43362_CHIP_ID)
  15220. -+ brcmf_feat_iovar_int_set(ifp, BRCMF_FEAT_MBSS, "mbss", 0);
  15221. -
  15222. - /* set chip related quirks */
  15223. - switch (drvr->bus_if->chip) {
  15224. diff --git a/package/kernel/mac80211/patches/338-mac80211-initialize-tid-field-in-struct-ieee80211_tx.patch b/package/kernel/mac80211/patches/338-mac80211-initialize-tid-field-in-struct-ieee80211_tx.patch
  15225. new file mode 100644
  15226. index 0000000..2f492e0
  15227. --- /dev/null
  15228. +++ b/package/kernel/mac80211/patches/338-mac80211-initialize-tid-field-in-struct-ieee80211_tx.patch
  15229. @@ -0,0 +1,21 @@
  15230. +From: Felix Fietkau <nbd@openwrt.org>
  15231. +Date: Mon, 5 Oct 2015 17:41:25 +0200
  15232. +Subject: [PATCH] mac80211: initialize tid field in struct ieee80211_txq
  15233. +
  15234. +Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  15235. +---
  15236. +
  15237. +--- a/net/mac80211/util.c
  15238. ++++ b/net/mac80211/util.c
  15239. +@@ -3288,9 +3288,11 @@ void ieee80211_init_tx_queue(struct ieee
  15240. + if (sta) {
  15241. + txqi->txq.sta = &sta->sta;
  15242. + sta->sta.txq[tid] = &txqi->txq;
  15243. ++ txqi->txq.tid = tid;
  15244. + txqi->txq.ac = ieee802_1d_to_ac[tid & 7];
  15245. + } else {
  15246. + sdata->vif.txq = &txqi->txq;
  15247. ++ txqi->txq.tid = 0;
  15248. + txqi->txq.ac = IEEE80211_AC_BE;
  15249. + }
  15250. + }
  15251. 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
  15252. deleted file mode 100644
  15253. index 6e461f6..0000000
  15254. --- a/package/kernel/mac80211/patches/339-0001-brcmfmac-use-static-superset-of-channels-for-wiphy-b.patch
  15255. +++ /dev/null
  15256. @@ -1,300 +0,0 @@
  15257. -From: Arend van Spriel <arend@broadcom.com>
  15258. -Date: Tue, 14 Apr 2015 20:10:24 +0200
  15259. -Subject: [PATCH] brcmfmac: use static superset of channels for wiphy
  15260. - bands
  15261. -
  15262. -The driver was constructing a list of channels per wiphy band
  15263. -by querying the device. This list is not what the hardware is
  15264. -able to do as it is already filtered by the country setting in
  15265. -the device. As user-space may change the country this would
  15266. -require updating the channel list which is not recommended [1].
  15267. -This patch introduces a superset of channels. The individual
  15268. -channels are disabled appropriately by querying the device.
  15269. -
  15270. -[1] http://mid.gmane.org/1426706320.3001.21.camel@sipsolutions.net
  15271. -
  15272. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15273. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  15274. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15275. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15276. ----
  15277. -
  15278. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  15279. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  15280. -@@ -129,13 +129,47 @@ static struct ieee80211_rate __wl_rates[
  15281. - RATETAB_ENT(BRCM_RATE_54M, 0),
  15282. - };
  15283. -
  15284. --#define wl_a_rates (__wl_rates + 4)
  15285. --#define wl_a_rates_size 8
  15286. - #define wl_g_rates (__wl_rates + 0)
  15287. --#define wl_g_rates_size 12
  15288. -+#define wl_g_rates_size ARRAY_SIZE(__wl_rates)
  15289. -+#define wl_a_rates (__wl_rates + 4)
  15290. -+#define wl_a_rates_size (wl_g_rates_size - 4)
  15291. -+
  15292. -+#define CHAN2G(_channel, _freq) { \
  15293. -+ .band = IEEE80211_BAND_2GHZ, \
  15294. -+ .center_freq = (_freq), \
  15295. -+ .hw_value = (_channel), \
  15296. -+ .flags = IEEE80211_CHAN_DISABLED, \
  15297. -+ .max_antenna_gain = 0, \
  15298. -+ .max_power = 30, \
  15299. -+}
  15300. -+
  15301. -+#define CHAN5G(_channel) { \
  15302. -+ .band = IEEE80211_BAND_5GHZ, \
  15303. -+ .center_freq = 5000 + (5 * (_channel)), \
  15304. -+ .hw_value = (_channel), \
  15305. -+ .flags = IEEE80211_CHAN_DISABLED, \
  15306. -+ .max_antenna_gain = 0, \
  15307. -+ .max_power = 30, \
  15308. -+}
  15309. -+
  15310. -+static struct ieee80211_channel __wl_2ghz_channels[] = {
  15311. -+ CHAN2G(1, 2412), CHAN2G(2, 2417), CHAN2G(3, 2422), CHAN2G(4, 2427),
  15312. -+ CHAN2G(5, 2432), CHAN2G(6, 2437), CHAN2G(7, 2442), CHAN2G(8, 2447),
  15313. -+ CHAN2G(9, 2452), CHAN2G(10, 2457), CHAN2G(11, 2462), CHAN2G(12, 2467),
  15314. -+ CHAN2G(13, 2472), CHAN2G(14, 2484)
  15315. -+};
  15316. -+
  15317. -+static struct ieee80211_channel __wl_5ghz_channels[] = {
  15318. -+ CHAN5G(34), CHAN5G(36), CHAN5G(38), CHAN5G(40), CHAN5G(42),
  15319. -+ CHAN5G(44), CHAN5G(46), CHAN5G(48), CHAN5G(52), CHAN5G(56),
  15320. -+ CHAN5G(60), CHAN5G(64), CHAN5G(100), CHAN5G(104), CHAN5G(108),
  15321. -+ CHAN5G(112), CHAN5G(116), CHAN5G(120), CHAN5G(124), CHAN5G(128),
  15322. -+ CHAN5G(132), CHAN5G(136), CHAN5G(140), CHAN5G(144), CHAN5G(149),
  15323. -+ CHAN5G(153), CHAN5G(157), CHAN5G(161), CHAN5G(165)
  15324. -+};
  15325. -
  15326. - /* Band templates duplicated per wiphy. The channel info
  15327. -- * is filled in after querying the device.
  15328. -+ * above is added to the band during setup.
  15329. - */
  15330. - static const struct ieee80211_supported_band __wl_band_2ghz = {
  15331. - .band = IEEE80211_BAND_2GHZ,
  15332. -@@ -143,7 +177,7 @@ static const struct ieee80211_supported_
  15333. - .n_bitrates = wl_g_rates_size,
  15334. - };
  15335. -
  15336. --static const struct ieee80211_supported_band __wl_band_5ghz_a = {
  15337. -+static const struct ieee80211_supported_band __wl_band_5ghz = {
  15338. - .band = IEEE80211_BAND_5GHZ,
  15339. - .bitrates = wl_a_rates,
  15340. - .n_bitrates = wl_a_rates_size,
  15341. -@@ -5252,40 +5286,6 @@ dongle_scantime_out:
  15342. - return err;
  15343. - }
  15344. -
  15345. --/* Filter the list of channels received from firmware counting only
  15346. -- * the 20MHz channels. The wiphy band data only needs those which get
  15347. -- * flagged to indicate if they can take part in higher bandwidth.
  15348. -- */
  15349. --static void brcmf_count_20mhz_channels(struct brcmf_cfg80211_info *cfg,
  15350. -- struct brcmf_chanspec_list *chlist,
  15351. -- u32 chcnt[])
  15352. --{
  15353. -- u32 total = le32_to_cpu(chlist->count);
  15354. -- struct brcmu_chan ch;
  15355. -- int i;
  15356. --
  15357. -- for (i = 0; i < total; i++) {
  15358. -- ch.chspec = (u16)le32_to_cpu(chlist->element[i]);
  15359. -- cfg->d11inf.decchspec(&ch);
  15360. --
  15361. -- /* Firmware gives a ordered list. We skip non-20MHz
  15362. -- * channels is 2G. For 5G we can abort upon reaching
  15363. -- * a non-20MHz channel in the list.
  15364. -- */
  15365. -- if (ch.bw != BRCMU_CHAN_BW_20) {
  15366. -- if (ch.band == BRCMU_CHAN_BAND_5G)
  15367. -- break;
  15368. -- else
  15369. -- continue;
  15370. -- }
  15371. --
  15372. -- if (ch.band == BRCMU_CHAN_BAND_2G)
  15373. -- chcnt[0] += 1;
  15374. -- else if (ch.band == BRCMU_CHAN_BAND_5G)
  15375. -- chcnt[1] += 1;
  15376. -- }
  15377. --}
  15378. --
  15379. - static void brcmf_update_bw40_channel_flag(struct ieee80211_channel *channel,
  15380. - struct brcmu_chan *ch)
  15381. - {
  15382. -@@ -5321,7 +5321,6 @@ static int brcmf_construct_chaninfo(stru
  15383. - u32 i, j;
  15384. - u32 total;
  15385. - u32 chaninfo;
  15386. -- u32 chcnt[2] = { 0, 0 };
  15387. - u32 index;
  15388. -
  15389. - pbuf = kzalloc(BRCMF_DCMD_MEDLEN, GFP_KERNEL);
  15390. -@@ -5338,42 +5337,15 @@ static int brcmf_construct_chaninfo(stru
  15391. - goto fail_pbuf;
  15392. - }
  15393. -
  15394. -- brcmf_count_20mhz_channels(cfg, list, chcnt);
  15395. - wiphy = cfg_to_wiphy(cfg);
  15396. -- if (chcnt[0]) {
  15397. -- band = kmemdup(&__wl_band_2ghz, sizeof(__wl_band_2ghz),
  15398. -- GFP_KERNEL);
  15399. -- if (band == NULL) {
  15400. -- err = -ENOMEM;
  15401. -- goto fail_pbuf;
  15402. -- }
  15403. -- band->channels = kcalloc(chcnt[0], sizeof(*channel),
  15404. -- GFP_KERNEL);
  15405. -- if (band->channels == NULL) {
  15406. -- kfree(band);
  15407. -- err = -ENOMEM;
  15408. -- goto fail_pbuf;
  15409. -- }
  15410. -- band->n_channels = 0;
  15411. -- wiphy->bands[IEEE80211_BAND_2GHZ] = band;
  15412. -- }
  15413. -- if (chcnt[1]) {
  15414. -- band = kmemdup(&__wl_band_5ghz_a, sizeof(__wl_band_5ghz_a),
  15415. -- GFP_KERNEL);
  15416. -- if (band == NULL) {
  15417. -- err = -ENOMEM;
  15418. -- goto fail_band2g;
  15419. -- }
  15420. -- band->channels = kcalloc(chcnt[1], sizeof(*channel),
  15421. -- GFP_KERNEL);
  15422. -- if (band->channels == NULL) {
  15423. -- kfree(band);
  15424. -- err = -ENOMEM;
  15425. -- goto fail_band2g;
  15426. -- }
  15427. -- band->n_channels = 0;
  15428. -- wiphy->bands[IEEE80211_BAND_5GHZ] = band;
  15429. -- }
  15430. -+ band = wiphy->bands[IEEE80211_BAND_2GHZ];
  15431. -+ if (band)
  15432. -+ for (i = 0; i < band->n_channels; i++)
  15433. -+ band->channels[i].flags = IEEE80211_CHAN_DISABLED;
  15434. -+ band = wiphy->bands[IEEE80211_BAND_5GHZ];
  15435. -+ if (band)
  15436. -+ for (i = 0; i < band->n_channels; i++)
  15437. -+ band->channels[i].flags = IEEE80211_CHAN_DISABLED;
  15438. -
  15439. - total = le32_to_cpu(list->count);
  15440. - for (i = 0; i < total; i++) {
  15441. -@@ -5388,6 +5360,8 @@ static int brcmf_construct_chaninfo(stru
  15442. - brcmf_err("Invalid channel Spec. 0x%x.\n", ch.chspec);
  15443. - continue;
  15444. - }
  15445. -+ if (!band)
  15446. -+ continue;
  15447. - if (!(bw_cap[band->band] & WLC_BW_40MHZ_BIT) &&
  15448. - ch.bw == BRCMU_CHAN_BW_40)
  15449. - continue;
  15450. -@@ -5415,9 +5389,9 @@ static int brcmf_construct_chaninfo(stru
  15451. - } else if (ch.bw == BRCMU_CHAN_BW_40) {
  15452. - brcmf_update_bw40_channel_flag(&channel[index], &ch);
  15453. - } else {
  15454. -- /* disable other bandwidths for now as mentioned
  15455. -- * order assure they are enabled for subsequent
  15456. -- * chanspecs.
  15457. -+ /* enable the channel and disable other bandwidths
  15458. -+ * for now as mentioned order assure they are enabled
  15459. -+ * for subsequent chanspecs.
  15460. - */
  15461. - channel[index].flags = IEEE80211_CHAN_NO_HT40 |
  15462. - IEEE80211_CHAN_NO_80MHZ;
  15463. -@@ -5436,16 +5410,8 @@ static int brcmf_construct_chaninfo(stru
  15464. - IEEE80211_CHAN_NO_IR;
  15465. - }
  15466. - }
  15467. -- if (index == band->n_channels)
  15468. -- band->n_channels++;
  15469. - }
  15470. -- kfree(pbuf);
  15471. -- return 0;
  15472. -
  15473. --fail_band2g:
  15474. -- kfree(wiphy->bands[IEEE80211_BAND_2GHZ]->channels);
  15475. -- kfree(wiphy->bands[IEEE80211_BAND_2GHZ]);
  15476. -- wiphy->bands[IEEE80211_BAND_2GHZ] = NULL;
  15477. - fail_pbuf:
  15478. - kfree(pbuf);
  15479. - return err;
  15480. -@@ -5778,7 +5744,12 @@ static void brcmf_wiphy_wowl_params(stru
  15481. -
  15482. - static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
  15483. - {
  15484. -+ struct ieee80211_supported_band *band;
  15485. - struct ieee80211_iface_combination ifc_combo;
  15486. -+ __le32 bandlist[3];
  15487. -+ u32 n_bands;
  15488. -+ int err, i;
  15489. -+
  15490. - wiphy->max_scan_ssids = WL_NUM_SCAN_MAX;
  15491. - wiphy->max_scan_ie_len = BRCMF_SCAN_IE_LEN_MAX;
  15492. - wiphy->max_num_pmkids = WL_NUM_PMKIDS_MAX;
  15493. -@@ -5820,7 +5791,52 @@ static int brcmf_setup_wiphy(struct wiph
  15494. - if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL))
  15495. - brcmf_wiphy_wowl_params(wiphy);
  15496. -
  15497. -- return brcmf_setup_wiphybands(wiphy);
  15498. -+ err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BANDLIST, &bandlist,
  15499. -+ sizeof(bandlist));
  15500. -+ if (err) {
  15501. -+ brcmf_err("could not obtain band info: err=%d\n", err);
  15502. -+ return err;
  15503. -+ }
  15504. -+ /* first entry in bandlist is number of bands */
  15505. -+ n_bands = le32_to_cpu(bandlist[0]);
  15506. -+ for (i = 1; i <= n_bands && i < ARRAY_SIZE(bandlist); i++) {
  15507. -+ if (bandlist[i] == cpu_to_le32(WLC_BAND_2G)) {
  15508. -+ band = kmemdup(&__wl_band_2ghz, sizeof(__wl_band_2ghz),
  15509. -+ GFP_KERNEL);
  15510. -+ if (!band)
  15511. -+ return -ENOMEM;
  15512. -+
  15513. -+ band->channels = kmemdup(&__wl_2ghz_channels,
  15514. -+ sizeof(__wl_2ghz_channels),
  15515. -+ GFP_KERNEL);
  15516. -+ if (!band->channels) {
  15517. -+ kfree(band);
  15518. -+ return -ENOMEM;
  15519. -+ }
  15520. -+
  15521. -+ band->n_channels = ARRAY_SIZE(__wl_2ghz_channels);
  15522. -+ wiphy->bands[IEEE80211_BAND_2GHZ] = band;
  15523. -+ }
  15524. -+ if (bandlist[i] == cpu_to_le32(WLC_BAND_5G)) {
  15525. -+ band = kmemdup(&__wl_band_5ghz, sizeof(__wl_band_5ghz),
  15526. -+ GFP_KERNEL);
  15527. -+ if (!band)
  15528. -+ return -ENOMEM;
  15529. -+
  15530. -+ band->channels = kmemdup(&__wl_5ghz_channels,
  15531. -+ sizeof(__wl_5ghz_channels),
  15532. -+ GFP_KERNEL);
  15533. -+ if (!band->channels) {
  15534. -+ kfree(band);
  15535. -+ return -ENOMEM;
  15536. -+ }
  15537. -+
  15538. -+ band->n_channels = ARRAY_SIZE(__wl_5ghz_channels);
  15539. -+ wiphy->bands[IEEE80211_BAND_5GHZ] = band;
  15540. -+ }
  15541. -+ }
  15542. -+ err = brcmf_setup_wiphybands(wiphy);
  15543. -+ return err;
  15544. - }
  15545. -
  15546. - static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg)
  15547. -@@ -6011,6 +6027,9 @@ static void brcmf_cfg80211_reg_notifier(
  15548. -
  15549. - static void brcmf_free_wiphy(struct wiphy *wiphy)
  15550. - {
  15551. -+ if (!wiphy)
  15552. -+ return;
  15553. -+
  15554. - kfree(wiphy->iface_combinations);
  15555. - if (wiphy->bands[IEEE80211_BAND_2GHZ]) {
  15556. - kfree(wiphy->bands[IEEE80211_BAND_2GHZ]->channels);
  15557. 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
  15558. deleted file mode 100644
  15559. index a0c22eb..0000000
  15560. --- a/package/kernel/mac80211/patches/339-0002-brcmfmac-update-wiphy-band-information-upon-updating.patch
  15561. +++ /dev/null
  15562. @@ -1,29 +0,0 @@
  15563. -From: Arend van Spriel <arend@broadcom.com>
  15564. -Date: Tue, 14 Apr 2015 20:10:25 +0200
  15565. -Subject: [PATCH] brcmfmac: update wiphy band information upon updating
  15566. - regulatory domain
  15567. -
  15568. -When change the country code the available channels may change. So
  15569. -the wiphy bands should be updated accordingly.
  15570. -
  15571. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  15572. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15573. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15574. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15575. ----
  15576. -
  15577. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  15578. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  15579. -@@ -6022,7 +6022,11 @@ static void brcmf_cfg80211_reg_notifier(
  15580. - memset(&ccreq, 0, sizeof(ccreq));
  15581. - ccreq.rev = cpu_to_le32(-1);
  15582. - memcpy(ccreq.ccode, req->alpha2, sizeof(req->alpha2));
  15583. -- brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq));
  15584. -+ if (brcmf_fil_iovar_data_set(ifp, "country", &ccreq, sizeof(ccreq))) {
  15585. -+ brcmf_err("firmware rejected country setting\n");
  15586. -+ return;
  15587. -+ }
  15588. -+ brcmf_setup_wiphybands(wiphy);
  15589. - }
  15590. -
  15591. - static void brcmf_free_wiphy(struct wiphy *wiphy)
  15592. 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
  15593. deleted file mode 100644
  15594. index 193f507..0000000
  15595. --- a/package/kernel/mac80211/patches/339-0003-brcmfmac-add-description-for-feature-flags.patch
  15596. +++ /dev/null
  15597. @@ -1,24 +0,0 @@
  15598. -From: Arend van Spriel <arend@broadcom.com>
  15599. -Date: Tue, 14 Apr 2015 20:10:26 +0200
  15600. -Subject: [PATCH] brcmfmac: add description for feature flags
  15601. -
  15602. -Some feature flags were not described in the header file. Adding
  15603. -the description.
  15604. -
  15605. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15606. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15607. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15608. ----
  15609. -
  15610. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  15611. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  15612. -@@ -19,7 +19,9 @@
  15613. - /*
  15614. - * Features:
  15615. - *
  15616. -+ * MBSS: multiple BSSID support (eg. guest network in AP mode).
  15617. - * MCHAN: multi-channel for concurrent P2P.
  15618. -+ * WOWL: Wake-On-WLAN.
  15619. - */
  15620. - #define BRCMF_FEAT_LIST \
  15621. - BRCMF_FEAT_DEF(MBSS) \
  15622. 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
  15623. deleted file mode 100644
  15624. index 42330b4..0000000
  15625. --- a/package/kernel/mac80211/patches/339-0004-brcmfmac-make-scheduled-scan-support-conditional.patch
  15626. +++ /dev/null
  15627. @@ -1,51 +0,0 @@
  15628. -From: Arend van Spriel <arend@broadcom.com>
  15629. -Date: Tue, 14 Apr 2015 20:10:27 +0200
  15630. -Subject: [PATCH] brcmfmac: make scheduled scan support conditional
  15631. -
  15632. -The scheduled scan support depends on firmware supporting the PNO
  15633. -feature. This feature is optional so add a feature flag for this
  15634. -in the driver and announce scheduled scan support accordingly.
  15635. -
  15636. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15637. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15638. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15639. ----
  15640. -
  15641. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  15642. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  15643. -@@ -5782,7 +5782,8 @@ static int brcmf_setup_wiphy(struct wiph
  15644. - wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM;
  15645. - wiphy->mgmt_stypes = brcmf_txrx_stypes;
  15646. - wiphy->max_remain_on_channel_duration = 5000;
  15647. -- brcmf_wiphy_pno_params(wiphy);
  15648. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_PNO))
  15649. -+ brcmf_wiphy_pno_params(wiphy);
  15650. -
  15651. - /* vendor commands/events support */
  15652. - wiphy->vendor_commands = brcmf_vendor_cmds;
  15653. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  15654. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  15655. -@@ -124,6 +124,7 @@ void brcmf_feat_attach(struct brcmf_pub
  15656. - struct brcmf_if *ifp = drvr->iflist[0];
  15657. -
  15658. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_MCHAN, "mchan");
  15659. -+ brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_PNO, "pfn");
  15660. - if (drvr->bus_if->wowl_supported)
  15661. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_WOWL, "wowl");
  15662. - if (drvr->bus_if->chip != BRCM_CC_43362_CHIP_ID)
  15663. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  15664. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  15665. -@@ -21,11 +21,13 @@
  15666. - *
  15667. - * MBSS: multiple BSSID support (eg. guest network in AP mode).
  15668. - * MCHAN: multi-channel for concurrent P2P.
  15669. -+ * PNO: preferred network offload.
  15670. - * WOWL: Wake-On-WLAN.
  15671. - */
  15672. - #define BRCMF_FEAT_LIST \
  15673. - BRCMF_FEAT_DEF(MBSS) \
  15674. - BRCMF_FEAT_DEF(MCHAN) \
  15675. -+ BRCMF_FEAT_DEF(PNO) \
  15676. - BRCMF_FEAT_DEF(WOWL)
  15677. - /*
  15678. - * Quirks:
  15679. 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
  15680. deleted file mode 100644
  15681. index b859d46..0000000
  15682. --- a/package/kernel/mac80211/patches/339-0005-brcmfmac-add-support-for-BCM4324-rev-B5-chipset.patch
  15683. +++ /dev/null
  15684. @@ -1,43 +0,0 @@
  15685. -From: Arend van Spriel <arend@broadcom.com>
  15686. -Date: Tue, 14 Apr 2015 20:10:28 +0200
  15687. -Subject: [PATCH] brcmfmac: add support for BCM4324 rev B5 chipset
  15688. -
  15689. -This patch adds support for the BCM4324 B5 revision. This device
  15690. -is similar to BCM43241 from driver and firmware perspective. It
  15691. -is known to be used in Lenovo Thinkpad Tablet devices.
  15692. -
  15693. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15694. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15695. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15696. ----
  15697. -
  15698. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15699. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15700. -@@ -601,6 +601,8 @@ static const struct sdiod_drive_str sdio
  15701. - #define BCM43241B0_NVRAM_NAME "brcm/brcmfmac43241b0-sdio.txt"
  15702. - #define BCM43241B4_FIRMWARE_NAME "brcm/brcmfmac43241b4-sdio.bin"
  15703. - #define BCM43241B4_NVRAM_NAME "brcm/brcmfmac43241b4-sdio.txt"
  15704. -+#define BCM43241B5_FIRMWARE_NAME "brcm/brcmfmac43241b5-sdio.bin"
  15705. -+#define BCM43241B5_NVRAM_NAME "brcm/brcmfmac43241b5-sdio.txt"
  15706. - #define BCM4329_FIRMWARE_NAME "brcm/brcmfmac4329-sdio.bin"
  15707. - #define BCM4329_NVRAM_NAME "brcm/brcmfmac4329-sdio.txt"
  15708. - #define BCM4330_FIRMWARE_NAME "brcm/brcmfmac4330-sdio.bin"
  15709. -@@ -628,6 +630,8 @@ MODULE_FIRMWARE(BCM43241B0_FIRMWARE_NAME
  15710. - MODULE_FIRMWARE(BCM43241B0_NVRAM_NAME);
  15711. - MODULE_FIRMWARE(BCM43241B4_FIRMWARE_NAME);
  15712. - MODULE_FIRMWARE(BCM43241B4_NVRAM_NAME);
  15713. -+MODULE_FIRMWARE(BCM43241B5_FIRMWARE_NAME);
  15714. -+MODULE_FIRMWARE(BCM43241B5_NVRAM_NAME);
  15715. - MODULE_FIRMWARE(BCM4329_FIRMWARE_NAME);
  15716. - MODULE_FIRMWARE(BCM4329_NVRAM_NAME);
  15717. - MODULE_FIRMWARE(BCM4330_FIRMWARE_NAME);
  15718. -@@ -667,7 +671,8 @@ enum brcmf_firmware_type {
  15719. - static const struct brcmf_firmware_names brcmf_fwname_data[] = {
  15720. - { BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM43143) },
  15721. - { BRCM_CC_43241_CHIP_ID, 0x0000001F, BRCMF_FIRMWARE_NVRAM(BCM43241B0) },
  15722. -- { BRCM_CC_43241_CHIP_ID, 0xFFFFFFE0, BRCMF_FIRMWARE_NVRAM(BCM43241B4) },
  15723. -+ { BRCM_CC_43241_CHIP_ID, 0x00000020, BRCMF_FIRMWARE_NVRAM(BCM43241B4) },
  15724. -+ { BRCM_CC_43241_CHIP_ID, 0xFFFFFFC0, BRCMF_FIRMWARE_NVRAM(BCM43241B5) },
  15725. - { BRCM_CC_4329_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4329) },
  15726. - { BRCM_CC_4330_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4330) },
  15727. - { BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4334) },
  15728. 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
  15729. deleted file mode 100644
  15730. index d420308..0000000
  15731. --- a/package/kernel/mac80211/patches/339-0006-brcmfmac-process-interrupt-regardless-sdiod-state.patch
  15732. +++ /dev/null
  15733. @@ -1,27 +0,0 @@
  15734. -From: Arend van Spriel <arend@broadcom.com>
  15735. -Date: Tue, 14 Apr 2015 20:10:29 +0200
  15736. -Subject: [PATCH] brcmfmac: process interrupt regardless sdiod state
  15737. -
  15738. -When the sdio bus state is not ready to process we abort the
  15739. -interrupt service routine. This is not wanted as it keeps the
  15740. -interrupt source active. Better clear the interrupt source.
  15741. -
  15742. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  15743. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15744. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  15745. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15746. ----
  15747. -
  15748. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15749. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  15750. -@@ -3555,10 +3555,6 @@ void brcmf_sdio_isr(struct brcmf_sdio *b
  15751. - return;
  15752. - }
  15753. -
  15754. -- if (bus->sdiodev->state != BRCMF_SDIOD_DATA) {
  15755. -- brcmf_err("bus is down. we have nothing to do\n");
  15756. -- return;
  15757. -- }
  15758. - /* Count the interrupt call */
  15759. - bus->sdcnt.intrcount++;
  15760. - if (in_interrupt())
  15761. 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
  15762. deleted file mode 100644
  15763. index ac5584e..0000000
  15764. --- a/package/kernel/mac80211/patches/339-0007-brcmfmac-fix-sdio-suspend-and-resume.patch
  15765. +++ /dev/null
  15766. @@ -1,68 +0,0 @@
  15767. -From: Arend van Spriel <arend@broadcom.com>
  15768. -Date: Tue, 14 Apr 2015 20:10:30 +0200
  15769. -Subject: [PATCH] brcmfmac: fix sdio suspend and resume
  15770. -
  15771. -commit 330b4e4be937 ("brcmfmac: Add wowl support for SDIO devices.")
  15772. -changed the behaviour by removing the MMC_PM_KEEP_POWER flag for
  15773. -non-wowl scenario, which needs to be restored. Another necessary
  15774. -change is to mark the card as being non-removable. With this in place
  15775. -the suspend resume test passes successfully doing:
  15776. -
  15777. - # echo devices > /sys/power/pm_test
  15778. - # echo mem > /sys/power/state
  15779. -
  15780. -Note that power may still be switched off when system is going
  15781. -in S3 state.
  15782. -
  15783. -Reported-by: Fu, Zhonghui <<zhonghui.fu@linux.intel.com>
  15784. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15785. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  15786. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15787. ----
  15788. -
  15789. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  15790. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  15791. -@@ -1011,6 +1011,14 @@ static int brcmf_sdiod_remove(struct brc
  15792. - return 0;
  15793. - }
  15794. -
  15795. -+static void brcmf_sdiod_host_fixup(struct mmc_host *host)
  15796. -+{
  15797. -+ /* runtime-pm powers off the device */
  15798. -+ pm_runtime_forbid(host->parent);
  15799. -+ /* avoid removal detection upon resume */
  15800. -+ host->caps |= MMC_CAP_NONREMOVABLE;
  15801. -+}
  15802. -+
  15803. - static int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev)
  15804. - {
  15805. - struct sdio_func *func;
  15806. -@@ -1076,7 +1084,7 @@ static int brcmf_sdiod_probe(struct brcm
  15807. - ret = -ENODEV;
  15808. - goto out;
  15809. - }
  15810. -- pm_runtime_forbid(host->parent);
  15811. -+ brcmf_sdiod_host_fixup(host);
  15812. - out:
  15813. - if (ret)
  15814. - brcmf_sdiod_remove(sdiodev);
  15815. -@@ -1246,15 +1254,15 @@ static int brcmf_ops_sdio_suspend(struct
  15816. - brcmf_sdiod_freezer_on(sdiodev);
  15817. - brcmf_sdio_wd_timer(sdiodev->bus, 0);
  15818. -
  15819. -+ sdio_flags = MMC_PM_KEEP_POWER;
  15820. - if (sdiodev->wowl_enabled) {
  15821. -- sdio_flags = MMC_PM_KEEP_POWER;
  15822. - if (sdiodev->pdata->oob_irq_supported)
  15823. - enable_irq_wake(sdiodev->pdata->oob_irq_nr);
  15824. - else
  15825. -- sdio_flags = MMC_PM_WAKE_SDIO_IRQ;
  15826. -- if (sdio_set_host_pm_flags(sdiodev->func[1], sdio_flags))
  15827. -- brcmf_err("Failed to set pm_flags %x\n", sdio_flags);
  15828. -+ sdio_flags |= MMC_PM_WAKE_SDIO_IRQ;
  15829. - }
  15830. -+ if (sdio_set_host_pm_flags(sdiodev->func[1], sdio_flags))
  15831. -+ brcmf_err("Failed to set pm_flags %x\n", sdio_flags);
  15832. - return 0;
  15833. - }
  15834. -
  15835. 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
  15836. deleted file mode 100644
  15837. index a521b65..0000000
  15838. --- a/package/kernel/mac80211/patches/339-0008-brcmfmac-add-support-for-BCM4358-PCIe-device.patch
  15839. +++ /dev/null
  15840. @@ -1,77 +0,0 @@
  15841. -From: Arend van Spriel <arend@broadcom.com>
  15842. -Date: Tue, 14 Apr 2015 20:10:31 +0200
  15843. -Subject: [PATCH] brcmfmac: add support for BCM4358 PCIe device
  15844. -
  15845. -This patch adds support for the BCM4358 2x2 11ac device.
  15846. -
  15847. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15848. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15849. ----
  15850. -
  15851. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  15852. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  15853. -@@ -649,6 +649,7 @@ static u32 brcmf_chip_tcm_rambase(struct
  15854. - case BRCM_CC_43567_CHIP_ID:
  15855. - case BRCM_CC_43569_CHIP_ID:
  15856. - case BRCM_CC_43570_CHIP_ID:
  15857. -+ case BRCM_CC_4358_CHIP_ID:
  15858. - case BRCM_CC_43602_CHIP_ID:
  15859. - return 0x180000;
  15860. - default:
  15861. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  15862. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  15863. -@@ -51,6 +51,8 @@ enum brcmf_pcie_state {
  15864. - #define BRCMF_PCIE_4356_NVRAM_NAME "brcm/brcmfmac4356-pcie.txt"
  15865. - #define BRCMF_PCIE_43570_FW_NAME "brcm/brcmfmac43570-pcie.bin"
  15866. - #define BRCMF_PCIE_43570_NVRAM_NAME "brcm/brcmfmac43570-pcie.txt"
  15867. -+#define BRCMF_PCIE_4358_FW_NAME "brcm/brcmfmac4358-pcie.bin"
  15868. -+#define BRCMF_PCIE_4358_NVRAM_NAME "brcm/brcmfmac4358-pcie.txt"
  15869. -
  15870. - #define BRCMF_PCIE_FW_UP_TIMEOUT 2000 /* msec */
  15871. -
  15872. -@@ -189,6 +191,8 @@ MODULE_FIRMWARE(BRCMF_PCIE_4356_FW_NAME)
  15873. - MODULE_FIRMWARE(BRCMF_PCIE_4356_NVRAM_NAME);
  15874. - MODULE_FIRMWARE(BRCMF_PCIE_43570_FW_NAME);
  15875. - MODULE_FIRMWARE(BRCMF_PCIE_43570_NVRAM_NAME);
  15876. -+MODULE_FIRMWARE(BRCMF_PCIE_4358_FW_NAME);
  15877. -+MODULE_FIRMWARE(BRCMF_PCIE_4358_NVRAM_NAME);
  15878. -
  15879. -
  15880. - struct brcmf_pcie_console {
  15881. -@@ -1333,6 +1337,10 @@ static int brcmf_pcie_get_fwnames(struct
  15882. - fw_name = BRCMF_PCIE_43570_FW_NAME;
  15883. - nvram_name = BRCMF_PCIE_43570_NVRAM_NAME;
  15884. - break;
  15885. -+ case BRCM_CC_4358_CHIP_ID:
  15886. -+ fw_name = BRCMF_PCIE_4358_FW_NAME;
  15887. -+ nvram_name = BRCMF_PCIE_4358_NVRAM_NAME;
  15888. -+ break;
  15889. - default:
  15890. - brcmf_err("Unsupported chip 0x%04x\n", devinfo->ci->chip);
  15891. - return -ENODEV;
  15892. -@@ -1850,6 +1858,7 @@ static struct pci_device_id brcmf_pcie_d
  15893. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4356_DEVICE_ID),
  15894. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43567_DEVICE_ID),
  15895. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43570_DEVICE_ID),
  15896. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4358_DEVICE_ID),
  15897. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_DEVICE_ID),
  15898. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_2G_DEVICE_ID),
  15899. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_5G_DEVICE_ID),
  15900. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  15901. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  15902. -@@ -45,6 +45,7 @@
  15903. - #define BRCM_CC_43567_CHIP_ID 43567
  15904. - #define BRCM_CC_43569_CHIP_ID 43569
  15905. - #define BRCM_CC_43570_CHIP_ID 43570
  15906. -+#define BRCM_CC_4358_CHIP_ID 0x4358
  15907. - #define BRCM_CC_43602_CHIP_ID 43602
  15908. -
  15909. - /* USB Device IDs */
  15910. -@@ -59,6 +60,7 @@
  15911. - #define BRCM_PCIE_4356_DEVICE_ID 0x43ec
  15912. - #define BRCM_PCIE_43567_DEVICE_ID 0x43d3
  15913. - #define BRCM_PCIE_43570_DEVICE_ID 0x43d9
  15914. -+#define BRCM_PCIE_4358_DEVICE_ID 0x43e9
  15915. - #define BRCM_PCIE_43602_DEVICE_ID 0x43ba
  15916. - #define BRCM_PCIE_43602_2G_DEVICE_ID 0x43bb
  15917. - #define BRCM_PCIE_43602_5G_DEVICE_ID 0x43bc
  15918. 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
  15919. deleted file mode 100644
  15920. index bcbb984..0000000
  15921. --- a/package/kernel/mac80211/patches/339-0009-brcmfmac-add-additional-43602-pcie-device-id.patch
  15922. +++ /dev/null
  15923. @@ -1,30 +0,0 @@
  15924. -From: Hante Meuleman <meuleman@broadcom.com>
  15925. -Date: Tue, 14 Apr 2015 20:10:32 +0200
  15926. -Subject: [PATCH] brcmfmac: add additional 43602 pcie device id.
  15927. -
  15928. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  15929. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15930. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  15931. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15932. ----
  15933. -
  15934. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  15935. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  15936. -@@ -1862,6 +1862,7 @@ static struct pci_device_id brcmf_pcie_d
  15937. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_DEVICE_ID),
  15938. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_2G_DEVICE_ID),
  15939. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_5G_DEVICE_ID),
  15940. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_RAW_DEVICE_ID),
  15941. - { /* end: all zeroes */ }
  15942. - };
  15943. -
  15944. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  15945. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  15946. -@@ -64,6 +64,7 @@
  15947. - #define BRCM_PCIE_43602_DEVICE_ID 0x43ba
  15948. - #define BRCM_PCIE_43602_2G_DEVICE_ID 0x43bb
  15949. - #define BRCM_PCIE_43602_5G_DEVICE_ID 0x43bc
  15950. -+#define BRCM_PCIE_43602_RAW_DEVICE_ID 43602
  15951. -
  15952. - /* brcmsmac IDs */
  15953. - #define BCM4313_D11N2G_ID 0x4727 /* 4313 802.11n 2.4G device */
  15954. 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
  15955. deleted file mode 100644
  15956. index 5f9bbea..0000000
  15957. --- a/package/kernel/mac80211/patches/339-0010-brcmfmac-Add-support-for-multiple-PCIE-devices-in-nv.patch
  15958. +++ /dev/null
  15959. @@ -1,351 +0,0 @@
  15960. -From: Hante Meuleman <meuleman@broadcom.com>
  15961. -Date: Tue, 14 Apr 2015 20:10:33 +0200
  15962. -Subject: [PATCH] brcmfmac: Add support for multiple PCIE devices in
  15963. - nvram.
  15964. -
  15965. -With PCIE it is possible to support multiple devices with the
  15966. -same device type. They all load the same nvram file. In order to
  15967. -support this the nvram can specify which part of the nvram is
  15968. -for which pcie device. This patch adds support for these new
  15969. -types of nvram files.
  15970. -
  15971. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  15972. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  15973. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  15974. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  15975. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  15976. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  15977. ----
  15978. -
  15979. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  15980. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  15981. -@@ -23,6 +23,10 @@
  15982. - #include "debug.h"
  15983. - #include "firmware.h"
  15984. -
  15985. -+#define BRCMF_FW_MAX_NVRAM_SIZE 64000
  15986. -+#define BRCMF_FW_NVRAM_DEVPATH_LEN 19 /* devpath0=pcie/1/4/ */
  15987. -+#define BRCMF_FW_NVRAM_PCIEDEV_LEN 9 /* pcie/1/4/ */
  15988. -+
  15989. - char brcmf_firmware_path[BRCMF_FW_PATH_LEN];
  15990. - module_param_string(firmware_path, brcmf_firmware_path,
  15991. - BRCMF_FW_PATH_LEN, 0440);
  15992. -@@ -46,6 +50,8 @@ enum nvram_parser_state {
  15993. - * @column: current column in line.
  15994. - * @pos: byte offset in input buffer.
  15995. - * @entry: start position of key,value entry.
  15996. -+ * @multi_dev_v1: detect pcie multi device v1 (compressed).
  15997. -+ * @multi_dev_v2: detect pcie multi device v2.
  15998. - */
  15999. - struct nvram_parser {
  16000. - enum nvram_parser_state state;
  16001. -@@ -56,6 +62,8 @@ struct nvram_parser {
  16002. - u32 column;
  16003. - u32 pos;
  16004. - u32 entry;
  16005. -+ bool multi_dev_v1;
  16006. -+ bool multi_dev_v2;
  16007. - };
  16008. -
  16009. - static bool is_nvram_char(char c)
  16010. -@@ -108,6 +116,10 @@ static enum nvram_parser_state brcmf_nvr
  16011. - st = COMMENT;
  16012. - else
  16013. - st = VALUE;
  16014. -+ if (strncmp(&nvp->fwnv->data[nvp->entry], "devpath", 7) == 0)
  16015. -+ nvp->multi_dev_v1 = true;
  16016. -+ if (strncmp(&nvp->fwnv->data[nvp->entry], "pcie/", 5) == 0)
  16017. -+ nvp->multi_dev_v2 = true;
  16018. - } else if (!is_nvram_char(c)) {
  16019. - brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n",
  16020. - nvp->line, nvp->column);
  16021. -@@ -133,6 +145,8 @@ brcmf_nvram_handle_value(struct nvram_pa
  16022. - ekv = (u8 *)&nvp->fwnv->data[nvp->pos];
  16023. - skv = (u8 *)&nvp->fwnv->data[nvp->entry];
  16024. - cplen = ekv - skv;
  16025. -+ if (nvp->nvram_len + cplen + 1 >= BRCMF_FW_MAX_NVRAM_SIZE)
  16026. -+ return END;
  16027. - /* copy to output buffer */
  16028. - memcpy(&nvp->nvram[nvp->nvram_len], skv, cplen);
  16029. - nvp->nvram_len += cplen;
  16030. -@@ -180,10 +194,18 @@ static enum nvram_parser_state
  16031. - static int brcmf_init_nvram_parser(struct nvram_parser *nvp,
  16032. - const struct firmware *nv)
  16033. - {
  16034. -+ size_t size;
  16035. -+
  16036. - memset(nvp, 0, sizeof(*nvp));
  16037. - nvp->fwnv = nv;
  16038. -+ /* Limit size to MAX_NVRAM_SIZE, some files contain lot of comment */
  16039. -+ if (nv->size > BRCMF_FW_MAX_NVRAM_SIZE)
  16040. -+ size = BRCMF_FW_MAX_NVRAM_SIZE;
  16041. -+ else
  16042. -+ size = nv->size;
  16043. - /* Alloc for extra 0 byte + roundup by 4 + length field */
  16044. -- nvp->nvram = kzalloc(nv->size + 1 + 3 + sizeof(u32), GFP_KERNEL);
  16045. -+ size += 1 + 3 + sizeof(u32);
  16046. -+ nvp->nvram = kzalloc(size, GFP_KERNEL);
  16047. - if (!nvp->nvram)
  16048. - return -ENOMEM;
  16049. -
  16050. -@@ -192,12 +214,136 @@ static int brcmf_init_nvram_parser(struc
  16051. - return 0;
  16052. - }
  16053. -
  16054. -+/* brcmf_fw_strip_multi_v1 :Some nvram files contain settings for multiple
  16055. -+ * devices. Strip it down for one device, use domain_nr/bus_nr to determine
  16056. -+ * which data is to be returned. v1 is the version where nvram is stored
  16057. -+ * compressed and "devpath" maps to index for valid entries.
  16058. -+ */
  16059. -+static void brcmf_fw_strip_multi_v1(struct nvram_parser *nvp, u16 domain_nr,
  16060. -+ u16 bus_nr)
  16061. -+{
  16062. -+ u32 i, j;
  16063. -+ bool found;
  16064. -+ u8 *nvram;
  16065. -+ u8 id;
  16066. -+
  16067. -+ nvram = kzalloc(nvp->nvram_len + 1 + 3 + sizeof(u32), GFP_KERNEL);
  16068. -+ if (!nvram)
  16069. -+ goto fail;
  16070. -+
  16071. -+ /* min length: devpath0=pcie/1/4/ + 0:x=y */
  16072. -+ if (nvp->nvram_len < BRCMF_FW_NVRAM_DEVPATH_LEN + 6)
  16073. -+ goto fail;
  16074. -+
  16075. -+ /* First search for the devpathX and see if it is the configuration
  16076. -+ * for domain_nr/bus_nr. Search complete nvp
  16077. -+ */
  16078. -+ found = false;
  16079. -+ i = 0;
  16080. -+ while (i < nvp->nvram_len - BRCMF_FW_NVRAM_DEVPATH_LEN) {
  16081. -+ /* Format: devpathX=pcie/Y/Z/
  16082. -+ * Y = domain_nr, Z = bus_nr, X = virtual ID
  16083. -+ */
  16084. -+ if ((strncmp(&nvp->nvram[i], "devpath", 7) == 0) &&
  16085. -+ (strncmp(&nvp->nvram[i + 8], "=pcie/", 6) == 0)) {
  16086. -+ if (((nvp->nvram[i + 14] - '0') == domain_nr) &&
  16087. -+ ((nvp->nvram[i + 16] - '0') == bus_nr)) {
  16088. -+ id = nvp->nvram[i + 7] - '0';
  16089. -+ found = true;
  16090. -+ break;
  16091. -+ }
  16092. -+ }
  16093. -+ while (nvp->nvram[i] != 0)
  16094. -+ i++;
  16095. -+ i++;
  16096. -+ }
  16097. -+ if (!found)
  16098. -+ goto fail;
  16099. -+
  16100. -+ /* Now copy all valid entries, release old nvram and assign new one */
  16101. -+ i = 0;
  16102. -+ j = 0;
  16103. -+ while (i < nvp->nvram_len) {
  16104. -+ if ((nvp->nvram[i] - '0' == id) && (nvp->nvram[i + 1] == ':')) {
  16105. -+ i += 2;
  16106. -+ while (nvp->nvram[i] != 0) {
  16107. -+ nvram[j] = nvp->nvram[i];
  16108. -+ i++;
  16109. -+ j++;
  16110. -+ }
  16111. -+ nvram[j] = 0;
  16112. -+ j++;
  16113. -+ }
  16114. -+ while (nvp->nvram[i] != 0)
  16115. -+ i++;
  16116. -+ i++;
  16117. -+ }
  16118. -+ kfree(nvp->nvram);
  16119. -+ nvp->nvram = nvram;
  16120. -+ nvp->nvram_len = j;
  16121. -+ return;
  16122. -+
  16123. -+fail:
  16124. -+ kfree(nvram);
  16125. -+ nvp->nvram_len = 0;
  16126. -+}
  16127. -+
  16128. -+/* brcmf_fw_strip_multi_v2 :Some nvram files contain settings for multiple
  16129. -+ * devices. Strip it down for one device, use domain_nr/bus_nr to determine
  16130. -+ * which data is to be returned. v2 is the version where nvram is stored
  16131. -+ * uncompressed, all relevant valid entries are identified by
  16132. -+ * pcie/domain_nr/bus_nr:
  16133. -+ */
  16134. -+static void brcmf_fw_strip_multi_v2(struct nvram_parser *nvp, u16 domain_nr,
  16135. -+ u16 bus_nr)
  16136. -+{
  16137. -+ u32 i, j;
  16138. -+ u8 *nvram;
  16139. -+
  16140. -+ nvram = kzalloc(nvp->nvram_len + 1 + 3 + sizeof(u32), GFP_KERNEL);
  16141. -+ if (!nvram)
  16142. -+ goto fail;
  16143. -+
  16144. -+ /* Copy all valid entries, release old nvram and assign new one.
  16145. -+ * Valid entries are of type pcie/X/Y/ where X = domain_nr and
  16146. -+ * Y = bus_nr.
  16147. -+ */
  16148. -+ i = 0;
  16149. -+ j = 0;
  16150. -+ while (i < nvp->nvram_len - BRCMF_FW_NVRAM_PCIEDEV_LEN) {
  16151. -+ if ((strncmp(&nvp->nvram[i], "pcie/", 5) == 0) &&
  16152. -+ (nvp->nvram[i + 6] == '/') && (nvp->nvram[i + 8] == '/') &&
  16153. -+ ((nvp->nvram[i + 5] - '0') == domain_nr) &&
  16154. -+ ((nvp->nvram[i + 7] - '0') == bus_nr)) {
  16155. -+ i += BRCMF_FW_NVRAM_PCIEDEV_LEN;
  16156. -+ while (nvp->nvram[i] != 0) {
  16157. -+ nvram[j] = nvp->nvram[i];
  16158. -+ i++;
  16159. -+ j++;
  16160. -+ }
  16161. -+ nvram[j] = 0;
  16162. -+ j++;
  16163. -+ }
  16164. -+ while (nvp->nvram[i] != 0)
  16165. -+ i++;
  16166. -+ i++;
  16167. -+ }
  16168. -+ kfree(nvp->nvram);
  16169. -+ nvp->nvram = nvram;
  16170. -+ nvp->nvram_len = j;
  16171. -+ return;
  16172. -+fail:
  16173. -+ kfree(nvram);
  16174. -+ nvp->nvram_len = 0;
  16175. -+}
  16176. -+
  16177. - /* brcmf_nvram_strip :Takes a buffer of "<var>=<value>\n" lines read from a fil
  16178. - * and ending in a NUL. Removes carriage returns, empty lines, comment lines,
  16179. - * and converts newlines to NULs. Shortens buffer as needed and pads with NULs.
  16180. - * End of buffer is completed with token identifying length of buffer.
  16181. - */
  16182. --static void *brcmf_fw_nvram_strip(const struct firmware *nv, u32 *new_length)
  16183. -+static void *brcmf_fw_nvram_strip(const struct firmware *nv, u32 *new_length,
  16184. -+ u16 domain_nr, u16 bus_nr)
  16185. - {
  16186. - struct nvram_parser nvp;
  16187. - u32 pad;
  16188. -@@ -212,6 +358,16 @@ static void *brcmf_fw_nvram_strip(const
  16189. - if (nvp.state == END)
  16190. - break;
  16191. - }
  16192. -+ if (nvp.multi_dev_v1)
  16193. -+ brcmf_fw_strip_multi_v1(&nvp, domain_nr, bus_nr);
  16194. -+ else if (nvp.multi_dev_v2)
  16195. -+ brcmf_fw_strip_multi_v2(&nvp, domain_nr, bus_nr);
  16196. -+
  16197. -+ if (nvp.nvram_len == 0) {
  16198. -+ kfree(nvp.nvram);
  16199. -+ return NULL;
  16200. -+ }
  16201. -+
  16202. - pad = nvp.nvram_len;
  16203. - *new_length = roundup(nvp.nvram_len + 1, 4);
  16204. - while (pad != *new_length) {
  16205. -@@ -239,6 +395,8 @@ struct brcmf_fw {
  16206. - u16 flags;
  16207. - const struct firmware *code;
  16208. - const char *nvram_name;
  16209. -+ u16 domain_nr;
  16210. -+ u16 bus_nr;
  16211. - void (*done)(struct device *dev, const struct firmware *fw,
  16212. - void *nvram_image, u32 nvram_len);
  16213. - };
  16214. -@@ -254,7 +412,8 @@ static void brcmf_fw_request_nvram_done(
  16215. - goto fail;
  16216. -
  16217. - if (fw) {
  16218. -- nvram = brcmf_fw_nvram_strip(fw, &nvram_length);
  16219. -+ nvram = brcmf_fw_nvram_strip(fw, &nvram_length,
  16220. -+ fwctx->domain_nr, fwctx->bus_nr);
  16221. - release_firmware(fw);
  16222. - if (!nvram && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL))
  16223. - goto fail;
  16224. -@@ -309,11 +468,12 @@ fail:
  16225. - kfree(fwctx);
  16226. - }
  16227. -
  16228. --int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  16229. -- const char *code, const char *nvram,
  16230. -- void (*fw_cb)(struct device *dev,
  16231. -- const struct firmware *fw,
  16232. -- void *nvram_image, u32 nvram_len))
  16233. -+int brcmf_fw_get_firmwares_pcie(struct device *dev, u16 flags,
  16234. -+ const char *code, const char *nvram,
  16235. -+ void (*fw_cb)(struct device *dev,
  16236. -+ const struct firmware *fw,
  16237. -+ void *nvram_image, u32 nvram_len),
  16238. -+ u16 domain_nr, u16 bus_nr)
  16239. - {
  16240. - struct brcmf_fw *fwctx;
  16241. -
  16242. -@@ -333,8 +493,21 @@ int brcmf_fw_get_firmwares(struct device
  16243. - fwctx->done = fw_cb;
  16244. - if (flags & BRCMF_FW_REQUEST_NVRAM)
  16245. - fwctx->nvram_name = nvram;
  16246. -+ fwctx->domain_nr = domain_nr;
  16247. -+ fwctx->bus_nr = bus_nr;
  16248. -
  16249. - return request_firmware_nowait(THIS_MODULE, true, code, dev,
  16250. - GFP_KERNEL, fwctx,
  16251. - brcmf_fw_request_code_done);
  16252. - }
  16253. -+
  16254. -+int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  16255. -+ const char *code, const char *nvram,
  16256. -+ void (*fw_cb)(struct device *dev,
  16257. -+ const struct firmware *fw,
  16258. -+ void *nvram_image, u32 nvram_len))
  16259. -+{
  16260. -+ return brcmf_fw_get_firmwares_pcie(dev, flags, code, nvram, fw_cb, 0,
  16261. -+ 0);
  16262. -+}
  16263. -+
  16264. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.h
  16265. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.h
  16266. -@@ -32,6 +32,12 @@ void brcmf_fw_nvram_free(void *nvram);
  16267. - * fails it will not use the callback, but call device_release_driver()
  16268. - * instead which will call the driver .remove() callback.
  16269. - */
  16270. -+int brcmf_fw_get_firmwares_pcie(struct device *dev, u16 flags,
  16271. -+ const char *code, const char *nvram,
  16272. -+ void (*fw_cb)(struct device *dev,
  16273. -+ const struct firmware *fw,
  16274. -+ void *nvram_image, u32 nvram_len),
  16275. -+ u16 domain_nr, u16 bus_nr);
  16276. - int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  16277. - const char *code, const char *nvram,
  16278. - void (*fw_cb)(struct device *dev,
  16279. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16280. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16281. -@@ -1649,8 +1649,13 @@ brcmf_pcie_probe(struct pci_dev *pdev, c
  16282. - struct brcmf_pciedev_info *devinfo;
  16283. - struct brcmf_pciedev *pcie_bus_dev;
  16284. - struct brcmf_bus *bus;
  16285. -+ u16 domain_nr;
  16286. -+ u16 bus_nr;
  16287. -
  16288. -- brcmf_dbg(PCIE, "Enter %x:%x\n", pdev->vendor, pdev->device);
  16289. -+ domain_nr = pci_domain_nr(pdev->bus) + 1;
  16290. -+ bus_nr = pdev->bus->number;
  16291. -+ brcmf_dbg(PCIE, "Enter %x:%x (%d/%d)\n", pdev->vendor, pdev->device,
  16292. -+ domain_nr, bus_nr);
  16293. -
  16294. - ret = -ENOMEM;
  16295. - devinfo = kzalloc(sizeof(*devinfo), GFP_KERNEL);
  16296. -@@ -1699,10 +1704,10 @@ brcmf_pcie_probe(struct pci_dev *pdev, c
  16297. - if (ret)
  16298. - goto fail_bus;
  16299. -
  16300. -- ret = brcmf_fw_get_firmwares(bus->dev, BRCMF_FW_REQUEST_NVRAM |
  16301. -- BRCMF_FW_REQ_NV_OPTIONAL,
  16302. -- devinfo->fw_name, devinfo->nvram_name,
  16303. -- brcmf_pcie_setup);
  16304. -+ ret = brcmf_fw_get_firmwares_pcie(bus->dev, BRCMF_FW_REQUEST_NVRAM |
  16305. -+ BRCMF_FW_REQ_NV_OPTIONAL,
  16306. -+ devinfo->fw_name, devinfo->nvram_name,
  16307. -+ brcmf_pcie_setup, domain_nr, bus_nr);
  16308. - if (ret == 0)
  16309. - return 0;
  16310. - fail_bus:
  16311. diff --git a/package/kernel/mac80211/patches/340-brcmfmac-cleanup-a-sizeof.patch b/package/kernel/mac80211/patches/340-brcmfmac-cleanup-a-sizeof.patch
  16312. deleted file mode 100644
  16313. index d26e118..0000000
  16314. --- a/package/kernel/mac80211/patches/340-brcmfmac-cleanup-a-sizeof.patch
  16315. +++ /dev/null
  16316. @@ -1,23 +0,0 @@
  16317. -From: Dan Carpenter <dan.carpenter@oracle.com>
  16318. -Date: Thu, 7 May 2015 12:59:19 +0300
  16319. -Subject: [PATCH] brcmfmac: cleanup a sizeof()
  16320. -
  16321. -"flowrings" and "*flowrings" are both pointers so this always returns
  16322. -sizeof(void *) and the current code works fine. But "*flowrings" is
  16323. -intended here and static checkers complain, so lets change it.
  16324. -
  16325. -Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
  16326. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16327. ----
  16328. -
  16329. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16330. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16331. -@@ -1617,7 +1617,7 @@ static void brcmf_pcie_setup(struct devi
  16332. - bus->msgbuf->commonrings[i] =
  16333. - &devinfo->shared.commonrings[i]->commonring;
  16334. -
  16335. -- flowrings = kcalloc(devinfo->shared.nrof_flowrings, sizeof(flowrings),
  16336. -+ flowrings = kcalloc(devinfo->shared.nrof_flowrings, sizeof(*flowrings),
  16337. - GFP_KERNEL);
  16338. - if (!flowrings)
  16339. - goto fail;
  16340. 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
  16341. deleted file mode 100644
  16342. index 9b2880d..0000000
  16343. --- a/package/kernel/mac80211/patches/341-brcmfmac-check-result-of-USB-firmware-request.patch
  16344. +++ /dev/null
  16345. @@ -1,33 +0,0 @@
  16346. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  16347. -Date: Thu, 7 May 2015 14:13:03 +0200
  16348. -Subject: [PATCH] brcmfmac: check result of USB firmware request
  16349. -MIME-Version: 1.0
  16350. -Content-Type: text/plain; charset=UTF-8
  16351. -Content-Transfer-Encoding: 8bit
  16352. -
  16353. -This prevents silence failures with driver waiting (infinitely) for a
  16354. -callback.
  16355. -
  16356. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  16357. -Acked-by: Arend van Spriel <arend@broadcom.com>
  16358. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16359. ----
  16360. -
  16361. ---- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  16362. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  16363. -@@ -1270,8 +1270,13 @@ static int brcmf_usb_probe_cb(struct brc
  16364. - bus->chiprev = bus_pub->chiprev;
  16365. -
  16366. - /* request firmware here */
  16367. -- brcmf_fw_get_firmwares(dev, 0, brcmf_usb_get_fwname(devinfo), NULL,
  16368. -- brcmf_usb_probe_phase2);
  16369. -+ ret = brcmf_fw_get_firmwares(dev, 0, brcmf_usb_get_fwname(devinfo),
  16370. -+ NULL, brcmf_usb_probe_phase2);
  16371. -+ if (ret) {
  16372. -+ brcmf_err("firmware request failed: %d\n", ret);
  16373. -+ goto fail;
  16374. -+ }
  16375. -+
  16376. - return 0;
  16377. -
  16378. - fail:
  16379. 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
  16380. deleted file mode 100644
  16381. index d46b300..0000000
  16382. --- a/package/kernel/mac80211/patches/342-brcmfmac-prohibit-ACPI-power-management-for-brcmfmac.patch
  16383. +++ /dev/null
  16384. @@ -1,47 +0,0 @@
  16385. -From: "Fu, Zhonghui" <zhonghui.fu@linux.intel.com>
  16386. -Date: Mon, 11 May 2015 10:41:32 +0800
  16387. -Subject: [PATCH] brcmfmac: prohibit ACPI power management for brcmfmac driver
  16388. -
  16389. -ACPI will manage WiFi chip's power state during suspend/resume
  16390. -process on some tablet platforms(such as ASUS T100TA). This is
  16391. -not supported by brcmfmac driver now, and the context of WiFi
  16392. -chip will be damaged after resume. This patch informs ACPI not
  16393. -to manage WiFi chip's power state.
  16394. -
  16395. -Signed-off-by: Zhonghui Fu <zhonghui.fu@linux.intel.com>
  16396. -Acked-by: Arend van Spriel <arend@broadcom.com>
  16397. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16398. ----
  16399. -
  16400. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  16401. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  16402. -@@ -33,6 +33,7 @@
  16403. - #include <linux/suspend.h>
  16404. - #include <linux/errno.h>
  16405. - #include <linux/module.h>
  16406. -+#include <linux/acpi.h>
  16407. - #include <net/cfg80211.h>
  16408. -
  16409. - #include <defs.h>
  16410. -@@ -1122,6 +1123,8 @@ static int brcmf_ops_sdio_probe(struct s
  16411. - int err;
  16412. - struct brcmf_sdio_dev *sdiodev;
  16413. - struct brcmf_bus *bus_if;
  16414. -+ struct device *dev;
  16415. -+ struct acpi_device *adev;
  16416. -
  16417. - brcmf_dbg(SDIO, "Enter\n");
  16418. - brcmf_dbg(SDIO, "Class=%x\n", func->class);
  16419. -@@ -1129,6 +1132,12 @@ static int brcmf_ops_sdio_probe(struct s
  16420. - brcmf_dbg(SDIO, "sdio device ID: 0x%04x\n", func->device);
  16421. - brcmf_dbg(SDIO, "Function#: %d\n", func->num);
  16422. -
  16423. -+ /* prohibit ACPI power management for this device */
  16424. -+ dev = &func->dev;
  16425. -+ adev = ACPI_COMPANION(dev);
  16426. -+ if (adev)
  16427. -+ adev->flags.power_manageable = 0;
  16428. -+
  16429. - /* Consume func num 1 but dont do anything with it. */
  16430. - if (func->num == 1)
  16431. - return 0;
  16432. 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
  16433. deleted file mode 100644
  16434. index 9b4609f..0000000
  16435. --- a/package/kernel/mac80211/patches/343-brcmfmac-avoid-gcc-5.1-warning.patch
  16436. +++ /dev/null
  16437. @@ -1,30 +0,0 @@
  16438. -From: Arnd Bergmann <arnd@arndb.de>
  16439. -Date: Tue, 12 May 2015 23:54:25 +0200
  16440. -Subject: [PATCH] brcmfmac: avoid gcc-5.1 warning
  16441. -
  16442. -gcc-5.0 gained a new warning in the fwsignal portion of the brcmfmac
  16443. -driver:
  16444. -
  16445. -drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c: In function 'brcmf_fws_txs_process':
  16446. -drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c:1478:8: warning: 'skb' may be used uninitialized in this function [-Wmaybe-uninitialized]
  16447. -
  16448. -This is a false positive, and marking the brcmf_fws_hanger_poppkt function
  16449. -as 'static inline' makes the warning go away. I have checked the object
  16450. -file output and while a little code gets moved around, the size of
  16451. -the binary remains identical.
  16452. -
  16453. -Signed-off-by: Arnd Bergmann <arnd@arndb.de>
  16454. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16455. ----
  16456. -
  16457. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  16458. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  16459. -@@ -635,7 +635,7 @@ static int brcmf_fws_hanger_pushpkt(stru
  16460. - return 0;
  16461. - }
  16462. -
  16463. --static int brcmf_fws_hanger_poppkt(struct brcmf_fws_hanger *h,
  16464. -+static inline int brcmf_fws_hanger_poppkt(struct brcmf_fws_hanger *h,
  16465. - u32 slot_id, struct sk_buff **pktout,
  16466. - bool remove_item)
  16467. - {
  16468. 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
  16469. deleted file mode 100644
  16470. index b16782d..0000000
  16471. --- a/package/kernel/mac80211/patches/344-0001-brcmfmac-allow-device-tree-node-without-interrupts-p.patch
  16472. +++ /dev/null
  16473. @@ -1,45 +0,0 @@
  16474. -From: Arend van Spriel <arend@broadcom.com>
  16475. -Date: Wed, 20 May 2015 14:09:47 +0200
  16476. -Subject: [PATCH] brcmfmac: allow device tree node without 'interrupts'
  16477. - property
  16478. -
  16479. -As described in the device tree bindings for 'brcm,bcm4329-fmac'
  16480. -nodes, the interrupts property is optional. So adding a check
  16481. -for the presence of this property before attempting to parse
  16482. -and map the interrupt. If not present or parsing fails return
  16483. -and fallback to in-band sdio interrupt.
  16484. -
  16485. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16486. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16487. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16488. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16489. ----
  16490. -
  16491. ---- a/drivers/net/wireless/brcm80211/brcmfmac/of.c
  16492. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/of.c
  16493. -@@ -39,10 +39,16 @@ void brcmf_of_probe(struct brcmf_sdio_de
  16494. - if (!sdiodev->pdata)
  16495. - return;
  16496. -
  16497. -+ if (of_property_read_u32(np, "brcm,drive-strength", &val) == 0)
  16498. -+ sdiodev->pdata->drive_strength = val;
  16499. -+
  16500. -+ /* make sure there are interrupts defined in the node */
  16501. -+ if (!of_find_property(np, "interrupts", NULL))
  16502. -+ return;
  16503. -+
  16504. - irq = irq_of_parse_and_map(np, 0);
  16505. - if (!irq) {
  16506. - brcmf_err("interrupt could not be mapped\n");
  16507. -- devm_kfree(dev, sdiodev->pdata);
  16508. - return;
  16509. - }
  16510. - irqf = irqd_get_trigger_type(irq_get_irq_data(irq));
  16511. -@@ -50,7 +56,4 @@ void brcmf_of_probe(struct brcmf_sdio_de
  16512. - sdiodev->pdata->oob_irq_supported = true;
  16513. - sdiodev->pdata->oob_irq_nr = irq;
  16514. - sdiodev->pdata->oob_irq_flags = irqf;
  16515. --
  16516. -- if (of_property_read_u32(np, "brcm,drive-strength", &val) == 0)
  16517. -- sdiodev->pdata->drive_strength = val;
  16518. - }
  16519. 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
  16520. deleted file mode 100644
  16521. index f81250e..0000000
  16522. --- a/package/kernel/mac80211/patches/344-0002-brcmfmac-Improve-throughput-by-scheduling-msbug-flow.patch
  16523. +++ /dev/null
  16524. @@ -1,87 +0,0 @@
  16525. -From: Hante Meuleman <meuleman@broadcom.com>
  16526. -Date: Wed, 20 May 2015 14:09:48 +0200
  16527. -Subject: [PATCH] brcmfmac: Improve throughput by scheduling msbug flow worker.
  16528. -
  16529. -The tx flow worker in msgbuf gets scheduled at tx till a certain
  16530. -threshold has been reached. Then the tx completes will take over
  16531. -the scheduling. When amsdu and ampdu is used the frames are
  16532. -transferred wireless in a very bulky fashion, in combination
  16533. -with this scheduling algorithm and buffer limiters in the stack
  16534. -this can result in limited throughput. This change causes the
  16535. -flow worker to be scheduled more frequently from tx.
  16536. -
  16537. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  16538. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  16539. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16540. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  16541. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  16542. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16543. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16544. ----
  16545. -
  16546. ---- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  16547. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  16548. -@@ -249,8 +249,8 @@ void brcmf_flowring_delete(struct brcmf_
  16549. - }
  16550. -
  16551. -
  16552. --void brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  16553. -- struct sk_buff *skb)
  16554. -+u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  16555. -+ struct sk_buff *skb)
  16556. - {
  16557. - struct brcmf_flowring_ring *ring;
  16558. -
  16559. -@@ -271,6 +271,7 @@ void brcmf_flowring_enqueue(struct brcmf
  16560. - if (skb_queue_len(&ring->skblist) < BRCMF_FLOWRING_LOW)
  16561. - brcmf_flowring_block(flow, flowid, false);
  16562. - }
  16563. -+ return skb_queue_len(&ring->skblist);
  16564. - }
  16565. -
  16566. -
  16567. ---- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.h
  16568. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.h
  16569. -@@ -64,8 +64,8 @@ u32 brcmf_flowring_create(struct brcmf_f
  16570. - void brcmf_flowring_delete(struct brcmf_flowring *flow, u8 flowid);
  16571. - void brcmf_flowring_open(struct brcmf_flowring *flow, u8 flowid);
  16572. - u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u8 flowid);
  16573. --void brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  16574. -- struct sk_buff *skb);
  16575. -+u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  16576. -+ struct sk_buff *skb);
  16577. - struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u8 flowid);
  16578. - void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u8 flowid,
  16579. - struct sk_buff *skb);
  16580. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  16581. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  16582. -@@ -73,7 +73,7 @@
  16583. - #define BRCMF_MSGBUF_TX_FLUSH_CNT1 32
  16584. - #define BRCMF_MSGBUF_TX_FLUSH_CNT2 96
  16585. -
  16586. --#define BRCMF_MSGBUF_DELAY_TXWORKER_THRS 64
  16587. -+#define BRCMF_MSGBUF_DELAY_TXWORKER_THRS 96
  16588. - #define BRCMF_MSGBUF_TRICKLE_TXWORKER_THRS 32
  16589. -
  16590. - struct msgbuf_common_hdr {
  16591. -@@ -797,6 +797,8 @@ static int brcmf_msgbuf_txdata(struct br
  16592. - struct brcmf_flowring *flow = msgbuf->flow;
  16593. - struct ethhdr *eh = (struct ethhdr *)(skb->data);
  16594. - u32 flowid;
  16595. -+ u32 queue_count;
  16596. -+ bool force;
  16597. -
  16598. - flowid = brcmf_flowring_lookup(flow, eh->h_dest, skb->priority, ifidx);
  16599. - if (flowid == BRCMF_FLOWRING_INVALID_ID) {
  16600. -@@ -804,8 +806,9 @@ static int brcmf_msgbuf_txdata(struct br
  16601. - if (flowid == BRCMF_FLOWRING_INVALID_ID)
  16602. - return -ENOMEM;
  16603. - }
  16604. -- brcmf_flowring_enqueue(flow, flowid, skb);
  16605. -- brcmf_msgbuf_schedule_txdata(msgbuf, flowid, false);
  16606. -+ queue_count = brcmf_flowring_enqueue(flow, flowid, skb);
  16607. -+ force = ((queue_count % BRCMF_MSGBUF_TRICKLE_TXWORKER_THRS) == 0);
  16608. -+ brcmf_msgbuf_schedule_txdata(msgbuf, flowid, force);
  16609. -
  16610. - return 0;
  16611. - }
  16612. 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
  16613. deleted file mode 100644
  16614. index 61153c4..0000000
  16615. --- a/package/kernel/mac80211/patches/344-0003-brcmfmac-remove-pci-shared-structure-rev4-support.patch
  16616. +++ /dev/null
  16617. @@ -1,41 +0,0 @@
  16618. -From: Franky Lin <frankyl@broadcom.com>
  16619. -Date: Wed, 20 May 2015 14:09:49 +0200
  16620. -Subject: [PATCH] brcmfmac: remove pci shared structure rev4 support
  16621. -
  16622. -All pcie full dongle chips supported by fmac are using rev 5+ shared
  16623. -structure. This patch removes the rev4 related code.
  16624. -
  16625. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16626. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16627. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  16628. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  16629. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16630. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16631. ----
  16632. -
  16633. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16634. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16635. -@@ -112,10 +112,9 @@ enum brcmf_pcie_state {
  16636. - BRCMF_PCIE_MB_INT_D2H3_DB0 | \
  16637. - BRCMF_PCIE_MB_INT_D2H3_DB1)
  16638. -
  16639. --#define BRCMF_PCIE_MIN_SHARED_VERSION 4
  16640. -+#define BRCMF_PCIE_MIN_SHARED_VERSION 5
  16641. - #define BRCMF_PCIE_MAX_SHARED_VERSION 5
  16642. - #define BRCMF_PCIE_SHARED_VERSION_MASK 0x00FF
  16643. --#define BRCMF_PCIE_SHARED_TXPUSH_SUPPORT 0x4000
  16644. -
  16645. - #define BRCMF_PCIE_FLAGS_HTOD_SPLIT 0x4000
  16646. - #define BRCMF_PCIE_FLAGS_DTOH_SPLIT 0x8000
  16647. -@@ -1280,11 +1279,6 @@ brcmf_pcie_init_share_ram_info(struct br
  16648. - brcmf_err("Unsupported PCIE version %d\n", version);
  16649. - return -EINVAL;
  16650. - }
  16651. -- if (shared->flags & BRCMF_PCIE_SHARED_TXPUSH_SUPPORT) {
  16652. -- brcmf_err("Unsupported legacy TX mode 0x%x\n",
  16653. -- shared->flags & BRCMF_PCIE_SHARED_TXPUSH_SUPPORT);
  16654. -- return -EINVAL;
  16655. -- }
  16656. -
  16657. - addr = sharedram_addr + BRCMF_SHARED_MAX_RXBUFPOST_OFFSET;
  16658. - shared->max_rxbufpost = brcmf_pcie_read_tcm16(devinfo, addr);
  16659. 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
  16660. deleted file mode 100644
  16661. index 8c8eebe..0000000
  16662. --- a/package/kernel/mac80211/patches/344-0004-brcmfmac-remove-dummy-cache-flush-invalidate-functio.patch
  16663. +++ /dev/null
  16664. @@ -1,120 +0,0 @@
  16665. -From: Franky Lin <frankyl@broadcom.com>
  16666. -Date: Wed, 20 May 2015 14:09:50 +0200
  16667. -Subject: [PATCH] brcmfmac: remove dummy cache flush/invalidate function
  16668. -
  16669. -brcmf_dma_flush and brcmf_dma_invalidate_cache are not necessary and
  16670. -have never been implemented.
  16671. -
  16672. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16673. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  16674. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  16675. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  16676. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16677. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16678. ----
  16679. -
  16680. ---- a/drivers/net/wireless/brcm80211/brcmfmac/commonring.c
  16681. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/commonring.c
  16682. -@@ -22,17 +22,6 @@
  16683. - #include "core.h"
  16684. - #include "commonring.h"
  16685. -
  16686. --
  16687. --/* dma flushing needs implementation for mips and arm platforms. Should
  16688. -- * be put in util. Note, this is not real flushing. It is virtual non
  16689. -- * cached memory. Only write buffers should have to be drained. Though
  16690. -- * this may be different depending on platform......
  16691. -- * SEE ALSO msgbuf.c
  16692. -- */
  16693. --#define brcmf_dma_flush(addr, len)
  16694. --#define brcmf_dma_invalidate_cache(addr, len)
  16695. --
  16696. --
  16697. - void brcmf_commonring_register_cb(struct brcmf_commonring *commonring,
  16698. - int (*cr_ring_bell)(void *ctx),
  16699. - int (*cr_update_rptr)(void *ctx),
  16700. -@@ -206,14 +195,9 @@ int brcmf_commonring_write_complete(stru
  16701. - address = commonring->buf_addr;
  16702. - address += (commonring->f_ptr * commonring->item_len);
  16703. - if (commonring->f_ptr > commonring->w_ptr) {
  16704. -- brcmf_dma_flush(address,
  16705. -- (commonring->depth - commonring->f_ptr) *
  16706. -- commonring->item_len);
  16707. - address = commonring->buf_addr;
  16708. - commonring->f_ptr = 0;
  16709. - }
  16710. -- brcmf_dma_flush(address, (commonring->w_ptr - commonring->f_ptr) *
  16711. -- commonring->item_len);
  16712. -
  16713. - commonring->f_ptr = commonring->w_ptr;
  16714. -
  16715. -@@ -258,8 +242,6 @@ void *brcmf_commonring_get_read_ptr(stru
  16716. - if (commonring->r_ptr == commonring->depth)
  16717. - commonring->r_ptr = 0;
  16718. -
  16719. -- brcmf_dma_invalidate_cache(ret_addr, *n_ items * commonring->item_len);
  16720. --
  16721. - return ret_addr;
  16722. - }
  16723. -
  16724. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  16725. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  16726. -@@ -278,16 +278,6 @@ struct brcmf_msgbuf_pktids {
  16727. - struct brcmf_msgbuf_pktid *array;
  16728. - };
  16729. -
  16730. --
  16731. --/* dma flushing needs implementation for mips and arm platforms. Should
  16732. -- * be put in util. Note, this is not real flushing. It is virtual non
  16733. -- * cached memory. Only write buffers should have to be drained. Though
  16734. -- * this may be different depending on platform......
  16735. -- */
  16736. --#define brcmf_dma_flush(addr, len)
  16737. --#define brcmf_dma_invalidate_cache(addr, len)
  16738. --
  16739. --
  16740. - static void brcmf_msgbuf_rxbuf_ioctlresp_post(struct brcmf_msgbuf *msgbuf);
  16741. -
  16742. -
  16743. -@@ -462,7 +452,6 @@ static int brcmf_msgbuf_tx_ioctl(struct
  16744. - memcpy(msgbuf->ioctbuf, buf, buf_len);
  16745. - else
  16746. - memset(msgbuf->ioctbuf, 0, buf_len);
  16747. -- brcmf_dma_flush(ioctl_buf, buf_len);
  16748. -
  16749. - err = brcmf_commonring_write_complete(commonring);
  16750. - brcmf_commonring_unlock(commonring);
  16751. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16752. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16753. -@@ -276,15 +276,6 @@ static const u32 brcmf_ring_itemsize[BRC
  16754. - };
  16755. -
  16756. -
  16757. --/* dma flushing needs implementation for mips and arm platforms. Should
  16758. -- * be put in util. Note, this is not real flushing. It is virtual non
  16759. -- * cached memory. Only write buffers should have to be drained. Though
  16760. -- * this may be different depending on platform......
  16761. -- */
  16762. --#define brcmf_dma_flush(addr, len)
  16763. --#define brcmf_dma_invalidate_cache(addr, len)
  16764. --
  16765. --
  16766. - static u32
  16767. - brcmf_pcie_read_reg32(struct brcmf_pciedev_info *devinfo, u32 reg_offset)
  16768. - {
  16769. -@@ -1174,7 +1165,6 @@ static int brcmf_pcie_init_scratchbuffer
  16770. - goto fail;
  16771. -
  16772. - memset(devinfo->shared.scratch, 0, BRCMF_DMA_D2H_SCRATCH_BUF_LEN);
  16773. -- brcmf_dma_flush(devinfo->shared.scratch, BRCMF_DMA_D2H_SCRATCH_BUF_LEN);
  16774. -
  16775. - addr = devinfo->shared.tcm_base_address +
  16776. - BRCMF_SHARED_DMA_SCRATCH_ADDR_OFFSET;
  16777. -@@ -1192,7 +1182,6 @@ static int brcmf_pcie_init_scratchbuffer
  16778. - goto fail;
  16779. -
  16780. - memset(devinfo->shared.ringupd, 0, BRCMF_DMA_D2H_RINGUPD_BUF_LEN);
  16781. -- brcmf_dma_flush(devinfo->shared.ringupd, BRCMF_DMA_D2H_RINGUPD_BUF_LEN);
  16782. -
  16783. - addr = devinfo->shared.tcm_base_address +
  16784. - BRCMF_SHARED_DMA_RINGUPD_ADDR_OFFSET;
  16785. 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
  16786. deleted file mode 100644
  16787. index 2f50abd..0000000
  16788. --- a/package/kernel/mac80211/patches/344-0005-brcmfmac-add-support-for-dma-indices-feature.patch
  16789. +++ /dev/null
  16790. @@ -1,270 +0,0 @@
  16791. -From: Franky Lin <frankyl@broadcom.com>
  16792. -Date: Wed, 20 May 2015 14:09:51 +0200
  16793. -Subject: [PATCH] brcmfmac: add support for dma indices feature
  16794. -
  16795. -PCIe full dongle firmware can support a dma indices feature with which
  16796. -firmware can update/fetch the read/write indices of message buffer
  16797. -rings on both host to dongle and dongle to host directions. The support is
  16798. -announced by firmware through shared flags.
  16799. -
  16800. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  16801. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  16802. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  16803. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  16804. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  16805. ----
  16806. -
  16807. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16808. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  16809. -@@ -115,6 +115,8 @@ enum brcmf_pcie_state {
  16810. - #define BRCMF_PCIE_MIN_SHARED_VERSION 5
  16811. - #define BRCMF_PCIE_MAX_SHARED_VERSION 5
  16812. - #define BRCMF_PCIE_SHARED_VERSION_MASK 0x00FF
  16813. -+#define BRCMF_PCIE_SHARED_DMA_INDEX 0x10000
  16814. -+#define BRCMF_PCIE_SHARED_DMA_2B_IDX 0x100000
  16815. -
  16816. - #define BRCMF_PCIE_FLAGS_HTOD_SPLIT 0x4000
  16817. - #define BRCMF_PCIE_FLAGS_DTOH_SPLIT 0x8000
  16818. -@@ -146,6 +148,10 @@ enum brcmf_pcie_state {
  16819. - #define BRCMF_SHARED_RING_H2D_R_IDX_PTR_OFFSET 8
  16820. - #define BRCMF_SHARED_RING_D2H_W_IDX_PTR_OFFSET 12
  16821. - #define BRCMF_SHARED_RING_D2H_R_IDX_PTR_OFFSET 16
  16822. -+#define BRCMF_SHARED_RING_H2D_WP_HADDR_OFFSET 20
  16823. -+#define BRCMF_SHARED_RING_H2D_RP_HADDR_OFFSET 28
  16824. -+#define BRCMF_SHARED_RING_D2H_WP_HADDR_OFFSET 36
  16825. -+#define BRCMF_SHARED_RING_D2H_RP_HADDR_OFFSET 44
  16826. - #define BRCMF_SHARED_RING_TCM_MEMLOC_OFFSET 0
  16827. - #define BRCMF_SHARED_RING_MAX_SUB_QUEUES 52
  16828. -
  16829. -@@ -247,6 +253,13 @@ struct brcmf_pciedev_info {
  16830. - bool mbdata_completed;
  16831. - bool irq_allocated;
  16832. - bool wowl_enabled;
  16833. -+ u8 dma_idx_sz;
  16834. -+ void *idxbuf;
  16835. -+ u32 idxbuf_sz;
  16836. -+ dma_addr_t idxbuf_dmahandle;
  16837. -+ u16 (*read_ptr)(struct brcmf_pciedev_info *devinfo, u32 mem_offset);
  16838. -+ void (*write_ptr)(struct brcmf_pciedev_info *devinfo, u32 mem_offset,
  16839. -+ u16 value);
  16840. - };
  16841. -
  16842. - struct brcmf_pcie_ringbuf {
  16843. -@@ -323,6 +336,25 @@ brcmf_pcie_write_tcm16(struct brcmf_pcie
  16844. - }
  16845. -
  16846. -
  16847. -+static u16
  16848. -+brcmf_pcie_read_idx(struct brcmf_pciedev_info *devinfo, u32 mem_offset)
  16849. -+{
  16850. -+ u16 *address = devinfo->idxbuf + mem_offset;
  16851. -+
  16852. -+ return (*(address));
  16853. -+}
  16854. -+
  16855. -+
  16856. -+static void
  16857. -+brcmf_pcie_write_idx(struct brcmf_pciedev_info *devinfo, u32 mem_offset,
  16858. -+ u16 value)
  16859. -+{
  16860. -+ u16 *address = devinfo->idxbuf + mem_offset;
  16861. -+
  16862. -+ *(address) = value;
  16863. -+}
  16864. -+
  16865. -+
  16866. - static u32
  16867. - brcmf_pcie_read_tcm32(struct brcmf_pciedev_info *devinfo, u32 mem_offset)
  16868. - {
  16869. -@@ -868,7 +900,7 @@ static int brcmf_pcie_ring_mb_write_rptr
  16870. - brcmf_dbg(PCIE, "W r_ptr %d (%d), ring %d\n", commonring->r_ptr,
  16871. - commonring->w_ptr, ring->id);
  16872. -
  16873. -- brcmf_pcie_write_tcm16(devinfo, ring->r_idx_addr, commonring->r_ptr);
  16874. -+ devinfo->write_ptr(devinfo, ring->r_idx_addr, commonring->r_ptr);
  16875. -
  16876. - return 0;
  16877. - }
  16878. -@@ -886,7 +918,7 @@ static int brcmf_pcie_ring_mb_write_wptr
  16879. - brcmf_dbg(PCIE, "W w_ptr %d (%d), ring %d\n", commonring->w_ptr,
  16880. - commonring->r_ptr, ring->id);
  16881. -
  16882. -- brcmf_pcie_write_tcm16(devinfo, ring->w_idx_addr, commonring->w_ptr);
  16883. -+ devinfo->write_ptr(devinfo, ring->w_idx_addr, commonring->w_ptr);
  16884. -
  16885. - return 0;
  16886. - }
  16887. -@@ -915,7 +947,7 @@ static int brcmf_pcie_ring_mb_update_rpt
  16888. - if (devinfo->state != BRCMFMAC_PCIE_STATE_UP)
  16889. - return -EIO;
  16890. -
  16891. -- commonring->r_ptr = brcmf_pcie_read_tcm16(devinfo, ring->r_idx_addr);
  16892. -+ commonring->r_ptr = devinfo->read_ptr(devinfo, ring->r_idx_addr);
  16893. -
  16894. - brcmf_dbg(PCIE, "R r_ptr %d (%d), ring %d\n", commonring->r_ptr,
  16895. - commonring->w_ptr, ring->id);
  16896. -@@ -933,7 +965,7 @@ static int brcmf_pcie_ring_mb_update_wpt
  16897. - if (devinfo->state != BRCMFMAC_PCIE_STATE_UP)
  16898. - return -EIO;
  16899. -
  16900. -- commonring->w_ptr = brcmf_pcie_read_tcm16(devinfo, ring->w_idx_addr);
  16901. -+ commonring->w_ptr = devinfo->read_ptr(devinfo, ring->w_idx_addr);
  16902. -
  16903. - brcmf_dbg(PCIE, "R w_ptr %d (%d), ring %d\n", commonring->w_ptr,
  16904. - commonring->r_ptr, ring->id);
  16905. -@@ -1038,6 +1070,13 @@ static void brcmf_pcie_release_ringbuffe
  16906. - }
  16907. - kfree(devinfo->shared.flowrings);
  16908. - devinfo->shared.flowrings = NULL;
  16909. -+ if (devinfo->idxbuf) {
  16910. -+ dma_free_coherent(&devinfo->pdev->dev,
  16911. -+ devinfo->idxbuf_sz,
  16912. -+ devinfo->idxbuf,
  16913. -+ devinfo->idxbuf_dmahandle);
  16914. -+ devinfo->idxbuf = NULL;
  16915. -+ }
  16916. - }
  16917. -
  16918. -
  16919. -@@ -1053,19 +1092,72 @@ static int brcmf_pcie_init_ringbuffers(s
  16920. - u32 addr;
  16921. - u32 ring_mem_ptr;
  16922. - u32 i;
  16923. -+ u64 address;
  16924. -+ u32 bufsz;
  16925. - u16 max_sub_queues;
  16926. -+ u8 idx_offset;
  16927. -
  16928. - ring_addr = devinfo->shared.ring_info_addr;
  16929. - brcmf_dbg(PCIE, "Base ring addr = 0x%08x\n", ring_addr);
  16930. -+ addr = ring_addr + BRCMF_SHARED_RING_MAX_SUB_QUEUES;
  16931. -+ max_sub_queues = brcmf_pcie_read_tcm16(devinfo, addr);
  16932. -
  16933. -- addr = ring_addr + BRCMF_SHARED_RING_D2H_W_IDX_PTR_OFFSET;
  16934. -- d2h_w_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  16935. -- addr = ring_addr + BRCMF_SHARED_RING_D2H_R_IDX_PTR_OFFSET;
  16936. -- d2h_r_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  16937. -- addr = ring_addr + BRCMF_SHARED_RING_H2D_W_IDX_PTR_OFFSET;
  16938. -- h2d_w_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  16939. -- addr = ring_addr + BRCMF_SHARED_RING_H2D_R_IDX_PTR_OFFSET;
  16940. -- h2d_r_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  16941. -+ if (devinfo->dma_idx_sz != 0) {
  16942. -+ bufsz = (BRCMF_NROF_D2H_COMMON_MSGRINGS + max_sub_queues) *
  16943. -+ devinfo->dma_idx_sz * 2;
  16944. -+ devinfo->idxbuf = dma_alloc_coherent(&devinfo->pdev->dev, bufsz,
  16945. -+ &devinfo->idxbuf_dmahandle,
  16946. -+ GFP_KERNEL);
  16947. -+ if (!devinfo->idxbuf)
  16948. -+ devinfo->dma_idx_sz = 0;
  16949. -+ }
  16950. -+
  16951. -+ if (devinfo->dma_idx_sz == 0) {
  16952. -+ addr = ring_addr + BRCMF_SHARED_RING_D2H_W_IDX_PTR_OFFSET;
  16953. -+ d2h_w_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  16954. -+ addr = ring_addr + BRCMF_SHARED_RING_D2H_R_IDX_PTR_OFFSET;
  16955. -+ d2h_r_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  16956. -+ addr = ring_addr + BRCMF_SHARED_RING_H2D_W_IDX_PTR_OFFSET;
  16957. -+ h2d_w_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  16958. -+ addr = ring_addr + BRCMF_SHARED_RING_H2D_R_IDX_PTR_OFFSET;
  16959. -+ h2d_r_idx_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  16960. -+ idx_offset = sizeof(u32);
  16961. -+ devinfo->write_ptr = brcmf_pcie_write_tcm16;
  16962. -+ devinfo->read_ptr = brcmf_pcie_read_tcm16;
  16963. -+ brcmf_dbg(PCIE, "Using TCM indices\n");
  16964. -+ } else {
  16965. -+ memset(devinfo->idxbuf, 0, bufsz);
  16966. -+ devinfo->idxbuf_sz = bufsz;
  16967. -+ idx_offset = devinfo->dma_idx_sz;
  16968. -+ devinfo->write_ptr = brcmf_pcie_write_idx;
  16969. -+ devinfo->read_ptr = brcmf_pcie_read_idx;
  16970. -+
  16971. -+ h2d_w_idx_ptr = 0;
  16972. -+ addr = ring_addr + BRCMF_SHARED_RING_H2D_WP_HADDR_OFFSET;
  16973. -+ address = (u64)devinfo->idxbuf_dmahandle;
  16974. -+ brcmf_pcie_write_tcm32(devinfo, addr, address & 0xffffffff);
  16975. -+ brcmf_pcie_write_tcm32(devinfo, addr + 4, address >> 32);
  16976. -+
  16977. -+ h2d_r_idx_ptr = h2d_w_idx_ptr + max_sub_queues * idx_offset;
  16978. -+ addr = ring_addr + BRCMF_SHARED_RING_H2D_RP_HADDR_OFFSET;
  16979. -+ address += max_sub_queues * idx_offset;
  16980. -+ brcmf_pcie_write_tcm32(devinfo, addr, address & 0xffffffff);
  16981. -+ brcmf_pcie_write_tcm32(devinfo, addr + 4, address >> 32);
  16982. -+
  16983. -+ d2h_w_idx_ptr = h2d_r_idx_ptr + max_sub_queues * idx_offset;
  16984. -+ addr = ring_addr + BRCMF_SHARED_RING_D2H_WP_HADDR_OFFSET;
  16985. -+ address += max_sub_queues * idx_offset;
  16986. -+ brcmf_pcie_write_tcm32(devinfo, addr, address & 0xffffffff);
  16987. -+ brcmf_pcie_write_tcm32(devinfo, addr + 4, address >> 32);
  16988. -+
  16989. -+ d2h_r_idx_ptr = d2h_w_idx_ptr +
  16990. -+ BRCMF_NROF_D2H_COMMON_MSGRINGS * idx_offset;
  16991. -+ addr = ring_addr + BRCMF_SHARED_RING_D2H_RP_HADDR_OFFSET;
  16992. -+ address += BRCMF_NROF_D2H_COMMON_MSGRINGS * idx_offset;
  16993. -+ brcmf_pcie_write_tcm32(devinfo, addr, address & 0xffffffff);
  16994. -+ brcmf_pcie_write_tcm32(devinfo, addr + 4, address >> 32);
  16995. -+ brcmf_dbg(PCIE, "Using host memory indices\n");
  16996. -+ }
  16997. -
  16998. - addr = ring_addr + BRCMF_SHARED_RING_TCM_MEMLOC_OFFSET;
  16999. - ring_mem_ptr = brcmf_pcie_read_tcm32(devinfo, addr);
  17000. -@@ -1079,8 +1171,8 @@ static int brcmf_pcie_init_ringbuffers(s
  17001. - ring->id = i;
  17002. - devinfo->shared.commonrings[i] = ring;
  17003. -
  17004. -- h2d_w_idx_ptr += sizeof(u32);
  17005. -- h2d_r_idx_ptr += sizeof(u32);
  17006. -+ h2d_w_idx_ptr += idx_offset;
  17007. -+ h2d_r_idx_ptr += idx_offset;
  17008. - ring_mem_ptr += BRCMF_RING_MEM_SZ;
  17009. - }
  17010. -
  17011. -@@ -1094,13 +1186,11 @@ static int brcmf_pcie_init_ringbuffers(s
  17012. - ring->id = i;
  17013. - devinfo->shared.commonrings[i] = ring;
  17014. -
  17015. -- d2h_w_idx_ptr += sizeof(u32);
  17016. -- d2h_r_idx_ptr += sizeof(u32);
  17017. -+ d2h_w_idx_ptr += idx_offset;
  17018. -+ d2h_r_idx_ptr += idx_offset;
  17019. - ring_mem_ptr += BRCMF_RING_MEM_SZ;
  17020. - }
  17021. -
  17022. -- addr = ring_addr + BRCMF_SHARED_RING_MAX_SUB_QUEUES;
  17023. -- max_sub_queues = brcmf_pcie_read_tcm16(devinfo, addr);
  17024. - devinfo->shared.nrof_flowrings =
  17025. - max_sub_queues - BRCMF_NROF_H2D_COMMON_MSGRINGS;
  17026. - rings = kcalloc(devinfo->shared.nrof_flowrings, sizeof(*ring),
  17027. -@@ -1124,15 +1214,15 @@ static int brcmf_pcie_init_ringbuffers(s
  17028. - ring);
  17029. - ring->w_idx_addr = h2d_w_idx_ptr;
  17030. - ring->r_idx_addr = h2d_r_idx_ptr;
  17031. -- h2d_w_idx_ptr += sizeof(u32);
  17032. -- h2d_r_idx_ptr += sizeof(u32);
  17033. -+ h2d_w_idx_ptr += idx_offset;
  17034. -+ h2d_r_idx_ptr += idx_offset;
  17035. - }
  17036. - devinfo->shared.flowrings = rings;
  17037. -
  17038. - return 0;
  17039. -
  17040. - fail:
  17041. -- brcmf_err("Allocating commonring buffers failed\n");
  17042. -+ brcmf_err("Allocating ring buffers failed\n");
  17043. - brcmf_pcie_release_ringbuffers(devinfo);
  17044. - return -ENOMEM;
  17045. - }
  17046. -@@ -1269,6 +1359,14 @@ brcmf_pcie_init_share_ram_info(struct br
  17047. - return -EINVAL;
  17048. - }
  17049. -
  17050. -+ /* check firmware support dma indicies */
  17051. -+ if (shared->flags & BRCMF_PCIE_SHARED_DMA_INDEX) {
  17052. -+ if (shared->flags & BRCMF_PCIE_SHARED_DMA_2B_IDX)
  17053. -+ devinfo->dma_idx_sz = sizeof(u16);
  17054. -+ else
  17055. -+ devinfo->dma_idx_sz = sizeof(u32);
  17056. -+ }
  17057. -+
  17058. - addr = sharedram_addr + BRCMF_SHARED_MAX_RXBUFPOST_OFFSET;
  17059. - shared->max_rxbufpost = brcmf_pcie_read_tcm16(devinfo, addr);
  17060. - if (shared->max_rxbufpost == 0)
  17061. 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
  17062. deleted file mode 100644
  17063. index 28408d2..0000000
  17064. --- a/package/kernel/mac80211/patches/345-brcmfmac-avoid-null-pointer-access-when-brcmf_msgbuf.patch
  17065. +++ /dev/null
  17066. @@ -1,102 +0,0 @@
  17067. -From: Arend van Spriel <arend@broadcom.com>
  17068. -Date: Tue, 26 May 2015 13:19:46 +0200
  17069. -Subject: [PATCH] brcmfmac: avoid null pointer access when
  17070. - brcmf_msgbuf_get_pktid() fails
  17071. -
  17072. -The function brcmf_msgbuf_get_pktid() may return a NULL pointer so
  17073. -the callers should check the return pointer before accessing it to
  17074. -avoid the crash below (see [1]):
  17075. -
  17076. -brcmfmac: brcmf_msgbuf_get_pktid: Invalid packet id 273 (not in use)
  17077. -BUG: unable to handle kernel NULL pointer dereference at 0000000000000080
  17078. -IP: [<ffffffff8145b225>] skb_pull+0x5/0x50
  17079. -PGD 0
  17080. -Oops: 0000 [#1] PREEMPT SMP
  17081. -Modules linked in: pci_stub vboxpci(O) vboxnetflt(O) vboxnetadp(O) vboxdrv(O)
  17082. - snd_hda_codec_hdmi bnep mousedev hid_generic ushwmon msr ext4 crc16 mbcache
  17083. - jbd2 sd_mod uas usb_storage ahci libahci libata scsi_mod xhci_pci xhci_hcd
  17084. - usbcore usb_common
  17085. -CPU: 0 PID: 1661 Comm: irq/61-brcmf_pc Tainted: G O 4.0.1-MacbookPro-ARCH #1
  17086. -Hardware name: Apple Inc. MacBookPro12,1/Mac-E43C1C25D4880AD6,
  17087. - BIOS MBP121.88Z.0167.B02.1503241251 03/24/2015
  17088. -task: ffff880264203cc0 ti: ffff88025ffe4000 task.ti: ffff88025ffe4000
  17089. -RIP: 0010:[<ffffffff8145b225>] [<ffffffff8145b225>] skb_pull+0x5/0x50
  17090. -RSP: 0018:ffff88025ffe7d40 EFLAGS: 00010202
  17091. -RAX: 0000000000000000 RBX: ffff88008a33c000 RCX: 0000000000000044
  17092. -RDX: 0000000000000000 RSI: 000000000000004a RDI: 0000000000000000
  17093. -RBP: ffff88025ffe7da8 R08: 0000000000000096 R09: 000000000000004a
  17094. -R10: 0000000000000000 R11: 000000000000048e R12: ffff88025ff14f00
  17095. -R13: 0000000000000000 R14: ffff880263b48200 R15: ffff88008a33c000
  17096. -FS: 0000000000000000(0000) GS:ffff88026ec00000(0000) knlGS:0000000000000000
  17097. -CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  17098. -CR2: 0000000000000080 CR3: 000000000180b000 CR4: 00000000003407f0
  17099. -Stack:
  17100. - ffffffffa06aed74 ffff88025ffe7dc8 ffff880263b48270 ffff880263b48278
  17101. - 05ea88020000004a 0002ffff81014635 000000001720b2f6 ffff88026ec116c0
  17102. - ffff880263b48200 0000000000010000 ffff880263b4ae00 ffff880264203cc0
  17103. -Call Trace:
  17104. - [<ffffffffa06aed74>] ? brcmf_msgbuf_process_rx+0x404/0x480 [brcmfmac]
  17105. - [<ffffffff810cea60>] ? irq_finalize_oneshot.part.30+0xf0/0xf0
  17106. - [<ffffffffa06afb55>] brcmf_proto_msgbuf_rx_trigger+0x35/0xf0 [brcmfmac]
  17107. - [<ffffffffa06baf2a>] brcmf_pcie_isr_thread_v2+0x8a/0x130 [brcmfmac]
  17108. - [<ffffffff810cea80>] irq_thread_fn+0x20/0x50
  17109. - [<ffffffff810ceddf>] irq_thread+0x13f/0x170
  17110. - [<ffffffff810cebf0>] ? wake_threads_waitq+0x30/0x30
  17111. - [<ffffffff810ceca0>] ? irq_thread_dtor+0xb0/0xb0
  17112. - [<ffffffff81092a08>] kthread+0xd8/0xf0
  17113. - [<ffffffff81092930>] ? kthread_create_on_node+0x1c0/0x1c0
  17114. - [<ffffffff8156d898>] ret_from_fork+0x58/0x90
  17115. - [<ffffffff81092930>] ? kthread_create_on_node+0x1c0/0x1c0
  17116. -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
  17117. - f7 88 50 01 c3 66 0f 1f 84 00 00 00 00 00 0f 1f
  17118. -RIP [<ffffffff8145b225>] skb_pull+0x5/0x50
  17119. - RSP <ffff88025ffe7d40>
  17120. -CR2: 0000000000000080
  17121. ----[ end trace b074c0f90e7c997d ]---
  17122. -
  17123. -[1] http://mid.gmane.org/20150430193259.GA5630@googlemail.com
  17124. -
  17125. -Cc: <stable@vger.kernel.org> # v3.18, v3.19, v4.0, v4.1
  17126. -Reported-by: Michael Hornung <mhornung.linux@gmail.com>
  17127. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  17128. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17129. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17130. ----
  17131. -
  17132. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  17133. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  17134. -@@ -500,11 +500,9 @@ static int brcmf_msgbuf_query_dcmd(struc
  17135. - msgbuf->rx_pktids,
  17136. - msgbuf->ioctl_resp_pktid);
  17137. - if (msgbuf->ioctl_resp_ret_len != 0) {
  17138. -- if (!skb) {
  17139. -- brcmf_err("Invalid packet id idx recv'd %d\n",
  17140. -- msgbuf->ioctl_resp_pktid);
  17141. -+ if (!skb)
  17142. - return -EBADF;
  17143. -- }
  17144. -+
  17145. - memcpy(buf, skb->data, (len < msgbuf->ioctl_resp_ret_len) ?
  17146. - len : msgbuf->ioctl_resp_ret_len);
  17147. - }
  17148. -@@ -866,10 +864,8 @@ brcmf_msgbuf_process_txstatus(struct brc
  17149. - flowid -= BRCMF_NROF_H2D_COMMON_MSGRINGS;
  17150. - skb = brcmf_msgbuf_get_pktid(msgbuf->drvr->bus_if->dev,
  17151. - msgbuf->tx_pktids, idx);
  17152. -- if (!skb) {
  17153. -- brcmf_err("Invalid packet id idx recv'd %d\n", idx);
  17154. -+ if (!skb)
  17155. - return;
  17156. -- }
  17157. -
  17158. - set_bit(flowid, msgbuf->txstatus_done_map);
  17159. - commonring = msgbuf->flowrings[flowid];
  17160. -@@ -1148,6 +1144,8 @@ brcmf_msgbuf_process_rx_complete(struct
  17161. -
  17162. - skb = brcmf_msgbuf_get_pktid(msgbuf->drvr->bus_if->dev,
  17163. - msgbuf->rx_pktids, idx);
  17164. -+ if (!skb)
  17165. -+ return;
  17166. -
  17167. - if (data_offset)
  17168. - skb_pull(skb, data_offset);
  17169. 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
  17170. deleted file mode 100644
  17171. index f023034..0000000
  17172. --- a/package/kernel/mac80211/patches/346-brcmfmac-fix-invalid-access-to-struct-acpi_device-fi.patch
  17173. +++ /dev/null
  17174. @@ -1,63 +0,0 @@
  17175. -From: Arend van Spriel <arend@broadcom.com>
  17176. -Date: Wed, 27 May 2015 19:31:41 +0200
  17177. -Subject: [PATCH] brcmfmac: fix invalid access to struct acpi_device fields
  17178. -
  17179. -The fields of struct acpi_device are only known when CONFIG_ACPI is
  17180. -defined. Fix this by using a helper function. This will resolve the
  17181. -issue found in linux-next:
  17182. -
  17183. - ../brcmfmac/bcmsdh.c: In function 'brcmf_ops_sdio_probe':
  17184. - ../brcmfmac/bcmsdh.c:1139:7: error: dereferencing pointer to incomplete type
  17185. - adev->flags.power_manageable = 0;
  17186. - ^
  17187. -
  17188. -Fixes: f0992ace680c ("brcmfmac: prohibit ACPI power management ...")
  17189. -Cc: Fu, Zhonghui <zhonghui.fu@linux.intel.com>
  17190. -Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
  17191. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17192. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17193. ----
  17194. -
  17195. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  17196. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  17197. -@@ -1117,6 +1117,18 @@ MODULE_DEVICE_TABLE(sdio, brcmf_sdmmc_id
  17198. - static struct brcmfmac_sdio_platform_data *brcmfmac_sdio_pdata;
  17199. -
  17200. -
  17201. -+static void brcmf_sdiod_acpi_set_power_manageable(struct device *dev,
  17202. -+ int val)
  17203. -+{
  17204. -+#if IS_ENABLED(CONFIG_ACPI)
  17205. -+ struct acpi_device *adev;
  17206. -+
  17207. -+ adev = ACPI_COMPANION(dev);
  17208. -+ if (adev)
  17209. -+ adev->flags.power_manageable = 0;
  17210. -+#endif
  17211. -+}
  17212. -+
  17213. - static int brcmf_ops_sdio_probe(struct sdio_func *func,
  17214. - const struct sdio_device_id *id)
  17215. - {
  17216. -@@ -1124,7 +1136,6 @@ static int brcmf_ops_sdio_probe(struct s
  17217. - struct brcmf_sdio_dev *sdiodev;
  17218. - struct brcmf_bus *bus_if;
  17219. - struct device *dev;
  17220. -- struct acpi_device *adev;
  17221. -
  17222. - brcmf_dbg(SDIO, "Enter\n");
  17223. - brcmf_dbg(SDIO, "Class=%x\n", func->class);
  17224. -@@ -1132,11 +1143,9 @@ static int brcmf_ops_sdio_probe(struct s
  17225. - brcmf_dbg(SDIO, "sdio device ID: 0x%04x\n", func->device);
  17226. - brcmf_dbg(SDIO, "Function#: %d\n", func->num);
  17227. -
  17228. -- /* prohibit ACPI power management for this device */
  17229. - dev = &func->dev;
  17230. -- adev = ACPI_COMPANION(dev);
  17231. -- if (adev)
  17232. -- adev->flags.power_manageable = 0;
  17233. -+ /* prohibit ACPI power management for this device */
  17234. -+ brcmf_sdiod_acpi_set_power_manageable(dev, 0);
  17235. -
  17236. - /* Consume func num 1 but dont do anything with it. */
  17237. - if (func->num == 1)
  17238. 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
  17239. deleted file mode 100644
  17240. index 2bfd44f..0000000
  17241. --- a/package/kernel/mac80211/patches/347-brcmfmac-simplify-check-stripping-v2-NVRAM.patch
  17242. +++ /dev/null
  17243. @@ -1,56 +0,0 @@
  17244. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17245. -Date: Wed, 20 May 2015 09:34:21 +0200
  17246. -Subject: [PATCH] brcmfmac: simplify check stripping v2 NVRAM
  17247. -MIME-Version: 1.0
  17248. -Content-Type: text/plain; charset=UTF-8
  17249. -Content-Transfer-Encoding: 8bit
  17250. -
  17251. -Comparing NVRAM entry with a full filtering string is simpler than
  17252. -comparing it with a short prefix and then checking random chars at magic
  17253. -offsets. The cost of snprintf relatively low, we execute it just once.
  17254. -Tested on BCM43602 with NVRAM hacked to use V2 format.
  17255. -
  17256. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  17257. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17258. ----
  17259. -
  17260. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17261. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17262. -@@ -25,7 +25,7 @@
  17263. -
  17264. - #define BRCMF_FW_MAX_NVRAM_SIZE 64000
  17265. - #define BRCMF_FW_NVRAM_DEVPATH_LEN 19 /* devpath0=pcie/1/4/ */
  17266. --#define BRCMF_FW_NVRAM_PCIEDEV_LEN 9 /* pcie/1/4/ */
  17267. -+#define BRCMF_FW_NVRAM_PCIEDEV_LEN 10 /* pcie/1/4/ + \0 */
  17268. -
  17269. - char brcmf_firmware_path[BRCMF_FW_PATH_LEN];
  17270. - module_param_string(firmware_path, brcmf_firmware_path,
  17271. -@@ -297,6 +297,8 @@ fail:
  17272. - static void brcmf_fw_strip_multi_v2(struct nvram_parser *nvp, u16 domain_nr,
  17273. - u16 bus_nr)
  17274. - {
  17275. -+ char prefix[BRCMF_FW_NVRAM_PCIEDEV_LEN];
  17276. -+ size_t len;
  17277. - u32 i, j;
  17278. - u8 *nvram;
  17279. -
  17280. -@@ -308,14 +310,13 @@ static void brcmf_fw_strip_multi_v2(stru
  17281. - * Valid entries are of type pcie/X/Y/ where X = domain_nr and
  17282. - * Y = bus_nr.
  17283. - */
  17284. -+ snprintf(prefix, sizeof(prefix), "pcie/%d/%d/", domain_nr, bus_nr);
  17285. -+ len = strlen(prefix);
  17286. - i = 0;
  17287. - j = 0;
  17288. -- while (i < nvp->nvram_len - BRCMF_FW_NVRAM_PCIEDEV_LEN) {
  17289. -- if ((strncmp(&nvp->nvram[i], "pcie/", 5) == 0) &&
  17290. -- (nvp->nvram[i + 6] == '/') && (nvp->nvram[i + 8] == '/') &&
  17291. -- ((nvp->nvram[i + 5] - '0') == domain_nr) &&
  17292. -- ((nvp->nvram[i + 7] - '0') == bus_nr)) {
  17293. -- i += BRCMF_FW_NVRAM_PCIEDEV_LEN;
  17294. -+ while (i < nvp->nvram_len - len) {
  17295. -+ if (strncmp(&nvp->nvram[i], prefix, len) == 0) {
  17296. -+ i += len;
  17297. - while (nvp->nvram[i] != 0) {
  17298. - nvram[j] = nvp->nvram[i];
  17299. - i++;
  17300. 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
  17301. deleted file mode 100644
  17302. index 0e65114..0000000
  17303. --- a/package/kernel/mac80211/patches/348-brcmfmac-simplify-check-finding-NVRAM-v1-device-path.patch
  17304. +++ /dev/null
  17305. @@ -1,57 +0,0 @@
  17306. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17307. -Date: Wed, 20 May 2015 11:01:08 +0200
  17308. -Subject: [PATCH] brcmfmac: simplify check finding NVRAM v1 device path
  17309. -MIME-Version: 1.0
  17310. -Content-Type: text/plain; charset=UTF-8
  17311. -Content-Transfer-Encoding: 8bit
  17312. -
  17313. -With a simple use of snprintf and small buffer we can compare NVRAM
  17314. -entry value with a full string. This way we avoid checking random chars
  17315. -at magic offsets.
  17316. -Tested on BCM43602 with NVRAM hacked to use v1 format.
  17317. -
  17318. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  17319. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17320. ----
  17321. -
  17322. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17323. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17324. -@@ -222,6 +222,10 @@ static int brcmf_init_nvram_parser(struc
  17325. - static void brcmf_fw_strip_multi_v1(struct nvram_parser *nvp, u16 domain_nr,
  17326. - u16 bus_nr)
  17327. - {
  17328. -+ /* Device path with a leading '=' key-value separator */
  17329. -+ char pcie_path[] = "=pcie/?/?";
  17330. -+ size_t pcie_len;
  17331. -+
  17332. - u32 i, j;
  17333. - bool found;
  17334. - u8 *nvram;
  17335. -@@ -238,6 +242,9 @@ static void brcmf_fw_strip_multi_v1(stru
  17336. - /* First search for the devpathX and see if it is the configuration
  17337. - * for domain_nr/bus_nr. Search complete nvp
  17338. - */
  17339. -+ snprintf(pcie_path, sizeof(pcie_path), "=pcie/%d/%d", domain_nr,
  17340. -+ bus_nr);
  17341. -+ pcie_len = strlen(pcie_path);
  17342. - found = false;
  17343. - i = 0;
  17344. - while (i < nvp->nvram_len - BRCMF_FW_NVRAM_DEVPATH_LEN) {
  17345. -@@ -245,13 +252,10 @@ static void brcmf_fw_strip_multi_v1(stru
  17346. - * Y = domain_nr, Z = bus_nr, X = virtual ID
  17347. - */
  17348. - if ((strncmp(&nvp->nvram[i], "devpath", 7) == 0) &&
  17349. -- (strncmp(&nvp->nvram[i + 8], "=pcie/", 6) == 0)) {
  17350. -- if (((nvp->nvram[i + 14] - '0') == domain_nr) &&
  17351. -- ((nvp->nvram[i + 16] - '0') == bus_nr)) {
  17352. -- id = nvp->nvram[i + 7] - '0';
  17353. -- found = true;
  17354. -- break;
  17355. -- }
  17356. -+ (strncmp(&nvp->nvram[i + 8], pcie_path, pcie_len) == 0)) {
  17357. -+ id = nvp->nvram[i + 7] - '0';
  17358. -+ found = true;
  17359. -+ break;
  17360. - }
  17361. - while (nvp->nvram[i] != 0)
  17362. - i++;
  17363. 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
  17364. deleted file mode 100644
  17365. index dc174e5..0000000
  17366. --- a/package/kernel/mac80211/patches/349-brcmfmac-treat-0-as-end-of-comment-when-parsing-NVRA.patch
  17367. +++ /dev/null
  17368. @@ -1,45 +0,0 @@
  17369. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17370. -Date: Wed, 20 May 2015 13:59:54 +0200
  17371. -Subject: [PATCH] brcmfmac: treat \0 as end of comment when parsing NVRAM
  17372. -MIME-Version: 1.0
  17373. -Content-Type: text/plain; charset=UTF-8
  17374. -Content-Transfer-Encoding: 8bit
  17375. -
  17376. -This fixes brcmfmac dealing with NVRAM coming from platform e.g. from a
  17377. -flash MTD partition. In such cases entries are separated by \0 instead
  17378. -of \n which caused ignoring whole content after the first "comment".
  17379. -While platform NVRAM doesn't usually contain comments, we switch to
  17380. -COMMENT state after e.g. finding an unexpected char in key name.
  17381. -
  17382. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  17383. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17384. ----
  17385. -
  17386. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17387. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17388. -@@ -162,17 +162,20 @@ brcmf_nvram_handle_value(struct nvram_pa
  17389. - static enum nvram_parser_state
  17390. - brcmf_nvram_handle_comment(struct nvram_parser *nvp)
  17391. - {
  17392. -- char *eol, *sol;
  17393. -+ char *eoc, *sol;
  17394. -
  17395. - sol = (char *)&nvp->fwnv->data[nvp->pos];
  17396. -- eol = strchr(sol, '\n');
  17397. -- if (eol == NULL)
  17398. -- return END;
  17399. -+ eoc = strchr(sol, '\n');
  17400. -+ if (!eoc) {
  17401. -+ eoc = strchr(sol, '\0');
  17402. -+ if (!eoc)
  17403. -+ return END;
  17404. -+ }
  17405. -
  17406. - /* eat all moving to next line */
  17407. - nvp->line++;
  17408. - nvp->column = 1;
  17409. -- nvp->pos += (eol - sol) + 1;
  17410. -+ nvp->pos += (eoc - sol) + 1;
  17411. - return IDLE;
  17412. - }
  17413. -
  17414. 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
  17415. deleted file mode 100644
  17416. index 5700142..0000000
  17417. --- a/package/kernel/mac80211/patches/350-brcmfmac-allow-NVRAM-values-to-contain-spaces.patch
  17418. +++ /dev/null
  17419. @@ -1,50 +0,0 @@
  17420. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17421. -Date: Sat, 23 May 2015 09:15:33 +0200
  17422. -Subject: [PATCH] brcmfmac: allow NVRAM values to contain spaces
  17423. -MIME-Version: 1.0
  17424. -Content-Type: text/plain; charset=UTF-8
  17425. -Content-Transfer-Encoding: 8bit
  17426. -
  17427. -Platform NVRAMs often contain values with spaces. Even if right now most
  17428. -firmware-supported entries are simple values, we shouldn't reject these
  17429. -with spaces. It was semi-confirmed by Broadcom in the early patch adding
  17430. -support for platform NVRAMs.
  17431. -
  17432. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  17433. -Acked-by: Arend van Spriel <arend@broadcom.com>
  17434. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17435. ----
  17436. -
  17437. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17438. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17439. -@@ -66,6 +66,12 @@ struct nvram_parser {
  17440. - bool multi_dev_v2;
  17441. - };
  17442. -
  17443. -+/**
  17444. -+ * is_nvram_char() - check if char is a valid one for NVRAM entry
  17445. -+ *
  17446. -+ * It accepts all printable ASCII chars except for '#' which opens a comment.
  17447. -+ * Please note that ' ' (space) while accepted is not a valid key name char.
  17448. -+ */
  17449. - static bool is_nvram_char(char c)
  17450. - {
  17451. - /* comment marker excluded */
  17452. -@@ -73,7 +79,7 @@ static bool is_nvram_char(char c)
  17453. - return false;
  17454. -
  17455. - /* key and value may have any other readable character */
  17456. -- return (c > 0x20 && c < 0x7f);
  17457. -+ return (c >= 0x20 && c < 0x7f);
  17458. - }
  17459. -
  17460. - static bool is_whitespace(char c)
  17461. -@@ -120,7 +126,7 @@ static enum nvram_parser_state brcmf_nvr
  17462. - nvp->multi_dev_v1 = true;
  17463. - if (strncmp(&nvp->fwnv->data[nvp->entry], "pcie/", 5) == 0)
  17464. - nvp->multi_dev_v2 = true;
  17465. -- } else if (!is_nvram_char(c)) {
  17466. -+ } else if (!is_nvram_char(c) || c == ' ') {
  17467. - brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n",
  17468. - nvp->line, nvp->column);
  17469. - return COMMENT;
  17470. 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
  17471. deleted file mode 100644
  17472. index 814b0d7..0000000
  17473. --- a/package/kernel/mac80211/patches/351-ath9k-fix-DMA-stop-sequence-for-AR9003.patch
  17474. +++ /dev/null
  17475. @@ -1,33 +0,0 @@
  17476. -From: Felix Fietkau <nbd@openwrt.org>
  17477. -Date: Tue, 2 Jun 2015 10:35:46 +0200
  17478. -Subject: [PATCH] ath9k: fix DMA stop sequence for AR9003+
  17479. -
  17480. -AR93xx and newer needs to stop rx before tx to avoid getting the DMA
  17481. -engine or MAC into a stuck state.
  17482. -This should reduce/fix the occurence of "Failed to stop Tx DMA" logspam.
  17483. -
  17484. -Cc: stable@vger.kernel.org
  17485. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  17486. ----
  17487. -
  17488. ---- a/drivers/net/wireless/ath/ath9k/main.c
  17489. -+++ b/drivers/net/wireless/ath/ath9k/main.c
  17490. -@@ -216,11 +216,13 @@ static bool ath_prepare_reset(struct ath
  17491. - ath_stop_ani(sc);
  17492. - ath9k_hw_disable_interrupts(ah);
  17493. -
  17494. -- if (!ath_drain_all_txq(sc))
  17495. -- ret = false;
  17496. --
  17497. -- if (!ath_stoprecv(sc))
  17498. -- ret = false;
  17499. -+ if (AR_SREV_9300_20_OR_LATER(ah)) {
  17500. -+ ret &= ath_stoprecv(sc);
  17501. -+ ret &= ath_drain_all_txq(sc);
  17502. -+ } else {
  17503. -+ ret &= ath_drain_all_txq(sc);
  17504. -+ ret &= ath_stoprecv(sc);
  17505. -+ }
  17506. -
  17507. - return ret;
  17508. - }
  17509. 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
  17510. deleted file mode 100644
  17511. index 7bbd57e..0000000
  17512. --- a/package/kernel/mac80211/patches/352-brcmfmac-support-NVRAMs-containing-pci-devpaths-inst.patch
  17513. +++ /dev/null
  17514. @@ -1,56 +0,0 @@
  17515. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17516. -Date: Thu, 28 May 2015 14:19:21 +0200
  17517. -Subject: [PATCH] brcmfmac: support NVRAMs containing pci devpaths (instead of
  17518. - pcie)
  17519. -MIME-Version: 1.0
  17520. -Content-Type: text/plain; charset=UTF-8
  17521. -Content-Transfer-Encoding: 8bit
  17522. -
  17523. -Recently Broadcom added support for NVRAMs with entries for multiple
  17524. -PCIe devices. One of the supported formats is based on prefixes defined
  17525. -like: devpath0=pcie/1/4/ and entries like 0:foo=bar 0:baz=qux etc.
  17526. -
  17527. -Unfortunately there are also a bit older devices using different way of
  17528. -defining prefixes, e.g. SmartRG SR400ac (2 x BCM43602) with entries:
  17529. -devpath0=pci/1/1/
  17530. -devpath1=pci/2/1
  17531. -Broadcom stated this old format will never be used/supported by brcmfmac
  17532. -but given the simplicity of this patch I'll insist on supporting it.
  17533. -
  17534. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  17535. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17536. ----
  17537. -
  17538. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17539. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17540. -@@ -232,6 +232,8 @@ static void brcmf_fw_strip_multi_v1(stru
  17541. - u16 bus_nr)
  17542. - {
  17543. - /* Device path with a leading '=' key-value separator */
  17544. -+ char pci_path[] = "=pci/?/?";
  17545. -+ size_t pci_len;
  17546. - char pcie_path[] = "=pcie/?/?";
  17547. - size_t pcie_len;
  17548. -
  17549. -@@ -251,6 +253,9 @@ static void brcmf_fw_strip_multi_v1(stru
  17550. - /* First search for the devpathX and see if it is the configuration
  17551. - * for domain_nr/bus_nr. Search complete nvp
  17552. - */
  17553. -+ snprintf(pci_path, sizeof(pci_path), "=pci/%d/%d", domain_nr,
  17554. -+ bus_nr);
  17555. -+ pci_len = strlen(pci_path);
  17556. - snprintf(pcie_path, sizeof(pcie_path), "=pcie/%d/%d", domain_nr,
  17557. - bus_nr);
  17558. - pcie_len = strlen(pcie_path);
  17559. -@@ -260,8 +265,9 @@ static void brcmf_fw_strip_multi_v1(stru
  17560. - /* Format: devpathX=pcie/Y/Z/
  17561. - * Y = domain_nr, Z = bus_nr, X = virtual ID
  17562. - */
  17563. -- if ((strncmp(&nvp->nvram[i], "devpath", 7) == 0) &&
  17564. -- (strncmp(&nvp->nvram[i + 8], pcie_path, pcie_len) == 0)) {
  17565. -+ if (strncmp(&nvp->nvram[i], "devpath", 7) == 0 &&
  17566. -+ (!strncmp(&nvp->nvram[i + 8], pci_path, pci_len) ||
  17567. -+ !strncmp(&nvp->nvram[i + 8], pcie_path, pcie_len))) {
  17568. - id = nvp->nvram[i + 7] - '0';
  17569. - found = true;
  17570. - break;
  17571. 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
  17572. deleted file mode 100644
  17573. index 1eff6ed..0000000
  17574. --- a/package/kernel/mac80211/patches/353-brcmfmac-set-wiphy-perm_addr-to-hardware-MAC-address.patch
  17575. +++ /dev/null
  17576. @@ -1,23 +0,0 @@
  17577. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17578. -Date: Sun, 31 May 2015 02:52:26 +0200
  17579. -Subject: [PATCH] brcmfmac: set wiphy perm_addr to hardware MAC address
  17580. -MIME-Version: 1.0
  17581. -Content-Type: text/plain; charset=UTF-8
  17582. -Content-Transfer-Encoding: 8bit
  17583. -
  17584. -This allows e.g. user space to use /sys/class/ieee80211/*/macaddress
  17585. -
  17586. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  17587. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17588. ----
  17589. -
  17590. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  17591. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  17592. -@@ -6070,6 +6070,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  17593. - brcmf_err("Could not allocate wiphy device\n");
  17594. - return NULL;
  17595. - }
  17596. -+ memcpy(wiphy->perm_addr, drvr->mac, ETH_ALEN);
  17597. - set_wiphy_dev(wiphy, busdev);
  17598. -
  17599. - cfg = wiphy_priv(wiphy);
  17600. 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
  17601. deleted file mode 100644
  17602. index c6e83dd..0000000
  17603. --- a/package/kernel/mac80211/patches/354-brcmfmac-use-direct-data-pointer-in-NVRAM-parser-str.patch
  17604. +++ /dev/null
  17605. @@ -1,144 +0,0 @@
  17606. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17607. -Date: Thu, 4 Jun 2015 22:11:07 +0200
  17608. -Subject: [PATCH] brcmfmac: use direct data pointer in NVRAM parser struct
  17609. -MIME-Version: 1.0
  17610. -Content-Type: text/plain; charset=UTF-8
  17611. -Content-Transfer-Encoding: 8bit
  17612. -
  17613. -As we plan to add support for platform NVRAM we should store direct
  17614. -data pointer without the extra struct firmware layer. This will allow
  17615. -us to support other sources with the only requirement being u8 buffer.
  17616. -
  17617. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  17618. -Acked-by: Arend van Spriel <arend@broadcom.com>
  17619. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17620. ----
  17621. -
  17622. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17623. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  17624. -@@ -43,7 +43,7 @@ enum nvram_parser_state {
  17625. - * struct nvram_parser - internal info for parser.
  17626. - *
  17627. - * @state: current parser state.
  17628. -- * @fwnv: input buffer being parsed.
  17629. -+ * @data: input buffer being parsed.
  17630. - * @nvram: output buffer with parse result.
  17631. - * @nvram_len: lenght of parse result.
  17632. - * @line: current line.
  17633. -@@ -55,7 +55,7 @@ enum nvram_parser_state {
  17634. - */
  17635. - struct nvram_parser {
  17636. - enum nvram_parser_state state;
  17637. -- const struct firmware *fwnv;
  17638. -+ const u8 *data;
  17639. - u8 *nvram;
  17640. - u32 nvram_len;
  17641. - u32 line;
  17642. -@@ -91,7 +91,7 @@ static enum nvram_parser_state brcmf_nvr
  17643. - {
  17644. - char c;
  17645. -
  17646. -- c = nvp->fwnv->data[nvp->pos];
  17647. -+ c = nvp->data[nvp->pos];
  17648. - if (c == '\n')
  17649. - return COMMENT;
  17650. - if (is_whitespace(c))
  17651. -@@ -115,16 +115,16 @@ static enum nvram_parser_state brcmf_nvr
  17652. - enum nvram_parser_state st = nvp->state;
  17653. - char c;
  17654. -
  17655. -- c = nvp->fwnv->data[nvp->pos];
  17656. -+ c = nvp->data[nvp->pos];
  17657. - if (c == '=') {
  17658. - /* ignore RAW1 by treating as comment */
  17659. -- if (strncmp(&nvp->fwnv->data[nvp->entry], "RAW1", 4) == 0)
  17660. -+ if (strncmp(&nvp->data[nvp->entry], "RAW1", 4) == 0)
  17661. - st = COMMENT;
  17662. - else
  17663. - st = VALUE;
  17664. -- if (strncmp(&nvp->fwnv->data[nvp->entry], "devpath", 7) == 0)
  17665. -+ if (strncmp(&nvp->data[nvp->entry], "devpath", 7) == 0)
  17666. - nvp->multi_dev_v1 = true;
  17667. -- if (strncmp(&nvp->fwnv->data[nvp->entry], "pcie/", 5) == 0)
  17668. -+ if (strncmp(&nvp->data[nvp->entry], "pcie/", 5) == 0)
  17669. - nvp->multi_dev_v2 = true;
  17670. - } else if (!is_nvram_char(c) || c == ' ') {
  17671. - brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n",
  17672. -@@ -145,11 +145,11 @@ brcmf_nvram_handle_value(struct nvram_pa
  17673. - char *ekv;
  17674. - u32 cplen;
  17675. -
  17676. -- c = nvp->fwnv->data[nvp->pos];
  17677. -+ c = nvp->data[nvp->pos];
  17678. - if (!is_nvram_char(c)) {
  17679. - /* key,value pair complete */
  17680. -- ekv = (u8 *)&nvp->fwnv->data[nvp->pos];
  17681. -- skv = (u8 *)&nvp->fwnv->data[nvp->entry];
  17682. -+ ekv = (u8 *)&nvp->data[nvp->pos];
  17683. -+ skv = (u8 *)&nvp->data[nvp->entry];
  17684. - cplen = ekv - skv;
  17685. - if (nvp->nvram_len + cplen + 1 >= BRCMF_FW_MAX_NVRAM_SIZE)
  17686. - return END;
  17687. -@@ -170,7 +170,7 @@ brcmf_nvram_handle_comment(struct nvram_
  17688. - {
  17689. - char *eoc, *sol;
  17690. -
  17691. -- sol = (char *)&nvp->fwnv->data[nvp->pos];
  17692. -+ sol = (char *)&nvp->data[nvp->pos];
  17693. - eoc = strchr(sol, '\n');
  17694. - if (!eoc) {
  17695. - eoc = strchr(sol, '\0');
  17696. -@@ -201,17 +201,17 @@ static enum nvram_parser_state
  17697. - };
  17698. -
  17699. - static int brcmf_init_nvram_parser(struct nvram_parser *nvp,
  17700. -- const struct firmware *nv)
  17701. -+ const u8 *data, size_t data_len)
  17702. - {
  17703. - size_t size;
  17704. -
  17705. - memset(nvp, 0, sizeof(*nvp));
  17706. -- nvp->fwnv = nv;
  17707. -+ nvp->data = data;
  17708. - /* Limit size to MAX_NVRAM_SIZE, some files contain lot of comment */
  17709. -- if (nv->size > BRCMF_FW_MAX_NVRAM_SIZE)
  17710. -+ if (data_len > BRCMF_FW_MAX_NVRAM_SIZE)
  17711. - size = BRCMF_FW_MAX_NVRAM_SIZE;
  17712. - else
  17713. -- size = nv->size;
  17714. -+ size = data_len;
  17715. - /* Alloc for extra 0 byte + roundup by 4 + length field */
  17716. - size += 1 + 3 + sizeof(u32);
  17717. - nvp->nvram = kzalloc(size, GFP_KERNEL);
  17718. -@@ -362,18 +362,18 @@ fail:
  17719. - * and converts newlines to NULs. Shortens buffer as needed and pads with NULs.
  17720. - * End of buffer is completed with token identifying length of buffer.
  17721. - */
  17722. --static void *brcmf_fw_nvram_strip(const struct firmware *nv, u32 *new_length,
  17723. -- u16 domain_nr, u16 bus_nr)
  17724. -+static void *brcmf_fw_nvram_strip(const u8 *data, size_t data_len,
  17725. -+ u32 *new_length, u16 domain_nr, u16 bus_nr)
  17726. - {
  17727. - struct nvram_parser nvp;
  17728. - u32 pad;
  17729. - u32 token;
  17730. - __le32 token_le;
  17731. -
  17732. -- if (brcmf_init_nvram_parser(&nvp, nv) < 0)
  17733. -+ if (brcmf_init_nvram_parser(&nvp, data, data_len) < 0)
  17734. - return NULL;
  17735. -
  17736. -- while (nvp.pos < nv->size) {
  17737. -+ while (nvp.pos < data_len) {
  17738. - nvp.state = nv_parser_states[nvp.state](&nvp);
  17739. - if (nvp.state == END)
  17740. - break;
  17741. -@@ -432,7 +432,7 @@ static void brcmf_fw_request_nvram_done(
  17742. - goto fail;
  17743. -
  17744. - if (fw) {
  17745. -- nvram = brcmf_fw_nvram_strip(fw, &nvram_length,
  17746. -+ nvram = brcmf_fw_nvram_strip(fw->data, fw->size, &nvram_length,
  17747. - fwctx->domain_nr, fwctx->bus_nr);
  17748. - release_firmware(fw);
  17749. - if (!nvram && !(fwctx->flags & BRCMF_FW_REQ_NV_OPTIONAL))
  17750. 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
  17751. deleted file mode 100644
  17752. index 4ecef3b..0000000
  17753. --- a/package/kernel/mac80211/patches/355-b43-fix-support-for-14e4-4321-PCI-dev-with-BCM4321-c.patch
  17754. +++ /dev/null
  17755. @@ -1,32 +0,0 @@
  17756. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  17757. -Date: Sat, 6 Jun 2015 22:45:59 +0200
  17758. -Subject: [PATCH] b43: fix support for 14e4:4321 PCI dev with BCM4321 chipset
  17759. -MIME-Version: 1.0
  17760. -Content-Type: text/plain; charset=UTF-8
  17761. -Content-Transfer-Encoding: 8bit
  17762. -
  17763. -It seems Broadcom released two devices with conflicting device id. There
  17764. -are for sure 14e4:4321 PCI devices with BCM4321 (N-PHY) chipset, they
  17765. -can be found in routers, e.g. Netgear WNR834Bv2. However, according to
  17766. -Broadcom public sources 0x4321 is also used for 5 GHz BCM4306 (G-PHY).
  17767. -It's unsure if they meant PCI device id, or "virtual" id (from SPROM).
  17768. -To distinguish these devices lets check PHY type (G vs. N).
  17769. -
  17770. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  17771. -Cc: <stable@vger.kernel.org> # 3.16+
  17772. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17773. ----
  17774. -
  17775. ---- a/drivers/net/wireless/b43/main.c
  17776. -+++ b/drivers/net/wireless/b43/main.c
  17777. -@@ -5365,6 +5365,10 @@ static void b43_supported_bands(struct b
  17778. - *have_5ghz_phy = true;
  17779. - return;
  17780. - case 0x4321: /* BCM4306 */
  17781. -+ /* There are 14e4:4321 PCI devs with 2.4 GHz BCM4321 (N-PHY) */
  17782. -+ if (dev->phy.type != B43_PHYTYPE_G)
  17783. -+ break;
  17784. -+ /* fall through */
  17785. - case 0x4313: /* BCM4311 */
  17786. - case 0x431a: /* BCM4318 */
  17787. - case 0x432a: /* BCM4321 */
  17788. 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
  17789. deleted file mode 100644
  17790. index bddb15a..0000000
  17791. --- a/package/kernel/mac80211/patches/356-ath9k-force-rx_clear-when-disabling-rx.patch
  17792. +++ /dev/null
  17793. @@ -1,31 +0,0 @@
  17794. -From: Felix Fietkau <nbd@openwrt.org>
  17795. -Date: Sun, 7 Jun 2015 13:53:35 +0200
  17796. -Subject: [PATCH] ath9k: force rx_clear when disabling rx
  17797. -
  17798. -This makes stopping Rx more reliable and should reduce the frequency of
  17799. -Rx related DMA stop warnings
  17800. -
  17801. -Cc: stable@vger.kernel.org
  17802. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  17803. ----
  17804. -
  17805. ---- a/drivers/net/wireless/ath/ath9k/mac.c
  17806. -+++ b/drivers/net/wireless/ath/ath9k/mac.c
  17807. -@@ -677,13 +677,15 @@ void ath9k_hw_startpcureceive(struct ath
  17808. -
  17809. - ath9k_ani_reset(ah, is_scanning);
  17810. -
  17811. -- REG_CLR_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT));
  17812. -+ REG_CLR_BIT(ah, AR_DIAG_SW,
  17813. -+ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  17814. - }
  17815. - EXPORT_SYMBOL(ath9k_hw_startpcureceive);
  17816. -
  17817. - void ath9k_hw_abortpcurecv(struct ath_hw *ah)
  17818. - {
  17819. -- REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_ABORT | AR_DIAG_RX_DIS);
  17820. -+ REG_SET_BIT(ah, AR_DIAG_SW,
  17821. -+ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  17822. -
  17823. - ath9k_hw_disable_mib_counters(ah);
  17824. - }
  17825. 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
  17826. deleted file mode 100644
  17827. index 74df9f9..0000000
  17828. --- a/package/kernel/mac80211/patches/357-0001-brcmfmac-Update-msgbuf-read-pointer-quicker.patch
  17829. +++ /dev/null
  17830. @@ -1,109 +0,0 @@
  17831. -From: Hante Meuleman <meuleman@broadcom.com>
  17832. -Date: Mon, 8 Jun 2015 14:38:32 +0200
  17833. -Subject: [PATCH] brcmfmac: Update msgbuf read pointer quicker.
  17834. -
  17835. -On device to host data using msgbuf the read pointer gets updated
  17836. -once all data is processed. Updating this pointer more frequently
  17837. -allows the firmware to add more data quicker. This will result in
  17838. -slightly higher and more stable throughput on CPU bounded host
  17839. -processors.
  17840. -
  17841. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  17842. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  17843. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17844. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  17845. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17846. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17847. ----
  17848. -
  17849. ---- a/drivers/net/wireless/brcm80211/brcmfmac/commonring.c
  17850. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/commonring.c
  17851. -@@ -223,8 +223,6 @@ void brcmf_commonring_write_cancel(struc
  17852. - void *brcmf_commonring_get_read_ptr(struct brcmf_commonring *commonring,
  17853. - u16 *n_items)
  17854. - {
  17855. -- void *ret_addr;
  17856. --
  17857. - if (commonring->cr_update_wptr)
  17858. - commonring->cr_update_wptr(commonring->cr_ctx);
  17859. -
  17860. -@@ -235,19 +233,18 @@ void *brcmf_commonring_get_read_ptr(stru
  17861. - if (*n_items == 0)
  17862. - return NULL;
  17863. -
  17864. -- ret_addr = commonring->buf_addr +
  17865. -- (commonring->r_ptr * commonring->item_len);
  17866. --
  17867. -- commonring->r_ptr += *n_items;
  17868. -- if (commonring->r_ptr == commonring->depth)
  17869. -- commonring->r_ptr = 0;
  17870. --
  17871. -- return ret_addr;
  17872. -+ return commonring->buf_addr +
  17873. -+ (commonring->r_ptr * commonring->item_len);
  17874. - }
  17875. -
  17876. -
  17877. --int brcmf_commonring_read_complete(struct brcmf_commonring *commonring)
  17878. -+int brcmf_commonring_read_complete(struct brcmf_commonring *commonring,
  17879. -+ u16 n_items)
  17880. - {
  17881. -+ commonring->r_ptr += n_items;
  17882. -+ if (commonring->r_ptr == commonring->depth)
  17883. -+ commonring->r_ptr = 0;
  17884. -+
  17885. - if (commonring->cr_write_rptr)
  17886. - return commonring->cr_write_rptr(commonring->cr_ctx);
  17887. -
  17888. ---- a/drivers/net/wireless/brcm80211/brcmfmac/commonring.h
  17889. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/commonring.h
  17890. -@@ -62,7 +62,8 @@ void brcmf_commonring_write_cancel(struc
  17891. - u16 n_items);
  17892. - void *brcmf_commonring_get_read_ptr(struct brcmf_commonring *commonring,
  17893. - u16 *n_items);
  17894. --int brcmf_commonring_read_complete(struct brcmf_commonring *commonring);
  17895. -+int brcmf_commonring_read_complete(struct brcmf_commonring *commonring,
  17896. -+ u16 n_items);
  17897. -
  17898. - #define brcmf_commonring_n_items(commonring) (commonring->depth)
  17899. - #define brcmf_commonring_len_item(commonring) (commonring->item_len)
  17900. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  17901. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  17902. -@@ -75,6 +75,8 @@
  17903. -
  17904. - #define BRCMF_MSGBUF_DELAY_TXWORKER_THRS 96
  17905. - #define BRCMF_MSGBUF_TRICKLE_TXWORKER_THRS 32
  17906. -+#define BRCMF_MSGBUF_UPDATE_RX_PTR_THRS 48
  17907. -+
  17908. -
  17909. - struct msgbuf_common_hdr {
  17910. - u8 msgtype;
  17911. -@@ -1257,19 +1259,27 @@ static void brcmf_msgbuf_process_rx(stru
  17912. - {
  17913. - void *buf;
  17914. - u16 count;
  17915. -+ u16 processed;
  17916. -
  17917. - again:
  17918. - buf = brcmf_commonring_get_read_ptr(commonring, &count);
  17919. - if (buf == NULL)
  17920. - return;
  17921. -
  17922. -+ processed = 0;
  17923. - while (count) {
  17924. - brcmf_msgbuf_process_msgtype(msgbuf,
  17925. - buf + msgbuf->rx_dataoffset);
  17926. - buf += brcmf_commonring_len_item(commonring);
  17927. -+ processed++;
  17928. -+ if (processed == BRCMF_MSGBUF_UPDATE_RX_PTR_THRS) {
  17929. -+ brcmf_commonring_read_complete(commonring, processed);
  17930. -+ processed = 0;
  17931. -+ }
  17932. - count--;
  17933. - }
  17934. -- brcmf_commonring_read_complete(commonring);
  17935. -+ if (processed)
  17936. -+ brcmf_commonring_read_complete(commonring, processed);
  17937. -
  17938. - if (commonring->r_ptr == 0)
  17939. - goto again;
  17940. 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
  17941. deleted file mode 100644
  17942. index 9e5b486..0000000
  17943. --- a/package/kernel/mac80211/patches/357-0002-brcmfmac-remove-chipinfo-debugfs-entry.patch
  17944. +++ /dev/null
  17945. @@ -1,39 +0,0 @@
  17946. -From: Arend van Spriel <arend@broadcom.com>
  17947. -Date: Mon, 8 Jun 2015 14:38:33 +0200
  17948. -Subject: [PATCH] brcmfmac: remove chipinfo debugfs entry
  17949. -
  17950. -The information provided by chipinfo is also provided by the
  17951. -revinfo debugfs entry. Removing it from debugfs.
  17952. -
  17953. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  17954. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  17955. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  17956. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  17957. ----
  17958. -
  17959. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  17960. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  17961. -@@ -41,15 +41,6 @@ void brcmf_debugfs_exit(void)
  17962. - root_folder = NULL;
  17963. - }
  17964. -
  17965. --static int brcmf_debugfs_chipinfo_read(struct seq_file *seq, void *data)
  17966. --{
  17967. -- struct brcmf_bus *bus = dev_get_drvdata(seq->private);
  17968. --
  17969. -- seq_printf(seq, "chip: %x(%u) rev %u\n",
  17970. -- bus->chip, bus->chip, bus->chiprev);
  17971. -- return 0;
  17972. --}
  17973. --
  17974. - int brcmf_debugfs_attach(struct brcmf_pub *drvr)
  17975. - {
  17976. - struct device *dev = drvr->bus_if->dev;
  17977. -@@ -58,7 +49,6 @@ int brcmf_debugfs_attach(struct brcmf_pu
  17978. - return -ENODEV;
  17979. -
  17980. - drvr->dbgfs_dir = debugfs_create_dir(dev_name(dev), root_folder);
  17981. -- brcmf_debugfs_add_entry(drvr, "chipinfo", brcmf_debugfs_chipinfo_read);
  17982. -
  17983. - return PTR_ERR_OR_ZERO(drvr->dbgfs_dir);
  17984. - }
  17985. 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
  17986. deleted file mode 100644
  17987. index c38b2cd..0000000
  17988. --- a/package/kernel/mac80211/patches/357-0003-brcmfmac-remove-watchdog-reset-from-brcmf_pcie_busco.patch
  17989. +++ /dev/null
  17990. @@ -1,53 +0,0 @@
  17991. -From: Arend van Spriel <arend@broadcom.com>
  17992. -Date: Mon, 8 Jun 2015 14:38:34 +0200
  17993. -Subject: [PATCH] brcmfmac: remove watchdog reset from
  17994. - brcmf_pcie_buscoreprep()
  17995. -
  17996. -The watchdog reset as done in brcmf_pcie_buscoreprep() is not
  17997. -sufficient. It needs to modify PCIe core registers as well
  17998. -which is properly done by brcmf_pcie_reset_device() after the
  17999. -chip recognition is done. So the faulty watchdog reset can be
  18000. -removed as it was causing driver reload to fail and hang the
  18001. -system requiring a power-cycle. Instead the call to to the
  18002. -brcmf_pcie_reset_device() function is done twice in the unload.
  18003. -
  18004. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  18005. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  18006. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  18007. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  18008. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  18009. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18010. ----
  18011. -
  18012. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  18013. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  18014. -@@ -1629,20 +1629,7 @@ static void brcmf_pcie_buscore_write32(v
  18015. -
  18016. - static int brcmf_pcie_buscoreprep(void *ctx)
  18017. - {
  18018. -- struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)ctx;
  18019. -- int err;
  18020. --
  18021. -- err = brcmf_pcie_get_resource(devinfo);
  18022. -- if (err == 0) {
  18023. -- /* Set CC watchdog to reset all the cores on the chip to bring
  18024. -- * back dongle to a sane state.
  18025. -- */
  18026. -- brcmf_pcie_buscore_write32(ctx, CORE_CC_REG(SI_ENUM_BASE,
  18027. -- watchdog), 4);
  18028. -- msleep(100);
  18029. -- }
  18030. --
  18031. -- return err;
  18032. -+ return brcmf_pcie_get_resource(ctx);
  18033. - }
  18034. -
  18035. -
  18036. -@@ -1824,6 +1811,7 @@ brcmf_pcie_remove(struct pci_dev *pdev)
  18037. - brcmf_pcie_intr_disable(devinfo);
  18038. -
  18039. - brcmf_detach(&pdev->dev);
  18040. -+ brcmf_pcie_reset_device(devinfo);
  18041. -
  18042. - kfree(bus->bus_priv.pcie);
  18043. - kfree(bus->msgbuf->flowrings);
  18044. 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
  18045. deleted file mode 100644
  18046. index 756fbb2..0000000
  18047. --- a/package/kernel/mac80211/patches/357-0004-brcmfmac-use-debugfs_create_devm_seqfile-helper-func.patch
  18048. +++ /dev/null
  18049. @@ -1,69 +0,0 @@
  18050. -From: Arend van Spriel <arend@broadcom.com>
  18051. -Date: Mon, 8 Jun 2015 14:38:35 +0200
  18052. -Subject: [PATCH] brcmfmac: use debugfs_create_devm_seqfile() helper
  18053. - function
  18054. -
  18055. -Some time ago the function debugfs_create_devm_seqfile() was
  18056. -introduced in debugfs. The caller simply needs to provide a
  18057. -device pointer and read function. The function brcmf_debugfs_add_entry()
  18058. -is now simply a wrapper only doing the work for CONFIG_BRCMDBG.
  18059. -
  18060. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  18061. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  18062. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  18063. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  18064. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  18065. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18066. ----
  18067. -
  18068. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  18069. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  18070. -@@ -64,44 +64,12 @@ struct dentry *brcmf_debugfs_get_devdir(
  18071. - return drvr->dbgfs_dir;
  18072. - }
  18073. -
  18074. --struct brcmf_debugfs_entry {
  18075. -- int (*read)(struct seq_file *seq, void *data);
  18076. -- struct brcmf_pub *drvr;
  18077. --};
  18078. --
  18079. --static int brcmf_debugfs_entry_open(struct inode *inode, struct file *f)
  18080. --{
  18081. -- struct brcmf_debugfs_entry *entry = inode->i_private;
  18082. --
  18083. -- return single_open(f, entry->read, entry->drvr->bus_if->dev);
  18084. --}
  18085. --
  18086. --static const struct file_operations brcmf_debugfs_def_ops = {
  18087. -- .owner = THIS_MODULE,
  18088. -- .open = brcmf_debugfs_entry_open,
  18089. -- .release = single_release,
  18090. -- .read = seq_read,
  18091. -- .llseek = seq_lseek
  18092. --};
  18093. --
  18094. - int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn,
  18095. - int (*read_fn)(struct seq_file *seq, void *data))
  18096. - {
  18097. -- struct dentry *dentry = drvr->dbgfs_dir;
  18098. -- struct brcmf_debugfs_entry *entry;
  18099. --
  18100. -- if (IS_ERR_OR_NULL(dentry))
  18101. -- return -ENOENT;
  18102. --
  18103. -- entry = devm_kzalloc(drvr->bus_if->dev, sizeof(*entry), GFP_KERNEL);
  18104. -- if (!entry)
  18105. -- return -ENOMEM;
  18106. --
  18107. -- entry->read = read_fn;
  18108. -- entry->drvr = drvr;
  18109. --
  18110. -- dentry = debugfs_create_file(fn, S_IRUGO, dentry, entry,
  18111. -- &brcmf_debugfs_def_ops);
  18112. -+ struct dentry *e;
  18113. -
  18114. -- return PTR_ERR_OR_ZERO(dentry);
  18115. -+ e = debugfs_create_devm_seqfile(drvr->bus_if->dev, fn,
  18116. -+ drvr->dbgfs_dir, read_fn);
  18117. -+ return PTR_ERR_OR_ZERO(e);
  18118. - }
  18119. 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
  18120. deleted file mode 100644
  18121. index 2674efb..0000000
  18122. --- a/package/kernel/mac80211/patches/358-ath9k_hw-fix-device-ID-check-for-AR956x.patch
  18123. +++ /dev/null
  18124. @@ -1,20 +0,0 @@
  18125. -From: Felix Fietkau <nbd@openwrt.org>
  18126. -Date: Sun, 21 Jun 2015 19:45:59 +0200
  18127. -Subject: [PATCH] ath9k_hw: fix device ID check for AR956x
  18128. -
  18129. -Because of the missing return, the macVersion value was being
  18130. -overwritten with an invalid register read
  18131. -
  18132. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  18133. ----
  18134. -
  18135. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  18136. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  18137. -@@ -278,6 +278,7 @@ static void ath9k_hw_read_revisions(stru
  18138. - return;
  18139. - case AR9300_DEVID_QCA956X:
  18140. - ah->hw_version.macVersion = AR_SREV_VERSION_9561;
  18141. -+ return;
  18142. - }
  18143. -
  18144. - val = REG_READ(ah, AR_SREV) & AR_SREV_ID;
  18145. 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
  18146. deleted file mode 100644
  18147. index ff24a4a..0000000
  18148. --- a/package/kernel/mac80211/patches/359-0001-brcmfmac-Check-if-firmware-supports-p2p.patch
  18149. +++ /dev/null
  18150. @@ -1,42 +0,0 @@
  18151. -From: Pontus Fuchs <pontusf@broadcom.com>
  18152. -Date: Thu, 11 Jun 2015 00:12:17 +0200
  18153. -Subject: [PATCH] brcmfmac: Check if firmware supports p2p
  18154. -
  18155. -Add a feature flag to reflect the firmware's p2p capability.
  18156. -
  18157. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  18158. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  18159. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  18160. -Signed-off-by: Pontus Fuchs <pontusf@broadcom.com>
  18161. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  18162. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18163. ----
  18164. -
  18165. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  18166. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  18167. -@@ -129,6 +129,7 @@ void brcmf_feat_attach(struct brcmf_pub
  18168. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_WOWL, "wowl");
  18169. - if (drvr->bus_if->chip != BRCM_CC_43362_CHIP_ID)
  18170. - brcmf_feat_iovar_int_set(ifp, BRCMF_FEAT_MBSS, "mbss", 0);
  18171. -+ brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_P2P, "p2p");
  18172. -
  18173. - /* set chip related quirks */
  18174. - switch (drvr->bus_if->chip) {
  18175. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  18176. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  18177. -@@ -23,12 +23,14 @@
  18178. - * MCHAN: multi-channel for concurrent P2P.
  18179. - * PNO: preferred network offload.
  18180. - * WOWL: Wake-On-WLAN.
  18181. -+ * P2P: peer-to-peer
  18182. - */
  18183. - #define BRCMF_FEAT_LIST \
  18184. - BRCMF_FEAT_DEF(MBSS) \
  18185. - BRCMF_FEAT_DEF(MCHAN) \
  18186. - BRCMF_FEAT_DEF(PNO) \
  18187. -- BRCMF_FEAT_DEF(WOWL)
  18188. -+ BRCMF_FEAT_DEF(WOWL) \
  18189. -+ BRCMF_FEAT_DEF(P2P)
  18190. - /*
  18191. - * Quirks:
  18192. - *
  18193. 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
  18194. deleted file mode 100644
  18195. index 3876ba0..0000000
  18196. --- a/package/kernel/mac80211/patches/359-0002-brcmfmac-Build-wiphy-mode-and-interface-combinations.patch
  18197. +++ /dev/null
  18198. @@ -1,198 +0,0 @@
  18199. -From: Pontus Fuchs <pontusf@broadcom.com>
  18200. -Date: Thu, 11 Jun 2015 00:12:18 +0200
  18201. -Subject: [PATCH] brcmfmac: Build wiphy mode and interface combinations
  18202. - dynamically
  18203. -
  18204. -Switch from using semi hard coded interface combinations. This makes
  18205. -it easier to announce what the firmware actually supports. This fixes
  18206. -the case where brcmfmac announces p2p but the firmware doesn't
  18207. -support it.
  18208. -
  18209. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  18210. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  18211. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  18212. -Signed-off-by: Pontus Fuchs <pontusf@broadcom.com>
  18213. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  18214. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18215. ----
  18216. -
  18217. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  18218. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  18219. -@@ -52,8 +52,6 @@
  18220. - #define BRCMF_PNO_SCAN_COMPLETE 1
  18221. - #define BRCMF_PNO_SCAN_INCOMPLETE 0
  18222. -
  18223. --#define BRCMF_IFACE_MAX_CNT 3
  18224. --
  18225. - #define WPA_OUI "\x00\x50\xF2" /* WPA OUI */
  18226. - #define WPA_OUI_TYPE 1
  18227. - #define RSN_OUI "\x00\x0F\xAC" /* RSN OUI */
  18228. -@@ -5639,53 +5637,6 @@ static int brcmf_setup_wiphybands(struct
  18229. - return 0;
  18230. - }
  18231. -
  18232. --static const struct ieee80211_iface_limit brcmf_iface_limits_mbss[] = {
  18233. -- {
  18234. -- .max = 1,
  18235. -- .types = BIT(NL80211_IFTYPE_STATION) |
  18236. -- BIT(NL80211_IFTYPE_ADHOC)
  18237. -- },
  18238. -- {
  18239. -- .max = 4,
  18240. -- .types = BIT(NL80211_IFTYPE_AP)
  18241. -- },
  18242. -- {
  18243. -- .max = 1,
  18244. -- .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  18245. -- BIT(NL80211_IFTYPE_P2P_GO)
  18246. -- },
  18247. -- {
  18248. -- .max = 1,
  18249. -- .types = BIT(NL80211_IFTYPE_P2P_DEVICE)
  18250. -- }
  18251. --};
  18252. --
  18253. --static const struct ieee80211_iface_limit brcmf_iface_limits_sbss[] = {
  18254. -- {
  18255. -- .max = 2,
  18256. -- .types = BIT(NL80211_IFTYPE_STATION) |
  18257. -- BIT(NL80211_IFTYPE_ADHOC) |
  18258. -- BIT(NL80211_IFTYPE_AP)
  18259. -- },
  18260. -- {
  18261. -- .max = 1,
  18262. -- .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  18263. -- BIT(NL80211_IFTYPE_P2P_GO)
  18264. -- },
  18265. -- {
  18266. -- .max = 1,
  18267. -- .types = BIT(NL80211_IFTYPE_P2P_DEVICE)
  18268. -- }
  18269. --};
  18270. --static struct ieee80211_iface_combination brcmf_iface_combos[] = {
  18271. -- {
  18272. -- .max_interfaces = BRCMF_IFACE_MAX_CNT,
  18273. -- .num_different_channels = 1,
  18274. -- .n_limits = ARRAY_SIZE(brcmf_iface_limits_sbss),
  18275. -- .limits = brcmf_iface_limits_sbss,
  18276. -- }
  18277. --};
  18278. --
  18279. - static const struct ieee80211_txrx_stypes
  18280. - brcmf_txrx_stypes[NUM_NL80211_IFTYPES] = {
  18281. - [NL80211_IFTYPE_STATION] = {
  18282. -@@ -5715,6 +5666,67 @@ brcmf_txrx_stypes[NUM_NL80211_IFTYPES] =
  18283. - }
  18284. - };
  18285. -
  18286. -+static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp)
  18287. -+{
  18288. -+ struct ieee80211_iface_combination *combo = NULL;
  18289. -+ struct ieee80211_iface_limit *limits = NULL;
  18290. -+ int i = 0, max_iface_cnt;
  18291. -+
  18292. -+ combo = kzalloc(sizeof(*combo), GFP_KERNEL);
  18293. -+ if (!combo)
  18294. -+ goto err;
  18295. -+
  18296. -+ limits = kzalloc(sizeof(*limits) * 4, GFP_KERNEL);
  18297. -+ if (!limits)
  18298. -+ goto err;
  18299. -+
  18300. -+ wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  18301. -+ BIT(NL80211_IFTYPE_ADHOC) |
  18302. -+ BIT(NL80211_IFTYPE_AP);
  18303. -+
  18304. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  18305. -+ combo->num_different_channels = 2;
  18306. -+ else
  18307. -+ combo->num_different_channels = 1;
  18308. -+
  18309. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) {
  18310. -+ limits[i].max = 1;
  18311. -+ limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  18312. -+ limits[i].max = 4;
  18313. -+ limits[i++].types = BIT(NL80211_IFTYPE_AP);
  18314. -+ max_iface_cnt = 5;
  18315. -+ } else {
  18316. -+ limits[i].max = 2;
  18317. -+ limits[i++].types = BIT(NL80211_IFTYPE_STATION) |
  18318. -+ BIT(NL80211_IFTYPE_AP);
  18319. -+ max_iface_cnt = 2;
  18320. -+ }
  18321. -+
  18322. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P)) {
  18323. -+ wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) |
  18324. -+ BIT(NL80211_IFTYPE_P2P_GO) |
  18325. -+ BIT(NL80211_IFTYPE_P2P_DEVICE);
  18326. -+ limits[i].max = 1;
  18327. -+ limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  18328. -+ BIT(NL80211_IFTYPE_P2P_GO);
  18329. -+ limits[i].max = 1;
  18330. -+ limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  18331. -+ max_iface_cnt += 2;
  18332. -+ }
  18333. -+ combo->max_interfaces = max_iface_cnt;
  18334. -+ combo->limits = limits;
  18335. -+ combo->n_limits = i;
  18336. -+
  18337. -+ wiphy->iface_combinations = combo;
  18338. -+ wiphy->n_iface_combinations = 1;
  18339. -+ return 0;
  18340. -+
  18341. -+err:
  18342. -+ kfree(limits);
  18343. -+ kfree(combo);
  18344. -+ return -ENOMEM;
  18345. -+}
  18346. -+
  18347. - static void brcmf_wiphy_pno_params(struct wiphy *wiphy)
  18348. - {
  18349. - /* scheduled scan settings */
  18350. -@@ -5745,7 +5757,6 @@ static void brcmf_wiphy_wowl_params(stru
  18351. - static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
  18352. - {
  18353. - struct ieee80211_supported_band *band;
  18354. -- struct ieee80211_iface_combination ifc_combo;
  18355. - __le32 bandlist[3];
  18356. - u32 n_bands;
  18357. - int err, i;
  18358. -@@ -5753,24 +5764,11 @@ static int brcmf_setup_wiphy(struct wiph
  18359. - wiphy->max_scan_ssids = WL_NUM_SCAN_MAX;
  18360. - wiphy->max_scan_ie_len = BRCMF_SCAN_IE_LEN_MAX;
  18361. - wiphy->max_num_pmkids = WL_NUM_PMKIDS_MAX;
  18362. -- wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  18363. -- BIT(NL80211_IFTYPE_ADHOC) |
  18364. -- BIT(NL80211_IFTYPE_AP) |
  18365. -- BIT(NL80211_IFTYPE_P2P_CLIENT) |
  18366. -- BIT(NL80211_IFTYPE_P2P_GO) |
  18367. -- BIT(NL80211_IFTYPE_P2P_DEVICE);
  18368. -- /* need VSDB firmware feature for concurrent channels */
  18369. -- ifc_combo = brcmf_iface_combos[0];
  18370. -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  18371. -- ifc_combo.num_different_channels = 2;
  18372. -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) {
  18373. -- ifc_combo.n_limits = ARRAY_SIZE(brcmf_iface_limits_mbss),
  18374. -- ifc_combo.limits = brcmf_iface_limits_mbss;
  18375. -- }
  18376. -- wiphy->iface_combinations = kmemdup(&ifc_combo,
  18377. -- sizeof(ifc_combo),
  18378. -- GFP_KERNEL);
  18379. -- wiphy->n_iface_combinations = ARRAY_SIZE(brcmf_iface_combos);
  18380. -+
  18381. -+ err = brcmf_setup_ifmodes(wiphy, ifp);
  18382. -+ if (err)
  18383. -+ return err;
  18384. -+
  18385. - wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
  18386. - wiphy->cipher_suites = __wl_cipher_suites;
  18387. - wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites);
  18388. -@@ -6035,6 +6033,8 @@ static void brcmf_free_wiphy(struct wiph
  18389. - if (!wiphy)
  18390. - return;
  18391. -
  18392. -+ if (wiphy->iface_combinations)
  18393. -+ kfree(wiphy->iface_combinations->limits);
  18394. - kfree(wiphy->iface_combinations);
  18395. - if (wiphy->bands[IEEE80211_BAND_2GHZ]) {
  18396. - kfree(wiphy->bands[IEEE80211_BAND_2GHZ]->channels);
  18397. 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
  18398. deleted file mode 100644
  18399. index 7bd0686..0000000
  18400. --- a/package/kernel/mac80211/patches/359-0003-brcmfmac-rework-.get_station-callback.patch
  18401. +++ /dev/null
  18402. @@ -1,326 +0,0 @@
  18403. -From: Arend van Spriel <arend@broadcom.com>
  18404. -Date: Thu, 11 Jun 2015 00:12:19 +0200
  18405. -Subject: [PATCH] brcmfmac: rework .get_station() callback
  18406. -
  18407. -The .get_station() cfg80211 callback is used in several scenarios. In
  18408. -managed mode it can obtain information about the access-point and its
  18409. -BSS parameters. In managed mode it can also obtain information about
  18410. -TDLS peers. In AP mode it can obtain information about connected
  18411. -clients.
  18412. -
  18413. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  18414. -Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  18415. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  18416. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  18417. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  18418. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18419. ----
  18420. -
  18421. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  18422. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  18423. -@@ -2395,27 +2395,80 @@ brcmf_cfg80211_reconfigure_wep(struct br
  18424. - brcmf_err("set wsec error (%d)\n", err);
  18425. - }
  18426. -
  18427. -+static void brcmf_convert_sta_flags(u32 fw_sta_flags, struct station_info *si)
  18428. -+{
  18429. -+ struct nl80211_sta_flag_update *sfu;
  18430. -+
  18431. -+ brcmf_dbg(TRACE, "flags %08x\n", fw_sta_flags);
  18432. -+ si->filled |= BIT(NL80211_STA_INFO_STA_FLAGS);
  18433. -+ sfu = &si->sta_flags;
  18434. -+ sfu->mask = BIT(NL80211_STA_FLAG_WME) |
  18435. -+ BIT(NL80211_STA_FLAG_AUTHENTICATED) |
  18436. -+ BIT(NL80211_STA_FLAG_ASSOCIATED) |
  18437. -+ BIT(NL80211_STA_FLAG_AUTHORIZED);
  18438. -+ if (fw_sta_flags & BRCMF_STA_WME)
  18439. -+ sfu->set |= BIT(NL80211_STA_FLAG_WME);
  18440. -+ if (fw_sta_flags & BRCMF_STA_AUTHE)
  18441. -+ sfu->set |= BIT(NL80211_STA_FLAG_AUTHENTICATED);
  18442. -+ if (fw_sta_flags & BRCMF_STA_ASSOC)
  18443. -+ sfu->set |= BIT(NL80211_STA_FLAG_ASSOCIATED);
  18444. -+ if (fw_sta_flags & BRCMF_STA_AUTHO)
  18445. -+ sfu->set |= BIT(NL80211_STA_FLAG_AUTHORIZED);
  18446. -+}
  18447. -+
  18448. -+static void brcmf_fill_bss_param(struct brcmf_if *ifp, struct station_info *si)
  18449. -+{
  18450. -+ struct {
  18451. -+ __le32 len;
  18452. -+ struct brcmf_bss_info_le bss_le;
  18453. -+ } *buf;
  18454. -+ u16 capability;
  18455. -+ int err;
  18456. -+
  18457. -+ buf = kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL);
  18458. -+ if (!buf)
  18459. -+ return;
  18460. -+
  18461. -+ buf->len = cpu_to_le32(WL_BSS_INFO_MAX);
  18462. -+ err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO, buf,
  18463. -+ WL_BSS_INFO_MAX);
  18464. -+ if (err) {
  18465. -+ brcmf_err("Failed to get bss info (%d)\n", err);
  18466. -+ return;
  18467. -+ }
  18468. -+ si->filled |= BIT(NL80211_STA_INFO_BSS_PARAM);
  18469. -+ si->bss_param.beacon_interval = le16_to_cpu(buf->bss_le.beacon_period);
  18470. -+ si->bss_param.dtim_period = buf->bss_le.dtim_period;
  18471. -+ capability = le16_to_cpu(buf->bss_le.capability);
  18472. -+ if (capability & IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT)
  18473. -+ si->bss_param.flags |= BSS_PARAM_FLAGS_CTS_PROT;
  18474. -+ if (capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
  18475. -+ si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE;
  18476. -+ if (capability & WLAN_CAPABILITY_SHORT_SLOT_TIME)
  18477. -+ si->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME;
  18478. -+}
  18479. -+
  18480. - static s32
  18481. - brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
  18482. - const u8 *mac, struct station_info *sinfo)
  18483. - {
  18484. - struct brcmf_if *ifp = netdev_priv(ndev);
  18485. -- struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
  18486. -- struct brcmf_scb_val_le scb_val;
  18487. -- int rssi;
  18488. -- s32 rate;
  18489. - s32 err = 0;
  18490. -- u8 *bssid = profile->bssid;
  18491. - struct brcmf_sta_info_le sta_info_le;
  18492. -- u32 beacon_period;
  18493. -- u32 dtim_period;
  18494. -+ u32 sta_flags;
  18495. -+ u32 is_tdls_peer;
  18496. -
  18497. - brcmf_dbg(TRACE, "Enter, MAC %pM\n", mac);
  18498. - if (!check_vif_up(ifp->vif))
  18499. - return -EIO;
  18500. -
  18501. -- if (brcmf_is_apmode(ifp->vif)) {
  18502. -- memcpy(&sta_info_le, mac, ETH_ALEN);
  18503. -+ memset(&sta_info_le, 0, sizeof(sta_info_le));
  18504. -+ memcpy(&sta_info_le, mac, ETH_ALEN);
  18505. -+ err = brcmf_fil_iovar_data_get(ifp, "tdls_sta_info",
  18506. -+ &sta_info_le,
  18507. -+ sizeof(sta_info_le));
  18508. -+ is_tdls_peer = !err;
  18509. -+ if (err) {
  18510. - err = brcmf_fil_iovar_data_get(ifp, "sta_info",
  18511. - &sta_info_le,
  18512. - sizeof(sta_info_le));
  18513. -@@ -2423,73 +2476,48 @@ brcmf_cfg80211_get_station(struct wiphy
  18514. - brcmf_err("GET STA INFO failed, %d\n", err);
  18515. - goto done;
  18516. - }
  18517. -- sinfo->filled = BIT(NL80211_STA_INFO_INACTIVE_TIME);
  18518. -- sinfo->inactive_time = le32_to_cpu(sta_info_le.idle) * 1000;
  18519. -- if (le32_to_cpu(sta_info_le.flags) & BRCMF_STA_ASSOC) {
  18520. -- sinfo->filled |= BIT(NL80211_STA_INFO_CONNECTED_TIME);
  18521. -- sinfo->connected_time = le32_to_cpu(sta_info_le.in);
  18522. -- }
  18523. -- brcmf_dbg(TRACE, "STA idle time : %d ms, connected time :%d sec\n",
  18524. -- sinfo->inactive_time, sinfo->connected_time);
  18525. -- } else if (ifp->vif->wdev.iftype == NL80211_IFTYPE_STATION) {
  18526. -- if (memcmp(mac, bssid, ETH_ALEN)) {
  18527. -- brcmf_err("Wrong Mac address cfg_mac-%pM wl_bssid-%pM\n",
  18528. -- mac, bssid);
  18529. -- err = -ENOENT;
  18530. -- goto done;
  18531. -- }
  18532. -- /* Report the current tx rate */
  18533. -- err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_RATE, &rate);
  18534. -- if (err) {
  18535. -- brcmf_err("Could not get rate (%d)\n", err);
  18536. -- goto done;
  18537. -- } else {
  18538. -+ }
  18539. -+ brcmf_dbg(TRACE, "version %d\n", le16_to_cpu(sta_info_le.ver));
  18540. -+ sinfo->filled = BIT(NL80211_STA_INFO_INACTIVE_TIME);
  18541. -+ sinfo->inactive_time = le32_to_cpu(sta_info_le.idle) * 1000;
  18542. -+ sta_flags = le32_to_cpu(sta_info_le.flags);
  18543. -+ brcmf_convert_sta_flags(sta_flags, sinfo);
  18544. -+ sinfo->sta_flags.mask |= BIT(NL80211_STA_FLAG_TDLS_PEER);
  18545. -+ if (is_tdls_peer)
  18546. -+ sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER);
  18547. -+ else
  18548. -+ sinfo->sta_flags.set &= ~BIT(NL80211_STA_FLAG_TDLS_PEER);
  18549. -+ if (sta_flags & BRCMF_STA_ASSOC) {
  18550. -+ sinfo->filled |= BIT(NL80211_STA_INFO_CONNECTED_TIME);
  18551. -+ sinfo->connected_time = le32_to_cpu(sta_info_le.in);
  18552. -+ brcmf_fill_bss_param(ifp, sinfo);
  18553. -+ }
  18554. -+ if (sta_flags & BRCMF_STA_SCBSTATS) {
  18555. -+ sinfo->filled |= BIT(NL80211_STA_INFO_TX_FAILED);
  18556. -+ sinfo->tx_failed = le32_to_cpu(sta_info_le.tx_failures);
  18557. -+ sinfo->filled |= BIT(NL80211_STA_INFO_TX_PACKETS);
  18558. -+ sinfo->tx_packets = le32_to_cpu(sta_info_le.tx_pkts);
  18559. -+ sinfo->tx_packets += le32_to_cpu(sta_info_le.tx_mcast_pkts);
  18560. -+ sinfo->filled |= BIT(NL80211_STA_INFO_RX_PACKETS);
  18561. -+ sinfo->rx_packets = le32_to_cpu(sta_info_le.rx_ucast_pkts);
  18562. -+ sinfo->rx_packets += le32_to_cpu(sta_info_le.rx_mcast_pkts);
  18563. -+ if (sinfo->tx_packets) {
  18564. - sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
  18565. -- sinfo->txrate.legacy = rate * 5;
  18566. -- brcmf_dbg(CONN, "Rate %d Mbps\n", rate / 2);
  18567. -+ sinfo->txrate.legacy = le32_to_cpu(sta_info_le.tx_rate);
  18568. -+ sinfo->txrate.legacy /= 100;
  18569. - }
  18570. --
  18571. -- if (test_bit(BRCMF_VIF_STATUS_CONNECTED,
  18572. -- &ifp->vif->sme_state)) {
  18573. -- memset(&scb_val, 0, sizeof(scb_val));
  18574. -- err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI,
  18575. -- &scb_val, sizeof(scb_val));
  18576. -- if (err) {
  18577. -- brcmf_err("Could not get rssi (%d)\n", err);
  18578. -- goto done;
  18579. -- } else {
  18580. -- rssi = le32_to_cpu(scb_val.val);
  18581. -- sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
  18582. -- sinfo->signal = rssi;
  18583. -- brcmf_dbg(CONN, "RSSI %d dBm\n", rssi);
  18584. -- }
  18585. -- err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_BCNPRD,
  18586. -- &beacon_period);
  18587. -- if (err) {
  18588. -- brcmf_err("Could not get beacon period (%d)\n",
  18589. -- err);
  18590. -- goto done;
  18591. -- } else {
  18592. -- sinfo->bss_param.beacon_interval =
  18593. -- beacon_period;
  18594. -- brcmf_dbg(CONN, "Beacon peroid %d\n",
  18595. -- beacon_period);
  18596. -- }
  18597. -- err = brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_DTIMPRD,
  18598. -- &dtim_period);
  18599. -- if (err) {
  18600. -- brcmf_err("Could not get DTIM period (%d)\n",
  18601. -- err);
  18602. -- goto done;
  18603. -- } else {
  18604. -- sinfo->bss_param.dtim_period = dtim_period;
  18605. -- brcmf_dbg(CONN, "DTIM peroid %d\n",
  18606. -- dtim_period);
  18607. -- }
  18608. -- sinfo->filled |= BIT(NL80211_STA_INFO_BSS_PARAM);
  18609. -+ if (sinfo->rx_packets) {
  18610. -+ sinfo->filled |= BIT(NL80211_STA_INFO_RX_BITRATE);
  18611. -+ sinfo->rxrate.legacy = le32_to_cpu(sta_info_le.rx_rate);
  18612. -+ sinfo->rxrate.legacy /= 100;
  18613. -+ }
  18614. -+ if (le16_to_cpu(sta_info_le.ver) >= 4) {
  18615. -+ sinfo->filled |= BIT(NL80211_STA_INFO_TX_BYTES);
  18616. -+ sinfo->tx_bytes = le64_to_cpu(sta_info_le.tx_tot_bytes);
  18617. -+ sinfo->filled |= BIT(NL80211_STA_INFO_RX_BYTES);
  18618. -+ sinfo->rx_bytes = le64_to_cpu(sta_info_le.rx_tot_bytes);
  18619. - }
  18620. -- } else
  18621. -- err = -EPERM;
  18622. -+ }
  18623. - done:
  18624. - brcmf_dbg(TRACE, "Exit\n");
  18625. - return err;
  18626. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  18627. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  18628. -@@ -32,7 +32,11 @@
  18629. - #define BRCMF_BSS_INFO_VERSION 109 /* curr ver of brcmf_bss_info_le struct */
  18630. - #define BRCMF_BSS_RSSI_ON_CHANNEL 0x0002
  18631. -
  18632. --#define BRCMF_STA_ASSOC 0x10 /* Associated */
  18633. -+#define BRCMF_STA_WME 0x00000002 /* WMM association */
  18634. -+#define BRCMF_STA_AUTHE 0x00000008 /* Authenticated */
  18635. -+#define BRCMF_STA_ASSOC 0x00000010 /* Associated */
  18636. -+#define BRCMF_STA_AUTHO 0x00000020 /* Authorized */
  18637. -+#define BRCMF_STA_SCBSTATS 0x00004000 /* Per STA debug stats */
  18638. -
  18639. - /* size of brcmf_scan_params not including variable length array */
  18640. - #define BRCMF_SCAN_PARAMS_FIXED_SIZE 64
  18641. -@@ -113,6 +117,7 @@
  18642. - #define BRCMF_WOWL_MAXPATTERNSIZE 128
  18643. -
  18644. - #define BRCMF_COUNTRY_BUF_SZ 4
  18645. -+#define BRCMF_ANT_MAX 4
  18646. -
  18647. - /* join preference types for join_pref iovar */
  18648. - enum brcmf_join_pref_types {
  18649. -@@ -456,25 +461,61 @@ struct brcmf_channel_info_le {
  18650. - };
  18651. -
  18652. - struct brcmf_sta_info_le {
  18653. -- __le16 ver; /* version of this struct */
  18654. -- __le16 len; /* length in bytes of this structure */
  18655. -- __le16 cap; /* sta's advertised capabilities */
  18656. -- __le32 flags; /* flags defined below */
  18657. -- __le32 idle; /* time since data pkt rx'd from sta */
  18658. -- u8 ea[ETH_ALEN]; /* Station address */
  18659. -- __le32 count; /* # rates in this set */
  18660. -- u8 rates[BRCMF_MAXRATES_IN_SET]; /* rates in 500kbps units */
  18661. -+ __le16 ver; /* version of this struct */
  18662. -+ __le16 len; /* length in bytes of this structure */
  18663. -+ __le16 cap; /* sta's advertised capabilities */
  18664. -+ __le32 flags; /* flags defined below */
  18665. -+ __le32 idle; /* time since data pkt rx'd from sta */
  18666. -+ u8 ea[ETH_ALEN]; /* Station address */
  18667. -+ __le32 count; /* # rates in this set */
  18668. -+ u8 rates[BRCMF_MAXRATES_IN_SET]; /* rates in 500kbps units */
  18669. - /* w/hi bit set if basic */
  18670. -- __le32 in; /* seconds elapsed since associated */
  18671. -- __le32 listen_interval_inms; /* Min Listen interval in ms for STA */
  18672. -- __le32 tx_pkts; /* # of packets transmitted */
  18673. -- __le32 tx_failures; /* # of packets failed */
  18674. -- __le32 rx_ucast_pkts; /* # of unicast packets received */
  18675. -- __le32 rx_mcast_pkts; /* # of multicast packets received */
  18676. -- __le32 tx_rate; /* Rate of last successful tx frame */
  18677. -- __le32 rx_rate; /* Rate of last successful rx frame */
  18678. -- __le32 rx_decrypt_succeeds; /* # of packet decrypted successfully */
  18679. -- __le32 rx_decrypt_failures; /* # of packet decrypted failed */
  18680. -+ __le32 in; /* seconds elapsed since associated */
  18681. -+ __le32 listen_interval_inms; /* Min Listen interval in ms for STA */
  18682. -+ __le32 tx_pkts; /* # of packets transmitted */
  18683. -+ __le32 tx_failures; /* # of packets failed */
  18684. -+ __le32 rx_ucast_pkts; /* # of unicast packets received */
  18685. -+ __le32 rx_mcast_pkts; /* # of multicast packets received */
  18686. -+ __le32 tx_rate; /* Rate of last successful tx frame */
  18687. -+ __le32 rx_rate; /* Rate of last successful rx frame */
  18688. -+ __le32 rx_decrypt_succeeds; /* # of packet decrypted successfully */
  18689. -+ __le32 rx_decrypt_failures; /* # of packet decrypted failed */
  18690. -+ __le32 tx_tot_pkts; /* # of tx pkts (ucast + mcast) */
  18691. -+ __le32 rx_tot_pkts; /* # of data packets recvd (uni + mcast) */
  18692. -+ __le32 tx_mcast_pkts; /* # of mcast pkts txed */
  18693. -+ __le64 tx_tot_bytes; /* data bytes txed (ucast + mcast) */
  18694. -+ __le64 rx_tot_bytes; /* data bytes recvd (ucast + mcast) */
  18695. -+ __le64 tx_ucast_bytes; /* data bytes txed (ucast) */
  18696. -+ __le64 tx_mcast_bytes; /* # data bytes txed (mcast) */
  18697. -+ __le64 rx_ucast_bytes; /* data bytes recvd (ucast) */
  18698. -+ __le64 rx_mcast_bytes; /* data bytes recvd (mcast) */
  18699. -+ s8 rssi[BRCMF_ANT_MAX]; /* per antenna rssi */
  18700. -+ s8 nf[BRCMF_ANT_MAX]; /* per antenna noise floor */
  18701. -+ __le16 aid; /* association ID */
  18702. -+ __le16 ht_capabilities; /* advertised ht caps */
  18703. -+ __le16 vht_flags; /* converted vht flags */
  18704. -+ __le32 tx_pkts_retry_cnt; /* # of frames where a retry was
  18705. -+ * exhausted.
  18706. -+ */
  18707. -+ __le32 tx_pkts_retry_exhausted; /* # of user frames where a retry
  18708. -+ * was exhausted
  18709. -+ */
  18710. -+ s8 rx_lastpkt_rssi[BRCMF_ANT_MAX]; /* Per antenna RSSI of last
  18711. -+ * received data frame.
  18712. -+ */
  18713. -+ /* TX WLAN retry/failure statistics:
  18714. -+ * Separated for host requested frames and locally generated frames.
  18715. -+ * Include unicast frame only where the retries/failures can be counted.
  18716. -+ */
  18717. -+ __le32 tx_pkts_total; /* # user frames sent successfully */
  18718. -+ __le32 tx_pkts_retries; /* # user frames retries */
  18719. -+ __le32 tx_pkts_fw_total; /* # FW generated sent successfully */
  18720. -+ __le32 tx_pkts_fw_retries; /* # retries for FW generated frames */
  18721. -+ __le32 tx_pkts_fw_retry_exhausted; /* # FW generated where a retry
  18722. -+ * was exhausted
  18723. -+ */
  18724. -+ __le32 rx_pkts_retried; /* # rx with retry bit set */
  18725. -+ __le32 tx_rate_fallback; /* lowest fallback TX rate */
  18726. - };
  18727. -
  18728. - struct brcmf_chanspec_list {
  18729. 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
  18730. deleted file mode 100644
  18731. index 302bc3e..0000000
  18732. --- a/package/kernel/mac80211/patches/359-0004-brcmfmac-have-sdio-return-EIO-when-device-communicat.patch
  18733. +++ /dev/null
  18734. @@ -1,56 +0,0 @@
  18735. -From: Arend van Spriel <arend@broadcom.com>
  18736. -Date: Thu, 11 Jun 2015 00:12:20 +0200
  18737. -Subject: [PATCH] brcmfmac: have sdio return -EIO when device communication
  18738. - is not possible
  18739. -
  18740. -The bus interface functions txctl and rxctl may be used while the device
  18741. -can not be accessed, eg. upon driver .remove() callback. This patch will
  18742. -immediately return -EIO when this is the case which speeds up the module
  18743. -unload.
  18744. -
  18745. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  18746. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  18747. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  18748. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  18749. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18750. ----
  18751. -
  18752. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  18753. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
  18754. -@@ -988,6 +988,7 @@ static void brcmf_sdiod_freezer_detach(s
  18755. -
  18756. - static int brcmf_sdiod_remove(struct brcmf_sdio_dev *sdiodev)
  18757. - {
  18758. -+ sdiodev->state = BRCMF_SDIOD_DOWN;
  18759. - if (sdiodev->bus) {
  18760. - brcmf_sdio_remove(sdiodev->bus);
  18761. - sdiodev->bus = NULL;
  18762. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  18763. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  18764. -@@ -2820,6 +2820,8 @@ static int brcmf_sdio_bus_txdata(struct
  18765. - struct brcmf_sdio *bus = sdiodev->bus;
  18766. -
  18767. - brcmf_dbg(TRACE, "Enter: pkt: data %p len %d\n", pkt->data, pkt->len);
  18768. -+ if (sdiodev->state != BRCMF_SDIOD_DATA)
  18769. -+ return -EIO;
  18770. -
  18771. - /* Add space for the header */
  18772. - skb_push(pkt, bus->tx_hdrlen);
  18773. -@@ -2948,6 +2950,8 @@ brcmf_sdio_bus_txctl(struct device *dev,
  18774. - int ret;
  18775. -
  18776. - brcmf_dbg(TRACE, "Enter\n");
  18777. -+ if (sdiodev->state != BRCMF_SDIOD_DATA)
  18778. -+ return -EIO;
  18779. -
  18780. - /* Send from dpc */
  18781. - bus->ctrl_frame_buf = msg;
  18782. -@@ -3238,6 +3242,8 @@ brcmf_sdio_bus_rxctl(struct device *dev,
  18783. - struct brcmf_sdio *bus = sdiodev->bus;
  18784. -
  18785. - brcmf_dbg(TRACE, "Enter\n");
  18786. -+ if (sdiodev->state != BRCMF_SDIOD_DATA)
  18787. -+ return -EIO;
  18788. -
  18789. - /* Wait until control frame is available */
  18790. - timeleft = brcmf_sdio_dcmd_resp_wait(bus, &bus->rxlen, &pending);
  18791. 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
  18792. deleted file mode 100644
  18793. index 34af6d2..0000000
  18794. --- a/package/kernel/mac80211/patches/359-0005-ath9k-make-DMA-stop-related-messages-debug-only.patch
  18795. +++ /dev/null
  18796. @@ -1,74 +0,0 @@
  18797. -From: Felix Fietkau <nbd@openwrt.org>
  18798. -Date: Thu, 2 Jul 2015 13:35:05 +0200
  18799. -Subject: [PATCH] ath9k: make DMA stop related messages debug-only
  18800. -
  18801. -A long time ago, ath9k had issues during reset where the DMA engine
  18802. -would stay active and could potentially corrupt memory.
  18803. -To debug those issues, the driver would print warnings whenever they
  18804. -occur.
  18805. -
  18806. -Nowadays, these issues are gone and the primary cause of these messages
  18807. -is if the MAC is stuck during reset or busy processing a long
  18808. -transmission. This is fairly harmless, yet these messages continue to
  18809. -worry users.
  18810. -
  18811. -To reduce the number of bogus bug reports, turn these messages into
  18812. -debug messages and count their occurence in the "reset" debugfs file.
  18813. -
  18814. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  18815. ----
  18816. -
  18817. ---- a/drivers/net/wireless/ath/ath9k/debug.c
  18818. -+++ b/drivers/net/wireless/ath/ath9k/debug.c
  18819. -@@ -765,6 +765,8 @@ static int read_file_reset(struct seq_fi
  18820. - [RESET_TYPE_BEACON_STUCK] = "Stuck Beacon",
  18821. - [RESET_TYPE_MCI] = "MCI Reset",
  18822. - [RESET_TYPE_CALIBRATION] = "Calibration error",
  18823. -+ [RESET_TX_DMA_ERROR] = "Tx DMA stop error",
  18824. -+ [RESET_RX_DMA_ERROR] = "Rx DMA stop error",
  18825. - };
  18826. - int i;
  18827. -
  18828. ---- a/drivers/net/wireless/ath/ath9k/debug.h
  18829. -+++ b/drivers/net/wireless/ath/ath9k/debug.h
  18830. -@@ -50,6 +50,8 @@ enum ath_reset_type {
  18831. - RESET_TYPE_BEACON_STUCK,
  18832. - RESET_TYPE_MCI,
  18833. - RESET_TYPE_CALIBRATION,
  18834. -+ RESET_TX_DMA_ERROR,
  18835. -+ RESET_RX_DMA_ERROR,
  18836. - __RESET_TYPE_MAX
  18837. - };
  18838. -
  18839. ---- a/drivers/net/wireless/ath/ath9k/recv.c
  18840. -+++ b/drivers/net/wireless/ath/ath9k/recv.c
  18841. -@@ -496,10 +496,9 @@ bool ath_stoprecv(struct ath_softc *sc)
  18842. -
  18843. - if (!(ah->ah_flags & AH_UNPLUGGED) &&
  18844. - unlikely(!stopped)) {
  18845. -- ath_err(ath9k_hw_common(sc->sc_ah),
  18846. -- "Could not stop RX, we could be "
  18847. -- "confusing the DMA engine when we start RX up\n");
  18848. -- ATH_DBG_WARN_ON_ONCE(!stopped);
  18849. -+ ath_dbg(ath9k_hw_common(sc->sc_ah), RESET,
  18850. -+ "Failed to stop Rx DMA\n");
  18851. -+ RESET_STAT_INC(sc, RESET_RX_DMA_ERROR);
  18852. - }
  18853. - return stopped && !reset;
  18854. - }
  18855. ---- a/drivers/net/wireless/ath/ath9k/xmit.c
  18856. -+++ b/drivers/net/wireless/ath/ath9k/xmit.c
  18857. -@@ -1896,8 +1896,11 @@ bool ath_drain_all_txq(struct ath_softc
  18858. - npend |= BIT(i);
  18859. - }
  18860. -
  18861. -- if (npend)
  18862. -- ath_err(common, "Failed to stop TX DMA, queues=0x%03x!\n", npend);
  18863. -+ if (npend) {
  18864. -+ RESET_STAT_INC(sc, RESET_TX_DMA_ERROR);
  18865. -+ ath_dbg(common, RESET,
  18866. -+ "Failed to stop TX DMA, queues=0x%03x!\n", npend);
  18867. -+ }
  18868. -
  18869. - for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
  18870. - if (!ATH_TXQ_SETUP(sc, i))
  18871. 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
  18872. deleted file mode 100644
  18873. index 06f2dce..0000000
  18874. --- a/package/kernel/mac80211/patches/359-0006-brcmfmac-free-ifp-for-non-netdev-interface-in-p2p-mo.patch
  18875. +++ /dev/null
  18876. @@ -1,44 +0,0 @@
  18877. -From: Arend van Spriel <arend@broadcom.com>
  18878. -Date: Thu, 11 Jun 2015 00:12:21 +0200
  18879. -Subject: [PATCH] brcmfmac: free ifp for non-netdev interface in p2p module
  18880. -
  18881. -Making it more clear by freeing the ifp in same place where the
  18882. -vif object is freed.
  18883. -
  18884. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  18885. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  18886. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  18887. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  18888. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18889. ----
  18890. -
  18891. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  18892. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  18893. -@@ -867,8 +867,6 @@ static void brcmf_del_if(struct brcmf_pu
  18894. - }
  18895. - /* unregister will take care of freeing it */
  18896. - unregister_netdev(ifp->ndev);
  18897. -- } else {
  18898. -- kfree(ifp);
  18899. - }
  18900. - }
  18901. -
  18902. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  18903. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  18904. -@@ -2238,6 +2238,7 @@ static void brcmf_p2p_delete_p2pdev(stru
  18905. - {
  18906. - cfg80211_unregister_wdev(&vif->wdev);
  18907. - p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  18908. -+ kfree(vif->ifp);
  18909. - brcmf_free_vif(vif);
  18910. - }
  18911. -
  18912. -@@ -2361,6 +2362,8 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  18913. - break;
  18914. -
  18915. - case NL80211_IFTYPE_P2P_DEVICE:
  18916. -+ brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  18917. -+ brcmf_p2p_deinit_discovery(p2p);
  18918. - brcmf_p2p_delete_p2pdev(p2p, vif);
  18919. - return 0;
  18920. - default:
  18921. 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
  18922. deleted file mode 100644
  18923. index 0a6e093..0000000
  18924. --- a/package/kernel/mac80211/patches/359-0007-brcmfmac-move-p2p-attach-detach-functions.patch
  18925. +++ /dev/null
  18926. @@ -1,225 +0,0 @@
  18927. -From: Arend van Spriel <arend@broadcom.com>
  18928. -Date: Thu, 11 Jun 2015 00:12:22 +0200
  18929. -Subject: [PATCH] brcmfmac: move p2p attach/detach functions
  18930. -
  18931. -Moving two functions in p2p.c as is so next change will be
  18932. -easier to review.
  18933. -
  18934. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  18935. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  18936. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  18937. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  18938. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  18939. ----
  18940. -
  18941. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  18942. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  18943. -@@ -1908,105 +1908,6 @@ s32 brcmf_p2p_notify_rx_mgmt_p2p_probere
  18944. -
  18945. -
  18946. - /**
  18947. -- * brcmf_p2p_attach() - attach for P2P.
  18948. -- *
  18949. -- * @cfg: driver private data for cfg80211 interface.
  18950. -- */
  18951. --s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg)
  18952. --{
  18953. -- struct brcmf_if *pri_ifp;
  18954. -- struct brcmf_if *p2p_ifp;
  18955. -- struct brcmf_cfg80211_vif *p2p_vif;
  18956. -- struct brcmf_p2p_info *p2p;
  18957. -- struct brcmf_pub *drvr;
  18958. -- s32 bssidx;
  18959. -- s32 err = 0;
  18960. --
  18961. -- p2p = &cfg->p2p;
  18962. -- p2p->cfg = cfg;
  18963. --
  18964. -- drvr = cfg->pub;
  18965. --
  18966. -- pri_ifp = drvr->iflist[0];
  18967. -- p2p_ifp = drvr->iflist[1];
  18968. --
  18969. -- p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif = pri_ifp->vif;
  18970. --
  18971. -- if (p2p_ifp) {
  18972. -- p2p_vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_P2P_DEVICE,
  18973. -- false);
  18974. -- if (IS_ERR(p2p_vif)) {
  18975. -- brcmf_err("could not create discovery vif\n");
  18976. -- err = -ENOMEM;
  18977. -- goto exit;
  18978. -- }
  18979. --
  18980. -- p2p_vif->ifp = p2p_ifp;
  18981. -- p2p_ifp->vif = p2p_vif;
  18982. -- p2p_vif->wdev.netdev = p2p_ifp->ndev;
  18983. -- p2p_ifp->ndev->ieee80211_ptr = &p2p_vif->wdev;
  18984. -- SET_NETDEV_DEV(p2p_ifp->ndev, wiphy_dev(cfg->wiphy));
  18985. --
  18986. -- p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = p2p_vif;
  18987. --
  18988. -- brcmf_p2p_generate_bss_mac(p2p, NULL);
  18989. -- memcpy(p2p_ifp->mac_addr, p2p->dev_addr, ETH_ALEN);
  18990. -- brcmf_p2p_set_firmware(pri_ifp, p2p->dev_addr);
  18991. --
  18992. -- /* Initialize P2P Discovery in the firmware */
  18993. -- err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1);
  18994. -- if (err < 0) {
  18995. -- brcmf_err("set p2p_disc error\n");
  18996. -- brcmf_free_vif(p2p_vif);
  18997. -- goto exit;
  18998. -- }
  18999. -- /* obtain bsscfg index for P2P discovery */
  19000. -- err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bssidx);
  19001. -- if (err < 0) {
  19002. -- brcmf_err("retrieving discover bsscfg index failed\n");
  19003. -- brcmf_free_vif(p2p_vif);
  19004. -- goto exit;
  19005. -- }
  19006. -- /* Verify that firmware uses same bssidx as driver !! */
  19007. -- if (p2p_ifp->bssidx != bssidx) {
  19008. -- brcmf_err("Incorrect bssidx=%d, compared to p2p_ifp->bssidx=%d\n",
  19009. -- bssidx, p2p_ifp->bssidx);
  19010. -- brcmf_free_vif(p2p_vif);
  19011. -- goto exit;
  19012. -- }
  19013. --
  19014. -- init_completion(&p2p->send_af_done);
  19015. -- INIT_WORK(&p2p->afx_hdl.afx_work, brcmf_p2p_afx_handler);
  19016. -- init_completion(&p2p->afx_hdl.act_frm_scan);
  19017. -- init_completion(&p2p->wait_next_af);
  19018. -- }
  19019. --exit:
  19020. -- return err;
  19021. --}
  19022. --
  19023. --
  19024. --/**
  19025. -- * brcmf_p2p_detach() - detach P2P.
  19026. -- *
  19027. -- * @p2p: P2P specific data.
  19028. -- */
  19029. --void brcmf_p2p_detach(struct brcmf_p2p_info *p2p)
  19030. --{
  19031. -- struct brcmf_cfg80211_vif *vif;
  19032. --
  19033. -- vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
  19034. -- if (vif != NULL) {
  19035. -- brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  19036. -- brcmf_p2p_deinit_discovery(p2p);
  19037. -- /* remove discovery interface */
  19038. -- brcmf_free_vif(vif);
  19039. -- p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  19040. -- }
  19041. -- /* just set it all to zero */
  19042. -- memset(p2p, 0, sizeof(*p2p));
  19043. --}
  19044. --
  19045. --/**
  19046. - * brcmf_p2p_get_current_chanspec() - Get current operation channel.
  19047. - *
  19048. - * @p2p: P2P specific data.
  19049. -@@ -2425,3 +2326,102 @@ void brcmf_p2p_stop_device(struct wiphy
  19050. - clear_bit(BRCMF_VIF_STATUS_READY, &vif->sme_state);
  19051. - mutex_unlock(&cfg->usr_sync);
  19052. - }
  19053. -+
  19054. -+/**
  19055. -+ * brcmf_p2p_attach() - attach for P2P.
  19056. -+ *
  19057. -+ * @cfg: driver private data for cfg80211 interface.
  19058. -+ */
  19059. -+s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg)
  19060. -+{
  19061. -+ struct brcmf_if *pri_ifp;
  19062. -+ struct brcmf_if *p2p_ifp;
  19063. -+ struct brcmf_cfg80211_vif *p2p_vif;
  19064. -+ struct brcmf_p2p_info *p2p;
  19065. -+ struct brcmf_pub *drvr;
  19066. -+ s32 bssidx;
  19067. -+ s32 err = 0;
  19068. -+
  19069. -+ p2p = &cfg->p2p;
  19070. -+ p2p->cfg = cfg;
  19071. -+
  19072. -+ drvr = cfg->pub;
  19073. -+
  19074. -+ pri_ifp = drvr->iflist[0];
  19075. -+ p2p_ifp = drvr->iflist[1];
  19076. -+
  19077. -+ p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif = pri_ifp->vif;
  19078. -+
  19079. -+ if (p2p_ifp) {
  19080. -+ p2p_vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_P2P_DEVICE,
  19081. -+ false);
  19082. -+ if (IS_ERR(p2p_vif)) {
  19083. -+ brcmf_err("could not create discovery vif\n");
  19084. -+ err = -ENOMEM;
  19085. -+ goto exit;
  19086. -+ }
  19087. -+
  19088. -+ p2p_vif->ifp = p2p_ifp;
  19089. -+ p2p_ifp->vif = p2p_vif;
  19090. -+ p2p_vif->wdev.netdev = p2p_ifp->ndev;
  19091. -+ p2p_ifp->ndev->ieee80211_ptr = &p2p_vif->wdev;
  19092. -+ SET_NETDEV_DEV(p2p_ifp->ndev, wiphy_dev(cfg->wiphy));
  19093. -+
  19094. -+ p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = p2p_vif;
  19095. -+
  19096. -+ brcmf_p2p_generate_bss_mac(p2p, NULL);
  19097. -+ memcpy(p2p_ifp->mac_addr, p2p->dev_addr, ETH_ALEN);
  19098. -+ brcmf_p2p_set_firmware(pri_ifp, p2p->dev_addr);
  19099. -+
  19100. -+ /* Initialize P2P Discovery in the firmware */
  19101. -+ err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1);
  19102. -+ if (err < 0) {
  19103. -+ brcmf_err("set p2p_disc error\n");
  19104. -+ brcmf_free_vif(p2p_vif);
  19105. -+ goto exit;
  19106. -+ }
  19107. -+ /* obtain bsscfg index for P2P discovery */
  19108. -+ err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bssidx);
  19109. -+ if (err < 0) {
  19110. -+ brcmf_err("retrieving discover bsscfg index failed\n");
  19111. -+ brcmf_free_vif(p2p_vif);
  19112. -+ goto exit;
  19113. -+ }
  19114. -+ /* Verify that firmware uses same bssidx as driver !! */
  19115. -+ if (p2p_ifp->bssidx != bssidx) {
  19116. -+ brcmf_err("Incorrect bssidx=%d, compared to p2p_ifp->bssidx=%d\n",
  19117. -+ bssidx, p2p_ifp->bssidx);
  19118. -+ brcmf_free_vif(p2p_vif);
  19119. -+ goto exit;
  19120. -+ }
  19121. -+
  19122. -+ init_completion(&p2p->send_af_done);
  19123. -+ INIT_WORK(&p2p->afx_hdl.afx_work, brcmf_p2p_afx_handler);
  19124. -+ init_completion(&p2p->afx_hdl.act_frm_scan);
  19125. -+ init_completion(&p2p->wait_next_af);
  19126. -+ }
  19127. -+exit:
  19128. -+ return err;
  19129. -+}
  19130. -+
  19131. -+/**
  19132. -+ * brcmf_p2p_detach() - detach P2P.
  19133. -+ *
  19134. -+ * @p2p: P2P specific data.
  19135. -+ */
  19136. -+void brcmf_p2p_detach(struct brcmf_p2p_info *p2p)
  19137. -+{
  19138. -+ struct brcmf_cfg80211_vif *vif;
  19139. -+
  19140. -+ vif = p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
  19141. -+ if (vif != NULL) {
  19142. -+ brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  19143. -+ brcmf_p2p_deinit_discovery(p2p);
  19144. -+ /* remove discovery interface */
  19145. -+ brcmf_free_vif(vif);
  19146. -+ p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  19147. -+ }
  19148. -+ /* just set it all to zero */
  19149. -+ memset(p2p, 0, sizeof(*p2p));
  19150. -+}
  19151. -+
  19152. 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
  19153. deleted file mode 100644
  19154. index 72e8eed..0000000
  19155. --- a/package/kernel/mac80211/patches/359-0008-brcmfmac-assure-p2pdev-is-unregistered-upon-driver-u.patch
  19156. +++ /dev/null
  19157. @@ -1,63 +0,0 @@
  19158. -From: Arend van Spriel <arend@broadcom.com>
  19159. -Date: Thu, 11 Jun 2015 00:12:23 +0200
  19160. -Subject: [PATCH] brcmfmac: assure p2pdev is unregistered upon driver
  19161. - unload
  19162. -
  19163. -When unloading the driver with a p2pdev interface it resulted in
  19164. -a warning upon calling wiphy_unregister() and subsequently a crash
  19165. -in the driver. This patch assures the p2pdev is unregistered calling
  19166. -unregister_wdev() before doing the wiphy_unregister().
  19167. -
  19168. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19169. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  19170. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19171. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19172. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19173. ----
  19174. -
  19175. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19176. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19177. -@@ -6206,10 +6206,8 @@ void brcmf_cfg80211_detach(struct brcmf_
  19178. - if (!cfg)
  19179. - return;
  19180. -
  19181. -- WARN_ON(!list_empty(&cfg->vif_list));
  19182. -- wiphy_unregister(cfg->wiphy);
  19183. - brcmf_btcoex_detach(cfg);
  19184. -- brcmf_p2p_detach(&cfg->p2p);
  19185. -+ wiphy_unregister(cfg->wiphy);
  19186. - wl_deinit_priv(cfg);
  19187. - brcmf_free_wiphy(cfg->wiphy);
  19188. - }
  19189. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  19190. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  19191. -@@ -1098,6 +1098,7 @@ void brcmf_detach(struct device *dev)
  19192. -
  19193. - /* stop firmware event handling */
  19194. - brcmf_fweh_detach(drvr);
  19195. -+ brcmf_p2p_detach(&drvr->config->p2p);
  19196. -
  19197. - brcmf_bus_change_state(bus_if, BRCMF_BUS_DOWN);
  19198. -
  19199. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  19200. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  19201. -@@ -16,6 +16,7 @@
  19202. - #include <linux/slab.h>
  19203. - #include <linux/netdevice.h>
  19204. - #include <linux/etherdevice.h>
  19205. -+#include <linux/rtnetlink.h>
  19206. - #include <net/cfg80211.h>
  19207. -
  19208. - #include <brcmu_wifi.h>
  19209. -@@ -2418,8 +2419,9 @@ void brcmf_p2p_detach(struct brcmf_p2p_i
  19210. - brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  19211. - brcmf_p2p_deinit_discovery(p2p);
  19212. - /* remove discovery interface */
  19213. -- brcmf_free_vif(vif);
  19214. -- p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  19215. -+ rtnl_lock();
  19216. -+ brcmf_p2p_delete_p2pdev(p2p, vif);
  19217. -+ rtnl_unlock();
  19218. - }
  19219. - /* just set it all to zero */
  19220. - memset(p2p, 0, sizeof(*p2p));
  19221. 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
  19222. deleted file mode 100644
  19223. index 179c77e..0000000
  19224. --- a/package/kernel/mac80211/patches/360-0001-brcmfmac-fix-double-free-of-p2pdev-interface.patch
  19225. +++ /dev/null
  19226. @@ -1,27 +0,0 @@
  19227. -From: Arend van Spriel <arend@broadcom.com>
  19228. -Date: Mon, 15 Jun 2015 22:48:38 +0200
  19229. -Subject: [PATCH] brcmfmac: fix double free of p2pdev interface
  19230. -
  19231. -When freeing the driver ifp pointer it should also be removed from
  19232. -the driver interface list, which is what brcmf_remove_interface()
  19233. -does. Otherwise, the ifp pointer will be freed twice triggering
  19234. -a kernel oops.
  19235. -
  19236. -Fixes: f37d69a4babc ("brcmfmac: free ifp for non-netdev interface in p2p module")
  19237. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19238. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19239. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19240. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19241. ----
  19242. -
  19243. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  19244. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  19245. -@@ -2140,7 +2140,7 @@ static void brcmf_p2p_delete_p2pdev(stru
  19246. - {
  19247. - cfg80211_unregister_wdev(&vif->wdev);
  19248. - p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  19249. -- kfree(vif->ifp);
  19250. -+ brcmf_remove_interface(vif->ifp->drvr, vif->ifp->bssidx);
  19251. - brcmf_free_vif(vif);
  19252. - }
  19253. -
  19254. 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
  19255. deleted file mode 100644
  19256. index e4f88b5..0000000
  19257. --- a/package/kernel/mac80211/patches/360-0002-brcmfmac-make-brcmf_p2p_detach-call-conditional.patch
  19258. +++ /dev/null
  19259. @@ -1,29 +0,0 @@
  19260. -From: Arend van Spriel <arend@broadcom.com>
  19261. -Date: Mon, 15 Jun 2015 22:48:39 +0200
  19262. -Subject: [PATCH] brcmfmac: make brcmf_p2p_detach() call conditional
  19263. -
  19264. -During verification of error handling in brcmf_cfg80211_attach() a
  19265. -null pointer dereference occurred upon calling brcmf_p2p_detach()
  19266. -from brcmf_detach(). This should only be called when the
  19267. -brcmf_cfg80211_attach() has succeeded.
  19268. -
  19269. -Fixes: f7a40873d2fa ("brcmfmac: assure p2pdev is unregistered upon driver unload")
  19270. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19271. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  19272. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19273. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19274. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19275. ----
  19276. -
  19277. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  19278. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  19279. -@@ -1098,7 +1098,8 @@ void brcmf_detach(struct device *dev)
  19280. -
  19281. - /* stop firmware event handling */
  19282. - brcmf_fweh_detach(drvr);
  19283. -- brcmf_p2p_detach(&drvr->config->p2p);
  19284. -+ if (drvr->config)
  19285. -+ brcmf_p2p_detach(&drvr->config->p2p);
  19286. -
  19287. - brcmf_bus_change_state(bus_if, BRCMF_BUS_DOWN);
  19288. -
  19289. 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
  19290. deleted file mode 100644
  19291. index 0a81237..0000000
  19292. --- a/package/kernel/mac80211/patches/361-brcmfmac-set-wiphy-s-addresses-to-provide-valid-MACs.patch
  19293. +++ /dev/null
  19294. @@ -1,67 +0,0 @@
  19295. -From: Rafa? Mi?ecki <zajec5@gmail.com>
  19296. -Date: Thu, 9 Jul 2015 17:07:08 +0200
  19297. -Subject: [PATCH] brcmfmac: set wiphy's addresses to provide valid MACs
  19298. -
  19299. -Broadcom's firmware requires every BSS to use MAC address with unique
  19300. -last few bits. The amount of bits may depend on a particular firmware,
  19301. -it was verified to be 2 for BCM43602 one.
  19302. -If this condition won't be fulfilled firmware will reject such MAC:
  19303. -brcmfmac: _brcmf_set_mac_address: Setting cur_etheraddr failed, -52
  19304. -
  19305. -We don't want to simply set addr_mask as it would also disallow using
  19306. -locally administrated bit. Instead let's build a list of addresses
  19307. -manually enabling 0x2 bit for extra interfaces.
  19308. -
  19309. -Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
  19310. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19311. ----
  19312. -
  19313. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19314. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19315. -@@ -5784,6 +5784,7 @@ static void brcmf_wiphy_wowl_params(stru
  19316. -
  19317. - static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
  19318. - {
  19319. -+ struct brcmf_pub *drvr = ifp->drvr;
  19320. - struct ieee80211_supported_band *band;
  19321. - __le32 bandlist[3];
  19322. - u32 n_bands;
  19323. -@@ -5797,6 +5798,19 @@ static int brcmf_setup_wiphy(struct wiph
  19324. - if (err)
  19325. - return err;
  19326. -
  19327. -+ for (i = 0; i < wiphy->iface_combinations->max_interfaces &&
  19328. -+ i < ARRAY_SIZE(drvr->addresses); i++) {
  19329. -+ u8 *addr = drvr->addresses[i].addr;
  19330. -+
  19331. -+ memcpy(addr, drvr->mac, ETH_ALEN);
  19332. -+ if (i) {
  19333. -+ addr[0] |= BIT(1);
  19334. -+ addr[ETH_ALEN - 1] ^= i;
  19335. -+ }
  19336. -+ }
  19337. -+ wiphy->addresses = drvr->addresses;
  19338. -+ wiphy->n_addresses = i;
  19339. -+
  19340. - wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
  19341. - wiphy->cipher_suites = __wl_cipher_suites;
  19342. - wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites);
  19343. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  19344. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  19345. -@@ -21,6 +21,7 @@
  19346. - #ifndef BRCMFMAC_CORE_H
  19347. - #define BRCMFMAC_CORE_H
  19348. -
  19349. -+#include <net/cfg80211.h>
  19350. - #include "fweh.h"
  19351. -
  19352. - #define TOE_TX_CSUM_OL 0x00000001
  19353. -@@ -118,6 +119,8 @@ struct brcmf_pub {
  19354. - /* Multicast data packets sent to dongle */
  19355. - unsigned long tx_multicast;
  19356. -
  19357. -+ struct mac_address addresses[BRCMF_MAX_IFS];
  19358. -+
  19359. - struct brcmf_if *iflist[BRCMF_MAX_IFS];
  19360. -
  19361. - struct mutex proto_block;
  19362. 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
  19363. deleted file mode 100644
  19364. index e44f121..0000000
  19365. --- a/package/kernel/mac80211/patches/362-brcmfmac-dhd_sdio.c-use-existing-atomic_or-primitive.patch
  19366. +++ /dev/null
  19367. @@ -1,45 +0,0 @@
  19368. -From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
  19369. -Date: Thu, 9 Jul 2015 13:43:18 +0530
  19370. -Subject: [PATCH] brcmfmac: dhd_sdio.c: use existing atomic_or primitive
  19371. -
  19372. -There's already a generic implementation so use that instead.
  19373. -
  19374. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19375. ----
  19376. -
  19377. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  19378. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  19379. -@@ -2564,15 +2564,6 @@ static inline void brcmf_sdio_clrintr(st
  19380. - }
  19381. - }
  19382. -
  19383. --static void atomic_orr(int val, atomic_t *v)
  19384. --{
  19385. -- int old_val;
  19386. --
  19387. -- old_val = atomic_read(v);
  19388. -- while (atomic_cmpxchg(v, old_val, val | old_val) != old_val)
  19389. -- old_val = atomic_read(v);
  19390. --}
  19391. --
  19392. - static int brcmf_sdio_intr_rstatus(struct brcmf_sdio *bus)
  19393. - {
  19394. - struct brcmf_core *buscore;
  19395. -@@ -2595,7 +2586,7 @@ static int brcmf_sdio_intr_rstatus(struc
  19396. - if (val) {
  19397. - brcmf_sdiod_regwl(bus->sdiodev, addr, val, &ret);
  19398. - bus->sdcnt.f1regdata++;
  19399. -- atomic_orr(val, &bus->intstatus);
  19400. -+ atomic_or(val, &bus->intstatus);
  19401. - }
  19402. -
  19403. - return ret;
  19404. -@@ -2712,7 +2703,7 @@ static void brcmf_sdio_dpc(struct brcmf_
  19405. -
  19406. - /* Keep still-pending events for next scheduling */
  19407. - if (intstatus)
  19408. -- atomic_orr(intstatus, &bus->intstatus);
  19409. -+ atomic_or(intstatus, &bus->intstatus);
  19410. -
  19411. - brcmf_sdio_clrintr(bus);
  19412. -
  19413. 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
  19414. deleted file mode 100644
  19415. index 76ca143..0000000
  19416. --- a/package/kernel/mac80211/patches/363-0001-brcmfmac-check-all-combinations-when-setting-wiphy-s.patch
  19417. +++ /dev/null
  19418. @@ -1,46 +0,0 @@
  19419. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  19420. -Date: Thu, 20 Aug 2015 00:16:42 +0200
  19421. -Subject: [PATCH] brcmfmac: check all combinations when setting wiphy's
  19422. - addresses
  19423. -MIME-Version: 1.0
  19424. -Content-Type: text/plain; charset=UTF-8
  19425. -Content-Transfer-Encoding: 8bit
  19426. -
  19427. -Broadcom is working on better reflection of interface combinations. With
  19428. -upcoming patches we may have 1st combination supporting less interfaces
  19429. -than others.
  19430. -To don't run out of addresses check all combinations to find the one
  19431. -with the greatest max_interfaces value.
  19432. -
  19433. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  19434. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19435. ----
  19436. -
  19437. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19438. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19439. -@@ -5785,7 +5785,9 @@ static void brcmf_wiphy_wowl_params(stru
  19440. - static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
  19441. - {
  19442. - struct brcmf_pub *drvr = ifp->drvr;
  19443. -+ const struct ieee80211_iface_combination *combo;
  19444. - struct ieee80211_supported_band *band;
  19445. -+ u16 max_interfaces = 0;
  19446. - __le32 bandlist[3];
  19447. - u32 n_bands;
  19448. - int err, i;
  19449. -@@ -5798,8 +5800,13 @@ static int brcmf_setup_wiphy(struct wiph
  19450. - if (err)
  19451. - return err;
  19452. -
  19453. -- for (i = 0; i < wiphy->iface_combinations->max_interfaces &&
  19454. -- i < ARRAY_SIZE(drvr->addresses); i++) {
  19455. -+ for (i = 0, combo = wiphy->iface_combinations;
  19456. -+ i < wiphy->n_iface_combinations; i++, combo++) {
  19457. -+ max_interfaces = max(max_interfaces, combo->max_interfaces);
  19458. -+ }
  19459. -+
  19460. -+ for (i = 0; i < max_interfaces && i < ARRAY_SIZE(drvr->addresses);
  19461. -+ i++) {
  19462. - u8 *addr = drvr->addresses[i].addr;
  19463. -
  19464. - memcpy(addr, drvr->mac, ETH_ALEN);
  19465. 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
  19466. deleted file mode 100644
  19467. index c4a0720..0000000
  19468. --- a/package/kernel/mac80211/patches/363-0002-brcmfmac-correct-interface-combination-info.patch
  19469. +++ /dev/null
  19470. @@ -1,204 +0,0 @@
  19471. -From: Arend van Spriel <arend@broadcom.com>
  19472. -Date: Thu, 20 Aug 2015 22:06:03 +0200
  19473. -Subject: [PATCH] brcmfmac: correct interface combination info
  19474. -
  19475. -The interface combination provided by brcmfmac did not truly reflect
  19476. -the combinations supported by driver and/or firmware.
  19477. -
  19478. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19479. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  19480. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19481. -Reviewed-by: Pontus Fuchs <pontusf@broadcom.com>
  19482. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19483. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19484. ----
  19485. -
  19486. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19487. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19488. -@@ -5694,63 +5694,132 @@ brcmf_txrx_stypes[NUM_NL80211_IFTYPES] =
  19489. - }
  19490. - };
  19491. -
  19492. -+/**
  19493. -+ * brcmf_setup_ifmodes() - determine interface modes and combinations.
  19494. -+ *
  19495. -+ * @wiphy: wiphy object.
  19496. -+ * @ifp: interface object needed for feat module api.
  19497. -+ *
  19498. -+ * The interface modes and combinations are determined dynamically here
  19499. -+ * based on firmware functionality.
  19500. -+ *
  19501. -+ * no p2p and no mbss:
  19502. -+ *
  19503. -+ * #STA <= 1, #AP <= 1, channels = 1, 2 total
  19504. -+ *
  19505. -+ * no p2p and mbss:
  19506. -+ *
  19507. -+ * #STA <= 1, #AP <= 1, channels = 1, 2 total
  19508. -+ * #AP <= 4, matching BI, channels = 1, 4 total
  19509. -+ *
  19510. -+ * p2p, no mchan, and mbss:
  19511. -+ *
  19512. -+ * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 1, 3 total
  19513. -+ * #STA <= 1, #P2P-DEV <= 1, #AP <= 1, #P2P-CL <= 1, channels = 1, 4 total
  19514. -+ * #AP <= 4, matching BI, channels = 1, 4 total
  19515. -+ *
  19516. -+ * p2p, mchan, and mbss:
  19517. -+ *
  19518. -+ * #STA <= 1, #P2P-DEV <= 1, #{P2P-CL, P2P-GO} <= 1, channels = 2, 3 total
  19519. -+ * #STA <= 1, #P2P-DEV <= 1, #AP <= 1, #P2P-CL <= 1, channels = 1, 4 total
  19520. -+ * #AP <= 4, matching BI, channels = 1, 4 total
  19521. -+ */
  19522. - static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp)
  19523. - {
  19524. - struct ieee80211_iface_combination *combo = NULL;
  19525. -- struct ieee80211_iface_limit *limits = NULL;
  19526. -- int i = 0, max_iface_cnt;
  19527. -+ struct ieee80211_iface_limit *c0_limits = NULL;
  19528. -+ struct ieee80211_iface_limit *p2p_limits = NULL;
  19529. -+ struct ieee80211_iface_limit *mbss_limits = NULL;
  19530. -+ bool mbss, p2p;
  19531. -+ int i, c, n_combos;
  19532. -
  19533. -- combo = kzalloc(sizeof(*combo), GFP_KERNEL);
  19534. -+ mbss = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS);
  19535. -+ p2p = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P);
  19536. -+
  19537. -+ n_combos = 1 + !!p2p + !!mbss;
  19538. -+ combo = kcalloc(n_combos, sizeof(*combo), GFP_KERNEL);
  19539. - if (!combo)
  19540. - goto err;
  19541. -
  19542. -- limits = kzalloc(sizeof(*limits) * 4, GFP_KERNEL);
  19543. -- if (!limits)
  19544. -+ c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
  19545. -+ if (!c0_limits)
  19546. - goto err;
  19547. -
  19548. -+ if (p2p) {
  19549. -+ p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
  19550. -+ if (!p2p_limits)
  19551. -+ goto err;
  19552. -+ }
  19553. -+
  19554. -+ if (mbss) {
  19555. -+ mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
  19556. -+ if (!mbss_limits)
  19557. -+ goto err;
  19558. -+ }
  19559. -+
  19560. - wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  19561. - BIT(NL80211_IFTYPE_ADHOC) |
  19562. - BIT(NL80211_IFTYPE_AP);
  19563. -
  19564. -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  19565. -- combo->num_different_channels = 2;
  19566. -- else
  19567. -- combo->num_different_channels = 1;
  19568. --
  19569. -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) {
  19570. -- limits[i].max = 1;
  19571. -- limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  19572. -- limits[i].max = 4;
  19573. -- limits[i++].types = BIT(NL80211_IFTYPE_AP);
  19574. -- max_iface_cnt = 5;
  19575. -- } else {
  19576. -- limits[i].max = 2;
  19577. -- limits[i++].types = BIT(NL80211_IFTYPE_STATION) |
  19578. -- BIT(NL80211_IFTYPE_AP);
  19579. -- max_iface_cnt = 2;
  19580. -- }
  19581. --
  19582. -- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P)) {
  19583. -+ c = 0;
  19584. -+ i = 0;
  19585. -+ combo[c].num_different_channels = 1;
  19586. -+ c0_limits[i].max = 1;
  19587. -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  19588. -+ if (p2p) {
  19589. -+ if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
  19590. -+ combo[c].num_different_channels = 2;
  19591. - wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) |
  19592. - BIT(NL80211_IFTYPE_P2P_GO) |
  19593. - BIT(NL80211_IFTYPE_P2P_DEVICE);
  19594. -- limits[i].max = 1;
  19595. -- limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  19596. -- BIT(NL80211_IFTYPE_P2P_GO);
  19597. -- limits[i].max = 1;
  19598. -- limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  19599. -- max_iface_cnt += 2;
  19600. -- }
  19601. -- combo->max_interfaces = max_iface_cnt;
  19602. -- combo->limits = limits;
  19603. -- combo->n_limits = i;
  19604. -+ c0_limits[i].max = 1;
  19605. -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  19606. -+ c0_limits[i].max = 1;
  19607. -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  19608. -+ BIT(NL80211_IFTYPE_P2P_GO);
  19609. -+ } else {
  19610. -+ c0_limits[i].max = 1;
  19611. -+ c0_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  19612. -+ }
  19613. -+ combo[c].max_interfaces = i;
  19614. -+ combo[c].n_limits = i;
  19615. -+ combo[c].limits = c0_limits;
  19616. -+
  19617. -+ if (p2p) {
  19618. -+ c++;
  19619. -+ i = 0;
  19620. -+ combo[c].num_different_channels = 1;
  19621. -+ p2p_limits[i].max = 1;
  19622. -+ p2p_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  19623. -+ p2p_limits[i].max = 1;
  19624. -+ p2p_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  19625. -+ p2p_limits[i].max = 1;
  19626. -+ p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT);
  19627. -+ p2p_limits[i].max = 1;
  19628. -+ p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  19629. -+ combo[c].max_interfaces = i;
  19630. -+ combo[c].n_limits = i;
  19631. -+ combo[c].limits = p2p_limits;
  19632. -+ }
  19633. -
  19634. -+ if (mbss) {
  19635. -+ c++;
  19636. -+ combo[c].beacon_int_infra_match = true;
  19637. -+ combo[c].num_different_channels = 1;
  19638. -+ mbss_limits[0].max = 4;
  19639. -+ mbss_limits[0].types = BIT(NL80211_IFTYPE_AP);
  19640. -+ combo[c].max_interfaces = 4;
  19641. -+ combo[c].n_limits = 1;
  19642. -+ combo[c].limits = mbss_limits;
  19643. -+ }
  19644. -+ wiphy->n_iface_combinations = n_combos;
  19645. - wiphy->iface_combinations = combo;
  19646. -- wiphy->n_iface_combinations = 1;
  19647. - return 0;
  19648. -
  19649. - err:
  19650. -- kfree(limits);
  19651. -+ kfree(c0_limits);
  19652. -+ kfree(p2p_limits);
  19653. -+ kfree(mbss_limits);
  19654. - kfree(combo);
  19655. - return -ENOMEM;
  19656. - }
  19657. -@@ -6079,11 +6148,15 @@ static void brcmf_cfg80211_reg_notifier(
  19658. -
  19659. - static void brcmf_free_wiphy(struct wiphy *wiphy)
  19660. - {
  19661. -+ int i;
  19662. -+
  19663. - if (!wiphy)
  19664. - return;
  19665. -
  19666. -- if (wiphy->iface_combinations)
  19667. -- kfree(wiphy->iface_combinations->limits);
  19668. -+ if (wiphy->iface_combinations) {
  19669. -+ for (i = 0; i < wiphy->n_iface_combinations; i++)
  19670. -+ kfree(wiphy->iface_combinations[i].limits);
  19671. -+ }
  19672. - kfree(wiphy->iface_combinations);
  19673. - if (wiphy->bands[IEEE80211_BAND_2GHZ]) {
  19674. - kfree(wiphy->bands[IEEE80211_BAND_2GHZ]->channels);
  19675. 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
  19676. deleted file mode 100644
  19677. index 9768ef2..0000000
  19678. --- a/package/kernel/mac80211/patches/363-0003-brcmfmac-add-debugfs-entry-for-msgbuf-statistics.patch
  19679. +++ /dev/null
  19680. @@ -1,87 +0,0 @@
  19681. -From: Franky Lin <frankyl@broadcom.com>
  19682. -Date: Thu, 20 Aug 2015 22:06:04 +0200
  19683. -Subject: [PATCH] brcmfmac: add debugfs entry for msgbuf statistics
  19684. -
  19685. -Expose ring buffer read/write pointers and other useful statistics
  19686. -through debugfs.
  19687. -
  19688. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  19689. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19690. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19691. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  19692. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19693. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19694. ----
  19695. -
  19696. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  19697. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  19698. -@@ -1360,6 +1360,60 @@ void brcmf_msgbuf_delete_flowring(struct
  19699. - }
  19700. - }
  19701. -
  19702. -+#ifdef DEBUG
  19703. -+static int brcmf_msgbuf_stats_read(struct seq_file *seq, void *data)
  19704. -+{
  19705. -+ struct brcmf_bus *bus_if = dev_get_drvdata(seq->private);
  19706. -+ struct brcmf_pub *drvr = bus_if->drvr;
  19707. -+ struct brcmf_msgbuf *msgbuf = (struct brcmf_msgbuf *)drvr->proto->pd;
  19708. -+ struct brcmf_commonring *commonring;
  19709. -+ u16 i;
  19710. -+ struct brcmf_flowring_ring *ring;
  19711. -+ struct brcmf_flowring_hash *hash;
  19712. -+
  19713. -+ commonring = msgbuf->commonrings[BRCMF_H2D_MSGRING_CONTROL_SUBMIT];
  19714. -+ seq_printf(seq, "h2d_ctl_submit: rp %4u, wp %4u, depth %4u\n",
  19715. -+ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  19716. -+ commonring = msgbuf->commonrings[BRCMF_H2D_MSGRING_RXPOST_SUBMIT];
  19717. -+ seq_printf(seq, "h2d_rx_submit: rp %4u, wp %4u, depth %4u\n",
  19718. -+ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  19719. -+ commonring = msgbuf->commonrings[BRCMF_D2H_MSGRING_CONTROL_COMPLETE];
  19720. -+ seq_printf(seq, "d2h_ctl_cmplt: rp %4u, wp %4u, depth %4u\n",
  19721. -+ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  19722. -+ commonring = msgbuf->commonrings[BRCMF_D2H_MSGRING_TX_COMPLETE];
  19723. -+ seq_printf(seq, "d2h_tx_cmplt: rp %4u, wp %4u, depth %4u\n",
  19724. -+ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  19725. -+ commonring = msgbuf->commonrings[BRCMF_D2H_MSGRING_RX_COMPLETE];
  19726. -+ seq_printf(seq, "d2h_rx_cmplt: rp %4u, wp %4u, depth %4u\n",
  19727. -+ commonring->r_ptr, commonring->w_ptr, commonring->depth);
  19728. -+
  19729. -+ seq_printf(seq, "\nh2d_flowrings: depth %u\n",
  19730. -+ BRCMF_H2D_TXFLOWRING_MAX_ITEM);
  19731. -+ seq_puts(seq, "Active flowrings:\n");
  19732. -+ hash = msgbuf->flow->hash;
  19733. -+ for (i = 0; i < msgbuf->flow->nrofrings; i++) {
  19734. -+ if (!msgbuf->flow->rings[i])
  19735. -+ continue;
  19736. -+ ring = msgbuf->flow->rings[i];
  19737. -+ if (ring->status != RING_OPEN)
  19738. -+ continue;
  19739. -+ commonring = msgbuf->flowrings[i];
  19740. -+ hash = &msgbuf->flow->hash[ring->hash_id];
  19741. -+ seq_printf(seq, "id %3u: rp %4u, wp %4u, qlen %4u, blocked %u\n"
  19742. -+ " ifidx %u, fifo %u, da %pM\n",
  19743. -+ i, commonring->r_ptr, commonring->w_ptr,
  19744. -+ skb_queue_len(&ring->skblist), ring->blocked,
  19745. -+ hash->ifidx, hash->fifo, hash->mac);
  19746. -+ }
  19747. -+
  19748. -+ return 0;
  19749. -+}
  19750. -+#else
  19751. -+static int brcmf_msgbuf_stats_read(struct seq_file *seq, void *data)
  19752. -+{
  19753. -+ return 0;
  19754. -+}
  19755. -+#endif
  19756. -
  19757. - int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr)
  19758. - {
  19759. -@@ -1460,6 +1514,8 @@ int brcmf_proto_msgbuf_attach(struct brc
  19760. - spin_lock_init(&msgbuf->flowring_work_lock);
  19761. - INIT_LIST_HEAD(&msgbuf->work_queue);
  19762. -
  19763. -+ brcmf_debugfs_add_entry(drvr, "msgbuf_stats", brcmf_msgbuf_stats_read);
  19764. -+
  19765. - return 0;
  19766. -
  19767. - fail:
  19768. 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
  19769. deleted file mode 100644
  19770. index 2b84cf9..0000000
  19771. --- a/package/kernel/mac80211/patches/363-0004-brcmfmac-make-use-of-cfg80211_check_combinations.patch
  19772. +++ /dev/null
  19773. @@ -1,83 +0,0 @@
  19774. -From: Arend van Spriel <arend@broadcom.com>
  19775. -Date: Thu, 20 Aug 2015 22:06:05 +0200
  19776. -Subject: [PATCH] brcmfmac: make use of cfg80211_check_combinations()
  19777. -
  19778. -Use cfg80211_check_combinations() so we can bail out early when an
  19779. -interface add or change results in an invalid combination.
  19780. -
  19781. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19782. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  19783. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19784. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19785. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19786. ----
  19787. -
  19788. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19789. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  19790. -@@ -469,6 +469,36 @@ brcmf_find_wpsie(const u8 *parse, u32 le
  19791. - return NULL;
  19792. - }
  19793. -
  19794. -+static int brcmf_vif_change_validate(struct brcmf_cfg80211_info *cfg,
  19795. -+ struct brcmf_cfg80211_vif *vif,
  19796. -+ enum nl80211_iftype new_type)
  19797. -+{
  19798. -+ int iftype_num[NUM_NL80211_IFTYPES];
  19799. -+ struct brcmf_cfg80211_vif *pos;
  19800. -+
  19801. -+ memset(&iftype_num[0], 0, sizeof(iftype_num));
  19802. -+ list_for_each_entry(pos, &cfg->vif_list, list)
  19803. -+ if (pos == vif)
  19804. -+ iftype_num[new_type]++;
  19805. -+ else
  19806. -+ iftype_num[pos->wdev.iftype]++;
  19807. -+
  19808. -+ return cfg80211_check_combinations(cfg->wiphy, 1, 0, iftype_num);
  19809. -+}
  19810. -+
  19811. -+static int brcmf_vif_add_validate(struct brcmf_cfg80211_info *cfg,
  19812. -+ enum nl80211_iftype new_type)
  19813. -+{
  19814. -+ int iftype_num[NUM_NL80211_IFTYPES];
  19815. -+ struct brcmf_cfg80211_vif *pos;
  19816. -+
  19817. -+ memset(&iftype_num[0], 0, sizeof(iftype_num));
  19818. -+ list_for_each_entry(pos, &cfg->vif_list, list)
  19819. -+ iftype_num[pos->wdev.iftype]++;
  19820. -+
  19821. -+ iftype_num[new_type]++;
  19822. -+ return cfg80211_check_combinations(cfg->wiphy, 1, 0, iftype_num);
  19823. -+}
  19824. -
  19825. - static void convert_key_from_CPU(struct brcmf_wsec_key *key,
  19826. - struct brcmf_wsec_key_le *key_le)
  19827. -@@ -662,8 +692,14 @@ static struct wireless_dev *brcmf_cfg802
  19828. - struct vif_params *params)
  19829. - {
  19830. - struct wireless_dev *wdev;
  19831. -+ int err;
  19832. -
  19833. - brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
  19834. -+ err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
  19835. -+ if (err) {
  19836. -+ brcmf_err("iface validation failed: err=%d\n", err);
  19837. -+ return ERR_PTR(err);
  19838. -+ }
  19839. - switch (type) {
  19840. - case NL80211_IFTYPE_ADHOC:
  19841. - case NL80211_IFTYPE_STATION:
  19842. -@@ -822,8 +858,12 @@ brcmf_cfg80211_change_iface(struct wiphy
  19843. - s32 ap = 0;
  19844. - s32 err = 0;
  19845. -
  19846. -- brcmf_dbg(TRACE, "Enter, ndev=%p, type=%d\n", ndev, type);
  19847. --
  19848. -+ brcmf_dbg(TRACE, "Enter, idx=%d, type=%d\n", ifp->bssidx, type);
  19849. -+ err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type);
  19850. -+ if (err) {
  19851. -+ brcmf_err("iface validation failed: err=%d\n", err);
  19852. -+ return err;
  19853. -+ }
  19854. - switch (type) {
  19855. - case NL80211_IFTYPE_MONITOR:
  19856. - case NL80211_IFTYPE_WDS:
  19857. 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
  19858. deleted file mode 100644
  19859. index 2d5f7b9..0000000
  19860. --- a/package/kernel/mac80211/patches/363-0005-brcmfmac-block-the-correct-flowring-when-backup-queu.patch
  19861. +++ /dev/null
  19862. @@ -1,48 +0,0 @@
  19863. -From: Franky Lin <frankyl@broadcom.com>
  19864. -Date: Thu, 20 Aug 2015 22:06:06 +0200
  19865. -Subject: [PATCH] brcmfmac: block the correct flowring when backup queue
  19866. - overflow
  19867. -
  19868. -brcmf_flowring_block blocks the last active flowring under the same
  19869. -interface instead of the one provided by caller. This could lead to a
  19870. -dead lock of netif stop if there are more than one flowring under the
  19871. -interface and the traffic is high enough so brcmf_flowring_enqueue can
  19872. -not unblock the ring right away.
  19873. -
  19874. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19875. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19876. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  19877. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19878. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19879. ----
  19880. -
  19881. ---- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  19882. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  19883. -@@ -194,11 +194,15 @@ static void brcmf_flowring_block(struct
  19884. - spin_lock_irqsave(&flow->block_lock, flags);
  19885. -
  19886. - ring = flow->rings[flowid];
  19887. -+ if (ring->blocked == blocked) {
  19888. -+ spin_unlock_irqrestore(&flow->block_lock, flags);
  19889. -+ return;
  19890. -+ }
  19891. - ifidx = brcmf_flowring_ifidx_get(flow, flowid);
  19892. -
  19893. - currently_blocked = false;
  19894. - for (i = 0; i < flow->nrofrings; i++) {
  19895. -- if (flow->rings[i]) {
  19896. -+ if ((flow->rings[i]) && (i != flowid)) {
  19897. - ring = flow->rings[i];
  19898. - if ((ring->status == RING_OPEN) &&
  19899. - (brcmf_flowring_ifidx_get(flow, i) == ifidx)) {
  19900. -@@ -209,8 +213,8 @@ static void brcmf_flowring_block(struct
  19901. - }
  19902. - }
  19903. - }
  19904. -- ring->blocked = blocked;
  19905. -- if (currently_blocked == blocked) {
  19906. -+ flow->rings[flowid]->blocked = blocked;
  19907. -+ if (currently_blocked) {
  19908. - spin_unlock_irqrestore(&flow->block_lock, flags);
  19909. - return;
  19910. - }
  19911. 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
  19912. deleted file mode 100644
  19913. index 7378401..0000000
  19914. --- a/package/kernel/mac80211/patches/363-0006-brcmfmac-bump-highest-event-number-for-4339-firmware.patch
  19915. +++ /dev/null
  19916. @@ -1,52 +0,0 @@
  19917. -From: Arend van Spriel <arend@broadcom.com>
  19918. -Date: Thu, 20 Aug 2015 22:06:07 +0200
  19919. -Subject: [PATCH] brcmfmac: bump highest event number for 4339 firmware
  19920. -
  19921. -The event mask length is determined by the highest event number
  19922. -that is specified in the driver. When this length is shorter than
  19923. -firmware expects setting event mask will fail and device becomes
  19924. -pretty useless. This issue was reported with bcm4339 firmware that
  19925. -was recently released.
  19926. -
  19927. -Reported-by: Pontus Fuchs <pontusf@broadcom.com>
  19928. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19929. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  19930. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19931. -Reviewed-by: Pontus Fuchs <pontusf@broadcom.com>
  19932. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19933. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19934. ----
  19935. -
  19936. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  19937. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  19938. -@@ -85,7 +85,6 @@ struct brcmf_event;
  19939. - BRCMF_ENUM_DEF(IF, 54) \
  19940. - BRCMF_ENUM_DEF(P2P_DISC_LISTEN_COMPLETE, 55) \
  19941. - BRCMF_ENUM_DEF(RSSI, 56) \
  19942. -- BRCMF_ENUM_DEF(PFN_SCAN_COMPLETE, 57) \
  19943. - BRCMF_ENUM_DEF(EXTLOG_MSG, 58) \
  19944. - BRCMF_ENUM_DEF(ACTION_FRAME, 59) \
  19945. - BRCMF_ENUM_DEF(ACTION_FRAME_COMPLETE, 60) \
  19946. -@@ -103,8 +102,7 @@ struct brcmf_event;
  19947. - BRCMF_ENUM_DEF(FIFO_CREDIT_MAP, 74) \
  19948. - BRCMF_ENUM_DEF(ACTION_FRAME_RX, 75) \
  19949. - BRCMF_ENUM_DEF(TDLS_PEER_EVENT, 92) \
  19950. -- BRCMF_ENUM_DEF(BCMC_CREDIT_SUPPORT, 127) \
  19951. -- BRCMF_ENUM_DEF(PSTA_PRIMARY_INTF_IND, 128)
  19952. -+ BRCMF_ENUM_DEF(BCMC_CREDIT_SUPPORT, 127)
  19953. -
  19954. - #define BRCMF_ENUM_DEF(id, val) \
  19955. - BRCMF_E_##id = (val),
  19956. -@@ -112,7 +110,11 @@ struct brcmf_event;
  19957. - /* firmware event codes sent by the dongle */
  19958. - enum brcmf_fweh_event_code {
  19959. - BRCMF_FWEH_EVENT_ENUM_DEFLIST
  19960. -- BRCMF_E_LAST
  19961. -+ /* this determines event mask length which must match
  19962. -+ * minimum length check in device firmware so it is
  19963. -+ * hard-coded here.
  19964. -+ */
  19965. -+ BRCMF_E_LAST = 139
  19966. - };
  19967. - #undef BRCMF_ENUM_DEF
  19968. -
  19969. 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
  19970. deleted file mode 100644
  19971. index 97444b3..0000000
  19972. --- a/package/kernel/mac80211/patches/365-0001-brcmfmac-consolidate-ifp-lookup-in-driver-core.patch
  19973. +++ /dev/null
  19974. @@ -1,138 +0,0 @@
  19975. -From: Arend van Spriel <arend@broadcom.com>
  19976. -Date: Wed, 26 Aug 2015 22:14:53 +0200
  19977. -Subject: [PATCH] brcmfmac: consolidate ifp lookup in driver core
  19978. -
  19979. -In rx path the firmware provide an interface index which is used to
  19980. -map to a struct brcmf_if instance. However, this involves some trick
  19981. -that is done in two places. This is changed by having driver core
  19982. -providing brcmf_get_ifp() function.
  19983. -
  19984. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  19985. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  19986. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  19987. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  19988. ----
  19989. -
  19990. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  19991. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  19992. -@@ -276,6 +276,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  19993. - struct sk_buff *pktbuf)
  19994. - {
  19995. - struct brcmf_proto_bcdc_header *h;
  19996. -+ struct brcmf_if *ifp;
  19997. -
  19998. - brcmf_dbg(BCDC, "Enter\n");
  19999. -
  20000. -@@ -289,30 +290,21 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  20001. - trace_brcmf_bcdchdr(pktbuf->data);
  20002. - h = (struct brcmf_proto_bcdc_header *)(pktbuf->data);
  20003. -
  20004. -- *ifidx = BCDC_GET_IF_IDX(h);
  20005. -- if (*ifidx >= BRCMF_MAX_IFS) {
  20006. -- brcmf_err("rx data ifnum out of range (%d)\n", *ifidx);
  20007. -+ ifp = brcmf_get_ifp(drvr, BCDC_GET_IF_IDX(h));
  20008. -+ if (IS_ERR_OR_NULL(ifp)) {
  20009. -+ brcmf_dbg(INFO, "no matching ifp found\n");
  20010. - return -EBADE;
  20011. - }
  20012. -- /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  20013. -- * events this is easy because it contains the bssidx which maps
  20014. -- * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  20015. -- * bssidx 1 is used for p2p0 and no data can be received or
  20016. -- * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  20017. -- */
  20018. -- if (*ifidx)
  20019. -- (*ifidx)++;
  20020. --
  20021. - if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) !=
  20022. - BCDC_PROTO_VER) {
  20023. - brcmf_err("%s: non-BCDC packet received, flags 0x%x\n",
  20024. -- brcmf_ifname(drvr, *ifidx), h->flags);
  20025. -+ brcmf_ifname(drvr, ifp->ifidx), h->flags);
  20026. - return -EBADE;
  20027. - }
  20028. -
  20029. - if (h->flags & BCDC_FLAG_SUM_GOOD) {
  20030. - brcmf_dbg(BCDC, "%s: BDC rcv, good checksum, flags 0x%x\n",
  20031. -- brcmf_ifname(drvr, *ifidx), h->flags);
  20032. -+ brcmf_ifname(drvr, ifp->ifidx), h->flags);
  20033. - pktbuf->ip_summed = CHECKSUM_UNNECESSARY;
  20034. - }
  20035. -
  20036. -@@ -320,12 +312,15 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  20037. -
  20038. - skb_pull(pktbuf, BCDC_HEADER_LEN);
  20039. - if (do_fws)
  20040. -- brcmf_fws_hdrpull(drvr, *ifidx, h->data_offset << 2, pktbuf);
  20041. -+ brcmf_fws_hdrpull(drvr, ifp->ifidx, h->data_offset << 2,
  20042. -+ pktbuf);
  20043. - else
  20044. - skb_pull(pktbuf, h->data_offset << 2);
  20045. -
  20046. - if (pktbuf->len == 0)
  20047. - return -ENODATA;
  20048. -+
  20049. -+ *ifidx = ifp->ifidx;
  20050. - return 0;
  20051. - }
  20052. -
  20053. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20054. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20055. -@@ -83,6 +83,25 @@ char *brcmf_ifname(struct brcmf_pub *drv
  20056. - return "<if_none>";
  20057. - }
  20058. -
  20059. -+struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx)
  20060. -+{
  20061. -+ if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  20062. -+ brcmf_err("ifidx %d out of range\n", ifidx);
  20063. -+ return ERR_PTR(-ERANGE);
  20064. -+ }
  20065. -+
  20066. -+ /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  20067. -+ * events this is easy because it contains the bssidx which maps
  20068. -+ * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  20069. -+ * bssidx 1 is used for p2p0 and no data can be received or
  20070. -+ * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  20071. -+ */
  20072. -+ if (ifidx)
  20073. -+ ifidx++;
  20074. -+
  20075. -+ return drvr->iflist[ifidx];
  20076. -+}
  20077. -+
  20078. - static void _brcmf_set_multicast_list(struct work_struct *work)
  20079. - {
  20080. - struct brcmf_if *ifp;
  20081. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20082. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20083. -@@ -202,7 +202,7 @@ int brcmf_netdev_wait_pend8021x(struct b
  20084. -
  20085. - /* Return pointer to interface name */
  20086. - char *brcmf_ifname(struct brcmf_pub *drvr, int idx);
  20087. --
  20088. -+struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  20089. - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  20090. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  20091. - char *name, u8 *mac_addr);
  20092. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  20093. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  20094. -@@ -1081,16 +1081,8 @@ brcmf_msgbuf_rx_skb(struct brcmf_msgbuf
  20095. - {
  20096. - struct brcmf_if *ifp;
  20097. -
  20098. -- /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  20099. -- * events this is easy because it contains the bssidx which maps
  20100. -- * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  20101. -- * bssidx 1 is used for p2p0 and no data can be received or
  20102. -- * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  20103. -- */
  20104. -- if (ifidx)
  20105. -- (ifidx)++;
  20106. -- ifp = msgbuf->drvr->iflist[ifidx];
  20107. -- if (!ifp || !ifp->ndev) {
  20108. -+ ifp = brcmf_get_ifp(msgbuf->drvr, ifidx);
  20109. -+ if (IS_ERR_OR_NULL(ifp) || !ifp->ndev) {
  20110. - brcmf_err("Received pkt for invalid ifidx %d\n", ifidx);
  20111. - brcmu_pkt_buf_free_skb(skb);
  20112. - return;
  20113. 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
  20114. deleted file mode 100644
  20115. index 632714c..0000000
  20116. --- a/package/kernel/mac80211/patches/365-0002-brcmfmac-make-brcmf_proto_hdrpull-return-struct-brcm.patch
  20117. +++ /dev/null
  20118. @@ -1,222 +0,0 @@
  20119. -From: Arend van Spriel <arend@broadcom.com>
  20120. -Date: Wed, 26 Aug 2015 22:14:54 +0200
  20121. -Subject: [PATCH] brcmfmac: make brcmf_proto_hdrpull() return struct
  20122. - brcmf_if instance
  20123. -
  20124. -Avoid spreading the ifidx in the driver, but have it return the
  20125. -struct brcmf_if instance.
  20126. -
  20127. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20128. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20129. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20130. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20131. ----
  20132. -
  20133. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  20134. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  20135. -@@ -272,11 +272,11 @@ brcmf_proto_bcdc_hdrpush(struct brcmf_pu
  20136. - }
  20137. -
  20138. - static int
  20139. --brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool do_fws, u8 *ifidx,
  20140. -- struct sk_buff *pktbuf)
  20141. -+brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool do_fws,
  20142. -+ struct sk_buff *pktbuf, struct brcmf_if **ifp)
  20143. - {
  20144. - struct brcmf_proto_bcdc_header *h;
  20145. -- struct brcmf_if *ifp;
  20146. -+ struct brcmf_if *tmp_if;
  20147. -
  20148. - brcmf_dbg(BCDC, "Enter\n");
  20149. -
  20150. -@@ -290,21 +290,21 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  20151. - trace_brcmf_bcdchdr(pktbuf->data);
  20152. - h = (struct brcmf_proto_bcdc_header *)(pktbuf->data);
  20153. -
  20154. -- ifp = brcmf_get_ifp(drvr, BCDC_GET_IF_IDX(h));
  20155. -- if (IS_ERR_OR_NULL(ifp)) {
  20156. -+ tmp_if = brcmf_get_ifp(drvr, BCDC_GET_IF_IDX(h));
  20157. -+ if (!tmp_if) {
  20158. - brcmf_dbg(INFO, "no matching ifp found\n");
  20159. - return -EBADE;
  20160. - }
  20161. - if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) !=
  20162. - BCDC_PROTO_VER) {
  20163. - brcmf_err("%s: non-BCDC packet received, flags 0x%x\n",
  20164. -- brcmf_ifname(drvr, ifp->ifidx), h->flags);
  20165. -+ brcmf_ifname(drvr, tmp_if->ifidx), h->flags);
  20166. - return -EBADE;
  20167. - }
  20168. -
  20169. - if (h->flags & BCDC_FLAG_SUM_GOOD) {
  20170. - brcmf_dbg(BCDC, "%s: BDC rcv, good checksum, flags 0x%x\n",
  20171. -- brcmf_ifname(drvr, ifp->ifidx), h->flags);
  20172. -+ brcmf_ifname(drvr, tmp_if->ifidx), h->flags);
  20173. - pktbuf->ip_summed = CHECKSUM_UNNECESSARY;
  20174. - }
  20175. -
  20176. -@@ -312,7 +312,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  20177. -
  20178. - skb_pull(pktbuf, BCDC_HEADER_LEN);
  20179. - if (do_fws)
  20180. -- brcmf_fws_hdrpull(drvr, ifp->ifidx, h->data_offset << 2,
  20181. -+ brcmf_fws_hdrpull(drvr, tmp_if->ifidx, h->data_offset << 2,
  20182. - pktbuf);
  20183. - else
  20184. - skb_pull(pktbuf, h->data_offset << 2);
  20185. -@@ -320,7 +320,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  20186. - if (pktbuf->len == 0)
  20187. - return -ENODATA;
  20188. -
  20189. -- *ifidx = ifp->ifidx;
  20190. -+ *ifp = tmp_if;
  20191. - return 0;
  20192. - }
  20193. -
  20194. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20195. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20196. -@@ -87,7 +87,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
  20197. - {
  20198. - if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  20199. - brcmf_err("ifidx %d out of range\n", ifidx);
  20200. -- return ERR_PTR(-ERANGE);
  20201. -+ return NULL;
  20202. - }
  20203. -
  20204. - /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  20205. -@@ -539,17 +539,15 @@ void brcmf_rx_frame(struct device *dev,
  20206. - struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  20207. - struct brcmf_pub *drvr = bus_if->drvr;
  20208. - struct brcmf_skb_reorder_data *rd;
  20209. -- u8 ifidx;
  20210. - int ret;
  20211. -
  20212. - brcmf_dbg(DATA, "Enter: %s: rxp=%p\n", dev_name(dev), skb);
  20213. -
  20214. - /* process and remove protocol-specific header */
  20215. -- ret = brcmf_proto_hdrpull(drvr, true, &ifidx, skb);
  20216. -- ifp = drvr->iflist[ifidx];
  20217. -+ ret = brcmf_proto_hdrpull(drvr, true, skb, &ifp);
  20218. -
  20219. - if (ret || !ifp || !ifp->ndev) {
  20220. -- if ((ret != -ENODATA) && ifp)
  20221. -+ if (ret != -ENODATA && ifp)
  20222. - ifp->stats.rx_errors++;
  20223. - brcmu_pkt_buf_free_skb(skb);
  20224. - return;
  20225. -@@ -592,17 +590,17 @@ void brcmf_txcomplete(struct device *dev
  20226. - {
  20227. - struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  20228. - struct brcmf_pub *drvr = bus_if->drvr;
  20229. -- u8 ifidx;
  20230. -+ struct brcmf_if *ifp;
  20231. -
  20232. - /* await txstatus signal for firmware if active */
  20233. - if (brcmf_fws_fc_active(drvr->fws)) {
  20234. - if (!success)
  20235. - brcmf_fws_bustxfail(drvr->fws, txp);
  20236. - } else {
  20237. -- if (brcmf_proto_hdrpull(drvr, false, &ifidx, txp))
  20238. -+ if (brcmf_proto_hdrpull(drvr, false, txp, &ifp))
  20239. - brcmu_pkt_buf_free_skb(txp);
  20240. - else
  20241. -- brcmf_txfinalize(drvr, txp, ifidx, success);
  20242. -+ brcmf_txfinalize(drvr, txp, ifp->ifidx, success);
  20243. - }
  20244. - }
  20245. -
  20246. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  20247. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  20248. -@@ -1448,7 +1448,7 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  20249. - struct sk_buff *skb;
  20250. - struct brcmf_skbuff_cb *skcb;
  20251. - struct brcmf_fws_mac_descriptor *entry = NULL;
  20252. -- u8 ifidx;
  20253. -+ struct brcmf_if *ifp;
  20254. -
  20255. - brcmf_dbg(DATA, "flags %d\n", flags);
  20256. -
  20257. -@@ -1497,15 +1497,16 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  20258. - }
  20259. - brcmf_fws_macdesc_return_req_credit(skb);
  20260. -
  20261. -- if (brcmf_proto_hdrpull(fws->drvr, false, &ifidx, skb)) {
  20262. -+ ret = brcmf_proto_hdrpull(fws->drvr, false, skb, &ifp);
  20263. -+ if (ret) {
  20264. - brcmu_pkt_buf_free_skb(skb);
  20265. - return -EINVAL;
  20266. - }
  20267. - if (!remove_from_hanger)
  20268. -- ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifidx,
  20269. -+ ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
  20270. - genbit, seq);
  20271. - if (remove_from_hanger || ret)
  20272. -- brcmf_txfinalize(fws->drvr, skb, ifidx, true);
  20273. -+ brcmf_txfinalize(fws->drvr, skb, ifp->ifidx, true);
  20274. -
  20275. - return 0;
  20276. - }
  20277. -@@ -1848,7 +1849,7 @@ static int brcmf_fws_commit_skb(struct b
  20278. - entry->transit_count--;
  20279. - if (entry->suppressed)
  20280. - entry->suppr_transit_count--;
  20281. -- brcmf_proto_hdrpull(fws->drvr, false, &ifidx, skb);
  20282. -+ (void)brcmf_proto_hdrpull(fws->drvr, false, skb, NULL);
  20283. - goto rollback;
  20284. - }
  20285. -
  20286. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  20287. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  20288. -@@ -522,7 +522,7 @@ static int brcmf_msgbuf_set_dcmd(struct
  20289. -
  20290. -
  20291. - static int brcmf_msgbuf_hdrpull(struct brcmf_pub *drvr, bool do_fws,
  20292. -- u8 *ifidx, struct sk_buff *skb)
  20293. -+ struct sk_buff *skb, struct brcmf_if **ifp)
  20294. - {
  20295. - return -ENODEV;
  20296. - }
  20297. -@@ -1082,7 +1082,7 @@ brcmf_msgbuf_rx_skb(struct brcmf_msgbuf
  20298. - struct brcmf_if *ifp;
  20299. -
  20300. - ifp = brcmf_get_ifp(msgbuf->drvr, ifidx);
  20301. -- if (IS_ERR_OR_NULL(ifp) || !ifp->ndev) {
  20302. -+ if (!ifp || !ifp->ndev) {
  20303. - brcmf_err("Received pkt for invalid ifidx %d\n", ifidx);
  20304. - brcmu_pkt_buf_free_skb(skb);
  20305. - return;
  20306. ---- a/drivers/net/wireless/brcm80211/brcmfmac/proto.h
  20307. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/proto.h
  20308. -@@ -24,8 +24,8 @@ enum proto_addr_mode {
  20309. -
  20310. -
  20311. - struct brcmf_proto {
  20312. -- int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws, u8 *ifidx,
  20313. -- struct sk_buff *skb);
  20314. -+ int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws,
  20315. -+ struct sk_buff *skb, struct brcmf_if **ifp);
  20316. - int (*query_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd,
  20317. - void *buf, uint len);
  20318. - int (*set_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd, void *buf,
  20319. -@@ -46,9 +46,19 @@ int brcmf_proto_attach(struct brcmf_pub
  20320. - void brcmf_proto_detach(struct brcmf_pub *drvr);
  20321. -
  20322. - static inline int brcmf_proto_hdrpull(struct brcmf_pub *drvr, bool do_fws,
  20323. -- u8 *ifidx, struct sk_buff *skb)
  20324. -+ struct sk_buff *skb,
  20325. -+ struct brcmf_if **ifp)
  20326. - {
  20327. -- return drvr->proto->hdrpull(drvr, do_fws, ifidx, skb);
  20328. -+ struct brcmf_if *tmp = NULL;
  20329. -+
  20330. -+ /* assure protocol is always called with
  20331. -+ * non-null initialized pointer.
  20332. -+ */
  20333. -+ if (ifp)
  20334. -+ *ifp = NULL;
  20335. -+ else
  20336. -+ ifp = &tmp;
  20337. -+ return drvr->proto->hdrpull(drvr, do_fws, skb, ifp);
  20338. - }
  20339. - static inline int brcmf_proto_query_dcmd(struct brcmf_pub *drvr, int ifidx,
  20340. - uint cmd, void *buf, uint len)
  20341. 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
  20342. deleted file mode 100644
  20343. index 2d15a77..0000000
  20344. --- a/package/kernel/mac80211/patches/365-0003-brcmfmac-change-parameters-for-brcmf_remove_interfac.patch
  20345. +++ /dev/null
  20346. @@ -1,87 +0,0 @@
  20347. -From: Arend van Spriel <arend@broadcom.com>
  20348. -Date: Wed, 26 Aug 2015 22:14:55 +0200
  20349. -Subject: [PATCH] brcmfmac: change parameters for
  20350. - brcmf_remove_interface()
  20351. -
  20352. -Just pass the interface to be removed, ie. the struct brcmf_if instance.
  20353. -
  20354. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20355. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20356. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20357. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20358. ----
  20359. -
  20360. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  20361. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  20362. -@@ -4982,7 +4982,7 @@ brcmf_notify_connect_status_ap(struct br
  20363. - brcmf_dbg(CONN, "AP mode link down\n");
  20364. - complete(&cfg->vif_disabled);
  20365. - if (ifp->vif->mbss)
  20366. -- brcmf_remove_interface(ifp->drvr, ifp->bssidx);
  20367. -+ brcmf_remove_interface(ifp);
  20368. - return 0;
  20369. - }
  20370. -
  20371. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20372. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20373. -@@ -887,12 +887,13 @@ static void brcmf_del_if(struct brcmf_pu
  20374. - }
  20375. - }
  20376. -
  20377. --void brcmf_remove_interface(struct brcmf_pub *drvr, u32 bssidx)
  20378. -+void brcmf_remove_interface(struct brcmf_if *ifp)
  20379. - {
  20380. -- if (drvr->iflist[bssidx]) {
  20381. -- brcmf_fws_del_interface(drvr->iflist[bssidx]);
  20382. -- brcmf_del_if(drvr, bssidx);
  20383. -- }
  20384. -+ if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bssidx] != ifp))
  20385. -+ return;
  20386. -+
  20387. -+ brcmf_fws_del_interface(ifp);
  20388. -+ brcmf_del_if(ifp->drvr, ifp->bssidx);
  20389. - }
  20390. -
  20391. - int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr)
  20392. -@@ -1122,7 +1123,7 @@ void brcmf_detach(struct device *dev)
  20393. -
  20394. - /* make sure primary interface removed last */
  20395. - for (i = BRCMF_MAX_IFS-1; i > -1; i--)
  20396. -- brcmf_remove_interface(drvr, i);
  20397. -+ brcmf_remove_interface(drvr->iflist[i]);
  20398. -
  20399. - brcmf_cfg80211_detach(drvr->config);
  20400. -
  20401. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20402. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20403. -@@ -206,7 +206,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
  20404. - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  20405. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  20406. - char *name, u8 *mac_addr);
  20407. --void brcmf_remove_interface(struct brcmf_pub *drvr, u32 bssidx);
  20408. -+void brcmf_remove_interface(struct brcmf_if *ifp);
  20409. - int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  20410. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  20411. - enum brcmf_netif_stop_reason reason, bool state);
  20412. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  20413. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  20414. -@@ -222,7 +222,7 @@ static void brcmf_fweh_handle_if_event(s
  20415. - err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
  20416. -
  20417. - if (ifp && ifevent->action == BRCMF_E_IF_DEL)
  20418. -- brcmf_remove_interface(drvr, ifevent->bssidx);
  20419. -+ brcmf_remove_interface(ifp);
  20420. - }
  20421. -
  20422. - /**
  20423. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  20424. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  20425. -@@ -2140,7 +2140,7 @@ static void brcmf_p2p_delete_p2pdev(stru
  20426. - {
  20427. - cfg80211_unregister_wdev(&vif->wdev);
  20428. - p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  20429. -- brcmf_remove_interface(vif->ifp->drvr, vif->ifp->bssidx);
  20430. -+ brcmf_remove_interface(vif->ifp);
  20431. - brcmf_free_vif(vif);
  20432. - }
  20433. -
  20434. 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
  20435. deleted file mode 100644
  20436. index 2b61f4e..0000000
  20437. --- a/package/kernel/mac80211/patches/365-0004-brcmfmac-only-call-brcmf_cfg80211_detach-when-attach.patch
  20438. +++ /dev/null
  20439. @@ -1,92 +0,0 @@
  20440. -From: Arend van Spriel <arend@broadcom.com>
  20441. -Date: Wed, 26 Aug 2015 22:14:56 +0200
  20442. -Subject: [PATCH] brcmfmac: only call brcmf_cfg80211_detach() when attach
  20443. - was successful
  20444. -
  20445. -In brcmf_bus_start() the function brcmf_cfg80211_attach() is called which
  20446. -may fail. If this happens we should not call brcmf_cfg80211_detach() in
  20447. -the failure path as it will result in NULL pointer dereference:
  20448. -
  20449. - brcmf_fweh_activate_events: Set event_msgs error (-5)
  20450. - brcmf_bus_start: failed: -5
  20451. - brcmf_sdio_firmware_callback: dongle is not responding
  20452. - BUG: unable to handle kernel NULL pointer dereference at 0000000000000068
  20453. - IP: [<ffffffff811e8f08>] kernfs_find_ns+0x18/0xd0
  20454. - PGD 0
  20455. - Oops: 0000 [#1] SMP
  20456. - Modules linked in: brcmfmac(O) brcmutil(O) cfg80211 auth_rpcgss
  20457. - CPU: 1 PID: 45 Comm: kworker/1:1 Tainted: G O
  20458. - Hardware name: Dell Inc. Latitude E6410/07XJP9, BIOS A07 02/15/2011
  20459. - Workqueue: events request_firmware_work_func
  20460. - task: ffff880036c09ac0 ti: ffff880036dd4000 task.ti: ffff880036dd4000
  20461. - RIP: 0010:[<ffffffff811e8f08>] [<ffffffff811e8f08>] kernfs_find_ns+0x18/0xd0
  20462. - RSP: 0018:ffff880036dd7a28 EFLAGS: 00010246
  20463. - RAX: ffff880036c09ac0 RBX: 0000000000000000 RCX: 000000007fffffff
  20464. - RDX: 0000000000000000 RSI: ffffffff816578b9 RDI: 0000000000000000
  20465. - RBP: ffff880036dd7a48 R08: 0000000000000000 R09: ffff880036c0b340
  20466. - R10: 00000000000002ec R11: ffff880036dd7b08 R12: ffffffff816578b9
  20467. - R13: 0000000000000000 R14: ffffffff816578b9 R15: ffff8800c6c87000
  20468. - FS: 0000000000000000(0000) GS:ffff88012bc40000(0000) knlGS:0000000000000000
  20469. - CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
  20470. - CR2: 0000000000000068 CR3: 0000000001a0b000 CR4: 00000000000006e0
  20471. - Stack:
  20472. - 0000000000000000 ffffffff816578b9 0000000000000000 ffff8800c0d003c8
  20473. - ffff880036dd7a78 ffffffff811e8ff5 0000000ffffffff1 ffffffff81a9b060
  20474. - ffff8800c789f880 ffff8800c0d00000 ffff880036dd7a98 ffffffff811ebe0d
  20475. - Call Trace:
  20476. - [<ffffffff811e8ff5>] kernfs_find_and_get_ns+0x35/0x60
  20477. - [<ffffffff811ebe0d>] sysfs_unmerge_group+0x1d/0x60
  20478. - [<ffffffff81404ef2>] dpm_sysfs_remove+0x22/0x60
  20479. - [<ffffffff813f9db9>] device_del+0x49/0x240
  20480. - [<ffffffff815da768>] rfkill_unregister+0x58/0xc0
  20481. - [<ffffffffa06bd91b>] wiphy_unregister+0xab/0x2f0 [cfg80211]
  20482. - [<ffffffffa0742fe3>] brcmf_cfg80211_detach+0x23/0x50 [brcmfmac]
  20483. - [<ffffffffa074d986>] brcmf_detach+0x86/0xe0 [brcmfmac]
  20484. - [<ffffffffa0757de8>] brcmf_sdio_remove+0x48/0x120 [brcmfmac]
  20485. - [<ffffffffa0758ed9>] brcmf_sdiod_remove+0x29/0xd0 [brcmfmac]
  20486. - [<ffffffffa0759031>] brcmf_ops_sdio_remove+0xb1/0x110 [brcmfmac]
  20487. - [<ffffffffa001c267>] sdio_bus_remove+0x37/0x100 [mmc_core]
  20488. - [<ffffffff813fe026>] __device_release_driver+0x96/0x130
  20489. - [<ffffffff813fe0e3>] device_release_driver+0x23/0x30
  20490. - [<ffffffffa0754bc8>] brcmf_sdio_firmware_callback+0x2a8/0x5d0 [brcmfmac]
  20491. - [<ffffffffa074deaf>] brcmf_fw_request_nvram_done+0x15f/0x5e0 [brcmfmac]
  20492. - [<ffffffff8140142f>] ? devres_add+0x3f/0x50
  20493. - [<ffffffff810642b5>] ? usermodehelper_read_unlock+0x15/0x20
  20494. - [<ffffffff81400000>] ? platform_match+0x70/0xa0
  20495. - [<ffffffff8140f400>] request_firmware_work_func+0x30/0x60
  20496. - [<ffffffff8106828c>] process_one_work+0x14c/0x3d0
  20497. - [<ffffffff8106862a>] worker_thread+0x11a/0x450
  20498. - [<ffffffff81068510>] ? process_one_work+0x3d0/0x3d0
  20499. - [<ffffffff8106d692>] kthread+0xd2/0xf0
  20500. - [<ffffffff8106d5c0>] ? kthread_create_on_node+0x180/0x180
  20501. - [<ffffffff815ed35f>] ret_from_fork+0x3f/0x70
  20502. - [<ffffffff8106d5c0>] ? kthread_create_on_node+0x180/0x180
  20503. - Code: e9 40 fe ff ff 48 89 d8 eb 87 66 0f 1f 84 00 00 00 00 00 66 66 66 66
  20504. - 90 55 48 89 e5 41 56 49 89 f6 41 55 49 89 d5 31 d2 41 54 53 <0f> b7
  20505. - 47 68 48 8b 5f 48 66 c1 e8 05 83 e0 01 4d 85 ed 0f b6 c8
  20506. - RIP [<ffffffff811e8f08>] kernfs_find_ns+0x18/0xd0
  20507. - RSP <ffff880036dd7a28>
  20508. - CR2: 0000000000000068
  20509. - ---[ end trace 87d6ec0d3fe46740 ]---
  20510. -
  20511. -Reported-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  20512. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20513. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20514. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20515. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20516. ----
  20517. -
  20518. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20519. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20520. -@@ -1049,7 +1049,10 @@ int brcmf_bus_start(struct device *dev)
  20521. - fail:
  20522. - if (ret < 0) {
  20523. - brcmf_err("failed: %d\n", ret);
  20524. -- brcmf_cfg80211_detach(drvr->config);
  20525. -+ if (drvr->config) {
  20526. -+ brcmf_cfg80211_detach(drvr->config);
  20527. -+ drvr->config = NULL;
  20528. -+ }
  20529. - if (drvr->fws) {
  20530. - brcmf_fws_del_interface(ifp);
  20531. - brcmf_fws_deinit(drvr);
  20532. 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
  20533. deleted file mode 100644
  20534. index 868b0a8..0000000
  20535. --- a/package/kernel/mac80211/patches/365-0005-brcmfmac-correct-detection-of-p2pdev-interface-event.patch
  20536. +++ /dev/null
  20537. @@ -1,105 +0,0 @@
  20538. -From: Arend van Spriel <arend@broadcom.com>
  20539. -Date: Wed, 26 Aug 2015 22:14:57 +0200
  20540. -Subject: [PATCH] brcmfmac: correct detection of p2pdev interface event
  20541. -
  20542. -The p2pdev interface is setup in firmware resulting in a interface
  20543. -event. This event has role and no-if flag. When role is p2p client
  20544. -and no-if flag is set it indicates that this is the p2pdev interface.
  20545. -This info is used in handling the event and adding interface in the
  20546. -driver.
  20547. -
  20548. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20549. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20550. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20551. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20552. ----
  20553. -
  20554. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20555. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20556. -@@ -795,7 +795,7 @@ fail:
  20557. - }
  20558. -
  20559. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  20560. -- char *name, u8 *mac_addr)
  20561. -+ bool is_p2pdev, char *name, u8 *mac_addr)
  20562. - {
  20563. - struct brcmf_if *ifp;
  20564. - struct net_device *ndev;
  20565. -@@ -821,7 +821,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  20566. - }
  20567. - }
  20568. -
  20569. -- if (!brcmf_p2p_enable && bssidx == 1) {
  20570. -+ if (!brcmf_p2p_enable && is_p2pdev) {
  20571. - /* this is P2P_DEVICE interface */
  20572. - brcmf_dbg(INFO, "allocate non-netdev interface\n");
  20573. - ifp = kzalloc(sizeof(*ifp), GFP_KERNEL);
  20574. -@@ -999,12 +999,12 @@ int brcmf_bus_start(struct device *dev)
  20575. - brcmf_dbg(TRACE, "\n");
  20576. -
  20577. - /* add primary networking interface */
  20578. -- ifp = brcmf_add_if(drvr, 0, 0, "wlan%d", NULL);
  20579. -+ ifp = brcmf_add_if(drvr, 0, 0, false, "wlan%d", NULL);
  20580. - if (IS_ERR(ifp))
  20581. - return PTR_ERR(ifp);
  20582. -
  20583. - if (brcmf_p2p_enable)
  20584. -- p2p_ifp = brcmf_add_if(drvr, 1, 0, "p2p%d", NULL);
  20585. -+ p2p_ifp = brcmf_add_if(drvr, 1, 0, false, "p2p%d", NULL);
  20586. - else
  20587. - p2p_ifp = NULL;
  20588. - if (IS_ERR(p2p_ifp))
  20589. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20590. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20591. -@@ -205,7 +205,7 @@ char *brcmf_ifname(struct brcmf_pub *drv
  20592. - struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  20593. - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  20594. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  20595. -- char *name, u8 *mac_addr);
  20596. -+ bool is_p2pdev, char *name, u8 *mac_addr);
  20597. - void brcmf_remove_interface(struct brcmf_if *ifp);
  20598. - int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  20599. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  20600. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  20601. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  20602. -@@ -179,6 +179,7 @@ static void brcmf_fweh_handle_if_event(s
  20603. - {
  20604. - struct brcmf_if_event *ifevent = data;
  20605. - struct brcmf_if *ifp;
  20606. -+ bool is_p2pdev;
  20607. - int err = 0;
  20608. -
  20609. - brcmf_dbg(EVENT, "action: %u idx: %u bsscfg: %u flags: %u role: %u\n",
  20610. -@@ -186,18 +187,16 @@ static void brcmf_fweh_handle_if_event(s
  20611. - ifevent->flags, ifevent->role);
  20612. -
  20613. - /* The P2P Device interface event must not be ignored
  20614. -- * contrary to what firmware tells us. The only way to
  20615. -- * distinguish the P2P Device is by looking at the ifidx
  20616. -- * and bssidx received.
  20617. -+ * contrary to what firmware tells us.
  20618. - */
  20619. -- if (!(ifevent->ifidx == 0 && ifevent->bssidx == 1) &&
  20620. -- (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) {
  20621. -+ is_p2pdev = (ifevent->flags & BRCMF_E_IF_FLAG_NOIF) &&
  20622. -+ ifevent->role == BRCMF_E_IF_ROLE_P2P_CLIENT;
  20623. -+ if (!is_p2pdev && (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) {
  20624. - brcmf_dbg(EVENT, "event can be ignored\n");
  20625. - return;
  20626. - }
  20627. - if (ifevent->ifidx >= BRCMF_MAX_IFS) {
  20628. -- brcmf_err("invalid interface index: %u\n",
  20629. -- ifevent->ifidx);
  20630. -+ brcmf_err("invalid interface index: %u\n", ifevent->ifidx);
  20631. - return;
  20632. - }
  20633. -
  20634. -@@ -207,7 +206,7 @@ static void brcmf_fweh_handle_if_event(s
  20635. - brcmf_dbg(EVENT, "adding %s (%pM)\n", emsg->ifname,
  20636. - emsg->addr);
  20637. - ifp = brcmf_add_if(drvr, ifevent->bssidx, ifevent->ifidx,
  20638. -- emsg->ifname, emsg->addr);
  20639. -+ is_p2pdev, emsg->ifname, emsg->addr);
  20640. - if (IS_ERR(ifp))
  20641. - return;
  20642. - brcmf_fws_add_interface(ifp);
  20643. 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
  20644. deleted file mode 100644
  20645. index aebbfa6..0000000
  20646. --- a/package/kernel/mac80211/patches/365-0006-brcmfmac-use-brcmf_get_ifp-to-map-ifidx-to-struct-br.patch
  20647. +++ /dev/null
  20648. @@ -1,126 +0,0 @@
  20649. -From: Arend van Spriel <arend@broadcom.com>
  20650. -Date: Wed, 26 Aug 2015 22:14:58 +0200
  20651. -Subject: [PATCH] brcmfmac: use brcmf_get_ifp() to map ifidx to struct
  20652. - brcmf_if instance
  20653. -
  20654. -The knowledge on how to map the interface index to a struct brcmf_if
  20655. -instance is in brcmf_get_ifp() so use that function when only the
  20656. -interface index is known instead of accessing brcmf_pub::iflist
  20657. -directly.
  20658. -
  20659. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20660. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20661. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20662. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20663. ----
  20664. -
  20665. ---- a/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c
  20666. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/btcoex.c
  20667. -@@ -149,7 +149,7 @@ static s32 brcmf_btcoex_params_read(stru
  20668. - static void brcmf_btcoex_boost_wifi(struct brcmf_btcoex_info *btci,
  20669. - bool trump_sco)
  20670. - {
  20671. -- struct brcmf_if *ifp = btci->cfg->pub->iflist[0];
  20672. -+ struct brcmf_if *ifp = brcmf_get_ifp(btci->cfg->pub, 0);
  20673. -
  20674. - if (trump_sco && !btci->saved_regs_part2) {
  20675. - /* this should reduce eSCO agressive
  20676. -@@ -468,7 +468,7 @@ int brcmf_btcoex_set_mode(struct brcmf_c
  20677. - {
  20678. - struct brcmf_cfg80211_info *cfg = wiphy_priv(vif->wdev.wiphy);
  20679. - struct brcmf_btcoex_info *btci = cfg->btcoex;
  20680. -- struct brcmf_if *ifp = cfg->pub->iflist[0];
  20681. -+ struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0);
  20682. -
  20683. - switch (mode) {
  20684. - case BRCMF_BTCOEX_DISABLED:
  20685. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  20686. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  20687. -@@ -6212,7 +6212,7 @@ static void brcmf_free_wiphy(struct wiph
  20688. - struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
  20689. - struct device *busdev)
  20690. - {
  20691. -- struct net_device *ndev = drvr->iflist[0]->ndev;
  20692. -+ struct net_device *ndev = brcmf_get_ifp(drvr, 0)->ndev;
  20693. - struct brcmf_cfg80211_info *cfg;
  20694. - struct wiphy *wiphy;
  20695. - struct brcmf_cfg80211_vif *vif;
  20696. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  20697. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  20698. -@@ -121,7 +121,7 @@ static void brcmf_feat_iovar_int_set(str
  20699. -
  20700. - void brcmf_feat_attach(struct brcmf_pub *drvr)
  20701. - {
  20702. -- struct brcmf_if *ifp = drvr->iflist[0];
  20703. -+ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
  20704. -
  20705. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_MCHAN, "mchan");
  20706. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_PNO, "pfn");
  20707. ---- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  20708. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
  20709. -@@ -221,7 +221,7 @@ static void brcmf_flowring_block(struct
  20710. -
  20711. - bus_if = dev_get_drvdata(flow->dev);
  20712. - drvr = bus_if->drvr;
  20713. -- ifp = drvr->iflist[ifidx];
  20714. -+ ifp = brcmf_get_ifp(drvr, ifidx);
  20715. - brcmf_txflowblock_if(ifp, BRCMF_NETIF_STOP_REASON_FLOW, blocked);
  20716. -
  20717. - spin_unlock_irqrestore(&flow->block_lock, flags);
  20718. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  20719. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  20720. -@@ -334,7 +334,7 @@ void brcmf_fweh_attach(struct brcmf_pub
  20721. - void brcmf_fweh_detach(struct brcmf_pub *drvr)
  20722. - {
  20723. - struct brcmf_fweh_info *fweh = &drvr->fweh;
  20724. -- struct brcmf_if *ifp = drvr->iflist[0];
  20725. -+ struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0);
  20726. - s8 eventmask[BRCMF_EVENTING_MASK_LEN];
  20727. -
  20728. - if (ifp) {
  20729. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  20730. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  20731. -@@ -972,7 +972,7 @@ static void
  20732. - brcmf_fws_flow_control_check(struct brcmf_fws_info *fws, struct pktq *pq,
  20733. - u8 if_id)
  20734. - {
  20735. -- struct brcmf_if *ifp = fws->drvr->iflist[!if_id ? 0 : if_id + 1];
  20736. -+ struct brcmf_if *ifp = brcmf_get_ifp(fws->drvr, if_id);
  20737. -
  20738. - if (WARN_ON(!ifp))
  20739. - return;
  20740. -@@ -2118,6 +2118,7 @@ static int brcmf_debugfs_fws_stats_read(
  20741. - int brcmf_fws_init(struct brcmf_pub *drvr)
  20742. - {
  20743. - struct brcmf_fws_info *fws;
  20744. -+ struct brcmf_if *ifp;
  20745. - u32 tlv = BRCMF_FWS_FLAGS_RSSI_SIGNALS;
  20746. - int rc;
  20747. - u32 mode;
  20748. -@@ -2177,21 +2178,22 @@ int brcmf_fws_init(struct brcmf_pub *drv
  20749. - * continue. Set mode back to none indicating not enabled.
  20750. - */
  20751. - fws->fw_signals = true;
  20752. -- if (brcmf_fil_iovar_int_set(drvr->iflist[0], "tlv", tlv)) {
  20753. -+ ifp = brcmf_get_ifp(drvr, 0);
  20754. -+ if (brcmf_fil_iovar_int_set(ifp, "tlv", tlv)) {
  20755. - brcmf_err("failed to set bdcv2 tlv signaling\n");
  20756. - fws->fcmode = BRCMF_FWS_FCMODE_NONE;
  20757. - fws->fw_signals = false;
  20758. - }
  20759. -
  20760. -- if (brcmf_fil_iovar_int_set(drvr->iflist[0], "ampdu_hostreorder", 1))
  20761. -+ if (brcmf_fil_iovar_int_set(ifp, "ampdu_hostreorder", 1))
  20762. - brcmf_dbg(INFO, "enabling AMPDU host-reorder failed\n");
  20763. -
  20764. - /* Enable seq number reuse, if supported */
  20765. -- if (brcmf_fil_iovar_int_get(drvr->iflist[0], "wlfc_mode", &mode) == 0) {
  20766. -+ if (brcmf_fil_iovar_int_get(ifp, "wlfc_mode", &mode) == 0) {
  20767. - if (BRCMF_FWS_MODE_GET_REUSESEQ(mode)) {
  20768. - mode = 0;
  20769. - BRCMF_FWS_MODE_SET_REUSESEQ(mode, 1);
  20770. -- if (brcmf_fil_iovar_int_set(drvr->iflist[0],
  20771. -+ if (brcmf_fil_iovar_int_set(ifp,
  20772. - "wlfc_mode", mode) == 0) {
  20773. - BRCMF_FWS_MODE_SET_REUSESEQ(fws->mode, 1);
  20774. - }
  20775. 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
  20776. deleted file mode 100644
  20777. index 23a7b6f..0000000
  20778. --- a/package/kernel/mac80211/patches/365-0007-brcmfmac-pass-struct-brcmf_if-instance-in-brcmf_txfi.patch
  20779. +++ /dev/null
  20780. @@ -1,122 +0,0 @@
  20781. -From: Arend van Spriel <arend@broadcom.com>
  20782. -Date: Wed, 26 Aug 2015 22:14:59 +0200
  20783. -Subject: [PATCH] brcmfmac: pass struct brcmf_if instance in
  20784. - brcmf_txfinalize()
  20785. -
  20786. -Most call sites of brcmf_txfinalize already have struct brcmf_if
  20787. -instance so pass that to brcmf_txfinalize() as the function
  20788. -needs it anyway.
  20789. -
  20790. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20791. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20792. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20793. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20794. ----
  20795. -
  20796. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20797. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20798. -@@ -560,17 +560,11 @@ void brcmf_rx_frame(struct device *dev,
  20799. - brcmf_netif_rx(ifp, skb);
  20800. - }
  20801. -
  20802. --void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, u8 ifidx,
  20803. -- bool success)
  20804. -+void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success)
  20805. - {
  20806. -- struct brcmf_if *ifp;
  20807. - struct ethhdr *eh;
  20808. - u16 type;
  20809. -
  20810. -- ifp = drvr->iflist[ifidx];
  20811. -- if (!ifp)
  20812. -- goto done;
  20813. --
  20814. - eh = (struct ethhdr *)(txp->data);
  20815. - type = ntohs(eh->h_proto);
  20816. -
  20817. -@@ -582,7 +576,7 @@ void brcmf_txfinalize(struct brcmf_pub *
  20818. -
  20819. - if (!success)
  20820. - ifp->stats.tx_errors++;
  20821. --done:
  20822. -+
  20823. - brcmu_pkt_buf_free_skb(txp);
  20824. - }
  20825. -
  20826. -@@ -600,7 +594,7 @@ void brcmf_txcomplete(struct device *dev
  20827. - if (brcmf_proto_hdrpull(drvr, false, txp, &ifp))
  20828. - brcmu_pkt_buf_free_skb(txp);
  20829. - else
  20830. -- brcmf_txfinalize(drvr, txp, ifp->ifidx, success);
  20831. -+ brcmf_txfinalize(ifp, txp, success);
  20832. - }
  20833. - }
  20834. -
  20835. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20836. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20837. -@@ -210,8 +210,7 @@ void brcmf_remove_interface(struct brcmf
  20838. - int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  20839. - void brcmf_txflowblock_if(struct brcmf_if *ifp,
  20840. - enum brcmf_netif_stop_reason reason, bool state);
  20841. --void brcmf_txfinalize(struct brcmf_pub *drvr, struct sk_buff *txp, u8 ifidx,
  20842. -- bool success);
  20843. -+void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  20844. - void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);
  20845. -
  20846. - /* Sets dongle media info (drv_version, mac address). */
  20847. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  20848. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  20849. -@@ -1506,7 +1506,7 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  20850. - ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
  20851. - genbit, seq);
  20852. - if (remove_from_hanger || ret)
  20853. -- brcmf_txfinalize(fws->drvr, skb, ifp->ifidx, true);
  20854. -+ brcmf_txfinalize(ifp, skb, true);
  20855. -
  20856. - return 0;
  20857. - }
  20858. -@@ -1905,7 +1905,7 @@ int brcmf_fws_process_skb(struct brcmf_i
  20859. - if (fws->avoid_queueing) {
  20860. - rc = brcmf_proto_txdata(drvr, ifp->ifidx, 0, skb);
  20861. - if (rc < 0)
  20862. -- brcmf_txfinalize(drvr, skb, ifp->ifidx, false);
  20863. -+ brcmf_txfinalize(ifp, skb, false);
  20864. - return rc;
  20865. - }
  20866. -
  20867. -@@ -1929,7 +1929,7 @@ int brcmf_fws_process_skb(struct brcmf_i
  20868. - brcmf_fws_schedule_deq(fws);
  20869. - } else {
  20870. - brcmf_err("drop skb: no hanger slot\n");
  20871. -- brcmf_txfinalize(drvr, skb, ifp->ifidx, false);
  20872. -+ brcmf_txfinalize(ifp, skb, false);
  20873. - rc = -ENOMEM;
  20874. - }
  20875. - brcmf_fws_unlock(fws);
  20876. -@@ -2009,8 +2009,9 @@ static void brcmf_fws_dequeue_worker(str
  20877. - ret = brcmf_proto_txdata(drvr, ifidx, 0, skb);
  20878. - brcmf_fws_lock(fws);
  20879. - if (ret < 0)
  20880. -- brcmf_txfinalize(drvr, skb, ifidx,
  20881. -- false);
  20882. -+ brcmf_txfinalize(brcmf_get_ifp(drvr,
  20883. -+ ifidx),
  20884. -+ skb, false);
  20885. - if (fws->bus_flow_blocked)
  20886. - break;
  20887. - }
  20888. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  20889. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  20890. -@@ -873,7 +873,11 @@ brcmf_msgbuf_process_txstatus(struct brc
  20891. - commonring = msgbuf->flowrings[flowid];
  20892. - atomic_dec(&commonring->outstanding_tx);
  20893. -
  20894. -- brcmf_txfinalize(msgbuf->drvr, skb, tx_status->msg.ifidx, true);
  20895. -+ /* Hante: i believe this was a bug as tx_status->msg.ifidx was used
  20896. -+ * in brcmf_txfinalize as index in drvr->iflist. Can you confirm/deny?
  20897. -+ */
  20898. -+ brcmf_txfinalize(brcmf_get_ifp(msgbuf->drvr, tx_status->msg.ifidx),
  20899. -+ skb, true);
  20900. - }
  20901. -
  20902. -
  20903. 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
  20904. deleted file mode 100644
  20905. index 8ddc0a6..0000000
  20906. --- a/package/kernel/mac80211/patches/365-0008-brcmfmac-add-mapping-for-interface-index-to-bsscfg-i.patch
  20907. +++ /dev/null
  20908. @@ -1,92 +0,0 @@
  20909. -From: Arend van Spriel <arend@broadcom.com>
  20910. -Date: Wed, 26 Aug 2015 22:15:00 +0200
  20911. -Subject: [PATCH] brcmfmac: add mapping for interface index to bsscfg
  20912. - index
  20913. -
  20914. -Because the P2P Device interface in firmware uses the same interface
  20915. -index as the primary interface we use the bsscfg index as index in the
  20916. -struct brcmf_pub::iflist. However, in the data path we get the interface
  20917. -index and not the bsscfg index. So we need a mapping of interface index
  20918. -to bsscfg index, which can be determined upon handle adding the interface.
  20919. -
  20920. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  20921. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  20922. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  20923. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  20924. ----
  20925. -
  20926. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20927. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  20928. -@@ -85,21 +85,20 @@ char *brcmf_ifname(struct brcmf_pub *drv
  20929. -
  20930. - struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx)
  20931. - {
  20932. -+ struct brcmf_if *ifp;
  20933. -+ s32 bssidx;
  20934. -+
  20935. - if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  20936. - brcmf_err("ifidx %d out of range\n", ifidx);
  20937. - return NULL;
  20938. - }
  20939. -
  20940. -- /* The ifidx is the idx to map to matching netdev/ifp. When receiving
  20941. -- * events this is easy because it contains the bssidx which maps
  20942. -- * 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
  20943. -- * bssidx 1 is used for p2p0 and no data can be received or
  20944. -- * transmitted on it. Therefor bssidx is ifidx + 1 if ifidx > 0
  20945. -- */
  20946. -- if (ifidx)
  20947. -- ifidx++;
  20948. -+ ifp = NULL;
  20949. -+ bssidx = drvr->if2bss[ifidx];
  20950. -+ if (bssidx >= 0)
  20951. -+ ifp = drvr->iflist[bssidx];
  20952. -
  20953. -- return drvr->iflist[ifidx];
  20954. -+ return ifp;
  20955. - }
  20956. -
  20957. - static void _brcmf_set_multicast_list(struct work_struct *work)
  20958. -@@ -831,6 +830,8 @@ struct brcmf_if *brcmf_add_if(struct brc
  20959. -
  20960. - ifp = netdev_priv(ndev);
  20961. - ifp->ndev = ndev;
  20962. -+ /* store mapping ifidx to bssidx */
  20963. -+ drvr->if2bss[ifidx] = bssidx;
  20964. - }
  20965. -
  20966. - ifp->drvr = drvr;
  20967. -@@ -855,6 +856,7 @@ static void brcmf_del_if(struct brcmf_pu
  20968. - struct brcmf_if *ifp;
  20969. -
  20970. - ifp = drvr->iflist[bssidx];
  20971. -+ drvr->if2bss[ifp->ifidx] = -1;
  20972. - drvr->iflist[bssidx] = NULL;
  20973. - if (!ifp) {
  20974. - brcmf_err("Null interface, idx=%d\n", bssidx);
  20975. -@@ -862,6 +864,7 @@ static void brcmf_del_if(struct brcmf_pu
  20976. - }
  20977. - brcmf_dbg(TRACE, "Enter, idx=%d, ifidx=%d\n", bssidx, ifp->ifidx);
  20978. - if (ifp->ndev) {
  20979. -+ drvr->if2bss[ifp->ifidx] = -1;
  20980. - if (bssidx == 0) {
  20981. - if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) {
  20982. - rtnl_lock();
  20983. -@@ -926,6 +929,7 @@ int brcmf_attach(struct device *dev)
  20984. - if (!drvr)
  20985. - return -ENOMEM;
  20986. -
  20987. -+ memset(drvr->if2bss, 0xFF, sizeof(drvr->if2bss));
  20988. - mutex_init(&drvr->proto_block);
  20989. -
  20990. - /* Link to bus module */
  20991. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20992. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  20993. -@@ -122,6 +122,7 @@ struct brcmf_pub {
  20994. - struct mac_address addresses[BRCMF_MAX_IFS];
  20995. -
  20996. - struct brcmf_if *iflist[BRCMF_MAX_IFS];
  20997. -+ s32 if2bss[BRCMF_MAX_IFS];
  20998. -
  20999. - struct mutex proto_block;
  21000. - unsigned char proto_buf[BRCMF_DCMD_MAXLEN];
  21001. 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
  21002. deleted file mode 100644
  21003. index a0a798b..0000000
  21004. --- a/package/kernel/mac80211/patches/365-0009-brcmfmac-add-dedicated-debug-level-for-firmware-cons.patch
  21005. +++ /dev/null
  21006. @@ -1,103 +0,0 @@
  21007. -From: Arend van Spriel <arend@broadcom.com>
  21008. -Date: Wed, 26 Aug 2015 22:15:01 +0200
  21009. -Subject: [PATCH] brcmfmac: add dedicated debug level for firmware
  21010. - console logging
  21011. -
  21012. -Both PCIe and SDIO devices have the possibility to log the firmware
  21013. -console output in kernel log. For PCIe it is logged when PCIE debug
  21014. -level is enabled. For SDIO it is logged when user specifies a non-zero
  21015. -console interval through debugfs. This patch tries to make it a
  21016. -bit more consistent. The firmware console output is only logged when
  21017. -FWCON debug level is enabled.
  21018. -
  21019. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  21020. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  21021. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  21022. -Reviewed-by: Pontus Fuchs <pontusf@broadcom.com>
  21023. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  21024. ----
  21025. -
  21026. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  21027. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  21028. -@@ -37,6 +37,7 @@
  21029. - #define BRCMF_SDIO_VAL 0x00020000
  21030. - #define BRCMF_MSGBUF_VAL 0x00040000
  21031. - #define BRCMF_PCIE_VAL 0x00080000
  21032. -+#define BRCMF_FWCON_VAL 0x00100000
  21033. -
  21034. - /* set default print format */
  21035. - #undef pr_fmt
  21036. -@@ -78,6 +79,7 @@ do { \
  21037. - #define BRCMF_GLOM_ON() (brcmf_msg_level & BRCMF_GLOM_VAL)
  21038. - #define BRCMF_EVENT_ON() (brcmf_msg_level & BRCMF_EVENT_VAL)
  21039. - #define BRCMF_FIL_ON() (brcmf_msg_level & BRCMF_FIL_VAL)
  21040. -+#define BRCMF_FWCON_ON() (brcmf_msg_level & BRCMF_FWCON_VAL)
  21041. -
  21042. - #else /* defined(DEBUG) || defined(CPTCFG_BRCM_TRACING) */
  21043. -
  21044. -@@ -90,6 +92,7 @@ do { \
  21045. - #define BRCMF_GLOM_ON() 0
  21046. - #define BRCMF_EVENT_ON() 0
  21047. - #define BRCMF_FIL_ON() 0
  21048. -+#define BRCMF_FWCON_ON() 0
  21049. -
  21050. - #endif /* defined(DEBUG) || defined(CPTCFG_BRCM_TRACING) */
  21051. -
  21052. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  21053. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  21054. -@@ -644,7 +644,7 @@ static void brcmf_pcie_bus_console_init(
  21055. - addr = console->base_addr + BRCMF_CONSOLE_BUFSIZE_OFFSET;
  21056. - console->bufsize = brcmf_pcie_read_tcm32(devinfo, addr);
  21057. -
  21058. -- brcmf_dbg(PCIE, "Console: base %x, buf %x, size %d\n",
  21059. -+ brcmf_dbg(FWCON, "Console: base %x, buf %x, size %d\n",
  21060. - console->base_addr, console->buf_addr, console->bufsize);
  21061. - }
  21062. -
  21063. -@@ -656,6 +656,9 @@ static void brcmf_pcie_bus_console_read(
  21064. - u8 ch;
  21065. - u32 newidx;
  21066. -
  21067. -+ if (!BRCMF_FWCON_ON())
  21068. -+ return;
  21069. -+
  21070. - console = &devinfo->shared.console;
  21071. - addr = console->base_addr + BRCMF_CONSOLE_WRITEIDX_OFFSET;
  21072. - newidx = brcmf_pcie_read_tcm32(devinfo, addr);
  21073. -@@ -677,7 +680,7 @@ static void brcmf_pcie_bus_console_read(
  21074. - }
  21075. - if (ch == '\n') {
  21076. - console->log_str[console->log_idx] = 0;
  21077. -- brcmf_dbg(PCIE, "CONSOLE: %s", console->log_str);
  21078. -+ pr_debug("CONSOLE: %s", console->log_str);
  21079. - console->log_idx = 0;
  21080. - }
  21081. - }
  21082. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  21083. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  21084. -@@ -123,6 +123,7 @@ struct rte_console {
  21085. -
  21086. - #define BRCMF_FIRSTREAD (1 << 6)
  21087. -
  21088. -+#define BRCMF_CONSOLE 10 /* watchdog interval to poll console */
  21089. -
  21090. - /* SBSDIO_DEVICE_CTL */
  21091. -
  21092. -@@ -3204,6 +3205,8 @@ static void brcmf_sdio_debugfs_create(st
  21093. - if (IS_ERR_OR_NULL(dentry))
  21094. - return;
  21095. -
  21096. -+ bus->console_interval = BRCMF_CONSOLE;
  21097. -+
  21098. - brcmf_debugfs_add_entry(drvr, "forensics", brcmf_sdio_forensic_read);
  21099. - brcmf_debugfs_add_entry(drvr, "counters",
  21100. - brcmf_debugfs_sdio_count_read);
  21101. -@@ -3613,7 +3616,7 @@ static void brcmf_sdio_bus_watchdog(stru
  21102. - }
  21103. - #ifdef DEBUG
  21104. - /* Poll for console output periodically */
  21105. -- if (bus->sdiodev->state == BRCMF_SDIOD_DATA &&
  21106. -+ if (bus->sdiodev->state == BRCMF_SDIOD_DATA && BRCMF_FWCON_ON() &&
  21107. - bus->console_interval != 0) {
  21108. - bus->console.count += BRCMF_WD_POLL_MS;
  21109. - if (bus->console.count >= bus->console_interval) {
  21110. 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
  21111. deleted file mode 100644
  21112. index 53e7ede..0000000
  21113. --- a/package/kernel/mac80211/patches/365-0010-brcmfmac-remove-ifidx-parameter-from-brcmf_fws_txsta.patch
  21114. +++ /dev/null
  21115. @@ -1,34 +0,0 @@
  21116. -From: Arend van Spriel <arend@broadcom.com>
  21117. -Date: Wed, 26 Aug 2015 22:15:02 +0200
  21118. -Subject: [PATCH] brcmfmac: remove ifidx parameter from
  21119. - brcmf_fws_txstatus_suppressed()
  21120. -
  21121. -The brcmf_fws_txstatus_suppressed() function prototype specifies an
  21122. -ifidx parameter which is not used within the function implementation.
  21123. -
  21124. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  21125. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  21126. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  21127. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  21128. ----
  21129. -
  21130. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  21131. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  21132. -@@ -1398,7 +1398,7 @@ done:
  21133. - }
  21134. -
  21135. - static int brcmf_fws_txstatus_suppressed(struct brcmf_fws_info *fws, int fifo,
  21136. -- struct sk_buff *skb, u8 ifidx,
  21137. -+ struct sk_buff *skb,
  21138. - u32 genbit, u16 seq)
  21139. - {
  21140. - struct brcmf_fws_mac_descriptor *entry = brcmf_skbcb(skb)->mac;
  21141. -@@ -1503,7 +1503,7 @@ brcmf_fws_txs_process(struct brcmf_fws_i
  21142. - return -EINVAL;
  21143. - }
  21144. - if (!remove_from_hanger)
  21145. -- ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, ifp->ifidx,
  21146. -+ ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb,
  21147. - genbit, seq);
  21148. - if (remove_from_hanger || ret)
  21149. - brcmf_txfinalize(ifp, skb, true);
  21150. 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
  21151. deleted file mode 100644
  21152. index bb05235..0000000
  21153. --- a/package/kernel/mac80211/patches/365-0011-brcmfmac-change-prototype-for-brcmf_fws_hdrpull.patch
  21154. +++ /dev/null
  21155. @@ -1,97 +0,0 @@
  21156. -From: Arend van Spriel <arend@broadcom.com>
  21157. -Date: Wed, 26 Aug 2015 22:15:03 +0200
  21158. -Subject: [PATCH] brcmfmac: change prototype for brcmf_fws_hdrpull()
  21159. -
  21160. -Instead of passing ifidx and drvr just pass struct brcmf_if pointer
  21161. -which holds both parameters.
  21162. -
  21163. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  21164. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  21165. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  21166. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  21167. ----
  21168. -
  21169. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  21170. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  21171. -@@ -312,8 +312,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  21172. -
  21173. - skb_pull(pktbuf, BCDC_HEADER_LEN);
  21174. - if (do_fws)
  21175. -- brcmf_fws_hdrpull(drvr, tmp_if->ifidx, h->data_offset << 2,
  21176. -- pktbuf);
  21177. -+ brcmf_fws_hdrpull(tmp_if, h->data_offset << 2, pktbuf);
  21178. - else
  21179. - skb_pull(pktbuf, h->data_offset << 2);
  21180. -
  21181. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  21182. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  21183. -@@ -1616,11 +1616,10 @@ static int brcmf_fws_notify_bcmc_credit_
  21184. - return 0;
  21185. - }
  21186. -
  21187. --int brcmf_fws_hdrpull(struct brcmf_pub *drvr, int ifidx, s16 signal_len,
  21188. -- struct sk_buff *skb)
  21189. -+void brcmf_fws_hdrpull(struct brcmf_if *ifp, s16 siglen, struct sk_buff *skb)
  21190. - {
  21191. - struct brcmf_skb_reorder_data *rd;
  21192. -- struct brcmf_fws_info *fws = drvr->fws;
  21193. -+ struct brcmf_fws_info *fws = ifp->drvr->fws;
  21194. - u8 *signal_data;
  21195. - s16 data_len;
  21196. - u8 type;
  21197. -@@ -1630,20 +1629,20 @@ int brcmf_fws_hdrpull(struct brcmf_pub *
  21198. - s32 err;
  21199. -
  21200. - brcmf_dbg(HDRS, "enter: ifidx %d, skblen %u, sig %d\n",
  21201. -- ifidx, skb->len, signal_len);
  21202. -+ ifp->ifidx, skb->len, siglen);
  21203. -
  21204. -- WARN_ON(signal_len > skb->len);
  21205. -+ WARN_ON(siglen > skb->len);
  21206. -
  21207. -- if (!signal_len)
  21208. -- return 0;
  21209. -+ if (!siglen)
  21210. -+ return;
  21211. - /* if flow control disabled, skip to packet data and leave */
  21212. - if ((!fws) || (!fws->fw_signals)) {
  21213. -- skb_pull(skb, signal_len);
  21214. -- return 0;
  21215. -+ skb_pull(skb, siglen);
  21216. -+ return;
  21217. - }
  21218. -
  21219. - fws->stats.header_pulls++;
  21220. -- data_len = signal_len;
  21221. -+ data_len = siglen;
  21222. - signal_data = skb->data;
  21223. -
  21224. - status = BRCMF_FWS_RET_OK_NOSCHEDULE;
  21225. -@@ -1731,14 +1730,12 @@ int brcmf_fws_hdrpull(struct brcmf_pub *
  21226. - /* signalling processing result does
  21227. - * not affect the actual ethernet packet.
  21228. - */
  21229. -- skb_pull(skb, signal_len);
  21230. -+ skb_pull(skb, siglen);
  21231. -
  21232. - /* this may be a signal-only packet
  21233. - */
  21234. - if (skb->len == 0)
  21235. - fws->stats.header_only_pkt++;
  21236. --
  21237. -- return 0;
  21238. - }
  21239. -
  21240. - static u8 brcmf_fws_precommit_skb(struct brcmf_fws_info *fws, int fifo,
  21241. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.h
  21242. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.h
  21243. -@@ -21,8 +21,7 @@
  21244. - int brcmf_fws_init(struct brcmf_pub *drvr);
  21245. - void brcmf_fws_deinit(struct brcmf_pub *drvr);
  21246. - bool brcmf_fws_fc_active(struct brcmf_fws_info *fws);
  21247. --int brcmf_fws_hdrpull(struct brcmf_pub *drvr, int ifidx, s16 signal_len,
  21248. -- struct sk_buff *skb);
  21249. -+void brcmf_fws_hdrpull(struct brcmf_if *ifp, s16 siglen, struct sk_buff *skb);
  21250. - int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb);
  21251. -
  21252. - void brcmf_fws_reset_interface(struct brcmf_if *ifp);
  21253. 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
  21254. deleted file mode 100644
  21255. index ba92c67..0000000
  21256. --- a/package/kernel/mac80211/patches/365-0012-brcmfmac-introduce-brcmf_net_detach-function.patch
  21257. +++ /dev/null
  21258. @@ -1,99 +0,0 @@
  21259. -From: Arend van Spriel <arend@broadcom.com>
  21260. -Date: Wed, 26 Aug 2015 22:15:04 +0200
  21261. -Subject: [PATCH] brcmfmac: introduce brcmf_net_detach() function
  21262. -
  21263. -In case of error during brcmf_bus_start() the network interfaces were
  21264. -freed using free_netdev(). However, the interfaces may have additional
  21265. -memory allocated which is not freed. The netdev has destructor set to
  21266. -brcmf_cfg80211_free_netdev() which frees the additional memory if
  21267. -allocated and call free_netdev(). The brcmf_net_detach() either calls
  21268. -brcmf_cfg80211_free_netdev() directly or uses unregister_netdev() when
  21269. -struct net_device::reg_state indicates the netdev was registered.
  21270. -
  21271. -Reported-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
  21272. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  21273. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  21274. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  21275. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  21276. ----
  21277. -
  21278. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  21279. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  21280. -@@ -4746,7 +4746,8 @@ void brcmf_cfg80211_free_netdev(struct n
  21281. - ifp = netdev_priv(ndev);
  21282. - vif = ifp->vif;
  21283. -
  21284. -- brcmf_free_vif(vif);
  21285. -+ if (vif)
  21286. -+ brcmf_free_vif(vif);
  21287. - free_netdev(ndev);
  21288. - }
  21289. -
  21290. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  21291. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  21292. -@@ -718,8 +718,6 @@ int brcmf_net_attach(struct brcmf_if *if
  21293. - }
  21294. -
  21295. - brcmf_dbg(INFO, "%s: Broadcom Dongle Host Driver\n", ndev->name);
  21296. --
  21297. -- ndev->destructor = brcmf_cfg80211_free_netdev;
  21298. - return 0;
  21299. -
  21300. - fail:
  21301. -@@ -729,6 +727,14 @@ fail:
  21302. - return -EBADE;
  21303. - }
  21304. -
  21305. -+static void brcmf_net_detach(struct net_device *ndev)
  21306. -+{
  21307. -+ if (ndev->reg_state == NETREG_REGISTERED)
  21308. -+ unregister_netdev(ndev);
  21309. -+ else
  21310. -+ brcmf_cfg80211_free_netdev(ndev);
  21311. -+}
  21312. -+
  21313. - static int brcmf_net_p2p_open(struct net_device *ndev)
  21314. - {
  21315. - brcmf_dbg(TRACE, "Enter\n");
  21316. -@@ -805,8 +811,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  21317. - ifp->ndev->name);
  21318. - if (ifidx) {
  21319. - netif_stop_queue(ifp->ndev);
  21320. -- unregister_netdev(ifp->ndev);
  21321. -- free_netdev(ifp->ndev);
  21322. -+ brcmf_net_detach(ifp->ndev);
  21323. - drvr->iflist[bssidx] = NULL;
  21324. - } else {
  21325. - brcmf_err("ignore IF event\n");
  21326. -@@ -828,6 +833,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  21327. - if (!ndev)
  21328. - return ERR_PTR(-ENOMEM);
  21329. -
  21330. -+ ndev->destructor = brcmf_cfg80211_free_netdev;
  21331. - ifp = netdev_priv(ndev);
  21332. - ifp->ndev = ndev;
  21333. - /* store mapping ifidx to bssidx */
  21334. -@@ -879,8 +885,7 @@ static void brcmf_del_if(struct brcmf_pu
  21335. - cancel_work_sync(&ifp->setmacaddr_work);
  21336. - cancel_work_sync(&ifp->multicast_work);
  21337. - }
  21338. -- /* unregister will take care of freeing it */
  21339. -- unregister_netdev(ifp->ndev);
  21340. -+ brcmf_net_detach(ifp->ndev);
  21341. - }
  21342. - }
  21343. -
  21344. -@@ -1056,11 +1061,11 @@ fail:
  21345. - brcmf_fws_deinit(drvr);
  21346. - }
  21347. - if (drvr->iflist[0]) {
  21348. -- free_netdev(ifp->ndev);
  21349. -+ brcmf_net_detach(ifp->ndev);
  21350. - drvr->iflist[0] = NULL;
  21351. - }
  21352. - if (p2p_ifp) {
  21353. -- free_netdev(p2p_ifp->ndev);
  21354. -+ brcmf_net_detach(p2p_ifp->ndev);
  21355. - drvr->iflist[1] = NULL;
  21356. - }
  21357. - return ret;
  21358. 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
  21359. deleted file mode 100644
  21360. index 5a7e447..0000000
  21361. --- a/package/kernel/mac80211/patches/366-brcmfmac-Reset-PCIE-devices-after-recognition.patch
  21362. +++ /dev/null
  21363. @@ -1,193 +0,0 @@
  21364. -From: Hante Meuleman <meuleman@broadcom.com>
  21365. -Date: Thu, 27 Aug 2015 16:14:06 +0200
  21366. -Subject: [PATCH] brcmfmac: Reset PCIE devices after recognition.
  21367. -
  21368. -When PCIE type devices are being FW reloaded without being properly
  21369. -reset then the device ends up in a locked state, requiring the
  21370. -device to be completely powered down. This patch adds a reset
  21371. -through watchdog at the moment the device (cores) has been
  21372. -recognized. This will solve warm reboot issues.
  21373. -
  21374. -Cc: Rafal Milecki <zajec5@gmail.com>
  21375. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  21376. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  21377. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  21378. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  21379. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  21380. ----
  21381. -
  21382. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  21383. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  21384. -@@ -101,6 +101,9 @@
  21385. - /* ARM Cortex M3 core, ID 0x82a */
  21386. - #define BCM4329_CORE_ARM_BASE 0x18002000
  21387. -
  21388. -+/* Max possibly supported memory size (limited by IO mapped memory) */
  21389. -+#define BRCMF_CHIP_MAX_MEMSIZE (4 * 1024 * 1024)
  21390. -+
  21391. - #define CORE_SB(base, field) \
  21392. - (base + SBCONFIGOFF + offsetof(struct sbconfig, field))
  21393. - #define SBCOREREV(sbidh) \
  21394. -@@ -687,6 +690,12 @@ static int brcmf_chip_get_raminfo(struct
  21395. - brcmf_err("RAM size is undetermined\n");
  21396. - return -ENOMEM;
  21397. - }
  21398. -+
  21399. -+ if (ci->pub.ramsize > BRCMF_CHIP_MAX_MEMSIZE) {
  21400. -+ brcmf_err("RAM size is incorrect\n");
  21401. -+ return -ENOMEM;
  21402. -+ }
  21403. -+
  21404. - return 0;
  21405. - }
  21406. -
  21407. -@@ -899,6 +908,15 @@ static int brcmf_chip_recognition(struct
  21408. -
  21409. - /* assure chip is passive for core access */
  21410. - brcmf_chip_set_passive(&ci->pub);
  21411. -+
  21412. -+ /* Call bus specific reset function now. Cores have been determined
  21413. -+ * but further access may require a chip specific reset at this point.
  21414. -+ */
  21415. -+ if (ci->ops->reset) {
  21416. -+ ci->ops->reset(ci->ctx, &ci->pub);
  21417. -+ brcmf_chip_set_passive(&ci->pub);
  21418. -+ }
  21419. -+
  21420. - return brcmf_chip_get_raminfo(ci);
  21421. - }
  21422. -
  21423. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  21424. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.h
  21425. -@@ -73,6 +73,7 @@ struct brcmf_buscore_ops {
  21426. - u32 (*read32)(void *ctx, u32 addr);
  21427. - void (*write32)(void *ctx, u32 addr, u32 value);
  21428. - int (*prepare)(void *ctx);
  21429. -+ int (*reset)(void *ctx, struct brcmf_chip *chip);
  21430. - int (*setup)(void *ctx, struct brcmf_chip *chip);
  21431. - void (*activate)(void *ctx, struct brcmf_chip *chip, u32 rstvec);
  21432. - };
  21433. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  21434. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  21435. -@@ -74,6 +74,8 @@ enum brcmf_pcie_state {
  21436. - #define BRCMF_PCIE_REG_INTMASK 0x94
  21437. - #define BRCMF_PCIE_REG_SBMBX 0x98
  21438. -
  21439. -+#define BRCMF_PCIE_REG_LINK_STATUS_CTRL 0xBC
  21440. -+
  21441. - #define BRCMF_PCIE_PCIE2REG_INTMASK 0x24
  21442. - #define BRCMF_PCIE_PCIE2REG_MAILBOXINT 0x48
  21443. - #define BRCMF_PCIE_PCIE2REG_MAILBOXMASK 0x4C
  21444. -@@ -466,6 +468,7 @@ brcmf_pcie_select_core(struct brcmf_pcie
  21445. -
  21446. - static void brcmf_pcie_reset_device(struct brcmf_pciedev_info *devinfo)
  21447. - {
  21448. -+ struct brcmf_core *core;
  21449. - u16 cfg_offset[] = { BRCMF_PCIE_CFGREG_STATUS_CMD,
  21450. - BRCMF_PCIE_CFGREG_PM_CSR,
  21451. - BRCMF_PCIE_CFGREG_MSI_CAP,
  21452. -@@ -484,32 +487,38 @@ static void brcmf_pcie_reset_device(stru
  21453. - if (!devinfo->ci)
  21454. - return;
  21455. -
  21456. -+ /* Disable ASPM */
  21457. - brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  21458. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  21459. -- BRCMF_PCIE_CFGREG_LINK_STATUS_CTRL);
  21460. -- lsc = brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA);
  21461. -+ pci_read_config_dword(devinfo->pdev, BRCMF_PCIE_REG_LINK_STATUS_CTRL,
  21462. -+ &lsc);
  21463. - val = lsc & (~BRCMF_PCIE_LINK_STATUS_CTRL_ASPM_ENAB);
  21464. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA, val);
  21465. -+ pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_LINK_STATUS_CTRL,
  21466. -+ val);
  21467. -
  21468. -+ /* Watchdog reset */
  21469. - brcmf_pcie_select_core(devinfo, BCMA_CORE_CHIPCOMMON);
  21470. - WRITECC32(devinfo, watchdog, 4);
  21471. - msleep(100);
  21472. -
  21473. -+ /* Restore ASPM */
  21474. - brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  21475. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  21476. -- BRCMF_PCIE_CFGREG_LINK_STATUS_CTRL);
  21477. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA, lsc);
  21478. -+ pci_write_config_dword(devinfo->pdev, BRCMF_PCIE_REG_LINK_STATUS_CTRL,
  21479. -+ lsc);
  21480. -
  21481. -- brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  21482. -- for (i = 0; i < ARRAY_SIZE(cfg_offset); i++) {
  21483. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  21484. -- cfg_offset[i]);
  21485. -- val = brcmf_pcie_read_reg32(devinfo,
  21486. -- BRCMF_PCIE_PCIE2REG_CONFIGDATA);
  21487. -- brcmf_dbg(PCIE, "config offset 0x%04x, value 0x%04x\n",
  21488. -- cfg_offset[i], val);
  21489. -- brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGDATA,
  21490. -- val);
  21491. -+ core = brcmf_chip_get_core(devinfo->ci, BCMA_CORE_PCIE2);
  21492. -+ if (core->rev <= 13) {
  21493. -+ for (i = 0; i < ARRAY_SIZE(cfg_offset); i++) {
  21494. -+ brcmf_pcie_write_reg32(devinfo,
  21495. -+ BRCMF_PCIE_PCIE2REG_CONFIGADDR,
  21496. -+ cfg_offset[i]);
  21497. -+ val = brcmf_pcie_read_reg32(devinfo,
  21498. -+ BRCMF_PCIE_PCIE2REG_CONFIGDATA);
  21499. -+ brcmf_dbg(PCIE, "config offset 0x%04x, value 0x%04x\n",
  21500. -+ cfg_offset[i], val);
  21501. -+ brcmf_pcie_write_reg32(devinfo,
  21502. -+ BRCMF_PCIE_PCIE2REG_CONFIGDATA,
  21503. -+ val);
  21504. -+ }
  21505. - }
  21506. - }
  21507. -
  21508. -@@ -519,8 +528,6 @@ static void brcmf_pcie_attach(struct brc
  21509. - u32 config;
  21510. -
  21511. - brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  21512. -- if (brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_INTMASK) != 0)
  21513. -- brcmf_pcie_reset_device(devinfo);
  21514. - /* BAR1 window may not be sized properly */
  21515. - brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  21516. - brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_CONFIGADDR, 0x4e0);
  21517. -@@ -1636,6 +1643,23 @@ static int brcmf_pcie_buscoreprep(void *
  21518. - }
  21519. -
  21520. -
  21521. -+static int brcmf_pcie_buscore_reset(void *ctx, struct brcmf_chip *chip)
  21522. -+{
  21523. -+ struct brcmf_pciedev_info *devinfo = (struct brcmf_pciedev_info *)ctx;
  21524. -+ u32 val;
  21525. -+
  21526. -+ devinfo->ci = chip;
  21527. -+ brcmf_pcie_reset_device(devinfo);
  21528. -+
  21529. -+ val = brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT);
  21530. -+ if (val != 0xffffffff)
  21531. -+ brcmf_pcie_write_reg32(devinfo, BRCMF_PCIE_PCIE2REG_MAILBOXINT,
  21532. -+ val);
  21533. -+
  21534. -+ return 0;
  21535. -+}
  21536. -+
  21537. -+
  21538. - static void brcmf_pcie_buscore_activate(void *ctx, struct brcmf_chip *chip,
  21539. - u32 rstvec)
  21540. - {
  21541. -@@ -1647,6 +1671,7 @@ static void brcmf_pcie_buscore_activate(
  21542. -
  21543. - static const struct brcmf_buscore_ops brcmf_pcie_buscore_ops = {
  21544. - .prepare = brcmf_pcie_buscoreprep,
  21545. -+ .reset = brcmf_pcie_buscore_reset,
  21546. - .activate = brcmf_pcie_buscore_activate,
  21547. - .read32 = brcmf_pcie_buscore_read32,
  21548. - .write32 = brcmf_pcie_buscore_write32,
  21549. -@@ -1814,7 +1839,6 @@ brcmf_pcie_remove(struct pci_dev *pdev)
  21550. - brcmf_pcie_intr_disable(devinfo);
  21551. -
  21552. - brcmf_detach(&pdev->dev);
  21553. -- brcmf_pcie_reset_device(devinfo);
  21554. -
  21555. - kfree(bus->bus_priv.pcie);
  21556. - kfree(bus->msgbuf->flowrings);
  21557. 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
  21558. deleted file mode 100644
  21559. index f7b3e40..0000000
  21560. --- a/package/kernel/mac80211/patches/367-ath10k-fix-DMA-related-firmware-crashes-on-multiple-.patch
  21561. +++ /dev/null
  21562. @@ -1,24 +0,0 @@
  21563. -From: Felix Fietkau <nbd@openwrt.org>
  21564. -Date: Sun, 13 Sep 2015 22:26:10 +0200
  21565. -Subject: [PATCH] ath10k: fix DMA related firmware crashes on multiple devices
  21566. -
  21567. -Some platforms really don't like DMA bursts of 256 bytes, and this
  21568. -causes the firmware to crash when sending beacons.
  21569. -Also, changing this based on the firmware version does not seem to make
  21570. -much sense, so use 128 bytes for all versions.
  21571. -
  21572. -Cc: stable@vger.kernel.org
  21573. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  21574. ----
  21575. -
  21576. ---- a/drivers/net/wireless/ath/ath10k/hw.h
  21577. -+++ b/drivers/net/wireless/ath/ath10k/hw.h
  21578. -@@ -253,7 +253,7 @@ struct ath10k_pktlog_hdr {
  21579. - #define TARGET_10X_MAX_FRAG_ENTRIES 0
  21580. -
  21581. - /* 10.2 parameters */
  21582. --#define TARGET_10_2_DMA_BURST_SIZE 1
  21583. -+#define TARGET_10_2_DMA_BURST_SIZE 0
  21584. -
  21585. - /* Target specific defines for WMI-TLV firmware */
  21586. - #define TARGET_TLV_NUM_VDEVS 3
  21587. 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
  21588. deleted file mode 100644
  21589. index c420d20..0000000
  21590. --- a/package/kernel/mac80211/patches/368-ath9k-declare-required-extra-tx-headroom.patch
  21591. +++ /dev/null
  21592. @@ -1,22 +0,0 @@
  21593. -From: Felix Fietkau <nbd@openwrt.org>
  21594. -Date: Thu, 24 Sep 2015 16:57:37 +0200
  21595. -Subject: [PATCH] ath9k: declare required extra tx headroom
  21596. -
  21597. -ath9k inserts padding between the 802.11 header and the data area (to
  21598. -align it). Since it didn't declare this extra required headroom, this
  21599. -led to some nasty issues like randomly dropped packets in some setups.
  21600. -
  21601. -Cc: stable@vger.kernel.org
  21602. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  21603. ----
  21604. -
  21605. ---- a/drivers/net/wireless/ath/ath9k/init.c
  21606. -+++ b/drivers/net/wireless/ath/ath9k/init.c
  21607. -@@ -867,6 +867,7 @@ static void ath9k_set_hw_capab(struct at
  21608. - hw->max_rate_tries = 10;
  21609. - hw->sta_data_size = sizeof(struct ath_node);
  21610. - hw->vif_data_size = sizeof(struct ath_vif);
  21611. -+ hw->extra_tx_headroom = 4;
  21612. -
  21613. - hw->wiphy->available_antennas_rx = BIT(ah->caps.max_rxchains) - 1;
  21614. - hw->wiphy->available_antennas_tx = BIT(ah->caps.max_txchains) - 1;
  21615. 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
  21616. deleted file mode 100644
  21617. index 1478efa..0000000
  21618. --- a/package/kernel/mac80211/patches/369-mac80211-initialize-tid-field-in-struct-ieee80211_tx.patch
  21619. +++ /dev/null
  21620. @@ -1,21 +0,0 @@
  21621. -From: Felix Fietkau <nbd@openwrt.org>
  21622. -Date: Mon, 5 Oct 2015 17:41:25 +0200
  21623. -Subject: [PATCH] mac80211: initialize tid field in struct ieee80211_txq
  21624. -
  21625. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  21626. ----
  21627. -
  21628. ---- a/net/mac80211/util.c
  21629. -+++ b/net/mac80211/util.c
  21630. -@@ -3323,9 +3323,11 @@ void ieee80211_init_tx_queue(struct ieee
  21631. - if (sta) {
  21632. - txqi->txq.sta = &sta->sta;
  21633. - sta->sta.txq[tid] = &txqi->txq;
  21634. -+ txqi->txq.tid = tid;
  21635. - txqi->txq.ac = ieee802_1d_to_ac[tid & 7];
  21636. - } else {
  21637. - sdata->vif.txq = &txqi->txq;
  21638. -+ txqi->txq.tid = 0;
  21639. - txqi->txq.ac = IEEE80211_AC_BE;
  21640. - }
  21641. - }
  21642. 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
  21643. deleted file mode 100644
  21644. index bcd1031..0000000
  21645. --- a/package/kernel/mac80211/patches/370-0001-brcmfmac-Fix-exception-handling.patch
  21646. +++ /dev/null
  21647. @@ -1,24 +0,0 @@
  21648. -From: Hante Meuleman <meuleman@broadcom.com>
  21649. -Date: Fri, 18 Sep 2015 22:08:04 +0200
  21650. -Subject: [PATCH] brcmfmac: Fix exception handling.
  21651. -
  21652. -In some exception situations the ifp->vif was not properly assigned
  21653. -which could result in crash.
  21654. -
  21655. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  21656. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  21657. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  21658. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  21659. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  21660. ----
  21661. -
  21662. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  21663. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  21664. -@@ -6331,6 +6331,7 @@ wiphy_unreg_out:
  21665. - priv_out:
  21666. - wl_deinit_priv(cfg);
  21667. - brcmf_free_vif(vif);
  21668. -+ ifp->vif = NULL;
  21669. - wiphy_out:
  21670. - brcmf_free_wiphy(wiphy);
  21671. - return NULL;
  21672. 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
  21673. deleted file mode 100644
  21674. index f4ab77b..0000000
  21675. --- a/package/kernel/mac80211/patches/370-0002-brcmfmac-Add-support-for-the-BCM4350-PCIE-device.patch
  21676. +++ /dev/null
  21677. @@ -1,81 +0,0 @@
  21678. -From: Hante Meuleman <meuleman@broadcom.com>
  21679. -Date: Fri, 18 Sep 2015 22:08:05 +0200
  21680. -Subject: [PATCH] brcmfmac: Add support for the BCM4350 PCIE device.
  21681. -
  21682. -This patch adds support fo the BRCM4350 2x2 11ac PCIE device.
  21683. -
  21684. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  21685. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  21686. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  21687. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  21688. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  21689. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  21690. ----
  21691. -
  21692. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  21693. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  21694. -@@ -647,6 +647,7 @@ static u32 brcmf_chip_tcm_rambase(struct
  21695. - return 0x198000;
  21696. - case BRCM_CC_4335_CHIP_ID:
  21697. - case BRCM_CC_4339_CHIP_ID:
  21698. -+ case BRCM_CC_4350_CHIP_ID:
  21699. - case BRCM_CC_4354_CHIP_ID:
  21700. - case BRCM_CC_4356_CHIP_ID:
  21701. - case BRCM_CC_43567_CHIP_ID:
  21702. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  21703. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  21704. -@@ -47,6 +47,8 @@ enum brcmf_pcie_state {
  21705. -
  21706. - #define BRCMF_PCIE_43602_FW_NAME "brcm/brcmfmac43602-pcie.bin"
  21707. - #define BRCMF_PCIE_43602_NVRAM_NAME "brcm/brcmfmac43602-pcie.txt"
  21708. -+#define BRCMF_PCIE_4350_FW_NAME "brcm/brcmfmac4350-pcie.bin"
  21709. -+#define BRCMF_PCIE_4350_NVRAM_NAME "brcm/brcmfmac4350-pcie.txt"
  21710. - #define BRCMF_PCIE_4356_FW_NAME "brcm/brcmfmac4356-pcie.bin"
  21711. - #define BRCMF_PCIE_4356_NVRAM_NAME "brcm/brcmfmac4356-pcie.txt"
  21712. - #define BRCMF_PCIE_43570_FW_NAME "brcm/brcmfmac43570-pcie.bin"
  21713. -@@ -194,6 +196,8 @@ enum brcmf_pcie_state {
  21714. -
  21715. - MODULE_FIRMWARE(BRCMF_PCIE_43602_FW_NAME);
  21716. - MODULE_FIRMWARE(BRCMF_PCIE_43602_NVRAM_NAME);
  21717. -+MODULE_FIRMWARE(BRCMF_PCIE_4350_FW_NAME);
  21718. -+MODULE_FIRMWARE(BRCMF_PCIE_4350_NVRAM_NAME);
  21719. - MODULE_FIRMWARE(BRCMF_PCIE_4356_FW_NAME);
  21720. - MODULE_FIRMWARE(BRCMF_PCIE_4356_NVRAM_NAME);
  21721. - MODULE_FIRMWARE(BRCMF_PCIE_43570_FW_NAME);
  21722. -@@ -1418,6 +1422,10 @@ static int brcmf_pcie_get_fwnames(struct
  21723. - fw_name = BRCMF_PCIE_43602_FW_NAME;
  21724. - nvram_name = BRCMF_PCIE_43602_NVRAM_NAME;
  21725. - break;
  21726. -+ case BRCM_CC_4350_CHIP_ID:
  21727. -+ fw_name = BRCMF_PCIE_4350_FW_NAME;
  21728. -+ nvram_name = BRCMF_PCIE_4350_NVRAM_NAME;
  21729. -+ break;
  21730. - case BRCM_CC_4356_CHIP_ID:
  21731. - fw_name = BRCMF_PCIE_4356_FW_NAME;
  21732. - nvram_name = BRCMF_PCIE_4356_NVRAM_NAME;
  21733. -@@ -1956,6 +1964,7 @@ cleanup:
  21734. - PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 }
  21735. -
  21736. - static struct pci_device_id brcmf_pcie_devid_table[] = {
  21737. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4350_DEVICE_ID),
  21738. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4356_DEVICE_ID),
  21739. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43567_DEVICE_ID),
  21740. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43570_DEVICE_ID),
  21741. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  21742. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  21743. -@@ -39,6 +39,7 @@
  21744. - #define BRCM_CC_4339_CHIP_ID 0x4339
  21745. - #define BRCM_CC_43430_CHIP_ID 43430
  21746. - #define BRCM_CC_4345_CHIP_ID 0x4345
  21747. -+#define BRCM_CC_4350_CHIP_ID 0x4350
  21748. - #define BRCM_CC_4354_CHIP_ID 0x4354
  21749. - #define BRCM_CC_4356_CHIP_ID 0x4356
  21750. - #define BRCM_CC_43566_CHIP_ID 43566
  21751. -@@ -56,6 +57,7 @@
  21752. - #define BRCM_USB_BCMFW_DEVICE_ID 0x0bdc
  21753. -
  21754. - /* PCIE Device IDs */
  21755. -+#define BRCM_PCIE_4350_DEVICE_ID 0x43a3
  21756. - #define BRCM_PCIE_4354_DEVICE_ID 0x43df
  21757. - #define BRCM_PCIE_4356_DEVICE_ID 0x43ec
  21758. - #define BRCM_PCIE_43567_DEVICE_ID 0x43d3
  21759. 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
  21760. deleted file mode 100644
  21761. index 62fdd8d..0000000
  21762. --- a/package/kernel/mac80211/patches/370-0003-brcmfmac-Fix-set-and-get-tx-power-functions.patch
  21763. +++ /dev/null
  21764. @@ -1,218 +0,0 @@
  21765. -From: Hante Meuleman <meuleman@broadcom.com>
  21766. -Date: Fri, 18 Sep 2015 22:08:06 +0200
  21767. -Subject: [PATCH] brcmfmac: Fix set and get tx-power functions.
  21768. -
  21769. -Implementation of tx-power (get and set) related functions are
  21770. -still assuming mW interface. This is wrong as functions use dbm
  21771. -(or mbm) nowadays. As a result a tx power configuration could
  21772. -result in wrong power configuration.
  21773. -
  21774. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  21775. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  21776. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  21777. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  21778. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  21779. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  21780. ----
  21781. -
  21782. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  21783. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  21784. -@@ -236,89 +236,6 @@ static int brcmf_roamoff;
  21785. - module_param_named(roamoff, brcmf_roamoff, int, S_IRUSR);
  21786. - MODULE_PARM_DESC(roamoff, "do not use internal roaming engine");
  21787. -
  21788. --/* Quarter dBm units to mW
  21789. -- * Table starts at QDBM_OFFSET, so the first entry is mW for qdBm=153
  21790. -- * Table is offset so the last entry is largest mW value that fits in
  21791. -- * a u16.
  21792. -- */
  21793. --
  21794. --#define QDBM_OFFSET 153 /* Offset for first entry */
  21795. --#define QDBM_TABLE_LEN 40 /* Table size */
  21796. --
  21797. --/* Smallest mW value that will round up to the first table entry, QDBM_OFFSET.
  21798. -- * Value is ( mW(QDBM_OFFSET - 1) + mW(QDBM_OFFSET) ) / 2
  21799. -- */
  21800. --#define QDBM_TABLE_LOW_BOUND 6493 /* Low bound */
  21801. --
  21802. --/* Largest mW value that will round down to the last table entry,
  21803. -- * QDBM_OFFSET + QDBM_TABLE_LEN-1.
  21804. -- * Value is ( mW(QDBM_OFFSET + QDBM_TABLE_LEN - 1) +
  21805. -- * mW(QDBM_OFFSET + QDBM_TABLE_LEN) ) / 2.
  21806. -- */
  21807. --#define QDBM_TABLE_HIGH_BOUND 64938 /* High bound */
  21808. --
  21809. --static const u16 nqdBm_to_mW_map[QDBM_TABLE_LEN] = {
  21810. --/* qdBm: +0 +1 +2 +3 +4 +5 +6 +7 */
  21811. --/* 153: */ 6683, 7079, 7499, 7943, 8414, 8913, 9441, 10000,
  21812. --/* 161: */ 10593, 11220, 11885, 12589, 13335, 14125, 14962, 15849,
  21813. --/* 169: */ 16788, 17783, 18836, 19953, 21135, 22387, 23714, 25119,
  21814. --/* 177: */ 26607, 28184, 29854, 31623, 33497, 35481, 37584, 39811,
  21815. --/* 185: */ 42170, 44668, 47315, 50119, 53088, 56234, 59566, 63096
  21816. --};
  21817. --
  21818. --static u16 brcmf_qdbm_to_mw(u8 qdbm)
  21819. --{
  21820. -- uint factor = 1;
  21821. -- int idx = qdbm - QDBM_OFFSET;
  21822. --
  21823. -- if (idx >= QDBM_TABLE_LEN)
  21824. -- /* clamp to max u16 mW value */
  21825. -- return 0xFFFF;
  21826. --
  21827. -- /* scale the qdBm index up to the range of the table 0-40
  21828. -- * where an offset of 40 qdBm equals a factor of 10 mW.
  21829. -- */
  21830. -- while (idx < 0) {
  21831. -- idx += 40;
  21832. -- factor *= 10;
  21833. -- }
  21834. --
  21835. -- /* return the mW value scaled down to the correct factor of 10,
  21836. -- * adding in factor/2 to get proper rounding.
  21837. -- */
  21838. -- return (nqdBm_to_mW_map[idx] + factor / 2) / factor;
  21839. --}
  21840. --
  21841. --static u8 brcmf_mw_to_qdbm(u16 mw)
  21842. --{
  21843. -- u8 qdbm;
  21844. -- int offset;
  21845. -- uint mw_uint = mw;
  21846. -- uint boundary;
  21847. --
  21848. -- /* handle boundary case */
  21849. -- if (mw_uint <= 1)
  21850. -- return 0;
  21851. --
  21852. -- offset = QDBM_OFFSET;
  21853. --
  21854. -- /* move mw into the range of the table */
  21855. -- while (mw_uint < QDBM_TABLE_LOW_BOUND) {
  21856. -- mw_uint *= 10;
  21857. -- offset -= 40;
  21858. -- }
  21859. --
  21860. -- for (qdbm = 0; qdbm < QDBM_TABLE_LEN - 1; qdbm++) {
  21861. -- boundary = nqdBm_to_mW_map[qdbm] + (nqdBm_to_mW_map[qdbm + 1] -
  21862. -- nqdBm_to_mW_map[qdbm]) / 2;
  21863. -- if (mw_uint < boundary)
  21864. -- break;
  21865. -- }
  21866. --
  21867. -- qdbm += (u8) offset;
  21868. --
  21869. -- return qdbm;
  21870. --}
  21871. -
  21872. - static u16 chandef_to_chanspec(struct brcmu_d11inf *d11inf,
  21873. - struct cfg80211_chan_def *ch)
  21874. -@@ -2016,16 +1933,14 @@ static s32
  21875. - brcmf_cfg80211_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
  21876. - enum nl80211_tx_power_setting type, s32 mbm)
  21877. - {
  21878. --
  21879. - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  21880. - struct net_device *ndev = cfg_to_ndev(cfg);
  21881. - struct brcmf_if *ifp = netdev_priv(ndev);
  21882. -- u16 txpwrmw;
  21883. -- s32 err = 0;
  21884. -- s32 disable = 0;
  21885. -- s32 dbm = MBM_TO_DBM(mbm);
  21886. -+ s32 err;
  21887. -+ s32 disable;
  21888. -+ u32 qdbm = 127;
  21889. -
  21890. -- brcmf_dbg(TRACE, "Enter\n");
  21891. -+ brcmf_dbg(TRACE, "Enter %d %d\n", type, mbm);
  21892. - if (!check_vif_up(ifp->vif))
  21893. - return -EIO;
  21894. -
  21895. -@@ -2034,12 +1949,20 @@ brcmf_cfg80211_set_tx_power(struct wiphy
  21896. - break;
  21897. - case NL80211_TX_POWER_LIMITED:
  21898. - case NL80211_TX_POWER_FIXED:
  21899. -- if (dbm < 0) {
  21900. -+ if (mbm < 0) {
  21901. - brcmf_err("TX_POWER_FIXED - dbm is negative\n");
  21902. - err = -EINVAL;
  21903. - goto done;
  21904. - }
  21905. -+ qdbm = MBM_TO_DBM(4 * mbm);
  21906. -+ if (qdbm > 127)
  21907. -+ qdbm = 127;
  21908. -+ qdbm |= WL_TXPWR_OVERRIDE;
  21909. - break;
  21910. -+ default:
  21911. -+ brcmf_err("Unsupported type %d\n", type);
  21912. -+ err = -EINVAL;
  21913. -+ goto done;
  21914. - }
  21915. - /* Make sure radio is off or on as far as software is concerned */
  21916. - disable = WL_RADIO_SW_DISABLE << 16;
  21917. -@@ -2047,52 +1970,44 @@ brcmf_cfg80211_set_tx_power(struct wiphy
  21918. - if (err)
  21919. - brcmf_err("WLC_SET_RADIO error (%d)\n", err);
  21920. -
  21921. -- if (dbm > 0xffff)
  21922. -- txpwrmw = 0xffff;
  21923. -- else
  21924. -- txpwrmw = (u16) dbm;
  21925. -- err = brcmf_fil_iovar_int_set(ifp, "qtxpower",
  21926. -- (s32)brcmf_mw_to_qdbm(txpwrmw));
  21927. -+ err = brcmf_fil_iovar_int_set(ifp, "qtxpower", qdbm);
  21928. - if (err)
  21929. - brcmf_err("qtxpower error (%d)\n", err);
  21930. -- cfg->conf->tx_power = dbm;
  21931. -
  21932. - done:
  21933. -- brcmf_dbg(TRACE, "Exit\n");
  21934. -+ brcmf_dbg(TRACE, "Exit %d (qdbm)\n", qdbm & ~WL_TXPWR_OVERRIDE);
  21935. - return err;
  21936. - }
  21937. -
  21938. --static s32 brcmf_cfg80211_get_tx_power(struct wiphy *wiphy,
  21939. -- struct wireless_dev *wdev,
  21940. -- s32 *dbm)
  21941. -+static s32
  21942. -+brcmf_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
  21943. -+ s32 *dbm)
  21944. - {
  21945. - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  21946. -- struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg));
  21947. -- s32 txpwrdbm;
  21948. -- u8 result;
  21949. -- s32 err = 0;
  21950. -+ struct net_device *ndev = cfg_to_ndev(cfg);
  21951. -+ struct brcmf_if *ifp = netdev_priv(ndev);
  21952. -+ s32 qdbm = 0;
  21953. -+ s32 err;
  21954. -
  21955. - brcmf_dbg(TRACE, "Enter\n");
  21956. - if (!check_vif_up(ifp->vif))
  21957. - return -EIO;
  21958. -
  21959. -- err = brcmf_fil_iovar_int_get(ifp, "qtxpower", &txpwrdbm);
  21960. -+ err = brcmf_fil_iovar_int_get(ifp, "qtxpower", &qdbm);
  21961. - if (err) {
  21962. - brcmf_err("error (%d)\n", err);
  21963. - goto done;
  21964. - }
  21965. --
  21966. -- result = (u8) (txpwrdbm & ~WL_TXPWR_OVERRIDE);
  21967. -- *dbm = (s32) brcmf_qdbm_to_mw(result);
  21968. -+ *dbm = (qdbm & ~WL_TXPWR_OVERRIDE) / 4;
  21969. -
  21970. - done:
  21971. -- brcmf_dbg(TRACE, "Exit\n");
  21972. -+ brcmf_dbg(TRACE, "Exit (0x%x %d)\n", qdbm, *dbm);
  21973. - return err;
  21974. - }
  21975. -
  21976. - static s32
  21977. - brcmf_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *ndev,
  21978. -- u8 key_idx, bool unicast, bool multicast)
  21979. -+ u8 key_idx, bool unicast, bool multicast)
  21980. - {
  21981. - struct brcmf_if *ifp = netdev_priv(ndev);
  21982. - u32 index;
  21983. 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
  21984. deleted file mode 100644
  21985. index c51365f..0000000
  21986. --- a/package/kernel/mac80211/patches/370-0004-brcmfmac-Only-assign-primary-netdev-to-if2bss-array.patch
  21987. +++ /dev/null
  21988. @@ -1,73 +0,0 @@
  21989. -From: Hante Meuleman <meuleman@broadcom.com>
  21990. -Date: Fri, 18 Sep 2015 22:08:07 +0200
  21991. -Subject: [PATCH] brcmfmac: Only assign primary netdev to if2bss array.
  21992. -
  21993. -The if2bss allows for translation of ifidx to bssidx which has a 1:n
  21994. -relation. Therefor only the first (primary) netdev should be
  21995. -assigned in this array. This fixes the p2pon=1 module param usage.
  21996. -
  21997. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  21998. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  21999. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  22000. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  22001. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  22002. ----
  22003. -
  22004. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  22005. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  22006. -@@ -53,6 +53,8 @@ MODULE_LICENSE("Dual BSD/GPL");
  22007. - #define BRCMF_RXREORDER_EXPIDX_VALID 0x08
  22008. - #define BRCMF_RXREORDER_NEW_HOLE 0x10
  22009. -
  22010. -+#define BRCMF_BSSIDX_INVALID -1
  22011. -+
  22012. - /* Error bits */
  22013. - int brcmf_msg_level;
  22014. - module_param_named(debug, brcmf_msg_level, int, S_IRUSR | S_IWUSR);
  22015. -@@ -837,7 +839,8 @@ struct brcmf_if *brcmf_add_if(struct brc
  22016. - ifp = netdev_priv(ndev);
  22017. - ifp->ndev = ndev;
  22018. - /* store mapping ifidx to bssidx */
  22019. -- drvr->if2bss[ifidx] = bssidx;
  22020. -+ if (drvr->if2bss[ifidx] == BRCMF_BSSIDX_INVALID)
  22021. -+ drvr->if2bss[ifidx] = bssidx;
  22022. - }
  22023. -
  22024. - ifp->drvr = drvr;
  22025. -@@ -862,15 +865,15 @@ static void brcmf_del_if(struct brcmf_pu
  22026. - struct brcmf_if *ifp;
  22027. -
  22028. - ifp = drvr->iflist[bssidx];
  22029. -- drvr->if2bss[ifp->ifidx] = -1;
  22030. - drvr->iflist[bssidx] = NULL;
  22031. - if (!ifp) {
  22032. - brcmf_err("Null interface, idx=%d\n", bssidx);
  22033. - return;
  22034. - }
  22035. - brcmf_dbg(TRACE, "Enter, idx=%d, ifidx=%d\n", bssidx, ifp->ifidx);
  22036. -+ if (drvr->if2bss[ifp->ifidx] == bssidx)
  22037. -+ drvr->if2bss[ifp->ifidx] = BRCMF_BSSIDX_INVALID;
  22038. - if (ifp->ndev) {
  22039. -- drvr->if2bss[ifp->ifidx] = -1;
  22040. - if (bssidx == 0) {
  22041. - if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) {
  22042. - rtnl_lock();
  22043. -@@ -926,6 +929,7 @@ int brcmf_attach(struct device *dev)
  22044. - {
  22045. - struct brcmf_pub *drvr = NULL;
  22046. - int ret = 0;
  22047. -+ int i;
  22048. -
  22049. - brcmf_dbg(TRACE, "Enter\n");
  22050. -
  22051. -@@ -934,7 +938,9 @@ int brcmf_attach(struct device *dev)
  22052. - if (!drvr)
  22053. - return -ENOMEM;
  22054. -
  22055. -- memset(drvr->if2bss, 0xFF, sizeof(drvr->if2bss));
  22056. -+ for (i = 0; i < ARRAY_SIZE(drvr->if2bss); i++)
  22057. -+ drvr->if2bss[i] = BRCMF_BSSIDX_INVALID;
  22058. -+
  22059. - mutex_init(&drvr->proto_block);
  22060. -
  22061. - /* Link to bus module */
  22062. 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
  22063. deleted file mode 100644
  22064. index 3c1058d..0000000
  22065. --- a/package/kernel/mac80211/patches/370-0005-brcmfmac-Inform-p2p-module-about-p2pon-through-API.patch
  22066. +++ /dev/null
  22067. @@ -1,113 +0,0 @@
  22068. -From: Hante Meuleman <meuleman@broadcom.com>
  22069. -Date: Fri, 18 Sep 2015 22:08:08 +0200
  22070. -Subject: [PATCH] brcmfmac: Inform p2p module about p2pon through API
  22071. -
  22072. -When the p2pon module param is used then p2p attach will initialize
  22073. -p2p device iface in the firmware, but it is doing that by checking
  22074. -data. It is cleaner to pass the p2pon information to p2p by API.
  22075. -This information is also needed for other patch.
  22076. -
  22077. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  22078. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  22079. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  22080. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  22081. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  22082. ----
  22083. -
  22084. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  22085. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  22086. -@@ -6126,7 +6126,8 @@ static void brcmf_free_wiphy(struct wiph
  22087. - }
  22088. -
  22089. - struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
  22090. -- struct device *busdev)
  22091. -+ struct device *busdev,
  22092. -+ bool p2pdev_forced)
  22093. - {
  22094. - struct net_device *ndev = brcmf_get_ifp(drvr, 0)->ndev;
  22095. - struct brcmf_cfg80211_info *cfg;
  22096. -@@ -6218,7 +6219,7 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  22097. - *cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
  22098. - }
  22099. -
  22100. -- err = brcmf_p2p_attach(cfg);
  22101. -+ err = brcmf_p2p_attach(cfg, p2pdev_forced);
  22102. - if (err) {
  22103. - brcmf_err("P2P initilisation failed (%d)\n", err);
  22104. - goto wiphy_unreg_out;
  22105. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  22106. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  22107. -@@ -469,7 +469,8 @@ brcmf_cfg80211_connect_info *cfg_to_conn
  22108. - }
  22109. -
  22110. - struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
  22111. -- struct device *busdev);
  22112. -+ struct device *busdev,
  22113. -+ bool p2pdev_forced);
  22114. - void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg);
  22115. - s32 brcmf_cfg80211_up(struct net_device *ndev);
  22116. - s32 brcmf_cfg80211_down(struct net_device *ndev);
  22117. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  22118. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  22119. -@@ -1044,7 +1044,8 @@ int brcmf_bus_start(struct device *dev)
  22120. -
  22121. - brcmf_fws_add_interface(ifp);
  22122. -
  22123. -- drvr->config = brcmf_cfg80211_attach(drvr, bus_if->dev);
  22124. -+ drvr->config = brcmf_cfg80211_attach(drvr, bus_if->dev,
  22125. -+ brcmf_p2p_enable);
  22126. - if (drvr->config == NULL) {
  22127. - ret = -ENOMEM;
  22128. - goto fail;
  22129. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  22130. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  22131. -@@ -2333,7 +2333,7 @@ void brcmf_p2p_stop_device(struct wiphy
  22132. - *
  22133. - * @cfg: driver private data for cfg80211 interface.
  22134. - */
  22135. --s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg)
  22136. -+s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced)
  22137. - {
  22138. - struct brcmf_if *pri_ifp;
  22139. - struct brcmf_if *p2p_ifp;
  22140. -@@ -2348,11 +2348,15 @@ s32 brcmf_p2p_attach(struct brcmf_cfg802
  22141. -
  22142. - drvr = cfg->pub;
  22143. -
  22144. -- pri_ifp = drvr->iflist[0];
  22145. -- p2p_ifp = drvr->iflist[1];
  22146. --
  22147. -+ pri_ifp = brcmf_get_ifp(drvr, 0);
  22148. - p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif = pri_ifp->vif;
  22149. -
  22150. -+ if (p2pdev_forced) {
  22151. -+ p2p_ifp = drvr->iflist[1];
  22152. -+ } else {
  22153. -+ p2p_ifp = NULL;
  22154. -+ p2p->p2pdev_dynamically = true;
  22155. -+ }
  22156. - if (p2p_ifp) {
  22157. - p2p_vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_P2P_DEVICE,
  22158. - false);
  22159. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.h
  22160. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.h
  22161. -@@ -124,6 +124,7 @@ struct afx_hdl {
  22162. - * @wait_next_af: thread synchronizing struct.
  22163. - * @gon_req_action: about to send go negotiation requets frame.
  22164. - * @block_gon_req_tx: drop tx go negotiation requets frame.
  22165. -+ * @p2pdev_dynamically: is p2p device if created by module param or supplicant.
  22166. - */
  22167. - struct brcmf_p2p_info {
  22168. - struct brcmf_cfg80211_info *cfg;
  22169. -@@ -144,9 +145,10 @@ struct brcmf_p2p_info {
  22170. - struct completion wait_next_af;
  22171. - bool gon_req_action;
  22172. - bool block_gon_req_tx;
  22173. -+ bool p2pdev_dynamically;
  22174. - };
  22175. -
  22176. --s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg);
  22177. -+s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced);
  22178. - void brcmf_p2p_detach(struct brcmf_p2p_info *p2p);
  22179. - struct wireless_dev *brcmf_p2p_add_vif(struct wiphy *wiphy, const char *name,
  22180. - enum nl80211_iftype type, u32 *flags,
  22181. 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
  22182. deleted file mode 100644
  22183. index 66b2117..0000000
  22184. --- a/package/kernel/mac80211/patches/370-0006-brcmfmac-Fix-bug-in-flowring-management.patch
  22185. +++ /dev/null
  22186. @@ -1,26 +0,0 @@
  22187. -From: Hante Meuleman <meuleman@broadcom.com>
  22188. -Date: Fri, 18 Sep 2015 22:08:09 +0200
  22189. -Subject: [PATCH] brcmfmac: Fix bug in flowring management.
  22190. -
  22191. -The hash index stored in the flowrings is of type u16 but gets
  22192. -stored in u8. This can result in incorrect indexing and possibly
  22193. -result in crashes. This patch fixes the type.
  22194. -
  22195. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  22196. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  22197. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  22198. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  22199. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  22200. ----
  22201. -
  22202. ---- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.h
  22203. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.h
  22204. -@@ -34,7 +34,7 @@ enum ring_status {
  22205. - };
  22206. -
  22207. - struct brcmf_flowring_ring {
  22208. -- u8 hash_id;
  22209. -+ u16 hash_id;
  22210. - bool blocked;
  22211. - enum ring_status status;
  22212. - struct sk_buff_head skblist;
  22213. 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
  22214. deleted file mode 100644
  22215. index c143c3b..0000000
  22216. --- a/package/kernel/mac80211/patches/370-0007-brcmfmac-Make-p2pon-module-param-always-available.patch
  22217. +++ /dev/null
  22218. @@ -1,29 +0,0 @@
  22219. -From: Hante Meuleman <meuleman@broadcom.com>
  22220. -Date: Fri, 18 Sep 2015 22:08:10 +0200
  22221. -Subject: [PATCH] brcmfmac: Make p2pon module param always available.
  22222. -
  22223. -p2pon module param is currently under define BRCMDBG. Though it is
  22224. -a needed option for older versions of the wpa_supplicant which do not
  22225. -support the P2P_DEVICE interface.
  22226. -
  22227. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  22228. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  22229. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  22230. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  22231. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  22232. ----
  22233. -
  22234. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  22235. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  22236. -@@ -62,10 +62,8 @@ MODULE_PARM_DESC(debug, "level of debug
  22237. -
  22238. - /* P2P0 enable */
  22239. - static int brcmf_p2p_enable;
  22240. --#ifdef CPTCFG_BRCMDBG
  22241. - module_param_named(p2pon, brcmf_p2p_enable, int, 0);
  22242. --MODULE_PARM_DESC(p2pon, "enable p2p management functionality");
  22243. --#endif
  22244. -+MODULE_PARM_DESC(p2pon, "enable legacy p2p management functionality");
  22245. -
  22246. - char *brcmf_ifname(struct brcmf_pub *drvr, int ifidx)
  22247. - {
  22248. 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
  22249. deleted file mode 100644
  22250. index 15ac2d9..0000000
  22251. --- a/package/kernel/mac80211/patches/370-0008-brcmfmac-Workaround-in-change-vif-for-wpa_supplicant.patch
  22252. +++ /dev/null
  22253. @@ -1,76 +0,0 @@
  22254. -From: Hante Meuleman <meuleman@broadcom.com>
  22255. -Date: Fri, 18 Sep 2015 22:08:11 +0200
  22256. -Subject: [PATCH] brcmfmac: Workaround in change vif for wpa_supplicant
  22257. - support.
  22258. -
  22259. -Different wpa_supplicants have different behavior and expectations
  22260. -regarding the change_virtual_intf behavior. This patch implements
  22261. -a workaround for the different versions and possible brcmfmac
  22262. -configuration.
  22263. -
  22264. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  22265. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  22266. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  22267. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  22268. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  22269. ----
  22270. -
  22271. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  22272. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  22273. -@@ -776,6 +776,37 @@ brcmf_cfg80211_change_iface(struct wiphy
  22274. - s32 err = 0;
  22275. -
  22276. - brcmf_dbg(TRACE, "Enter, idx=%d, type=%d\n", ifp->bssidx, type);
  22277. -+
  22278. -+ /* WAR: There are a number of p2p interface related problems which
  22279. -+ * need to be handled initially (before doing the validate).
  22280. -+ * wpa_supplicant tends to do iface changes on p2p device/client/go
  22281. -+ * which are not always possible/allowed. However we need to return
  22282. -+ * OK otherwise the wpa_supplicant wont start. The situation differs
  22283. -+ * on configuration and setup (p2pon=1 module param). The first check
  22284. -+ * is to see if the request is a change to station for p2p iface.
  22285. -+ */
  22286. -+ if ((type == NL80211_IFTYPE_STATION) &&
  22287. -+ ((vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT) ||
  22288. -+ (vif->wdev.iftype == NL80211_IFTYPE_P2P_GO) ||
  22289. -+ (vif->wdev.iftype == NL80211_IFTYPE_P2P_DEVICE))) {
  22290. -+ brcmf_dbg(TRACE, "Ignoring cmd for p2p if\n");
  22291. -+ /* Now depending on whether module param p2pon=1 was used the
  22292. -+ * response needs to be either 0 or EOPNOTSUPP. The reason is
  22293. -+ * that if p2pon=1 is used, but a newer supplicant is used then
  22294. -+ * we should return an error, as this combination wont work.
  22295. -+ * In other situations 0 is returned and supplicant will start
  22296. -+ * normally. It will give a trace in cfg80211, but it is the
  22297. -+ * only way to get it working. Unfortunately this will result
  22298. -+ * in situation where we wont support new supplicant in
  22299. -+ * combination with module param p2pon=1, but that is the way
  22300. -+ * it is. If the user tries this then unloading of driver might
  22301. -+ * fail/lock.
  22302. -+ */
  22303. -+ if (cfg->p2p.p2pdev_dynamically)
  22304. -+ return -EOPNOTSUPP;
  22305. -+ else
  22306. -+ return 0;
  22307. -+ }
  22308. - err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type);
  22309. - if (err) {
  22310. - brcmf_err("iface validation failed: err=%d\n", err);
  22311. -@@ -791,18 +822,6 @@ brcmf_cfg80211_change_iface(struct wiphy
  22312. - infra = 0;
  22313. - break;
  22314. - case NL80211_IFTYPE_STATION:
  22315. -- /* Ignore change for p2p IF. Unclear why supplicant does this */
  22316. -- if ((vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT) ||
  22317. -- (vif->wdev.iftype == NL80211_IFTYPE_P2P_GO)) {
  22318. -- brcmf_dbg(TRACE, "Ignoring cmd for p2p if\n");
  22319. -- /* WAR: It is unexpected to get a change of VIF for P2P
  22320. -- * IF, but it happens. The request can not be handled
  22321. -- * but returning EPERM causes a crash. Returning 0
  22322. -- * without setting ieee80211_ptr->iftype causes trace
  22323. -- * (WARN_ON) but it works with wpa_supplicant
  22324. -- */
  22325. -- return 0;
  22326. -- }
  22327. - infra = 1;
  22328. - break;
  22329. - case NL80211_IFTYPE_AP:
  22330. 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
  22331. deleted file mode 100644
  22332. index 1988b5c..0000000
  22333. --- a/package/kernel/mac80211/patches/370-0009-brcmfmac-Deleting-of-p2p-device-is-leaking-memory.patch
  22334. +++ /dev/null
  22335. @@ -1,124 +0,0 @@
  22336. -From: Hante Meuleman <meuleman@broadcom.com>
  22337. -Date: Fri, 18 Sep 2015 22:08:12 +0200
  22338. -Subject: [PATCH] brcmfmac: Deleting of p2p device is leaking memory.
  22339. -
  22340. -When a p2p device gets deleted, the memory for the vif is not being
  22341. -released. This is solved by reorganizing the cleanup path and
  22342. -properly freeing the memory.
  22343. -
  22344. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  22345. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  22346. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  22347. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  22348. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  22349. ----
  22350. -
  22351. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  22352. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  22353. -@@ -887,6 +887,16 @@ static void brcmf_del_if(struct brcmf_pu
  22354. - cancel_work_sync(&ifp->multicast_work);
  22355. - }
  22356. - brcmf_net_detach(ifp->ndev);
  22357. -+ } else {
  22358. -+ /* Only p2p device interfaces which get dynamically created
  22359. -+ * end up here. In this case the p2p module should be informed
  22360. -+ * about the removal of the interface within the firmware. If
  22361. -+ * not then p2p commands towards the firmware will cause some
  22362. -+ * serious troublesome side effects. The p2p module will clean
  22363. -+ * up the ifp if needed.
  22364. -+ */
  22365. -+ brcmf_p2p_ifp_removed(ifp);
  22366. -+ kfree(ifp);
  22367. - }
  22368. - }
  22369. -
  22370. -@@ -894,7 +904,8 @@ void brcmf_remove_interface(struct brcmf
  22371. - {
  22372. - if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bssidx] != ifp))
  22373. - return;
  22374. --
  22375. -+ brcmf_dbg(TRACE, "Enter, bssidx=%d, ifidx=%d\n", ifp->bssidx,
  22376. -+ ifp->ifidx);
  22377. - brcmf_fws_del_interface(ifp);
  22378. - brcmf_del_if(ifp->drvr, ifp->bssidx);
  22379. - }
  22380. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  22381. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  22382. -@@ -2131,20 +2131,6 @@ fail:
  22383. - }
  22384. -
  22385. - /**
  22386. -- * brcmf_p2p_delete_p2pdev() - delete P2P_DEVICE virtual interface.
  22387. -- *
  22388. -- * @vif: virtual interface object to delete.
  22389. -- */
  22390. --static void brcmf_p2p_delete_p2pdev(struct brcmf_p2p_info *p2p,
  22391. -- struct brcmf_cfg80211_vif *vif)
  22392. --{
  22393. -- cfg80211_unregister_wdev(&vif->wdev);
  22394. -- p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  22395. -- brcmf_remove_interface(vif->ifp);
  22396. -- brcmf_free_vif(vif);
  22397. --}
  22398. --
  22399. --/**
  22400. - * brcmf_p2p_add_vif() - create a new P2P virtual interface.
  22401. - *
  22402. - * @wiphy: wiphy device of new interface.
  22403. -@@ -2264,9 +2250,11 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  22404. - break;
  22405. -
  22406. - case NL80211_IFTYPE_P2P_DEVICE:
  22407. -+ if (!p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif)
  22408. -+ return 0;
  22409. - brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  22410. - brcmf_p2p_deinit_discovery(p2p);
  22411. -- brcmf_p2p_delete_p2pdev(p2p, vif);
  22412. -+ brcmf_remove_interface(vif->ifp);
  22413. - return 0;
  22414. - default:
  22415. - return -ENOTSUPP;
  22416. -@@ -2298,6 +2286,21 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  22417. - return err;
  22418. - }
  22419. -
  22420. -+void brcmf_p2p_ifp_removed(struct brcmf_if *ifp)
  22421. -+{
  22422. -+ struct brcmf_cfg80211_info *cfg;
  22423. -+ struct brcmf_cfg80211_vif *vif;
  22424. -+
  22425. -+ brcmf_dbg(INFO, "P2P: device interface removed\n");
  22426. -+ vif = ifp->vif;
  22427. -+ cfg = wdev_to_cfg(&vif->wdev);
  22428. -+ cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
  22429. -+ rtnl_lock();
  22430. -+ cfg80211_unregister_wdev(&vif->wdev);
  22431. -+ rtnl_unlock();
  22432. -+ brcmf_free_vif(vif);
  22433. -+}
  22434. -+
  22435. - int brcmf_p2p_start_device(struct wiphy *wiphy, struct wireless_dev *wdev)
  22436. - {
  22437. - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  22438. -@@ -2422,10 +2425,7 @@ void brcmf_p2p_detach(struct brcmf_p2p_i
  22439. - if (vif != NULL) {
  22440. - brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  22441. - brcmf_p2p_deinit_discovery(p2p);
  22442. -- /* remove discovery interface */
  22443. -- rtnl_lock();
  22444. -- brcmf_p2p_delete_p2pdev(p2p, vif);
  22445. -- rtnl_unlock();
  22446. -+ brcmf_remove_interface(vif->ifp);
  22447. - }
  22448. - /* just set it all to zero */
  22449. - memset(p2p, 0, sizeof(*p2p));
  22450. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.h
  22451. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.h
  22452. -@@ -156,6 +156,7 @@ struct wireless_dev *brcmf_p2p_add_vif(s
  22453. - int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev);
  22454. - int brcmf_p2p_ifchange(struct brcmf_cfg80211_info *cfg,
  22455. - enum brcmf_fil_p2p_if_types if_type);
  22456. -+void brcmf_p2p_ifp_removed(struct brcmf_if *ifp);
  22457. - int brcmf_p2p_start_device(struct wiphy *wiphy, struct wireless_dev *wdev);
  22458. - void brcmf_p2p_stop_device(struct wiphy *wiphy, struct wireless_dev *wdev);
  22459. - int brcmf_p2p_scan_prep(struct wiphy *wiphy,
  22460. 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
  22461. deleted file mode 100644
  22462. index 5225c9e..0000000
  22463. --- a/package/kernel/mac80211/patches/370-0010-brcmfmac-Only-handle-p2p_stop_device-if-vif-is-valid.patch
  22464. +++ /dev/null
  22465. @@ -1,40 +0,0 @@
  22466. -From: Hante Meuleman <meuleman@broadcom.com>
  22467. -Date: Fri, 18 Sep 2015 22:08:13 +0200
  22468. -Subject: [PATCH] brcmfmac: Only handle p2p_stop_device if vif is valid
  22469. -
  22470. -In some situations it is possible that vif has been removed while
  22471. -cfg80211 invokes the p2p_stop_device handler. This will result in
  22472. -crash.
  22473. -
  22474. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  22475. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  22476. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  22477. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  22478. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  22479. ----
  22480. -
  22481. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  22482. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  22483. -@@ -2324,11 +2324,17 @@ void brcmf_p2p_stop_device(struct wiphy
  22484. - struct brcmf_cfg80211_vif *vif;
  22485. -
  22486. - vif = container_of(wdev, struct brcmf_cfg80211_vif, wdev);
  22487. -- mutex_lock(&cfg->usr_sync);
  22488. -- (void)brcmf_p2p_deinit_discovery(p2p);
  22489. -- brcmf_abort_scanning(cfg);
  22490. -- clear_bit(BRCMF_VIF_STATUS_READY, &vif->sme_state);
  22491. -- mutex_unlock(&cfg->usr_sync);
  22492. -+ /* This call can be result of the unregister_wdev call. In that case
  22493. -+ * we dont want to do anything anymore. Just return. The config vif
  22494. -+ * will have been cleared at this point.
  22495. -+ */
  22496. -+ if (p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif == vif) {
  22497. -+ mutex_lock(&cfg->usr_sync);
  22498. -+ (void)brcmf_p2p_deinit_discovery(p2p);
  22499. -+ brcmf_abort_scanning(cfg);
  22500. -+ clear_bit(BRCMF_VIF_STATUS_READY, &vif->sme_state);
  22501. -+ mutex_unlock(&cfg->usr_sync);
  22502. -+ }
  22503. - }
  22504. -
  22505. - /**
  22506. 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
  22507. deleted file mode 100644
  22508. index e2f24e8..0000000
  22509. --- a/package/kernel/mac80211/patches/370-0011-brcmfmac-Fix-p2p-bug-for-older-firmwares.patch
  22510. +++ /dev/null
  22511. @@ -1,35 +0,0 @@
  22512. -From: Hante Meuleman <meuleman@broadcom.com>
  22513. -Date: Fri, 18 Sep 2015 22:08:14 +0200
  22514. -Subject: [PATCH] brcmfmac: Fix p2p bug for older firmwares.
  22515. -
  22516. -Some devices with older firmwares are reporting new p2p device
  22517. -interface with the wrong type. Accept this type to get p2p
  22518. -working for these devices.
  22519. -
  22520. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  22521. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  22522. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  22523. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  22524. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  22525. ----
  22526. -
  22527. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  22528. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  22529. -@@ -186,11 +186,13 @@ static void brcmf_fweh_handle_if_event(s
  22530. - ifevent->action, ifevent->ifidx, ifevent->bssidx,
  22531. - ifevent->flags, ifevent->role);
  22532. -
  22533. -- /* The P2P Device interface event must not be ignored
  22534. -- * contrary to what firmware tells us.
  22535. -+ /* The P2P Device interface event must not be ignored contrary to what
  22536. -+ * firmware tells us. Older firmware uses p2p noif, with sta role.
  22537. -+ * This should be accepted.
  22538. - */
  22539. -- is_p2pdev = (ifevent->flags & BRCMF_E_IF_FLAG_NOIF) &&
  22540. -- ifevent->role == BRCMF_E_IF_ROLE_P2P_CLIENT;
  22541. -+ is_p2pdev = ((ifevent->flags & BRCMF_E_IF_FLAG_NOIF) &&
  22542. -+ (ifevent->role == BRCMF_E_IF_ROLE_P2P_CLIENT ||
  22543. -+ ifevent->role == BRCMF_E_IF_ROLE_STA));
  22544. - if (!is_p2pdev && (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) {
  22545. - brcmf_dbg(EVENT, "event can be ignored\n");
  22546. - return;
  22547. 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
  22548. deleted file mode 100644
  22549. index 52c787f..0000000
  22550. --- a/package/kernel/mac80211/patches/370-0012-brcmfmac-Add-module-parameter-to-disable-features.patch
  22551. +++ /dev/null
  22552. @@ -1,54 +0,0 @@
  22553. -From: Hante Meuleman <meuleman@broadcom.com>
  22554. -Date: Fri, 18 Sep 2015 22:08:15 +0200
  22555. -Subject: [PATCH] brcmfmac: Add module parameter to disable features.
  22556. -
  22557. -For debugging purpose it is very handy to be able to disable
  22558. -features. It has happened a few times that new features turned
  22559. -out not always being properly detected for all devices/firmwares.
  22560. -Making it possible to disable the feature with a module parameter
  22561. -will make testing/debugging easier.
  22562. -
  22563. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  22564. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  22565. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  22566. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  22567. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  22568. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  22569. ----
  22570. -
  22571. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  22572. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  22573. -@@ -15,6 +15,7 @@
  22574. - */
  22575. -
  22576. - #include <linux/netdevice.h>
  22577. -+#include <linux/module.h>
  22578. -
  22579. - #include <brcm_hw_ids.h>
  22580. - #include "core.h"
  22581. -@@ -23,6 +24,12 @@
  22582. - #include "fwil.h"
  22583. - #include "feature.h"
  22584. -
  22585. -+
  22586. -+/* Module param feature_disable (global for all devices) */
  22587. -+static int brcmf_feature_disable;
  22588. -+module_param_named(feature_disable, brcmf_feature_disable, int, 0);
  22589. -+MODULE_PARM_DESC(feature_disable, "Disable features");
  22590. -+
  22591. - /*
  22592. - * expand feature list to array of feature strings.
  22593. - */
  22594. -@@ -131,6 +138,12 @@ void brcmf_feat_attach(struct brcmf_pub
  22595. - brcmf_feat_iovar_int_set(ifp, BRCMF_FEAT_MBSS, "mbss", 0);
  22596. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_P2P, "p2p");
  22597. -
  22598. -+ if (brcmf_feature_disable) {
  22599. -+ brcmf_dbg(INFO, "Features: 0x%02x, disable: 0x%02x\n",
  22600. -+ ifp->drvr->feat_flags, brcmf_feature_disable);
  22601. -+ ifp->drvr->feat_flags &= ~brcmf_feature_disable;
  22602. -+ }
  22603. -+
  22604. - /* set chip related quirks */
  22605. - switch (drvr->bus_if->chip) {
  22606. - case BRCM_CC_43236_CHIP_ID:
  22607. 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
  22608. deleted file mode 100644
  22609. index 58a638a..0000000
  22610. --- a/package/kernel/mac80211/patches/370-0013-brcmfmac-Fix-race-condition-bug-when-deleting-p2p-in.patch
  22611. +++ /dev/null
  22612. @@ -1,80 +0,0 @@
  22613. -From: Hante Meuleman <meuleman@broadcom.com>
  22614. -Date: Fri, 18 Sep 2015 22:08:16 +0200
  22615. -Subject: [PATCH] brcmfmac: Fix race condition bug when deleting p2p interface.
  22616. -
  22617. -When p2p device interface gets deleted by deinitialising discovery
  22618. -it will result in an event which removes the interface, but that is
  22619. -also done by delete p2p interface code. This results in race
  22620. -condition which sometimes results in lockup/crash. With this patch
  22621. -the delete device interface will wait for the event (with timeout)
  22622. -removing the possible race condition. Also on the stop device call
  22623. -from cfg80211 the deinitialisation of the discovery device should
  22624. -be avoided as it can result in a similar situation.
  22625. -
  22626. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  22627. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  22628. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  22629. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  22630. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  22631. ----
  22632. -
  22633. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  22634. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  22635. -@@ -2238,6 +2238,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  22636. - brcmf_dbg(TRACE, "delete P2P vif\n");
  22637. - vif = container_of(wdev, struct brcmf_cfg80211_vif, wdev);
  22638. -
  22639. -+ brcmf_cfg80211_arm_vif_event(cfg, vif);
  22640. - switch (vif->wdev.iftype) {
  22641. - case NL80211_IFTYPE_P2P_CLIENT:
  22642. - if (test_bit(BRCMF_VIF_STATUS_DISCONNECTING, &vif->sme_state))
  22643. -@@ -2254,8 +2255,6 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  22644. - return 0;
  22645. - brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  22646. - brcmf_p2p_deinit_discovery(p2p);
  22647. -- brcmf_remove_interface(vif->ifp);
  22648. -- return 0;
  22649. - default:
  22650. - return -ENOTSUPP;
  22651. - }
  22652. -@@ -2267,10 +2266,11 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  22653. - wait_for_completion_timeout(&cfg->vif_disabled,
  22654. - msecs_to_jiffies(500));
  22655. -
  22656. -- brcmf_vif_clear_mgmt_ies(vif);
  22657. --
  22658. -- brcmf_cfg80211_arm_vif_event(cfg, vif);
  22659. -- err = brcmf_p2p_release_p2p_if(vif);
  22660. -+ err = 0;
  22661. -+ if (vif->wdev.iftype != NL80211_IFTYPE_P2P_DEVICE) {
  22662. -+ brcmf_vif_clear_mgmt_ies(vif);
  22663. -+ err = brcmf_p2p_release_p2p_if(vif);
  22664. -+ }
  22665. - if (!err) {
  22666. - /* wait for firmware event */
  22667. - err = brcmf_cfg80211_wait_vif_event_timeout(cfg, BRCMF_E_IF_DEL,
  22668. -@@ -2280,8 +2280,12 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  22669. - else
  22670. - err = 0;
  22671. - }
  22672. -+ if (err)
  22673. -+ brcmf_remove_interface(vif->ifp);
  22674. -+
  22675. - brcmf_cfg80211_arm_vif_event(cfg, NULL);
  22676. -- p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif = NULL;
  22677. -+ if (vif->wdev.iftype != NL80211_IFTYPE_P2P_DEVICE)
  22678. -+ p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif = NULL;
  22679. -
  22680. - return err;
  22681. - }
  22682. -@@ -2330,7 +2334,9 @@ void brcmf_p2p_stop_device(struct wiphy
  22683. - */
  22684. - if (p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif == vif) {
  22685. - mutex_lock(&cfg->usr_sync);
  22686. -- (void)brcmf_p2p_deinit_discovery(p2p);
  22687. -+ /* Set the discovery state to SCAN */
  22688. -+ (void)brcmf_p2p_set_discover_state(vif->ifp,
  22689. -+ WL_P2P_DISC_ST_SCAN, 0, 0);
  22690. - brcmf_abort_scanning(cfg);
  22691. - clear_bit(BRCMF_VIF_STATUS_READY, &vif->sme_state);
  22692. - mutex_unlock(&cfg->usr_sync);
  22693. 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
  22694. deleted file mode 100644
  22695. index d0bbf2a..0000000
  22696. --- a/package/kernel/mac80211/patches/370-0014-brcmfmac-Add-support-for-the-BCM4365-and-BCM4366-PCI.patch
  22697. +++ /dev/null
  22698. @@ -1,277 +0,0 @@
  22699. -From: Hante Meuleman <meuleman@broadcom.com>
  22700. -Date: Fri, 18 Sep 2015 22:08:17 +0200
  22701. -Subject: [PATCH] brcmfmac: Add support for the BCM4365 and BCM4366 PCIE
  22702. - devices.
  22703. -
  22704. -This patch adds support for the BCM4365 and BCM4366 11ac Wave2
  22705. -PCIE devices.
  22706. -
  22707. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  22708. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  22709. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  22710. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  22711. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  22712. ----
  22713. -
  22714. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  22715. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  22716. -@@ -208,6 +208,7 @@ struct sbsocramregs {
  22717. - };
  22718. -
  22719. - #define SOCRAMREGOFFS(_f) offsetof(struct sbsocramregs, _f)
  22720. -+#define SYSMEMREGOFFS(_f) offsetof(struct sbsocramregs, _f)
  22721. -
  22722. - #define ARMCR4_CAP (0x04)
  22723. - #define ARMCR4_BANKIDX (0x40)
  22724. -@@ -516,6 +517,9 @@ static int brcmf_chip_cores_check(struct
  22725. - case BCMA_CORE_ARM_CR4:
  22726. - cpu_found = true;
  22727. - break;
  22728. -+ case BCMA_CORE_ARM_CA7:
  22729. -+ cpu_found = true;
  22730. -+ break;
  22731. - default:
  22732. - break;
  22733. - }
  22734. -@@ -614,6 +618,29 @@ static void brcmf_chip_socram_ramsize(st
  22735. - }
  22736. - }
  22737. -
  22738. -+/** Return the SYS MEM size */
  22739. -+static u32 brcmf_chip_sysmem_ramsize(struct brcmf_core_priv *sysmem)
  22740. -+{
  22741. -+ u32 memsize = 0;
  22742. -+ u32 coreinfo;
  22743. -+ u32 idx;
  22744. -+ u32 nb;
  22745. -+ u32 banksize;
  22746. -+
  22747. -+ if (!brcmf_chip_iscoreup(&sysmem->pub))
  22748. -+ brcmf_chip_resetcore(&sysmem->pub, 0, 0, 0);
  22749. -+
  22750. -+ coreinfo = brcmf_chip_core_read32(sysmem, SYSMEMREGOFFS(coreinfo));
  22751. -+ nb = (coreinfo & SRCI_SRNB_MASK) >> SRCI_SRNB_SHIFT;
  22752. -+
  22753. -+ for (idx = 0; idx < nb; idx++) {
  22754. -+ brcmf_chip_socram_banksize(sysmem, idx, &banksize);
  22755. -+ memsize += banksize;
  22756. -+ }
  22757. -+
  22758. -+ return memsize;
  22759. -+}
  22760. -+
  22761. - /** Return the TCM-RAM size of the ARMCR4 core. */
  22762. - static u32 brcmf_chip_tcm_ramsize(struct brcmf_core_priv *cr4)
  22763. - {
  22764. -@@ -656,6 +683,9 @@ static u32 brcmf_chip_tcm_rambase(struct
  22765. - case BRCM_CC_4358_CHIP_ID:
  22766. - case BRCM_CC_43602_CHIP_ID:
  22767. - return 0x180000;
  22768. -+ case BRCM_CC_4365_CHIP_ID:
  22769. -+ case BRCM_CC_4366_CHIP_ID:
  22770. -+ return 0x200000;
  22771. - default:
  22772. - brcmf_err("unknown chip: %s\n", ci->pub.name);
  22773. - break;
  22774. -@@ -678,10 +708,28 @@ static int brcmf_chip_get_raminfo(struct
  22775. - return -EINVAL;
  22776. - }
  22777. - } else {
  22778. -- mem = brcmf_chip_get_core(&ci->pub, BCMA_CORE_INTERNAL_MEM);
  22779. -- mem_core = container_of(mem, struct brcmf_core_priv, pub);
  22780. -- brcmf_chip_socram_ramsize(mem_core, &ci->pub.ramsize,
  22781. -- &ci->pub.srsize);
  22782. -+ mem = brcmf_chip_get_core(&ci->pub, BCMA_CORE_SYS_MEM);
  22783. -+ if (mem) {
  22784. -+ mem_core = container_of(mem, struct brcmf_core_priv,
  22785. -+ pub);
  22786. -+ ci->pub.ramsize = brcmf_chip_sysmem_ramsize(mem_core);
  22787. -+ ci->pub.rambase = brcmf_chip_tcm_rambase(ci);
  22788. -+ if (!ci->pub.rambase) {
  22789. -+ brcmf_err("RAM base not provided with ARM CA7 core\n");
  22790. -+ return -EINVAL;
  22791. -+ }
  22792. -+ } else {
  22793. -+ mem = brcmf_chip_get_core(&ci->pub,
  22794. -+ BCMA_CORE_INTERNAL_MEM);
  22795. -+ if (!mem) {
  22796. -+ brcmf_err("No memory cores found\n");
  22797. -+ return -ENOMEM;
  22798. -+ }
  22799. -+ mem_core = container_of(mem, struct brcmf_core_priv,
  22800. -+ pub);
  22801. -+ brcmf_chip_socram_ramsize(mem_core, &ci->pub.ramsize,
  22802. -+ &ci->pub.srsize);
  22803. -+ }
  22804. - }
  22805. - brcmf_dbg(INFO, "RAM: base=0x%x size=%d (0x%x) sr=%d (0x%x)\n",
  22806. - ci->pub.rambase, ci->pub.ramsize, ci->pub.ramsize,
  22807. -@@ -924,7 +972,7 @@ static int brcmf_chip_recognition(struct
  22808. - static void brcmf_chip_disable_arm(struct brcmf_chip_priv *chip, u16 id)
  22809. - {
  22810. - struct brcmf_core *core;
  22811. -- struct brcmf_core_priv *cr4;
  22812. -+ struct brcmf_core_priv *cpu;
  22813. - u32 val;
  22814. -
  22815. -
  22816. -@@ -937,10 +985,11 @@ static void brcmf_chip_disable_arm(struc
  22817. - brcmf_chip_coredisable(core, 0, 0);
  22818. - break;
  22819. - case BCMA_CORE_ARM_CR4:
  22820. -- cr4 = container_of(core, struct brcmf_core_priv, pub);
  22821. -+ case BCMA_CORE_ARM_CA7:
  22822. -+ cpu = container_of(core, struct brcmf_core_priv, pub);
  22823. -
  22824. - /* clear all IOCTL bits except HALT bit */
  22825. -- val = chip->ops->read32(chip->ctx, cr4->wrapbase + BCMA_IOCTL);
  22826. -+ val = chip->ops->read32(chip->ctx, cpu->wrapbase + BCMA_IOCTL);
  22827. - val &= ARMCR4_BCMA_IOCTL_CPUHALT;
  22828. - brcmf_chip_resetcore(core, val, ARMCR4_BCMA_IOCTL_CPUHALT,
  22829. - ARMCR4_BCMA_IOCTL_CPUHALT);
  22830. -@@ -1162,6 +1211,33 @@ static bool brcmf_chip_cr4_set_active(st
  22831. - return true;
  22832. - }
  22833. -
  22834. -+static inline void
  22835. -+brcmf_chip_ca7_set_passive(struct brcmf_chip_priv *chip)
  22836. -+{
  22837. -+ struct brcmf_core *core;
  22838. -+
  22839. -+ brcmf_chip_disable_arm(chip, BCMA_CORE_ARM_CA7);
  22840. -+
  22841. -+ core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_80211);
  22842. -+ brcmf_chip_resetcore(core, D11_BCMA_IOCTL_PHYRESET |
  22843. -+ D11_BCMA_IOCTL_PHYCLOCKEN,
  22844. -+ D11_BCMA_IOCTL_PHYCLOCKEN,
  22845. -+ D11_BCMA_IOCTL_PHYCLOCKEN);
  22846. -+}
  22847. -+
  22848. -+static bool brcmf_chip_ca7_set_active(struct brcmf_chip_priv *chip, u32 rstvec)
  22849. -+{
  22850. -+ struct brcmf_core *core;
  22851. -+
  22852. -+ chip->ops->activate(chip->ctx, &chip->pub, rstvec);
  22853. -+
  22854. -+ /* restore ARM */
  22855. -+ core = brcmf_chip_get_core(&chip->pub, BCMA_CORE_ARM_CA7);
  22856. -+ brcmf_chip_resetcore(core, ARMCR4_BCMA_IOCTL_CPUHALT, 0, 0);
  22857. -+
  22858. -+ return true;
  22859. -+}
  22860. -+
  22861. - void brcmf_chip_set_passive(struct brcmf_chip *pub)
  22862. - {
  22863. - struct brcmf_chip_priv *chip;
  22864. -@@ -1175,8 +1251,16 @@ void brcmf_chip_set_passive(struct brcmf
  22865. - brcmf_chip_cr4_set_passive(chip);
  22866. - return;
  22867. - }
  22868. --
  22869. -- brcmf_chip_cm3_set_passive(chip);
  22870. -+ arm = brcmf_chip_get_core(pub, BCMA_CORE_ARM_CA7);
  22871. -+ if (arm) {
  22872. -+ brcmf_chip_ca7_set_passive(chip);
  22873. -+ return;
  22874. -+ }
  22875. -+ arm = brcmf_chip_get_core(pub, BCMA_CORE_ARM_CM3);
  22876. -+ if (arm) {
  22877. -+ brcmf_chip_cm3_set_passive(chip);
  22878. -+ return;
  22879. -+ }
  22880. - }
  22881. -
  22882. - bool brcmf_chip_set_active(struct brcmf_chip *pub, u32 rstvec)
  22883. -@@ -1190,8 +1274,14 @@ bool brcmf_chip_set_active(struct brcmf_
  22884. - arm = brcmf_chip_get_core(pub, BCMA_CORE_ARM_CR4);
  22885. - if (arm)
  22886. - return brcmf_chip_cr4_set_active(chip, rstvec);
  22887. -+ arm = brcmf_chip_get_core(pub, BCMA_CORE_ARM_CA7);
  22888. -+ if (arm)
  22889. -+ return brcmf_chip_ca7_set_active(chip, rstvec);
  22890. -+ arm = brcmf_chip_get_core(pub, BCMA_CORE_ARM_CM3);
  22891. -+ if (arm)
  22892. -+ return brcmf_chip_cm3_set_active(chip);
  22893. -
  22894. -- return brcmf_chip_cm3_set_active(chip);
  22895. -+ return false;
  22896. - }
  22897. -
  22898. - bool brcmf_chip_sr_capable(struct brcmf_chip *pub)
  22899. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  22900. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  22901. -@@ -55,6 +55,10 @@ enum brcmf_pcie_state {
  22902. - #define BRCMF_PCIE_43570_NVRAM_NAME "brcm/brcmfmac43570-pcie.txt"
  22903. - #define BRCMF_PCIE_4358_FW_NAME "brcm/brcmfmac4358-pcie.bin"
  22904. - #define BRCMF_PCIE_4358_NVRAM_NAME "brcm/brcmfmac4358-pcie.txt"
  22905. -+#define BRCMF_PCIE_4365_FW_NAME "brcm/brcmfmac4365b-pcie.bin"
  22906. -+#define BRCMF_PCIE_4365_NVRAM_NAME "brcm/brcmfmac4365b-pcie.txt"
  22907. -+#define BRCMF_PCIE_4366_FW_NAME "brcm/brcmfmac4366b-pcie.bin"
  22908. -+#define BRCMF_PCIE_4366_NVRAM_NAME "brcm/brcmfmac4366b-pcie.txt"
  22909. -
  22910. - #define BRCMF_PCIE_FW_UP_TIMEOUT 2000 /* msec */
  22911. -
  22912. -@@ -204,6 +208,10 @@ MODULE_FIRMWARE(BRCMF_PCIE_43570_FW_NAME
  22913. - MODULE_FIRMWARE(BRCMF_PCIE_43570_NVRAM_NAME);
  22914. - MODULE_FIRMWARE(BRCMF_PCIE_4358_FW_NAME);
  22915. - MODULE_FIRMWARE(BRCMF_PCIE_4358_NVRAM_NAME);
  22916. -+MODULE_FIRMWARE(BRCMF_PCIE_4365_FW_NAME);
  22917. -+MODULE_FIRMWARE(BRCMF_PCIE_4365_NVRAM_NAME);
  22918. -+MODULE_FIRMWARE(BRCMF_PCIE_4366_FW_NAME);
  22919. -+MODULE_FIRMWARE(BRCMF_PCIE_4366_NVRAM_NAME);
  22920. -
  22921. -
  22922. - struct brcmf_pcie_console {
  22923. -@@ -1440,6 +1448,14 @@ static int brcmf_pcie_get_fwnames(struct
  22924. - fw_name = BRCMF_PCIE_4358_FW_NAME;
  22925. - nvram_name = BRCMF_PCIE_4358_NVRAM_NAME;
  22926. - break;
  22927. -+ case BRCM_CC_4365_CHIP_ID:
  22928. -+ fw_name = BRCMF_PCIE_4365_FW_NAME;
  22929. -+ nvram_name = BRCMF_PCIE_4365_NVRAM_NAME;
  22930. -+ break;
  22931. -+ case BRCM_CC_4366_CHIP_ID:
  22932. -+ fw_name = BRCMF_PCIE_4366_FW_NAME;
  22933. -+ nvram_name = BRCMF_PCIE_4366_NVRAM_NAME;
  22934. -+ break;
  22935. - default:
  22936. - brcmf_err("Unsupported chip 0x%04x\n", devinfo->ci->chip);
  22937. - return -ENODEV;
  22938. -@@ -1973,6 +1989,12 @@ static struct pci_device_id brcmf_pcie_d
  22939. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_2G_DEVICE_ID),
  22940. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_5G_DEVICE_ID),
  22941. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_RAW_DEVICE_ID),
  22942. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_DEVICE_ID),
  22943. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_2G_DEVICE_ID),
  22944. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_5G_DEVICE_ID),
  22945. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_DEVICE_ID),
  22946. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_2G_DEVICE_ID),
  22947. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_5G_DEVICE_ID),
  22948. - { /* end: all zeroes */ }
  22949. - };
  22950. -
  22951. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  22952. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  22953. -@@ -48,6 +48,8 @@
  22954. - #define BRCM_CC_43570_CHIP_ID 43570
  22955. - #define BRCM_CC_4358_CHIP_ID 0x4358
  22956. - #define BRCM_CC_43602_CHIP_ID 43602
  22957. -+#define BRCM_CC_4365_CHIP_ID 0x4365
  22958. -+#define BRCM_CC_4366_CHIP_ID 0x4366
  22959. -
  22960. - /* USB Device IDs */
  22961. - #define BRCM_USB_43143_DEVICE_ID 0xbd1e
  22962. -@@ -67,6 +69,13 @@
  22963. - #define BRCM_PCIE_43602_2G_DEVICE_ID 0x43bb
  22964. - #define BRCM_PCIE_43602_5G_DEVICE_ID 0x43bc
  22965. - #define BRCM_PCIE_43602_RAW_DEVICE_ID 43602
  22966. -+#define BRCM_PCIE_4365_DEVICE_ID 0x43ca
  22967. -+#define BRCM_PCIE_4365_2G_DEVICE_ID 0x43cb
  22968. -+#define BRCM_PCIE_4365_5G_DEVICE_ID 0x43cc
  22969. -+#define BRCM_PCIE_4366_DEVICE_ID 0x43c3
  22970. -+#define BRCM_PCIE_4366_2G_DEVICE_ID 0x43c4
  22971. -+#define BRCM_PCIE_4366_5G_DEVICE_ID 0x43c5
  22972. -+
  22973. -
  22974. - /* brcmsmac IDs */
  22975. - #define BCM4313_D11N2G_ID 0x4727 /* 4313 802.11n 2.4G device */
  22976. 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
  22977. deleted file mode 100644
  22978. index d33c803..0000000
  22979. --- a/package/kernel/mac80211/patches/370-0015-brcmfmac-Fix-TDLS-setup-by-properly-handling-p2p-noi.patch
  22980. +++ /dev/null
  22981. @@ -1,120 +0,0 @@
  22982. -From: Hante Meuleman <meuleman@broadcom.com>
  22983. -Date: Fri, 18 Sep 2015 22:08:18 +0200
  22984. -Subject: [PATCH] brcmfmac: Fix TDLS setup by properly handling p2p noif.
  22985. -
  22986. -There is a workaround needed for p2p device setup which breaks tdls
  22987. -functionality. This patch fixes that by properly signalling fweh that
  22988. -p2p device setup is ongoing.
  22989. -
  22990. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  22991. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  22992. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  22993. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  22994. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  22995. ----
  22996. -
  22997. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  22998. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  22999. -@@ -188,11 +188,13 @@ static void brcmf_fweh_handle_if_event(s
  23000. -
  23001. - /* The P2P Device interface event must not be ignored contrary to what
  23002. - * firmware tells us. Older firmware uses p2p noif, with sta role.
  23003. -- * This should be accepted.
  23004. -+ * This should be accepted when p2pdev_setup is ongoing. TDLS setup will
  23005. -+ * use the same ifevent and should be ignored.
  23006. - */
  23007. - is_p2pdev = ((ifevent->flags & BRCMF_E_IF_FLAG_NOIF) &&
  23008. - (ifevent->role == BRCMF_E_IF_ROLE_P2P_CLIENT ||
  23009. -- ifevent->role == BRCMF_E_IF_ROLE_STA));
  23010. -+ ((ifevent->role == BRCMF_E_IF_ROLE_STA) &&
  23011. -+ (drvr->fweh.p2pdev_setup_ongoing))));
  23012. - if (!is_p2pdev && (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) {
  23013. - brcmf_dbg(EVENT, "event can be ignored\n");
  23014. - return;
  23015. -@@ -316,6 +318,17 @@ event_free:
  23016. - }
  23017. -
  23018. - /**
  23019. -+ * brcmf_fweh_p2pdev_setup() - P2P device setup ongoing (or not).
  23020. -+ *
  23021. -+ * @ifp: ifp on which setup is taking place or finished.
  23022. -+ * @ongoing: p2p device setup in progress (or not).
  23023. -+ */
  23024. -+void brcmf_fweh_p2pdev_setup(struct brcmf_if *ifp, bool ongoing)
  23025. -+{
  23026. -+ ifp->drvr->fweh.p2pdev_setup_ongoing = ongoing;
  23027. -+}
  23028. -+
  23029. -+/**
  23030. - * brcmf_fweh_attach() - initialize firmware event handling.
  23031. - *
  23032. - * @drvr: driver information object.
  23033. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  23034. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  23035. -@@ -230,12 +230,14 @@ typedef int (*brcmf_fweh_handler_t)(stru
  23036. - /**
  23037. - * struct brcmf_fweh_info - firmware event handling information.
  23038. - *
  23039. -+ * @p2pdev_setup_ongoing: P2P device creation in progress.
  23040. - * @event_work: event worker.
  23041. - * @evt_q_lock: lock for event queue protection.
  23042. - * @event_q: event queue.
  23043. - * @evt_handler: registered event handlers.
  23044. - */
  23045. - struct brcmf_fweh_info {
  23046. -+ bool p2pdev_setup_ongoing;
  23047. - struct work_struct event_work;
  23048. - spinlock_t evt_q_lock;
  23049. - struct list_head event_q;
  23050. -@@ -255,6 +257,7 @@ void brcmf_fweh_unregister(struct brcmf_
  23051. - int brcmf_fweh_activate_events(struct brcmf_if *ifp);
  23052. - void brcmf_fweh_process_event(struct brcmf_pub *drvr,
  23053. - struct brcmf_event *event_packet);
  23054. -+void brcmf_fweh_p2pdev_setup(struct brcmf_if *ifp, bool ongoing);
  23055. -
  23056. - static inline void brcmf_fweh_process_skb(struct brcmf_pub *drvr,
  23057. - struct sk_buff *skb)
  23058. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  23059. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  23060. -@@ -2084,11 +2084,13 @@ static struct wireless_dev *brcmf_p2p_cr
  23061. - brcmf_p2p_set_firmware(pri_ifp, p2p->dev_addr);
  23062. -
  23063. - brcmf_cfg80211_arm_vif_event(p2p->cfg, p2p_vif);
  23064. -+ brcmf_fweh_p2pdev_setup(pri_ifp, true);
  23065. -
  23066. - /* Initialize P2P Discovery in the firmware */
  23067. - err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1);
  23068. - if (err < 0) {
  23069. - brcmf_err("set p2p_disc error\n");
  23070. -+ brcmf_fweh_p2pdev_setup(pri_ifp, false);
  23071. - brcmf_cfg80211_arm_vif_event(p2p->cfg, NULL);
  23072. - goto fail;
  23073. - }
  23074. -@@ -2097,6 +2099,7 @@ static struct wireless_dev *brcmf_p2p_cr
  23075. - err = brcmf_cfg80211_wait_vif_event_timeout(p2p->cfg, BRCMF_E_IF_ADD,
  23076. - msecs_to_jiffies(1500));
  23077. - brcmf_cfg80211_arm_vif_event(p2p->cfg, NULL);
  23078. -+ brcmf_fweh_p2pdev_setup(pri_ifp, false);
  23079. - if (!err) {
  23080. - brcmf_err("timeout occurred\n");
  23081. - err = -EIO;
  23082. -@@ -2393,6 +2396,8 @@ s32 brcmf_p2p_attach(struct brcmf_cfg802
  23083. - memcpy(p2p_ifp->mac_addr, p2p->dev_addr, ETH_ALEN);
  23084. - brcmf_p2p_set_firmware(pri_ifp, p2p->dev_addr);
  23085. -
  23086. -+ brcmf_fweh_p2pdev_setup(pri_ifp, true);
  23087. -+
  23088. - /* Initialize P2P Discovery in the firmware */
  23089. - err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1);
  23090. - if (err < 0) {
  23091. -@@ -2419,8 +2424,9 @@ s32 brcmf_p2p_attach(struct brcmf_cfg802
  23092. - INIT_WORK(&p2p->afx_hdl.afx_work, brcmf_p2p_afx_handler);
  23093. - init_completion(&p2p->afx_hdl.act_frm_scan);
  23094. - init_completion(&p2p->wait_next_af);
  23095. -- }
  23096. - exit:
  23097. -+ brcmf_fweh_p2pdev_setup(pri_ifp, false);
  23098. -+ }
  23099. - return err;
  23100. - }
  23101. -
  23102. 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
  23103. deleted file mode 100644
  23104. index b880078..0000000
  23105. --- a/package/kernel/mac80211/patches/370-0016-brcmfmac-Accept-events-when-TDLS-is-used-in-combinat.patch
  23106. +++ /dev/null
  23107. @@ -1,29 +0,0 @@
  23108. -From: Hante Meuleman <meuleman@broadcom.com>
  23109. -Date: Fri, 18 Sep 2015 22:08:19 +0200
  23110. -Subject: [PATCH] brcmfmac: Accept events when TDLS is used in combination with
  23111. - p2p.
  23112. -
  23113. -TDLS events are mapped back to primary interface but when p2p is in
  23114. -use then this fails because the check was incorrect by checking
  23115. -bsscfg number. Which can be different when a p2p device has been
  23116. -created.
  23117. -
  23118. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  23119. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  23120. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  23121. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  23122. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  23123. ----
  23124. -
  23125. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  23126. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  23127. -@@ -300,8 +300,7 @@ static void brcmf_fweh_event_worker(stru
  23128. - goto event_free;
  23129. - }
  23130. -
  23131. -- if ((event->code == BRCMF_E_TDLS_PEER_EVENT) &&
  23132. -- (emsg.bsscfgidx == 1))
  23133. -+ if (event->code == BRCMF_E_TDLS_PEER_EVENT)
  23134. - ifp = drvr->iflist[0];
  23135. - else
  23136. - ifp = drvr->iflist[emsg.bsscfgidx];
  23137. 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
  23138. deleted file mode 100644
  23139. index 9311a9d..0000000
  23140. --- a/package/kernel/mac80211/patches/371-brcmfmac-include-linux-atomic.h.patch
  23141. +++ /dev/null
  23142. @@ -1,23 +0,0 @@
  23143. -From: Hauke Mehrtens <hauke@hauke-m.de>
  23144. -Date: Sat, 19 Sep 2015 12:47:20 +0200
  23145. -Subject: [PATCH] brcmfmac: include linux/atomic.h
  23146. -
  23147. -brcmfmac uses atomic_or() and other atomic_* functions, but does not
  23148. -include linux/atomic.h. This file gets included by some other header
  23149. -file so this normally does not cause problems.
  23150. -
  23151. -Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  23152. -Acked-by: Arend van Spriel <arend@broadcom.com>
  23153. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  23154. ----
  23155. -
  23156. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  23157. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  23158. -@@ -15,6 +15,7 @@
  23159. - */
  23160. -
  23161. - #include <linux/types.h>
  23162. -+#include <linux/atomic.h>
  23163. - #include <linux/kernel.h>
  23164. - #include <linux/kthread.h>
  23165. - #include <linux/printk.h>
  23166. 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
  23167. deleted file mode 100644
  23168. index cf3f278..0000000
  23169. --- a/package/kernel/mac80211/patches/372-0001-brcmfmac-expose-device-memory-to-devcoredump-subsyst.patch
  23170. +++ /dev/null
  23171. @@ -1,347 +0,0 @@
  23172. -From: Arend van Spriel <arend@broadcom.com>
  23173. -Date: Thu, 8 Oct 2015 20:33:11 +0200
  23174. -Subject: [PATCH] brcmfmac: expose device memory to devcoredump subsystem
  23175. -
  23176. -Upon PSM watchdog event received from firmware the driver will obtain
  23177. -a memory snapshot of the device and expose it to user-space through
  23178. -the devcoredump framework. This will trigger a uevent.
  23179. -
  23180. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  23181. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  23182. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  23183. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  23184. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  23185. ----
  23186. -
  23187. ---- a/drivers/net/wireless/brcm80211/Kconfig
  23188. -+++ b/drivers/net/wireless/brcm80211/Kconfig
  23189. -@@ -85,5 +85,6 @@ config BRCM_TRACING
  23190. - config BRCMDBG
  23191. - bool "Broadcom driver debug functions"
  23192. - depends on BRCMSMAC || BRCMFMAC
  23193. -+ select WANT_DEV_COREDUMP
  23194. - ---help---
  23195. - Selecting this enables additional code for debug purposes.
  23196. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bus.h
  23197. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bus.h
  23198. -@@ -65,6 +65,8 @@ struct brcmf_bus_dcmd {
  23199. - * @rxctl: receive a control response message from dongle.
  23200. - * @gettxq: obtain a reference of bus transmit queue (optional).
  23201. - * @wowl_config: specify if dongle is configured for wowl when going to suspend
  23202. -+ * @get_ramsize: obtain size of device memory.
  23203. -+ * @get_memdump: obtain device memory dump in provided buffer.
  23204. - *
  23205. - * This structure provides an abstract interface towards the
  23206. - * bus specific driver. For control messages to common driver
  23207. -@@ -79,6 +81,8 @@ struct brcmf_bus_ops {
  23208. - int (*rxctl)(struct device *dev, unsigned char *msg, uint len);
  23209. - struct pktq * (*gettxq)(struct device *dev);
  23210. - void (*wowl_config)(struct device *dev, bool enabled);
  23211. -+ size_t (*get_ramsize)(struct device *dev);
  23212. -+ int (*get_memdump)(struct device *dev, void *data, size_t len);
  23213. - };
  23214. -
  23215. -
  23216. -@@ -185,6 +189,23 @@ void brcmf_bus_wowl_config(struct brcmf_
  23217. - bus->ops->wowl_config(bus->dev, enabled);
  23218. - }
  23219. -
  23220. -+static inline size_t brcmf_bus_get_ramsize(struct brcmf_bus *bus)
  23221. -+{
  23222. -+ if (!bus->ops->get_ramsize)
  23223. -+ return 0;
  23224. -+
  23225. -+ return bus->ops->get_ramsize(bus->dev);
  23226. -+}
  23227. -+
  23228. -+static inline
  23229. -+int brcmf_bus_get_memdump(struct brcmf_bus *bus, void *data, size_t len)
  23230. -+{
  23231. -+ if (!bus->ops->get_memdump)
  23232. -+ return -EOPNOTSUPP;
  23233. -+
  23234. -+ return bus->ops->get_memdump(bus->dev, data, len);
  23235. -+}
  23236. -+
  23237. - /*
  23238. - * interface functions from common layer
  23239. - */
  23240. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  23241. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  23242. -@@ -957,8 +957,8 @@ int brcmf_attach(struct device *dev)
  23243. - drvr->bus_if = dev_get_drvdata(dev);
  23244. - drvr->bus_if->drvr = drvr;
  23245. -
  23246. -- /* create device debugfs folder */
  23247. -- brcmf_debugfs_attach(drvr);
  23248. -+ /* attach debug facilities */
  23249. -+ brcmf_debug_attach(drvr);
  23250. -
  23251. - /* Attach and link in the protocol */
  23252. - ret = brcmf_proto_attach(drvr);
  23253. -@@ -1155,7 +1155,7 @@ void brcmf_detach(struct device *dev)
  23254. -
  23255. - brcmf_proto_detach(drvr);
  23256. -
  23257. -- brcmf_debugfs_detach(drvr);
  23258. -+ brcmf_debug_detach(drvr);
  23259. - bus_if->drvr = NULL;
  23260. - kfree(drvr);
  23261. - }
  23262. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  23263. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  23264. -@@ -16,15 +16,45 @@
  23265. - #include <linux/debugfs.h>
  23266. - #include <linux/netdevice.h>
  23267. - #include <linux/module.h>
  23268. -+#include <linux/devcoredump.h>
  23269. -
  23270. - #include <brcmu_wifi.h>
  23271. - #include <brcmu_utils.h>
  23272. - #include "core.h"
  23273. - #include "bus.h"
  23274. -+#include "fweh.h"
  23275. - #include "debug.h"
  23276. -
  23277. - static struct dentry *root_folder;
  23278. -
  23279. -+static int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data,
  23280. -+ size_t len)
  23281. -+{
  23282. -+ void *dump;
  23283. -+ size_t ramsize;
  23284. -+
  23285. -+ ramsize = brcmf_bus_get_ramsize(bus);
  23286. -+ if (ramsize) {
  23287. -+ dump = vzalloc(len + ramsize);
  23288. -+ if (!dump)
  23289. -+ return -ENOMEM;
  23290. -+ memcpy(dump, data, len);
  23291. -+ brcmf_bus_get_memdump(bus, dump + len, ramsize);
  23292. -+ dev_coredumpv(bus->dev, dump, len + ramsize, GFP_KERNEL);
  23293. -+ }
  23294. -+ return 0;
  23295. -+}
  23296. -+
  23297. -+static int brcmf_debug_psm_watchdog_notify(struct brcmf_if *ifp,
  23298. -+ const struct brcmf_event_msg *evtmsg,
  23299. -+ void *data)
  23300. -+{
  23301. -+ brcmf_dbg(TRACE, "enter: idx=%d\n", ifp->bssidx);
  23302. -+
  23303. -+ return brcmf_debug_create_memdump(ifp->drvr->bus_if, data,
  23304. -+ evtmsg->datalen);
  23305. -+}
  23306. -+
  23307. - void brcmf_debugfs_init(void)
  23308. - {
  23309. - root_folder = debugfs_create_dir(KBUILD_MODNAME, NULL);
  23310. -@@ -41,7 +71,7 @@ void brcmf_debugfs_exit(void)
  23311. - root_folder = NULL;
  23312. - }
  23313. -
  23314. --int brcmf_debugfs_attach(struct brcmf_pub *drvr)
  23315. -+int brcmf_debug_attach(struct brcmf_pub *drvr)
  23316. - {
  23317. - struct device *dev = drvr->bus_if->dev;
  23318. -
  23319. -@@ -49,12 +79,18 @@ int brcmf_debugfs_attach(struct brcmf_pu
  23320. - return -ENODEV;
  23321. -
  23322. - drvr->dbgfs_dir = debugfs_create_dir(dev_name(dev), root_folder);
  23323. -+ if (IS_ERR(drvr->dbgfs_dir))
  23324. -+ return PTR_ERR(drvr->dbgfs_dir);
  23325. -
  23326. -- return PTR_ERR_OR_ZERO(drvr->dbgfs_dir);
  23327. -+
  23328. -+ return brcmf_fweh_register(drvr, BRCMF_E_PSM_WATCHDOG,
  23329. -+ brcmf_debug_psm_watchdog_notify);
  23330. - }
  23331. -
  23332. --void brcmf_debugfs_detach(struct brcmf_pub *drvr)
  23333. -+void brcmf_debug_detach(struct brcmf_pub *drvr)
  23334. - {
  23335. -+ brcmf_fweh_unregister(drvr, BRCMF_E_PSM_WATCHDOG);
  23336. -+
  23337. - if (!IS_ERR_OR_NULL(drvr->dbgfs_dir))
  23338. - debugfs_remove_recursive(drvr->dbgfs_dir);
  23339. - }
  23340. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  23341. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  23342. -@@ -109,8 +109,8 @@ struct brcmf_pub;
  23343. - #ifdef DEBUG
  23344. - void brcmf_debugfs_init(void);
  23345. - void brcmf_debugfs_exit(void);
  23346. --int brcmf_debugfs_attach(struct brcmf_pub *drvr);
  23347. --void brcmf_debugfs_detach(struct brcmf_pub *drvr);
  23348. -+int brcmf_debug_attach(struct brcmf_pub *drvr);
  23349. -+void brcmf_debug_detach(struct brcmf_pub *drvr);
  23350. - struct dentry *brcmf_debugfs_get_devdir(struct brcmf_pub *drvr);
  23351. - int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn,
  23352. - int (*read_fn)(struct seq_file *seq, void *data));
  23353. -@@ -121,11 +121,11 @@ static inline void brcmf_debugfs_init(vo
  23354. - static inline void brcmf_debugfs_exit(void)
  23355. - {
  23356. - }
  23357. --static inline int brcmf_debugfs_attach(struct brcmf_pub *drvr)
  23358. -+static inline int brcmf_debug_attach(struct brcmf_pub *drvr)
  23359. - {
  23360. - return 0;
  23361. - }
  23362. --static inline void brcmf_debugfs_detach(struct brcmf_pub *drvr)
  23363. -+static inline void brcmf_debug_detach(struct brcmf_pub *drvr)
  23364. - {
  23365. - }
  23366. - static inline
  23367. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  23368. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  23369. -@@ -448,6 +448,47 @@ brcmf_pcie_copy_mem_todev(struct brcmf_p
  23370. - }
  23371. -
  23372. -
  23373. -+static void
  23374. -+brcmf_pcie_copy_dev_tomem(struct brcmf_pciedev_info *devinfo, u32 mem_offset,
  23375. -+ void *dstaddr, u32 len)
  23376. -+{
  23377. -+ void __iomem *address = devinfo->tcm + mem_offset;
  23378. -+ __le32 *dst32;
  23379. -+ __le16 *dst16;
  23380. -+ u8 *dst8;
  23381. -+
  23382. -+ if (((ulong)address & 4) || ((ulong)dstaddr & 4) || (len & 4)) {
  23383. -+ if (((ulong)address & 2) || ((ulong)dstaddr & 2) || (len & 2)) {
  23384. -+ dst8 = (u8 *)dstaddr;
  23385. -+ while (len) {
  23386. -+ *dst8 = ioread8(address);
  23387. -+ address++;
  23388. -+ dst8++;
  23389. -+ len--;
  23390. -+ }
  23391. -+ } else {
  23392. -+ len = len / 2;
  23393. -+ dst16 = (__le16 *)dstaddr;
  23394. -+ while (len) {
  23395. -+ *dst16 = cpu_to_le16(ioread16(address));
  23396. -+ address += 2;
  23397. -+ dst16++;
  23398. -+ len--;
  23399. -+ }
  23400. -+ }
  23401. -+ } else {
  23402. -+ len = len / 4;
  23403. -+ dst32 = (__le32 *)dstaddr;
  23404. -+ while (len) {
  23405. -+ *dst32 = cpu_to_le32(ioread32(address));
  23406. -+ address += 4;
  23407. -+ dst32++;
  23408. -+ len--;
  23409. -+ }
  23410. -+ }
  23411. -+}
  23412. -+
  23413. -+
  23414. - #define WRITECC32(devinfo, reg, value) brcmf_pcie_write_reg32(devinfo, \
  23415. - CHIPCREGOFFS(reg), value)
  23416. -
  23417. -@@ -1352,12 +1393,36 @@ static void brcmf_pcie_wowl_config(struc
  23418. - }
  23419. -
  23420. -
  23421. -+static size_t brcmf_pcie_get_ramsize(struct device *dev)
  23422. -+{
  23423. -+ struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  23424. -+ struct brcmf_pciedev *buspub = bus_if->bus_priv.pcie;
  23425. -+ struct brcmf_pciedev_info *devinfo = buspub->devinfo;
  23426. -+
  23427. -+ return devinfo->ci->ramsize - devinfo->ci->srsize;
  23428. -+}
  23429. -+
  23430. -+
  23431. -+static int brcmf_pcie_get_memdump(struct device *dev, void *data, size_t len)
  23432. -+{
  23433. -+ struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  23434. -+ struct brcmf_pciedev *buspub = bus_if->bus_priv.pcie;
  23435. -+ struct brcmf_pciedev_info *devinfo = buspub->devinfo;
  23436. -+
  23437. -+ brcmf_dbg(PCIE, "dump at 0x%08X: len=%zu\n", devinfo->ci->rambase, len);
  23438. -+ brcmf_pcie_copy_dev_tomem(devinfo, devinfo->ci->rambase, data, len);
  23439. -+ return 0;
  23440. -+}
  23441. -+
  23442. -+
  23443. - static struct brcmf_bus_ops brcmf_pcie_bus_ops = {
  23444. - .txdata = brcmf_pcie_tx,
  23445. - .stop = brcmf_pcie_down,
  23446. - .txctl = brcmf_pcie_tx_ctlpkt,
  23447. - .rxctl = brcmf_pcie_rx_ctlpkt,
  23448. - .wowl_config = brcmf_pcie_wowl_config,
  23449. -+ .get_ramsize = brcmf_pcie_get_ramsize,
  23450. -+ .get_memdump = brcmf_pcie_get_memdump,
  23451. - };
  23452. -
  23453. -
  23454. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  23455. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  23456. -@@ -3539,6 +3539,51 @@ done:
  23457. - return err;
  23458. - }
  23459. -
  23460. -+static size_t brcmf_sdio_bus_get_ramsize(struct device *dev)
  23461. -+{
  23462. -+ struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  23463. -+ struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
  23464. -+ struct brcmf_sdio *bus = sdiodev->bus;
  23465. -+
  23466. -+ return bus->ci->ramsize - bus->ci->srsize;
  23467. -+}
  23468. -+
  23469. -+static int brcmf_sdio_bus_get_memdump(struct device *dev, void *data,
  23470. -+ size_t mem_size)
  23471. -+{
  23472. -+ struct brcmf_bus *bus_if = dev_get_drvdata(dev);
  23473. -+ struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
  23474. -+ struct brcmf_sdio *bus = sdiodev->bus;
  23475. -+ int err;
  23476. -+ int address;
  23477. -+ int offset;
  23478. -+ int len;
  23479. -+
  23480. -+ brcmf_dbg(INFO, "dump at 0x%08x: size=%zu\n", bus->ci->rambase,
  23481. -+ mem_size);
  23482. -+
  23483. -+ address = bus->ci->rambase;
  23484. -+ offset = err = 0;
  23485. -+ sdio_claim_host(sdiodev->func[1]);
  23486. -+ while (offset < mem_size) {
  23487. -+ len = ((offset + MEMBLOCK) < mem_size) ? MEMBLOCK :
  23488. -+ mem_size - offset;
  23489. -+ err = brcmf_sdiod_ramrw(sdiodev, false, address, data, len);
  23490. -+ if (err) {
  23491. -+ brcmf_err("error %d on reading %d membytes at 0x%08x\n",
  23492. -+ err, len, address);
  23493. -+ goto done;
  23494. -+ }
  23495. -+ data += len;
  23496. -+ offset += len;
  23497. -+ address += len;
  23498. -+ }
  23499. -+
  23500. -+done:
  23501. -+ sdio_release_host(sdiodev->func[1]);
  23502. -+ return err;
  23503. -+}
  23504. -+
  23505. - void brcmf_sdio_trigger_dpc(struct brcmf_sdio *bus)
  23506. - {
  23507. - if (!bus->dpc_triggered) {
  23508. -@@ -3987,7 +4032,9 @@ static struct brcmf_bus_ops brcmf_sdio_b
  23509. - .txctl = brcmf_sdio_bus_txctl,
  23510. - .rxctl = brcmf_sdio_bus_rxctl,
  23511. - .gettxq = brcmf_sdio_bus_gettxq,
  23512. -- .wowl_config = brcmf_sdio_wowl_config
  23513. -+ .wowl_config = brcmf_sdio_wowl_config,
  23514. -+ .get_ramsize = brcmf_sdio_bus_get_ramsize,
  23515. -+ .get_memdump = brcmf_sdio_bus_get_memdump,
  23516. - };
  23517. -
  23518. - static void brcmf_sdio_firmware_callback(struct device *dev,
  23519. 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
  23520. deleted file mode 100644
  23521. index 5b82bca..0000000
  23522. --- a/package/kernel/mac80211/patches/372-0002-brcmfmac-Fix-race-condition-between-USB-probe-load-a.patch
  23523. +++ /dev/null
  23524. @@ -1,108 +0,0 @@
  23525. -From: Hante Meuleman <meuleman@broadcom.com>
  23526. -Date: Thu, 8 Oct 2015 20:33:12 +0200
  23527. -Subject: [PATCH] brcmfmac: Fix race condition between USB probe/load and
  23528. - disconnect.
  23529. -
  23530. -When a USB device gets disconnected due to for example removal
  23531. -then it is possible that it is still in the loading phase due to
  23532. -the asynchronous load routines. These routines can then possible
  23533. -access memory which has been freed. Fix this by mutex locking the
  23534. -device init phase.
  23535. -
  23536. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  23537. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  23538. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  23539. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  23540. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  23541. ----
  23542. -
  23543. ---- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  23544. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  23545. -@@ -144,6 +144,7 @@ struct brcmf_usbdev_info {
  23546. -
  23547. - struct usb_device *usbdev;
  23548. - struct device *dev;
  23549. -+ struct mutex dev_init_lock;
  23550. -
  23551. - int ctl_in_pipe, ctl_out_pipe;
  23552. - struct urb *ctl_urb; /* URB for control endpoint */
  23553. -@@ -1204,6 +1205,8 @@ static void brcmf_usb_probe_phase2(struc
  23554. - int ret;
  23555. -
  23556. - brcmf_dbg(USB, "Start fw downloading\n");
  23557. -+
  23558. -+ devinfo = bus->bus_priv.usb->devinfo;
  23559. - ret = check_file(fw->data);
  23560. - if (ret < 0) {
  23561. - brcmf_err("invalid firmware\n");
  23562. -@@ -1211,7 +1214,6 @@ static void brcmf_usb_probe_phase2(struc
  23563. - goto error;
  23564. - }
  23565. -
  23566. -- devinfo = bus->bus_priv.usb->devinfo;
  23567. - devinfo->image = fw->data;
  23568. - devinfo->image_len = fw->size;
  23569. -
  23570. -@@ -1224,9 +1226,11 @@ static void brcmf_usb_probe_phase2(struc
  23571. - if (ret)
  23572. - goto error;
  23573. -
  23574. -+ mutex_unlock(&devinfo->dev_init_lock);
  23575. - return;
  23576. - error:
  23577. - brcmf_dbg(TRACE, "failed: dev=%s, err=%d\n", dev_name(dev), ret);
  23578. -+ mutex_unlock(&devinfo->dev_init_lock);
  23579. - device_release_driver(dev);
  23580. - }
  23581. -
  23582. -@@ -1264,6 +1268,7 @@ static int brcmf_usb_probe_cb(struct brc
  23583. - if (ret)
  23584. - goto fail;
  23585. - /* we are done */
  23586. -+ mutex_unlock(&devinfo->dev_init_lock);
  23587. - return 0;
  23588. - }
  23589. - bus->chip = bus_pub->devid;
  23590. -@@ -1317,6 +1322,12 @@ brcmf_usb_probe(struct usb_interface *in
  23591. -
  23592. - devinfo->usbdev = usb;
  23593. - devinfo->dev = &usb->dev;
  23594. -+ /* Take an init lock, to protect for disconnect while still loading.
  23595. -+ * Necessary because of the asynchronous firmware load construction
  23596. -+ */
  23597. -+ mutex_init(&devinfo->dev_init_lock);
  23598. -+ mutex_lock(&devinfo->dev_init_lock);
  23599. -+
  23600. - usb_set_intfdata(intf, devinfo);
  23601. -
  23602. - /* Check that the device supports only one configuration */
  23603. -@@ -1391,6 +1402,7 @@ brcmf_usb_probe(struct usb_interface *in
  23604. - return 0;
  23605. -
  23606. - fail:
  23607. -+ mutex_unlock(&devinfo->dev_init_lock);
  23608. - kfree(devinfo);
  23609. - usb_set_intfdata(intf, NULL);
  23610. - return ret;
  23611. -@@ -1403,8 +1415,19 @@ brcmf_usb_disconnect(struct usb_interfac
  23612. -
  23613. - brcmf_dbg(USB, "Enter\n");
  23614. - devinfo = (struct brcmf_usbdev_info *)usb_get_intfdata(intf);
  23615. -- brcmf_usb_disconnect_cb(devinfo);
  23616. -- kfree(devinfo);
  23617. -+
  23618. -+ if (devinfo) {
  23619. -+ mutex_lock(&devinfo->dev_init_lock);
  23620. -+ /* Make sure that devinfo still exists. Firmware probe routines
  23621. -+ * may have released the device and cleared the intfdata.
  23622. -+ */
  23623. -+ if (!usb_get_intfdata(intf))
  23624. -+ goto done;
  23625. -+
  23626. -+ brcmf_usb_disconnect_cb(devinfo);
  23627. -+ kfree(devinfo);
  23628. -+ }
  23629. -+done:
  23630. - brcmf_dbg(USB, "Exit\n");
  23631. - }
  23632. -
  23633. 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
  23634. deleted file mode 100644
  23635. index f877c23..0000000
  23636. --- a/package/kernel/mac80211/patches/372-0003-brcmfmac-rename-firmware_path-to-alternative_fw_path.patch
  23637. +++ /dev/null
  23638. @@ -1,28 +0,0 @@
  23639. -From: Franky Lin <frankyl@broadcom.com>
  23640. -Date: Thu, 8 Oct 2015 20:33:13 +0200
  23641. -Subject: [PATCH] brcmfmac: rename firmware_path to alternative_fw_path
  23642. -
  23643. -In brcmfmac the module parameter "firmware_path" is used as an
  23644. -alternative relative path under the search path used by firmware_class
  23645. -or ueventhelper. Rename the parameter to alternative_fw_path to avoid
  23646. -confusion.
  23647. -
  23648. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  23649. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  23650. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  23651. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  23652. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  23653. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  23654. ----
  23655. -
  23656. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  23657. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  23658. -@@ -28,7 +28,7 @@
  23659. - #define BRCMF_FW_NVRAM_PCIEDEV_LEN 10 /* pcie/1/4/ + \0 */
  23660. -
  23661. - char brcmf_firmware_path[BRCMF_FW_PATH_LEN];
  23662. --module_param_string(firmware_path, brcmf_firmware_path,
  23663. -+module_param_string(alternative_fw_path, brcmf_firmware_path,
  23664. - BRCMF_FW_PATH_LEN, 0440);
  23665. -
  23666. - enum nvram_parser_state {
  23667. 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
  23668. deleted file mode 100644
  23669. index 0bfd9ef..0000000
  23670. --- a/package/kernel/mac80211/patches/372-0004-brcmfmac-remove-conversational-comment.patch
  23671. +++ /dev/null
  23672. @@ -1,25 +0,0 @@
  23673. -From: Arend van Spriel <arend@broadcom.com>
  23674. -Date: Thu, 8 Oct 2015 20:33:14 +0200
  23675. -Subject: [PATCH] brcmfmac: remove conversational comment
  23676. -
  23677. -Removing a comment that was only useful during the review of
  23678. -the change that introduced it and which should never have been
  23679. -submitted.
  23680. -
  23681. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  23682. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  23683. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  23684. ----
  23685. -
  23686. ---- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  23687. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
  23688. -@@ -873,9 +873,6 @@ brcmf_msgbuf_process_txstatus(struct brc
  23689. - commonring = msgbuf->flowrings[flowid];
  23690. - atomic_dec(&commonring->outstanding_tx);
  23691. -
  23692. -- /* Hante: i believe this was a bug as tx_status->msg.ifidx was used
  23693. -- * in brcmf_txfinalize as index in drvr->iflist. Can you confirm/deny?
  23694. -- */
  23695. - brcmf_txfinalize(brcmf_get_ifp(msgbuf->drvr, tx_status->msg.ifidx),
  23696. - skb, true);
  23697. - }
  23698. 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
  23699. deleted file mode 100644
  23700. index 3ffada8..0000000
  23701. --- a/package/kernel/mac80211/patches/372-0005-brcmfmac-Rework-p2p-attach-use-single-method-for-p2p.patch
  23702. +++ /dev/null
  23703. @@ -1,226 +0,0 @@
  23704. -From: Hante Meuleman <meuleman@broadcom.com>
  23705. -Date: Thu, 8 Oct 2015 20:33:15 +0200
  23706. -Subject: [PATCH] brcmfmac: Rework p2p attach, use single method for p2p dev
  23707. - creation.
  23708. -
  23709. -When module param p2pon is used a p2p device is created at init.
  23710. -This patch reworks how this is done by using the same method as
  23711. -for a dynamically (by user space) created p2p device.
  23712. -
  23713. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  23714. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  23715. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  23716. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  23717. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  23718. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  23719. ----
  23720. -
  23721. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  23722. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  23723. -@@ -6237,6 +6237,17 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  23724. - else
  23725. - *cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
  23726. - }
  23727. -+ /* p2p might require that "if-events" get processed by fweh. So
  23728. -+ * activate the already registered event handlers now and activate
  23729. -+ * the rest when initialization has completed. drvr->config needs to
  23730. -+ * be assigned before activating events.
  23731. -+ */
  23732. -+ drvr->config = cfg;
  23733. -+ err = brcmf_fweh_activate_events(ifp);
  23734. -+ if (err) {
  23735. -+ brcmf_err("FWEH activation failed (%d)\n", err);
  23736. -+ goto wiphy_unreg_out;
  23737. -+ }
  23738. -
  23739. - err = brcmf_p2p_attach(cfg, p2pdev_forced);
  23740. - if (err) {
  23741. -@@ -6259,6 +6270,13 @@ struct brcmf_cfg80211_info *brcmf_cfg802
  23742. - brcmf_notify_tdls_peer_event);
  23743. - }
  23744. -
  23745. -+ /* (re-) activate FWEH event handling */
  23746. -+ err = brcmf_fweh_activate_events(ifp);
  23747. -+ if (err) {
  23748. -+ brcmf_err("FWEH activation failed (%d)\n", err);
  23749. -+ goto wiphy_unreg_out;
  23750. -+ }
  23751. -+
  23752. - return cfg;
  23753. -
  23754. - wiphy_unreg_out:
  23755. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  23756. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  23757. -@@ -828,8 +828,8 @@ struct brcmf_if *brcmf_add_if(struct brc
  23758. - } else {
  23759. - brcmf_dbg(INFO, "allocate netdev interface\n");
  23760. - /* Allocate netdev, including space for private structure */
  23761. -- ndev = alloc_netdev(sizeof(*ifp), name, NET_NAME_UNKNOWN,
  23762. -- ether_setup);
  23763. -+ ndev = alloc_netdev(sizeof(*ifp), is_p2pdev ? "p2p%d" : name,
  23764. -+ NET_NAME_UNKNOWN, ether_setup);
  23765. - if (!ndev)
  23766. - return ERR_PTR(-ENOMEM);
  23767. -
  23768. -@@ -1021,12 +1021,7 @@ int brcmf_bus_start(struct device *dev)
  23769. - if (IS_ERR(ifp))
  23770. - return PTR_ERR(ifp);
  23771. -
  23772. -- if (brcmf_p2p_enable)
  23773. -- p2p_ifp = brcmf_add_if(drvr, 1, 0, false, "p2p%d", NULL);
  23774. -- else
  23775. -- p2p_ifp = NULL;
  23776. -- if (IS_ERR(p2p_ifp))
  23777. -- p2p_ifp = NULL;
  23778. -+ p2p_ifp = NULL;
  23779. -
  23780. - /* signal bus ready */
  23781. - brcmf_bus_change_state(bus_if, BRCMF_BUS_UP);
  23782. -@@ -1060,11 +1055,13 @@ int brcmf_bus_start(struct device *dev)
  23783. - goto fail;
  23784. - }
  23785. -
  23786. -- ret = brcmf_fweh_activate_events(ifp);
  23787. -- if (ret < 0)
  23788. -- goto fail;
  23789. --
  23790. - ret = brcmf_net_attach(ifp, false);
  23791. -+
  23792. -+ if ((!ret) && (brcmf_p2p_enable)) {
  23793. -+ p2p_ifp = drvr->iflist[1];
  23794. -+ if (p2p_ifp)
  23795. -+ ret = brcmf_net_p2p_attach(p2p_ifp);
  23796. -+ }
  23797. - fail:
  23798. - if (ret < 0) {
  23799. - brcmf_err("failed: %d\n", ret);
  23800. -@@ -1076,20 +1073,12 @@ fail:
  23801. - brcmf_fws_del_interface(ifp);
  23802. - brcmf_fws_deinit(drvr);
  23803. - }
  23804. -- if (drvr->iflist[0]) {
  23805. -+ if (ifp)
  23806. - brcmf_net_detach(ifp->ndev);
  23807. -- drvr->iflist[0] = NULL;
  23808. -- }
  23809. -- if (p2p_ifp) {
  23810. -+ if (p2p_ifp)
  23811. - brcmf_net_detach(p2p_ifp->ndev);
  23812. -- drvr->iflist[1] = NULL;
  23813. -- }
  23814. - return ret;
  23815. - }
  23816. -- if ((brcmf_p2p_enable) && (p2p_ifp))
  23817. -- if (brcmf_net_p2p_attach(p2p_ifp) < 0)
  23818. -- brcmf_p2p_enable = 0;
  23819. --
  23820. - return 0;
  23821. - }
  23822. -
  23823. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  23824. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  23825. -@@ -213,7 +213,8 @@ static void brcmf_fweh_handle_if_event(s
  23826. - is_p2pdev, emsg->ifname, emsg->addr);
  23827. - if (IS_ERR(ifp))
  23828. - return;
  23829. -- brcmf_fws_add_interface(ifp);
  23830. -+ if (!is_p2pdev)
  23831. -+ brcmf_fws_add_interface(ifp);
  23832. - if (!drvr->fweh.evt_handler[BRCMF_E_IF])
  23833. - if (brcmf_net_attach(ifp, false) < 0)
  23834. - return;
  23835. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  23836. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  23837. -@@ -2350,83 +2350,30 @@ void brcmf_p2p_stop_device(struct wiphy
  23838. - * brcmf_p2p_attach() - attach for P2P.
  23839. - *
  23840. - * @cfg: driver private data for cfg80211 interface.
  23841. -+ * @p2pdev_forced: create p2p device interface at attach.
  23842. - */
  23843. - s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced)
  23844. - {
  23845. -- struct brcmf_if *pri_ifp;
  23846. -- struct brcmf_if *p2p_ifp;
  23847. -- struct brcmf_cfg80211_vif *p2p_vif;
  23848. - struct brcmf_p2p_info *p2p;
  23849. -- struct brcmf_pub *drvr;
  23850. -- s32 bssidx;
  23851. -+ struct brcmf_if *pri_ifp;
  23852. - s32 err = 0;
  23853. -+ void *err_ptr;
  23854. -
  23855. - p2p = &cfg->p2p;
  23856. - p2p->cfg = cfg;
  23857. -
  23858. -- drvr = cfg->pub;
  23859. --
  23860. -- pri_ifp = brcmf_get_ifp(drvr, 0);
  23861. -+ pri_ifp = brcmf_get_ifp(cfg->pub, 0);
  23862. - p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif = pri_ifp->vif;
  23863. -
  23864. - if (p2pdev_forced) {
  23865. -- p2p_ifp = drvr->iflist[1];
  23866. -+ err_ptr = brcmf_p2p_create_p2pdev(p2p, NULL, NULL);
  23867. -+ if (IS_ERR(err_ptr)) {
  23868. -+ brcmf_err("P2P device creation failed.\n");
  23869. -+ err = PTR_ERR(err_ptr);
  23870. -+ }
  23871. - } else {
  23872. -- p2p_ifp = NULL;
  23873. - p2p->p2pdev_dynamically = true;
  23874. - }
  23875. -- if (p2p_ifp) {
  23876. -- p2p_vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_P2P_DEVICE,
  23877. -- false);
  23878. -- if (IS_ERR(p2p_vif)) {
  23879. -- brcmf_err("could not create discovery vif\n");
  23880. -- err = -ENOMEM;
  23881. -- goto exit;
  23882. -- }
  23883. --
  23884. -- p2p_vif->ifp = p2p_ifp;
  23885. -- p2p_ifp->vif = p2p_vif;
  23886. -- p2p_vif->wdev.netdev = p2p_ifp->ndev;
  23887. -- p2p_ifp->ndev->ieee80211_ptr = &p2p_vif->wdev;
  23888. -- SET_NETDEV_DEV(p2p_ifp->ndev, wiphy_dev(cfg->wiphy));
  23889. --
  23890. -- p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = p2p_vif;
  23891. --
  23892. -- brcmf_p2p_generate_bss_mac(p2p, NULL);
  23893. -- memcpy(p2p_ifp->mac_addr, p2p->dev_addr, ETH_ALEN);
  23894. -- brcmf_p2p_set_firmware(pri_ifp, p2p->dev_addr);
  23895. --
  23896. -- brcmf_fweh_p2pdev_setup(pri_ifp, true);
  23897. --
  23898. -- /* Initialize P2P Discovery in the firmware */
  23899. -- err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1);
  23900. -- if (err < 0) {
  23901. -- brcmf_err("set p2p_disc error\n");
  23902. -- brcmf_free_vif(p2p_vif);
  23903. -- goto exit;
  23904. -- }
  23905. -- /* obtain bsscfg index for P2P discovery */
  23906. -- err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bssidx);
  23907. -- if (err < 0) {
  23908. -- brcmf_err("retrieving discover bsscfg index failed\n");
  23909. -- brcmf_free_vif(p2p_vif);
  23910. -- goto exit;
  23911. -- }
  23912. -- /* Verify that firmware uses same bssidx as driver !! */
  23913. -- if (p2p_ifp->bssidx != bssidx) {
  23914. -- brcmf_err("Incorrect bssidx=%d, compared to p2p_ifp->bssidx=%d\n",
  23915. -- bssidx, p2p_ifp->bssidx);
  23916. -- brcmf_free_vif(p2p_vif);
  23917. -- goto exit;
  23918. -- }
  23919. --
  23920. -- init_completion(&p2p->send_af_done);
  23921. -- INIT_WORK(&p2p->afx_hdl.afx_work, brcmf_p2p_afx_handler);
  23922. -- init_completion(&p2p->afx_hdl.act_frm_scan);
  23923. -- init_completion(&p2p->wait_next_af);
  23924. --exit:
  23925. -- brcmf_fweh_p2pdev_setup(pri_ifp, false);
  23926. -- }
  23927. - return err;
  23928. - }
  23929. -
  23930. 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
  23931. deleted file mode 100644
  23932. index 0abcf1e..0000000
  23933. --- a/package/kernel/mac80211/patches/372-0006-brcmfmac-Fix-station-info-rate-information.patch
  23934. +++ /dev/null
  23935. @@ -1,36 +0,0 @@
  23936. -From: Hante Meuleman <meuleman@broadcom.com>
  23937. -Date: Thu, 8 Oct 2015 20:33:16 +0200
  23938. -Subject: [PATCH] brcmfmac: Fix station info rate information.
  23939. -
  23940. -Txrate and rxrate in get_station got assigned first with value
  23941. -in kbps and then divided by 100 to get it in 100kbps unit. The
  23942. -problem with that is that type of rate is u16 which resulted
  23943. -in incorrect values for high data rate values.
  23944. -
  23945. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  23946. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  23947. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  23948. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  23949. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  23950. ----
  23951. -
  23952. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  23953. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  23954. -@@ -2477,13 +2477,13 @@ brcmf_cfg80211_get_station(struct wiphy
  23955. - sinfo->rx_packets += le32_to_cpu(sta_info_le.rx_mcast_pkts);
  23956. - if (sinfo->tx_packets) {
  23957. - sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
  23958. -- sinfo->txrate.legacy = le32_to_cpu(sta_info_le.tx_rate);
  23959. -- sinfo->txrate.legacy /= 100;
  23960. -+ sinfo->txrate.legacy =
  23961. -+ le32_to_cpu(sta_info_le.tx_rate) / 100;
  23962. - }
  23963. - if (sinfo->rx_packets) {
  23964. - sinfo->filled |= BIT(NL80211_STA_INFO_RX_BITRATE);
  23965. -- sinfo->rxrate.legacy = le32_to_cpu(sta_info_le.rx_rate);
  23966. -- sinfo->rxrate.legacy /= 100;
  23967. -+ sinfo->rxrate.legacy =
  23968. -+ le32_to_cpu(sta_info_le.rx_rate) / 100;
  23969. - }
  23970. - if (le16_to_cpu(sta_info_le.ver) >= 4) {
  23971. - sinfo->filled |= BIT(NL80211_STA_INFO_TX_BYTES);
  23972. 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
  23973. deleted file mode 100644
  23974. index bb03d67..0000000
  23975. --- a/package/kernel/mac80211/patches/372-0007-brcmfmac-Add-RSSI-information-to-get_station.patch
  23976. +++ /dev/null
  23977. @@ -1,50 +0,0 @@
  23978. -From: Hante Meuleman <meuleman@broadcom.com>
  23979. -Date: Thu, 8 Oct 2015 20:33:17 +0200
  23980. -Subject: [PATCH] brcmfmac: Add RSSI information to get_station.
  23981. -
  23982. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  23983. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  23984. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  23985. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  23986. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  23987. ----
  23988. -
  23989. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  23990. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  23991. -@@ -2431,6 +2431,9 @@ brcmf_cfg80211_get_station(struct wiphy
  23992. - struct brcmf_sta_info_le sta_info_le;
  23993. - u32 sta_flags;
  23994. - u32 is_tdls_peer;
  23995. -+ s32 total_rssi;
  23996. -+ s32 count_rssi;
  23997. -+ u32 i;
  23998. -
  23999. - brcmf_dbg(TRACE, "Enter, MAC %pM\n", mac);
  24000. - if (!check_vif_up(ifp->vif))
  24001. -@@ -2491,6 +2494,26 @@ brcmf_cfg80211_get_station(struct wiphy
  24002. - sinfo->filled |= BIT(NL80211_STA_INFO_RX_BYTES);
  24003. - sinfo->rx_bytes = le64_to_cpu(sta_info_le.rx_tot_bytes);
  24004. - }
  24005. -+ total_rssi = 0;
  24006. -+ count_rssi = 0;
  24007. -+ for (i = 0; i < BRCMF_ANT_MAX; i++) {
  24008. -+ if (sta_info_le.rssi[i]) {
  24009. -+ sinfo->chain_signal_avg[count_rssi] =
  24010. -+ sta_info_le.rssi[i];
  24011. -+ sinfo->chain_signal[count_rssi] =
  24012. -+ sta_info_le.rssi[i];
  24013. -+ total_rssi += sta_info_le.rssi[i];
  24014. -+ count_rssi++;
  24015. -+ }
  24016. -+ }
  24017. -+ if (count_rssi) {
  24018. -+ sinfo->filled |= BIT(NL80211_STA_INFO_CHAIN_SIGNAL);
  24019. -+ sinfo->chains = count_rssi;
  24020. -+
  24021. -+ sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
  24022. -+ total_rssi /= count_rssi;
  24023. -+ sinfo->signal = total_rssi;
  24024. -+ }
  24025. - }
  24026. - done:
  24027. - brcmf_dbg(TRACE, "Exit\n");
  24028. 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
  24029. deleted file mode 100644
  24030. index a6bafd2..0000000
  24031. --- a/package/kernel/mac80211/patches/372-0008-brcmfmac-Add-dump_station-support-to-cfg80221-ops.patch
  24032. +++ /dev/null
  24033. @@ -1,107 +0,0 @@
  24034. -From: Hante Meuleman <meuleman@broadcom.com>
  24035. -Date: Thu, 8 Oct 2015 20:33:18 +0200
  24036. -Subject: [PATCH] brcmfmac: Add dump_station support to cfg80221 ops.
  24037. -
  24038. -With this feature it becomes possible to request a station
  24039. -assoc list.
  24040. -
  24041. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  24042. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  24043. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  24044. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  24045. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  24046. ----
  24047. -
  24048. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  24049. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  24050. -@@ -2520,6 +2520,35 @@ done:
  24051. - return err;
  24052. - }
  24053. -
  24054. -+static int
  24055. -+brcmf_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *ndev,
  24056. -+ int idx, u8 *mac, struct station_info *sinfo)
  24057. -+{
  24058. -+ struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  24059. -+ struct brcmf_if *ifp = netdev_priv(ndev);
  24060. -+ s32 err;
  24061. -+
  24062. -+ brcmf_dbg(TRACE, "Enter, idx %d\n", idx);
  24063. -+
  24064. -+ if (idx == 0) {
  24065. -+ cfg->assoclist.count = cpu_to_le32(BRCMF_MAX_ASSOCLIST);
  24066. -+ err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_ASSOCLIST,
  24067. -+ &cfg->assoclist,
  24068. -+ sizeof(cfg->assoclist));
  24069. -+ if (err) {
  24070. -+ brcmf_err("BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n",
  24071. -+ err);
  24072. -+ cfg->assoclist.count = 0;
  24073. -+ return -EOPNOTSUPP;
  24074. -+ }
  24075. -+ }
  24076. -+ if (idx < le32_to_cpu(cfg->assoclist.count)) {
  24077. -+ memcpy(mac, cfg->assoclist.mac[idx], ETH_ALEN);
  24078. -+ return brcmf_cfg80211_get_station(wiphy, ndev, mac, sinfo);
  24079. -+ }
  24080. -+ return -ENOENT;
  24081. -+}
  24082. -+
  24083. - static s32
  24084. - brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev,
  24085. - bool enabled, s32 timeout)
  24086. -@@ -4619,6 +4648,7 @@ static struct cfg80211_ops wl_cfg80211_o
  24087. - .join_ibss = brcmf_cfg80211_join_ibss,
  24088. - .leave_ibss = brcmf_cfg80211_leave_ibss,
  24089. - .get_station = brcmf_cfg80211_get_station,
  24090. -+ .dump_station = brcmf_cfg80211_dump_station,
  24091. - .set_tx_power = brcmf_cfg80211_set_tx_power,
  24092. - .get_tx_power = brcmf_cfg80211_get_tx_power,
  24093. - .add_key = brcmf_cfg80211_add_key,
  24094. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  24095. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  24096. -@@ -407,6 +407,7 @@ struct brcmf_cfg80211_info {
  24097. - struct brcmu_d11inf d11inf;
  24098. - bool wowl_enabled;
  24099. - u32 pre_wowl_pmmode;
  24100. -+ struct brcmf_assoclist_le assoclist;
  24101. - };
  24102. -
  24103. - /**
  24104. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwil.h
  24105. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil.h
  24106. -@@ -72,6 +72,7 @@
  24107. - #define BRCMF_C_GET_BSS_INFO 136
  24108. - #define BRCMF_C_GET_BANDLIST 140
  24109. - #define BRCMF_C_SET_SCB_TIMEOUT 158
  24110. -+#define BRCMF_C_GET_ASSOCLIST 159
  24111. - #define BRCMF_C_GET_PHYLIST 180
  24112. - #define BRCMF_C_SET_SCAN_CHANNEL_TIME 185
  24113. - #define BRCMF_C_SET_SCAN_UNASSOC_TIME 187
  24114. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  24115. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  24116. -@@ -119,6 +119,8 @@
  24117. - #define BRCMF_COUNTRY_BUF_SZ 4
  24118. - #define BRCMF_ANT_MAX 4
  24119. -
  24120. -+#define BRCMF_MAX_ASSOCLIST 128
  24121. -+
  24122. - /* join preference types for join_pref iovar */
  24123. - enum brcmf_join_pref_types {
  24124. - BRCMF_JOIN_PREF_RSSI = 1,
  24125. -@@ -621,4 +623,15 @@ struct brcmf_rev_info_le {
  24126. - __le32 nvramrev;
  24127. - };
  24128. -
  24129. -+/**
  24130. -+ * struct brcmf_assoclist_le - request assoc list.
  24131. -+ *
  24132. -+ * @count: indicates number of stations.
  24133. -+ * @mac: MAC addresses of stations.
  24134. -+ */
  24135. -+struct brcmf_assoclist_le {
  24136. -+ __le32 count;
  24137. -+ u8 mac[BRCMF_MAX_ASSOCLIST][ETH_ALEN];
  24138. -+};
  24139. -+
  24140. - #endif /* FWIL_TYPES_H_ */
  24141. 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
  24142. deleted file mode 100644
  24143. index dc54904..0000000
  24144. --- a/package/kernel/mac80211/patches/372-0009-brcmfmac-Move-brcmf_c_preinit_dcmds-prototype-to-cor.patch
  24145. +++ /dev/null
  24146. @@ -1,42 +0,0 @@
  24147. -From: Hante Meuleman <meuleman@broadcom.com>
  24148. -Date: Thu, 8 Oct 2015 20:33:19 +0200
  24149. -Subject: [PATCH] brcmfmac: Move brcmf_c_preinit_dcmds prototype to correct
  24150. - file.
  24151. -
  24152. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  24153. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  24154. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  24155. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  24156. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  24157. ----
  24158. -
  24159. ---- a/drivers/net/wireless/brcm80211/brcmfmac/common.h
  24160. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/common.h
  24161. -@@ -17,4 +17,7 @@
  24162. -
  24163. - extern const u8 ALLFFMAC[ETH_ALEN];
  24164. -
  24165. -+/* Sets dongle media info (drv_version, mac address). */
  24166. -+int brcmf_c_preinit_dcmds(struct brcmf_if *ifp);
  24167. -+
  24168. - #endif /* BRCMFMAC_COMMON_H */
  24169. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  24170. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  24171. -@@ -33,6 +33,7 @@
  24172. - #include "feature.h"
  24173. - #include "proto.h"
  24174. - #include "pcie.h"
  24175. -+#include "common.h"
  24176. -
  24177. - MODULE_AUTHOR("Broadcom Corporation");
  24178. - MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver.");
  24179. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  24180. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  24181. -@@ -214,7 +214,4 @@ void brcmf_txflowblock_if(struct brcmf_i
  24182. - void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  24183. - void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);
  24184. -
  24185. --/* Sets dongle media info (drv_version, mac address). */
  24186. --int brcmf_c_preinit_dcmds(struct brcmf_if *ifp);
  24187. --
  24188. - #endif /* BRCMFMAC_CORE_H */
  24189. 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
  24190. deleted file mode 100644
  24191. index c6a7363..0000000
  24192. --- a/package/kernel/mac80211/patches/372-0010-brcmfmac-Remove-unused-state-AP-creating.patch
  24193. +++ /dev/null
  24194. @@ -1,55 +0,0 @@
  24195. -From: Hante Meuleman <meuleman@broadcom.com>
  24196. -Date: Thu, 8 Oct 2015 20:33:20 +0200
  24197. -Subject: [PATCH] brcmfmac: Remove unused state AP creating.
  24198. -
  24199. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  24200. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  24201. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  24202. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  24203. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  24204. ----
  24205. -
  24206. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  24207. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  24208. -@@ -839,7 +839,6 @@ brcmf_cfg80211_change_iface(struct wiphy
  24209. - err = brcmf_p2p_ifchange(cfg, BRCMF_FIL_P2P_IF_GO);
  24210. - }
  24211. - if (!err) {
  24212. -- set_bit(BRCMF_VIF_STATUS_AP_CREATING, &vif->sme_state);
  24213. - brcmf_dbg(INFO, "IF Type = AP\n");
  24214. - }
  24215. - } else {
  24216. -@@ -4250,7 +4249,6 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  24217. -
  24218. - brcmf_dbg(TRACE, "GO mode configuration complete\n");
  24219. - }
  24220. -- clear_bit(BRCMF_VIF_STATUS_AP_CREATING, &ifp->vif->sme_state);
  24221. - set_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state);
  24222. -
  24223. - exit:
  24224. -@@ -4315,7 +4313,6 @@ static int brcmf_cfg80211_stop_ap(struct
  24225. - }
  24226. - brcmf_set_mpc(ifp, 1);
  24227. - brcmf_configure_arp_offload(ifp, true);
  24228. -- set_bit(BRCMF_VIF_STATUS_AP_CREATING, &ifp->vif->sme_state);
  24229. - clear_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state);
  24230. -
  24231. - return err;
  24232. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  24233. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  24234. -@@ -143,7 +143,6 @@ struct brcmf_cfg80211_profile {
  24235. - * @BRCMF_VIF_STATUS_CONNECTING: connect/join in progress.
  24236. - * @BRCMF_VIF_STATUS_CONNECTED: connected/joined succesfully.
  24237. - * @BRCMF_VIF_STATUS_DISCONNECTING: disconnect/disable in progress.
  24238. -- * @BRCMF_VIF_STATUS_AP_CREATING: interface configured for AP operation.
  24239. - * @BRCMF_VIF_STATUS_AP_CREATED: AP operation started.
  24240. - */
  24241. - enum brcmf_vif_status {
  24242. -@@ -151,7 +150,6 @@ enum brcmf_vif_status {
  24243. - BRCMF_VIF_STATUS_CONNECTING,
  24244. - BRCMF_VIF_STATUS_CONNECTED,
  24245. - BRCMF_VIF_STATUS_DISCONNECTING,
  24246. -- BRCMF_VIF_STATUS_AP_CREATING,
  24247. - BRCMF_VIF_STATUS_AP_CREATED
  24248. - };
  24249. -
  24250. 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
  24251. deleted file mode 100644
  24252. index c0948de..0000000
  24253. --- a/package/kernel/mac80211/patches/372-0011-brcmfmac-Properly-set-carrier-state-of-netdev.patch
  24254. +++ /dev/null
  24255. @@ -1,122 +0,0 @@
  24256. -From: Hante Meuleman <meuleman@broadcom.com>
  24257. -Date: Thu, 8 Oct 2015 20:33:21 +0200
  24258. -Subject: [PATCH] brcmfmac: Properly set carrier state of netdev.
  24259. -
  24260. -Use the netif_carrier api to correctly set carrier state on the
  24261. -different modes.
  24262. -
  24263. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  24264. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  24265. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  24266. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  24267. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  24268. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  24269. ----
  24270. -
  24271. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  24272. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  24273. -@@ -4250,6 +4250,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  24274. - brcmf_dbg(TRACE, "GO mode configuration complete\n");
  24275. - }
  24276. - set_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state);
  24277. -+ brcmf_net_setcarrier(ifp, true);
  24278. -
  24279. - exit:
  24280. - if ((err) && (!mbss)) {
  24281. -@@ -4314,6 +4315,7 @@ static int brcmf_cfg80211_stop_ap(struct
  24282. - brcmf_set_mpc(ifp, 1);
  24283. - brcmf_configure_arp_offload(ifp, true);
  24284. - clear_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state);
  24285. -+ brcmf_net_setcarrier(ifp, false);
  24286. -
  24287. - return err;
  24288. - }
  24289. -@@ -5023,6 +5025,7 @@ brcmf_notify_connect_status(struct brcmf
  24290. - &ifp->vif->sme_state);
  24291. - } else
  24292. - brcmf_bss_connect_done(cfg, ndev, e, true);
  24293. -+ brcmf_net_setcarrier(ifp, true);
  24294. - } else if (brcmf_is_linkdown(e)) {
  24295. - brcmf_dbg(CONN, "Linkdown\n");
  24296. - if (!brcmf_is_ibssmode(ifp->vif)) {
  24297. -@@ -5032,6 +5035,7 @@ brcmf_notify_connect_status(struct brcmf
  24298. - brcmf_init_prof(ndev_to_prof(ndev));
  24299. - if (ndev != cfg_to_ndev(cfg))
  24300. - complete(&cfg->vif_disabled);
  24301. -+ brcmf_net_setcarrier(ifp, false);
  24302. - } else if (brcmf_is_nonetwork(cfg, e)) {
  24303. - if (brcmf_is_ibssmode(ifp->vif))
  24304. - clear_bit(BRCMF_VIF_STATUS_CONNECTING,
  24305. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  24306. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  24307. -@@ -635,8 +635,7 @@ static int brcmf_netdev_stop(struct net_
  24308. -
  24309. - brcmf_cfg80211_down(ndev);
  24310. -
  24311. -- /* Set state and stop OS transmissions */
  24312. -- netif_stop_queue(ndev);
  24313. -+ brcmf_net_setcarrier(ifp, false);
  24314. -
  24315. - return 0;
  24316. - }
  24317. -@@ -670,8 +669,8 @@ static int brcmf_netdev_open(struct net_
  24318. - return -EIO;
  24319. - }
  24320. -
  24321. -- /* Allow transmit calls */
  24322. -- netif_start_queue(ndev);
  24323. -+ /* Clear, carrier, set when connected or AP mode. */
  24324. -+ netif_carrier_off(ndev);
  24325. - return 0;
  24326. - }
  24327. -
  24328. -@@ -736,6 +735,24 @@ static void brcmf_net_detach(struct net_
  24329. - brcmf_cfg80211_free_netdev(ndev);
  24330. - }
  24331. -
  24332. -+void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on)
  24333. -+{
  24334. -+ struct net_device *ndev;
  24335. -+
  24336. -+ brcmf_dbg(TRACE, "Enter, idx=%d carrier=%d\n", ifp->bssidx, on);
  24337. -+
  24338. -+ ndev = ifp->ndev;
  24339. -+ brcmf_txflowblock_if(ifp, BRCMF_NETIF_STOP_REASON_DISCONNECTED, !on);
  24340. -+ if (on) {
  24341. -+ if (!netif_carrier_ok(ndev))
  24342. -+ netif_carrier_on(ndev);
  24343. -+
  24344. -+ } else {
  24345. -+ if (netif_carrier_ok(ndev))
  24346. -+ netif_carrier_off(ndev);
  24347. -+ }
  24348. -+}
  24349. -+
  24350. - static int brcmf_net_p2p_open(struct net_device *ndev)
  24351. - {
  24352. - brcmf_dbg(TRACE, "Enter\n");
  24353. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  24354. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  24355. -@@ -154,10 +154,13 @@ struct brcmf_fws_mac_descriptor;
  24356. - * netif stopped due to firmware signalling flow control.
  24357. - * @BRCMF_NETIF_STOP_REASON_FLOW:
  24358. - * netif stopped due to flowring full.
  24359. -+ * @BRCMF_NETIF_STOP_REASON_DISCONNECTED:
  24360. -+ * netif stopped due to not being connected (STA mode).
  24361. - */
  24362. - enum brcmf_netif_stop_reason {
  24363. -- BRCMF_NETIF_STOP_REASON_FWS_FC = 1,
  24364. -- BRCMF_NETIF_STOP_REASON_FLOW = 2
  24365. -+ BRCMF_NETIF_STOP_REASON_FWS_FC = BIT(0),
  24366. -+ BRCMF_NETIF_STOP_REASON_FLOW = BIT(1),
  24367. -+ BRCMF_NETIF_STOP_REASON_DISCONNECTED = BIT(2)
  24368. - };
  24369. -
  24370. - /**
  24371. -@@ -213,5 +216,6 @@ void brcmf_txflowblock_if(struct brcmf_i
  24372. - enum brcmf_netif_stop_reason reason, bool state);
  24373. - void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  24374. - void brcmf_netif_rx(struct brcmf_if *ifp, struct sk_buff *skb);
  24375. -+void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on);
  24376. -
  24377. - #endif /* BRCMFMAC_CORE_H */
  24378. 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
  24379. deleted file mode 100644
  24380. index ea6fad1..0000000
  24381. --- a/package/kernel/mac80211/patches/373-brcm80211-Add-support-for-brcm4371.patch
  24382. +++ /dev/null
  24383. @@ -1,78 +0,0 @@
  24384. -From: Eric Caruso <ejcaruso@google.com>
  24385. -Date: Wed, 14 Oct 2015 12:34:11 -0700
  24386. -Subject: [PATCH] brcm80211: Add support for brcm4371
  24387. -
  24388. -This is a new Broadcom chip and we should be able to recognize it.
  24389. -
  24390. -Signed-off-by: Eric Caruso <ejcaruso@google.com>
  24391. -Acked-by: Arend van Spriel <arend@broadcom.com>
  24392. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  24393. ----
  24394. -
  24395. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  24396. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  24397. -@@ -682,6 +682,7 @@ static u32 brcmf_chip_tcm_rambase(struct
  24398. - case BRCM_CC_43570_CHIP_ID:
  24399. - case BRCM_CC_4358_CHIP_ID:
  24400. - case BRCM_CC_43602_CHIP_ID:
  24401. -+ case BRCM_CC_4371_CHIP_ID:
  24402. - return 0x180000;
  24403. - case BRCM_CC_4365_CHIP_ID:
  24404. - case BRCM_CC_4366_CHIP_ID:
  24405. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  24406. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  24407. -@@ -59,6 +59,8 @@ enum brcmf_pcie_state {
  24408. - #define BRCMF_PCIE_4365_NVRAM_NAME "brcm/brcmfmac4365b-pcie.txt"
  24409. - #define BRCMF_PCIE_4366_FW_NAME "brcm/brcmfmac4366b-pcie.bin"
  24410. - #define BRCMF_PCIE_4366_NVRAM_NAME "brcm/brcmfmac4366b-pcie.txt"
  24411. -+#define BRCMF_PCIE_4371_FW_NAME "brcm/brcmfmac4371-pcie.bin"
  24412. -+#define BRCMF_PCIE_4371_NVRAM_NAME "brcm/brcmfmac4371-pcie.txt"
  24413. -
  24414. - #define BRCMF_PCIE_FW_UP_TIMEOUT 2000 /* msec */
  24415. -
  24416. -@@ -212,6 +214,8 @@ MODULE_FIRMWARE(BRCMF_PCIE_4365_FW_NAME)
  24417. - MODULE_FIRMWARE(BRCMF_PCIE_4365_NVRAM_NAME);
  24418. - MODULE_FIRMWARE(BRCMF_PCIE_4366_FW_NAME);
  24419. - MODULE_FIRMWARE(BRCMF_PCIE_4366_NVRAM_NAME);
  24420. -+MODULE_FIRMWARE(BRCMF_PCIE_4371_FW_NAME);
  24421. -+MODULE_FIRMWARE(BRCMF_PCIE_4371_NVRAM_NAME);
  24422. -
  24423. -
  24424. - struct brcmf_pcie_console {
  24425. -@@ -1521,6 +1525,10 @@ static int brcmf_pcie_get_fwnames(struct
  24426. - fw_name = BRCMF_PCIE_4366_FW_NAME;
  24427. - nvram_name = BRCMF_PCIE_4366_NVRAM_NAME;
  24428. - break;
  24429. -+ case BRCM_CC_4371_CHIP_ID:
  24430. -+ fw_name = BRCMF_PCIE_4371_FW_NAME;
  24431. -+ nvram_name = BRCMF_PCIE_4371_NVRAM_NAME;
  24432. -+ break;
  24433. - default:
  24434. - brcmf_err("Unsupported chip 0x%04x\n", devinfo->ci->chip);
  24435. - return -ENODEV;
  24436. -@@ -2060,6 +2068,7 @@ static struct pci_device_id brcmf_pcie_d
  24437. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_DEVICE_ID),
  24438. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_2G_DEVICE_ID),
  24439. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_5G_DEVICE_ID),
  24440. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4371_DEVICE_ID),
  24441. - { /* end: all zeroes */ }
  24442. - };
  24443. -
  24444. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  24445. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  24446. -@@ -50,6 +50,7 @@
  24447. - #define BRCM_CC_43602_CHIP_ID 43602
  24448. - #define BRCM_CC_4365_CHIP_ID 0x4365
  24449. - #define BRCM_CC_4366_CHIP_ID 0x4366
  24450. -+#define BRCM_CC_4371_CHIP_ID 0x4371
  24451. -
  24452. - /* USB Device IDs */
  24453. - #define BRCM_USB_43143_DEVICE_ID 0xbd1e
  24454. -@@ -75,6 +76,7 @@
  24455. - #define BRCM_PCIE_4366_DEVICE_ID 0x43c3
  24456. - #define BRCM_PCIE_4366_2G_DEVICE_ID 0x43c4
  24457. - #define BRCM_PCIE_4366_5G_DEVICE_ID 0x43c5
  24458. -+#define BRCM_PCIE_4371_DEVICE_ID 0x440d
  24459. -
  24460. -
  24461. - /* brcmsmac IDs */
  24462. 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
  24463. deleted file mode 100644
  24464. index 221bae6..0000000
  24465. --- a/package/kernel/mac80211/patches/374-0001-brcmfmac-Add-support-for-the-BCM4359-11ac-RSDB-PCIE-.patch
  24466. +++ /dev/null
  24467. @@ -1,78 +0,0 @@
  24468. -From: Hante Meuleman <meuleman@broadcom.com>
  24469. -Date: Thu, 29 Oct 2015 20:33:11 +0100
  24470. -Subject: [PATCH] brcmfmac: Add support for the BCM4359 11ac RSDB PCIE device.
  24471. -
  24472. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  24473. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  24474. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  24475. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  24476. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  24477. ----
  24478. -
  24479. ---- a/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  24480. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/chip.c
  24481. -@@ -681,6 +681,7 @@ static u32 brcmf_chip_tcm_rambase(struct
  24482. - case BRCM_CC_43569_CHIP_ID:
  24483. - case BRCM_CC_43570_CHIP_ID:
  24484. - case BRCM_CC_4358_CHIP_ID:
  24485. -+ case BRCM_CC_4359_CHIP_ID:
  24486. - case BRCM_CC_43602_CHIP_ID:
  24487. - case BRCM_CC_4371_CHIP_ID:
  24488. - return 0x180000;
  24489. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  24490. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  24491. -@@ -55,6 +55,8 @@ enum brcmf_pcie_state {
  24492. - #define BRCMF_PCIE_43570_NVRAM_NAME "brcm/brcmfmac43570-pcie.txt"
  24493. - #define BRCMF_PCIE_4358_FW_NAME "brcm/brcmfmac4358-pcie.bin"
  24494. - #define BRCMF_PCIE_4358_NVRAM_NAME "brcm/brcmfmac4358-pcie.txt"
  24495. -+#define BRCMF_PCIE_4359_FW_NAME "brcm/brcmfmac4359-pcie.bin"
  24496. -+#define BRCMF_PCIE_4359_NVRAM_NAME "brcm/brcmfmac4359-pcie.txt"
  24497. - #define BRCMF_PCIE_4365_FW_NAME "brcm/brcmfmac4365b-pcie.bin"
  24498. - #define BRCMF_PCIE_4365_NVRAM_NAME "brcm/brcmfmac4365b-pcie.txt"
  24499. - #define BRCMF_PCIE_4366_FW_NAME "brcm/brcmfmac4366b-pcie.bin"
  24500. -@@ -210,6 +212,8 @@ MODULE_FIRMWARE(BRCMF_PCIE_43570_FW_NAME
  24501. - MODULE_FIRMWARE(BRCMF_PCIE_43570_NVRAM_NAME);
  24502. - MODULE_FIRMWARE(BRCMF_PCIE_4358_FW_NAME);
  24503. - MODULE_FIRMWARE(BRCMF_PCIE_4358_NVRAM_NAME);
  24504. -+MODULE_FIRMWARE(BRCMF_PCIE_4359_FW_NAME);
  24505. -+MODULE_FIRMWARE(BRCMF_PCIE_4359_NVRAM_NAME);
  24506. - MODULE_FIRMWARE(BRCMF_PCIE_4365_FW_NAME);
  24507. - MODULE_FIRMWARE(BRCMF_PCIE_4365_NVRAM_NAME);
  24508. - MODULE_FIRMWARE(BRCMF_PCIE_4366_FW_NAME);
  24509. -@@ -1517,6 +1521,10 @@ static int brcmf_pcie_get_fwnames(struct
  24510. - fw_name = BRCMF_PCIE_4358_FW_NAME;
  24511. - nvram_name = BRCMF_PCIE_4358_NVRAM_NAME;
  24512. - break;
  24513. -+ case BRCM_CC_4359_CHIP_ID:
  24514. -+ fw_name = BRCMF_PCIE_4359_FW_NAME;
  24515. -+ nvram_name = BRCMF_PCIE_4359_NVRAM_NAME;
  24516. -+ break;
  24517. - case BRCM_CC_4365_CHIP_ID:
  24518. - fw_name = BRCMF_PCIE_4365_FW_NAME;
  24519. - nvram_name = BRCMF_PCIE_4365_NVRAM_NAME;
  24520. -@@ -2058,6 +2066,7 @@ static struct pci_device_id brcmf_pcie_d
  24521. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43567_DEVICE_ID),
  24522. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43570_DEVICE_ID),
  24523. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4358_DEVICE_ID),
  24524. -+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4359_DEVICE_ID),
  24525. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_DEVICE_ID),
  24526. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_2G_DEVICE_ID),
  24527. - BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_5G_DEVICE_ID),
  24528. ---- a/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  24529. -+++ b/drivers/net/wireless/brcm80211/include/brcm_hw_ids.h
  24530. -@@ -47,6 +47,7 @@
  24531. - #define BRCM_CC_43569_CHIP_ID 43569
  24532. - #define BRCM_CC_43570_CHIP_ID 43570
  24533. - #define BRCM_CC_4358_CHIP_ID 0x4358
  24534. -+#define BRCM_CC_4359_CHIP_ID 0x4359
  24535. - #define BRCM_CC_43602_CHIP_ID 43602
  24536. - #define BRCM_CC_4365_CHIP_ID 0x4365
  24537. - #define BRCM_CC_4366_CHIP_ID 0x4366
  24538. -@@ -66,6 +67,7 @@
  24539. - #define BRCM_PCIE_43567_DEVICE_ID 0x43d3
  24540. - #define BRCM_PCIE_43570_DEVICE_ID 0x43d9
  24541. - #define BRCM_PCIE_4358_DEVICE_ID 0x43e9
  24542. -+#define BRCM_PCIE_4359_DEVICE_ID 0x43ef
  24543. - #define BRCM_PCIE_43602_DEVICE_ID 0x43ba
  24544. - #define BRCM_PCIE_43602_2G_DEVICE_ID 0x43bb
  24545. - #define BRCM_PCIE_43602_5G_DEVICE_ID 0x43bc
  24546. 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
  24547. deleted file mode 100644
  24548. index 331896b..0000000
  24549. --- a/package/kernel/mac80211/patches/374-0002-brcmfmac-Simplify-and-fix-usage-of-brcmf_ifname.patch
  24550. +++ /dev/null
  24551. @@ -1,110 +0,0 @@
  24552. -From: Hante Meuleman <meuleman@broadcom.com>
  24553. -Date: Thu, 29 Oct 2015 20:33:12 +0100
  24554. -Subject: [PATCH] brcmfmac: Simplify and fix usage of brcmf_ifname.
  24555. -
  24556. -brcmf_ifname is a debug function to return a name related to an ifp,
  24557. -but is using a rather complex implementation. It was also used
  24558. -wrongly from bcdc as it did not use the bsscfgidx as it was supposed
  24559. -to, but bssidx. This patch fixes that bug and simplifies
  24560. -brcmf_ifname.
  24561. -
  24562. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  24563. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  24564. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  24565. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  24566. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  24567. ----
  24568. -
  24569. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  24570. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
  24571. -@@ -187,7 +187,8 @@ retry:
  24572. - goto retry;
  24573. - if (id != bcdc->reqid) {
  24574. - brcmf_err("%s: unexpected request id %d (expected %d)\n",
  24575. -- brcmf_ifname(drvr, ifidx), id, bcdc->reqid);
  24576. -+ brcmf_ifname(brcmf_get_ifp(drvr, ifidx)), id,
  24577. -+ bcdc->reqid);
  24578. - ret = -EINVAL;
  24579. - goto done;
  24580. - }
  24581. -@@ -234,7 +235,8 @@ brcmf_proto_bcdc_set_dcmd(struct brcmf_p
  24582. -
  24583. - if (id != bcdc->reqid) {
  24584. - brcmf_err("%s: unexpected request id %d (expected %d)\n",
  24585. -- brcmf_ifname(drvr, ifidx), id, bcdc->reqid);
  24586. -+ brcmf_ifname(brcmf_get_ifp(drvr, ifidx)), id,
  24587. -+ bcdc->reqid);
  24588. - ret = -EINVAL;
  24589. - goto done;
  24590. - }
  24591. -@@ -298,13 +300,13 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pu
  24592. - if (((h->flags & BCDC_FLAG_VER_MASK) >> BCDC_FLAG_VER_SHIFT) !=
  24593. - BCDC_PROTO_VER) {
  24594. - brcmf_err("%s: non-BCDC packet received, flags 0x%x\n",
  24595. -- brcmf_ifname(drvr, tmp_if->ifidx), h->flags);
  24596. -+ brcmf_ifname(tmp_if), h->flags);
  24597. - return -EBADE;
  24598. - }
  24599. -
  24600. - if (h->flags & BCDC_FLAG_SUM_GOOD) {
  24601. - brcmf_dbg(BCDC, "%s: BDC rcv, good checksum, flags 0x%x\n",
  24602. -- brcmf_ifname(drvr, tmp_if->ifidx), h->flags);
  24603. -+ brcmf_ifname(tmp_if), h->flags);
  24604. - pktbuf->ip_summed = CHECKSUM_UNNECESSARY;
  24605. - }
  24606. -
  24607. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  24608. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  24609. -@@ -66,20 +66,13 @@ static int brcmf_p2p_enable;
  24610. - module_param_named(p2pon, brcmf_p2p_enable, int, 0);
  24611. - MODULE_PARM_DESC(p2pon, "enable legacy p2p management functionality");
  24612. -
  24613. --char *brcmf_ifname(struct brcmf_pub *drvr, int ifidx)
  24614. -+char *brcmf_ifname(struct brcmf_if *ifp)
  24615. - {
  24616. -- if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  24617. -- brcmf_err("ifidx %d out of range\n", ifidx);
  24618. -- return "<if_bad>";
  24619. -- }
  24620. --
  24621. -- if (drvr->iflist[ifidx] == NULL) {
  24622. -- brcmf_err("null i/f %d\n", ifidx);
  24623. -+ if (!ifp)
  24624. - return "<if_null>";
  24625. -- }
  24626. -
  24627. -- if (drvr->iflist[ifidx]->ndev)
  24628. -- return drvr->iflist[ifidx]->ndev->name;
  24629. -+ if (ifp->ndev)
  24630. -+ return ifp->ndev->name;
  24631. -
  24632. - return "<if_none>";
  24633. - }
  24634. -@@ -237,14 +230,14 @@ static netdev_tx_t brcmf_netdev_start_xm
  24635. - struct sk_buff *skb2;
  24636. -
  24637. - brcmf_dbg(INFO, "%s: insufficient headroom\n",
  24638. -- brcmf_ifname(drvr, ifp->bssidx));
  24639. -+ brcmf_ifname(ifp));
  24640. - drvr->bus_if->tx_realloc++;
  24641. - skb2 = skb_realloc_headroom(skb, drvr->hdrlen);
  24642. - dev_kfree_skb(skb);
  24643. - skb = skb2;
  24644. - if (skb == NULL) {
  24645. - brcmf_err("%s: skb_realloc_headroom failed\n",
  24646. -- brcmf_ifname(drvr, ifp->bssidx));
  24647. -+ brcmf_ifname(ifp));
  24648. - ret = -ENOMEM;
  24649. - goto done;
  24650. - }
  24651. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  24652. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  24653. -@@ -205,7 +205,7 @@ struct brcmf_skb_reorder_data {
  24654. - int brcmf_netdev_wait_pend8021x(struct brcmf_if *ifp);
  24655. -
  24656. - /* Return pointer to interface name */
  24657. --char *brcmf_ifname(struct brcmf_pub *drvr, int idx);
  24658. -+char *brcmf_ifname(struct brcmf_if *ifp);
  24659. - struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  24660. - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  24661. - struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  24662. 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
  24663. deleted file mode 100644
  24664. index 4d60521..0000000
  24665. --- a/package/kernel/mac80211/patches/374-0003-brcmfmac-Remove-unnecessary-check-from-start_xmit.patch
  24666. +++ /dev/null
  24667. @@ -1,32 +0,0 @@
  24668. -From: Hante Meuleman <meuleman@broadcom.com>
  24669. -Date: Thu, 29 Oct 2015 20:33:13 +0100
  24670. -Subject: [PATCH] brcmfmac: Remove unnecessary check from start_xmit.
  24671. -
  24672. -The brcmf_netdev_start_xmit checks if the ndev is still valid by
  24673. -checking if it still exists in database. This check is not needed
  24674. -and therefor removed.
  24675. -
  24676. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  24677. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  24678. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  24679. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  24680. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  24681. ----
  24682. -
  24683. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  24684. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  24685. -@@ -217,14 +217,6 @@ static netdev_tx_t brcmf_netdev_start_xm
  24686. - goto done;
  24687. - }
  24688. -
  24689. -- if (!drvr->iflist[ifp->bssidx]) {
  24690. -- brcmf_err("bad ifidx %d\n", ifp->bssidx);
  24691. -- netif_stop_queue(ndev);
  24692. -- dev_kfree_skb(skb);
  24693. -- ret = -ENODEV;
  24694. -- goto done;
  24695. -- }
  24696. --
  24697. - /* Make sure there's enough room for any header */
  24698. - if (skb_headroom(skb) < drvr->hdrlen) {
  24699. - struct sk_buff *skb2;
  24700. 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
  24701. deleted file mode 100644
  24702. index 5030297..0000000
  24703. --- a/package/kernel/mac80211/patches/374-0004-brcmfmac-Remove-unncessary-variable-irq_requested.patch
  24704. +++ /dev/null
  24705. @@ -1,49 +0,0 @@
  24706. -From: Hante Meuleman <meuleman@broadcom.com>
  24707. -Date: Thu, 29 Oct 2015 20:33:14 +0100
  24708. -Subject: [PATCH] brcmfmac: Remove unncessary variable irq_requested.
  24709. -
  24710. -The variable irq_requested is unneeded as the functionality
  24711. -it is providing, is also provided by the variable irq_allocated.
  24712. -
  24713. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  24714. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  24715. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  24716. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  24717. ----
  24718. -
  24719. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  24720. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  24721. -@@ -257,7 +257,6 @@ struct brcmf_pcie_core_info {
  24722. - struct brcmf_pciedev_info {
  24723. - enum brcmf_pcie_state state;
  24724. - bool in_irq;
  24725. -- bool irq_requested;
  24726. - struct pci_dev *pdev;
  24727. - char fw_name[BRCMF_FW_PATH_LEN + BRCMF_FW_NAME_LEN];
  24728. - char nvram_name[BRCMF_FW_PATH_LEN + BRCMF_FW_NAME_LEN];
  24729. -@@ -889,7 +888,6 @@ static int brcmf_pcie_request_irq(struct
  24730. -
  24731. - brcmf_dbg(PCIE, "Enter\n");
  24732. - /* is it a v1 or v2 implementation */
  24733. -- devinfo->irq_requested = false;
  24734. - pci_enable_msi(pdev);
  24735. - if (devinfo->generic_corerev == BRCMF_PCIE_GENREV1) {
  24736. - if (request_threaded_irq(pdev->irq,
  24737. -@@ -912,7 +910,6 @@ static int brcmf_pcie_request_irq(struct
  24738. - return -EIO;
  24739. - }
  24740. - }
  24741. -- devinfo->irq_requested = true;
  24742. - devinfo->irq_allocated = true;
  24743. - return 0;
  24744. - }
  24745. -@@ -930,9 +927,6 @@ static void brcmf_pcie_release_irq(struc
  24746. - pdev = devinfo->pdev;
  24747. -
  24748. - brcmf_pcie_intr_disable(devinfo);
  24749. -- if (!devinfo->irq_requested)
  24750. -- return;
  24751. -- devinfo->irq_requested = false;
  24752. - free_irq(pdev->irq, devinfo);
  24753. - pci_disable_msi(pdev);
  24754. -
  24755. 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
  24756. deleted file mode 100644
  24757. index f2afb90..0000000
  24758. --- a/package/kernel/mac80211/patches/374-0005-brcmfmac-Disable-runtime-pm-for-USB.patch
  24759. +++ /dev/null
  24760. @@ -1,26 +0,0 @@
  24761. -From: Hante Meuleman <meuleman@broadcom.com>
  24762. -Date: Thu, 29 Oct 2015 20:33:15 +0100
  24763. -Subject: [PATCH] brcmfmac: Disable runtime pm for USB.
  24764. -
  24765. -Currently runtime pm is enabled for USB, but it is not properly
  24766. -supported by driver. This patch disables the runtime PM support
  24767. -completely for USB, as it currently can result in problems on
  24768. -some systems.
  24769. -
  24770. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  24771. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  24772. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  24773. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  24774. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  24775. ----
  24776. -
  24777. ---- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  24778. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  24779. -@@ -1504,7 +1504,6 @@ static struct usb_driver brcmf_usbdrvr =
  24780. - .suspend = brcmf_usb_suspend,
  24781. - .resume = brcmf_usb_resume,
  24782. - .reset_resume = brcmf_usb_reset_resume,
  24783. -- .supports_autosuspend = 1,
  24784. - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
  24785. - .disable_hub_initiated_lpm = 1,
  24786. - #endif
  24787. 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
  24788. deleted file mode 100644
  24789. index 78a95c5..0000000
  24790. --- a/package/kernel/mac80211/patches/374-0006-brcmfmac-Add-RSDB-support.patch
  24791. +++ /dev/null
  24792. @@ -1,65 +0,0 @@
  24793. -From: Hante Meuleman <meuleman@broadcom.com>
  24794. -Date: Thu, 29 Oct 2015 20:33:16 +0100
  24795. -Subject: [PATCH] brcmfmac: Add RSDB support.
  24796. -
  24797. -Broadcom devices with a single 802.11 core can work on two band
  24798. -concurrently using VSDB feature, ie. Virtual Simultaneous Dual-Band.
  24799. -For devices that are fitted with two 802.11 cores and RF paths the
  24800. -driver should support a firmware feature called RSDB, which stands
  24801. -for Real Simultaneous Dual-Band. RSDB works almost autonomously in
  24802. -firmware except for AP config. When the device supports RSDB then
  24803. -the interface should not be brought down when configuring it,
  24804. -otherwise the link (if configured) on the other interface will be
  24805. -lost.
  24806. -
  24807. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  24808. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  24809. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  24810. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  24811. -[kvalo@codeaurora.org: changed the commit log based on discussion]
  24812. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  24813. ----
  24814. -
  24815. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  24816. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  24817. -@@ -4182,7 +4182,9 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  24818. - }
  24819. - }
  24820. -
  24821. -- if (dev_role == NL80211_IFTYPE_AP) {
  24822. -+ if ((dev_role == NL80211_IFTYPE_AP) &&
  24823. -+ ((ifp->ifidx == 0) ||
  24824. -+ !brcmf_feat_is_enabled(ifp, BRCMF_FEAT_RSDB))) {
  24825. - err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1);
  24826. - if (err < 0) {
  24827. - brcmf_err("BRCMF_C_DOWN error %d\n", err);
  24828. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  24829. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.c
  24830. -@@ -137,6 +137,7 @@ void brcmf_feat_attach(struct brcmf_pub
  24831. - if (drvr->bus_if->chip != BRCM_CC_43362_CHIP_ID)
  24832. - brcmf_feat_iovar_int_set(ifp, BRCMF_FEAT_MBSS, "mbss", 0);
  24833. - brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_P2P, "p2p");
  24834. -+ brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_RSDB, "rsdb_mode");
  24835. -
  24836. - if (brcmf_feature_disable) {
  24837. - brcmf_dbg(INFO, "Features: 0x%02x, disable: 0x%02x\n",
  24838. ---- a/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  24839. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/feature.h
  24840. -@@ -24,13 +24,16 @@
  24841. - * PNO: preferred network offload.
  24842. - * WOWL: Wake-On-WLAN.
  24843. - * P2P: peer-to-peer
  24844. -+ * RSDB: Real Simultaneous Dual Band
  24845. - */
  24846. - #define BRCMF_FEAT_LIST \
  24847. - BRCMF_FEAT_DEF(MBSS) \
  24848. - BRCMF_FEAT_DEF(MCHAN) \
  24849. - BRCMF_FEAT_DEF(PNO) \
  24850. - BRCMF_FEAT_DEF(WOWL) \
  24851. -- BRCMF_FEAT_DEF(P2P)
  24852. -+ BRCMF_FEAT_DEF(P2P) \
  24853. -+ BRCMF_FEAT_DEF(RSDB)
  24854. -+
  24855. - /*
  24856. - * Quirks:
  24857. - *
  24858. 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
  24859. deleted file mode 100644
  24860. index d1e7264..0000000
  24861. --- a/package/kernel/mac80211/patches/374-0007-brcmfmac-Use-consistent-naming-for-bsscfgidx.patch
  24862. +++ /dev/null
  24863. @@ -1,533 +0,0 @@
  24864. -From: Hante Meuleman <meuleman@broadcom.com>
  24865. -Date: Thu, 29 Oct 2015 20:33:17 +0100
  24866. -Subject: [PATCH] brcmfmac: Use consistent naming for bsscfgidx.
  24867. -
  24868. -The variable bsscfgidx is used in different places with different
  24869. -names, e.g. bsscfg, bssidx, bsscfg_idx. This patch cleans this up
  24870. -by using bsscfgidx everywhere.
  24871. -
  24872. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  24873. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  24874. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  24875. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  24876. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  24877. ----
  24878. -
  24879. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  24880. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  24881. -@@ -775,7 +775,8 @@ brcmf_cfg80211_change_iface(struct wiphy
  24882. - s32 ap = 0;
  24883. - s32 err = 0;
  24884. -
  24885. -- brcmf_dbg(TRACE, "Enter, idx=%d, type=%d\n", ifp->bssidx, type);
  24886. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, type=%d\n", ifp->bsscfgidx,
  24887. -+ type);
  24888. -
  24889. - /* WAR: There are a number of p2p interface related problems which
  24890. - * need to be handled initially (before doing the validate).
  24891. -@@ -2920,7 +2921,7 @@ brcmf_cfg80211_escan_handler(struct brcm
  24892. - status = e->status;
  24893. -
  24894. - if (!test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) {
  24895. -- brcmf_err("scan not ready, bssidx=%d\n", ifp->bssidx);
  24896. -+ brcmf_err("scan not ready, bsscfgidx=%d\n", ifp->bsscfgidx);
  24897. - return -EPERM;
  24898. - }
  24899. -
  24900. -@@ -3876,7 +3877,8 @@ s32 brcmf_vif_set_mgmt_ie(struct brcmf_c
  24901. - ifp = vif->ifp;
  24902. - saved_ie = &vif->saved_ie;
  24903. -
  24904. -- brcmf_dbg(TRACE, "bssidx %d, pktflag : 0x%02X\n", ifp->bssidx, pktflag);
  24905. -+ brcmf_dbg(TRACE, "bsscfgidx %d, pktflag : 0x%02X\n", ifp->bsscfgidx,
  24906. -+ pktflag);
  24907. - iovar_ie_buf = kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL);
  24908. - if (!iovar_ie_buf)
  24909. - return -ENOMEM;
  24910. -@@ -4240,7 +4242,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wi
  24911. - brcmf_err("setting ssid failed %d\n", err);
  24912. - goto exit;
  24913. - }
  24914. -- bss_enable.bsscfg_idx = cpu_to_le32(ifp->bssidx);
  24915. -+ bss_enable.bsscfgidx = cpu_to_le32(ifp->bsscfgidx);
  24916. - bss_enable.enable = cpu_to_le32(1);
  24917. - err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
  24918. - sizeof(bss_enable));
  24919. -@@ -4307,7 +4309,7 @@ static int brcmf_cfg80211_stop_ap(struct
  24920. - if (err < 0)
  24921. - brcmf_err("BRCMF_C_UP error %d\n", err);
  24922. - } else {
  24923. -- bss_enable.bsscfg_idx = cpu_to_le32(ifp->bssidx);
  24924. -+ bss_enable.bsscfgidx = cpu_to_le32(ifp->bsscfgidx);
  24925. - bss_enable.enable = cpu_to_le32(0);
  24926. - err = brcmf_fil_iovar_data_set(ifp, "bss", &bss_enable,
  24927. - sizeof(bss_enable));
  24928. -@@ -5093,9 +5095,9 @@ static s32 brcmf_notify_vif_event(struct
  24929. - struct brcmf_cfg80211_vif_event *event = &cfg->vif_event;
  24930. - struct brcmf_cfg80211_vif *vif;
  24931. -
  24932. -- brcmf_dbg(TRACE, "Enter: action %u flags %u ifidx %u bsscfg %u\n",
  24933. -+ brcmf_dbg(TRACE, "Enter: action %u flags %u ifidx %u bsscfgidx %u\n",
  24934. - ifevent->action, ifevent->flags, ifevent->ifidx,
  24935. -- ifevent->bssidx);
  24936. -+ ifevent->bsscfgidx);
  24937. -
  24938. - mutex_lock(&event->vif_event_lock);
  24939. - event->action = ifevent->action;
  24940. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  24941. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  24942. -@@ -80,7 +80,7 @@ char *brcmf_ifname(struct brcmf_if *ifp)
  24943. - struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx)
  24944. - {
  24945. - struct brcmf_if *ifp;
  24946. -- s32 bssidx;
  24947. -+ s32 bsscfgidx;
  24948. -
  24949. - if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) {
  24950. - brcmf_err("ifidx %d out of range\n", ifidx);
  24951. -@@ -88,9 +88,9 @@ struct brcmf_if *brcmf_get_ifp(struct br
  24952. - }
  24953. -
  24954. - ifp = NULL;
  24955. -- bssidx = drvr->if2bss[ifidx];
  24956. -- if (bssidx >= 0)
  24957. -- ifp = drvr->iflist[bssidx];
  24958. -+ bsscfgidx = drvr->if2bss[ifidx];
  24959. -+ if (bsscfgidx >= 0)
  24960. -+ ifp = drvr->iflist[bsscfgidx];
  24961. -
  24962. - return ifp;
  24963. - }
  24964. -@@ -108,7 +108,7 @@ static void _brcmf_set_multicast_list(st
  24965. -
  24966. - ifp = container_of(work, struct brcmf_if, multicast_work);
  24967. -
  24968. -- brcmf_dbg(TRACE, "Enter, idx=%d\n", ifp->bssidx);
  24969. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
  24970. -
  24971. - ndev = ifp->ndev;
  24972. -
  24973. -@@ -168,7 +168,7 @@ _brcmf_set_mac_address(struct work_struc
  24974. -
  24975. - ifp = container_of(work, struct brcmf_if, setmacaddr_work);
  24976. -
  24977. -- brcmf_dbg(TRACE, "Enter, idx=%d\n", ifp->bssidx);
  24978. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
  24979. -
  24980. - err = brcmf_fil_iovar_data_set(ifp, "cur_etheraddr", ifp->mac_addr,
  24981. - ETH_ALEN);
  24982. -@@ -206,7 +206,7 @@ static netdev_tx_t brcmf_netdev_start_xm
  24983. - struct brcmf_pub *drvr = ifp->drvr;
  24984. - struct ethhdr *eh = (struct ethhdr *)(skb->data);
  24985. -
  24986. -- brcmf_dbg(DATA, "Enter, idx=%d\n", ifp->bssidx);
  24987. -+ brcmf_dbg(DATA, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
  24988. -
  24989. - /* Can the device send data? */
  24990. - if (drvr->bus_if->state != BRCMF_BUS_UP) {
  24991. -@@ -267,8 +267,8 @@ void brcmf_txflowblock_if(struct brcmf_i
  24992. - if (!ifp || !ifp->ndev)
  24993. - return;
  24994. -
  24995. -- brcmf_dbg(TRACE, "enter: idx=%d stop=0x%X reason=%d state=%d\n",
  24996. -- ifp->bssidx, ifp->netif_stop, reason, state);
  24997. -+ brcmf_dbg(TRACE, "enter: bsscfgidx=%d stop=0x%X reason=%d state=%d\n",
  24998. -+ ifp->bsscfgidx, ifp->netif_stop, reason, state);
  24999. -
  25000. - spin_lock_irqsave(&ifp->netif_stop_lock, flags);
  25001. - if (state) {
  25002. -@@ -587,7 +587,7 @@ static struct net_device_stats *brcmf_ne
  25003. - {
  25004. - struct brcmf_if *ifp = netdev_priv(ndev);
  25005. -
  25006. -- brcmf_dbg(TRACE, "Enter, idx=%d\n", ifp->bssidx);
  25007. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
  25008. -
  25009. - return &ifp->stats;
  25010. - }
  25011. -@@ -616,7 +616,7 @@ static int brcmf_netdev_stop(struct net_
  25012. - {
  25013. - struct brcmf_if *ifp = netdev_priv(ndev);
  25014. -
  25015. -- brcmf_dbg(TRACE, "Enter, idx=%d\n", ifp->bssidx);
  25016. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
  25017. -
  25018. - brcmf_cfg80211_down(ndev);
  25019. -
  25020. -@@ -632,7 +632,7 @@ static int brcmf_netdev_open(struct net_
  25021. - struct brcmf_bus *bus_if = drvr->bus_if;
  25022. - u32 toe_ol;
  25023. -
  25024. -- brcmf_dbg(TRACE, "Enter, idx=%d\n", ifp->bssidx);
  25025. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
  25026. -
  25027. - /* If bus is not ready, can't continue */
  25028. - if (bus_if->state != BRCMF_BUS_UP) {
  25029. -@@ -674,7 +674,7 @@ int brcmf_net_attach(struct brcmf_if *if
  25030. - struct net_device *ndev;
  25031. - s32 err;
  25032. -
  25033. -- brcmf_dbg(TRACE, "Enter, idx=%d mac=%pM\n", ifp->bssidx,
  25034. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d mac=%pM\n", ifp->bsscfgidx,
  25035. - ifp->mac_addr);
  25036. - ndev = ifp->ndev;
  25037. -
  25038. -@@ -706,7 +706,7 @@ int brcmf_net_attach(struct brcmf_if *if
  25039. - return 0;
  25040. -
  25041. - fail:
  25042. -- drvr->iflist[ifp->bssidx] = NULL;
  25043. -+ drvr->iflist[ifp->bsscfgidx] = NULL;
  25044. - ndev->netdev_ops = NULL;
  25045. - free_netdev(ndev);
  25046. - return -EBADE;
  25047. -@@ -724,7 +724,8 @@ void brcmf_net_setcarrier(struct brcmf_i
  25048. - {
  25049. - struct net_device *ndev;
  25050. -
  25051. -- brcmf_dbg(TRACE, "Enter, idx=%d carrier=%d\n", ifp->bssidx, on);
  25052. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d carrier=%d\n", ifp->bsscfgidx,
  25053. -+ on);
  25054. -
  25055. - ndev = ifp->ndev;
  25056. - brcmf_txflowblock_if(ifp, BRCMF_NETIF_STOP_REASON_DISCONNECTED, !on);
  25057. -@@ -771,7 +772,7 @@ static int brcmf_net_p2p_attach(struct b
  25058. - {
  25059. - struct net_device *ndev;
  25060. -
  25061. -- brcmf_dbg(TRACE, "Enter, idx=%d mac=%pM\n", ifp->bssidx,
  25062. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d mac=%pM\n", ifp->bsscfgidx,
  25063. - ifp->mac_addr);
  25064. - ndev = ifp->ndev;
  25065. -
  25066. -@@ -790,21 +791,21 @@ static int brcmf_net_p2p_attach(struct b
  25067. - return 0;
  25068. -
  25069. - fail:
  25070. -- ifp->drvr->iflist[ifp->bssidx] = NULL;
  25071. -+ ifp->drvr->iflist[ifp->bsscfgidx] = NULL;
  25072. - ndev->netdev_ops = NULL;
  25073. - free_netdev(ndev);
  25074. - return -EBADE;
  25075. - }
  25076. -
  25077. --struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  25078. -+struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  25079. - bool is_p2pdev, char *name, u8 *mac_addr)
  25080. - {
  25081. - struct brcmf_if *ifp;
  25082. - struct net_device *ndev;
  25083. -
  25084. -- brcmf_dbg(TRACE, "Enter, idx=%d, ifidx=%d\n", bssidx, ifidx);
  25085. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", bsscfgidx, ifidx);
  25086. -
  25087. -- ifp = drvr->iflist[bssidx];
  25088. -+ ifp = drvr->iflist[bsscfgidx];
  25089. - /*
  25090. - * Delete the existing interface before overwriting it
  25091. - * in case we missed the BRCMF_E_IF_DEL event.
  25092. -@@ -815,7 +816,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  25093. - if (ifidx) {
  25094. - netif_stop_queue(ifp->ndev);
  25095. - brcmf_net_detach(ifp->ndev);
  25096. -- drvr->iflist[bssidx] = NULL;
  25097. -+ drvr->iflist[bsscfgidx] = NULL;
  25098. - } else {
  25099. - brcmf_err("ignore IF event\n");
  25100. - return ERR_PTR(-EINVAL);
  25101. -@@ -839,15 +840,15 @@ struct brcmf_if *brcmf_add_if(struct brc
  25102. - ndev->destructor = brcmf_cfg80211_free_netdev;
  25103. - ifp = netdev_priv(ndev);
  25104. - ifp->ndev = ndev;
  25105. -- /* store mapping ifidx to bssidx */
  25106. -+ /* store mapping ifidx to bsscfgidx */
  25107. - if (drvr->if2bss[ifidx] == BRCMF_BSSIDX_INVALID)
  25108. -- drvr->if2bss[ifidx] = bssidx;
  25109. -+ drvr->if2bss[ifidx] = bsscfgidx;
  25110. - }
  25111. -
  25112. - ifp->drvr = drvr;
  25113. -- drvr->iflist[bssidx] = ifp;
  25114. -+ drvr->iflist[bsscfgidx] = ifp;
  25115. - ifp->ifidx = ifidx;
  25116. -- ifp->bssidx = bssidx;
  25117. -+ ifp->bsscfgidx = bsscfgidx;
  25118. -
  25119. - init_waitqueue_head(&ifp->pend_8021x_wait);
  25120. - spin_lock_init(&ifp->netif_stop_lock);
  25121. -@@ -861,21 +862,22 @@ struct brcmf_if *brcmf_add_if(struct brc
  25122. - return ifp;
  25123. - }
  25124. -
  25125. --static void brcmf_del_if(struct brcmf_pub *drvr, s32 bssidx)
  25126. -+static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx)
  25127. - {
  25128. - struct brcmf_if *ifp;
  25129. -
  25130. -- ifp = drvr->iflist[bssidx];
  25131. -- drvr->iflist[bssidx] = NULL;
  25132. -+ ifp = drvr->iflist[bsscfgidx];
  25133. -+ drvr->iflist[bsscfgidx] = NULL;
  25134. - if (!ifp) {
  25135. -- brcmf_err("Null interface, idx=%d\n", bssidx);
  25136. -+ brcmf_err("Null interface, bsscfgidx=%d\n", bsscfgidx);
  25137. - return;
  25138. - }
  25139. -- brcmf_dbg(TRACE, "Enter, idx=%d, ifidx=%d\n", bssidx, ifp->ifidx);
  25140. -- if (drvr->if2bss[ifp->ifidx] == bssidx)
  25141. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", bsscfgidx,
  25142. -+ ifp->ifidx);
  25143. -+ if (drvr->if2bss[ifp->ifidx] == bsscfgidx)
  25144. - drvr->if2bss[ifp->ifidx] = BRCMF_BSSIDX_INVALID;
  25145. - if (ifp->ndev) {
  25146. -- if (bssidx == 0) {
  25147. -+ if (bsscfgidx == 0) {
  25148. - if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) {
  25149. - rtnl_lock();
  25150. - brcmf_netdev_stop(ifp->ndev);
  25151. -@@ -905,12 +907,12 @@ static void brcmf_del_if(struct brcmf_pu
  25152. -
  25153. - void brcmf_remove_interface(struct brcmf_if *ifp)
  25154. - {
  25155. -- if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bssidx] != ifp))
  25156. -+ if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bsscfgidx] != ifp))
  25157. - return;
  25158. -- brcmf_dbg(TRACE, "Enter, bssidx=%d, ifidx=%d\n", ifp->bssidx,
  25159. -+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", ifp->bsscfgidx,
  25160. - ifp->ifidx);
  25161. - brcmf_fws_del_interface(ifp);
  25162. -- brcmf_del_if(ifp->drvr, ifp->bssidx);
  25163. -+ brcmf_del_if(ifp->drvr, ifp->bsscfgidx);
  25164. - }
  25165. -
  25166. - int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr)
  25167. -@@ -925,10 +927,10 @@ int brcmf_get_next_free_bsscfgidx(struct
  25168. - highest = 2;
  25169. - for (ifidx = 0; ifidx < BRCMF_MAX_IFS; ifidx++) {
  25170. - if (drvr->iflist[ifidx]) {
  25171. -- if (drvr->iflist[ifidx]->bssidx == bsscfgidx)
  25172. -+ if (drvr->iflist[ifidx]->bsscfgidx == bsscfgidx)
  25173. - bsscfgidx = highest + 1;
  25174. -- else if (drvr->iflist[ifidx]->bssidx > highest)
  25175. -- highest = drvr->iflist[ifidx]->bssidx;
  25176. -+ else if (drvr->iflist[ifidx]->bsscfgidx > highest)
  25177. -+ highest = drvr->iflist[ifidx]->bsscfgidx;
  25178. - } else {
  25179. - available = true;
  25180. - }
  25181. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
  25182. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
  25183. -@@ -174,7 +174,7 @@ enum brcmf_netif_stop_reason {
  25184. - * @multicast_work: worker object for multicast provisioning.
  25185. - * @fws_desc: interface specific firmware-signalling descriptor.
  25186. - * @ifidx: interface index in device firmware.
  25187. -- * @bssidx: index of bss associated with this interface.
  25188. -+ * @bsscfgidx: index of bss associated with this interface.
  25189. - * @mac_addr: assigned mac address.
  25190. - * @netif_stop: bitmap indicates reason why netif queues are stopped.
  25191. - * @netif_stop_lock: spinlock for update netif_stop from multiple sources.
  25192. -@@ -190,7 +190,7 @@ struct brcmf_if {
  25193. - struct work_struct multicast_work;
  25194. - struct brcmf_fws_mac_descriptor *fws_desc;
  25195. - int ifidx;
  25196. -- s32 bssidx;
  25197. -+ s32 bsscfgidx;
  25198. - u8 mac_addr[ETH_ALEN];
  25199. - u8 netif_stop;
  25200. - spinlock_t netif_stop_lock;
  25201. -@@ -208,7 +208,7 @@ int brcmf_netdev_wait_pend8021x(struct b
  25202. - char *brcmf_ifname(struct brcmf_if *ifp);
  25203. - struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  25204. - int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  25205. --struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bssidx, s32 ifidx,
  25206. -+struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  25207. - bool is_p2pdev, char *name, u8 *mac_addr);
  25208. - void brcmf_remove_interface(struct brcmf_if *ifp);
  25209. - int brcmf_get_next_free_bsscfgidx(struct brcmf_pub *drvr);
  25210. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  25211. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.c
  25212. -@@ -49,7 +49,7 @@ static int brcmf_debug_psm_watchdog_noti
  25213. - const struct brcmf_event_msg *evtmsg,
  25214. - void *data)
  25215. - {
  25216. -- brcmf_dbg(TRACE, "enter: idx=%d\n", ifp->bssidx);
  25217. -+ brcmf_dbg(TRACE, "enter: bsscfgidx=%d\n", ifp->bsscfgidx);
  25218. -
  25219. - return brcmf_debug_create_memdump(ifp->drvr->bus_if, data,
  25220. - evtmsg->datalen);
  25221. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  25222. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c
  25223. -@@ -182,8 +182,8 @@ static void brcmf_fweh_handle_if_event(s
  25224. - bool is_p2pdev;
  25225. - int err = 0;
  25226. -
  25227. -- brcmf_dbg(EVENT, "action: %u idx: %u bsscfg: %u flags: %u role: %u\n",
  25228. -- ifevent->action, ifevent->ifidx, ifevent->bssidx,
  25229. -+ brcmf_dbg(EVENT, "action: %u ifidx: %u bsscfgidx: %u flags: %u role: %u\n",
  25230. -+ ifevent->action, ifevent->ifidx, ifevent->bsscfgidx,
  25231. - ifevent->flags, ifevent->role);
  25232. -
  25233. - /* The P2P Device interface event must not be ignored contrary to what
  25234. -@@ -204,12 +204,12 @@ static void brcmf_fweh_handle_if_event(s
  25235. - return;
  25236. - }
  25237. -
  25238. -- ifp = drvr->iflist[ifevent->bssidx];
  25239. -+ ifp = drvr->iflist[ifevent->bsscfgidx];
  25240. -
  25241. - if (ifevent->action == BRCMF_E_IF_ADD) {
  25242. - brcmf_dbg(EVENT, "adding %s (%pM)\n", emsg->ifname,
  25243. - emsg->addr);
  25244. -- ifp = brcmf_add_if(drvr, ifevent->bssidx, ifevent->ifidx,
  25245. -+ ifp = brcmf_add_if(drvr, ifevent->bsscfgidx, ifevent->ifidx,
  25246. - is_p2pdev, emsg->ifname, emsg->addr);
  25247. - if (IS_ERR(ifp))
  25248. - return;
  25249. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  25250. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h
  25251. -@@ -219,7 +219,7 @@ struct brcmf_if_event {
  25252. - u8 ifidx;
  25253. - u8 action;
  25254. - u8 flags;
  25255. -- u8 bssidx;
  25256. -+ u8 bsscfgidx;
  25257. - u8 role;
  25258. - };
  25259. -
  25260. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwil.c
  25261. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil.c
  25262. -@@ -293,22 +293,22 @@ brcmf_fil_iovar_int_get(struct brcmf_if
  25263. - }
  25264. -
  25265. - static u32
  25266. --brcmf_create_bsscfg(s32 bssidx, char *name, char *data, u32 datalen, char *buf,
  25267. -- u32 buflen)
  25268. -+brcmf_create_bsscfg(s32 bsscfgidx, char *name, char *data, u32 datalen,
  25269. -+ char *buf, u32 buflen)
  25270. - {
  25271. - const s8 *prefix = "bsscfg:";
  25272. - s8 *p;
  25273. - u32 prefixlen;
  25274. - u32 namelen;
  25275. - u32 iolen;
  25276. -- __le32 bssidx_le;
  25277. -+ __le32 bsscfgidx_le;
  25278. -
  25279. -- if (bssidx == 0)
  25280. -+ if (bsscfgidx == 0)
  25281. - return brcmf_create_iovar(name, data, datalen, buf, buflen);
  25282. -
  25283. - prefixlen = strlen(prefix);
  25284. - namelen = strlen(name) + 1; /* lengh of iovar name + null */
  25285. -- iolen = prefixlen + namelen + sizeof(bssidx_le) + datalen;
  25286. -+ iolen = prefixlen + namelen + sizeof(bsscfgidx_le) + datalen;
  25287. -
  25288. - if (buflen < iolen) {
  25289. - brcmf_err("buffer is too short\n");
  25290. -@@ -326,9 +326,9 @@ brcmf_create_bsscfg(s32 bssidx, char *na
  25291. - p += namelen;
  25292. -
  25293. - /* bss config index as first data */
  25294. -- bssidx_le = cpu_to_le32(bssidx);
  25295. -- memcpy(p, &bssidx_le, sizeof(bssidx_le));
  25296. -- p += sizeof(bssidx_le);
  25297. -+ bsscfgidx_le = cpu_to_le32(bsscfgidx);
  25298. -+ memcpy(p, &bsscfgidx_le, sizeof(bsscfgidx_le));
  25299. -+ p += sizeof(bsscfgidx_le);
  25300. -
  25301. - /* parameter buffer follows */
  25302. - if (datalen)
  25303. -@@ -347,12 +347,12 @@ brcmf_fil_bsscfg_data_set(struct brcmf_i
  25304. -
  25305. - mutex_lock(&drvr->proto_block);
  25306. -
  25307. -- brcmf_dbg(FIL, "ifidx=%d, bssidx=%d, name=%s, len=%d\n", ifp->ifidx,
  25308. -- ifp->bssidx, name, len);
  25309. -+ brcmf_dbg(FIL, "ifidx=%d, bsscfgidx=%d, name=%s, len=%d\n", ifp->ifidx,
  25310. -+ ifp->bsscfgidx, name, len);
  25311. - brcmf_dbg_hex_dump(BRCMF_FIL_ON(), data,
  25312. - min_t(uint, len, MAX_HEX_DUMP_LEN), "data\n");
  25313. -
  25314. -- buflen = brcmf_create_bsscfg(ifp->bssidx, name, data, len,
  25315. -+ buflen = brcmf_create_bsscfg(ifp->bsscfgidx, name, data, len,
  25316. - drvr->proto_buf, sizeof(drvr->proto_buf));
  25317. - if (buflen) {
  25318. - err = brcmf_fil_cmd_data(ifp, BRCMF_C_SET_VAR, drvr->proto_buf,
  25319. -@@ -376,7 +376,7 @@ brcmf_fil_bsscfg_data_get(struct brcmf_i
  25320. -
  25321. - mutex_lock(&drvr->proto_block);
  25322. -
  25323. -- buflen = brcmf_create_bsscfg(ifp->bssidx, name, data, len,
  25324. -+ buflen = brcmf_create_bsscfg(ifp->bsscfgidx, name, data, len,
  25325. - drvr->proto_buf, sizeof(drvr->proto_buf));
  25326. - if (buflen) {
  25327. - err = brcmf_fil_cmd_data(ifp, BRCMF_C_GET_VAR, drvr->proto_buf,
  25328. -@@ -387,8 +387,8 @@ brcmf_fil_bsscfg_data_get(struct brcmf_i
  25329. - err = -EPERM;
  25330. - brcmf_err("Creating bsscfg failed\n");
  25331. - }
  25332. -- brcmf_dbg(FIL, "ifidx=%d, bssidx=%d, name=%s, len=%d\n", ifp->ifidx,
  25333. -- ifp->bssidx, name, len);
  25334. -+ brcmf_dbg(FIL, "ifidx=%d, bsscfgidx=%d, name=%s, len=%d\n", ifp->ifidx,
  25335. -+ ifp->bsscfgidx, name, len);
  25336. - brcmf_dbg_hex_dump(BRCMF_FIL_ON(), data,
  25337. - min_t(uint, len, MAX_HEX_DUMP_LEN), "data\n");
  25338. -
  25339. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  25340. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  25341. -@@ -170,7 +170,7 @@ struct brcmf_fil_af_params_le {
  25342. - };
  25343. -
  25344. - struct brcmf_fil_bss_enable_le {
  25345. -- __le32 bsscfg_idx;
  25346. -+ __le32 bsscfgidx;
  25347. - __le32 enable;
  25348. - };
  25349. -
  25350. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  25351. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  25352. -@@ -719,7 +719,7 @@ static void brcmf_fws_macdesc_init(struc
  25353. - desc->state = BRCMF_FWS_STATE_OPEN;
  25354. - desc->requested_credit = 0;
  25355. - desc->requested_packet = 0;
  25356. -- /* depending on use may need ifp->bssidx instead */
  25357. -+ /* depending on use may need ifp->bsscfgidx instead */
  25358. - desc->interface_id = ifidx;
  25359. - desc->ac_bitmap = 0xff; /* update this when handling APSD */
  25360. - if (addr)
  25361. -@@ -1938,7 +1938,7 @@ void brcmf_fws_reset_interface(struct br
  25362. - {
  25363. - struct brcmf_fws_mac_descriptor *entry = ifp->fws_desc;
  25364. -
  25365. -- brcmf_dbg(TRACE, "enter: idx=%d\n", ifp->bssidx);
  25366. -+ brcmf_dbg(TRACE, "enter: bsscfgidx=%d\n", ifp->bsscfgidx);
  25367. - if (!entry)
  25368. - return;
  25369. -
  25370. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  25371. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  25372. -@@ -2067,7 +2067,7 @@ static struct wireless_dev *brcmf_p2p_cr
  25373. - struct brcmf_if *p2p_ifp;
  25374. - struct brcmf_if *pri_ifp;
  25375. - int err;
  25376. -- u32 bssidx;
  25377. -+ u32 bsscfgidx;
  25378. -
  25379. - if (p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif)
  25380. - return ERR_PTR(-ENOSPC);
  25381. -@@ -2113,13 +2113,13 @@ static struct wireless_dev *brcmf_p2p_cr
  25382. - memcpy(&p2p_vif->wdev.address, p2p->dev_addr, sizeof(p2p->dev_addr));
  25383. -
  25384. - /* verify bsscfg index for P2P discovery */
  25385. -- err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bssidx);
  25386. -+ err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bsscfgidx);
  25387. - if (err < 0) {
  25388. - brcmf_err("retrieving discover bsscfg index failed\n");
  25389. - goto fail;
  25390. - }
  25391. -
  25392. -- WARN_ON(p2p_ifp->bssidx != bssidx);
  25393. -+ WARN_ON(p2p_ifp->bsscfgidx != bsscfgidx);
  25394. -
  25395. - init_completion(&p2p->send_af_done);
  25396. - INIT_WORK(&p2p->afx_hdl.afx_work, brcmf_p2p_afx_handler);
  25397. 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
  25398. deleted file mode 100644
  25399. index fb2b85e..0000000
  25400. --- a/package/kernel/mac80211/patches/374-0008-brcmfmac-Use-new-methods-for-pcie-Power-Management.patch
  25401. +++ /dev/null
  25402. @@ -1,163 +0,0 @@
  25403. -From: Hante Meuleman <meuleman@broadcom.com>
  25404. -Date: Thu, 29 Oct 2015 20:33:18 +0100
  25405. -Subject: [PATCH] brcmfmac: Use new methods for pcie Power Management.
  25406. -
  25407. -Currently the legacy methods suspend and resume are used for pcie
  25408. -devices. This is not the preferable method and is also causing
  25409. -issues with some setups when doing hibernate. Changing this to
  25410. -use the new PM methods.
  25411. -
  25412. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  25413. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  25414. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  25415. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  25416. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  25417. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  25418. ----
  25419. -
  25420. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  25421. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  25422. -@@ -1388,10 +1388,6 @@ static void brcmf_pcie_wowl_config(struc
  25423. -
  25424. - brcmf_dbg(PCIE, "Configuring WOWL, enabled=%d\n", enabled);
  25425. - devinfo->wowl_enabled = enabled;
  25426. -- if (enabled)
  25427. -- device_set_wakeup_enable(&devinfo->pdev->dev, true);
  25428. -- else
  25429. -- device_set_wakeup_enable(&devinfo->pdev->dev, false);
  25430. - }
  25431. -
  25432. -
  25433. -@@ -1961,15 +1957,14 @@ brcmf_pcie_remove(struct pci_dev *pdev)
  25434. - #ifdef CONFIG_PM
  25435. -
  25436. -
  25437. --static int brcmf_pcie_suspend(struct pci_dev *pdev, pm_message_t state)
  25438. -+static int brcmf_pcie_pm_enter_D3(struct device *dev)
  25439. - {
  25440. - struct brcmf_pciedev_info *devinfo;
  25441. - struct brcmf_bus *bus;
  25442. -- int err;
  25443. -
  25444. -- brcmf_dbg(PCIE, "Enter, state=%d, pdev=%p\n", state.event, pdev);
  25445. -+ brcmf_err("Enter\n");
  25446. -
  25447. -- bus = dev_get_drvdata(&pdev->dev);
  25448. -+ bus = dev_get_drvdata(dev);
  25449. - devinfo = bus->bus_priv.pcie->devinfo;
  25450. -
  25451. - brcmf_bus_change_state(bus, BRCMF_BUS_DOWN);
  25452. -@@ -1984,62 +1979,45 @@ static int brcmf_pcie_suspend(struct pci
  25453. - brcmf_err("Timeout on response for entering D3 substate\n");
  25454. - return -EIO;
  25455. - }
  25456. -- brcmf_pcie_send_mb_data(devinfo, BRCMF_H2D_HOST_D0_INFORM_IN_USE);
  25457. -
  25458. -- err = pci_save_state(pdev);
  25459. -- if (err)
  25460. -- brcmf_err("pci_save_state failed, err=%d\n", err);
  25461. -- if ((err) || (!devinfo->wowl_enabled)) {
  25462. -- brcmf_chip_detach(devinfo->ci);
  25463. -- devinfo->ci = NULL;
  25464. -- brcmf_pcie_remove(pdev);
  25465. -- return 0;
  25466. -- }
  25467. -+ devinfo->state = BRCMFMAC_PCIE_STATE_DOWN;
  25468. -
  25469. -- return pci_prepare_to_sleep(pdev);
  25470. -+ return 0;
  25471. - }
  25472. -
  25473. --static int brcmf_pcie_resume(struct pci_dev *pdev)
  25474. -+
  25475. -+static int brcmf_pcie_pm_leave_D3(struct device *dev)
  25476. - {
  25477. - struct brcmf_pciedev_info *devinfo;
  25478. - struct brcmf_bus *bus;
  25479. -+ struct pci_dev *pdev;
  25480. - int err;
  25481. -
  25482. -- bus = dev_get_drvdata(&pdev->dev);
  25483. -- brcmf_dbg(PCIE, "Enter, pdev=%p, bus=%p\n", pdev, bus);
  25484. -+ brcmf_err("Enter\n");
  25485. -
  25486. -- err = pci_set_power_state(pdev, PCI_D0);
  25487. -- if (err) {
  25488. -- brcmf_err("pci_set_power_state failed, err=%d\n", err);
  25489. -- goto cleanup;
  25490. -- }
  25491. -- pci_restore_state(pdev);
  25492. -- pci_enable_wake(pdev, PCI_D3hot, false);
  25493. -- pci_enable_wake(pdev, PCI_D3cold, false);
  25494. -+ bus = dev_get_drvdata(dev);
  25495. -+ devinfo = bus->bus_priv.pcie->devinfo;
  25496. -+ brcmf_dbg(PCIE, "Enter, dev=%p, bus=%p\n", dev, bus);
  25497. -
  25498. - /* Check if device is still up and running, if so we are ready */
  25499. -- if (bus) {
  25500. -- devinfo = bus->bus_priv.pcie->devinfo;
  25501. -- if (brcmf_pcie_read_reg32(devinfo,
  25502. -- BRCMF_PCIE_PCIE2REG_INTMASK) != 0) {
  25503. -- if (brcmf_pcie_send_mb_data(devinfo,
  25504. -- BRCMF_H2D_HOST_D0_INFORM))
  25505. -- goto cleanup;
  25506. -- brcmf_dbg(PCIE, "Hot resume, continue....\n");
  25507. -- brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  25508. -- brcmf_bus_change_state(bus, BRCMF_BUS_UP);
  25509. -- brcmf_pcie_intr_enable(devinfo);
  25510. -- return 0;
  25511. -- }
  25512. -+ if (brcmf_pcie_read_reg32(devinfo, BRCMF_PCIE_PCIE2REG_INTMASK) != 0) {
  25513. -+ brcmf_dbg(PCIE, "Try to wakeup device....\n");
  25514. -+ if (brcmf_pcie_send_mb_data(devinfo, BRCMF_H2D_HOST_D0_INFORM))
  25515. -+ goto cleanup;
  25516. -+ brcmf_dbg(PCIE, "Hot resume, continue....\n");
  25517. -+ devinfo->state = BRCMFMAC_PCIE_STATE_UP;
  25518. -+ brcmf_pcie_select_core(devinfo, BCMA_CORE_PCIE2);
  25519. -+ brcmf_bus_change_state(bus, BRCMF_BUS_UP);
  25520. -+ brcmf_pcie_intr_enable(devinfo);
  25521. -+ return 0;
  25522. - }
  25523. -
  25524. - cleanup:
  25525. -- if (bus) {
  25526. -- devinfo = bus->bus_priv.pcie->devinfo;
  25527. -- brcmf_chip_detach(devinfo->ci);
  25528. -- devinfo->ci = NULL;
  25529. -- brcmf_pcie_remove(pdev);
  25530. -- }
  25531. -+ brcmf_chip_detach(devinfo->ci);
  25532. -+ devinfo->ci = NULL;
  25533. -+ pdev = devinfo->pdev;
  25534. -+ brcmf_pcie_remove(pdev);
  25535. -+
  25536. - err = brcmf_pcie_probe(pdev, NULL);
  25537. - if (err)
  25538. - brcmf_err("probe after resume failed, err=%d\n", err);
  25539. -@@ -2048,6 +2026,14 @@ cleanup:
  25540. - }
  25541. -
  25542. -
  25543. -+static const struct dev_pm_ops brcmf_pciedrvr_pm = {
  25544. -+ .suspend = brcmf_pcie_pm_enter_D3,
  25545. -+ .resume = brcmf_pcie_pm_leave_D3,
  25546. -+ .freeze = brcmf_pcie_pm_enter_D3,
  25547. -+ .restore = brcmf_pcie_pm_leave_D3,
  25548. -+};
  25549. -+
  25550. -+
  25551. - #endif /* CONFIG_PM */
  25552. -
  25553. -
  25554. -@@ -2086,9 +2072,8 @@ static struct pci_driver brcmf_pciedrvr
  25555. - .probe = brcmf_pcie_probe,
  25556. - .remove = brcmf_pcie_remove,
  25557. - #ifdef CONFIG_PM
  25558. -- .suspend = brcmf_pcie_suspend,
  25559. -- .resume = brcmf_pcie_resume
  25560. --#endif /* CONFIG_PM */
  25561. -+ .driver.pm = &brcmf_pciedrvr_pm,
  25562. -+#endif
  25563. - };
  25564. -
  25565. -
  25566. 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
  25567. deleted file mode 100644
  25568. index 4324cc7..0000000
  25569. --- a/package/kernel/mac80211/patches/374-0009-brcmfmac-Add-wowl-wake-indication-report.patch
  25570. +++ /dev/null
  25571. @@ -1,129 +0,0 @@
  25572. -From: Hante Meuleman <meuleman@broadcom.com>
  25573. -Date: Thu, 29 Oct 2015 20:33:19 +0100
  25574. -Subject: [PATCH] brcmfmac: Add wowl wake indication report.
  25575. -
  25576. -On wakeup of the system (resume) a wowl wakeup indication report
  25577. -can be sent to cfg80211. This patch adds support for this. The
  25578. -report specifies if the device was responsible for the wakeup
  25579. -and if so, will specify the exact reason.
  25580. -
  25581. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  25582. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  25583. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  25584. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  25585. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  25586. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  25587. ----
  25588. -
  25589. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  25590. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  25591. -@@ -3061,6 +3061,67 @@ static s32 brcmf_config_wowl_pattern(str
  25592. - return ret;
  25593. - }
  25594. -
  25595. -+#ifdef CPTCFG_PM
  25596. -+
  25597. -+static void brcmf_report_wowl_wakeind(struct wiphy *wiphy, struct brcmf_if *ifp)
  25598. -+{
  25599. -+ struct brcmf_wowl_wakeind_le wake_ind_le;
  25600. -+ struct cfg80211_wowlan_wakeup wakeup_data;
  25601. -+ struct cfg80211_wowlan_wakeup *wakeup;
  25602. -+ u32 wakeind;
  25603. -+ s32 err;
  25604. -+
  25605. -+ err = brcmf_fil_iovar_data_get(ifp, "wowl_wakeind", &wake_ind_le,
  25606. -+ sizeof(wake_ind_le));
  25607. -+ if (!err) {
  25608. -+ brcmf_err("Get wowl_wakeind failed, err = %d\n", err);
  25609. -+ return;
  25610. -+ }
  25611. -+
  25612. -+ wakeind = le32_to_cpu(wake_ind_le.ucode_wakeind);
  25613. -+ if (wakeind & (BRCMF_WOWL_MAGIC | BRCMF_WOWL_DIS | BRCMF_WOWL_BCN |
  25614. -+ BRCMF_WOWL_RETR | BRCMF_WOWL_NET)) {
  25615. -+ wakeup = &wakeup_data;
  25616. -+ memset(&wakeup_data, 0, sizeof(wakeup_data));
  25617. -+ wakeup_data.pattern_idx = -1;
  25618. -+
  25619. -+ if (wakeind & BRCMF_WOWL_MAGIC) {
  25620. -+ brcmf_dbg(INFO, "WOWL Wake indicator: BRCMF_WOWL_MAGIC\n");
  25621. -+ wakeup_data.magic_pkt = true;
  25622. -+ }
  25623. -+ if (wakeind & BRCMF_WOWL_DIS) {
  25624. -+ brcmf_dbg(INFO, "WOWL Wake indicator: BRCMF_WOWL_DIS\n");
  25625. -+ wakeup_data.disconnect = true;
  25626. -+ }
  25627. -+ if (wakeind & BRCMF_WOWL_BCN) {
  25628. -+ brcmf_dbg(INFO, "WOWL Wake indicator: BRCMF_WOWL_BCN\n");
  25629. -+ wakeup_data.disconnect = true;
  25630. -+ }
  25631. -+ if (wakeind & BRCMF_WOWL_RETR) {
  25632. -+ brcmf_dbg(INFO, "WOWL Wake indicator: BRCMF_WOWL_RETR\n");
  25633. -+ wakeup_data.disconnect = true;
  25634. -+ }
  25635. -+ if (wakeind & BRCMF_WOWL_NET) {
  25636. -+ brcmf_dbg(INFO, "WOWL Wake indicator: BRCMF_WOWL_NET\n");
  25637. -+ /* For now always map to pattern 0, no API to get
  25638. -+ * correct information available at the moment.
  25639. -+ */
  25640. -+ wakeup_data.pattern_idx = 0;
  25641. -+ }
  25642. -+ } else {
  25643. -+ wakeup = NULL;
  25644. -+ }
  25645. -+ cfg80211_report_wowlan_wakeup(&ifp->vif->wdev, wakeup, GFP_KERNEL);
  25646. -+}
  25647. -+
  25648. -+#else
  25649. -+
  25650. -+static void brcmf_report_wowl_wakeind(struct wiphy *wiphy, struct brcmf_if *ifp)
  25651. -+{
  25652. -+}
  25653. -+
  25654. -+#endif /* CPTCFG_PM */
  25655. -+
  25656. - static s32 brcmf_cfg80211_resume(struct wiphy *wiphy)
  25657. - {
  25658. - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  25659. -@@ -3070,11 +3131,12 @@ static s32 brcmf_cfg80211_resume(struct
  25660. - brcmf_dbg(TRACE, "Enter\n");
  25661. -
  25662. - if (cfg->wowl_enabled) {
  25663. -+ brcmf_report_wowl_wakeind(wiphy, ifp);
  25664. -+ brcmf_fil_iovar_int_set(ifp, "wowl_clear", 0);
  25665. -+ brcmf_config_wowl_pattern(ifp, "clr", NULL, 0, NULL, 0);
  25666. - brcmf_configure_arp_offload(ifp, true);
  25667. - brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PM,
  25668. - cfg->pre_wowl_pmmode);
  25669. -- brcmf_fil_iovar_int_set(ifp, "wowl_clear", 0);
  25670. -- brcmf_config_wowl_pattern(ifp, "clr", NULL, 0, NULL, 0);
  25671. - cfg->wowl_enabled = false;
  25672. - }
  25673. - return 0;
  25674. -@@ -3108,6 +3170,7 @@ static void brcmf_configure_wowl(struct
  25675. - wowl->patterns[i].pkt_offset);
  25676. - }
  25677. - }
  25678. -+ brcmf_fil_iovar_data_set(ifp, "wowl_wakeind", "clear", strlen("clear"));
  25679. - brcmf_fil_iovar_int_set(ifp, "wowl", wowl_config);
  25680. - brcmf_fil_iovar_int_set(ifp, "wowl_activate", 1);
  25681. - brcmf_bus_wowl_config(cfg->pub->bus_if, true);
  25682. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  25683. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  25684. -@@ -634,4 +634,16 @@ struct brcmf_assoclist_le {
  25685. - u8 mac[BRCMF_MAX_ASSOCLIST][ETH_ALEN];
  25686. - };
  25687. -
  25688. -+/**
  25689. -+ * struct brcmf_wowl_wakeind_le - Wakeup indicators
  25690. -+ * Note: note both fields contain same information.
  25691. -+ *
  25692. -+ * @pci_wakeind: Whether PCI PMECSR PMEStatus bit was set.
  25693. -+ * @ucode_wakeind: What wakeup-event indication was set by ucode
  25694. -+ */
  25695. -+struct brcmf_wowl_wakeind_le {
  25696. -+ __le32 pci_wakeind;
  25697. -+ __le32 ucode_wakeind;
  25698. -+};
  25699. -+
  25700. - #endif /* FWIL_TYPES_H_ */
  25701. 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
  25702. deleted file mode 100644
  25703. index a0cc231..0000000
  25704. --- a/package/kernel/mac80211/patches/375-brcmfmac-constify-brcmf_bus_ops-structures.patch
  25705. +++ /dev/null
  25706. @@ -1,57 +0,0 @@
  25707. -From: Julia Lawall <Julia.Lawall@lip6.fr>
  25708. -Date: Sat, 14 Nov 2015 17:22:07 +0100
  25709. -Subject: [PATCH] brcmfmac: constify brcmf_bus_ops structures
  25710. -
  25711. -The brcmf_bus_ops structures are never modified, so declare them as const.
  25712. -
  25713. -Done with the help of Coccinelle.
  25714. -
  25715. -Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
  25716. -Acked-by: Arend van Spriel <arend@broadcom.com>
  25717. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  25718. ----
  25719. -
  25720. ---- a/drivers/net/wireless/brcm80211/brcmfmac/bus.h
  25721. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/bus.h
  25722. -@@ -137,7 +137,7 @@ struct brcmf_bus {
  25723. - bool always_use_fws_queue;
  25724. - bool wowl_supported;
  25725. -
  25726. -- struct brcmf_bus_ops *ops;
  25727. -+ const struct brcmf_bus_ops *ops;
  25728. - struct brcmf_bus_msgbuf *msgbuf;
  25729. - };
  25730. -
  25731. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  25732. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  25733. -@@ -1413,7 +1413,7 @@ static int brcmf_pcie_get_memdump(struct
  25734. - }
  25735. -
  25736. -
  25737. --static struct brcmf_bus_ops brcmf_pcie_bus_ops = {
  25738. -+static const struct brcmf_bus_ops brcmf_pcie_bus_ops = {
  25739. - .txdata = brcmf_pcie_tx,
  25740. - .stop = brcmf_pcie_down,
  25741. - .txctl = brcmf_pcie_tx_ctlpkt,
  25742. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  25743. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  25744. -@@ -4025,7 +4025,7 @@ brcmf_sdio_watchdog(unsigned long data)
  25745. - }
  25746. - }
  25747. -
  25748. --static struct brcmf_bus_ops brcmf_sdio_bus_ops = {
  25749. -+static const struct brcmf_bus_ops brcmf_sdio_bus_ops = {
  25750. - .stop = brcmf_sdio_bus_stop,
  25751. - .preinit = brcmf_sdio_bus_preinit,
  25752. - .txdata = brcmf_sdio_bus_txdata,
  25753. ---- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  25754. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  25755. -@@ -1163,7 +1163,7 @@ static void brcmf_usb_wowl_config(struct
  25756. - device_set_wakeup_enable(devinfo->dev, false);
  25757. - }
  25758. -
  25759. --static struct brcmf_bus_ops brcmf_usb_bus_ops = {
  25760. -+static const struct brcmf_bus_ops brcmf_usb_bus_ops = {
  25761. - .txdata = brcmf_usb_tx,
  25762. - .stop = brcmf_usb_down,
  25763. - .txctl = brcmf_usb_tx_ctlpkt,
  25764. 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
  25765. deleted file mode 100644
  25766. index 83f1ebe..0000000
  25767. --- a/package/kernel/mac80211/patches/376-0001-brcmfmac-Cleanup-ssid-storage.patch
  25768. +++ /dev/null
  25769. @@ -1,251 +0,0 @@
  25770. -From: Hante Meuleman <meuleman@broadcom.com>
  25771. -Date: Wed, 25 Nov 2015 11:32:37 +0100
  25772. -Subject: [PATCH] brcmfmac: Cleanup ssid storage.
  25773. -
  25774. -SSIDs used for connect and p2p got stored, but never used.
  25775. -
  25776. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  25777. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  25778. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  25779. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  25780. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  25781. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  25782. ----
  25783. -
  25784. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  25785. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  25786. -@@ -959,7 +959,7 @@ brcmf_run_escan(struct brcmf_cfg80211_in
  25787. - params_size += sizeof(u32) * ((request->n_channels + 1) / 2);
  25788. -
  25789. - /* Allocate space for populating ssids in struct */
  25790. -- params_size += sizeof(struct brcmf_ssid) * request->n_ssids;
  25791. -+ params_size += sizeof(struct brcmf_ssid_le) * request->n_ssids;
  25792. - }
  25793. -
  25794. - params = kzalloc(params_size, GFP_KERNEL);
  25795. -@@ -1291,6 +1291,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
  25796. - s32 wsec = 0;
  25797. - s32 bcnprd;
  25798. - u16 chanspec;
  25799. -+ u32 ssid_len;
  25800. -
  25801. - brcmf_dbg(TRACE, "Enter\n");
  25802. - if (!check_vif_up(ifp->vif))
  25803. -@@ -1368,17 +1369,15 @@ brcmf_cfg80211_join_ibss(struct wiphy *w
  25804. - memset(&join_params, 0, sizeof(struct brcmf_join_params));
  25805. -
  25806. - /* SSID */
  25807. -- profile->ssid.SSID_len = min_t(u32, params->ssid_len, 32);
  25808. -- memcpy(profile->ssid.SSID, params->ssid, profile->ssid.SSID_len);
  25809. -- memcpy(join_params.ssid_le.SSID, params->ssid, profile->ssid.SSID_len);
  25810. -- join_params.ssid_le.SSID_len = cpu_to_le32(profile->ssid.SSID_len);
  25811. -+ ssid_len = min_t(u32, params->ssid_len, IEEE80211_MAX_SSID_LEN);
  25812. -+ memcpy(join_params.ssid_le.SSID, params->ssid, ssid_len);
  25813. -+ join_params.ssid_le.SSID_len = cpu_to_le32(ssid_len);
  25814. - join_params_size = sizeof(join_params.ssid_le);
  25815. -
  25816. - /* BSSID */
  25817. - if (params->bssid) {
  25818. - memcpy(join_params.params_le.bssid, params->bssid, ETH_ALEN);
  25819. -- join_params_size = sizeof(join_params.ssid_le) +
  25820. -- BRCMF_ASSOC_PARAMS_FIXED_SIZE;
  25821. -+ join_params_size += BRCMF_ASSOC_PARAMS_FIXED_SIZE;
  25822. - memcpy(profile->bssid, params->bssid, ETH_ALEN);
  25823. - } else {
  25824. - eth_broadcast_addr(join_params.params_le.bssid);
  25825. -@@ -1728,7 +1727,6 @@ brcmf_cfg80211_connect(struct wiphy *wip
  25826. - {
  25827. - struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
  25828. - struct brcmf_if *ifp = netdev_priv(ndev);
  25829. -- struct brcmf_cfg80211_profile *profile = &ifp->vif->profile;
  25830. - struct ieee80211_channel *chan = sme->channel;
  25831. - struct brcmf_join_params join_params;
  25832. - size_t join_params_size;
  25833. -@@ -1739,6 +1737,7 @@ brcmf_cfg80211_connect(struct wiphy *wip
  25834. - struct brcmf_ext_join_params_le *ext_join_params;
  25835. - u16 chanspec;
  25836. - s32 err = 0;
  25837. -+ u32 ssid_len;
  25838. -
  25839. - brcmf_dbg(TRACE, "Enter\n");
  25840. - if (!check_vif_up(ifp->vif))
  25841. -@@ -1824,15 +1823,6 @@ brcmf_cfg80211_connect(struct wiphy *wip
  25842. - goto done;
  25843. - }
  25844. -
  25845. -- profile->ssid.SSID_len = min_t(u32, (u32)sizeof(profile->ssid.SSID),
  25846. -- (u32)sme->ssid_len);
  25847. -- memcpy(&profile->ssid.SSID, sme->ssid, profile->ssid.SSID_len);
  25848. -- if (profile->ssid.SSID_len < IEEE80211_MAX_SSID_LEN) {
  25849. -- profile->ssid.SSID[profile->ssid.SSID_len] = 0;
  25850. -- brcmf_dbg(CONN, "SSID \"%s\", len (%d)\n", profile->ssid.SSID,
  25851. -- profile->ssid.SSID_len);
  25852. -- }
  25853. --
  25854. - /* Join with specific BSSID and cached SSID
  25855. - * If SSID is zero join based on BSSID only
  25856. - */
  25857. -@@ -1845,9 +1835,12 @@ brcmf_cfg80211_connect(struct wiphy *wip
  25858. - err = -ENOMEM;
  25859. - goto done;
  25860. - }
  25861. -- ext_join_params->ssid_le.SSID_len = cpu_to_le32(profile->ssid.SSID_len);
  25862. -- memcpy(&ext_join_params->ssid_le.SSID, sme->ssid,
  25863. -- profile->ssid.SSID_len);
  25864. -+ ssid_len = min_t(u32, sme->ssid_len, IEEE80211_MAX_SSID_LEN);
  25865. -+ ext_join_params->ssid_le.SSID_len = cpu_to_le32(ssid_len);
  25866. -+ memcpy(&ext_join_params->ssid_le.SSID, sme->ssid, ssid_len);
  25867. -+ if (ssid_len < IEEE80211_MAX_SSID_LEN)
  25868. -+ brcmf_dbg(CONN, "SSID \"%s\", len (%d)\n",
  25869. -+ ext_join_params->ssid_le.SSID, ssid_len);
  25870. -
  25871. - /* Set up join scan parameters */
  25872. - ext_join_params->scan_le.scan_type = -1;
  25873. -@@ -1895,8 +1888,8 @@ brcmf_cfg80211_connect(struct wiphy *wip
  25874. - memset(&join_params, 0, sizeof(join_params));
  25875. - join_params_size = sizeof(join_params.ssid_le);
  25876. -
  25877. -- memcpy(&join_params.ssid_le.SSID, sme->ssid, profile->ssid.SSID_len);
  25878. -- join_params.ssid_le.SSID_len = cpu_to_le32(profile->ssid.SSID_len);
  25879. -+ memcpy(&join_params.ssid_le.SSID, sme->ssid, ssid_len);
  25880. -+ join_params.ssid_le.SSID_len = cpu_to_le32(ssid_len);
  25881. -
  25882. - if (sme->bssid)
  25883. - memcpy(join_params.params_le.bssid, sme->bssid, ETH_ALEN);
  25884. -@@ -2775,9 +2768,7 @@ CleanUp:
  25885. - static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg,
  25886. - struct brcmf_if *ifp)
  25887. - {
  25888. -- struct brcmf_cfg80211_profile *profile = ndev_to_prof(ifp->ndev);
  25889. - struct brcmf_bss_info_le *bi;
  25890. -- struct brcmf_ssid *ssid;
  25891. - const struct brcmf_tlv *tim;
  25892. - u16 beacon_interval;
  25893. - u8 dtim_period;
  25894. -@@ -2789,8 +2780,6 @@ static s32 brcmf_update_bss_info(struct
  25895. - if (brcmf_is_ibssmode(ifp->vif))
  25896. - return err;
  25897. -
  25898. -- ssid = &profile->ssid;
  25899. --
  25900. - *(__le32 *)cfg->extra_buf = cpu_to_le32(WL_EXTRA_BUF_MAX);
  25901. - err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO,
  25902. - cfg->extra_buf, WL_EXTRA_BUF_MAX);
  25903. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  25904. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  25905. -@@ -124,13 +124,11 @@ struct brcmf_cfg80211_security {
  25906. - /**
  25907. - * struct brcmf_cfg80211_profile - profile information.
  25908. - *
  25909. -- * @ssid: ssid of associated/associating ap.
  25910. - * @bssid: bssid of joined/joining ibss.
  25911. - * @sec: security information.
  25912. - * @key: key information
  25913. - */
  25914. - struct brcmf_cfg80211_profile {
  25915. -- struct brcmf_ssid ssid;
  25916. - u8 bssid[ETH_ALEN];
  25917. - struct brcmf_cfg80211_security sec;
  25918. - struct brcmf_wsec_key key[BRCMF_MAX_DEFAULT_KEYS];
  25919. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  25920. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  25921. -@@ -282,14 +282,9 @@ struct brcm_rateset_le {
  25922. - u8 rates[BRCMF_MAXRATES_IN_SET];
  25923. - };
  25924. -
  25925. --struct brcmf_ssid {
  25926. -- u32 SSID_len;
  25927. -- unsigned char SSID[32];
  25928. --};
  25929. --
  25930. - struct brcmf_ssid_le {
  25931. - __le32 SSID_len;
  25932. -- unsigned char SSID[32];
  25933. -+ unsigned char SSID[IEEE80211_MAX_SSID_LEN];
  25934. - };
  25935. -
  25936. - struct brcmf_scan_params_le {
  25937. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  25938. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  25939. -@@ -642,7 +642,6 @@ static s32 brcmf_p2p_escan(struct brcmf_
  25940. - struct brcmf_cfg80211_vif *vif;
  25941. - struct brcmf_p2p_scan_le *p2p_params;
  25942. - struct brcmf_scan_params_le *sparams;
  25943. -- struct brcmf_ssid ssid;
  25944. -
  25945. - memsize += num_chans * sizeof(__le16);
  25946. - memblk = kzalloc(memsize, GFP_KERNEL);
  25947. -@@ -655,16 +654,16 @@ static s32 brcmf_p2p_escan(struct brcmf_
  25948. - ret = -EINVAL;
  25949. - goto exit;
  25950. - }
  25951. -+ p2p_params = (struct brcmf_p2p_scan_le *)memblk;
  25952. -+ sparams = &p2p_params->eparams.params_le;
  25953. -
  25954. - switch (search_state) {
  25955. - case WL_P2P_DISC_ST_SEARCH:
  25956. - /*
  25957. - * If we in SEARCH STATE, we don't need to set SSID explictly
  25958. -- * because dongle use P2P WILDCARD internally by default
  25959. -+ * because dongle use P2P WILDCARD internally by default, use
  25960. -+ * null ssid, which it is already due to kzalloc.
  25961. - */
  25962. -- /* use null ssid */
  25963. -- ssid.SSID_len = 0;
  25964. -- memset(ssid.SSID, 0, sizeof(ssid.SSID));
  25965. - break;
  25966. - case WL_P2P_DISC_ST_SCAN:
  25967. - /*
  25968. -@@ -673,8 +672,10 @@ static s32 brcmf_p2p_escan(struct brcmf_
  25969. - * P2P WILDCARD because we just do broadcast scan unless
  25970. - * setting SSID.
  25971. - */
  25972. -- ssid.SSID_len = BRCMF_P2P_WILDCARD_SSID_LEN;
  25973. -- memcpy(ssid.SSID, BRCMF_P2P_WILDCARD_SSID, ssid.SSID_len);
  25974. -+ sparams->ssid_le.SSID_len =
  25975. -+ cpu_to_le32(BRCMF_P2P_WILDCARD_SSID_LEN);
  25976. -+ memcpy(sparams->ssid_le.SSID, BRCMF_P2P_WILDCARD_SSID,
  25977. -+ BRCMF_P2P_WILDCARD_SSID_LEN);
  25978. - break;
  25979. - default:
  25980. - brcmf_err(" invalid search state %d\n", search_state);
  25981. -@@ -687,11 +688,9 @@ static s32 brcmf_p2p_escan(struct brcmf_
  25982. - /*
  25983. - * set p2p scan parameters.
  25984. - */
  25985. -- p2p_params = (struct brcmf_p2p_scan_le *)memblk;
  25986. - p2p_params->type = 'E';
  25987. -
  25988. - /* determine the scan engine parameters */
  25989. -- sparams = &p2p_params->eparams.params_le;
  25990. - sparams->bss_type = DOT11_BSSTYPE_ANY;
  25991. - if (p2p->cfg->active_scan)
  25992. - sparams->scan_type = 0;
  25993. -@@ -699,9 +698,6 @@ static s32 brcmf_p2p_escan(struct brcmf_
  25994. - sparams->scan_type = 1;
  25995. -
  25996. - eth_broadcast_addr(sparams->bssid);
  25997. -- if (ssid.SSID_len)
  25998. -- memcpy(sparams->ssid_le.SSID, ssid.SSID, ssid.SSID_len);
  25999. -- sparams->ssid_le.SSID_len = cpu_to_le32(ssid.SSID_len);
  26000. - sparams->home_time = cpu_to_le32(P2PAPI_SCAN_HOME_TIME_MS);
  26001. -
  26002. - /*
  26003. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.h
  26004. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.h
  26005. -@@ -112,7 +112,6 @@ struct afx_hdl {
  26006. - * @int_addr: P2P interface address.
  26007. - * @bss_idx: informate for P2P bss types.
  26008. - * @listen_timer: timer for @WL_P2P_DISC_ST_LISTEN discover state.
  26009. -- * @ssid: ssid for P2P GO.
  26010. - * @listen_channel: channel for @WL_P2P_DISC_ST_LISTEN discover state.
  26011. - * @remain_on_channel: contains copy of struct used by cfg80211.
  26012. - * @remain_on_channel_cookie: cookie counter for remain on channel cmd
  26013. -@@ -133,7 +132,6 @@ struct brcmf_p2p_info {
  26014. - u8 int_addr[ETH_ALEN];
  26015. - struct p2p_bss bss_idx[P2PAPI_BSSCFG_MAX];
  26016. - struct timer_list listen_timer;
  26017. -- struct brcmf_ssid ssid;
  26018. - u8 listen_channel;
  26019. - struct ieee80211_channel remain_on_channel;
  26020. - u32 remain_on_channel_cookie;
  26021. 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
  26022. deleted file mode 100644
  26023. index 8672c18..0000000
  26024. --- a/package/kernel/mac80211/patches/376-0002-brcmfmac-Return-actual-error-by-fwil.patch
  26025. +++ /dev/null
  26026. @@ -1,31 +0,0 @@
  26027. -From: Hante Meuleman <meuleman@broadcom.com>
  26028. -Date: Wed, 25 Nov 2015 11:32:38 +0100
  26029. -Subject: [PATCH] brcmfmac: Return actual error by fwil.
  26030. -
  26031. -FWIL is always mapping back errors to EBADE. This is not very
  26032. -conventient when trying to understand problems by reading logs.
  26033. -Some callers print the error code, but that is quite useless
  26034. -when the exact error code is not returned. It also makes it
  26035. -impossible to differentiate based on error code. This patch
  26036. -changes the return of EBADE into the actual error code.
  26037. -
  26038. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  26039. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  26040. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  26041. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  26042. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  26043. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  26044. ----
  26045. -
  26046. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwil.c
  26047. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil.c
  26048. -@@ -126,7 +126,8 @@ brcmf_fil_cmd_data(struct brcmf_if *ifp,
  26049. -
  26050. - brcmf_dbg(FIL, "Failed: %s (%d)\n",
  26051. - brcmf_fil_get_errstr((u32)(-err)), err);
  26052. -- return -EBADE;
  26053. -+
  26054. -+ return err;
  26055. - }
  26056. -
  26057. - s32
  26058. 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
  26059. deleted file mode 100644
  26060. index 1cfab21..0000000
  26061. --- a/package/kernel/mac80211/patches/376-0003-brcmfmac-Change-error-print-on-wlan0-existence.patch
  26062. +++ /dev/null
  26063. @@ -1,41 +0,0 @@
  26064. -From: Hante Meuleman <meuleman@broadcom.com>
  26065. -Date: Wed, 25 Nov 2015 11:32:39 +0100
  26066. -Subject: [PATCH] brcmfmac: Change error print on wlan0 existence.
  26067. -
  26068. -During initialization of the device, but also on some other
  26069. -moments the driver prints an error that the netdev already exists.
  26070. -This is a result of the way the driver is initializing the
  26071. -firmware and not really an error. The code is not treating it as
  26072. -an error either. This error print has resulted in many questions
  26073. -by users and is confusing and incorrect. This patch changes the
  26074. -error log into a debug info log.
  26075. -
  26076. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  26077. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  26078. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  26079. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  26080. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  26081. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  26082. ----
  26083. -
  26084. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  26085. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  26086. -@@ -811,14 +811,15 @@ struct brcmf_if *brcmf_add_if(struct brc
  26087. - * in case we missed the BRCMF_E_IF_DEL event.
  26088. - */
  26089. - if (ifp) {
  26090. -- brcmf_err("ERROR: netdev:%s already exists\n",
  26091. -- ifp->ndev->name);
  26092. - if (ifidx) {
  26093. -+ brcmf_err("ERROR: netdev:%s already exists\n",
  26094. -+ ifp->ndev->name);
  26095. - netif_stop_queue(ifp->ndev);
  26096. - brcmf_net_detach(ifp->ndev);
  26097. - drvr->iflist[bsscfgidx] = NULL;
  26098. - } else {
  26099. -- brcmf_err("ignore IF event\n");
  26100. -+ brcmf_dbg(INFO, "netdev:%s ignore IF event\n",
  26101. -+ ifp->ndev->name);
  26102. - return ERR_PTR(-EINVAL);
  26103. - }
  26104. - }
  26105. 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
  26106. deleted file mode 100644
  26107. index dfc3a98..0000000
  26108. --- a/package/kernel/mac80211/patches/376-0004-brcmfmac-no-retries-on-rxglom-superframe-errors.patch
  26109. +++ /dev/null
  26110. @@ -1,76 +0,0 @@
  26111. -From: Franky Lin <frankyl@broadcom.com>
  26112. -Date: Wed, 25 Nov 2015 11:32:40 +0100
  26113. -Subject: [PATCH] brcmfmac: no retries on rxglom superframe errors
  26114. -
  26115. -Aborting the current read attempt on the superframe also removes the
  26116. -packet from the pipeline. Retries should not be attempted on the next
  26117. -packet since it would not be a superframe(either a superframe descriptor
  26118. -or other data packet) and should not be handled by brcmf_sdio_rxglom
  26119. -
  26120. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  26121. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  26122. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  26123. -Signed-off-by: Franky Lin <frankyl@broadcom.com>
  26124. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  26125. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  26126. ----
  26127. -
  26128. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  26129. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  26130. -@@ -460,7 +460,6 @@ struct brcmf_sdio {
  26131. -
  26132. - struct sk_buff *glomd; /* Packet containing glomming descriptor */
  26133. - struct sk_buff_head glom; /* Packet list for glommed superframe */
  26134. -- uint glomerr; /* Glom packet read errors */
  26135. -
  26136. - u8 *rxbuf; /* Buffer for receiving control packets */
  26137. - uint rxblen; /* Allocated length of rxbuf */
  26138. -@@ -1654,20 +1653,15 @@ static u8 brcmf_sdio_rxglom(struct brcmf
  26139. - sdio_release_host(bus->sdiodev->func[1]);
  26140. - bus->sdcnt.f2rxdata++;
  26141. -
  26142. -- /* On failure, kill the superframe, allow a couple retries */
  26143. -+ /* On failure, kill the superframe */
  26144. - if (errcode < 0) {
  26145. - brcmf_err("glom read of %d bytes failed: %d\n",
  26146. - dlen, errcode);
  26147. -
  26148. - sdio_claim_host(bus->sdiodev->func[1]);
  26149. -- if (bus->glomerr++ < 3) {
  26150. -- brcmf_sdio_rxfail(bus, true, true);
  26151. -- } else {
  26152. -- bus->glomerr = 0;
  26153. -- brcmf_sdio_rxfail(bus, true, false);
  26154. -- bus->sdcnt.rxglomfail++;
  26155. -- brcmf_sdio_free_glom(bus);
  26156. -- }
  26157. -+ brcmf_sdio_rxfail(bus, true, false);
  26158. -+ bus->sdcnt.rxglomfail++;
  26159. -+ brcmf_sdio_free_glom(bus);
  26160. - sdio_release_host(bus->sdiodev->func[1]);
  26161. - return 0;
  26162. - }
  26163. -@@ -1708,19 +1702,11 @@ static u8 brcmf_sdio_rxglom(struct brcmf
  26164. - }
  26165. -
  26166. - if (errcode) {
  26167. -- /* Terminate frame on error, request
  26168. -- a couple retries */
  26169. -+ /* Terminate frame on error */
  26170. - sdio_claim_host(bus->sdiodev->func[1]);
  26171. -- if (bus->glomerr++ < 3) {
  26172. -- /* Restore superframe header space */
  26173. -- skb_push(pfirst, sfdoff);
  26174. -- brcmf_sdio_rxfail(bus, true, true);
  26175. -- } else {
  26176. -- bus->glomerr = 0;
  26177. -- brcmf_sdio_rxfail(bus, true, false);
  26178. -- bus->sdcnt.rxglomfail++;
  26179. -- brcmf_sdio_free_glom(bus);
  26180. -- }
  26181. -+ brcmf_sdio_rxfail(bus, true, false);
  26182. -+ bus->sdcnt.rxglomfail++;
  26183. -+ brcmf_sdio_free_glom(bus);
  26184. - sdio_release_host(bus->sdiodev->func[1]);
  26185. - bus->cur_read.len = 0;
  26186. - return 0;
  26187. 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
  26188. deleted file mode 100644
  26189. index ede1f47..0000000
  26190. --- a/package/kernel/mac80211/patches/376-0005-brcmfmac-Remove-redundant-parameter-action-from-scan.patch
  26191. +++ /dev/null
  26192. @@ -1,108 +0,0 @@
  26193. -From: Hante Meuleman <meuleman@broadcom.com>
  26194. -Date: Wed, 25 Nov 2015 11:32:41 +0100
  26195. -Subject: [PATCH] brcmfmac: Remove redundant parameter action from scan.
  26196. -
  26197. -ESCAN is always performed using action start scan. No need to
  26198. -pass this parameter on to different functions.
  26199. -
  26200. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  26201. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  26202. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  26203. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  26204. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  26205. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  26206. ----
  26207. -
  26208. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  26209. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  26210. -@@ -945,7 +945,7 @@ static void brcmf_escan_prep(struct brcm
  26211. -
  26212. - static s32
  26213. - brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
  26214. -- struct cfg80211_scan_request *request, u16 action)
  26215. -+ struct cfg80211_scan_request *request)
  26216. - {
  26217. - s32 params_size = BRCMF_SCAN_PARAMS_FIXED_SIZE +
  26218. - offsetof(struct brcmf_escan_params_le, params_le);
  26219. -@@ -970,7 +970,7 @@ brcmf_run_escan(struct brcmf_cfg80211_in
  26220. - BUG_ON(params_size + sizeof("escan") >= BRCMF_DCMD_MEDLEN);
  26221. - brcmf_escan_prep(cfg, &params->params_le, request);
  26222. - params->version = cpu_to_le32(BRCMF_ESCAN_REQ_VERSION);
  26223. -- params->action = cpu_to_le16(action);
  26224. -+ params->action = cpu_to_le16(WL_ESCAN_ACTION_START);
  26225. - params->sync_id = cpu_to_le16(0x1234);
  26226. -
  26227. - err = brcmf_fil_iovar_data_set(ifp, "escan", params, params_size);
  26228. -@@ -1012,7 +1012,7 @@ brcmf_do_escan(struct brcmf_cfg80211_inf
  26229. - results->count = 0;
  26230. - results->buflen = WL_ESCAN_RESULTS_FIXED_SIZE;
  26231. -
  26232. -- err = escan->run(cfg, ifp, request, WL_ESCAN_ACTION_START);
  26233. -+ err = escan->run(cfg, ifp, request);
  26234. - if (err)
  26235. - brcmf_scan_config_mpc(ifp, 1);
  26236. - return err;
  26237. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  26238. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  26239. -@@ -231,7 +231,7 @@ struct escan_info {
  26240. - struct wiphy *wiphy;
  26241. - struct brcmf_if *ifp;
  26242. - s32 (*run)(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
  26243. -- struct cfg80211_scan_request *request, u16 action);
  26244. -+ struct cfg80211_scan_request *request);
  26245. - };
  26246. -
  26247. - /**
  26248. ---- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  26249. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
  26250. -@@ -625,11 +625,10 @@ exit:
  26251. - * @num_chans: number of channels to scan.
  26252. - * @chanspecs: channel parameters for @num_chans channels.
  26253. - * @search_state: P2P discover state to use.
  26254. -- * @action: scan action to pass to firmware.
  26255. - * @bss_type: type of P2P bss.
  26256. - */
  26257. - static s32 brcmf_p2p_escan(struct brcmf_p2p_info *p2p, u32 num_chans,
  26258. -- u16 chanspecs[], s32 search_state, u16 action,
  26259. -+ u16 chanspecs[], s32 search_state,
  26260. - enum p2p_bss_type bss_type)
  26261. - {
  26262. - s32 ret = 0;
  26263. -@@ -738,7 +737,7 @@ static s32 brcmf_p2p_escan(struct brcmf_
  26264. -
  26265. - /* set the escan specific parameters */
  26266. - p2p_params->eparams.version = cpu_to_le32(BRCMF_ESCAN_REQ_VERSION);
  26267. -- p2p_params->eparams.action = cpu_to_le16(action);
  26268. -+ p2p_params->eparams.action = cpu_to_le16(WL_ESCAN_ACTION_START);
  26269. - p2p_params->eparams.sync_id = cpu_to_le16(0x1234);
  26270. - /* perform p2p scan on primary device */
  26271. - ret = brcmf_fil_bsscfg_data_set(vif->ifp, "p2p_scan", memblk, memsize);
  26272. -@@ -762,8 +761,7 @@ exit:
  26273. - */
  26274. - static s32 brcmf_p2p_run_escan(struct brcmf_cfg80211_info *cfg,
  26275. - struct brcmf_if *ifp,
  26276. -- struct cfg80211_scan_request *request,
  26277. -- u16 action)
  26278. -+ struct cfg80211_scan_request *request)
  26279. - {
  26280. - struct brcmf_p2p_info *p2p = &cfg->p2p;
  26281. - s32 err = 0;
  26282. -@@ -823,7 +821,7 @@ static s32 brcmf_p2p_run_escan(struct br
  26283. - num_nodfs++;
  26284. - }
  26285. - err = brcmf_p2p_escan(p2p, num_nodfs, chanspecs, search_state,
  26286. -- action, P2PAPI_BSSCFG_DEVICE);
  26287. -+ P2PAPI_BSSCFG_DEVICE);
  26288. - kfree(chanspecs);
  26289. - }
  26290. - exit:
  26291. -@@ -1092,8 +1090,7 @@ static s32 brcmf_p2p_act_frm_search(stru
  26292. - default_chan_list[2] = ch.chspec;
  26293. - }
  26294. - err = brcmf_p2p_escan(p2p, channel_cnt, default_chan_list,
  26295. -- WL_P2P_DISC_ST_SEARCH, WL_ESCAN_ACTION_START,
  26296. -- P2PAPI_BSSCFG_DEVICE);
  26297. -+ WL_P2P_DISC_ST_SEARCH, P2PAPI_BSSCFG_DEVICE);
  26298. - kfree(default_chan_list);
  26299. - exit:
  26300. - return err;
  26301. 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
  26302. deleted file mode 100644
  26303. index 41b8770..0000000
  26304. --- a/package/kernel/mac80211/patches/376-0006-brcmfmac-Cleanup-roaming-configuration.patch
  26305. +++ /dev/null
  26306. @@ -1,180 +0,0 @@
  26307. -From: Hante Meuleman <meuleman@broadcom.com>
  26308. -Date: Wed, 25 Nov 2015 11:32:42 +0100
  26309. -Subject: [PATCH] brcmfmac: Cleanup roaming configuration.
  26310. -
  26311. -Put all roaming configuration related code in one place and
  26312. -configure timeout based upon roaming setting.
  26313. -
  26314. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  26315. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  26316. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  26317. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  26318. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  26319. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  26320. ----
  26321. -
  26322. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  26323. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  26324. -@@ -4755,7 +4755,6 @@ struct brcmf_cfg80211_vif *brcmf_alloc_v
  26325. - vif->wdev.iftype = type;
  26326. -
  26327. - vif->pm_block = pm_block;
  26328. -- vif->roam_off = -1;
  26329. -
  26330. - brcmf_init_prof(&vif->profile);
  26331. -
  26332. -@@ -5305,35 +5304,33 @@ static void init_vif_event(struct brcmf_
  26333. - mutex_init(&event->vif_event_lock);
  26334. - }
  26335. -
  26336. --static s32
  26337. --brcmf_dongle_roam(struct brcmf_if *ifp, u32 bcn_timeout)
  26338. -+static s32 brcmf_dongle_roam(struct brcmf_if *ifp)
  26339. - {
  26340. -- s32 err = 0;
  26341. -+ s32 err;
  26342. -+ u32 bcn_timeout;
  26343. - __le32 roamtrigger[2];
  26344. - __le32 roam_delta[2];
  26345. -
  26346. -- /*
  26347. -- * Setup timeout if Beacons are lost and roam is
  26348. -- * off to report link down
  26349. -- */
  26350. -- if (brcmf_roamoff) {
  26351. -- err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout", bcn_timeout);
  26352. -- if (err) {
  26353. -- brcmf_err("bcn_timeout error (%d)\n", err);
  26354. -- goto dongle_rom_out;
  26355. -- }
  26356. -+ /* Configure beacon timeout value based upon roaming setting */
  26357. -+ if (brcmf_roamoff)
  26358. -+ bcn_timeout = BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_OFF;
  26359. -+ else
  26360. -+ bcn_timeout = BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON;
  26361. -+ err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout", bcn_timeout);
  26362. -+ if (err) {
  26363. -+ brcmf_err("bcn_timeout error (%d)\n", err);
  26364. -+ goto roam_setup_done;
  26365. - }
  26366. -
  26367. -- /*
  26368. -- * Enable/Disable built-in roaming to allow supplicant
  26369. -- * to take care of roaming
  26370. -+ /* Enable/Disable built-in roaming to allow supplicant to take care of
  26371. -+ * roaming.
  26372. - */
  26373. - brcmf_dbg(INFO, "Internal Roaming = %s\n",
  26374. - brcmf_roamoff ? "Off" : "On");
  26375. - err = brcmf_fil_iovar_int_set(ifp, "roam_off", !!(brcmf_roamoff));
  26376. - if (err) {
  26377. - brcmf_err("roam_off error (%d)\n", err);
  26378. -- goto dongle_rom_out;
  26379. -+ goto roam_setup_done;
  26380. - }
  26381. -
  26382. - roamtrigger[0] = cpu_to_le32(WL_ROAM_TRIGGER_LEVEL);
  26383. -@@ -5342,7 +5339,7 @@ brcmf_dongle_roam(struct brcmf_if *ifp,
  26384. - (void *)roamtrigger, sizeof(roamtrigger));
  26385. - if (err) {
  26386. - brcmf_err("WLC_SET_ROAM_TRIGGER error (%d)\n", err);
  26387. -- goto dongle_rom_out;
  26388. -+ goto roam_setup_done;
  26389. - }
  26390. -
  26391. - roam_delta[0] = cpu_to_le32(WL_ROAM_DELTA);
  26392. -@@ -5351,10 +5348,10 @@ brcmf_dongle_roam(struct brcmf_if *ifp,
  26393. - (void *)roam_delta, sizeof(roam_delta));
  26394. - if (err) {
  26395. - brcmf_err("WLC_SET_ROAM_DELTA error (%d)\n", err);
  26396. -- goto dongle_rom_out;
  26397. -+ goto roam_setup_done;
  26398. - }
  26399. -
  26400. --dongle_rom_out:
  26401. -+roam_setup_done:
  26402. - return err;
  26403. - }
  26404. -
  26405. -@@ -6069,7 +6066,7 @@ static s32 brcmf_config_dongle(struct br
  26406. - brcmf_dbg(INFO, "power save set to %s\n",
  26407. - (power_mode ? "enabled" : "disabled"));
  26408. -
  26409. -- err = brcmf_dongle_roam(ifp, WL_BEACON_TIMEOUT);
  26410. -+ err = brcmf_dongle_roam(ifp);
  26411. - if (err)
  26412. - goto default_conf_out;
  26413. - err = brcmf_cfg80211_change_iface(wdev->wiphy, ndev, wdev->iftype,
  26414. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  26415. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.h
  26416. -@@ -28,7 +28,6 @@
  26417. - #define WL_EXTRA_BUF_MAX 2048
  26418. - #define WL_ROAM_TRIGGER_LEVEL -75
  26419. - #define WL_ROAM_DELTA 20
  26420. --#define WL_BEACON_TIMEOUT 3
  26421. -
  26422. - #define WL_SCAN_CHANNEL_TIME 40
  26423. - #define WL_SCAN_UNASSOC_TIME 40
  26424. -@@ -77,6 +76,9 @@
  26425. -
  26426. - #define BRCMF_MAX_DEFAULT_KEYS 4
  26427. -
  26428. -+/* beacon loss timeout defaults */
  26429. -+#define BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_ON 2
  26430. -+#define BRCMF_DEFAULT_BCN_TIMEOUT_ROAM_OFF 4
  26431. -
  26432. - /**
  26433. - * enum brcmf_scan_status - scan engine status
  26434. -@@ -178,7 +180,6 @@ struct vif_saved_ie {
  26435. - * @ifp: lower layer interface pointer
  26436. - * @wdev: wireless device.
  26437. - * @profile: profile information.
  26438. -- * @roam_off: roaming state.
  26439. - * @sme_state: SME state using enum brcmf_vif_status bits.
  26440. - * @pm_block: power-management blocked.
  26441. - * @list: linked list.
  26442. -@@ -189,7 +190,6 @@ struct brcmf_cfg80211_vif {
  26443. - struct brcmf_if *ifp;
  26444. - struct wireless_dev wdev;
  26445. - struct brcmf_cfg80211_profile profile;
  26446. -- s32 roam_off;
  26447. - unsigned long sme_state;
  26448. - bool pm_block;
  26449. - struct vif_saved_ie saved_ie;
  26450. ---- a/drivers/net/wireless/brcm80211/brcmfmac/common.c
  26451. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/common.c
  26452. -@@ -29,7 +29,6 @@
  26453. -
  26454. - const u8 ALLFFMAC[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
  26455. -
  26456. --#define BRCMF_DEFAULT_BCN_TIMEOUT 3
  26457. - #define BRCMF_DEFAULT_SCAN_CHANNEL_TIME 40
  26458. - #define BRCMF_DEFAULT_SCAN_UNASSOC_TIME 40
  26459. -
  26460. -@@ -107,26 +106,6 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
  26461. - goto done;
  26462. - }
  26463. -
  26464. -- /*
  26465. -- * Setup timeout if Beacons are lost and roam is off to report
  26466. -- * link down
  26467. -- */
  26468. -- err = brcmf_fil_iovar_int_set(ifp, "bcn_timeout",
  26469. -- BRCMF_DEFAULT_BCN_TIMEOUT);
  26470. -- if (err) {
  26471. -- brcmf_err("bcn_timeout error (%d)\n", err);
  26472. -- goto done;
  26473. -- }
  26474. --
  26475. -- /* Enable/Disable build-in roaming to allowed ext supplicant to take
  26476. -- * of romaing
  26477. -- */
  26478. -- err = brcmf_fil_iovar_int_set(ifp, "roam_off", 1);
  26479. -- if (err) {
  26480. -- brcmf_err("roam_off error (%d)\n", err);
  26481. -- goto done;
  26482. -- }
  26483. --
  26484. - /* Setup join_pref to select target by RSSI(with boost on 5GHz) */
  26485. - join_pref_params[0].type = BRCMF_JOIN_PREF_RSSI_DELTA;
  26486. - join_pref_params[0].len = 2;
  26487. 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
  26488. deleted file mode 100644
  26489. index 395166b..0000000
  26490. --- a/package/kernel/mac80211/patches/376-0007-brcmfmac-Add-beamforming-support.patch
  26491. +++ /dev/null
  26492. @@ -1,115 +0,0 @@
  26493. -From: Hante Meuleman <meuleman@broadcom.com>
  26494. -Date: Wed, 25 Nov 2015 11:32:43 +0100
  26495. -Subject: [PATCH] brcmfmac: Add beamforming support.
  26496. -
  26497. -Some devices support beamforming. This patch enables tx beamforming
  26498. -if supported and reports beamforming capabilities per channel if
  26499. -supported.
  26500. -
  26501. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  26502. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  26503. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  26504. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  26505. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  26506. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  26507. ----
  26508. -
  26509. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  26510. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  26511. -@@ -5671,7 +5671,8 @@ static __le16 brcmf_get_mcs_map(u32 ncha
  26512. - }
  26513. -
  26514. - static void brcmf_update_vht_cap(struct ieee80211_supported_band *band,
  26515. -- u32 bw_cap[2], u32 nchain)
  26516. -+ u32 bw_cap[2], u32 nchain, u32 txstreams,
  26517. -+ u32 txbf_bfe_cap, u32 txbf_bfr_cap)
  26518. - {
  26519. - __le16 mcs_map;
  26520. -
  26521. -@@ -5690,6 +5691,25 @@ static void brcmf_update_vht_cap(struct
  26522. - mcs_map = brcmf_get_mcs_map(nchain, IEEE80211_VHT_MCS_SUPPORT_0_9);
  26523. - band->vht_cap.vht_mcs.rx_mcs_map = mcs_map;
  26524. - band->vht_cap.vht_mcs.tx_mcs_map = mcs_map;
  26525. -+
  26526. -+ /* Beamforming support information */
  26527. -+ if (txbf_bfe_cap & BRCMF_TXBF_SU_BFE_CAP)
  26528. -+ band->vht_cap.cap |= IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE;
  26529. -+ if (txbf_bfe_cap & BRCMF_TXBF_MU_BFE_CAP)
  26530. -+ band->vht_cap.cap |= IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE;
  26531. -+ if (txbf_bfr_cap & BRCMF_TXBF_SU_BFR_CAP)
  26532. -+ band->vht_cap.cap |= IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE;
  26533. -+ if (txbf_bfr_cap & BRCMF_TXBF_MU_BFR_CAP)
  26534. -+ band->vht_cap.cap |= IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE;
  26535. -+
  26536. -+ if ((txbf_bfe_cap || txbf_bfr_cap) && (txstreams > 1)) {
  26537. -+ band->vht_cap.cap |=
  26538. -+ (2 << IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT);
  26539. -+ band->vht_cap.cap |= ((txstreams - 1) <<
  26540. -+ IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT);
  26541. -+ band->vht_cap.cap |=
  26542. -+ IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB;
  26543. -+ }
  26544. - }
  26545. -
  26546. - static int brcmf_setup_wiphybands(struct wiphy *wiphy)
  26547. -@@ -5704,6 +5724,9 @@ static int brcmf_setup_wiphybands(struct
  26548. - int err;
  26549. - s32 i;
  26550. - struct ieee80211_supported_band *band;
  26551. -+ u32 txstreams = 0;
  26552. -+ u32 txbf_bfe_cap = 0;
  26553. -+ u32 txbf_bfr_cap = 0;
  26554. -
  26555. - (void)brcmf_fil_iovar_int_get(ifp, "vhtmode", &vhtmode);
  26556. - err = brcmf_fil_iovar_int_get(ifp, "nmode", &nmode);
  26557. -@@ -5732,6 +5755,14 @@ static int brcmf_setup_wiphybands(struct
  26558. - return err;
  26559. - }
  26560. -
  26561. -+ if (vhtmode) {
  26562. -+ (void)brcmf_fil_iovar_int_get(ifp, "txstreams", &txstreams);
  26563. -+ (void)brcmf_fil_iovar_int_get(ifp, "txbf_bfe_cap",
  26564. -+ &txbf_bfe_cap);
  26565. -+ (void)brcmf_fil_iovar_int_get(ifp, "txbf_bfr_cap",
  26566. -+ &txbf_bfr_cap);
  26567. -+ }
  26568. -+
  26569. - wiphy = cfg_to_wiphy(cfg);
  26570. - for (i = 0; i < ARRAY_SIZE(wiphy->bands); i++) {
  26571. - band = wiphy->bands[i];
  26572. -@@ -5741,7 +5772,8 @@ static int brcmf_setup_wiphybands(struct
  26573. - if (nmode)
  26574. - brcmf_update_ht_cap(band, bw_cap, nchain);
  26575. - if (vhtmode)
  26576. -- brcmf_update_vht_cap(band, bw_cap, nchain);
  26577. -+ brcmf_update_vht_cap(band, bw_cap, nchain, txstreams,
  26578. -+ txbf_bfe_cap, txbf_bfr_cap);
  26579. - }
  26580. -
  26581. - return 0;
  26582. ---- a/drivers/net/wireless/brcm80211/brcmfmac/common.c
  26583. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/common.c
  26584. -@@ -153,6 +153,9 @@ int brcmf_c_preinit_dcmds(struct brcmf_i
  26585. - goto done;
  26586. - }
  26587. -
  26588. -+ /* Enable tx beamforming, errors can be ignored (not supported) */
  26589. -+ (void)brcmf_fil_iovar_int_set(ifp, "txbf", 1);
  26590. -+
  26591. - /* do bus specific preinit here */
  26592. - err = brcmf_bus_preinit(ifp->drvr->bus_if);
  26593. - done:
  26594. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  26595. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwil_types.h
  26596. -@@ -121,6 +121,11 @@
  26597. -
  26598. - #define BRCMF_MAX_ASSOCLIST 128
  26599. -
  26600. -+#define BRCMF_TXBF_SU_BFE_CAP BIT(0)
  26601. -+#define BRCMF_TXBF_MU_BFE_CAP BIT(1)
  26602. -+#define BRCMF_TXBF_SU_BFR_CAP BIT(0)
  26603. -+#define BRCMF_TXBF_MU_BFR_CAP BIT(1)
  26604. -+
  26605. - /* join preference types for join_pref iovar */
  26606. - enum brcmf_join_pref_types {
  26607. - BRCMF_JOIN_PREF_RSSI = 1,
  26608. 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
  26609. deleted file mode 100644
  26610. index d471eb5..0000000
  26611. --- a/package/kernel/mac80211/patches/376-0008-brcmfmac-assure-net_ratelimit-is-declared-before-use.patch
  26612. +++ /dev/null
  26613. @@ -1,25 +0,0 @@
  26614. -From: Arend van Spriel <arend@broadcom.com>
  26615. -Date: Wed, 25 Nov 2015 11:32:45 +0100
  26616. -Subject: [PATCH] brcmfmac: assure net_ratelimit() is declared before use
  26617. -
  26618. -Under some kernel configuration we get build issue with implicit
  26619. -declaration of net_ratelimit() function. Fix this by explicitly
  26620. -including the file providing the prototype.
  26621. -
  26622. -Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
  26623. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  26624. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  26625. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  26626. ----
  26627. -
  26628. ---- a/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  26629. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  26630. -@@ -17,6 +17,8 @@
  26631. - #ifndef BRCMFMAC_DEBUG_H
  26632. - #define BRCMFMAC_DEBUG_H
  26633. -
  26634. -+#include <linux/net.h> /* net_ratelimit() */
  26635. -+
  26636. - /* message levels */
  26637. - #define BRCMF_TRACE_VAL 0x00000002
  26638. - #define BRCMF_INFO_VAL 0x00000004
  26639. 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
  26640. deleted file mode 100644
  26641. index 0ec9d10..0000000
  26642. --- a/package/kernel/mac80211/patches/376-0009-brcmfmac-Unify-methods-to-define-and-map-firmware-fi.patch
  26643. +++ /dev/null
  26644. @@ -1,664 +0,0 @@
  26645. -From: Hante Meuleman <meuleman@broadcom.com>
  26646. -Date: Wed, 25 Nov 2015 11:32:46 +0100
  26647. -Subject: [PATCH] brcmfmac: Unify methods to define and map firmware files.
  26648. -
  26649. -All bus drivers (sdio, usb and pcie) require firmware files which
  26650. -needs to be downloaded to the device, The definitions and mapping
  26651. -of device id and revision to firmware and nvram file is done by
  26652. -each bus driver. This patch creates common functions and defines
  26653. -to simplify and unify the definition of these firmware and nvram
  26654. -files and mapping.
  26655. -
  26656. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  26657. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  26658. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  26659. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  26660. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  26661. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  26662. ----
  26663. -
  26664. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  26665. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
  26666. -@@ -27,9 +27,9 @@
  26667. - #define BRCMF_FW_NVRAM_DEVPATH_LEN 19 /* devpath0=pcie/1/4/ */
  26668. - #define BRCMF_FW_NVRAM_PCIEDEV_LEN 10 /* pcie/1/4/ + \0 */
  26669. -
  26670. --char brcmf_firmware_path[BRCMF_FW_PATH_LEN];
  26671. -+static char brcmf_firmware_path[BRCMF_FW_NAME_LEN];
  26672. - module_param_string(alternative_fw_path, brcmf_firmware_path,
  26673. -- BRCMF_FW_PATH_LEN, 0440);
  26674. -+ BRCMF_FW_NAME_LEN, 0440);
  26675. -
  26676. - enum nvram_parser_state {
  26677. - IDLE,
  26678. -@@ -531,3 +531,43 @@ int brcmf_fw_get_firmwares(struct device
  26679. - 0);
  26680. - }
  26681. -
  26682. -+int brcmf_fw_map_chip_to_name(u32 chip, u32 chiprev,
  26683. -+ struct brcmf_firmware_mapping mapping_table[],
  26684. -+ u32 table_size, char fw_name[BRCMF_FW_NAME_LEN],
  26685. -+ char nvram_name[BRCMF_FW_NAME_LEN])
  26686. -+{
  26687. -+ u32 i;
  26688. -+ char end;
  26689. -+
  26690. -+ for (i = 0; i < table_size; i++) {
  26691. -+ if (mapping_table[i].chipid == chip &&
  26692. -+ mapping_table[i].revmask & BIT(chiprev))
  26693. -+ break;
  26694. -+ }
  26695. -+
  26696. -+ if (i == table_size) {
  26697. -+ brcmf_err("Unknown chipid %d [%d]\n", chip, chiprev);
  26698. -+ return -ENODEV;
  26699. -+ }
  26700. -+
  26701. -+ /* check if firmware path is provided by module parameter */
  26702. -+ if (brcmf_firmware_path[0] != '\0') {
  26703. -+ strlcpy(fw_name, brcmf_firmware_path, BRCMF_FW_NAME_LEN);
  26704. -+ if ((nvram_name) && (mapping_table[i].nvram))
  26705. -+ strlcpy(nvram_name, brcmf_firmware_path,
  26706. -+ BRCMF_FW_NAME_LEN);
  26707. -+
  26708. -+ end = brcmf_firmware_path[strlen(brcmf_firmware_path) - 1];
  26709. -+ if (end != '/') {
  26710. -+ strlcat(fw_name, "/", BRCMF_FW_NAME_LEN);
  26711. -+ if ((nvram_name) && (mapping_table[i].nvram))
  26712. -+ strlcat(nvram_name, "/", BRCMF_FW_NAME_LEN);
  26713. -+ }
  26714. -+ }
  26715. -+ strlcat(fw_name, mapping_table[i].fw, BRCMF_FW_NAME_LEN);
  26716. -+ if ((nvram_name) && (mapping_table[i].nvram))
  26717. -+ strlcat(nvram_name, mapping_table[i].nvram, BRCMF_FW_NAME_LEN);
  26718. -+
  26719. -+ return 0;
  26720. -+}
  26721. -+
  26722. ---- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.h
  26723. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.h
  26724. -@@ -21,11 +21,51 @@
  26725. - #define BRCMF_FW_REQ_FLAGS 0x00F0
  26726. - #define BRCMF_FW_REQ_NV_OPTIONAL 0x0010
  26727. -
  26728. --#define BRCMF_FW_PATH_LEN 256
  26729. --#define BRCMF_FW_NAME_LEN 32
  26730. -+#define BRCMF_FW_NAME_LEN 320
  26731. -
  26732. --extern char brcmf_firmware_path[];
  26733. -+#define BRCMF_FW_DEFAULT_PATH "brcm/"
  26734. -
  26735. -+/**
  26736. -+ * struct brcmf_firmware_mapping - Used to map chipid/revmask to firmware
  26737. -+ * filename and nvram filename. Each bus type implementation should create
  26738. -+ * a table of firmware mappings (using the macros defined below).
  26739. -+ *
  26740. -+ * @chipid: ID of chip.
  26741. -+ * @revmask: bitmask of revisions, e.g. 0x10 means rev 4 only, 0xf means rev 0-3
  26742. -+ * @fw: name of the firmware file.
  26743. -+ * @nvram: name of nvram file.
  26744. -+ */
  26745. -+struct brcmf_firmware_mapping {
  26746. -+ u32 chipid;
  26747. -+ u32 revmask;
  26748. -+ const char *fw;
  26749. -+ const char *nvram;
  26750. -+};
  26751. -+
  26752. -+#define BRCMF_FW_NVRAM_DEF(fw_nvram_name, fw, nvram) \
  26753. -+static const char BRCM_ ## fw_nvram_name ## _FIRMWARE_NAME[] = \
  26754. -+ BRCMF_FW_DEFAULT_PATH fw; \
  26755. -+static const char BRCM_ ## fw_nvram_name ## _NVRAM_NAME[] = \
  26756. -+ BRCMF_FW_DEFAULT_PATH nvram; \
  26757. -+MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH fw); \
  26758. -+MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH nvram)
  26759. -+
  26760. -+#define BRCMF_FW_DEF(fw_name, fw) \
  26761. -+static const char BRCM_ ## fw_name ## _FIRMWARE_NAME[] = \
  26762. -+ BRCMF_FW_DEFAULT_PATH fw; \
  26763. -+MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH fw) \
  26764. -+
  26765. -+#define BRCMF_FW_NVRAM_ENTRY(chipid, mask, name) \
  26766. -+ { chipid, mask, \
  26767. -+ BRCM_ ## name ## _FIRMWARE_NAME, BRCM_ ## name ## _NVRAM_NAME }
  26768. -+
  26769. -+#define BRCMF_FW_ENTRY(chipid, mask, name) \
  26770. -+ { chipid, mask, BRCM_ ## name ## _FIRMWARE_NAME, NULL }
  26771. -+
  26772. -+int brcmf_fw_map_chip_to_name(u32 chip, u32 chiprev,
  26773. -+ struct brcmf_firmware_mapping mapping_table[],
  26774. -+ u32 table_size, char fw_name[BRCMF_FW_NAME_LEN],
  26775. -+ char nvram_name[BRCMF_FW_NAME_LEN]);
  26776. - void brcmf_fw_nvram_free(void *nvram);
  26777. - /*
  26778. - * Request firmware(s) asynchronously. When the asynchronous request
  26779. ---- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  26780. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
  26781. -@@ -44,25 +44,29 @@ enum brcmf_pcie_state {
  26782. - BRCMFMAC_PCIE_STATE_UP
  26783. - };
  26784. -
  26785. --
  26786. --#define BRCMF_PCIE_43602_FW_NAME "brcm/brcmfmac43602-pcie.bin"
  26787. --#define BRCMF_PCIE_43602_NVRAM_NAME "brcm/brcmfmac43602-pcie.txt"
  26788. --#define BRCMF_PCIE_4350_FW_NAME "brcm/brcmfmac4350-pcie.bin"
  26789. --#define BRCMF_PCIE_4350_NVRAM_NAME "brcm/brcmfmac4350-pcie.txt"
  26790. --#define BRCMF_PCIE_4356_FW_NAME "brcm/brcmfmac4356-pcie.bin"
  26791. --#define BRCMF_PCIE_4356_NVRAM_NAME "brcm/brcmfmac4356-pcie.txt"
  26792. --#define BRCMF_PCIE_43570_FW_NAME "brcm/brcmfmac43570-pcie.bin"
  26793. --#define BRCMF_PCIE_43570_NVRAM_NAME "brcm/brcmfmac43570-pcie.txt"
  26794. --#define BRCMF_PCIE_4358_FW_NAME "brcm/brcmfmac4358-pcie.bin"
  26795. --#define BRCMF_PCIE_4358_NVRAM_NAME "brcm/brcmfmac4358-pcie.txt"
  26796. --#define BRCMF_PCIE_4359_FW_NAME "brcm/brcmfmac4359-pcie.bin"
  26797. --#define BRCMF_PCIE_4359_NVRAM_NAME "brcm/brcmfmac4359-pcie.txt"
  26798. --#define BRCMF_PCIE_4365_FW_NAME "brcm/brcmfmac4365b-pcie.bin"
  26799. --#define BRCMF_PCIE_4365_NVRAM_NAME "brcm/brcmfmac4365b-pcie.txt"
  26800. --#define BRCMF_PCIE_4366_FW_NAME "brcm/brcmfmac4366b-pcie.bin"
  26801. --#define BRCMF_PCIE_4366_NVRAM_NAME "brcm/brcmfmac4366b-pcie.txt"
  26802. --#define BRCMF_PCIE_4371_FW_NAME "brcm/brcmfmac4371-pcie.bin"
  26803. --#define BRCMF_PCIE_4371_NVRAM_NAME "brcm/brcmfmac4371-pcie.txt"
  26804. -+BRCMF_FW_NVRAM_DEF(43602, "brcmfmac43602-pcie.bin", "brcmfmac43602-pcie.txt");
  26805. -+BRCMF_FW_NVRAM_DEF(4350, "brcmfmac4350-pcie.bin", "brcmfmac4350-pcie.txt");
  26806. -+BRCMF_FW_NVRAM_DEF(4356, "brcmfmac4356-pcie.bin", "brcmfmac4356-pcie.txt");
  26807. -+BRCMF_FW_NVRAM_DEF(43570, "brcmfmac43570-pcie.bin", "brcmfmac43570-pcie.txt");
  26808. -+BRCMF_FW_NVRAM_DEF(4358, "brcmfmac4358-pcie.bin", "brcmfmac4358-pcie.txt");
  26809. -+BRCMF_FW_NVRAM_DEF(4359, "brcmfmac4359-pcie.bin", "brcmfmac4359-pcie.txt");
  26810. -+BRCMF_FW_NVRAM_DEF(4365B, "brcmfmac4365b-pcie.bin", "brcmfmac4365b-pcie.txt");
  26811. -+BRCMF_FW_NVRAM_DEF(4366B, "brcmfmac4366b-pcie.bin", "brcmfmac4366b-pcie.txt");
  26812. -+BRCMF_FW_NVRAM_DEF(4371, "brcmfmac4371-pcie.bin", "brcmfmac4371-pcie.txt");
  26813. -+
  26814. -+static struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = {
  26815. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43602_CHIP_ID, 0xFFFFFFFF, 43602),
  26816. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4350_CHIP_ID, 0xFFFFFFFF, 4350),
  26817. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4356_CHIP_ID, 0xFFFFFFFF, 4356),
  26818. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43567_CHIP_ID, 0xFFFFFFFF, 43570),
  26819. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43569_CHIP_ID, 0xFFFFFFFF, 43570),
  26820. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43570_CHIP_ID, 0xFFFFFFFF, 43570),
  26821. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4358_CHIP_ID, 0xFFFFFFFF, 4358),
  26822. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4359_CHIP_ID, 0xFFFFFFFF, 4359),
  26823. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4365_CHIP_ID, 0xFFFFFFFF, 4365B),
  26824. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0xFFFFFFFF, 4366B),
  26825. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4371_CHIP_ID, 0xFFFFFFFF, 4371),
  26826. -+};
  26827. -
  26828. - #define BRCMF_PCIE_FW_UP_TIMEOUT 2000 /* msec */
  26829. -
  26830. -@@ -202,26 +206,6 @@ enum brcmf_pcie_state {
  26831. - #define BRCMF_PCIE_LINK_STATUS_CTRL_ASPM_ENAB 3
  26832. -
  26833. -
  26834. --MODULE_FIRMWARE(BRCMF_PCIE_43602_FW_NAME);
  26835. --MODULE_FIRMWARE(BRCMF_PCIE_43602_NVRAM_NAME);
  26836. --MODULE_FIRMWARE(BRCMF_PCIE_4350_FW_NAME);
  26837. --MODULE_FIRMWARE(BRCMF_PCIE_4350_NVRAM_NAME);
  26838. --MODULE_FIRMWARE(BRCMF_PCIE_4356_FW_NAME);
  26839. --MODULE_FIRMWARE(BRCMF_PCIE_4356_NVRAM_NAME);
  26840. --MODULE_FIRMWARE(BRCMF_PCIE_43570_FW_NAME);
  26841. --MODULE_FIRMWARE(BRCMF_PCIE_43570_NVRAM_NAME);
  26842. --MODULE_FIRMWARE(BRCMF_PCIE_4358_FW_NAME);
  26843. --MODULE_FIRMWARE(BRCMF_PCIE_4358_NVRAM_NAME);
  26844. --MODULE_FIRMWARE(BRCMF_PCIE_4359_FW_NAME);
  26845. --MODULE_FIRMWARE(BRCMF_PCIE_4359_NVRAM_NAME);
  26846. --MODULE_FIRMWARE(BRCMF_PCIE_4365_FW_NAME);
  26847. --MODULE_FIRMWARE(BRCMF_PCIE_4365_NVRAM_NAME);
  26848. --MODULE_FIRMWARE(BRCMF_PCIE_4366_FW_NAME);
  26849. --MODULE_FIRMWARE(BRCMF_PCIE_4366_NVRAM_NAME);
  26850. --MODULE_FIRMWARE(BRCMF_PCIE_4371_FW_NAME);
  26851. --MODULE_FIRMWARE(BRCMF_PCIE_4371_NVRAM_NAME);
  26852. --
  26853. --
  26854. - struct brcmf_pcie_console {
  26855. - u32 base_addr;
  26856. - u32 buf_addr;
  26857. -@@ -258,8 +242,8 @@ struct brcmf_pciedev_info {
  26858. - enum brcmf_pcie_state state;
  26859. - bool in_irq;
  26860. - struct pci_dev *pdev;
  26861. -- char fw_name[BRCMF_FW_PATH_LEN + BRCMF_FW_NAME_LEN];
  26862. -- char nvram_name[BRCMF_FW_PATH_LEN + BRCMF_FW_NAME_LEN];
  26863. -+ char fw_name[BRCMF_FW_NAME_LEN];
  26864. -+ char nvram_name[BRCMF_FW_NAME_LEN];
  26865. - void __iomem *regs;
  26866. - void __iomem *tcm;
  26867. - u32 tcm_size;
  26868. -@@ -1478,84 +1462,6 @@ brcmf_pcie_init_share_ram_info(struct br
  26869. - }
  26870. -
  26871. -
  26872. --static int brcmf_pcie_get_fwnames(struct brcmf_pciedev_info *devinfo)
  26873. --{
  26874. -- char *fw_name;
  26875. -- char *nvram_name;
  26876. -- uint fw_len, nv_len;
  26877. -- char end;
  26878. --
  26879. -- brcmf_dbg(PCIE, "Enter, chip 0x%04x chiprev %d\n", devinfo->ci->chip,
  26880. -- devinfo->ci->chiprev);
  26881. --
  26882. -- switch (devinfo->ci->chip) {
  26883. -- case BRCM_CC_43602_CHIP_ID:
  26884. -- fw_name = BRCMF_PCIE_43602_FW_NAME;
  26885. -- nvram_name = BRCMF_PCIE_43602_NVRAM_NAME;
  26886. -- break;
  26887. -- case BRCM_CC_4350_CHIP_ID:
  26888. -- fw_name = BRCMF_PCIE_4350_FW_NAME;
  26889. -- nvram_name = BRCMF_PCIE_4350_NVRAM_NAME;
  26890. -- break;
  26891. -- case BRCM_CC_4356_CHIP_ID:
  26892. -- fw_name = BRCMF_PCIE_4356_FW_NAME;
  26893. -- nvram_name = BRCMF_PCIE_4356_NVRAM_NAME;
  26894. -- break;
  26895. -- case BRCM_CC_43567_CHIP_ID:
  26896. -- case BRCM_CC_43569_CHIP_ID:
  26897. -- case BRCM_CC_43570_CHIP_ID:
  26898. -- fw_name = BRCMF_PCIE_43570_FW_NAME;
  26899. -- nvram_name = BRCMF_PCIE_43570_NVRAM_NAME;
  26900. -- break;
  26901. -- case BRCM_CC_4358_CHIP_ID:
  26902. -- fw_name = BRCMF_PCIE_4358_FW_NAME;
  26903. -- nvram_name = BRCMF_PCIE_4358_NVRAM_NAME;
  26904. -- break;
  26905. -- case BRCM_CC_4359_CHIP_ID:
  26906. -- fw_name = BRCMF_PCIE_4359_FW_NAME;
  26907. -- nvram_name = BRCMF_PCIE_4359_NVRAM_NAME;
  26908. -- break;
  26909. -- case BRCM_CC_4365_CHIP_ID:
  26910. -- fw_name = BRCMF_PCIE_4365_FW_NAME;
  26911. -- nvram_name = BRCMF_PCIE_4365_NVRAM_NAME;
  26912. -- break;
  26913. -- case BRCM_CC_4366_CHIP_ID:
  26914. -- fw_name = BRCMF_PCIE_4366_FW_NAME;
  26915. -- nvram_name = BRCMF_PCIE_4366_NVRAM_NAME;
  26916. -- break;
  26917. -- case BRCM_CC_4371_CHIP_ID:
  26918. -- fw_name = BRCMF_PCIE_4371_FW_NAME;
  26919. -- nvram_name = BRCMF_PCIE_4371_NVRAM_NAME;
  26920. -- break;
  26921. -- default:
  26922. -- brcmf_err("Unsupported chip 0x%04x\n", devinfo->ci->chip);
  26923. -- return -ENODEV;
  26924. -- }
  26925. --
  26926. -- fw_len = sizeof(devinfo->fw_name) - 1;
  26927. -- nv_len = sizeof(devinfo->nvram_name) - 1;
  26928. -- /* check if firmware path is provided by module parameter */
  26929. -- if (brcmf_firmware_path[0] != '\0') {
  26930. -- strncpy(devinfo->fw_name, brcmf_firmware_path, fw_len);
  26931. -- strncpy(devinfo->nvram_name, brcmf_firmware_path, nv_len);
  26932. -- fw_len -= strlen(devinfo->fw_name);
  26933. -- nv_len -= strlen(devinfo->nvram_name);
  26934. --
  26935. -- end = brcmf_firmware_path[strlen(brcmf_firmware_path) - 1];
  26936. -- if (end != '/') {
  26937. -- strncat(devinfo->fw_name, "/", fw_len);
  26938. -- strncat(devinfo->nvram_name, "/", nv_len);
  26939. -- fw_len--;
  26940. -- nv_len--;
  26941. -- }
  26942. -- }
  26943. -- strncat(devinfo->fw_name, fw_name, fw_len);
  26944. -- strncat(devinfo->nvram_name, nvram_name, nv_len);
  26945. --
  26946. -- return 0;
  26947. --}
  26948. --
  26949. --
  26950. - static int brcmf_pcie_download_fw_nvram(struct brcmf_pciedev_info *devinfo,
  26951. - const struct firmware *fw, void *nvram,
  26952. - u32 nvram_len)
  26953. -@@ -1891,7 +1797,10 @@ brcmf_pcie_probe(struct pci_dev *pdev, c
  26954. - bus->wowl_supported = pci_pme_capable(pdev, PCI_D3hot);
  26955. - dev_set_drvdata(&pdev->dev, bus);
  26956. -
  26957. -- ret = brcmf_pcie_get_fwnames(devinfo);
  26958. -+ ret = brcmf_fw_map_chip_to_name(devinfo->ci->chip, devinfo->ci->chiprev,
  26959. -+ brcmf_pcie_fwnames,
  26960. -+ ARRAY_SIZE(brcmf_pcie_fwnames),
  26961. -+ devinfo->fw_name, devinfo->nvram_name);
  26962. - if (ret)
  26963. - goto fail_bus;
  26964. -
  26965. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  26966. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.c
  26967. -@@ -596,136 +596,41 @@ static const struct sdiod_drive_str sdio
  26968. - {4, 0x1}
  26969. - };
  26970. -
  26971. --#define BCM43143_FIRMWARE_NAME "brcm/brcmfmac43143-sdio.bin"
  26972. --#define BCM43143_NVRAM_NAME "brcm/brcmfmac43143-sdio.txt"
  26973. --#define BCM43241B0_FIRMWARE_NAME "brcm/brcmfmac43241b0-sdio.bin"
  26974. --#define BCM43241B0_NVRAM_NAME "brcm/brcmfmac43241b0-sdio.txt"
  26975. --#define BCM43241B4_FIRMWARE_NAME "brcm/brcmfmac43241b4-sdio.bin"
  26976. --#define BCM43241B4_NVRAM_NAME "brcm/brcmfmac43241b4-sdio.txt"
  26977. --#define BCM43241B5_FIRMWARE_NAME "brcm/brcmfmac43241b5-sdio.bin"
  26978. --#define BCM43241B5_NVRAM_NAME "brcm/brcmfmac43241b5-sdio.txt"
  26979. --#define BCM4329_FIRMWARE_NAME "brcm/brcmfmac4329-sdio.bin"
  26980. --#define BCM4329_NVRAM_NAME "brcm/brcmfmac4329-sdio.txt"
  26981. --#define BCM4330_FIRMWARE_NAME "brcm/brcmfmac4330-sdio.bin"
  26982. --#define BCM4330_NVRAM_NAME "brcm/brcmfmac4330-sdio.txt"
  26983. --#define BCM4334_FIRMWARE_NAME "brcm/brcmfmac4334-sdio.bin"
  26984. --#define BCM4334_NVRAM_NAME "brcm/brcmfmac4334-sdio.txt"
  26985. --#define BCM43340_FIRMWARE_NAME "brcm/brcmfmac43340-sdio.bin"
  26986. --#define BCM43340_NVRAM_NAME "brcm/brcmfmac43340-sdio.txt"
  26987. --#define BCM4335_FIRMWARE_NAME "brcm/brcmfmac4335-sdio.bin"
  26988. --#define BCM4335_NVRAM_NAME "brcm/brcmfmac4335-sdio.txt"
  26989. --#define BCM43362_FIRMWARE_NAME "brcm/brcmfmac43362-sdio.bin"
  26990. --#define BCM43362_NVRAM_NAME "brcm/brcmfmac43362-sdio.txt"
  26991. --#define BCM4339_FIRMWARE_NAME "brcm/brcmfmac4339-sdio.bin"
  26992. --#define BCM4339_NVRAM_NAME "brcm/brcmfmac4339-sdio.txt"
  26993. --#define BCM43430_FIRMWARE_NAME "brcm/brcmfmac43430-sdio.bin"
  26994. --#define BCM43430_NVRAM_NAME "brcm/brcmfmac43430-sdio.txt"
  26995. --#define BCM43455_FIRMWARE_NAME "brcm/brcmfmac43455-sdio.bin"
  26996. --#define BCM43455_NVRAM_NAME "brcm/brcmfmac43455-sdio.txt"
  26997. --#define BCM4354_FIRMWARE_NAME "brcm/brcmfmac4354-sdio.bin"
  26998. --#define BCM4354_NVRAM_NAME "brcm/brcmfmac4354-sdio.txt"
  26999. --
  27000. --MODULE_FIRMWARE(BCM43143_FIRMWARE_NAME);
  27001. --MODULE_FIRMWARE(BCM43143_NVRAM_NAME);
  27002. --MODULE_FIRMWARE(BCM43241B0_FIRMWARE_NAME);
  27003. --MODULE_FIRMWARE(BCM43241B0_NVRAM_NAME);
  27004. --MODULE_FIRMWARE(BCM43241B4_FIRMWARE_NAME);
  27005. --MODULE_FIRMWARE(BCM43241B4_NVRAM_NAME);
  27006. --MODULE_FIRMWARE(BCM43241B5_FIRMWARE_NAME);
  27007. --MODULE_FIRMWARE(BCM43241B5_NVRAM_NAME);
  27008. --MODULE_FIRMWARE(BCM4329_FIRMWARE_NAME);
  27009. --MODULE_FIRMWARE(BCM4329_NVRAM_NAME);
  27010. --MODULE_FIRMWARE(BCM4330_FIRMWARE_NAME);
  27011. --MODULE_FIRMWARE(BCM4330_NVRAM_NAME);
  27012. --MODULE_FIRMWARE(BCM4334_FIRMWARE_NAME);
  27013. --MODULE_FIRMWARE(BCM4334_NVRAM_NAME);
  27014. --MODULE_FIRMWARE(BCM43340_FIRMWARE_NAME);
  27015. --MODULE_FIRMWARE(BCM43340_NVRAM_NAME);
  27016. --MODULE_FIRMWARE(BCM4335_FIRMWARE_NAME);
  27017. --MODULE_FIRMWARE(BCM4335_NVRAM_NAME);
  27018. --MODULE_FIRMWARE(BCM43362_FIRMWARE_NAME);
  27019. --MODULE_FIRMWARE(BCM43362_NVRAM_NAME);
  27020. --MODULE_FIRMWARE(BCM4339_FIRMWARE_NAME);
  27021. --MODULE_FIRMWARE(BCM4339_NVRAM_NAME);
  27022. --MODULE_FIRMWARE(BCM43430_FIRMWARE_NAME);
  27023. --MODULE_FIRMWARE(BCM43430_NVRAM_NAME);
  27024. --MODULE_FIRMWARE(BCM43455_FIRMWARE_NAME);
  27025. --MODULE_FIRMWARE(BCM43455_NVRAM_NAME);
  27026. --MODULE_FIRMWARE(BCM4354_FIRMWARE_NAME);
  27027. --MODULE_FIRMWARE(BCM4354_NVRAM_NAME);
  27028. --
  27029. --struct brcmf_firmware_names {
  27030. -- u32 chipid;
  27031. -- u32 revmsk;
  27032. -- const char *bin;
  27033. -- const char *nv;
  27034. -+BRCMF_FW_NVRAM_DEF(43143, "brcmfmac43143-sdio.bin", "brcmfmac43143-sdio.txt");
  27035. -+BRCMF_FW_NVRAM_DEF(43241B0, "brcmfmac43241b0-sdio.bin",
  27036. -+ "brcmfmac43241b0-sdio.txt");
  27037. -+BRCMF_FW_NVRAM_DEF(43241B4, "brcmfmac43241b4-sdio.bin",
  27038. -+ "brcmfmac43241b4-sdio.txt");
  27039. -+BRCMF_FW_NVRAM_DEF(43241B5, "brcmfmac43241b5-sdio.bin",
  27040. -+ "brcmfmac43241b5-sdio.txt");
  27041. -+BRCMF_FW_NVRAM_DEF(4329, "brcmfmac4329-sdio.bin", "brcmfmac4329-sdio.txt");
  27042. -+BRCMF_FW_NVRAM_DEF(4330, "brcmfmac4330-sdio.bin", "brcmfmac4330-sdio.txt");
  27043. -+BRCMF_FW_NVRAM_DEF(4334, "brcmfmac4334-sdio.bin", "brcmfmac4334-sdio.txt");
  27044. -+BRCMF_FW_NVRAM_DEF(43340, "brcmfmac43340-sdio.bin", "brcmfmac43340-sdio.txt");
  27045. -+BRCMF_FW_NVRAM_DEF(4335, "brcmfmac4335-sdio.bin", "brcmfmac4335-sdio.txt");
  27046. -+BRCMF_FW_NVRAM_DEF(43362, "brcmfmac43362-sdio.bin", "brcmfmac43362-sdio.txt");
  27047. -+BRCMF_FW_NVRAM_DEF(4339, "brcmfmac4339-sdio.bin", "brcmfmac4339-sdio.txt");
  27048. -+BRCMF_FW_NVRAM_DEF(43430, "brcmfmac43430-sdio.bin", "brcmfmac43430-sdio.txt");
  27049. -+BRCMF_FW_NVRAM_DEF(43455, "brcmfmac43455-sdio.bin", "brcmfmac43455-sdio.txt");
  27050. -+BRCMF_FW_NVRAM_DEF(4354, "brcmfmac4354-sdio.bin", "brcmfmac4354-sdio.txt");
  27051. -+
  27052. -+static struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = {
  27053. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143),
  27054. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43241_CHIP_ID, 0x0000001F, 43241B0),
  27055. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43241_CHIP_ID, 0x00000020, 43241B4),
  27056. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43241_CHIP_ID, 0xFFFFFFC0, 43241B5),
  27057. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4329_CHIP_ID, 0xFFFFFFFF, 4329),
  27058. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4330_CHIP_ID, 0xFFFFFFFF, 4330),
  27059. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, 4334),
  27060. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43340_CHIP_ID, 0xFFFFFFFF, 43340),
  27061. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, 4335),
  27062. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, 43362),
  27063. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, 4339),
  27064. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43430_CHIP_ID, 0xFFFFFFFF, 43430),
  27065. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4345_CHIP_ID, 0xFFFFFFC0, 43455),
  27066. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, 4354)
  27067. - };
  27068. -
  27069. --enum brcmf_firmware_type {
  27070. -- BRCMF_FIRMWARE_BIN,
  27071. -- BRCMF_FIRMWARE_NVRAM
  27072. --};
  27073. --
  27074. --#define BRCMF_FIRMWARE_NVRAM(name) \
  27075. -- name ## _FIRMWARE_NAME, name ## _NVRAM_NAME
  27076. --
  27077. --static const struct brcmf_firmware_names brcmf_fwname_data[] = {
  27078. -- { BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM43143) },
  27079. -- { BRCM_CC_43241_CHIP_ID, 0x0000001F, BRCMF_FIRMWARE_NVRAM(BCM43241B0) },
  27080. -- { BRCM_CC_43241_CHIP_ID, 0x00000020, BRCMF_FIRMWARE_NVRAM(BCM43241B4) },
  27081. -- { BRCM_CC_43241_CHIP_ID, 0xFFFFFFC0, BRCMF_FIRMWARE_NVRAM(BCM43241B5) },
  27082. -- { BRCM_CC_4329_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4329) },
  27083. -- { BRCM_CC_4330_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4330) },
  27084. -- { BRCM_CC_4334_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4334) },
  27085. -- { BRCM_CC_43340_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM43340) },
  27086. -- { BRCM_CC_4335_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4335) },
  27087. -- { BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, BRCMF_FIRMWARE_NVRAM(BCM43362) },
  27088. -- { BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4339) },
  27089. -- { BRCM_CC_43430_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM43430) },
  27090. -- { BRCM_CC_4345_CHIP_ID, 0xFFFFFFC0, BRCMF_FIRMWARE_NVRAM(BCM43455) },
  27091. -- { BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4354) }
  27092. --};
  27093. --
  27094. --static int brcmf_sdio_get_fwnames(struct brcmf_chip *ci,
  27095. -- struct brcmf_sdio_dev *sdiodev)
  27096. --{
  27097. -- int i;
  27098. -- char end;
  27099. --
  27100. -- for (i = 0; i < ARRAY_SIZE(brcmf_fwname_data); i++) {
  27101. -- if (brcmf_fwname_data[i].chipid == ci->chip &&
  27102. -- brcmf_fwname_data[i].revmsk & BIT(ci->chiprev))
  27103. -- break;
  27104. -- }
  27105. --
  27106. -- if (i == ARRAY_SIZE(brcmf_fwname_data)) {
  27107. -- brcmf_err("Unknown chipid %d [%d]\n", ci->chip, ci->chiprev);
  27108. -- return -ENODEV;
  27109. -- }
  27110. --
  27111. -- /* check if firmware path is provided by module parameter */
  27112. -- if (brcmf_firmware_path[0] != '\0') {
  27113. -- strlcpy(sdiodev->fw_name, brcmf_firmware_path,
  27114. -- sizeof(sdiodev->fw_name));
  27115. -- strlcpy(sdiodev->nvram_name, brcmf_firmware_path,
  27116. -- sizeof(sdiodev->nvram_name));
  27117. --
  27118. -- end = brcmf_firmware_path[strlen(brcmf_firmware_path) - 1];
  27119. -- if (end != '/') {
  27120. -- strlcat(sdiodev->fw_name, "/",
  27121. -- sizeof(sdiodev->fw_name));
  27122. -- strlcat(sdiodev->nvram_name, "/",
  27123. -- sizeof(sdiodev->nvram_name));
  27124. -- }
  27125. -- }
  27126. -- strlcat(sdiodev->fw_name, brcmf_fwname_data[i].bin,
  27127. -- sizeof(sdiodev->fw_name));
  27128. -- strlcat(sdiodev->nvram_name, brcmf_fwname_data[i].nv,
  27129. -- sizeof(sdiodev->nvram_name));
  27130. --
  27131. -- return 0;
  27132. --}
  27133. --
  27134. - static void pkt_align(struct sk_buff *p, int len, int align)
  27135. - {
  27136. - uint datalign;
  27137. -@@ -4252,7 +4157,10 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
  27138. - brcmf_sdio_debugfs_create(bus);
  27139. - brcmf_dbg(INFO, "completed!!\n");
  27140. -
  27141. -- ret = brcmf_sdio_get_fwnames(bus->ci, sdiodev);
  27142. -+ ret = brcmf_fw_map_chip_to_name(bus->ci->chip, bus->ci->chiprev,
  27143. -+ brcmf_sdio_fwnames,
  27144. -+ ARRAY_SIZE(brcmf_sdio_fwnames),
  27145. -+ sdiodev->fw_name, sdiodev->nvram_name);
  27146. - if (ret)
  27147. - goto fail;
  27148. -
  27149. ---- a/drivers/net/wireless/brcm80211/brcmfmac/sdio.h
  27150. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio.h
  27151. -@@ -195,8 +195,8 @@ struct brcmf_sdio_dev {
  27152. - uint max_segment_size;
  27153. - uint txglomsz;
  27154. - struct sg_table sgtable;
  27155. -- char fw_name[BRCMF_FW_PATH_LEN + BRCMF_FW_NAME_LEN];
  27156. -- char nvram_name[BRCMF_FW_PATH_LEN + BRCMF_FW_NAME_LEN];
  27157. -+ char fw_name[BRCMF_FW_NAME_LEN];
  27158. -+ char nvram_name[BRCMF_FW_NAME_LEN];
  27159. - bool wowl_enabled;
  27160. - enum brcmf_sdiod_state state;
  27161. - struct brcmf_sdiod_freezer *freezer;
  27162. ---- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  27163. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
  27164. -@@ -43,10 +43,20 @@
  27165. - #define BRCMF_USB_CBCTL_READ 1
  27166. - #define BRCMF_USB_MAX_PKT_SIZE 1600
  27167. -
  27168. --#define BRCMF_USB_43143_FW_NAME "brcm/brcmfmac43143.bin"
  27169. --#define BRCMF_USB_43236_FW_NAME "brcm/brcmfmac43236b.bin"
  27170. --#define BRCMF_USB_43242_FW_NAME "brcm/brcmfmac43242a.bin"
  27171. --#define BRCMF_USB_43569_FW_NAME "brcm/brcmfmac43569.bin"
  27172. -+BRCMF_FW_DEF(43143, "brcmfmac43143.bin");
  27173. -+BRCMF_FW_DEF(43236B, "brcmfmac43236b.bin");
  27174. -+BRCMF_FW_DEF(43242A, "brcmfmac43242a.bin");
  27175. -+BRCMF_FW_DEF(43569, "brcmfmac43569.bin");
  27176. -+
  27177. -+static struct brcmf_firmware_mapping brcmf_usb_fwnames[] = {
  27178. -+ BRCMF_FW_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143),
  27179. -+ BRCMF_FW_ENTRY(BRCM_CC_43235_CHIP_ID, 0x00000008, 43236B),
  27180. -+ BRCMF_FW_ENTRY(BRCM_CC_43236_CHIP_ID, 0x00000008, 43236B),
  27181. -+ BRCMF_FW_ENTRY(BRCM_CC_43238_CHIP_ID, 0x00000008, 43236B),
  27182. -+ BRCMF_FW_ENTRY(BRCM_CC_43242_CHIP_ID, 0xFFFFFFFF, 43242A),
  27183. -+ BRCMF_FW_ENTRY(BRCM_CC_43566_CHIP_ID, 0xFFFFFFFF, 43569),
  27184. -+ BRCMF_FW_ENTRY(BRCM_CC_43569_CHIP_ID, 0xFFFFFFFF, 43569)
  27185. -+};
  27186. -
  27187. - #define TRX_MAGIC 0x30524448 /* "HDR0" */
  27188. - #define TRX_MAX_OFFSET 3 /* Max number of file offsets */
  27189. -@@ -139,6 +149,7 @@ struct brcmf_usbdev_info {
  27190. - struct brcmf_usbreq *tx_reqs;
  27191. - struct brcmf_usbreq *rx_reqs;
  27192. -
  27193. -+ char fw_name[BRCMF_FW_NAME_LEN];
  27194. - const u8 *image; /* buffer for combine fw and nvram */
  27195. - int image_len;
  27196. -
  27197. -@@ -983,45 +994,15 @@ static int brcmf_usb_dlrun(struct brcmf_
  27198. - return 0;
  27199. - }
  27200. -
  27201. --static bool brcmf_usb_chip_support(int chipid, int chiprev)
  27202. --{
  27203. -- switch(chipid) {
  27204. -- case BRCM_CC_43143_CHIP_ID:
  27205. -- return true;
  27206. -- case BRCM_CC_43235_CHIP_ID:
  27207. -- case BRCM_CC_43236_CHIP_ID:
  27208. -- case BRCM_CC_43238_CHIP_ID:
  27209. -- return (chiprev == 3);
  27210. -- case BRCM_CC_43242_CHIP_ID:
  27211. -- return true;
  27212. -- case BRCM_CC_43566_CHIP_ID:
  27213. -- case BRCM_CC_43569_CHIP_ID:
  27214. -- return true;
  27215. -- default:
  27216. -- break;
  27217. -- }
  27218. -- return false;
  27219. --}
  27220. --
  27221. - static int
  27222. - brcmf_usb_fw_download(struct brcmf_usbdev_info *devinfo)
  27223. - {
  27224. -- int devid, chiprev;
  27225. - int err;
  27226. -
  27227. - brcmf_dbg(USB, "Enter\n");
  27228. - if (devinfo == NULL)
  27229. - return -ENODEV;
  27230. -
  27231. -- devid = devinfo->bus_pub.devid;
  27232. -- chiprev = devinfo->bus_pub.chiprev;
  27233. --
  27234. -- if (!brcmf_usb_chip_support(devid, chiprev)) {
  27235. -- brcmf_err("unsupported chip %d rev %d\n",
  27236. -- devid, chiprev);
  27237. -- return -EINVAL;
  27238. -- }
  27239. --
  27240. - if (!devinfo->image) {
  27241. - brcmf_err("No firmware!\n");
  27242. - return -ENOENT;
  27243. -@@ -1071,25 +1052,6 @@ static int check_file(const u8 *headers)
  27244. - return -1;
  27245. - }
  27246. -
  27247. --static const char *brcmf_usb_get_fwname(struct brcmf_usbdev_info *devinfo)
  27248. --{
  27249. -- switch (devinfo->bus_pub.devid) {
  27250. -- case BRCM_CC_43143_CHIP_ID:
  27251. -- return BRCMF_USB_43143_FW_NAME;
  27252. -- case BRCM_CC_43235_CHIP_ID:
  27253. -- case BRCM_CC_43236_CHIP_ID:
  27254. -- case BRCM_CC_43238_CHIP_ID:
  27255. -- return BRCMF_USB_43236_FW_NAME;
  27256. -- case BRCM_CC_43242_CHIP_ID:
  27257. -- return BRCMF_USB_43242_FW_NAME;
  27258. -- case BRCM_CC_43566_CHIP_ID:
  27259. -- case BRCM_CC_43569_CHIP_ID:
  27260. -- return BRCMF_USB_43569_FW_NAME;
  27261. -- default:
  27262. -- return NULL;
  27263. -- }
  27264. --}
  27265. --
  27266. -
  27267. - static
  27268. - struct brcmf_usbdev *brcmf_usb_attach(struct brcmf_usbdev_info *devinfo,
  27269. -@@ -1274,9 +1236,16 @@ static int brcmf_usb_probe_cb(struct brc
  27270. - bus->chip = bus_pub->devid;
  27271. - bus->chiprev = bus_pub->chiprev;
  27272. -
  27273. -+ ret = brcmf_fw_map_chip_to_name(bus_pub->devid, bus_pub->chiprev,
  27274. -+ brcmf_usb_fwnames,
  27275. -+ ARRAY_SIZE(brcmf_usb_fwnames),
  27276. -+ devinfo->fw_name, NULL);
  27277. -+ if (ret)
  27278. -+ goto fail;
  27279. -+
  27280. - /* request firmware here */
  27281. -- ret = brcmf_fw_get_firmwares(dev, 0, brcmf_usb_get_fwname(devinfo),
  27282. -- NULL, brcmf_usb_probe_phase2);
  27283. -+ ret = brcmf_fw_get_firmwares(dev, 0, devinfo->fw_name, NULL,
  27284. -+ brcmf_usb_probe_phase2);
  27285. - if (ret) {
  27286. - brcmf_err("firmware request failed: %d\n", ret);
  27287. - goto fail;
  27288. -@@ -1472,8 +1441,7 @@ static int brcmf_usb_reset_resume(struct
  27289. -
  27290. - brcmf_dbg(USB, "Enter\n");
  27291. -
  27292. -- return brcmf_fw_get_firmwares(&usb->dev, 0,
  27293. -- brcmf_usb_get_fwname(devinfo), NULL,
  27294. -+ return brcmf_fw_get_firmwares(&usb->dev, 0, devinfo->fw_name, NULL,
  27295. - brcmf_usb_probe_phase2);
  27296. - }
  27297. -
  27298. -@@ -1491,10 +1459,6 @@ static struct usb_device_id brcmf_usb_de
  27299. - };
  27300. -
  27301. - MODULE_DEVICE_TABLE(usb, brcmf_usb_devid_table);
  27302. --MODULE_FIRMWARE(BRCMF_USB_43143_FW_NAME);
  27303. --MODULE_FIRMWARE(BRCMF_USB_43236_FW_NAME);
  27304. --MODULE_FIRMWARE(BRCMF_USB_43242_FW_NAME);
  27305. --MODULE_FIRMWARE(BRCMF_USB_43569_FW_NAME);
  27306. -
  27307. - static struct usb_driver brcmf_usbdrvr = {
  27308. - .name = KBUILD_MODNAME,
  27309. 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
  27310. deleted file mode 100644
  27311. index 2174d09..0000000
  27312. --- a/package/kernel/mac80211/patches/376-0010-brcmfmac-Fix-double-free-on-exception-at-module-load.patch
  27313. +++ /dev/null
  27314. @@ -1,22 +0,0 @@
  27315. -From: Hante Meuleman <meuleman@broadcom.com>
  27316. -Date: Wed, 25 Nov 2015 11:32:47 +0100
  27317. -Subject: [PATCH] brcmfmac: Fix double free on exception at module load.
  27318. -
  27319. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  27320. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  27321. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  27322. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  27323. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  27324. ----
  27325. -
  27326. ---- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  27327. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  27328. -@@ -1083,6 +1083,8 @@ fail:
  27329. - brcmf_net_detach(ifp->ndev);
  27330. - if (p2p_ifp)
  27331. - brcmf_net_detach(p2p_ifp->ndev);
  27332. -+ drvr->iflist[0] = NULL;
  27333. -+ drvr->iflist[1] = NULL;
  27334. - return ret;
  27335. - }
  27336. - return 0;
  27337. 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
  27338. deleted file mode 100644
  27339. index 8ec1441..0000000
  27340. --- a/package/kernel/mac80211/patches/377-brcmfmac-only-lock-and-unlock-fws-if-fws-is-not-null.patch
  27341. +++ /dev/null
  27342. @@ -1,30 +0,0 @@
  27343. -From: Colin Ian King <colin.king@canonical.com>
  27344. -Date: Wed, 2 Dec 2015 11:45:10 +0000
  27345. -Subject: [PATCH] brcmfmac: only lock and unlock fws if fws is not null
  27346. -
  27347. -There is a null ptr check for fws to set bcmc_credit_check, however,
  27348. -there a lock and unlock on fws should only performed if fwts is
  27349. -also not null to also avoid a potential null pointer deference.
  27350. -
  27351. -Signed-off-by: Colin Ian King <colin.king@canonical.com>
  27352. -Acked-by: Arend van Spriel <arend@broadcom.com>
  27353. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  27354. ----
  27355. -
  27356. ---- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  27357. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
  27358. -@@ -1609,10 +1609,11 @@ static int brcmf_fws_notify_bcmc_credit_
  27359. - {
  27360. - struct brcmf_fws_info *fws = ifp->drvr->fws;
  27361. -
  27362. -- brcmf_fws_lock(fws);
  27363. -- if (fws)
  27364. -+ if (fws) {
  27365. -+ brcmf_fws_lock(fws);
  27366. - fws->bcmc_credit_check = true;
  27367. -- brcmf_fws_unlock(fws);
  27368. -+ brcmf_fws_unlock(fws);
  27369. -+ }
  27370. - return 0;
  27371. - }
  27372. -
  27373. diff --git a/package/kernel/mac80211/patches/400-ath_move_debug_code.patch b/package/kernel/mac80211/patches/400-ath_move_debug_code.patch
  27374. index 298f722..72e9a41 100644
  27375. --- a/package/kernel/mac80211/patches/400-ath_move_debug_code.patch
  27376. +++ b/package/kernel/mac80211/patches/400-ath_move_debug_code.patch
  27377. @@ -14,7 +14,7 @@
  27378. ccflags-y += -D__CHECK_ENDIAN__
  27379. --- a/drivers/net/wireless/ath/ath.h
  27380. +++ b/drivers/net/wireless/ath/ath.h
  27381. -@@ -316,13 +316,6 @@ void _ath_dbg(struct ath_common *common,
  27382. +@@ -318,13 +318,6 @@ void _ath_dbg(struct ath_common *common,
  27383. #endif /* CPTCFG_ATH_DEBUG */
  27384. /** Returns string describing opmode, or NULL if unknown mode. */
  27385. diff --git a/package/kernel/mac80211/patches/402-ath_regd_optional.patch b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  27386. index 2dac505..f918c18 100644
  27387. --- a/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  27388. +++ b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  27389. @@ -59,7 +59,7 @@
  27390. ---help---
  27391. --- a/.local-symbols
  27392. +++ b/.local-symbols
  27393. -@@ -89,6 +89,7 @@ RTL8187_LEDS=
  27394. +@@ -137,6 +137,7 @@ RTL8187_LEDS=
  27395. ATH_COMMON=
  27396. ATH_CARDS=
  27397. ATH_DEBUG=
  27398. diff --git a/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch b/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch
  27399. index 1476953..8b52ac3 100644
  27400. --- a/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch
  27401. +++ b/package/kernel/mac80211/patches/404-regd_no_assoc_hints.patch
  27402. @@ -1,6 +1,6 @@
  27403. --- a/net/wireless/reg.c
  27404. +++ b/net/wireless/reg.c
  27405. -@@ -2368,6 +2368,8 @@ void regulatory_hint_country_ie(struct w
  27406. +@@ -2390,6 +2390,8 @@ void regulatory_hint_country_ie(struct w
  27407. enum environment_cap env = ENVIRON_ANY;
  27408. struct regulatory_request *request = NULL, *lr;
  27409. @@ -9,7 +9,7 @@
  27410. /* IE len must be evenly divisible by 2 */
  27411. if (country_ie_len & 0x01)
  27412. return;
  27413. -@@ -2571,6 +2573,7 @@ static void restore_regulatory_settings(
  27414. +@@ -2596,6 +2598,7 @@ static void restore_regulatory_settings(
  27415. void regulatory_hint_disconnect(void)
  27416. {
  27417. 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
  27418. index 93760f9..1a62484 100644
  27419. --- a/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
  27420. +++ b/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
  27421. @@ -1,6 +1,6 @@
  27422. --- a/drivers/net/wireless/ath/ath9k/init.c
  27423. +++ b/drivers/net/wireless/ath/ath9k/init.c
  27424. -@@ -715,6 +715,7 @@ static const struct ieee80211_iface_limi
  27425. +@@ -722,6 +722,7 @@ static const struct ieee80211_iface_limi
  27426. BIT(NL80211_IFTYPE_AP) },
  27427. { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  27428. BIT(NL80211_IFTYPE_P2P_GO) },
  27429. diff --git a/package/kernel/mac80211/patches/440-ath5k_channel_bw_debugfs.patch b/package/kernel/mac80211/patches/440-ath5k_channel_bw_debugfs.patch
  27430. index aa521d2..42d43a4 100644
  27431. --- a/package/kernel/mac80211/patches/440-ath5k_channel_bw_debugfs.patch
  27432. +++ b/package/kernel/mac80211/patches/440-ath5k_channel_bw_debugfs.patch
  27433. @@ -121,7 +121,7 @@ drivers/net/wireless/ath/ath5k/debug.c | 86 ++++++++++++++++++++++++++++++++
  27434. debugfs_create_file("antenna", S_IWUSR | S_IRUSR, phydir, ah,
  27435. --- a/drivers/net/wireless/ath/ath5k/ath5k.h
  27436. +++ b/drivers/net/wireless/ath/ath5k/ath5k.h
  27437. -@@ -1371,6 +1371,7 @@ struct ath5k_hw {
  27438. +@@ -1370,6 +1370,7 @@ struct ath5k_hw {
  27439. u8 ah_coverage_class;
  27440. bool ah_ack_bitrate_high;
  27441. u8 ah_bwmode;
  27442. diff --git a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  27443. index 5892c3e..5a3e37c 100644
  27444. --- a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  27445. +++ b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  27446. @@ -1,6 +1,6 @@
  27447. --- a/drivers/net/wireless/ath/ath9k/init.c
  27448. +++ b/drivers/net/wireless/ath/ath9k/init.c
  27449. -@@ -1024,23 +1024,23 @@ static int __init ath9k_init(void)
  27450. +@@ -1032,23 +1032,23 @@ static int __init ath9k_init(void)
  27451. {
  27452. int error;
  27453. diff --git a/package/kernel/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch b/package/kernel/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch
  27454. index ed2cfee..d2a3b96 100644
  27455. --- a/package/kernel/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch
  27456. +++ b/package/kernel/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch
  27457. @@ -1,6 +1,6 @@
  27458. --- a/drivers/net/wireless/ath/ath9k/hw.c
  27459. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  27460. -@@ -389,13 +389,8 @@ static void ath9k_hw_init_config(struct
  27461. +@@ -390,13 +390,8 @@ static void ath9k_hw_init_config(struct
  27462. ah->config.rx_intr_mitigation = true;
  27463. @@ -14,5 +14,5 @@
  27464. + ah->config.rimt_last = 250;
  27465. + ah->config.rimt_first = 500;
  27466. - /*
  27467. - * We need this for PCI devices only (Cardbus, PCI, miniPCI)
  27468. + if (AR_SREV_9462(ah) || AR_SREV_9565(ah))
  27469. + ah->config.pll_pwrsave = 7;
  27470. diff --git a/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch b/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  27471. index d4104f0..6766111 100644
  27472. --- a/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  27473. +++ b/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  27474. @@ -1,6 +1,6 @@
  27475. --- a/drivers/net/wireless/ath/ath9k/ath9k.h
  27476. +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  27477. -@@ -87,7 +87,7 @@ int ath_descdma_setup(struct ath_softc *
  27478. +@@ -88,7 +88,7 @@ int ath_descdma_setup(struct ath_softc *
  27479. (_l) &= ((_sz) - 1); \
  27480. } while (0)
  27481. diff --git a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  27482. index 40b5c81..c84d1bc 100644
  27483. --- a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  27484. +++ b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  27485. @@ -1,6 +1,6 @@
  27486. --- a/drivers/net/wireless/ath/ath9k/hw.c
  27487. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  27488. -@@ -647,6 +647,7 @@ int ath9k_hw_init(struct ath_hw *ah)
  27489. +@@ -651,6 +651,7 @@ int ath9k_hw_init(struct ath_hw *ah)
  27490. /* These are all the AR5008/AR9001/AR9002/AR9003 hardware family of chipsets */
  27491. switch (ah->hw_version.devid) {
  27492. diff --git a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  27493. index 0c50a0b..99bf7e8 100644
  27494. --- a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  27495. +++ b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  27496. @@ -18,7 +18,7 @@
  27497. const u8 *addr);
  27498. --- a/include/net/mac80211.h
  27499. +++ b/include/net/mac80211.h
  27500. -@@ -1171,6 +1171,7 @@ enum ieee80211_smps_mode {
  27501. +@@ -1252,6 +1252,7 @@ enum ieee80211_smps_mode {
  27502. *
  27503. * @power_level: requested transmit power (in dBm), backward compatibility
  27504. * value only that is set to the minimum of all interfaces
  27505. @@ -26,7 +26,7 @@
  27506. *
  27507. * @chandef: the channel definition to tune to
  27508. * @radar_enabled: whether radar detection is enabled
  27509. -@@ -1192,6 +1193,7 @@ struct ieee80211_conf {
  27510. +@@ -1273,6 +1274,7 @@ struct ieee80211_conf {
  27511. u32 flags;
  27512. int power_level, dynamic_ps_timeout;
  27513. int max_sleep_period;
  27514. @@ -36,7 +36,7 @@
  27515. u8 ps_dtim_period;
  27516. --- a/include/uapi/linux/nl80211.h
  27517. +++ b/include/uapi/linux/nl80211.h
  27518. -@@ -1760,6 +1760,9 @@ enum nl80211_commands {
  27519. +@@ -1761,6 +1761,9 @@ enum nl80211_commands {
  27520. * @NL80211_ATTR_REG_INDOOR: flag attribute, if set indicates that the device
  27521. * is operating in an indoor environment.
  27522. *
  27523. @@ -46,7 +46,7 @@
  27524. * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  27525. * @NL80211_ATTR_MAX: highest attribute number currently defined
  27526. * @__NL80211_ATTR_AFTER_LAST: internal use
  27527. -@@ -2129,6 +2132,8 @@ enum nl80211_attrs {
  27528. +@@ -2130,6 +2133,8 @@ enum nl80211_attrs {
  27529. NL80211_ATTR_REG_INDOOR,
  27530. @@ -57,7 +57,7 @@
  27531. __NL80211_ATTR_AFTER_LAST,
  27532. --- a/net/mac80211/cfg.c
  27533. +++ b/net/mac80211/cfg.c
  27534. -@@ -2208,6 +2208,19 @@ static int ieee80211_get_tx_power(struct
  27535. +@@ -2233,6 +2233,19 @@ static int ieee80211_get_tx_power(struct
  27536. return 0;
  27537. }
  27538. @@ -77,7 +77,7 @@
  27539. static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev,
  27540. const u8 *addr)
  27541. {
  27542. -@@ -3771,6 +3784,7 @@ const struct cfg80211_ops mac80211_confi
  27543. +@@ -3845,6 +3858,7 @@ const struct cfg80211_ops mac80211_confi
  27544. .set_wiphy_params = ieee80211_set_wiphy_params,
  27545. .set_tx_power = ieee80211_set_tx_power,
  27546. .get_tx_power = ieee80211_get_tx_power,
  27547. @@ -87,7 +87,7 @@
  27548. CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd)
  27549. --- a/net/mac80211/ieee80211_i.h
  27550. +++ b/net/mac80211/ieee80211_i.h
  27551. -@@ -1333,6 +1333,7 @@ struct ieee80211_local {
  27552. +@@ -1318,6 +1318,7 @@ struct ieee80211_local {
  27553. int dynamic_ps_forced_timeout;
  27554. int user_power_level; /* in dBm, for all interfaces */
  27555. @@ -97,7 +97,7 @@
  27556. --- a/net/mac80211/main.c
  27557. +++ b/net/mac80211/main.c
  27558. -@@ -98,7 +98,7 @@ static u32 ieee80211_hw_conf_chan(struct
  27559. +@@ -95,7 +95,7 @@ static u32 ieee80211_hw_conf_chan(struct
  27560. struct ieee80211_sub_if_data *sdata;
  27561. struct cfg80211_chan_def chandef = {};
  27562. u32 changed = 0;
  27563. @@ -106,7 +106,7 @@
  27564. u32 offchannel_flag;
  27565. offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
  27566. -@@ -155,6 +155,12 @@ static u32 ieee80211_hw_conf_chan(struct
  27567. +@@ -152,6 +152,12 @@ static u32 ieee80211_hw_conf_chan(struct
  27568. }
  27569. rcu_read_unlock();
  27570. @@ -119,7 +119,7 @@
  27571. if (local->hw.conf.power_level != power) {
  27572. changed |= IEEE80211_CONF_CHANGE_POWER;
  27573. local->hw.conf.power_level = power;
  27574. -@@ -578,6 +584,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
  27575. +@@ -581,6 +587,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
  27576. IEEE80211_RADIOTAP_MCS_HAVE_BW;
  27577. local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI |
  27578. IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH;
  27579. @@ -129,7 +129,7 @@
  27580. local->user_power_level = IEEE80211_UNSET_POWER_LEVEL;
  27581. --- a/net/wireless/nl80211.c
  27582. +++ b/net/wireless/nl80211.c
  27583. -@@ -400,6 +400,7 @@ static const struct nla_policy nl80211_p
  27584. +@@ -402,6 +402,7 @@ static const struct nla_policy nl80211_p
  27585. [NL80211_ATTR_NETNS_FD] = { .type = NLA_U32 },
  27586. [NL80211_ATTR_SCHED_SCAN_DELAY] = { .type = NLA_U32 },
  27587. [NL80211_ATTR_REG_INDOOR] = { .type = NLA_FLAG },
  27588. @@ -137,7 +137,7 @@
  27589. };
  27590. /* policy for the key attributes */
  27591. -@@ -2206,6 +2207,20 @@ static int nl80211_set_wiphy(struct sk_b
  27592. +@@ -2207,6 +2208,20 @@ static int nl80211_set_wiphy(struct sk_b
  27593. if (result)
  27594. return result;
  27595. }
  27596. diff --git a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  27597. index 7512811..3cfffa0 100644
  27598. --- a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  27599. +++ b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  27600. @@ -1,6 +1,6 @@
  27601. --- a/drivers/net/wireless/ath/ath9k/ath9k.h
  27602. +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  27603. -@@ -814,6 +814,9 @@ static inline int ath9k_dump_btcoex(stru
  27604. +@@ -806,6 +806,9 @@ static inline int ath9k_dump_btcoex(stru
  27605. void ath_init_leds(struct ath_softc *sc);
  27606. void ath_deinit_leds(struct ath_softc *sc);
  27607. void ath_fill_led_pin(struct ath_softc *sc);
  27608. @@ -10,7 +10,7 @@
  27609. #else
  27610. static inline void ath_init_leds(struct ath_softc *sc)
  27611. {
  27612. -@@ -953,6 +956,13 @@ void ath_ant_comb_scan(struct ath_softc
  27613. +@@ -945,6 +948,13 @@ void ath_ant_comb_scan(struct ath_softc
  27614. #define ATH9K_NUM_CHANCTX 2 /* supports 2 operating channels */
  27615. @@ -24,7 +24,7 @@
  27616. struct ath_softc {
  27617. struct ieee80211_hw *hw;
  27618. struct device *dev;
  27619. -@@ -1004,9 +1014,8 @@ struct ath_softc {
  27620. +@@ -996,9 +1006,8 @@ struct ath_softc {
  27621. spinlock_t chan_lock;
  27622. #ifdef CPTCFG_MAC80211_LEDS
  27623. @@ -165,7 +165,7 @@
  27624. void ath_fill_led_pin(struct ath_softc *sc)
  27625. --- a/drivers/net/wireless/ath/ath9k/init.c
  27626. +++ b/drivers/net/wireless/ath/ath9k/init.c
  27627. -@@ -936,7 +936,7 @@ int ath9k_init_device(u16 devid, struct
  27628. +@@ -944,7 +944,7 @@ int ath9k_init_device(u16 devid, struct
  27629. #ifdef CPTCFG_MAC80211_LEDS
  27630. /* must be initialized before ieee80211_register_hw */
  27631. diff --git a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  27632. index 08c5a0f..2b2c763 100644
  27633. --- a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  27634. +++ b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  27635. @@ -62,7 +62,7 @@
  27636. debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy,
  27637. --- a/drivers/net/wireless/ath/ath9k/hw.h
  27638. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  27639. -@@ -513,6 +513,12 @@ enum {
  27640. +@@ -519,6 +519,12 @@ enum {
  27641. ATH9K_RESET_COLD,
  27642. };
  27643. @@ -75,7 +75,7 @@
  27644. struct ath9k_hw_version {
  27645. u32 magic;
  27646. u16 devid;
  27647. -@@ -794,6 +800,8 @@ struct ath_hw {
  27648. +@@ -804,6 +810,8 @@ struct ath_hw {
  27649. u32 rfkill_polarity;
  27650. u32 ah_flags;
  27651. @@ -84,7 +84,7 @@
  27652. bool reset_power_on;
  27653. bool htc_reset_init;
  27654. -@@ -1055,6 +1063,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
  27655. +@@ -1066,6 +1074,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
  27656. bool ath9k_hw_check_alive(struct ath_hw *ah);
  27657. bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode);
  27658. @@ -94,7 +94,7 @@
  27659. struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah,
  27660. --- a/drivers/net/wireless/ath/ath9k/hw.c
  27661. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  27662. -@@ -1804,6 +1804,20 @@ u32 ath9k_hw_get_tsf_offset(struct times
  27663. +@@ -1808,6 +1808,20 @@ u32 ath9k_hw_get_tsf_offset(struct times
  27664. }
  27665. EXPORT_SYMBOL(ath9k_hw_get_tsf_offset);
  27666. @@ -115,7 +115,7 @@
  27667. int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
  27668. struct ath9k_hw_cal_data *caldata, bool fastcc)
  27669. {
  27670. -@@ -2012,6 +2026,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  27671. +@@ -2016,6 +2030,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  27672. ar9003_hw_disable_phy_restart(ah);
  27673. ath9k_hw_apply_gpio_override(ah);
  27674. diff --git a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  27675. index 8c9b34c..fddaf56 100644
  27676. --- a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  27677. +++ b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  27678. @@ -1,6 +1,6 @@
  27679. --- a/drivers/net/wireless/ath/ath9k/hw.h
  27680. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  27681. -@@ -710,6 +710,7 @@ struct ath_spec_scan {
  27682. +@@ -720,6 +720,7 @@ struct ath_spec_scan {
  27683. * @config_pci_powersave:
  27684. * @calibrate: periodic calibration for NF, ANI, IQ, ADC gain, ADC-DC
  27685. *
  27686. @@ -8,7 +8,7 @@
  27687. * @spectral_scan_config: set parameters for spectral scan and enable/disable it
  27688. * @spectral_scan_trigger: trigger a spectral scan run
  27689. * @spectral_scan_wait: wait for a spectral scan run to finish
  27690. -@@ -732,6 +733,7 @@ struct ath_hw_ops {
  27691. +@@ -742,6 +743,7 @@ struct ath_hw_ops {
  27692. struct ath_hw_antcomb_conf *antconf);
  27693. void (*antdiv_comb_conf_set)(struct ath_hw *ah,
  27694. struct ath_hw_antcomb_conf *antconf);
  27695. @@ -55,7 +55,7 @@
  27696. ops->spectral_scan_config = ar9003_hw_spectral_scan_config;
  27697. --- a/drivers/net/wireless/ath/ath9k/init.c
  27698. +++ b/drivers/net/wireless/ath/ath9k/init.c
  27699. -@@ -703,7 +703,8 @@ static void ath9k_init_txpower_limits(st
  27700. +@@ -710,7 +710,8 @@ static void ath9k_init_txpower_limits(st
  27701. if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
  27702. ath9k_init_band_txpower(sc, IEEE80211_BAND_5GHZ);
  27703. @@ -65,7 +65,7 @@
  27704. }
  27705. static const struct ieee80211_iface_limit if_limits[] = {
  27706. -@@ -896,6 +897,18 @@ static void ath9k_set_hw_capab(struct at
  27707. +@@ -904,6 +905,18 @@ static void ath9k_set_hw_capab(struct at
  27708. SET_IEEE80211_PERM_ADDR(hw, common->macaddr);
  27709. }
  27710. @@ -84,7 +84,7 @@
  27711. int ath9k_init_device(u16 devid, struct ath_softc *sc,
  27712. const struct ath_bus_ops *bus_ops)
  27713. {
  27714. -@@ -941,6 +954,8 @@ int ath9k_init_device(u16 devid, struct
  27715. +@@ -949,6 +962,8 @@ int ath9k_init_device(u16 devid, struct
  27716. ARRAY_SIZE(ath9k_tpt_blink));
  27717. #endif
  27718. @@ -110,7 +110,7 @@
  27719. static inline void ath9k_hw_set_bt_ant_diversity(struct ath_hw *ah, bool enable)
  27720. --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  27721. +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  27722. -@@ -1316,9 +1316,30 @@ void ar5008_hw_init_rate_txpower(struct
  27723. +@@ -1327,9 +1327,30 @@ void ar5008_hw_init_rate_txpower(struct
  27724. }
  27725. }
  27726. @@ -141,7 +141,7 @@
  27727. static const u32 ar5416_cca_regs[6] = {
  27728. AR_PHY_CCA,
  27729. AR_PHY_CH1_CCA,
  27730. -@@ -1333,6 +1354,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
  27731. +@@ -1344,6 +1365,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
  27732. if (ret)
  27733. return ret;
  27734. 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
  27735. index 240b898..6ca642a 100644
  27736. --- a/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch
  27737. +++ b/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch
  27738. @@ -1,6 +1,6 @@
  27739. --- a/drivers/net/wireless/ath/ath9k/hw.c
  27740. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  27741. -@@ -245,6 +245,19 @@ void ath9k_hw_get_channel_centers(struct
  27742. +@@ -246,6 +246,19 @@ void ath9k_hw_get_channel_centers(struct
  27743. centers->synth_center + (extoff * HT40_CHANNEL_CENTER_SHIFT);
  27744. }
  27745. @@ -20,7 +20,7 @@
  27746. /******************/
  27747. /* Chip Revisions */
  27748. /******************/
  27749. -@@ -1382,6 +1395,9 @@ static bool ath9k_hw_set_reset(struct at
  27750. +@@ -1386,6 +1399,9 @@ static bool ath9k_hw_set_reset(struct at
  27751. if (AR_SREV_9100(ah))
  27752. udelay(50);
  27753. @@ -30,7 +30,7 @@
  27754. return true;
  27755. }
  27756. -@@ -1481,6 +1497,9 @@ static bool ath9k_hw_chip_reset(struct a
  27757. +@@ -1485,6 +1501,9 @@ static bool ath9k_hw_chip_reset(struct a
  27758. ar9003_hw_internal_regulator_apply(ah);
  27759. ath9k_hw_init_pll(ah, chan);
  27760. @@ -40,7 +40,7 @@
  27761. return true;
  27762. }
  27763. -@@ -1782,8 +1801,14 @@ static int ath9k_hw_do_fastcc(struct ath
  27764. +@@ -1786,8 +1805,14 @@ static int ath9k_hw_do_fastcc(struct ath
  27765. if (AR_SREV_9271(ah))
  27766. ar9002_hw_load_ani_reg(ah, chan);
  27767. @@ -55,7 +55,7 @@
  27768. return -EINVAL;
  27769. }
  27770. -@@ -2037,6 +2062,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  27771. +@@ -2041,6 +2066,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  27772. ath9k_hw_set_radar_params(ah);
  27773. }
  27774. diff --git a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  27775. index 9610372..bc0aca6 100644
  27776. --- a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  27777. +++ b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  27778. @@ -1,6 +1,6 @@
  27779. --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  27780. +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  27781. -@@ -945,55 +945,6 @@ static bool ar5008_hw_ani_control_new(st
  27782. +@@ -956,55 +956,6 @@ static bool ar5008_hw_ani_control_new(st
  27783. * on == 0 means more noise imm
  27784. */
  27785. u32 on = param ? 1 : 0;
  27786. 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
  27787. index c0dc4fe..15863a6 100644
  27788. --- a/package/kernel/mac80211/patches/600-0001-rt2x00-rt2800lib-move-rt2800_drv_data-declaration-in.patch
  27789. +++ b/package/kernel/mac80211/patches/600-0001-rt2x00-rt2800lib-move-rt2800_drv_data-declaration-in.patch
  27790. @@ -20,32 +20,14 @@ Changes since v1: ---
  27791. drivers/net/wireless/rt2x00/rt2800lib.h | 11 +++++++++++
  27792. 2 files changed, 11 insertions(+), 13 deletions(-)
  27793. ---- a/drivers/net/wireless/rt2x00/rt2800.h
  27794. -+++ b/drivers/net/wireless/rt2x00/rt2800.h
  27795. -@@ -2960,17 +2960,4 @@ enum rt2800_eeprom_word {
  27796. - */
  27797. - #define BCN_TBTT_OFFSET 64
  27798. -
  27799. --/*
  27800. -- * RT2800 driver data structure
  27801. -- */
  27802. --struct rt2800_drv_data {
  27803. -- u8 calibration_bw20;
  27804. -- u8 calibration_bw40;
  27805. -- u8 bbp25;
  27806. -- u8 bbp26;
  27807. -- u8 txmixer_gain_24g;
  27808. -- u8 txmixer_gain_5g;
  27809. -- unsigned int tbtt_tick;
  27810. --};
  27811. --
  27812. - #endif /* RT2800_H */
  27813. --- a/drivers/net/wireless/rt2x00/rt2800lib.h
  27814. +++ b/drivers/net/wireless/rt2x00/rt2800lib.h
  27815. -@@ -20,6 +20,17 @@
  27816. +@@ -20,6 +20,20 @@
  27817. #ifndef RT2800LIB_H
  27818. #define RT2800LIB_H
  27819. ++#include "rt2800.h"
  27820. ++
  27821. +/* RT2800 driver data structure */
  27822. +struct rt2800_drv_data {
  27823. + u8 calibration_bw20;
  27824. @@ -55,8 +37,30 @@ Changes since v1: ---
  27825. + u8 txmixer_gain_24g;
  27826. + u8 txmixer_gain_5g;
  27827. + unsigned int tbtt_tick;
  27828. ++ DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  27829. +};
  27830. +
  27831. struct rt2800_ops {
  27832. void (*register_read)(struct rt2x00_dev *rt2x00dev,
  27833. const unsigned int offset, u32 *value);
  27834. +--- a/drivers/net/wireless/rt2x00/rt2800.h
  27835. ++++ b/drivers/net/wireless/rt2x00/rt2800.h
  27836. +@@ -2969,18 +2969,4 @@ enum rt2800_eeprom_word {
  27837. + #define WCID_END 222
  27838. + #define STA_IDS_SIZE (WCID_END - WCID_START + 2)
  27839. +
  27840. +-/*
  27841. +- * RT2800 driver data structure
  27842. +- */
  27843. +-struct rt2800_drv_data {
  27844. +- u8 calibration_bw20;
  27845. +- u8 calibration_bw40;
  27846. +- u8 bbp25;
  27847. +- u8 bbp26;
  27848. +- u8 txmixer_gain_24g;
  27849. +- u8 txmixer_gain_5g;
  27850. +- unsigned int tbtt_tick;
  27851. +- DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  27852. +-};
  27853. +-
  27854. + #endif /* RT2800_H */
  27855. 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
  27856. index 6bad6ac..9165eec 100644
  27857. --- a/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch
  27858. +++ b/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch
  27859. @@ -24,7 +24,7 @@ Changes since v1:
  27860. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  27861. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  27862. -@@ -7747,6 +7747,7 @@ static int rt2800_probe_rt(struct rt2x00
  27863. +@@ -7721,6 +7721,7 @@ static int rt2800_probe_rt(struct rt2x00
  27864. int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
  27865. {
  27866. @@ -32,7 +32,7 @@ Changes since v1:
  27867. int retval;
  27868. u32 reg;
  27869. -@@ -7754,6 +7755,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  27870. +@@ -7728,6 +7729,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  27871. if (retval)
  27872. return retval;
  27873. @@ -44,9 +44,9 @@ Changes since v1:
  27874. */
  27875. --- a/drivers/net/wireless/rt2x00/rt2800lib.h
  27876. +++ b/drivers/net/wireless/rt2x00/rt2800lib.h
  27877. -@@ -20,6 +20,10 @@
  27878. - #ifndef RT2800LIB_H
  27879. - #define RT2800LIB_H
  27880. +@@ -22,6 +22,10 @@
  27881. +
  27882. + #include "rt2800.h"
  27883. +enum rt2800_flag {
  27884. + RT2800_HAS_HIGH_SHARED_MEM,
  27885. @@ -55,16 +55,16 @@ Changes since v1:
  27886. /* RT2800 driver data structure */
  27887. struct rt2800_drv_data {
  27888. u8 calibration_bw20;
  27889. -@@ -29,6 +33,8 @@ struct rt2800_drv_data {
  27890. - u8 txmixer_gain_24g;
  27891. +@@ -32,6 +36,8 @@ struct rt2800_drv_data {
  27892. u8 txmixer_gain_5g;
  27893. unsigned int tbtt_tick;
  27894. + DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  27895. +
  27896. + unsigned long rt2800_flags;
  27897. };
  27898. struct rt2800_ops {
  27899. -@@ -61,6 +67,13 @@ struct rt2800_ops {
  27900. +@@ -64,6 +70,13 @@ struct rt2800_ops {
  27901. __le32 *(*drv_get_txwi)(struct queue_entry *entry);
  27902. };
  27903. 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
  27904. index 9f8dfcc..5671515 100644
  27905. --- a/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch
  27906. +++ b/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch
  27907. @@ -175,7 +175,7 @@ Changes since v1: ---
  27908. /*
  27909. * Update WCID information
  27910. -@@ -1437,8 +1467,11 @@ int rt2800_config_pairwise_key(struct rt
  27911. +@@ -1405,8 +1435,11 @@ int rt2800_config_pairwise_key(struct rt
  27912. sizeof(key_entry.rx_mic));
  27913. offset = PAIRWISE_KEY_ENTRY(key->hw_key_idx);
  27914. @@ -187,7 +187,7 @@ Changes since v1: ---
  27915. }
  27916. /*
  27917. -@@ -4908,14 +4941,19 @@ static int rt2800_init_registers(struct
  27918. +@@ -4884,14 +4917,19 @@ static int rt2800_init_registers(struct
  27919. /*
  27920. * ASIC will keep garbage value after boot, clear encryption keys.
  27921. */
  27922. @@ -207,7 +207,7 @@ Changes since v1: ---
  27923. }
  27924. /*
  27925. -@@ -5041,8 +5079,10 @@ static int rt2800_wait_bbp_ready(struct
  27926. +@@ -5017,8 +5055,10 @@ static int rt2800_wait_bbp_ready(struct
  27927. * BBP was enabled after firmware was loaded,
  27928. * but we need to reactivate it now.
  27929. */
  27930. @@ -218,7 +218,7 @@ Changes since v1: ---
  27931. msleep(1);
  27932. for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
  27933. -@@ -6738,11 +6778,19 @@ int rt2800_enable_radio(struct rt2x00_de
  27934. +@@ -6714,11 +6754,19 @@ int rt2800_enable_radio(struct rt2x00_de
  27935. /*
  27936. * Send signal during boot time to initialize firmware.
  27937. */
  27938. @@ -239,7 +239,7 @@ Changes since v1: ---
  27939. msleep(1);
  27940. /*
  27941. -@@ -7751,6 +7799,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  27942. +@@ -7725,6 +7773,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  27943. int retval;
  27944. u32 reg;
  27945. @@ -248,22 +248,22 @@ Changes since v1: ---
  27946. retval = rt2800_probe_rt(rt2x00dev);
  27947. if (retval)
  27948. return retval;
  27949. -@@ -7830,8 +7880,11 @@ void rt2800_get_tkip_seq(struct ieee8021
  27950. - u32 offset;
  27951. +@@ -7808,8 +7858,11 @@ void rt2800_get_key_seq(struct ieee80211
  27952. + return;
  27953. - offset = MAC_IVEIV_ENTRY(hw_key_idx);
  27954. + offset = MAC_IVEIV_ENTRY(key->hw_key_idx);
  27955. +
  27956. + rt2800_shared_mem_lock(rt2x00dev);
  27957. rt2800_register_multiread(rt2x00dev, offset,
  27958. &iveiv_entry, sizeof(iveiv_entry));
  27959. + rt2800_shared_mem_unlock(rt2x00dev);
  27960. - memcpy(iv16, &iveiv_entry.iv[0], sizeof(*iv16));
  27961. - memcpy(iv32, &iveiv_entry.iv[4], sizeof(*iv32));
  27962. + memcpy(&seq->tkip.iv16, &iveiv_entry.iv[0], 2);
  27963. + memcpy(&seq->tkip.iv32, &iveiv_entry.iv[4], 4);
  27964. --- a/drivers/net/wireless/rt2x00/rt2800lib.h
  27965. +++ b/drivers/net/wireless/rt2x00/rt2800lib.h
  27966. -@@ -35,6 +35,11 @@ struct rt2800_drv_data {
  27967. - unsigned int tbtt_tick;
  27968. +@@ -38,6 +38,11 @@ struct rt2800_drv_data {
  27969. + DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  27970. unsigned long rt2800_flags;
  27971. +
  27972. @@ -274,7 +274,7 @@ Changes since v1: ---
  27973. };
  27974. struct rt2800_ops {
  27975. -@@ -65,6 +70,10 @@ struct rt2800_ops {
  27976. +@@ -68,6 +73,10 @@ struct rt2800_ops {
  27977. const u8 *data, const size_t len);
  27978. int (*drv_init_registers)(struct rt2x00_dev *rt2x00dev);
  27979. __le32 *(*drv_get_txwi)(struct queue_entry *entry);
  27980. @@ -285,7 +285,7 @@ Changes since v1: ---
  27981. };
  27982. static inline bool rt2800_has_high_shared_mem(struct rt2x00_dev *rt2x00dev)
  27983. -@@ -74,6 +83,29 @@ static inline bool rt2800_has_high_share
  27984. +@@ -77,6 +86,29 @@ static inline bool rt2800_has_high_share
  27985. return test_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  27986. }
  27987. @@ -486,7 +486,7 @@ Changes since v1: ---
  27988. /*
  27989. * Queue handlers.
  27990. */
  27991. -@@ -294,8 +315,10 @@ static int rt2800usb_write_firmware(stru
  27992. +@@ -299,8 +320,10 @@ static int rt2800usb_write_firmware(stru
  27993. data + offset, length);
  27994. }
  27995. @@ -497,7 +497,7 @@ Changes since v1: ---
  27996. /*
  27997. * Send firmware request to device to load firmware,
  27998. -@@ -310,7 +333,10 @@ static int rt2800usb_write_firmware(stru
  27999. +@@ -315,7 +338,10 @@ static int rt2800usb_write_firmware(stru
  28000. }
  28001. msleep(10);
  28002. @@ -508,7 +508,7 @@ Changes since v1: ---
  28003. return 0;
  28004. }
  28005. -@@ -328,8 +354,10 @@ static int rt2800usb_init_registers(stru
  28006. +@@ -333,8 +359,10 @@ static int rt2800usb_init_registers(stru
  28007. if (rt2800_wait_csr_ready(rt2x00dev))
  28008. return -EBUSY;
  28009. @@ -519,7 +519,7 @@ Changes since v1: ---
  28010. reg = 0;
  28011. rt2x00_set_field32(&reg, MAC_SYS_CTRL_RESET_CSR, 1);
  28012. -@@ -859,6 +887,9 @@ static const struct rt2800_ops rt2800usb
  28013. +@@ -863,6 +891,9 @@ static const struct rt2800_ops rt2800usb
  28014. .drv_write_firmware = rt2800usb_write_firmware,
  28015. .drv_init_registers = rt2800usb_init_registers,
  28016. .drv_get_txwi = rt2800usb_get_txwi,
  28017. 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
  28018. index e7eb630..d04998a 100644
  28019. --- a/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch
  28020. +++ b/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch
  28021. @@ -24,7 +24,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28022. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28023. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28024. -@@ -4638,6 +4638,7 @@ EXPORT_SYMBOL_GPL(rt2800_link_tuner);
  28025. +@@ -4614,6 +4614,7 @@ EXPORT_SYMBOL_GPL(rt2800_link_tuner);
  28026. */
  28027. static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
  28028. {
  28029. @@ -32,7 +32,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28030. u32 reg;
  28031. u16 eeprom;
  28032. unsigned int i;
  28033. -@@ -5003,7 +5004,7 @@ static int rt2800_init_registers(struct
  28034. +@@ -4979,7 +4980,7 @@ static int rt2800_init_registers(struct
  28035. /*
  28036. * Clear all beacons
  28037. */
  28038. @@ -41,7 +41,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28039. rt2800_clear_beacon_register(rt2x00dev, i);
  28040. if (rt2x00_is_usb(rt2x00dev)) {
  28041. -@@ -7852,6 +7853,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  28042. +@@ -7826,6 +7827,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  28043. if (rt2x00_rt(rt2x00dev, RT3593))
  28044. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  28045. @@ -52,11 +52,11 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28046. */
  28047. --- a/drivers/net/wireless/rt2x00/rt2800lib.h
  28048. +++ b/drivers/net/wireless/rt2x00/rt2800lib.h
  28049. -@@ -33,6 +33,7 @@ struct rt2800_drv_data {
  28050. +@@ -35,6 +35,7 @@ struct rt2800_drv_data {
  28051. u8 txmixer_gain_24g;
  28052. u8 txmixer_gain_5g;
  28053. unsigned int tbtt_tick;
  28054. + unsigned int hw_beacon_count;
  28055. + DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  28056. unsigned long rt2800_flags;
  28057. -
  28058. 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
  28059. index b79b4be..f5231f0 100644
  28060. --- a/package/kernel/mac80211/patches/600-0006-rt2x00-rt2800lib-init-additional-beacon-offset-regis.patch
  28061. +++ b/package/kernel/mac80211/patches/600-0006-rt2x00-rt2800lib-init-additional-beacon-offset-regis.patch
  28062. @@ -34,7 +34,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28063. */
  28064. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28065. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28066. -@@ -4650,6 +4650,30 @@ static int rt2800_init_registers(struct
  28067. +@@ -4626,6 +4626,30 @@ static int rt2800_init_registers(struct
  28068. if (ret)
  28069. return ret;
  28070. 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
  28071. index 180c5e3..4b21eae 100644
  28072. --- a/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch
  28073. +++ b/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch
  28074. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28075. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28076. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28077. -@@ -7877,7 +7877,10 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  28078. +@@ -7851,7 +7851,10 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  28079. if (rt2x00_rt(rt2x00dev, RT3593))
  28080. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  28081. 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
  28082. index 31aa34a..e77cd86 100644
  28083. --- a/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch
  28084. +++ b/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch
  28085. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28086. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28087. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28088. -@@ -7847,6 +7847,7 @@ static int rt2800_probe_rt(struct rt2x00
  28089. +@@ -7821,6 +7821,7 @@ static int rt2800_probe_rt(struct rt2x00
  28090. case RT3390:
  28091. case RT3572:
  28092. case RT3593:
  28093. 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
  28094. index a90c590..780c1dd 100644
  28095. --- a/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
  28096. +++ b/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
  28097. @@ -31,7 +31,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28098. #define RF5370 0x5370
  28099. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28100. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28101. -@@ -7465,6 +7465,66 @@ static const struct rf_channel rf_vals_3
  28102. +@@ -7441,6 +7441,66 @@ static const struct rf_channel rf_vals_3
  28103. {173, 0x61, 0, 9},
  28104. };
  28105. @@ -98,7 +98,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28106. static const struct rf_channel rf_vals_5592_xtal20[] = {
  28107. /* Channel, N, K, mod, R */
  28108. {1, 482, 4, 10, 3},
  28109. -@@ -7694,6 +7754,11 @@ static int rt2800_probe_hw_mode(struct r
  28110. +@@ -7668,6 +7728,11 @@ static int rt2800_probe_hw_mode(struct r
  28111. spec->channels = rf_vals_3x;
  28112. break;
  28113. 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
  28114. index ab2673b..858dece 100644
  28115. --- a/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
  28116. +++ b/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
  28117. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28118. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28119. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28120. -@@ -4402,6 +4402,7 @@ void rt2800_vco_calibration(struct rt2x0
  28121. +@@ -4378,6 +4378,7 @@ void rt2800_vco_calibration(struct rt2x0
  28122. case RF3053:
  28123. case RF3070:
  28124. case RF3290:
  28125. @@ -18,7 +18,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28126. case RF5360:
  28127. case RF5362:
  28128. case RF5370:
  28129. -@@ -7873,6 +7874,7 @@ static int rt2800_probe_hw_mode(struct r
  28130. +@@ -7847,6 +7848,7 @@ static int rt2800_probe_hw_mode(struct r
  28131. case RF3053:
  28132. case RF3070:
  28133. case RF3290:
  28134. 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
  28135. index 05ed444..ed82e44 100644
  28136. --- a/package/kernel/mac80211/patches/600-0012-rt2x00-rt2800lib-add-channel-configuration-function-.patch
  28137. +++ b/package/kernel/mac80211/patches/600-0012-rt2x00-rt2800lib-add-channel-configuration-function-.patch
  28138. @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28139. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28140. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28141. -@@ -2649,6 +2649,211 @@ static void rt2800_config_channel_rf3053
  28142. +@@ -2625,6 +2625,211 @@ static void rt2800_config_channel_rf3053
  28143. }
  28144. }
  28145. @@ -223,7 +223,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28146. #define POWER_BOUND 0x27
  28147. #define POWER_BOUND_5G 0x2b
  28148. -@@ -3261,6 +3466,9 @@ static void rt2800_config_channel(struct
  28149. +@@ -3237,6 +3442,9 @@ static void rt2800_config_channel(struct
  28150. case RF3322:
  28151. rt2800_config_channel_rf3322(rt2x00dev, conf, rf, info);
  28152. break;
  28153. 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
  28154. index 3b50775..33cbc4c 100644
  28155. --- a/package/kernel/mac80211/patches/600-0013-rt2x00-rt2800lib-enable-RF3853-support.patch
  28156. +++ b/package/kernel/mac80211/patches/600-0013-rt2x00-rt2800lib-enable-RF3853-support.patch
  28157. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28158. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28159. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28160. -@@ -7430,6 +7430,7 @@ static int rt2800_init_eeprom(struct rt2
  28161. +@@ -7406,6 +7406,7 @@ static int rt2800_init_eeprom(struct rt2
  28162. case RF3290:
  28163. case RF3320:
  28164. case RF3322:
  28165. 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
  28166. index 4dfb068..c3a4798 100644
  28167. --- a/package/kernel/mac80211/patches/600-0014-rt2x00-rt2800lib-add-MAC-register-initialization-for.patch
  28168. +++ b/package/kernel/mac80211/patches/600-0014-rt2x00-rt2800lib-add-MAC-register-initialization-for.patch
  28169. @@ -35,7 +35,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28170. #define RX_FILTER_CFG 0x1400
  28171. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28172. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28173. -@@ -5005,6 +5005,12 @@ static int rt2800_init_registers(struct
  28174. +@@ -4981,6 +4981,12 @@ static int rt2800_init_registers(struct
  28175. rt2800_register_write(rt2x00dev, TX_SW_CFG2,
  28176. 0x00000000);
  28177. }
  28178. @@ -48,7 +48,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28179. } else if (rt2x00_rt(rt2x00dev, RT5390) ||
  28180. rt2x00_rt(rt2x00dev, RT5392) ||
  28181. rt2x00_rt(rt2x00dev, RT5592)) {
  28182. -@@ -5035,9 +5041,11 @@ static int rt2800_init_registers(struct
  28183. +@@ -5011,9 +5017,11 @@ static int rt2800_init_registers(struct
  28184. rt2800_register_read(rt2x00dev, MAX_LEN_CFG, &reg);
  28185. rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_MPDU, AGGREGATION_SIZE);
  28186. @@ -63,7 +63,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28187. rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 2);
  28188. else
  28189. rt2x00_set_field32(&reg, MAX_LEN_CFG_MAX_PSDU, 1);
  28190. -@@ -5190,6 +5198,11 @@ static int rt2800_init_registers(struct
  28191. +@@ -5166,6 +5174,11 @@ static int rt2800_init_registers(struct
  28192. reg = rt2x00_rt(rt2x00dev, RT5592) ? 0x00000082 : 0x00000002;
  28193. rt2800_register_write(rt2x00dev, TXOP_HLDR_ET, reg);
  28194. 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
  28195. index 6663b78..e647777 100644
  28196. --- a/package/kernel/mac80211/patches/600-0016-rt2x00-rt2800lib-add-BBP-register-initialization-for.patch
  28197. +++ b/package/kernel/mac80211/patches/600-0016-rt2x00-rt2800lib-add-BBP-register-initialization-for.patch
  28198. @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28199. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28200. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28201. -@@ -5808,6 +5808,47 @@ static void rt2800_init_bbp_3593(struct
  28202. +@@ -5784,6 +5784,47 @@ static void rt2800_init_bbp_3593(struct
  28203. rt2800_bbp_write(rt2x00dev, 103, 0xc0);
  28204. }
  28205. @@ -59,7 +59,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28206. static void rt2800_init_bbp_53xx(struct rt2x00_dev *rt2x00dev)
  28207. {
  28208. int ant, div_mode;
  28209. -@@ -6026,6 +6067,9 @@ static void rt2800_init_bbp(struct rt2x0
  28210. +@@ -6002,6 +6043,9 @@ static void rt2800_init_bbp(struct rt2x0
  28211. case RT3593:
  28212. rt2800_init_bbp_3593(rt2x00dev);
  28213. return;
  28214. 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
  28215. index 6e66f14..0fec3cd 100644
  28216. --- a/package/kernel/mac80211/patches/600-0017-rt2x00-rt2800lib-add-RFCSR-initialization-for-RT3883.patch
  28217. +++ b/package/kernel/mac80211/patches/600-0017-rt2x00-rt2800lib-add-RFCSR-initialization-for-RT3883.patch
  28218. @@ -21,7 +21,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28219. /*
  28220. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28221. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28222. -@@ -6843,6 +6843,144 @@ static void rt2800_init_rfcsr_3593(struc
  28223. +@@ -6819,6 +6819,144 @@ static void rt2800_init_rfcsr_3593(struc
  28224. /* TODO: enable stream mode support */
  28225. }
  28226. @@ -166,7 +166,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28227. static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
  28228. {
  28229. rt2800_rf_init_calibration(rt2x00dev, 2);
  28230. -@@ -7074,6 +7212,9 @@ static void rt2800_init_rfcsr(struct rt2
  28231. +@@ -7050,6 +7188,9 @@ static void rt2800_init_rfcsr(struct rt2
  28232. case RT3390:
  28233. rt2800_init_rfcsr_3390(rt2x00dev);
  28234. break;
  28235. 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
  28236. index 9390f7e..c9d1e06 100644
  28237. --- a/package/kernel/mac80211/patches/600-0019-rt2x00-rt2800lib-force-rf-type-to-RF3853-on-RT3883.patch
  28238. +++ b/package/kernel/mac80211/patches/600-0019-rt2x00-rt2800lib-force-rf-type-to-RF3853-on-RT3883.patch
  28239. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28240. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28241. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28242. -@@ -7611,6 +7611,8 @@ static int rt2800_init_eeprom(struct rt2
  28243. +@@ -7587,6 +7587,8 @@ static int rt2800_init_eeprom(struct rt2
  28244. rt2x00_rt(rt2x00dev, RT5390) ||
  28245. rt2x00_rt(rt2x00dev, RT5392))
  28246. rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &rf);
  28247. 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
  28248. index 1cba4f6..12b9c33 100644
  28249. --- a/package/kernel/mac80211/patches/600-0020-rt2x00-rt2800lib-add-channel-configuration-code-for-.patch
  28250. +++ b/package/kernel/mac80211/patches/600-0020-rt2x00-rt2800lib-add-channel-configuration-code-for-.patch
  28251. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28252. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28253. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28254. -@@ -3429,6 +3429,36 @@ static char rt2800_txpower_to_dev(struct
  28255. +@@ -3405,6 +3405,36 @@ static char rt2800_txpower_to_dev(struct
  28256. return clamp_t(char, txpower, MIN_A_TXPOWER, MAX_A_TXPOWER);
  28257. }
  28258. @@ -47,7 +47,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28259. static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
  28260. struct ieee80211_conf *conf,
  28261. struct rf_channel *rf,
  28262. -@@ -3447,6 +3477,12 @@ static void rt2800_config_channel(struct
  28263. +@@ -3423,6 +3453,12 @@ static void rt2800_config_channel(struct
  28264. rt2800_txpower_to_dev(rt2x00dev, rf->channel,
  28265. info->default_power3);
  28266. @@ -60,7 +60,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28267. switch (rt2x00dev->chip.rf) {
  28268. case RF2020:
  28269. case RF3020:
  28270. -@@ -3530,6 +3566,15 @@ static void rt2800_config_channel(struct
  28271. +@@ -3506,6 +3542,15 @@ static void rt2800_config_channel(struct
  28272. rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain);
  28273. rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain);
  28274. rt2800_bbp_write(rt2x00dev, 77, 0x98);
  28275. @@ -76,7 +76,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28276. } else {
  28277. rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain);
  28278. rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain);
  28279. -@@ -3542,6 +3587,7 @@ static void rt2800_config_channel(struct
  28280. +@@ -3518,6 +3563,7 @@ static void rt2800_config_channel(struct
  28281. !rt2x00_rt(rt2x00dev, RT5392)) {
  28282. if (rt2x00_has_cap_external_lna_bg(rt2x00dev)) {
  28283. rt2800_bbp_write(rt2x00dev, 82, 0x62);
  28284. @@ -84,7 +84,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28285. rt2800_bbp_write(rt2x00dev, 75, 0x46);
  28286. } else {
  28287. if (rt2x00_rt(rt2x00dev, RT3593))
  28288. -@@ -3550,19 +3596,22 @@ static void rt2800_config_channel(struct
  28289. +@@ -3526,19 +3572,22 @@ static void rt2800_config_channel(struct
  28290. rt2800_bbp_write(rt2x00dev, 82, 0x84);
  28291. rt2800_bbp_write(rt2x00dev, 75, 0x50);
  28292. }
  28293. @@ -110,7 +110,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28294. rt2800_bbp_write(rt2x00dev, 83, 0x9a);
  28295. if (rt2x00_has_cap_external_lna_a(rt2x00dev))
  28296. -@@ -3684,6 +3733,23 @@ static void rt2800_config_channel(struct
  28297. +@@ -3660,6 +3709,23 @@ static void rt2800_config_channel(struct
  28298. rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg);
  28299. 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
  28300. index 1773128..3f40b4e 100644
  28301. --- a/package/kernel/mac80211/patches/600-0021-rt2x00-rt2800lib-fix-txpower_to_dev-function-for-RT3.patch
  28302. +++ b/package/kernel/mac80211/patches/600-0021-rt2x00-rt2800lib-fix-txpower_to_dev-function-for-RT3.patch
  28303. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28304. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28305. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28306. -@@ -3416,13 +3416,15 @@ static char rt2800_txpower_to_dev(struct
  28307. +@@ -3392,13 +3392,15 @@ static char rt2800_txpower_to_dev(struct
  28308. unsigned int channel,
  28309. char txpower)
  28310. {
  28311. 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
  28312. index 36f0a4c..52baeec 100644
  28313. --- a/package/kernel/mac80211/patches/600-0022-rt2x00-rt2800lib-use-correct-txpower-calculation-fun.patch
  28314. +++ b/package/kernel/mac80211/patches/600-0022-rt2x00-rt2800lib-use-correct-txpower-calculation-fun.patch
  28315. @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28316. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28317. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28318. -@@ -4635,7 +4635,8 @@ static void rt2800_config_txpower(struct
  28319. +@@ -4611,7 +4611,8 @@ static void rt2800_config_txpower(struct
  28320. struct ieee80211_channel *chan,
  28321. int power_level)
  28322. {
  28323. 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
  28324. index 8119f97..b9dafc6 100644
  28325. --- a/package/kernel/mac80211/patches/600-0023-rt2x00-rt2800lib-hardcode-txmixer-gain-values-to-zer.patch
  28326. +++ b/package/kernel/mac80211/patches/600-0023-rt2x00-rt2800lib-hardcode-txmixer-gain-values-to-zer.patch
  28327. @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28328. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28329. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28330. -@@ -7493,7 +7493,8 @@ static u8 rt2800_get_txmixer_gain_24g(st
  28331. +@@ -7469,7 +7469,8 @@ static u8 rt2800_get_txmixer_gain_24g(st
  28332. {
  28333. u16 word;
  28334. @@ -21,7 +21,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28335. return 0;
  28336. rt2800_eeprom_read(rt2x00dev, EEPROM_TXMIXER_GAIN_BG, &word);
  28337. -@@ -7507,7 +7508,8 @@ static u8 rt2800_get_txmixer_gain_5g(str
  28338. +@@ -7483,7 +7484,8 @@ static u8 rt2800_get_txmixer_gain_5g(str
  28339. {
  28340. u16 word;
  28341. 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
  28342. index dfbdee7..f09f803 100644
  28343. --- a/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch
  28344. +++ b/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch
  28345. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28346. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28347. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28348. -@@ -8428,7 +8428,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  28349. +@@ -8402,7 +8402,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  28350. if (rt2x00_rt(rt2x00dev, RT3593))
  28351. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  28352. 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
  28353. index 22f7110..f7d23fc 100644
  28354. --- a/package/kernel/mac80211/patches/600-0027-rt2x00-rt2800lib-fix-antenna-configuration-for-RT388.patch
  28355. +++ b/package/kernel/mac80211/patches/600-0027-rt2x00-rt2800lib-fix-antenna-configuration-for-RT388.patch
  28356. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28357. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28358. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28359. -@@ -1961,7 +1961,8 @@ void rt2800_config_ant(struct rt2x00_dev
  28360. +@@ -1937,7 +1937,8 @@ void rt2800_config_ant(struct rt2x00_dev
  28361. rt2800_bbp_write(rt2x00dev, 3, r3);
  28362. rt2800_bbp_write(rt2x00dev, 1, r1);
  28363. 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
  28364. index 9945f38..4da750e 100644
  28365. --- a/package/kernel/mac80211/patches/600-0028-rt2x00-rt2800lib-fix-LNA-gain-configuration-for-RT38.patch
  28366. +++ b/package/kernel/mac80211/patches/600-0028-rt2x00-rt2800lib-fix-LNA-gain-configuration-for-RT38.patch
  28367. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28368. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28369. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28370. -@@ -1984,7 +1984,8 @@ static void rt2800_config_lna_gain(struc
  28371. +@@ -1960,7 +1960,8 @@ static void rt2800_config_lna_gain(struc
  28372. rt2800_eeprom_read(rt2x00dev, EEPROM_LNA, &eeprom);
  28373. lna_gain = rt2x00_get_field16(eeprom, EEPROM_LNA_A0);
  28374. } else if (libconf->rf.channel <= 128) {
  28375. @@ -20,7 +20,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28376. rt2800_eeprom_read(rt2x00dev, EEPROM_EXT_LNA2, &eeprom);
  28377. lna_gain = rt2x00_get_field16(eeprom,
  28378. EEPROM_EXT_LNA2_A1);
  28379. -@@ -1994,7 +1995,8 @@ static void rt2800_config_lna_gain(struc
  28380. +@@ -1970,7 +1971,8 @@ static void rt2800_config_lna_gain(struc
  28381. EEPROM_RSSI_BG2_LNA_A1);
  28382. }
  28383. } else {
  28384. 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
  28385. index beadea8..628b237 100644
  28386. --- a/package/kernel/mac80211/patches/600-0029-rt2x00-rt2800lib-fix-VGC-setup-for-RT3883.patch
  28387. +++ b/package/kernel/mac80211/patches/600-0029-rt2x00-rt2800lib-fix-VGC-setup-for-RT3883.patch
  28388. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28389. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28390. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28391. -@@ -4835,7 +4835,8 @@ static u8 rt2800_get_default_vgc(struct
  28392. +@@ -4811,7 +4811,8 @@ static u8 rt2800_get_default_vgc(struct
  28393. else
  28394. vgc = 0x2e + rt2x00dev->lna_gain;
  28395. } else { /* 5GHZ band */
  28396. @@ -20,7 +20,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28397. vgc = 0x20 + (rt2x00dev->lna_gain * 5) / 3;
  28398. else if (rt2x00_rt(rt2x00dev, RT5592))
  28399. vgc = 0x24 + (2 * rt2x00dev->lna_gain);
  28400. -@@ -4855,7 +4856,8 @@ static inline void rt2800_set_vgc(struct
  28401. +@@ -4831,7 +4832,8 @@ static inline void rt2800_set_vgc(struct
  28402. {
  28403. if (qual->vgc_level != vgc_level) {
  28404. if (rt2x00_rt(rt2x00dev, RT3572) ||
  28405. @@ -30,7 +30,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28406. rt2800_bbp_write_with_rx_chain(rt2x00dev, 66,
  28407. vgc_level);
  28408. } else if (rt2x00_rt(rt2x00dev, RT5592)) {
  28409. -@@ -4902,6 +4904,11 @@ void rt2800_link_tuner(struct rt2x00_dev
  28410. +@@ -4878,6 +4880,11 @@ void rt2800_link_tuner(struct rt2x00_dev
  28411. }
  28412. break;
  28413. 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
  28414. index a6c0f58..216b8b6 100644
  28415. --- a/package/kernel/mac80211/patches/600-0030-rt2x00-rt2800lib-fix-EEPROM-LNA-validation-for-RT388.patch
  28416. +++ b/package/kernel/mac80211/patches/600-0030-rt2x00-rt2800lib-fix-EEPROM-LNA-validation-for-RT388.patch
  28417. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28418. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28419. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28420. -@@ -7630,7 +7630,8 @@ static int rt2800_validate_eeprom(struct
  28421. +@@ -7606,7 +7606,8 @@ static int rt2800_validate_eeprom(struct
  28422. rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_BG2, &word);
  28423. if (abs(rt2x00_get_field16(word, EEPROM_RSSI_BG2_OFFSET2)) > 10)
  28424. rt2x00_set_field16(&word, EEPROM_RSSI_BG2_OFFSET2, 0);
  28425. @@ -20,7 +20,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28426. if (rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0x00 ||
  28427. rt2x00_get_field16(word, EEPROM_RSSI_BG2_LNA_A1) == 0xff)
  28428. rt2x00_set_field16(&word, EEPROM_RSSI_BG2_LNA_A1,
  28429. -@@ -7650,7 +7651,8 @@ static int rt2800_validate_eeprom(struct
  28430. +@@ -7626,7 +7627,8 @@ static int rt2800_validate_eeprom(struct
  28431. rt2800_eeprom_read(rt2x00dev, EEPROM_RSSI_A2, &word);
  28432. if (abs(rt2x00_get_field16(word, EEPROM_RSSI_A2_OFFSET2)) > 10)
  28433. rt2x00_set_field16(&word, EEPROM_RSSI_A2_OFFSET2, 0);
  28434. @@ -30,7 +30,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28435. if (rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0x00 ||
  28436. rt2x00_get_field16(word, EEPROM_RSSI_A2_LNA_A2) == 0xff)
  28437. rt2x00_set_field16(&word, EEPROM_RSSI_A2_LNA_A2,
  28438. -@@ -7658,7 +7660,8 @@ static int rt2800_validate_eeprom(struct
  28439. +@@ -7634,7 +7636,8 @@ static int rt2800_validate_eeprom(struct
  28440. }
  28441. rt2800_eeprom_write(rt2x00dev, EEPROM_RSSI_A2, word);
  28442. 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
  28443. index 910f9ec..515086f 100644
  28444. --- a/package/kernel/mac80211/patches/600-0031-rt2x00-rt2800lib-fix-txpower-compensation-for-RT3883.patch
  28445. +++ b/package/kernel/mac80211/patches/600-0031-rt2x00-rt2800lib-fix-txpower-compensation-for-RT3883.patch
  28446. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28447. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28448. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28449. -@@ -4005,6 +4005,9 @@ static u8 rt2800_compensate_txpower(stru
  28450. +@@ -3981,6 +3981,9 @@ static u8 rt2800_compensate_txpower(stru
  28451. if (rt2x00_rt(rt2x00dev, RT3593))
  28452. return min_t(u8, txpower, 0xc);
  28453. 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
  28454. index bcdfc67..77e3f1b 100644
  28455. --- a/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch
  28456. +++ b/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch
  28457. @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  28458. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28459. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28460. -@@ -8441,7 +8441,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  28461. +@@ -8415,7 +8415,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  28462. if (retval)
  28463. return retval;
  28464. diff --git a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  28465. index 8f650a2..44b629f 100644
  28466. --- a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  28467. +++ b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  28468. @@ -1,13 +1,13 @@
  28469. --- a/.local-symbols
  28470. +++ b/.local-symbols
  28471. -@@ -263,6 +263,7 @@ RT2X00_LIB_FIRMWARE=
  28472. +@@ -312,6 +312,7 @@ RT2X00_LIB_FIRMWARE=
  28473. RT2X00_LIB_CRYPTO=
  28474. RT2X00_LIB_LEDS=
  28475. RT2X00_LIB_DEBUGFS=
  28476. +RT2X00_LIB_EEPROM=
  28477. RT2X00_DEBUG=
  28478. - RTL_CARDS=
  28479. - RTL8192CE=
  28480. + WL_MEDIATEK=
  28481. + MT7601U=
  28482. --- a/drivers/net/wireless/rt2x00/Kconfig
  28483. +++ b/drivers/net/wireless/rt2x00/Kconfig
  28484. @@ -69,6 +69,7 @@ config RT2800PCI
  28485. @@ -48,7 +48,7 @@
  28486. obj-$(CPTCFG_RT2X00_LIB_MMIO) += rt2x00mmio.o
  28487. --- a/drivers/net/wireless/rt2x00/rt2800lib.h
  28488. +++ b/drivers/net/wireless/rt2x00/rt2800lib.h
  28489. -@@ -43,6 +43,8 @@ struct rt2800_drv_data {
  28490. +@@ -46,6 +46,8 @@ struct rt2800_drv_data {
  28491. } shmem_lock;
  28492. };
  28493. @@ -57,7 +57,7 @@
  28494. struct rt2800_ops {
  28495. void (*register_read)(struct rt2x00_dev *rt2x00dev,
  28496. const unsigned int offset, u32 *value);
  28497. -@@ -176,6 +178,15 @@ static inline int rt2800_read_eeprom(str
  28498. +@@ -179,6 +181,15 @@ static inline int rt2800_read_eeprom(str
  28499. {
  28500. const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
  28501. 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
  28502. index a35bd55..16a579d 100644
  28503. --- a/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch
  28504. +++ b/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch
  28505. @@ -41,7 +41,7 @@
  28506. * Interrupt context handlers.
  28507. --- a/drivers/net/wireless/rt2x00/rt61pci.c
  28508. +++ b/drivers/net/wireless/rt2x00/rt61pci.c
  28509. -@@ -2392,6 +2392,7 @@ static int rt61pci_validate_eeprom(struc
  28510. +@@ -2390,6 +2390,7 @@ static int rt61pci_validate_eeprom(struc
  28511. u32 reg;
  28512. u16 word;
  28513. u8 *mac;
  28514. @@ -49,7 +49,7 @@
  28515. s8 value;
  28516. rt2x00mmio_register_read(rt2x00dev, E2PROM_CSR, &reg);
  28517. -@@ -2412,7 +2413,11 @@ static int rt61pci_validate_eeprom(struc
  28518. +@@ -2410,7 +2411,11 @@ static int rt61pci_validate_eeprom(struc
  28519. /*
  28520. * Start validation of the data that has been read.
  28521. */
  28522. 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
  28523. index 067d2ea..39b1ccc 100644
  28524. --- a/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
  28525. +++ b/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
  28526. @@ -1,6 +1,6 @@
  28527. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28528. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28529. -@@ -3552,11 +3552,18 @@ static void rt2800_config_channel(struct
  28530. +@@ -3528,11 +3528,18 @@ static void rt2800_config_channel(struct
  28531. /*
  28532. * Change BBP settings
  28533. */
  28534. @@ -19,7 +19,7 @@
  28535. } else if (rt2x00_rt(rt2x00dev, RT3593)) {
  28536. if (rf->channel > 14) {
  28537. /* Disable CCK Packet detection on 5GHz */
  28538. -@@ -6618,6 +6625,12 @@ static void rt2800_init_rfcsr_3290(struc
  28539. +@@ -6594,6 +6601,12 @@ static void rt2800_init_rfcsr_3290(struc
  28540. static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev)
  28541. {
  28542. @@ -32,7 +32,7 @@
  28543. rt2800_rf_init_calibration(rt2x00dev, 30);
  28544. rt2800_rfcsr_write(rt2x00dev, 0, 0xf0);
  28545. -@@ -6653,15 +6666,30 @@ static void rt2800_init_rfcsr_3352(struc
  28546. +@@ -6629,15 +6642,30 @@ static void rt2800_init_rfcsr_3352(struc
  28547. rt2800_rfcsr_write(rt2x00dev, 31, 0x80);
  28548. rt2800_rfcsr_write(rt2x00dev, 32, 0x80);
  28549. rt2800_rfcsr_write(rt2x00dev, 33, 0x00);
  28550. @@ -66,7 +66,7 @@
  28551. rt2800_rfcsr_write(rt2x00dev, 43, 0xdb);
  28552. rt2800_rfcsr_write(rt2x00dev, 44, 0xdb);
  28553. rt2800_rfcsr_write(rt2x00dev, 45, 0xdb);
  28554. -@@ -6669,15 +6697,20 @@ static void rt2800_init_rfcsr_3352(struc
  28555. +@@ -6645,15 +6673,20 @@ static void rt2800_init_rfcsr_3352(struc
  28556. rt2800_rfcsr_write(rt2x00dev, 47, 0x0d);
  28557. rt2800_rfcsr_write(rt2x00dev, 48, 0x14);
  28558. rt2800_rfcsr_write(rt2x00dev, 49, 0x00);
  28559. @@ -96,7 +96,7 @@
  28560. rt2800_rfcsr_write(rt2x00dev, 59, 0x00);
  28561. rt2800_rfcsr_write(rt2x00dev, 60, 0x00);
  28562. rt2800_rfcsr_write(rt2x00dev, 61, 0x00);
  28563. -@@ -7698,6 +7731,7 @@ static int rt2800_init_eeprom(struct rt2
  28564. +@@ -7674,6 +7707,7 @@ static int rt2800_init_eeprom(struct rt2
  28565. * RT53xx: defined in "EEPROM_CHIP_ID" field
  28566. */
  28567. if (rt2x00_rt(rt2x00dev, RT3290) ||
  28568. @@ -104,7 +104,7 @@
  28569. rt2x00_rt(rt2x00dev, RT5390) ||
  28570. rt2x00_rt(rt2x00dev, RT5392))
  28571. rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &rf);
  28572. -@@ -7793,7 +7827,8 @@ static int rt2800_init_eeprom(struct rt2
  28573. +@@ -7769,7 +7803,8 @@ static int rt2800_init_eeprom(struct rt2
  28574. /*
  28575. * Detect if this device has Bluetooth co-existence.
  28576. */
  28577. @@ -114,7 +114,7 @@
  28578. __set_bit(CAPABILITY_BT_COEXIST, &rt2x00dev->cap_flags);
  28579. /*
  28580. -@@ -7822,6 +7857,22 @@ static int rt2800_init_eeprom(struct rt2
  28581. +@@ -7798,6 +7833,22 @@ static int rt2800_init_eeprom(struct rt2
  28582. EIRP_MAX_TX_POWER_LIMIT)
  28583. __set_bit(CAPABILITY_POWER_LIMIT, &rt2x00dev->cap_flags);
  28584. 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
  28585. index 1dcca36..dcecba4 100644
  28586. --- a/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
  28587. +++ b/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
  28588. @@ -1,6 +1,6 @@
  28589. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28590. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28591. -@@ -8209,6 +8209,27 @@ static const struct rf_channel rf_vals_5
  28592. +@@ -8185,6 +8185,27 @@ static const struct rf_channel rf_vals_5
  28593. {196, 83, 0, 12, 1},
  28594. };
  28595. @@ -28,7 +28,7 @@
  28596. static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
  28597. {
  28598. struct hw_mode_spec *spec = &rt2x00dev->spec;
  28599. -@@ -8297,7 +8318,10 @@ static int rt2800_probe_hw_mode(struct r
  28600. +@@ -8271,7 +8292,10 @@ static int rt2800_probe_hw_mode(struct r
  28601. case RF5390:
  28602. case RF5392:
  28603. spec->num_channels = 14;
  28604. @@ -40,7 +40,7 @@
  28605. break;
  28606. case RF3052:
  28607. -@@ -8481,6 +8505,19 @@ static int rt2800_probe_rt(struct rt2x00
  28608. +@@ -8455,6 +8479,19 @@ static int rt2800_probe_rt(struct rt2x00
  28609. return 0;
  28610. }
  28611. @@ -60,7 +60,7 @@
  28612. int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
  28613. {
  28614. struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
  28615. -@@ -8523,6 +8560,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  28616. +@@ -8497,6 +8534,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  28617. rt2800_register_write(rt2x00dev, GPIO_CTRL, reg);
  28618. /*
  28619. diff --git a/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch b/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  28620. index c779a17..9f11862 100644
  28621. --- a/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  28622. +++ b/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  28623. @@ -8,7 +8,7 @@
  28624. #include "rt2x00.h"
  28625. #include "rt2800lib.h"
  28626. -@@ -8507,13 +8508,14 @@ static int rt2800_probe_rt(struct rt2x00
  28627. +@@ -8481,13 +8482,14 @@ static int rt2800_probe_rt(struct rt2x00
  28628. int rt2800_probe_clk(struct rt2x00_dev *rt2x00dev)
  28629. {
  28630. diff --git a/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch b/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  28631. index 840b3bc..9679d71 100644
  28632. --- a/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  28633. +++ b/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  28634. @@ -10,7 +10,7 @@
  28635. #define RF5370 0x5370
  28636. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28637. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28638. -@@ -3038,6 +3038,13 @@ static void rt2800_config_channel_rf53xx
  28639. +@@ -3014,6 +3014,13 @@ static void rt2800_config_channel_rf53xx
  28640. rt2800_rfcsr_write(rt2x00dev, 59,
  28641. r59_non_bt[idx]);
  28642. @@ -24,7 +24,7 @@
  28643. }
  28644. }
  28645. }
  28646. -@@ -3516,6 +3523,7 @@ static void rt2800_config_channel(struct
  28647. +@@ -3492,6 +3499,7 @@ static void rt2800_config_channel(struct
  28648. rt2800_config_channel_rf3853(rt2x00dev, conf, rf, info);
  28649. break;
  28650. case RF3070:
  28651. @@ -32,7 +32,7 @@
  28652. case RF5360:
  28653. case RF5362:
  28654. case RF5370:
  28655. -@@ -3534,6 +3542,7 @@ static void rt2800_config_channel(struct
  28656. +@@ -3510,6 +3518,7 @@ static void rt2800_config_channel(struct
  28657. if (rt2x00_rf(rt2x00dev, RF3070) ||
  28658. rt2x00_rf(rt2x00dev, RF3290) ||
  28659. rt2x00_rf(rt2x00dev, RF3322) ||
  28660. @@ -40,7 +40,7 @@
  28661. rt2x00_rf(rt2x00dev, RF5360) ||
  28662. rt2x00_rf(rt2x00dev, RF5362) ||
  28663. rt2x00_rf(rt2x00dev, RF5370) ||
  28664. -@@ -3812,7 +3821,8 @@ static void rt2800_config_channel(struct
  28665. +@@ -3788,7 +3797,8 @@ static void rt2800_config_channel(struct
  28666. /*
  28667. * Clear update flag
  28668. */
  28669. @@ -50,7 +50,7 @@
  28670. rt2800_bbp_read(rt2x00dev, 49, &bbp);
  28671. rt2x00_set_field8(&bbp, BBP49_UPDATE_FLAG, 0);
  28672. rt2800_bbp_write(rt2x00dev, 49, bbp);
  28673. -@@ -4698,6 +4708,7 @@ void rt2800_vco_calibration(struct rt2x0
  28674. +@@ -4674,6 +4684,7 @@ void rt2800_vco_calibration(struct rt2x0
  28675. case RF3070:
  28676. case RF3290:
  28677. case RF3853:
  28678. @@ -58,7 +58,7 @@
  28679. case RF5360:
  28680. case RF5362:
  28681. case RF5370:
  28682. -@@ -5111,6 +5122,8 @@ static int rt2800_init_registers(struct
  28683. +@@ -5087,6 +5098,8 @@ static int rt2800_init_registers(struct
  28684. rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
  28685. rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);
  28686. rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000);
  28687. @@ -67,7 +67,7 @@
  28688. } else {
  28689. rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000000);
  28690. rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);
  28691. -@@ -5766,9 +5779,13 @@ static void rt2800_init_bbp_3352(struct
  28692. +@@ -5742,9 +5755,13 @@ static void rt2800_init_bbp_3352(struct
  28693. rt2800_bbp_write(rt2x00dev, 82, 0x62);
  28694. @@ -84,7 +84,7 @@
  28695. rt2800_bbp_write(rt2x00dev, 86, 0x38);
  28696. -@@ -5782,9 +5799,13 @@ static void rt2800_init_bbp_3352(struct
  28697. +@@ -5758,9 +5775,13 @@ static void rt2800_init_bbp_3352(struct
  28698. rt2800_bbp_write(rt2x00dev, 104, 0x92);
  28699. @@ -101,7 +101,7 @@
  28700. rt2800_bbp_write(rt2x00dev, 120, 0x50);
  28701. -@@ -5809,6 +5830,13 @@ static void rt2800_init_bbp_3352(struct
  28702. +@@ -5785,6 +5806,13 @@ static void rt2800_init_bbp_3352(struct
  28703. rt2800_bbp_write(rt2x00dev, 143, 0xa2);
  28704. rt2800_bbp_write(rt2x00dev, 148, 0xc8);
  28705. @@ -115,7 +115,7 @@
  28706. }
  28707. static void rt2800_init_bbp_3390(struct rt2x00_dev *rt2x00dev)
  28708. -@@ -6150,6 +6178,7 @@ static void rt2800_init_bbp(struct rt2x0
  28709. +@@ -6126,6 +6154,7 @@ static void rt2800_init_bbp(struct rt2x0
  28710. rt2800_init_bbp_3290(rt2x00dev);
  28711. break;
  28712. case RT3352:
  28713. @@ -123,7 +123,7 @@
  28714. rt2800_init_bbp_3352(rt2x00dev);
  28715. break;
  28716. case RT3390:
  28717. -@@ -7101,6 +7130,76 @@ static void rt2800_init_rfcsr_3883(struc
  28718. +@@ -7077,6 +7106,76 @@ static void rt2800_init_rfcsr_3883(struc
  28719. rt2800_rfcsr_write(rt2x00dev, 20, rfcsr);
  28720. }
  28721. @@ -200,7 +200,7 @@
  28722. static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
  28723. {
  28724. rt2800_rf_init_calibration(rt2x00dev, 2);
  28725. -@@ -7341,6 +7440,9 @@ static void rt2800_init_rfcsr(struct rt2
  28726. +@@ -7317,6 +7416,9 @@ static void rt2800_init_rfcsr(struct rt2
  28727. case RT3593:
  28728. rt2800_init_rfcsr_3593(rt2x00dev);
  28729. break;
  28730. @@ -210,7 +210,7 @@
  28731. case RT5390:
  28732. rt2800_init_rfcsr_5390(rt2x00dev);
  28733. break;
  28734. -@@ -7600,6 +7702,12 @@ static int rt2800_validate_eeprom(struct
  28735. +@@ -7576,6 +7678,12 @@ static int rt2800_validate_eeprom(struct
  28736. rt2x00_set_field16(&word, EEPROM_NIC_CONF0_RF_TYPE, RF2820);
  28737. rt2800_eeprom_write(rt2x00dev, EEPROM_NIC_CONF0, word);
  28738. rt2x00_eeprom_dbg(rt2x00dev, "Antenna: 0x%04x\n", word);
  28739. @@ -223,7 +223,7 @@
  28740. } else if (rt2x00_rt(rt2x00dev, RT2860) ||
  28741. rt2x00_rt(rt2x00dev, RT2872)) {
  28742. /*
  28743. -@@ -7738,6 +7846,8 @@ static int rt2800_init_eeprom(struct rt2
  28744. +@@ -7714,6 +7822,8 @@ static int rt2800_init_eeprom(struct rt2
  28745. rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &rf);
  28746. else if (rt2x00_rt(rt2x00dev, RT3883))
  28747. rf = RF3853;
  28748. @@ -232,7 +232,7 @@
  28749. else
  28750. rf = rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RF_TYPE);
  28751. -@@ -7757,6 +7867,7 @@ static int rt2800_init_eeprom(struct rt2
  28752. +@@ -7733,6 +7843,7 @@ static int rt2800_init_eeprom(struct rt2
  28753. case RF3320:
  28754. case RF3322:
  28755. case RF3853:
  28756. @@ -240,7 +240,7 @@
  28757. case RF5360:
  28758. case RF5362:
  28759. case RF5370:
  28760. -@@ -8312,6 +8423,7 @@ static int rt2800_probe_hw_mode(struct r
  28761. +@@ -8286,6 +8397,7 @@ static int rt2800_probe_hw_mode(struct r
  28762. case RF3290:
  28763. case RF3320:
  28764. case RF3322:
  28765. @@ -248,7 +248,7 @@
  28766. case RF5360:
  28767. case RF5362:
  28768. case RF5370:
  28769. -@@ -8451,6 +8563,7 @@ static int rt2800_probe_hw_mode(struct r
  28770. +@@ -8425,6 +8537,7 @@ static int rt2800_probe_hw_mode(struct r
  28771. case RF3070:
  28772. case RF3290:
  28773. case RF3853:
  28774. @@ -256,7 +256,7 @@
  28775. case RF5360:
  28776. case RF5362:
  28777. case RF5370:
  28778. -@@ -8491,6 +8604,7 @@ static int rt2800_probe_rt(struct rt2x00
  28779. +@@ -8465,6 +8578,7 @@ static int rt2800_probe_rt(struct rt2x00
  28780. case RT3572:
  28781. case RT3593:
  28782. case RT3883:
  28783. 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
  28784. index 13f2048..b085c5e 100644
  28785. --- a/package/kernel/mac80211/patches/619-rt2x00-change-led-polarity-from-OF.patch
  28786. +++ b/package/kernel/mac80211/patches/619-rt2x00-change-led-polarity-from-OF.patch
  28787. @@ -8,7 +8,7 @@
  28788. #include "rt2x00.h"
  28789. #include "rt2800lib.h"
  28790. -@@ -7957,6 +7958,17 @@ static int rt2800_init_eeprom(struct rt2
  28791. +@@ -7933,6 +7934,17 @@ static int rt2800_init_eeprom(struct rt2
  28792. rt2800_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC);
  28793. rt2800_init_led(rt2x00dev, &rt2x00dev->led_qual, LED_TYPE_QUALITY);
  28794. diff --git a/package/kernel/mac80211/patches/620-rt2x00-rt3352-rf-id.patch b/package/kernel/mac80211/patches/620-rt2x00-rt3352-rf-id.patch
  28795. index aaa8367..259cb1f 100644
  28796. --- a/package/kernel/mac80211/patches/620-rt2x00-rt3352-rf-id.patch
  28797. +++ b/package/kernel/mac80211/patches/620-rt2x00-rt3352-rf-id.patch
  28798. @@ -1,6 +1,6 @@
  28799. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28800. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28801. -@@ -7841,10 +7841,11 @@ static int rt2800_init_eeprom(struct rt2
  28802. +@@ -7817,10 +7817,11 @@ static int rt2800_init_eeprom(struct rt2
  28803. * RT53xx: defined in "EEPROM_CHIP_ID" field
  28804. */
  28805. if (rt2x00_rt(rt2x00dev, RT3290) ||
  28806. diff --git a/package/kernel/mac80211/patches/621-rt2x00-ht20_40_fix.patch b/package/kernel/mac80211/patches/621-rt2x00-ht20_40_fix.patch
  28807. index bb2fc1c..77d63fe 100644
  28808. --- a/package/kernel/mac80211/patches/621-rt2x00-ht20_40_fix.patch
  28809. +++ b/package/kernel/mac80211/patches/621-rt2x00-ht20_40_fix.patch
  28810. @@ -11,7 +11,7 @@
  28811. * RFCSR 31:
  28812. --- a/drivers/net/wireless/rt2x00/rt2800lib.c
  28813. +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
  28814. -@@ -3551,8 +3551,13 @@ static void rt2800_config_channel(struct
  28815. +@@ -3527,8 +3527,13 @@ static void rt2800_config_channel(struct
  28816. rt2x00_rf(rt2x00dev, RF5390) ||
  28817. rt2x00_rf(rt2x00dev, RF5392)) {
  28818. rt2800_rfcsr_read(rt2x00dev, 30, &rfcsr);
  28819. diff --git a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  28820. index 9e29034..3b8b756 100644
  28821. --- a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  28822. +++ b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  28823. @@ -1,6 +1,6 @@
  28824. --- a/drivers/net/wireless/libertas/cfg.c
  28825. +++ b/drivers/net/wireless/libertas/cfg.c
  28826. -@@ -2084,6 +2084,8 @@ struct wireless_dev *lbs_cfg_alloc(struc
  28827. +@@ -2083,6 +2083,8 @@ struct wireless_dev *lbs_cfg_alloc(struc
  28828. goto err_wiphy_new;
  28829. }
  28830. diff --git a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  28831. index 252fa81..dace56b 100644
  28832. --- a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  28833. +++ b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  28834. @@ -1,6 +1,6 @@
  28835. --- a/drivers/net/wireless/libertas/cfg.c
  28836. +++ b/drivers/net/wireless/libertas/cfg.c
  28837. -@@ -2174,6 +2174,8 @@ int lbs_cfg_register(struct lbs_private
  28838. +@@ -2173,6 +2173,8 @@ int lbs_cfg_register(struct lbs_private
  28839. wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  28840. wdev->wiphy->reg_notifier = lbs_reg_notifier;
  28841. diff --git a/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch b/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  28842. index ac58dba..dd82ce5 100644
  28843. --- a/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  28844. +++ b/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  28845. @@ -9,7 +9,7 @@
  28846. antenna = b43_antenna_to_phyctl(antenna);
  28847. ctl = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_BEACPHYCTL);
  28848. /* We can't send beacons with short preamble. Would get PHY errors. */
  28849. -@@ -3302,8 +3302,8 @@ static int b43_chip_init(struct b43_wlde
  28850. +@@ -3300,8 +3300,8 @@ static int b43_chip_init(struct b43_wlde
  28851. /* Select the antennae */
  28852. if (phy->ops->set_rx_antenna)
  28853. @@ -20,7 +20,7 @@
  28854. if (phy->type == B43_PHYTYPE_B) {
  28855. value16 = b43_read16(dev, 0x005E);
  28856. -@@ -4003,7 +4003,6 @@ static int b43_op_config(struct ieee8021
  28857. +@@ -4001,7 +4001,6 @@ static int b43_op_config(struct ieee8021
  28858. struct b43_wldev *dev = wl->current_dev;
  28859. struct b43_phy *phy = &dev->phy;
  28860. struct ieee80211_conf *conf = &hw->conf;
  28861. @@ -28,7 +28,7 @@
  28862. int err = 0;
  28863. mutex_lock(&wl->mutex);
  28864. -@@ -4046,11 +4045,9 @@ static int b43_op_config(struct ieee8021
  28865. +@@ -4044,11 +4043,9 @@ static int b43_op_config(struct ieee8021
  28866. }
  28867. /* Antennas for RX and management frame TX. */
  28868. @@ -42,7 +42,7 @@
  28869. if (wl->radio_enabled != phy->radio_on) {
  28870. if (wl->radio_enabled) {
  28871. -@@ -5213,6 +5210,47 @@ static int b43_op_get_survey(struct ieee
  28872. +@@ -5209,6 +5206,47 @@ static int b43_op_get_survey(struct ieee
  28873. return 0;
  28874. }
  28875. @@ -90,7 +90,7 @@
  28876. static const struct ieee80211_ops b43_hw_ops = {
  28877. .tx = b43_op_tx,
  28878. .conf_tx = b43_op_conf_tx,
  28879. -@@ -5234,6 +5272,8 @@ static const struct ieee80211_ops b43_hw
  28880. +@@ -5230,6 +5268,8 @@ static const struct ieee80211_ops b43_hw
  28881. .sw_scan_complete = b43_op_sw_scan_complete_notifier,
  28882. .get_survey = b43_op_get_survey,
  28883. .rfkill_poll = b43_rfkill_poll,
  28884. @@ -99,7 +99,7 @@
  28885. };
  28886. /* Hard-reset the chip. Do not call this directly.
  28887. -@@ -5542,6 +5582,8 @@ static int b43_one_core_attach(struct b4
  28888. +@@ -5538,6 +5578,8 @@ static int b43_one_core_attach(struct b4
  28889. if (!wldev)
  28890. goto out;
  28891. @@ -108,7 +108,7 @@
  28892. wldev->use_pio = b43_modparam_pio;
  28893. wldev->dev = dev;
  28894. wldev->wl = wl;
  28895. -@@ -5632,6 +5674,9 @@ static struct b43_wl *b43_wireless_init(
  28896. +@@ -5628,6 +5670,9 @@ static struct b43_wl *b43_wireless_init(
  28897. hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
  28898. 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
  28899. index 44bb779..dbfb158 100644
  28900. --- a/package/kernel/mac80211/patches/860-brcmfmac-use-bcm47xx-platform-NVRAM-as-fallback.patch
  28901. +++ b/package/kernel/mac80211/patches/860-brcmfmac-use-bcm47xx-platform-NVRAM-as-fallback.patch
  28902. @@ -69,9 +69,9 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  28903. }
  28904. --- a/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  28905. +++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.h
  28906. -@@ -19,6 +19,8 @@
  28907. -
  28908. - #include <linux/net.h> /* net_ratelimit() */
  28909. +@@ -17,6 +17,8 @@
  28910. + #ifndef BRCMFMAC_DEBUG_H
  28911. + #define BRCMFMAC_DEBUG_H
  28912. +#include <linux/net.h>
  28913. +
  28914. 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
  28915. index 14f8a00..685a5f9 100644
  28916. --- a/package/kernel/mac80211/patches/861-brcmfmac-register-wiphy-s-during-module_init.patch
  28917. +++ b/package/kernel/mac80211/patches/861-brcmfmac-register-wiphy-s-during-module_init.patch
  28918. @@ -13,7 +13,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  28919. --- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
  28920. +++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
  28921. -@@ -1226,6 +1226,7 @@ static int __init brcmfmac_module_init(v
  28922. +@@ -1213,6 +1213,7 @@ static int __init brcmfmac_module_init(v
  28923. #endif
  28924. if (!schedule_work(&brcmf_driver_work))
  28925. return -EBUSY;
  28926. 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
  28927. index 32c4a6f..5fdfa37 100644
  28928. --- a/package/kernel/mac80211/patches/862-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
  28929. +++ b/package/kernel/mac80211/patches/862-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
  28930. @@ -10,7 +10,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  28931. --- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  28932. +++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  28933. -@@ -608,9 +608,37 @@ static struct wireless_dev *brcmf_cfg802
  28934. +@@ -692,9 +692,37 @@ static struct wireless_dev *brcmf_cfg802
  28935. u32 *flags,
  28936. struct vif_params *params)
  28937. {
  28938. 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
  28939. deleted file mode 100644
  28940. index d6b9e37..0000000
  28941. --- a/package/kernel/mac80211/patches/863-brcmfmac-fix-setting-primary-channel-for-80-MHz-widt.patch
  28942. +++ /dev/null
  28943. @@ -1,65 +0,0 @@
  28944. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  28945. -Date: Wed, 20 Jan 2016 16:35:12 +0100
  28946. -Subject: [PATCH] brcmfmac: fix setting primary channel for 80 MHz width
  28947. -MIME-Version: 1.0
  28948. -Content-Type: text/plain; charset=UTF-8
  28949. -Content-Transfer-Encoding: 8bit
  28950. -
  28951. -First of all it changes the way we calculate primary channel offset. If
  28952. -we use e.g. 80 MHz channel with primary frequency 5180 MHz (which means
  28953. -center frequency is 5210 MHz) it makes sense to calculate primary offset
  28954. -as -30 MHz.
  28955. -Then it fixes values we compare primary_offset with. We were comparing
  28956. -offset in MHz against -2 or 2 which was resulting in picking a wrong
  28957. -primary channel.
  28958. -
  28959. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  28960. ----
  28961. - .../brcm80211/brcmfmac/cfg80211.c | 23 ++++++++++------------
  28962. - 1 file changed, 10 insertions(+), 13 deletions(-)
  28963. -
  28964. ---- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  28965. -+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
  28966. -@@ -246,7 +246,7 @@ static u16 chandef_to_chanspec(struct br
  28967. - brcmf_dbg(TRACE, "chandef: control %d center %d width %d\n",
  28968. - ch->chan->center_freq, ch->center_freq1, ch->width);
  28969. - ch_inf.chnum = ieee80211_frequency_to_channel(ch->center_freq1);
  28970. -- primary_offset = ch->center_freq1 - ch->chan->center_freq;
  28971. -+ primary_offset = ch->chan->center_freq - ch->center_freq1;
  28972. - switch (ch->width) {
  28973. - case NL80211_CHAN_WIDTH_20:
  28974. - case NL80211_CHAN_WIDTH_20_NOHT:
  28975. -@@ -255,24 +255,21 @@ static u16 chandef_to_chanspec(struct br
  28976. - break;
  28977. - case NL80211_CHAN_WIDTH_40:
  28978. - ch_inf.bw = BRCMU_CHAN_BW_40;
  28979. -- if (primary_offset < 0)
  28980. -+ if (primary_offset > 0)
  28981. - ch_inf.sb = BRCMU_CHAN_SB_U;
  28982. - else
  28983. - ch_inf.sb = BRCMU_CHAN_SB_L;
  28984. - break;
  28985. - case NL80211_CHAN_WIDTH_80:
  28986. - ch_inf.bw = BRCMU_CHAN_BW_80;
  28987. -- if (primary_offset < 0) {
  28988. -- if (primary_offset < -CH_10MHZ_APART)
  28989. -- ch_inf.sb = BRCMU_CHAN_SB_UU;
  28990. -- else
  28991. -- ch_inf.sb = BRCMU_CHAN_SB_UL;
  28992. -- } else {
  28993. -- if (primary_offset > CH_10MHZ_APART)
  28994. -- ch_inf.sb = BRCMU_CHAN_SB_LL;
  28995. -- else
  28996. -- ch_inf.sb = BRCMU_CHAN_SB_LU;
  28997. -- }
  28998. -+ if (primary_offset == -30)
  28999. -+ ch_inf.sb = BRCMU_CHAN_SB_LL;
  29000. -+ else if (primary_offset == -10)
  29001. -+ ch_inf.sb = BRCMU_CHAN_SB_LU;
  29002. -+ else if (primary_offset == 10)
  29003. -+ ch_inf.sb = BRCMU_CHAN_SB_UL;
  29004. -+ else
  29005. -+ ch_inf.sb = BRCMU_CHAN_SB_UU;
  29006. - break;
  29007. - case NL80211_CHAN_WIDTH_80P80:
  29008. - case NL80211_CHAN_WIDTH_160:
  29009. 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
  29010. deleted file mode 100644
  29011. index 856dea8..0000000
  29012. --- a/package/kernel/mac80211/patches/900-wlcore-Add-support-for-DT-platform-data.patch
  29013. +++ /dev/null
  29014. @@ -1,139 +0,0 @@
  29015. -When running with DT, we no longer have a board file that can set up the
  29016. -platform data for wlcore. Allow this data to be passed from DT.
  29017. -
  29018. -Since some platforms use a gpio-irq, add support for passing either the
  29019. -irq number or the gpio number. For the latter case, the driver will
  29020. -request the gpio and convert it to the irq number. If an irq is
  29021. -specified, it'll be used as is.
  29022. -
  29023. -[Arik - the pdev_data pointer does not belong to us and is freed when
  29024. -the device is released. Dereference to our private data first.]
  29025. -
  29026. -Signed-off-by: Ido Yariv <ido@wizery.com>
  29027. -Signed-off-by: Arik Nemtsov <arik@wizery.com>
  29028. ----
  29029. - drivers/net/wireless/ti/wlcore/sdio.c | 71 ++++++++++++++++++++++++++++++++---
  29030. - include/linux/wl12xx.h | 3 +-
  29031. - 2 files changed, 67 insertions(+), 7 deletions(-)
  29032. -
  29033. ---- a/drivers/net/wireless/ti/wlcore/sdio.c
  29034. -+++ b/drivers/net/wireless/ti/wlcore/sdio.c
  29035. -@@ -34,6 +34,7 @@
  29036. - #include <linux/wl12xx.h>
  29037. - #include <linux/pm_runtime.h>
  29038. - #include <linux/printk.h>
  29039. -+#include <linux/of.h>
  29040. -
  29041. - #include "wlcore.h"
  29042. - #include "wl12xx_80211.h"
  29043. -@@ -214,6 +215,61 @@ static struct wl1271_if_operations sdio_
  29044. - .set_block_size = wl1271_sdio_set_block_size,
  29045. - };
  29046. -
  29047. -+static const struct of_device_id wlcore_of_match[] = {
  29048. -+ {
  29049. -+ .compatible = "wlcore",
  29050. -+ },
  29051. -+ {}
  29052. -+};
  29053. -+MODULE_DEVICE_TABLE(of, wlcore_of_match);
  29054. -+
  29055. -+static struct wl12xx_platform_data *get_platform_data(struct device *dev)
  29056. -+{
  29057. -+ struct wl12xx_platform_data *pdata;
  29058. -+ struct device_node *np;
  29059. -+ u32 gpio;
  29060. -+
  29061. -+ pdata = wl12xx_get_platform_data();
  29062. -+ if (!IS_ERR(pdata))
  29063. -+ return kmemdup(pdata, sizeof(*pdata), GFP_KERNEL);
  29064. -+
  29065. -+ np = of_find_matching_node(NULL, wlcore_of_match);
  29066. -+ if (!np) {
  29067. -+ dev_err(dev, "No platform data set\n");
  29068. -+ return NULL;
  29069. -+ }
  29070. -+
  29071. -+ pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
  29072. -+ if (!pdata) {
  29073. -+ dev_err(dev, "Can't allocate platform data\n");
  29074. -+ return NULL;
  29075. -+ }
  29076. -+
  29077. -+ if (of_property_read_u32(np, "irq", &pdata->irq)) {
  29078. -+ if (!of_property_read_u32(np, "gpio", &gpio) &&
  29079. -+ !gpio_request_one(gpio, GPIOF_IN, "wlcore_irq")) {
  29080. -+ pdata->gpio = gpio;
  29081. -+ pdata->irq = gpio_to_irq(gpio);
  29082. -+ }
  29083. -+ }
  29084. -+
  29085. -+ /* Optional fields */
  29086. -+ pdata->use_eeprom = of_property_read_bool(np, "use-eeprom");
  29087. -+ of_property_read_u32(np, "board-ref-clock", &pdata->board_ref_clock);
  29088. -+ of_property_read_u32(np, "board-tcxo-clock", &pdata->board_tcxo_clock);
  29089. -+ of_property_read_u32(np, "platform-quirks", &pdata->platform_quirks);
  29090. -+
  29091. -+ return pdata;
  29092. -+}
  29093. -+
  29094. -+static void del_platform_data(struct wl12xx_platform_data *pdata)
  29095. -+{
  29096. -+ if (pdata->gpio)
  29097. -+ gpio_free(pdata->gpio);
  29098. -+
  29099. -+ kfree(pdata);
  29100. -+}
  29101. -+
  29102. - static int wl1271_probe(struct sdio_func *func,
  29103. - const struct sdio_device_id *id)
  29104. - {
  29105. -@@ -245,10 +301,10 @@ static int wl1271_probe(struct sdio_func
  29106. - /* Use block mode for transferring over one block size of data */
  29107. - func->card->quirks |= MMC_QUIRK_BLKSZ_FOR_BYTE_MODE;
  29108. -
  29109. -- pdev_data.pdata = wl12xx_get_platform_data();
  29110. -- if (IS_ERR(pdev_data.pdata)) {
  29111. -- ret = PTR_ERR(pdev_data.pdata);
  29112. -- dev_err(glue->dev, "missing wlan platform data: %d\n", ret);
  29113. -+ pdev_data.pdata = get_platform_data(&func->dev);
  29114. -+ if (!pdev_data.pdata) {
  29115. -+ ret = -EINVAL;
  29116. -+ dev_err(glue->dev, "missing wlan platform data\n");
  29117. - goto out_free_glue;
  29118. - }
  29119. -
  29120. -@@ -279,7 +335,7 @@ static int wl1271_probe(struct sdio_func
  29121. - if (!glue->core) {
  29122. - dev_err(glue->dev, "can't allocate platform_device");
  29123. - ret = -ENOMEM;
  29124. -- goto out_free_glue;
  29125. -+ goto out_free_pdata;
  29126. - }
  29127. -
  29128. - glue->core->dev.parent = &func->dev;
  29129. -@@ -313,6 +369,9 @@ static int wl1271_probe(struct sdio_func
  29130. - out_dev_put:
  29131. - platform_device_put(glue->core);
  29132. -
  29133. -+out_free_pdata:
  29134. -+ del_platform_data(pdev_data->pdata);
  29135. -+
  29136. - out_free_glue:
  29137. - kfree(glue);
  29138. -
  29139. -@@ -323,11 +382,14 @@ out:
  29140. - static void wl1271_remove(struct sdio_func *func)
  29141. - {
  29142. - struct wl12xx_sdio_glue *glue = sdio_get_drvdata(func);
  29143. -+ struct wlcore_platdev_data *pdev_data = glue->core->dev.platform_data;
  29144. -+ struct wl12xx_platform_data *pdata = pdev_data->pdata;
  29145. -
  29146. - /* Undo decrement done above in wl1271_probe */
  29147. - pm_runtime_get_noresume(&func->dev);
  29148. -
  29149. - platform_device_unregister(glue->core);
  29150. -+ del_platform_data(pdata);
  29151. - kfree(glue);
  29152. - }
  29153. -
  29154. 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
  29155. index 501910f..b0536ce 100644
  29156. --- a/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch
  29157. +++ b/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch
  29158. @@ -210,7 +210,7 @@
  29159. case RT5592:
  29160. *txwi_size = TXWI_DESC_SIZE_5WORDS;
  29161. *rxwi_size = RXWI_DESC_SIZE_6WORDS;
  29162. -@@ -3326,6 +3399,312 @@ static void rt2800_config_channel_rf55xx
  29163. +@@ -3302,6 +3375,312 @@ static void rt2800_config_channel_rf55xx
  29164. rt2800_bbp_write(rt2x00dev, 196, (rf->channel <= 14) ? 0x19 : 0x7F);
  29165. }
  29166. @@ -258,6 +258,7 @@
  29167. + u32 mac_sys_ctrl, mac_status;
  29168. + u32 tx_pin = 0x00150F0F;
  29169. + struct hw_mode_spec *spec = &rt2x00dev->spec;
  29170. ++ struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
  29171. +
  29172. + /* Frequeny plan setting */
  29173. + /*
  29174. @@ -383,7 +384,6 @@
  29175. + rfcsr &= (~0x4);
  29176. + rt2800_rfcsr_write(rt2x00dev, 28, rfcsr);
  29177. +
  29178. -+ struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
  29179. + /*if (bScan == FALSE)*/
  29180. + if (conf_is_ht40(conf)) {
  29181. + txrx_agc_fc = rt2x00_get_field8(drv_data->calibration_bw40,
  29182. @@ -523,7 +523,7 @@
  29183. static void rt2800_bbp_write_with_rx_chain(struct rt2x00_dev *rt2x00dev,
  29184. const unsigned int word,
  29185. const u8 value)
  29186. -@@ -3482,7 +3861,7 @@ static void rt2800_config_channel(struct
  29187. +@@ -3458,7 +3837,7 @@ static void rt2800_config_channel(struct
  29188. struct channel_info *info)
  29189. {
  29190. u32 reg;
  29191. @@ -532,7 +532,7 @@
  29192. u8 bbp, rfcsr;
  29193. info->default_power1 = rt2800_txpower_to_dev(rt2x00dev, rf->channel,
  29194. -@@ -3536,6 +3915,9 @@ static void rt2800_config_channel(struct
  29195. +@@ -3512,6 +3891,9 @@ static void rt2800_config_channel(struct
  29196. case RF5592:
  29197. rt2800_config_channel_rf55xx(rt2x00dev, conf, rf, info);
  29198. break;
  29199. @@ -542,7 +542,7 @@
  29200. default:
  29201. rt2800_config_channel_rf2xxx(rt2x00dev, conf, rf, info);
  29202. }
  29203. -@@ -3638,7 +4020,7 @@ static void rt2800_config_channel(struct
  29204. +@@ -3614,7 +3996,7 @@ static void rt2800_config_channel(struct
  29205. else if (rt2x00_rt(rt2x00dev, RT3593) ||
  29206. rt2x00_rt(rt2x00dev, RT3883))
  29207. rt2800_bbp_write(rt2x00dev, 82, 0x82);
  29208. @@ -551,7 +551,7 @@
  29209. rt2800_bbp_write(rt2x00dev, 82, 0xf2);
  29210. if (rt2x00_rt(rt2x00dev, RT3593) ||
  29211. -@@ -3660,7 +4042,7 @@ static void rt2800_config_channel(struct
  29212. +@@ -3636,7 +4018,7 @@ static void rt2800_config_channel(struct
  29213. if (rt2x00_rt(rt2x00dev, RT3572))
  29214. rt2800_rfcsr_write(rt2x00dev, 8, 0);
  29215. @@ -560,7 +560,7 @@
  29216. switch (rt2x00dev->default_ant.tx_chain_num) {
  29217. case 3:
  29218. -@@ -3709,6 +4091,7 @@ static void rt2800_config_channel(struct
  29219. +@@ -3685,6 +4067,7 @@ static void rt2800_config_channel(struct
  29220. rt2x00_set_field32(&tx_pin, TX_PIN_CFG_RFTR_EN, 1);
  29221. rt2x00_set_field32(&tx_pin, TX_PIN_CFG_TRSW_EN, 1);
  29222. @@ -568,7 +568,7 @@
  29223. rt2800_register_write(rt2x00dev, TX_PIN_CFG, tx_pin);
  29224. -@@ -4725,6 +5108,14 @@ void rt2800_vco_calibration(struct rt2x0
  29225. +@@ -4701,6 +5084,14 @@ void rt2800_vco_calibration(struct rt2x0
  29226. rt2x00_set_field8(&rfcsr, RFCSR3_VCOCAL_EN, 1);
  29227. rt2800_rfcsr_write(rt2x00dev, 3, rfcsr);
  29228. break;
  29229. @@ -583,7 +583,7 @@
  29230. default:
  29231. return;
  29232. }
  29233. -@@ -5125,9 +5516,42 @@ static int rt2800_init_registers(struct
  29234. +@@ -5101,9 +5492,42 @@ static int rt2800_init_registers(struct
  29235. } else if (rt2x00_rt(rt2x00dev, RT5390) ||
  29236. rt2x00_rt(rt2x00dev, RT5392) ||
  29237. rt2x00_rt(rt2x00dev, RT5592)) {
  29238. @@ -629,7 +629,7 @@
  29239. } else if (rt2x00_rt(rt2x00dev, RT5350)) {
  29240. rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
  29241. } else {
  29242. -@@ -6159,6 +6583,225 @@ static void rt2800_init_bbp_5592(struct
  29243. +@@ -6135,6 +6559,225 @@ static void rt2800_init_bbp_5592(struct
  29244. rt2800_bbp_write(rt2x00dev, 103, 0xc0);
  29245. }
  29246. @@ -855,7 +855,7 @@
  29247. static void rt2800_init_bbp(struct rt2x00_dev *rt2x00dev)
  29248. {
  29249. unsigned int i;
  29250. -@@ -6201,7 +6844,10 @@ static void rt2800_init_bbp(struct rt2x0
  29251. +@@ -6177,7 +6820,10 @@ static void rt2800_init_bbp(struct rt2x0
  29252. return;
  29253. case RT5390:
  29254. case RT5392:
  29255. @@ -867,7 +867,7 @@
  29256. break;
  29257. case RT5592:
  29258. rt2800_init_bbp_5592(rt2x00dev);
  29259. -@@ -7415,6 +8061,295 @@ static void rt2800_init_rfcsr_5592(struc
  29260. +@@ -7391,6 +8037,296 @@ static void rt2800_init_rfcsr_5592(struc
  29261. rt2800_led_open_drain_enable(rt2x00dev);
  29262. }
  29263. @@ -875,6 +875,8 @@
  29264. +{
  29265. + u16 freq;
  29266. + u8 rfvalue;
  29267. ++ struct hw_mode_spec *spec = &rt2x00dev->spec;
  29268. ++
  29269. + /* Initialize RF central register to default value */
  29270. + rt2800_rfcsr_write(rt2x00dev, 0, 0x02);
  29271. + rt2800_rfcsr_write(rt2x00dev, 1, 0x03);
  29272. @@ -921,7 +923,6 @@
  29273. + rt2800_rfcsr_write(rt2x00dev, 42, 0x5B);
  29274. + rt2800_rfcsr_write(rt2x00dev, 43, 0x00);
  29275. +
  29276. -+ struct hw_mode_spec *spec = &rt2x00dev->spec;
  29277. + rt2800_rfcsr_write(rt2x00dev, 11, 0x21);
  29278. + if (spec->clk_is_20mhz)
  29279. + rt2800_rfcsr_write(rt2x00dev, 13, 0x03);
  29280. @@ -1163,7 +1164,7 @@
  29281. static void rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev)
  29282. {
  29283. if (rt2800_is_305x_soc(rt2x00dev)) {
  29284. -@@ -7450,7 +8385,10 @@ static void rt2800_init_rfcsr(struct rt2
  29285. +@@ -7426,7 +8362,10 @@ static void rt2800_init_rfcsr(struct rt2
  29286. rt2800_init_rfcsr_5350(rt2x00dev);
  29287. break;
  29288. case RT5390:
  29289. @@ -1175,7 +1176,7 @@
  29290. break;
  29291. case RT5392:
  29292. rt2800_init_rfcsr_5392(rt2x00dev);
  29293. -@@ -7882,6 +8820,7 @@ static int rt2800_init_eeprom(struct rt2
  29294. +@@ -7858,6 +8797,7 @@ static int rt2800_init_eeprom(struct rt2
  29295. case RF5390:
  29296. case RF5392:
  29297. case RF5592:
  29298. @@ -1183,7 +1184,7 @@
  29299. break;
  29300. default:
  29301. rt2x00_err(rt2x00dev, "Invalid RF chipset 0x%04x detected\n",
  29302. -@@ -8448,6 +9387,7 @@ static int rt2800_probe_hw_mode(struct r
  29303. +@@ -8422,6 +9362,7 @@ static int rt2800_probe_hw_mode(struct r
  29304. case RF5372:
  29305. case RF5390:
  29306. case RF5392:
  29307. @@ -1191,7 +1192,7 @@
  29308. spec->num_channels = 14;
  29309. if (spec->clk_is_20mhz)
  29310. spec->channels = rf_vals_xtal20mhz_3x;
  29311. -@@ -8588,6 +9528,7 @@ static int rt2800_probe_hw_mode(struct r
  29312. +@@ -8562,6 +9503,7 @@ static int rt2800_probe_hw_mode(struct r
  29313. case RF5372:
  29314. case RF5390:
  29315. case RF5392:
  29316. 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
  29317. deleted file mode 100644
  29318. index 4c04d4f..0000000
  29319. --- a/package/kernel/mac80211/patches/920-ath10k_allow_fallback_to_board_bin_on_empty_otp_stream.patch
  29320. +++ /dev/null
  29321. @@ -1,20 +0,0 @@
  29322. ---- a/drivers/net/wireless/ath/ath10k/core.c
  29323. -+++ b/drivers/net/wireless/ath/ath10k/core.c
  29324. -@@ -387,9 +387,14 @@ static int ath10k_download_and_run_otp(s
  29325. -
  29326. - ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot otp execute result %d\n", result);
  29327. -
  29328. -- if (!skip_otp && result != 0) {
  29329. -- ath10k_err(ar, "otp calibration failed: %d", result);
  29330. -- return -EINVAL;
  29331. -+ if (!skip_otp) {
  29332. -+ if (result == 2) {
  29333. -+ ath10k_warn(ar, "otp stream is empty, using board.bin contents");
  29334. -+ return 0;
  29335. -+ } else if (result != 0) {
  29336. -+ ath10k_err(ar, "otp calibration failed: %d", result);
  29337. -+ return -EINVAL;
  29338. -+ }
  29339. - }
  29340. -
  29341. - return 0;
  29342. diff --git a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  29343. index eed3814..93196e1 100644
  29344. --- a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  29345. +++ b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  29346. @@ -14,7 +14,7 @@ Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  29347. --- a/drivers/net/wireless/ath/ath10k/core.c
  29348. +++ b/drivers/net/wireless/ath/ath10k/core.c
  29349. -@@ -1323,6 +1323,16 @@ int ath10k_core_register(struct ath10k *
  29350. +@@ -1520,6 +1520,16 @@ int ath10k_core_register(struct ath10k *
  29351. ar->chip_id = chip_id;
  29352. queue_work(ar->workqueue, &ar->register_work);
  29353. 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
  29354. index 8003f86..34910a0 100644
  29355. --- a/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
  29356. +++ b/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
  29357. @@ -1,6 +1,6 @@
  29358. --- a/drivers/net/wireless/ath/ath10k/mac.c
  29359. +++ b/drivers/net/wireless/ath/ath10k/mac.c
  29360. -@@ -5416,6 +5416,21 @@ struct ath10k_vif *ath10k_get_arvif(stru
  29361. +@@ -6804,6 +6804,21 @@ struct ath10k_vif *ath10k_get_arvif(stru
  29362. return arvif_iter.arvif;
  29363. }
  29364. @@ -22,7 +22,7 @@
  29365. int ath10k_mac_register(struct ath10k *ar)
  29366. {
  29367. static const u32 cipher_suites[] = {
  29368. -@@ -5590,6 +5605,12 @@ int ath10k_mac_register(struct ath10k *a
  29369. +@@ -7025,6 +7040,12 @@ int ath10k_mac_register(struct ath10k *a
  29370. ar->hw->wiphy->cipher_suites = cipher_suites;
  29371. ar->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  29372. diff --git a/package/kernel/mac80211/patches/940-mwl8k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/940-mwl8k_init_devices_synchronously.patch
  29373. new file mode 100644
  29374. index 0000000..75d8212
  29375. --- /dev/null
  29376. +++ b/package/kernel/mac80211/patches/940-mwl8k_init_devices_synchronously.patch
  29377. @@ -0,0 +1,20 @@
  29378. +--- a/drivers/net/wireless/mwl8k.c
  29379. ++++ b/drivers/net/wireless/mwl8k.c
  29380. +@@ -6261,6 +6261,8 @@ static int mwl8k_probe(struct pci_dev *p
  29381. +
  29382. + priv->running_bsses = 0;
  29383. +
  29384. ++ wait_for_completion(&priv->firmware_loading_complete);
  29385. ++
  29386. + return rc;
  29387. +
  29388. + err_stop_firmware:
  29389. +@@ -6294,8 +6296,6 @@ static void mwl8k_remove(struct pci_dev
  29390. + return;
  29391. + priv = hw->priv;
  29392. +
  29393. +- wait_for_completion(&priv->firmware_loading_complete);
  29394. +-
  29395. + if (priv->fw_state == FW_STATE_ERROR) {
  29396. + mwl8k_hw_reset(priv);
  29397. + goto unmap;
  29398. diff --git a/package/kernel/mt76/patches/001-backport_ieee80211_hw_set.patch b/package/kernel/mt76/patches/001-backport_ieee80211_hw_set.patch
  29399. deleted file mode 100644
  29400. index e94574d..0000000
  29401. --- a/package/kernel/mt76/patches/001-backport_ieee80211_hw_set.patch
  29402. +++ /dev/null
  29403. @@ -1,12 +0,0 @@
  29404. ---- a/init.c
  29405. -+++ b/init.c
  29406. -@@ -16,6 +16,9 @@
  29407. - #include "eeprom.h"
  29408. - #include "mcu.h"
  29409. -
  29410. -+#define ieee80211_hw_set(hw, flag) \
  29411. -+ do { (hw)->flags |= IEEE80211_HW_##flag; } while(0)
  29412. -+
  29413. - static bool
  29414. - mt76_wait_for_mac(struct mt76_dev *dev)
  29415. - {