0006-mac80211-update-to-LEDE-0a0caa2656c8db73518a1783743ede772e3ac40f.patch 351 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Tue, 7 Jun 2016 14:06:23 +0200
  3. Subject: mac80211: update to LEDE 0a0caa2656c8db73518a1783743ede772e3ac40f
  4. diff --git a/package/firmware/ath10k-firmware/Makefile b/package/firmware/ath10k-firmware/Makefile
  5. index b03d644..4f63cdd 100644
  6. --- a/package/firmware/ath10k-firmware/Makefile
  7. +++ b/package/firmware/ath10k-firmware/Makefile
  8. @@ -8,7 +8,7 @@
  9. include $(TOPDIR)/rules.mk
  10. PKG_NAME:=ath10k-firmware
  11. -PKG_SOURCE_VERSION:=77f72b5f7dd940386d9e619a17904987759b7186
  12. +PKG_SOURCE_VERSION:=b00eb8d30fbebb6a5047ccacefa8c37e072fca9c
  13. PKG_VERSION:=2014-11-13-$(PKG_SOURCE_VERSION)
  14. PKG_RELEASE:=1
  15. @@ -17,7 +17,7 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  16. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  17. PKG_SOURCE_URL:=https://github.com/kvalo/ath10k-firmware.git
  18. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  19. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  20. include $(INCLUDE_DIR)/package.mk
  21. @@ -28,14 +28,18 @@ define Package/ath10k-firmware-default
  22. CATEGORY:=Kernel modules
  23. SUBMENU:=$(WMENU)
  24. URL:=$(PKG_SOURCE_URL)
  25. + DEPENDS:=kmod-ath10k
  26. endef
  27. define Package/ath10k-firmware-qca988x
  28. $(Package/ath10k-firmware-default)
  29. + DEFAULT:=PACKAGE_kmod-ath10k
  30. TITLE:=ath10k firmware for QCA988x devices
  31. endef
  32. QCA988X_FIRMWARE_FILE:=firmware-5.bin_10.2.4.97-1
  33. +QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-16.bin-lede
  34. +QCA99X0_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-7.bin-lede.001
  35. define Download/ath10k-firmware-qca988x
  36. URL:=https://www.codeaurora.org/cgit/quic/qsdk/oss/firmware/ath10k-firmware/plain/10.2.4/
  37. @@ -44,11 +48,63 @@ define Download/ath10k-firmware-qca988x
  38. endef
  39. $(eval $(call Download,ath10k-firmware-qca988x))
  40. +define Download/ath10k-firmware-qca988x-ct
  41. + URL:=https://www.candelatech.com/downloads/
  42. + FILE:=$(QCA988X_FIRMWARE_FILE_CT)
  43. + MD5SUM:=5b651c0458bcf5c20701308b5e519976
  44. +endef
  45. +$(eval $(call Download,ath10k-firmware-qca988x-ct))
  46. +
  47. +define Download/ath10k-firmware-qca99x0-ct
  48. + URL:=https://www.candelatech.com/downloads/ath10k-10-4/
  49. + FILE:=$(QCA99X0_FIRMWARE_FILE_CT)
  50. + MD5SUM:=eb710949ff79142954aadae24616169c
  51. +endef
  52. +$(eval $(call Download,ath10k-firmware-qca99x0-ct))
  53. +
  54. define Package/ath10k-firmware-qca99x0
  55. $(Package/ath10k-firmware-default)
  56. TITLE:=ath10k firmware for QCA99x0 devices
  57. endef
  58. +define Package/ath10k-firmware-qca988x-ct
  59. +$(Package/ath10k-firmware-default)
  60. + TITLE:=ath10k CT 10.1 firmware for QCA988x devices
  61. +endef
  62. +
  63. +define Package/ath10k-firmware-qca988x-ct/description
  64. +Alternative ath10k firmware for QCA988X from Candela Technologies.
  65. +Enables IBSS and other features. See:
  66. +http://www.candelatech.com/ath10k-10.1.php
  67. +This firmware will NOT be used unless the standard ath10k-firmware-qca988x
  68. +is un-selected since the driver will try to load firmware-5.bin before
  69. +firmware-2.bin
  70. +endef
  71. +
  72. +define Package/ath10k-firmware-qca99x0-ct/description
  73. +Alternative ath10k firmware for QCA99x0 from Candela Technologies.
  74. +Enables IBSS and other features. See:
  75. +http://www.candelatech.com/ath10k-10.4.php
  76. +This firmware conflicts with the standard 99x0 firmware, so select only
  77. +one.
  78. +endef
  79. +
  80. +define Package/ath10k-firmware-qca99x0/description
  81. +Standard ath10k firmware for QCA99x0 from QCA
  82. +This firmware conflicts with the CT 99x0 firmware, so select only
  83. +one.
  84. +endef
  85. +
  86. +define Package/ath10k-firmware-qca99x0-ct
  87. +$(Package/ath10k-firmware-default)
  88. + TITLE:=ath10k CT 10.4.3 firmware for QCA99x0 devices
  89. +endef
  90. +
  91. +define Package/ath10k-firmware-qca9984
  92. +$(Package/ath10k-firmware-default)
  93. + TITLE:=ath10k firmware for QCA9984 devices
  94. +endef
  95. +
  96. define Package/ath10k-firmware-qca6174
  97. $(Package/ath10k-firmware-default)
  98. TITLE:=ath10k firmware for QCA6174 devices
  99. @@ -58,8 +114,8 @@ QCA99X0_BOARD_REV:=ddcec9efd245da9365c474f513a855a55f3ac7fe
  100. QCA99X0_BOARD_FILE:=board-2.bin.$(QCA99X0_BOARD_REV)
  101. define Download/qca99x0-board
  102. - URL:=https://www.codeaurora.org/cgit/quic/qsdk/oss/firmware/ath10k-firmware/plain/ath10k/QCA99X0/hw2.0
  103. - URL_FILE:=board-2.bin?id=ddcec9efd245da9365c474f513a855a55f3ac7fe
  104. + URL:=https://source.codeaurora.org/quic/qsdk/oss/firmware/ath10k-firmware/plain/ath10k/QCA99X0/hw2.0
  105. + URL_FILE:=board-2.bin?id=$(QCA99X0_BOARD_REV)
  106. FILE:=$(QCA99X0_BOARD_FILE)
  107. MD5SUM:=a2b3c653c2363a5641200051d6333d0a
  108. endef
  109. @@ -79,6 +135,16 @@ define Package/ath10k-firmware-qca988x/install
  110. $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin
  111. endef
  112. +define Package/ath10k-firmware-qca988x-ct/install
  113. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
  114. + $(INSTALL_DATA) \
  115. + $(PKG_BUILD_DIR)/QCA988X/board.bin \
  116. + $(1)/lib/firmware/ath10k/QCA988X/hw2.0/
  117. + $(INSTALL_DATA) \
  118. + $(DL_DIR)/$(QCA988X_FIRMWARE_FILE_CT) \
  119. + $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-2.bin
  120. +endef
  121. +
  122. define Package/ath10k-firmware-qca6174/install
  123. $(INSTALL_DIR) $(1)/lib/firmware/ath10k
  124. $(CP) $(PKG_BUILD_DIR)/QCA6174 $(1)/lib/firmware/ath10k/
  125. @@ -97,6 +163,33 @@ define Package/ath10k-firmware-qca99x0/install
  126. $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/firmware-5.bin
  127. endef
  128. +define Package/ath10k-firmware-qca99x0-ct/install
  129. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA99X0/hw2.0
  130. + $(INSTALL_DATA) \
  131. + $(DL_DIR)/$(QCA99X0_BOARD_FILE) \
  132. + $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board-2.bin
  133. + $(INSTALL_DATA) \
  134. + $(PKG_BUILD_DIR)/QCA99X0/hw2.0/boardData_AR900B_CUS239_5G_v2_001.bin \
  135. + $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board.bin
  136. + $(INSTALL_DATA) \
  137. + $(DL_DIR)/$(QCA99X0_FIRMWARE_FILE_CT) \
  138. + $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/firmware-5.bin
  139. +endef
  140. +
  141. +define Package/ath10k-firmware-qca9984/install
  142. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0
  143. + $(INSTALL_DATA) \
  144. + $(PKG_BUILD_DIR)/QCA9984/hw1.0/board-2.bin \
  145. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin
  146. + $(INSTALL_DATA) \
  147. + $(PKG_BUILD_DIR)/QCA9984/hw1.0/firmware-5.bin_10.4-3.2-00072 \
  148. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/firmware-5.bin
  149. +endef
  150. +
  151. $(eval $(call BuildPackage,ath10k-firmware-qca988x))
  152. $(eval $(call BuildPackage,ath10k-firmware-qca99x0))
  153. $(eval $(call BuildPackage,ath10k-firmware-qca6174))
  154. +$(eval $(call BuildPackage,ath10k-firmware-qca9984))
  155. +
  156. +$(eval $(call BuildPackage,ath10k-firmware-qca988x-ct))
  157. +$(eval $(call BuildPackage,ath10k-firmware-qca99x0-ct))
  158. diff --git a/package/firmware/linux-firmware/Makefile b/package/firmware/linux-firmware/Makefile
  159. index 2fcd93b..7a2e977 100644
  160. --- a/package/firmware/linux-firmware/Makefile
  161. +++ b/package/firmware/linux-firmware/Makefile
  162. @@ -16,10 +16,10 @@ PKG_SOURCE_PROTO:=git
  163. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  164. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
  165. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
  166. -PKG_SOURCE_URL:=git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
  167. -PKG_MIRROR_MD5SUM:=ca4d289ad9380471cae376fc7dd3660a
  168. +PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
  169. +PKG_MIRROR_MD5SUM:=8d44332359de89b1936b4ff608a72614
  170. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  171. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  172. SCAN_DEPS = *.mk
  173. diff --git a/package/firmware/linux-firmware/realtek.mk b/package/firmware/linux-firmware/realtek.mk
  174. index 0f8b1ce..4229ca0 100644
  175. --- a/package/firmware/linux-firmware/realtek.mk
  176. +++ b/package/firmware/linux-firmware/realtek.mk
  177. @@ -43,8 +43,15 @@ endef
  178. $(eval $(call BuildPackage,rtl8192de-firmware))
  179. Package/rtl8192se-firmware = $(call Package/firmware-default,RealTek RTL8192SE firmware)
  180. -define KernelPackage/rtl8192se/install
  181. +define Package/rtl8192se-firmware/install
  182. $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  183. $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8192sefw.bin $(1)/lib/firmware/rtlwifi
  184. endef
  185. $(eval $(call BuildPackage,rtl8192se-firmware))
  186. +
  187. +Package/rtl8192su-firmware = $(call Package/firmware-default,RealTek RTL8192SU firmware)
  188. +define Package/rtl8192su-firmware/install
  189. + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  190. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8712u.bin $(1)/lib/firmware/rtlwifi
  191. +endef
  192. +$(eval $(call BuildPackage,rtl8192su-firmware))
  193. diff --git a/package/kernel/acx-mac80211/Makefile b/package/kernel/acx-mac80211/Makefile
  194. index 1820e7a..8fce374 100644
  195. --- a/package/kernel/acx-mac80211/Makefile
  196. +++ b/package/kernel/acx-mac80211/Makefile
  197. @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk
  198. include $(INCLUDE_DIR)/kernel.mk
  199. PKG_NAME:=acx-mac80211
  200. -PKG_REV:=v20130127
  201. -PKG_VERSION:=20130909
  202. +PKG_REV:=b6fc31491020cb01d2cd1acc170cfa03ced7e726
  203. +PKG_VERSION:=20140216
  204. PKG_RELEASE:=1
  205. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  206. -PKG_SOURCE_URL:=git://acx100.git.sourceforge.net/gitroot/acx100/acx-mac80211
  207. +PKG_SOURCE_URL:=http://git.code.sf.net/p/acx100/acx-mac80211
  208. PKG_SOURCE_PROTO:=git
  209. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  210. PKG_SOURCE_VERSION:=$(PKG_REV)
  211. @@ -190,7 +190,7 @@ define Build/Compile
  212. CROSS_COMPILE="$(TARGET_CROSS)" \
  213. SUBDIRS="$(PKG_BUILD_DIR)" \
  214. $(PKG_EXTRA_KCONFIG) \
  215. - EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS) -DCONFIG_ACX_MAC80211_VERSION=\"KERNEL_VERSION(3,14,0)\"" \
  216. + EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS) -DCONFIG_ACX_MAC80211_VERSION=\"KERNEL_VERSION(4,2,0)\"" \
  217. LINUXINCLUDE="-I$(STAGING_DIR)/usr/include/mac80211-backport/uapi -I$(STAGING_DIR)/usr/include/mac80211-backport \
  218. -I$(STAGING_DIR)/usr/include/mac80211/uapi -I$(STAGING_DIR)/usr/include/mac80211 \
  219. -I$(LINUX_DIR)/include -I$(LINUX_DIR)/include/$(LINUX_UAPI_DIR) \
  220. diff --git a/package/kernel/acx-mac80211/patches/001-pci-mem-Fix-3.8-build.patch b/package/kernel/acx-mac80211/patches/001-pci-mem-Fix-3.8-build.patch
  221. deleted file mode 100644
  222. index fa4a6be..0000000
  223. --- a/package/kernel/acx-mac80211/patches/001-pci-mem-Fix-3.8-build.patch
  224. +++ /dev/null
  225. @@ -1,129 +0,0 @@
  226. -From 8a0f5890019bf43f4bc95ef0754b062ddfcfa9cd Mon Sep 17 00:00:00 2001
  227. -From: Oliver Winker <oliver@oli1170.net>
  228. -Date: Sun, 10 Mar 2013 21:04:23 +0100
  229. -Subject: [PATCH 1/3] pci, mem: Fix 3.8 build
  230. -
  231. -__devexit and __devinit not used anymore in 3.8
  232. -
  233. -Signed-off-by: Reinhard Karcher <reinhard.karcher@gmx.net>
  234. -Signed-off-by: Oliver Winker <oliver@oli1170.net>
  235. ----
  236. - mem.c | 13 ++++++++++++-
  237. - pci.c | 26 +++++++++++++++++++++++++-
  238. - 2 files changed, 37 insertions(+), 2 deletions(-)
  239. -
  240. ---- a/mem.c
  241. -+++ b/mem.c
  242. -@@ -2216,7 +2216,11 @@ int acx100mem_ioctl_set_phy_amp_bias(str
  243. - * ==================================================
  244. - */
  245. -
  246. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  247. - static int __devinit acxmem_probe(struct platform_device *pdev)
  248. -+#else
  249. -+static int acxmem_probe(struct platform_device *pdev)
  250. -+#endif
  251. - {
  252. - acx_device_t *adev = NULL;
  253. - const char *chip_name;
  254. -@@ -2392,7 +2396,11 @@ static int __devinit acxmem_probe(struct
  255. - * pdev - ptr to PCI device structure containing info about pci
  256. - * configuration
  257. - */
  258. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  259. - static int __devexit acxmem_remove(struct platform_device *pdev)
  260. -+#else
  261. -+static int acxmem_remove(struct platform_device *pdev)
  262. -+#endif
  263. - {
  264. - struct ieee80211_hw *hw = (struct ieee80211_hw *)
  265. - platform_get_drvdata(pdev);
  266. -@@ -2594,8 +2602,11 @@ static struct platform_driver acxmem_dri
  267. - .name = "acx-mem",
  268. - },
  269. - .probe = acxmem_probe,
  270. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  271. - .remove = __devexit_p(acxmem_remove),
  272. --
  273. -+#else
  274. -+ .remove = acxmem_remove,
  275. -+#endif
  276. - #ifdef CONFIG_PM
  277. - .suspend = acxmem_e_suspend,
  278. - .resume = acxmem_e_resume
  279. ---- a/pci.c
  280. -+++ b/pci.c
  281. -@@ -1039,7 +1039,11 @@ int acx100pci_ioctl_set_phy_amp_bias(str
  282. - * id - ptr to the device id entry that matched this device
  283. - */
  284. - #ifdef CONFIG_PCI
  285. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  286. - static int __devinit acxpci_probe(struct pci_dev *pdev,
  287. -+#else
  288. -+static int acxpci_probe(struct pci_dev *pdev,
  289. -+#endif
  290. - const struct pci_device_id *id)
  291. - {
  292. - unsigned long mem_region1 = 0;
  293. -@@ -1292,7 +1296,11 @@ static int __devinit acxpci_probe(struct
  294. - *
  295. - * pdev - ptr to PCI device structure containing info about pci configuration
  296. - */
  297. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  298. - static void __devexit acxpci_remove(struct pci_dev *pdev)
  299. -+#else
  300. -+static void acxpci_remove(struct pci_dev *pdev)
  301. -+#endif
  302. - {
  303. - struct ieee80211_hw *hw
  304. - = (struct ieee80211_hw *) pci_get_drvdata(pdev);
  305. -@@ -1505,7 +1513,11 @@ static struct pci_driver acxpci_driver =
  306. - .name = "acx_pci",
  307. - .id_table = acxpci_id_tbl,
  308. - .probe = acxpci_probe,
  309. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  310. - .remove = __devexit_p(acxpci_remove),
  311. -+#else
  312. -+ .remove = acxpci_remove,
  313. -+#endif
  314. - #ifdef CONFIG_PM
  315. - .suspend = acxpci_e_suspend,
  316. - .resume = acxpci_e_resume
  317. -@@ -1603,8 +1615,12 @@ static struct vlynq_device_id acx_vlynq_
  318. - };
  319. -
  320. -
  321. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  322. - static __devinit int vlynq_probe(struct vlynq_device *vdev,
  323. -- struct vlynq_device_id *id)
  324. -+#else
  325. -+static int vlynq_probe(struct vlynq_device *vdev,
  326. -+#endif
  327. -+ struct vlynq_device_id *id)
  328. - {
  329. - int result = -EIO, i;
  330. - u32 addr;
  331. -@@ -1785,7 +1801,11 @@ static __devinit int vlynq_probe(struct
  332. - return result;
  333. - }
  334. -
  335. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  336. - static __devexit void vlynq_remove(struct vlynq_device *vdev)
  337. -+#else
  338. -+static void vlynq_remove(struct vlynq_device *vdev)
  339. -+#endif
  340. - {
  341. - struct ieee80211_hw *hw = vlynq_get_drvdata(vdev);
  342. - acx_device_t *adev = hw2adev(hw);
  343. -@@ -1851,7 +1871,11 @@ static struct vlynq_driver acxvlynq_driv
  344. - .name = "acx_vlynq",
  345. - .id_table = acx_vlynq_id,
  346. - .probe = vlynq_probe,
  347. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  348. - .remove = __devexit_p(vlynq_remove),
  349. -+#else
  350. -+ .remove = vlynq_remove,
  351. -+#endif
  352. - };
  353. - #endif /* CONFIG_VLYNQ */
  354. -
  355. diff --git a/package/kernel/acx-mac80211/patches/003-Fix-3.10-build.patch b/package/kernel/acx-mac80211/patches/003-Fix-3.10-build.patch
  356. deleted file mode 100644
  357. index c737844..0000000
  358. --- a/package/kernel/acx-mac80211/patches/003-Fix-3.10-build.patch
  359. +++ /dev/null
  360. @@ -1,31 +0,0 @@
  361. -From 1daf4bfdb072b08f3b4e412bbfa9645f88dc0a01 Mon Sep 17 00:00:00 2001
  362. -From: Oliver Winker <oliver@oli1170.net>
  363. -Date: Tue, 3 Sep 2013 20:36:36 +0200
  364. -Subject: [PATCH 3/3] Fix 3.10 build
  365. -
  366. -Signed-off-by: Reinhard Karcher <reinhard.karcher@gmx.net>
  367. -Signed-off-by: Oliver Winker <oliver@oli1170.net>
  368. ----
  369. - main.c | 7 +++++++
  370. - 1 file changed, 7 insertions(+)
  371. -
  372. ---- a/main.c
  373. -+++ b/main.c
  374. -@@ -682,10 +682,17 @@ int acx_op_config(struct ieee80211_hw *h
  375. -
  376. - if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
  377. - logf1(L_DEBUG, "IEEE80211_CONF_CHANGE_CHANNEL,"
  378. -+#if CONFIG_ACX_MAC80211_VERSION >= KERNEL_VERSION(3, 10, 0)
  379. -+ "channel->hw_value=%i\n", conf->chandef.chan->hw_value);
  380. -+
  381. -+ acx_set_channel(adev, conf->chandef.chan->hw_value,
  382. -+ conf->chandef.chan->center_freq);
  383. -+#else
  384. - "channel->hw_value=%i\n", conf->channel->hw_value);
  385. -
  386. - acx_set_channel(adev, conf->channel->hw_value,
  387. - conf->channel->center_freq);
  388. -+#endif
  389. -
  390. - changed_not_done &= ~IEEE80211_CONF_CHANGE_CHANNEL;
  391. - }
  392. diff --git a/package/kernel/acx-mac80211/patches/004-Fix-3.14-build.patch b/package/kernel/acx-mac80211/patches/004-Fix-3.14-build.patch
  393. deleted file mode 100644
  394. index 847b573..0000000
  395. --- a/package/kernel/acx-mac80211/patches/004-Fix-3.14-build.patch
  396. +++ /dev/null
  397. @@ -1,22 +0,0 @@
  398. -From d17fcac710e629463591f6bd09d76b66ec591583 Mon Sep 17 00:00:00 2001
  399. -From: Hauke Mehrtens <hauke@hauke-m.de>
  400. -Date: Wed, 5 Feb 2014 20:57:07 +0100
  401. -Subject: [PATCH] Fix 3.14 build
  402. -
  403. -Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  404. ----
  405. - main.c | 2 ++
  406. - 1 file changed, 2 insertions(+)
  407. -
  408. ---- a/main.c
  409. -+++ b/main.c
  410. -@@ -500,7 +500,9 @@ int acx_init_ieee80211(acx_device_t *ade
  411. - hw->flags &= ~IEEE80211_HW_RX_INCLUDES_FCS;
  412. - hw->queues = 1;
  413. - hw->wiphy->max_scan_ssids = 1;
  414. -+#if CONFIG_ACX_MAC80211_VERSION < KERNEL_VERSION(3, 14, 0)
  415. - hw->channel_change_time = 10000;
  416. -+#endif
  417. -
  418. - /* OW TODO Check if RTS/CTS threshold can be included here */
  419. -
  420. diff --git a/package/kernel/acx-mac80211/patches/300-api_sync.patch b/package/kernel/acx-mac80211/patches/300-api_sync.patch
  421. new file mode 100644
  422. index 0000000..94d6135
  423. --- /dev/null
  424. +++ b/package/kernel/acx-mac80211/patches/300-api_sync.patch
  425. @@ -0,0 +1,83 @@
  426. +--- a/main.c
  427. ++++ b/main.c
  428. +@@ -497,7 +497,7 @@ int acx_free_mechanics(acx_device_t *ade
  429. +
  430. + int acx_init_ieee80211(acx_device_t *adev, struct ieee80211_hw *hw)
  431. + {
  432. +- hw->flags &= ~IEEE80211_HW_RX_INCLUDES_FCS;
  433. ++ __clear_bit(IEEE80211_HW_RX_INCLUDES_FCS, hw->flags);
  434. + hw->queues = 1;
  435. + hw->wiphy->max_scan_ssids = 1;
  436. +
  437. +@@ -525,14 +525,14 @@ int acx_init_ieee80211(acx_device_t *ade
  438. + /* We base signal quality on winlevel approach of previous driver
  439. + * TODO OW 20100615 This should into a common init code
  440. + */
  441. +- hw->flags |= IEEE80211_HW_SIGNAL_UNSPEC;
  442. ++ __set_bit(IEEE80211_HW_SIGNAL_UNSPEC, hw->flags);
  443. + hw->max_signal = 100;
  444. +
  445. + if (IS_ACX100(adev)) {
  446. +- adev->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
  447. ++ adev->hw->wiphy->bands[NL80211_BAND_2GHZ] =
  448. + &acx100_band_2GHz;
  449. + } else if (IS_ACX111(adev))
  450. +- adev->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
  451. ++ adev->hw->wiphy->bands[NL80211_BAND_2GHZ] =
  452. + &acx111_band_2GHz;
  453. + else {
  454. + log(L_ANY, "Error: Unknown device");
  455. +@@ -945,8 +945,8 @@ void acx_op_configure_filter(struct ieee
  456. + changed_flags, *total_flags);
  457. +
  458. + /* OWI TODO: Set also FIF_PROBE_REQ ? */
  459. +- *total_flags &= (FIF_PROMISC_IN_BSS | FIF_ALLMULTI | FIF_FCSFAIL
  460. +- | FIF_CONTROL | FIF_OTHER_BSS);
  461. ++ *total_flags &= (FIF_ALLMULTI | FIF_FCSFAIL | FIF_CONTROL
  462. ++ | FIF_OTHER_BSS);
  463. +
  464. + logf1(L_DEBUG, "2: *total_flags=0x%08x\n", *total_flags);
  465. +
  466. +@@ -1045,9 +1045,10 @@ void acx_op_tx(struct ieee80211_hw *hw,
  467. + }
  468. +
  469. + int acx_op_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  470. +- struct cfg80211_scan_request *req)
  471. ++ struct ieee80211_scan_request *hw_req)
  472. + {
  473. + acx_device_t *adev = hw2adev(hw);
  474. ++ struct cfg80211_scan_request *req = &hw_req->req;
  475. + struct sk_buff *skb;
  476. + size_t ssid_len = 0;
  477. + u8 *ssid = NULL;
  478. +@@ -1082,7 +1083,7 @@ int acx_op_hw_scan(struct ieee80211_hw *
  479. + goto out;
  480. + }
  481. + #else
  482. +- skb = ieee80211_probereq_get(adev->hw, adev->vif, ssid, ssid_len,
  483. ++ skb = ieee80211_probereq_get(adev->hw, vif->addr, ssid, ssid_len,
  484. + req->ie_len);
  485. + if (!skb) {
  486. + ret = -ENOMEM;
  487. +--- a/main.h
  488. ++++ b/main.h
  489. +@@ -62,7 +62,7 @@ void acx_op_tx(struct ieee80211_hw *hw,
  490. + #endif
  491. +
  492. + int acx_op_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  493. +- struct cfg80211_scan_request *req);
  494. ++ struct ieee80211_scan_request *req);
  495. +
  496. + int acx_recover_hw(acx_device_t *adev);
  497. +
  498. +--- a/cardsetting.c
  499. ++++ b/cardsetting.c
  500. +@@ -159,7 +159,7 @@ int acx_set_channel(acx_device_t *adev,
  501. + int res = 0;
  502. +
  503. + adev->rx_status.freq = freq;
  504. +- adev->rx_status.band = IEEE80211_BAND_2GHZ;
  505. ++ adev->rx_status.band = NL80211_BAND_2GHZ;
  506. +
  507. + adev->channel = channel;
  508. +
  509. diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
  510. index 30da1cf..bee0723 100644
  511. --- a/package/kernel/mac80211/Makefile
  512. +++ b/package/kernel/mac80211/Makefile
  513. @@ -10,20 +10,21 @@ include $(INCLUDE_DIR)/kernel.mk
  514. PKG_NAME:=mac80211
  515. -PKG_VERSION:=2016-01-10
  516. +PKG_VERSION:=2016-05-12
  517. PKG_RELEASE:=1
  518. PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
  519. PKG_BACKPORT_VERSION:=
  520. -PKG_MD5SUM:=be5fae2e8d6f7490f9b073374fb895ba
  521. +PKG_MD5SUM:=2142cf38509896dca108624e7c193611
  522. PKG_SOURCE:=compat-wireless-$(PKG_VERSION)$(PKG_BACKPORT_VERSION).tar.bz2
  523. PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION)
  524. PKG_BUILD_PARALLEL:=1
  525. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  526. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  527. PKG_DRIVERS = \
  528. adm8211 \
  529. + airo \
  530. ath ath5k ath9k ath9k-common ath9k-htc ath10k \
  531. b43 b43legacy \
  532. carl9170 \
  533. @@ -52,6 +53,7 @@ PKG_CONFIG_DEPENDS:= \
  534. $(patsubst %,CONFIG_PACKAGE_kmod-%,$(PKG_DRIVERS)) \
  535. CONFIG_PACKAGE_MAC80211_DEBUGFS \
  536. CONFIG_PACKAGE_MAC80211_MESH \
  537. + CONFIG_PACKAGE_MAC80211_TRACING \
  538. CONFIG_PACKAGE_ATH_DEBUG \
  539. CONFIG_PACKAGE_ATH_DFS \
  540. CONFIG_PACKAGE_B43_DEBUG \
  541. @@ -63,7 +65,12 @@ PKG_CONFIG_DEPENDS:= \
  542. CONFIG_PACKAGE_B43_BUSES_BCMA_AND_SSB \
  543. CONFIG_PACKAGE_B43_BUSES_BCMA \
  544. CONFIG_PACKAGE_B43_BUSES_SSB \
  545. + CONFIG_PACKAGE_BRCM80211_DEBUG \
  546. + CONFIG_PACKAGE_IWLWIFI_DEBUG \
  547. + CONFIG_PACKAGE_IWLWIFI_DEBUGFS \
  548. CONFIG_PACKAGE_RTLWIFI_DEBUG \
  549. + CONFIG_ATH9K_SUPPORT_PCOEM \
  550. + CONFIG_ATH9K_TX99 \
  551. CONFIG_ATH_USER_REGD \
  552. include $(INCLUDE_DIR)/package.mk
  553. @@ -73,7 +80,7 @@ WMENU:=Wireless Drivers
  554. define KernelPackage/mac80211/Default
  555. SUBMENU:=$(WMENU)
  556. URL:=https://wireless.wiki.kernel.org/
  557. - MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  558. + MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  559. endef
  560. define KernelPackage/cfg80211
  561. @@ -92,7 +99,7 @@ endef
  562. define KernelPackage/mac80211
  563. $(call KernelPackage/mac80211/Default)
  564. TITLE:=Linux 802.11 Wireless Networking Stack
  565. - DEPENDS+= +kmod-cfg80211 +hostapd-common +kmod-crypto-core +kmod-crypto-arc4
  566. + DEPENDS+= +kmod-cfg80211 +hostapd-common
  567. KCONFIG:=\
  568. CONFIG_AVERAGE=y
  569. FILES:= $(PKG_BUILD_DIR)/net/mac80211/mac80211.ko
  570. @@ -138,10 +145,23 @@ define KernelPackage/adm8211
  571. AUTOLOAD:=$(call AutoProbe,adm8211)
  572. endef
  573. +define KernelPackage/airo
  574. + $(call KernelPackage/mac80211/Default)
  575. + TITLE:=Cisco Aironet driver
  576. + DEPENDS+=@PCI_SUPPORT +@DRIVER_WEXT_SUPPORT +kmod-cfg80211 @TARGET_x86
  577. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/cisco/airo.ko
  578. + AUTOLOAD:=$(call AutoProbe,airo)
  579. +endef
  580. +
  581. +define KernelPackage/airo/description
  582. + Kernel support for Cisco Aironet cards
  583. +endef
  584. +
  585. define KernelPackage/ath/config
  586. if PACKAGE_kmod-ath
  587. config ATH_USER_REGD
  588. bool "Force Atheros drivers to respect the user's regdomain settings"
  589. + default y
  590. help
  591. Atheros' idea of regulatory handling is that the EEPROM of the card defines
  592. the regulatory limits and the user is only allowed to restrict the settings
  593. @@ -226,6 +246,10 @@ define KernelPackage/ath9k/config
  594. bool "Support chips used in PC OEM cards"
  595. depends on PACKAGE_kmod-ath9k
  596. + config ATH9K_TX99
  597. + bool "Enable TX99 support"
  598. + depends on PACKAGE_kmod-ath9k
  599. +
  600. endef
  601. define KernelPackage/ath9k-htc
  602. @@ -247,7 +271,7 @@ define KernelPackage/ath10k
  603. $(call KernelPackage/mac80211/Default)
  604. TITLE:=Atheros 802.11ac wireless cards support
  605. URL:=https://wireless.wiki.kernel.org/en/users/Drivers/ath10k
  606. - DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY +ath10k-firmware-qca988x
  607. + DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY
  608. FILES:= \
  609. $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_core.ko \
  610. $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_pci.ko
  611. @@ -673,6 +697,7 @@ define KernelPackage/brcmfmac/config
  612. config BRCMFMAC_SDIO
  613. bool "Enable SDIO bus interface support"
  614. + default y if TARGET_brcm2708
  615. default n
  616. help
  617. Enable support for cards attached to an SDIO bus.
  618. @@ -761,7 +786,7 @@ endef
  619. define KernelPackage/iwlwifi
  620. $(call KernelPackage/mac80211/Default)
  621. - DEPENDS:= +kmod-mac80211 @PCI_SUPPORT +@DRIVER_11N_SUPPORT +iwlwifi-firmware
  622. + DEPENDS:= +kmod-mac80211 @PCI_SUPPORT +@DRIVER_11N_SUPPORT +iwlwifi-firmware @!LINUX_3_18
  623. TITLE:=Intel AGN Wireless support
  624. FILES:= \
  625. $(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlwifi/iwlwifi.ko \
  626. @@ -870,7 +895,7 @@ endef
  627. define KernelPackage/lib80211
  628. $(call KernelPackage/mac80211/Default)
  629. TITLE:=802.11 Networking stack
  630. - DEPENDS:=+kmod-cfg80211
  631. + DEPENDS:=+kmod-cfg80211 +kmod-crypto-hash
  632. FILES:= \
  633. $(PKG_BUILD_DIR)/net/wireless/lib80211.ko \
  634. $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_wep.ko \
  635. @@ -897,7 +922,7 @@ endef
  636. define KernelPackage/libipw
  637. $(call KernelPackage/mac80211/Default)
  638. TITLE:=libipw for ipw2100 and ipw2200
  639. - DEPENDS:=@PCI_SUPPORT +kmod-crypto-michael-mic +kmod-crypto-core +kmod-crypto-arc4 +kmod-lib80211 +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT @!BIG_ENDIAN
  640. + DEPENDS:=@PCI_SUPPORT +kmod-crypto-michael-mic +kmod-lib80211 +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT @!BIG_ENDIAN
  641. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/ipw2x00/libipw.ko
  642. AUTOLOAD:=$(call AutoProbe,libipw)
  643. endef
  644. @@ -978,7 +1003,7 @@ endef
  645. define KernelPackage/libertas-spi
  646. $(call KernelPackage/mac80211/Default)
  647. SUBMENU:=Wireless Drivers
  648. - DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +@DRIVER_WEXT_SUPPORT +libertas-spi-firmware
  649. + DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +@DRIVER_WEXT_SUPPORT @!TARGET_uml +libertas-spi-firmware
  650. KCONFIG := \
  651. CONFIG_SPI=y \
  652. CONFIG_SPI_MASTER=y
  653. @@ -1453,6 +1478,7 @@ config-y:= \
  654. WLAN_VENDOR_ATH \
  655. WLAN_VENDOR_ATMEL \
  656. WLAN_VENDOR_BROADCOM \
  657. + WLAN_VENDOR_CISCO \
  658. WLAN_VENDOR_INTEL \
  659. WLAN_VENDOR_INTERSIL \
  660. WLAN_VENDOR_MARVELL \
  661. @@ -1491,6 +1517,8 @@ endif
  662. config-$(call config_package,lib80211) += LIB80211 LIB80211_CRYPT_WEP LIB80211_CRYPT_CCMP LIB80211_CRYPT_TKIP
  663. +config-$(call config_package,airo) += AIRO
  664. +
  665. config-$(call config_package,ath) += ATH_CARDS ATH_COMMON
  666. config-$(CONFIG_PACKAGE_ATH_DEBUG) += ATH_DEBUG ATH10K_DEBUG
  667. config-$(CONFIG_PACKAGE_ATH_DFS) += ATH9K_DFS_CERTIFIED ATH10K_DFS_CERTIFIED
  668. @@ -1501,6 +1529,7 @@ config-$(CONFIG_TARGET_ar71xx) += ATH9K_AHB
  669. config-$(CONFIG_PCI) += ATH9K_PCI
  670. config-$(CONFIG_ATH_USER_REGD) += ATH_USER_REGD
  671. config-$(CONFIG_ATH9K_SUPPORT_PCOEM) += ATH9K_PCOEM
  672. +config-$(CONFIG_ATH9K_TX99) += ATH9K_TX99
  673. config-$(call config_package,ath9k-htc) += ATH9K_HTC
  674. config-$(call config_package,ath10k) += ATH10K ATH10K_PCI
  675. @@ -1764,6 +1793,7 @@ endef
  676. $(eval $(call KernelPackage,adm8211))
  677. +$(eval $(call KernelPackage,airo))
  678. $(eval $(call KernelPackage,ath))
  679. $(eval $(call KernelPackage,ath10k))
  680. $(eval $(call KernelPackage,ath5k))
  681. diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  682. index fb2f928..e3d612e 100644
  683. --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  684. +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  685. @@ -23,6 +23,7 @@ drv_mac80211_init_device_config() {
  686. config_add_int rxantenna txantenna antenna_gain txpower distance
  687. config_add_boolean noscan ht_coex
  688. config_add_array ht_capab
  689. + config_add_array channels
  690. config_add_boolean \
  691. rxldpc \
  692. short_gi_80 \
  693. @@ -89,6 +90,7 @@ mac80211_hostapd_setup_base() {
  694. json_select config
  695. [ "$auto_channel" -gt 0 ] && channel=acs_survey
  696. + [ "$auto_channel" -gt 0 ] && json_get_values channel_list channels
  697. json_get_vars noscan ht_coex
  698. json_get_values ht_capab_list ht_capab
  699. @@ -218,7 +220,6 @@ mac80211_hostapd_setup_base() {
  700. vht_max_a_mpdu_len_exp:7 \
  701. vht_max_mpdu:11454 \
  702. rx_stbc:4 \
  703. - tx_stbc:4 \
  704. vht_link_adapt:3 \
  705. vht160:2
  706. @@ -230,13 +231,13 @@ mac80211_hostapd_setup_base() {
  707. cap_rx_stbc=$((($vht_cap >> 8) & 7))
  708. [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc"
  709. - ht_cap_mask="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))"
  710. + vht_cap="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))"
  711. mac80211_add_capabilities vht_capab $vht_cap \
  712. RXLDPC:0x10::$rxldpc \
  713. SHORT-GI-80:0x20::$short_gi_80 \
  714. SHORT-GI-160:0x40::$short_gi_160 \
  715. - TX-STBC-2BY1:0x80::$tx_stbc \
  716. + TX-STBC-2BY1:0x80::$tx_stbc_2by1 \
  717. SU-BEAMFORMER:0x800::$su_beamformer \
  718. SU-BEAMFORMEE:0x1000::$su_beamformee \
  719. MU-BEAMFORMER:0x80000::$mu_beamformer \
  720. @@ -245,10 +246,10 @@ mac80211_hostapd_setup_base() {
  721. HTC-VHT:0x400000::$htc_vht \
  722. RX-ANTENNA-PATTERN:0x10000000::$rx_antenna_pattern \
  723. TX-ANTENNA-PATTERN:0x20000000::$tx_antenna_pattern \
  724. - RX-STBC1:0x700:0x100:1 \
  725. - RX-STBC12:0x700:0x200:1 \
  726. - RX-STBC123:0x700:0x300:1 \
  727. - RX-STBC1234:0x700:0x400:1 \
  728. + RX-STBC-1:0x700:0x100:1 \
  729. + RX-STBC-12:0x700:0x200:1 \
  730. + RX-STBC-123:0x700:0x300:1 \
  731. + RX-STBC-1234:0x700:0x400:1 \
  732. # supported Channel widths
  733. vht160_hw=0
  734. @@ -301,6 +302,7 @@ mac80211_hostapd_setup_base() {
  735. hostapd_prepare_device_config "$hostapd_conf_file" nl80211
  736. cat >> "$hostapd_conf_file" <<EOF
  737. ${channel:+channel=$channel}
  738. +${channel_list:+chanlist=$channel_list}
  739. ${noscan:+noscan=$noscan}
  740. $base_cfg
  741. @@ -391,11 +393,10 @@ mac80211_generate_mac() {
  742. find_phy() {
  743. [ -n "$phy" -a -d /sys/class/ieee80211/$phy ] && return 0
  744. [ -n "$path" ] && {
  745. - for phy in /sys/devices/$path/ieee80211/phy*; do
  746. - [ -e "$phy" ] && {
  747. - phy="${phy##*/}"
  748. - return 0
  749. - }
  750. + for phy in $(ls /sys/class/ieee80211 2>/dev/null); do
  751. + case "$(readlink -f /sys/class/ieee80211/$phy/device)" in
  752. + *$path) return 0;;
  753. + esac
  754. done
  755. }
  756. [ -n "$macaddr" ] && {
  757. @@ -481,7 +482,7 @@ mac80211_prepare_vif() {
  758. # All interfaces must have unique mac addresses
  759. # which can either be explicitly set in the device
  760. # section, or automatically generated
  761. - ifconfig "$ifname" hw ether "$macaddr"
  762. + ip link set dev "$ifname" address "$macaddr"
  763. fi
  764. json_select ..
  765. @@ -496,7 +497,7 @@ mac80211_setup_supplicant() {
  766. mac80211_setup_adhoc_htmode() {
  767. case "$htmode" in
  768. VHT20|HT20) ibss_htmode=HT20;;
  769. - HT40*|VHT40|VHT80|VHT160)
  770. + HT40*|VHT40|VHT160)
  771. case "$hwmode" in
  772. a)
  773. case "$(( ($channel / 4) % 2 ))" in
  774. @@ -520,6 +521,9 @@ mac80211_setup_adhoc_htmode() {
  775. esac
  776. [ "$auto_channel" -gt 0 ] && ibss_htmode="HT40+"
  777. ;;
  778. + VHT80)
  779. + ibss_htmode="80MHZ"
  780. + ;;
  781. NONE|NOHT)
  782. ibss_htmode="NOHT"
  783. ;;
  784. @@ -580,7 +584,7 @@ mac80211_setup_vif() {
  785. json_get_vars mode
  786. json_get_var vif_txpower txpower
  787. - ifconfig "$ifname" up || {
  788. + ip link set dev "$ifname" up || {
  789. wireless_setup_vif_failed IFUP_ERROR
  790. json_select ..
  791. return
  792. @@ -643,7 +647,7 @@ mac80211_interface_cleanup() {
  793. local phy="$1"
  794. for wdev in $(list_phy_interfaces "$phy"); do
  795. - ifconfig "$wdev" down 2>/dev/null
  796. + ip link set dev "$wdev" down 2>/dev/null
  797. iw dev "$wdev" del
  798. done
  799. }
  800. diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
  801. index ea229d6..06f3b8b 100644
  802. --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh
  803. +++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
  804. @@ -9,11 +9,10 @@ lookup_phy() {
  805. local devpath
  806. config_get devpath "$device" path
  807. [ -n "$devpath" ] && {
  808. - for _phy in /sys/devices/$devpath/ieee80211/phy*; do
  809. - [ -e "$_phy" ] && {
  810. - phy="${_phy##*/}"
  811. - return
  812. - }
  813. + for phy in $(ls /sys/class/ieee80211 2>/dev/null); do
  814. + case "$(readlink -f /sys/class/ieee80211/$phy/device)" in
  815. + *$devpath) return;;
  816. + esac
  817. done
  818. }
  819. @@ -102,6 +101,9 @@ detect_mac80211() {
  820. fi
  821. if [ -n "$path" ]; then
  822. path="${path##/sys/devices/}"
  823. + case "$path" in
  824. + platform*/pci*) path="${path##platform/}";;
  825. + esac
  826. dev_id=" option path '$path'"
  827. else
  828. dev_id=" option macaddr $(cat /sys/class/ieee80211/${dev}/macaddress)"
  829. diff --git a/package/kernel/mac80211/patches/004-backports-add-skb_free_frag.patch b/package/kernel/mac80211/patches/004-backports-add-skb_free_frag.patch
  830. deleted file mode 100644
  831. index 9adfd8f..0000000
  832. --- a/package/kernel/mac80211/patches/004-backports-add-skb_free_frag.patch
  833. +++ /dev/null
  834. @@ -1,21 +0,0 @@
  835. -From: Felix Fietkau <nbd@openwrt.org>
  836. -Date: Thu, 28 Jan 2016 15:16:35 +0100
  837. -Subject: [PATCH] backports: add skb_free_frag()
  838. -
  839. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  840. ----
  841. -
  842. ---- a/backport-include/linux/skbuff.h
  843. -+++ b/backport-include/linux/skbuff.h
  844. -@@ -300,4 +300,11 @@ int skb_ensure_writable(struct sk_buff *
  845. -
  846. - #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) */
  847. -
  848. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
  849. -+static inline void skb_free_frag(void *data)
  850. -+{
  851. -+ put_page(virt_to_head_page(data));
  852. -+}
  853. -+#endif
  854. -+
  855. - #endif /* __BACKPORT_SKBUFF_H */
  856. diff --git a/package/kernel/mac80211/patches/004-header-backport-GENL_UNS_ADMIN_PERM.patch b/package/kernel/mac80211/patches/004-header-backport-GENL_UNS_ADMIN_PERM.patch
  857. new file mode 100644
  858. index 0000000..38d655f
  859. --- /dev/null
  860. +++ b/package/kernel/mac80211/patches/004-header-backport-GENL_UNS_ADMIN_PERM.patch
  861. @@ -0,0 +1,21 @@
  862. +From: Felix Fietkau <nbd@nbd.name>
  863. +Date: Sat, 14 May 2016 16:39:35 +0200
  864. +Subject: [PATCH] header: backport GENL_UNS_ADMIN_PERM
  865. +
  866. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  867. +---
  868. + create mode 100644 backport-include/uapi/linux/genetlink.h
  869. +
  870. +--- /dev/null
  871. ++++ b/backport-include/uapi/linux/genetlink.h
  872. +@@ -0,0 +1,10 @@
  873. ++#ifndef __COMPAT_UAPI_LINUX_GENETLINK_H
  874. ++#define __COMPAT_UAPI_LINUX_GENETLINK_H
  875. ++
  876. ++#include_next <uapi/linux/genetlink.h>
  877. ++
  878. ++#ifndef GENL_UNS_ADMIN_PERM
  879. ++#define GENL_UNS_ADMIN_PERM GENL_ADMIN_PERM
  880. ++#endif
  881. ++
  882. ++#endif
  883. diff --git a/package/kernel/mac80211/patches/005-backports-add-napi_alloc_frag.patch b/package/kernel/mac80211/patches/005-backports-add-napi_alloc_frag.patch
  884. deleted file mode 100644
  885. index 9b672a8..0000000
  886. --- a/package/kernel/mac80211/patches/005-backports-add-napi_alloc_frag.patch
  887. +++ /dev/null
  888. @@ -1,20 +0,0 @@
  889. -From: Felix Fietkau <nbd@openwrt.org>
  890. -Date: Thu, 28 Jan 2016 15:19:22 +0100
  891. -Subject: [PATCH] backports: add napi_alloc_frag
  892. -
  893. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  894. ----
  895. -
  896. ---- a/backport-include/linux/netdevice.h
  897. -+++ b/backport-include/linux/netdevice.h
  898. -@@ -232,6 +232,10 @@ static inline void backport_unregister_n
  899. - #define unregister_netdevice_many LINUX_BACKPORT(unregister_netdevice_many)
  900. - #endif
  901. -
  902. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
  903. -+#define napi_alloc_frag netdev_alloc_frag
  904. -+#endif
  905. -+
  906. - /*
  907. - * Complicated way of saying: We only backport netdev_rss_key stuff on kernels
  908. - * that either already have net_get_random_once() (>= 3.13) or where we've been
  909. diff --git a/package/kernel/mac80211/patches/005-header-backport-nla_put_u64_64bit-and-nla_put_64bit.patch b/package/kernel/mac80211/patches/005-header-backport-nla_put_u64_64bit-and-nla_put_64bit.patch
  910. new file mode 100644
  911. index 0000000..e20d87a
  912. --- /dev/null
  913. +++ b/package/kernel/mac80211/patches/005-header-backport-nla_put_u64_64bit-and-nla_put_64bit.patch
  914. @@ -0,0 +1,158 @@
  915. +From: Felix Fietkau <nbd@nbd.name>
  916. +Date: Sat, 14 May 2016 16:40:16 +0200
  917. +Subject: [PATCH] header: backport nla_put_u64_64bit and nla_put_64bit
  918. +
  919. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  920. +---
  921. +
  922. +--- a/backport-include/net/netlink.h
  923. ++++ b/backport-include/net/netlink.h
  924. +@@ -189,4 +189,148 @@ static inline __le64 nla_get_le64(const
  925. + }
  926. + #endif /* < 4.4 */
  927. +
  928. ++
  929. ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0)
  930. ++
  931. ++/**
  932. ++ * nla_need_padding_for_64bit - test 64-bit alignment of the next attribute
  933. ++ * @skb: socket buffer the message is stored in
  934. ++ *
  935. ++ * Return true if padding is needed to align the next attribute (nla_data()) to
  936. ++ * a 64-bit aligned area.
  937. ++ */
  938. ++static inline bool nla_need_padding_for_64bit(struct sk_buff *skb)
  939. ++{
  940. ++#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
  941. ++ /* The nlattr header is 4 bytes in size, that's why we test
  942. ++ * if the skb->data _is_ aligned. A NOP attribute, plus
  943. ++ * nlattr header for next attribute, will make nla_data()
  944. ++ * 8-byte aligned.
  945. ++ */
  946. ++ if (IS_ALIGNED((unsigned long)skb_tail_pointer(skb), 8))
  947. ++ return true;
  948. ++#endif
  949. ++ return false;
  950. ++}
  951. ++
  952. ++/**
  953. ++ * nla_align_64bit - 64-bit align the nla_data() of next attribute
  954. ++ * @skb: socket buffer the message is stored in
  955. ++ * @padattr: attribute type for the padding
  956. ++ *
  957. ++ * Conditionally emit a padding netlink attribute in order to make
  958. ++ * the next attribute we emit have a 64-bit aligned nla_data() area.
  959. ++ * This will only be done in architectures which do not have
  960. ++ * CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS defined.
  961. ++ *
  962. ++ * Returns zero on success or a negative error code.
  963. ++ */
  964. ++static inline int nla_align_64bit(struct sk_buff *skb, int padattr)
  965. ++{
  966. ++ if (nla_need_padding_for_64bit(skb) &&
  967. ++ !nla_reserve(skb, padattr, 0))
  968. ++ return -EMSGSIZE;
  969. ++
  970. ++ return 0;
  971. ++}
  972. ++
  973. ++/**
  974. ++ * __nla_reserve_64bit - reserve room for attribute on the skb and align it
  975. ++ * @skb: socket buffer to reserve room on
  976. ++ * @attrtype: attribute type
  977. ++ * @attrlen: length of attribute payload
  978. ++ * @padattr: attribute type for the padding
  979. ++ *
  980. ++ * Adds a netlink attribute header to a socket buffer and reserves
  981. ++ * room for the payload but does not copy it. It also ensure that this
  982. ++ * attribute will have a 64-bit aligned nla_data() area.
  983. ++ *
  984. ++ * The caller is responsible to ensure that the skb provides enough
  985. ++ * tailroom for the attribute header and payload.
  986. ++ */
  987. ++static inline struct nlattr *__nla_reserve_64bit(struct sk_buff *skb, int attrtype,
  988. ++ int attrlen, int padattr)
  989. ++{
  990. ++ if (nla_need_padding_for_64bit(skb))
  991. ++ nla_align_64bit(skb, padattr);
  992. ++
  993. ++ return __nla_reserve(skb, attrtype, attrlen);
  994. ++}
  995. ++
  996. ++/**
  997. ++ * __nla_put_64bit - Add a netlink attribute to a socket buffer and align it
  998. ++ * @skb: socket buffer to add attribute to
  999. ++ * @attrtype: attribute type
  1000. ++ * @attrlen: length of attribute payload
  1001. ++ * @data: head of attribute payload
  1002. ++ * @padattr: attribute type for the padding
  1003. ++ *
  1004. ++ * The caller is responsible to ensure that the skb provides enough
  1005. ++ * tailroom for the attribute header and payload.
  1006. ++ */
  1007. ++static inline void __nla_put_64bit(struct sk_buff *skb, int attrtype, int attrlen,
  1008. ++ const void *data, int padattr)
  1009. ++{
  1010. ++ struct nlattr *nla;
  1011. ++
  1012. ++ nla = __nla_reserve_64bit(skb, attrtype, attrlen, padattr);
  1013. ++ memcpy(nla_data(nla), data, attrlen);
  1014. ++}
  1015. ++
  1016. ++/**
  1017. ++ * nla_total_size_64bit - total length of attribute including padding
  1018. ++ * @payload: length of payload
  1019. ++ */
  1020. ++static inline int nla_total_size_64bit(int payload)
  1021. ++{
  1022. ++ return NLA_ALIGN(nla_attr_size(payload))
  1023. ++#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
  1024. ++ + NLA_ALIGN(nla_attr_size(0))
  1025. ++#endif
  1026. ++ ;
  1027. ++}
  1028. ++
  1029. ++/**
  1030. ++ * nla_put_64bit - Add a netlink attribute to a socket buffer and align it
  1031. ++ * @skb: socket buffer to add attribute to
  1032. ++ * @attrtype: attribute type
  1033. ++ * @attrlen: length of attribute payload
  1034. ++ * @data: head of attribute payload
  1035. ++ * @padattr: attribute type for the padding
  1036. ++ *
  1037. ++ * Returns -EMSGSIZE if the tailroom of the skb is insufficient to store
  1038. ++ * the attribute header and payload.
  1039. ++ */
  1040. ++static inline int nla_put_64bit(struct sk_buff *skb, int attrtype, int attrlen,
  1041. ++ const void *data, int padattr)
  1042. ++{
  1043. ++ size_t len;
  1044. ++
  1045. ++ if (nla_need_padding_for_64bit(skb))
  1046. ++ len = nla_total_size_64bit(attrlen);
  1047. ++ else
  1048. ++ len = nla_total_size(attrlen);
  1049. ++ if (unlikely(skb_tailroom(skb) < len))
  1050. ++ return -EMSGSIZE;
  1051. ++
  1052. ++ __nla_put_64bit(skb, attrtype, attrlen, data, padattr);
  1053. ++ return 0;
  1054. ++}
  1055. ++
  1056. ++/**
  1057. ++ * nla_put_u64_64bit - Add a u64 netlink attribute to a skb and align it
  1058. ++ * @skb: socket buffer to add attribute to
  1059. ++ * @attrtype: attribute type
  1060. ++ * @value: numeric value
  1061. ++ * @padattr: attribute type for the padding
  1062. ++ */
  1063. ++static inline int nla_put_u64_64bit(struct sk_buff *skb, int attrtype,
  1064. ++ u64 value, int padattr)
  1065. ++{
  1066. ++ return nla_put_64bit(skb, attrtype, sizeof(u64), &value, padattr);
  1067. ++}
  1068. ++
  1069. ++
  1070. ++#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) */
  1071. ++
  1072. + #endif /* __BACKPORT_NET_NETLINK_H */
  1073. diff --git a/package/kernel/mac80211/patches/006-compat-bump-rhashtable-backport-version-due-to-API-c.patch b/package/kernel/mac80211/patches/006-compat-bump-rhashtable-backport-version-due-to-API-c.patch
  1074. new file mode 100644
  1075. index 0000000..1fdad3c
  1076. --- /dev/null
  1077. +++ b/package/kernel/mac80211/patches/006-compat-bump-rhashtable-backport-version-due-to-API-c.patch
  1078. @@ -0,0 +1,18 @@
  1079. +From: Felix Fietkau <nbd@nbd.name>
  1080. +Date: Sat, 14 May 2016 16:44:57 +0200
  1081. +Subject: [PATCH] compat: bump rhashtable backport version due to API changes
  1082. +
  1083. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  1084. +---
  1085. +
  1086. +--- a/compat/Kconfig
  1087. ++++ b/compat/Kconfig
  1088. +@@ -139,7 +139,7 @@ config BPAUTO_BUILD_WANT_DEV_COREDUMP
  1089. + config BPAUTO_RHASHTABLE
  1090. + bool
  1091. + # current API of rhashtable was introduced in version 4.1
  1092. +- depends on KERNEL_4_1
  1093. ++ depends on KERNEL_4_7
  1094. + # not very nice - but better than always having it
  1095. + default y if MAC80211
  1096. + #h-file linux/rhashtable.h
  1097. diff --git a/package/kernel/mac80211/patches/007-fix_duplicate_skcipher_backport.patch b/package/kernel/mac80211/patches/007-fix_duplicate_skcipher_backport.patch
  1098. new file mode 100644
  1099. index 0000000..38b3179
  1100. --- /dev/null
  1101. +++ b/package/kernel/mac80211/patches/007-fix_duplicate_skcipher_backport.patch
  1102. @@ -0,0 +1,11 @@
  1103. +--- a/compat/Makefile
  1104. ++++ b/compat/Makefile
  1105. +@@ -35,8 +35,6 @@ compat-$(CPTCFG_KERNEL_4_6) += backport-
  1106. +
  1107. + compat-$(CPTCFG_BPAUTO_BUILD_CRYPTO_CCM) += crypto-ccm.o
  1108. + compat-$(CPTCFG_BPAUTO_CRYPTO_SKCIPHER) += crypto-skcipher.o
  1109. +-skcipher-objs += crypto-skcipher.o
  1110. +-obj-$(CPTCFG_BPAUTO_CRYPTO_SKCIPHER) += skcipher.o
  1111. + compat-$(CPTCFG_BPAUTO_BUILD_WANT_DEV_COREDUMP) += drivers-base-devcoredump.o
  1112. + compat-$(CPTCFG_BPAUTO_RHASHTABLE) += lib-rhashtable.o
  1113. + cordic-objs += lib-cordic.o
  1114. diff --git a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  1115. index fd1e1cf..e9a140c 100644
  1116. --- a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  1117. +++ b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  1118. @@ -1,6 +1,6 @@
  1119. --- a/.local-symbols
  1120. +++ b/.local-symbols
  1121. -@@ -476,44 +476,6 @@ USB_IPHETH=
  1122. +@@ -481,45 +481,6 @@ USB_IPHETH=
  1123. USB_SIERRA_NET=
  1124. USB_VL600=
  1125. USB_NET_CH9200=
  1126. @@ -37,6 +37,7 @@
  1127. -BCMA_DRIVER_PCI=
  1128. -BCMA_DRIVER_PCI_HOSTMODE=
  1129. -BCMA_DRIVER_MIPS=
  1130. +-BCMA_PFLASH=
  1131. -BCMA_SFLASH=
  1132. -BCMA_NFLASH=
  1133. -BCMA_DRIVER_GMAC_CMN=
  1134. @@ -56,7 +57,7 @@
  1135. return (bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev);
  1136. #else
  1137. return bus->chipco.dev;
  1138. -@@ -4903,7 +4903,7 @@ static int b43_wireless_core_init(struct
  1139. +@@ -4901,7 +4901,7 @@ static int b43_wireless_core_init(struct
  1140. }
  1141. if (sprom->boardflags_lo & B43_BFL_XTAL_NOSLOW)
  1142. hf |= B43_HF_DSCRQ; /* Disable slowclock requests from ucode. */
  1143. diff --git a/package/kernel/mac80211/patches/080-disable_clk_backport.patch b/package/kernel/mac80211/patches/080-disable_clk_backport.patch
  1144. deleted file mode 100644
  1145. index 3765591..0000000
  1146. --- a/package/kernel/mac80211/patches/080-disable_clk_backport.patch
  1147. +++ /dev/null
  1148. @@ -1,20 +0,0 @@
  1149. ---- a/compat/compat-3.6.c
  1150. -+++ b/compat/compat-3.6.c
  1151. -@@ -147,17 +147,3 @@ int sg_alloc_table_from_pages(struct sg_
  1152. - return 0;
  1153. - }
  1154. - EXPORT_SYMBOL_GPL(sg_alloc_table_from_pages);
  1155. --
  1156. --/* whoopsie ! */
  1157. --#ifndef CONFIG_COMMON_CLK
  1158. --int clk_enable(struct clk *clk)
  1159. --{
  1160. -- return 0;
  1161. --}
  1162. --EXPORT_SYMBOL_GPL(clk_enable);
  1163. --
  1164. --void clk_disable(struct clk *clk)
  1165. --{
  1166. --}
  1167. --EXPORT_SYMBOL_GPL(clk_disable);
  1168. --#endif
  1169. diff --git a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  1170. index 02f46c7..b65b0bd 100644
  1171. --- a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  1172. +++ b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  1173. @@ -34,12 +34,9 @@
  1174. #include "aes_ccm.h"
  1175. -void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
  1176. -- u8 *data, size_t data_len, u8 *mic,
  1177. -- size_t mic_len)
  1178. +static void aes_ccm_prepare(struct crypto_cipher *tfm, u8 *b_0, u8 *aad, u8 *s_0,
  1179. + u8 *a, u8 *b)
  1180. - {
  1181. -- struct scatterlist sg[3];
  1182. ++{
  1183. + int i;
  1184. +
  1185. + crypto_cipher_encrypt_one(tfm, b, b_0);
  1186. @@ -54,55 +51,56 @@
  1187. + for (i = 0; i < AES_BLOCK_SIZE; i++)
  1188. + aad[i] ^= b[i];
  1189. + crypto_cipher_encrypt_one(tfm, a, aad);
  1190. -
  1191. -- char aead_req_data[sizeof(struct aead_request) +
  1192. -- crypto_aead_reqsize(tfm)]
  1193. -- __aligned(__alignof__(struct aead_request));
  1194. -- struct aead_request *aead_req = (void *) aead_req_data;
  1195. ++
  1196. + /* Mask out bits from auth-only-b_0 */
  1197. + b_0[0] &= 0x07;
  1198. -
  1199. -- memset(aead_req, 0, sizeof(aead_req_data));
  1200. ++
  1201. + /* S_0 is used to encrypt T (= MIC) */
  1202. + b_0[14] = 0;
  1203. + b_0[15] = 0;
  1204. + crypto_cipher_encrypt_one(tfm, s_0, b_0);
  1205. +}
  1206. -
  1207. -- sg_init_table(sg, 3);
  1208. -- sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad));
  1209. -- sg_set_buf(&sg[1], data, data_len);
  1210. -- sg_set_buf(&sg[2], mic, mic_len);
  1211. -
  1212. -- aead_request_set_tfm(aead_req, tfm);
  1213. -- aead_request_set_crypt(aead_req, sg, sg, data_len, b_0);
  1214. -- aead_request_set_ad(aead_req, sg[0].length);
  1215. ++
  1216. ++
  1217. +void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *b_0, u8 *aad,
  1218. -+ u8 *data, size_t data_len, u8 *mic,
  1219. -+ size_t mic_len)
  1220. -+{
  1221. + u8 *data, size_t data_len, u8 *mic,
  1222. + size_t mic_len)
  1223. + {
  1224. +- struct scatterlist sg[3];
  1225. + int i, j, last_len, num_blocks;
  1226. + u8 b[AES_BLOCK_SIZE];
  1227. + u8 s_0[AES_BLOCK_SIZE];
  1228. + u8 e[AES_BLOCK_SIZE];
  1229. + u8 *pos, *cpos;
  1230. -+
  1231. +
  1232. +- char aead_req_data[sizeof(struct aead_request) +
  1233. +- crypto_aead_reqsize(tfm)]
  1234. +- __aligned(__alignof__(struct aead_request));
  1235. +- struct aead_request *aead_req = (void *) aead_req_data;
  1236. + num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
  1237. + last_len = data_len % AES_BLOCK_SIZE;
  1238. + aes_ccm_prepare(tfm, b_0, aad, s_0, b, b);
  1239. -+
  1240. +
  1241. +- memset(aead_req, 0, sizeof(aead_req_data));
  1242. + /* Process payload blocks */
  1243. + pos = data;
  1244. + cpos = data;
  1245. + for (j = 1; j <= num_blocks; j++) {
  1246. + int blen = (j == num_blocks && last_len) ?
  1247. + last_len : AES_BLOCK_SIZE;
  1248. -+
  1249. +
  1250. +- sg_init_table(sg, 3);
  1251. +- sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad));
  1252. +- sg_set_buf(&sg[1], data, data_len);
  1253. +- sg_set_buf(&sg[2], mic, mic_len);
  1254. + /* Authentication followed by encryption */
  1255. + for (i = 0; i < blen; i++)
  1256. + b[i] ^= pos[i];
  1257. + crypto_cipher_encrypt_one(tfm, b, b);
  1258. -+
  1259. +
  1260. +- aead_request_set_tfm(aead_req, tfm);
  1261. +- aead_request_set_crypt(aead_req, sg, sg, data_len, b_0);
  1262. +- aead_request_set_ad(aead_req, sg[0].length);
  1263. + b_0[14] = (j >> 8) & 0xff;
  1264. + b_0[15] = j & 0xff;
  1265. + crypto_cipher_encrypt_one(tfm, e, b_0);
  1266. @@ -125,37 +123,30 @@
  1267. - crypto_aead_reqsize(tfm)]
  1268. - __aligned(__alignof__(struct aead_request));
  1269. - struct aead_request *aead_req = (void *) aead_req_data;
  1270. --
  1271. -- if (data_len == 0)
  1272. -- return -EINVAL;
  1273. --
  1274. -- memset(aead_req, 0, sizeof(aead_req_data));
  1275. --
  1276. -- sg_init_table(sg, 3);
  1277. -- sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad));
  1278. -- sg_set_buf(&sg[1], data, data_len);
  1279. -- sg_set_buf(&sg[2], mic, mic_len);
  1280. --
  1281. -- aead_request_set_tfm(aead_req, tfm);
  1282. -- aead_request_set_crypt(aead_req, sg, sg, data_len + mic_len, b_0);
  1283. -- aead_request_set_ad(aead_req, sg[0].length);
  1284. + int i, j, last_len, num_blocks;
  1285. + u8 *pos, *cpos;
  1286. + u8 a[AES_BLOCK_SIZE];
  1287. + u8 b[AES_BLOCK_SIZE];
  1288. + u8 s_0[AES_BLOCK_SIZE];
  1289. -+
  1290. +
  1291. +- if (data_len == 0)
  1292. +- return -EINVAL;
  1293. + num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
  1294. + last_len = data_len % AES_BLOCK_SIZE;
  1295. + aes_ccm_prepare(tfm, b_0, aad, s_0, a, b);
  1296. -+
  1297. +
  1298. +- memset(aead_req, 0, sizeof(aead_req_data));
  1299. + /* Process payload blocks */
  1300. + cpos = data;
  1301. + pos = data;
  1302. + for (j = 1; j <= num_blocks; j++) {
  1303. + int blen = (j == num_blocks && last_len) ?
  1304. + last_len : AES_BLOCK_SIZE;
  1305. -+
  1306. +
  1307. +- sg_init_table(sg, 3);
  1308. +- sg_set_buf(&sg[0], &aad[2], be16_to_cpup((__be16 *)aad));
  1309. +- sg_set_buf(&sg[1], data, data_len);
  1310. +- sg_set_buf(&sg[2], mic, mic_len);
  1311. + /* Decryption followed by authentication */
  1312. + b_0[14] = (j >> 8) & 0xff;
  1313. + b_0[15] = j & 0xff;
  1314. @@ -166,7 +157,10 @@
  1315. + }
  1316. + crypto_cipher_encrypt_one(tfm, a, a);
  1317. + }
  1318. -+
  1319. +
  1320. +- aead_request_set_tfm(aead_req, tfm);
  1321. +- aead_request_set_crypt(aead_req, sg, sg, data_len + mic_len, b_0);
  1322. +- aead_request_set_ad(aead_req, sg[0].length);
  1323. + for (i = 0; i < mic_len; i++) {
  1324. + if ((mic[i] ^ s_0[i]) != a[i])
  1325. + return -1;
  1326. @@ -185,12 +179,12 @@
  1327. {
  1328. - struct crypto_aead *tfm;
  1329. - int err;
  1330. -+ struct crypto_cipher *tfm;
  1331. -
  1332. +-
  1333. - tfm = crypto_alloc_aead("ccm(aes)", 0, CRYPTO_ALG_ASYNC);
  1334. - if (IS_ERR(tfm))
  1335. - return tfm;
  1336. --
  1337. ++ struct crypto_cipher *tfm;
  1338. +
  1339. - err = crypto_aead_setkey(tfm, key, key_len);
  1340. - if (err)
  1341. - goto free_aead;
  1342. @@ -309,7 +303,7 @@
  1343. #endif /* AES_GMAC_H */
  1344. --- a/net/mac80211/key.h
  1345. +++ b/net/mac80211/key.h
  1346. -@@ -84,7 +84,7 @@ struct ieee80211_key {
  1347. +@@ -88,7 +88,7 @@ struct ieee80211_key {
  1348. * Management frames.
  1349. */
  1350. u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_CCMP_PN_LEN];
  1351. @@ -320,7 +314,7 @@
  1352. struct {
  1353. --- a/net/mac80211/wpa.c
  1354. +++ b/net/mac80211/wpa.c
  1355. -@@ -307,7 +307,8 @@ ieee80211_crypto_tkip_decrypt(struct iee
  1356. +@@ -304,7 +304,8 @@ ieee80211_crypto_tkip_decrypt(struct iee
  1357. }
  1358. @@ -330,7 +324,7 @@
  1359. {
  1360. __le16 mask_fc;
  1361. int a4_included, mgmt;
  1362. -@@ -337,14 +338,8 @@ static void ccmp_special_blocks(struct s
  1363. +@@ -334,14 +335,8 @@ static void ccmp_special_blocks(struct s
  1364. else
  1365. qos_tid = 0;
  1366. @@ -347,7 +341,7 @@
  1367. /* Nonce: Nonce Flags | A2 | PN
  1368. * Nonce Flags: Priority (b0..b3) | Management (b4) | Reserved (b5..b7)
  1369. -@@ -352,6 +347,8 @@ static void ccmp_special_blocks(struct s
  1370. +@@ -349,6 +344,8 @@ static void ccmp_special_blocks(struct s
  1371. b_0[1] = qos_tid | (mgmt << 4);
  1372. memcpy(&b_0[2], hdr->addr2, ETH_ALEN);
  1373. memcpy(&b_0[8], pn, IEEE80211_CCMP_PN_LEN);
  1374. @@ -356,7 +350,7 @@
  1375. /* AAD (extra authenticate-only data) / masked 802.11 header
  1376. * FC | A1 | A2 | A3 | SC | [A4] | [QC] */
  1377. -@@ -463,7 +460,7 @@ static int ccmp_encrypt_skb(struct ieee8
  1378. +@@ -460,7 +457,7 @@ static int ccmp_encrypt_skb(struct ieee8
  1379. return 0;
  1380. pos += IEEE80211_CCMP_HDR_LEN;
  1381. @@ -365,7 +359,7 @@
  1382. ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, b_0, aad, pos, len,
  1383. skb_put(skb, mic_len), mic_len);
  1384. -@@ -534,7 +531,7 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  1385. +@@ -537,7 +534,7 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  1386. u8 aad[2 * AES_BLOCK_SIZE];
  1387. u8 b_0[AES_BLOCK_SIZE];
  1388. /* hardware didn't decrypt/verify MIC */
  1389. 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
  1390. index d1d9fbd..3ca166f 100644
  1391. --- a/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
  1392. +++ b/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
  1393. @@ -2,7 +2,7 @@ Used for AP+STA support in OpenWrt - preserve AP mode keys across STA reconnects
  1394. --- a/net/mac80211/cfg.c
  1395. +++ b/net/mac80211/cfg.c
  1396. -@@ -846,7 +846,6 @@ static int ieee80211_stop_ap(struct wiph
  1397. +@@ -850,7 +850,6 @@ static int ieee80211_stop_ap(struct wiph
  1398. sdata->u.ap.driver_smps_mode = IEEE80211_SMPS_OFF;
  1399. __sta_info_flush(sdata, true);
  1400. diff --git a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  1401. index 2855a88..3029598 100644
  1402. --- a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  1403. +++ b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  1404. @@ -18,7 +18,7 @@
  1405. static int ieee80211_ifa6_changed(struct notifier_block *nb,
  1406. unsigned long data, void *arg)
  1407. {
  1408. -@@ -1087,14 +1087,14 @@ int ieee80211_register_hw(struct ieee802
  1409. +@@ -1089,14 +1089,14 @@ int ieee80211_register_hw(struct ieee802
  1410. rtnl_unlock();
  1411. @@ -35,7 +35,7 @@
  1412. local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed;
  1413. result = register_inet6addr_notifier(&local->ifa6_notifier);
  1414. if (result)
  1415. -@@ -1103,13 +1103,13 @@ int ieee80211_register_hw(struct ieee802
  1416. +@@ -1105,13 +1105,13 @@ int ieee80211_register_hw(struct ieee802
  1417. return 0;
  1418. @@ -52,7 +52,7 @@
  1419. fail_ifa:
  1420. #endif
  1421. rtnl_lock();
  1422. -@@ -1137,10 +1137,10 @@ void ieee80211_unregister_hw(struct ieee
  1423. +@@ -1139,10 +1139,10 @@ void ieee80211_unregister_hw(struct ieee
  1424. tasklet_kill(&local->tx_pending_tasklet);
  1425. tasklet_kill(&local->tasklet);
  1426. diff --git a/package/kernel/mac80211/patches/210-ap_scan.patch b/package/kernel/mac80211/patches/210-ap_scan.patch
  1427. index a99cbd2..29f05c4 100644
  1428. --- a/package/kernel/mac80211/patches/210-ap_scan.patch
  1429. +++ b/package/kernel/mac80211/patches/210-ap_scan.patch
  1430. @@ -1,6 +1,6 @@
  1431. --- a/net/mac80211/cfg.c
  1432. +++ b/net/mac80211/cfg.c
  1433. -@@ -1999,7 +1999,7 @@ static int ieee80211_scan(struct wiphy *
  1434. +@@ -2008,7 +2008,7 @@ static int ieee80211_scan(struct wiphy *
  1435. * the frames sent while scanning on other channel will be
  1436. * lost)
  1437. */
  1438. 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
  1439. index bddb15a..8f7e893 100644
  1440. --- a/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch
  1441. +++ b/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch
  1442. @@ -1,17 +1,18 @@
  1443. -From: Felix Fietkau <nbd@openwrt.org>
  1444. +From: Felix Fietkau <nbd@nbd.name>
  1445. Date: Sun, 7 Jun 2015 13:53:35 +0200
  1446. Subject: [PATCH] ath9k: force rx_clear when disabling rx
  1447. This makes stopping Rx more reliable and should reduce the frequency of
  1448. -Rx related DMA stop warnings
  1449. +Rx related DMA stop warnings. Don't use rx_clear in TX99 mode.
  1450. Cc: stable@vger.kernel.org
  1451. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1452. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  1453. +Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
  1454. ---
  1455. --- a/drivers/net/wireless/ath/ath9k/mac.c
  1456. +++ b/drivers/net/wireless/ath/ath9k/mac.c
  1457. -@@ -677,13 +677,15 @@ void ath9k_hw_startpcureceive(struct ath
  1458. +@@ -677,13 +677,18 @@ void ath9k_hw_startpcureceive(struct ath
  1459. ath9k_ani_reset(ah, is_scanning);
  1460. @@ -24,8 +25,11 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1461. void ath9k_hw_abortpcurecv(struct ath_hw *ah)
  1462. {
  1463. - REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_ABORT | AR_DIAG_RX_DIS);
  1464. -+ REG_SET_BIT(ah, AR_DIAG_SW,
  1465. -+ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  1466. ++ u32 reg = AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT;
  1467. ++
  1468. ++ if (!config_enabled(CPTCFG_ATH9K_TX99))
  1469. ++ reg |= AR_DIAG_FORCE_RX_CLEAR;
  1470. ++ REG_SET_BIT(ah, AR_DIAG_SW, reg);
  1471. ath9k_hw_disable_mib_counters(ah);
  1472. }
  1473. 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
  1474. index a160dc4..358d028 100644
  1475. --- a/package/kernel/mac80211/patches/301-ath9k-limit-retries-for-powersave-response-frames.patch
  1476. +++ b/package/kernel/mac80211/patches/301-ath9k-limit-retries-for-powersave-response-frames.patch
  1477. @@ -1,4 +1,4 @@
  1478. -From: Felix Fietkau <nbd@openwrt.org>
  1479. +From: Felix Fietkau <nbd@nbd.name>
  1480. Date: Thu, 2 Jul 2015 15:20:56 +0200
  1481. Subject: [PATCH] ath9k: limit retries for powersave response frames
  1482. @@ -8,7 +8,7 @@ gone to sleep. To avoid wasting too much airtime on this, limit the
  1483. number of retries on such frames and ensure that no sample rate gets
  1484. used.
  1485. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1486. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  1487. ---
  1488. --- a/drivers/net/wireless/ath/ath9k/xmit.c
  1489. diff --git a/package/kernel/mac80211/patches/302-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch b/package/kernel/mac80211/patches/302-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch
  1490. new file mode 100644
  1491. index 0000000..7caa9be
  1492. --- /dev/null
  1493. +++ b/package/kernel/mac80211/patches/302-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch
  1494. @@ -0,0 +1,37 @@
  1495. +From: Felix Fietkau <nbd@nbd.name>
  1496. +Date: Sat, 14 May 2016 14:51:02 +0200
  1497. +Subject: [PATCH] Revert "ath9k: interpret requested txpower in EIRP
  1498. + domain"
  1499. +
  1500. +This reverts commit 71f5137bf010c6faffab50c0ec15374c59c4a411.
  1501. +---
  1502. +
  1503. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  1504. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  1505. +@@ -2914,7 +2914,8 @@ void ath9k_hw_apply_txpower(struct ath_h
  1506. + {
  1507. + struct ath_regulatory *reg = ath9k_hw_regulatory(ah);
  1508. + struct ieee80211_channel *channel;
  1509. +- int chan_pwr, new_pwr;
  1510. ++ int chan_pwr, new_pwr, max_gain;
  1511. ++ int ant_gain, ant_reduction = 0;
  1512. +
  1513. + if (!chan)
  1514. + return;
  1515. +@@ -2922,10 +2923,15 @@ void ath9k_hw_apply_txpower(struct ath_h
  1516. + channel = chan->chan;
  1517. + chan_pwr = min_t(int, channel->max_power * 2, MAX_RATE_POWER);
  1518. + new_pwr = min_t(int, chan_pwr, reg->power_limit);
  1519. ++ max_gain = chan_pwr - new_pwr + channel->max_antenna_gain * 2;
  1520. ++
  1521. ++ ant_gain = get_antenna_gain(ah, chan);
  1522. ++ if (ant_gain > max_gain)
  1523. ++ ant_reduction = ant_gain - max_gain;
  1524. +
  1525. + ah->eep_ops->set_txpower(ah, chan,
  1526. + ath9k_regd_get_ctl(reg, chan),
  1527. +- get_antenna_gain(ah, chan), new_pwr, test);
  1528. ++ ant_reduction, new_pwr, test);
  1529. + }
  1530. +
  1531. + void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test)
  1532. diff --git a/package/kernel/mac80211/patches/302-ath9k_hw-add-low-power-tx-gain-table-for-AR953x.patch b/package/kernel/mac80211/patches/302-ath9k_hw-add-low-power-tx-gain-table-for-AR953x.patch
  1533. deleted file mode 100644
  1534. index 22b987a..0000000
  1535. --- a/package/kernel/mac80211/patches/302-ath9k_hw-add-low-power-tx-gain-table-for-AR953x.patch
  1536. +++ /dev/null
  1537. @@ -1,95 +0,0 @@
  1538. -From: Felix Fietkau <nbd@openwrt.org>
  1539. -Date: Thu, 14 Jan 2016 03:14:03 +0100
  1540. -Subject: [PATCH] ath9k_hw: add low power tx gain table for AR953x
  1541. -
  1542. -Used in some newer TP-Link AR9533 devices.
  1543. -
  1544. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1545. ----
  1546. -
  1547. ---- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c
  1548. -+++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
  1549. -@@ -698,6 +698,9 @@ static void ar9003_tx_gain_table_mode2(s
  1550. - else if (AR_SREV_9340(ah))
  1551. - INIT_INI_ARRAY(&ah->iniModesTxGain,
  1552. - ar9340Modes_low_ob_db_tx_gain_table_1p0);
  1553. -+ else if (AR_SREV_9531_11(ah))
  1554. -+ INIT_INI_ARRAY(&ah->iniModesTxGain,
  1555. -+ qca953x_1p1_modes_no_xpa_low_power_tx_gain_table);
  1556. - else if (AR_SREV_9485_11_OR_LATER(ah))
  1557. - INIT_INI_ARRAY(&ah->iniModesTxGain,
  1558. - ar9485Modes_low_ob_db_tx_gain_1_1);
  1559. ---- a/drivers/net/wireless/ath/ath9k/ar953x_initvals.h
  1560. -+++ b/drivers/net/wireless/ath/ath9k/ar953x_initvals.h
  1561. -@@ -757,6 +757,71 @@ static const u32 qca953x_1p1_modes_xpa_t
  1562. - {0x00016448, 0x6c927a70},
  1563. - };
  1564. -
  1565. -+static const u32 qca953x_1p1_modes_no_xpa_low_power_tx_gain_table[][2] = {
  1566. -+ /* Addr allmodes */
  1567. -+ {0x0000a2dc, 0xfff55592},
  1568. -+ {0x0000a2e0, 0xfff99924},
  1569. -+ {0x0000a2e4, 0xfffe1e00},
  1570. -+ {0x0000a2e8, 0xffffe000},
  1571. -+ {0x0000a410, 0x000050d6},
  1572. -+ {0x0000a500, 0x00000069},
  1573. -+ {0x0000a504, 0x0400006b},
  1574. -+ {0x0000a508, 0x0800006d},
  1575. -+ {0x0000a50c, 0x0c000269},
  1576. -+ {0x0000a510, 0x1000026b},
  1577. -+ {0x0000a514, 0x1400026d},
  1578. -+ {0x0000a518, 0x18000669},
  1579. -+ {0x0000a51c, 0x1c00066b},
  1580. -+ {0x0000a520, 0x1d000a68},
  1581. -+ {0x0000a524, 0x21000a6a},
  1582. -+ {0x0000a528, 0x25000a6c},
  1583. -+ {0x0000a52c, 0x29000a6e},
  1584. -+ {0x0000a530, 0x2d0012a9},
  1585. -+ {0x0000a534, 0x310012ab},
  1586. -+ {0x0000a538, 0x350012ad},
  1587. -+ {0x0000a53c, 0x39001b0a},
  1588. -+ {0x0000a540, 0x3d001b0c},
  1589. -+ {0x0000a544, 0x41001b0e},
  1590. -+ {0x0000a548, 0x43001bae},
  1591. -+ {0x0000a54c, 0x45001914},
  1592. -+ {0x0000a550, 0x47001916},
  1593. -+ {0x0000a554, 0x49001b96},
  1594. -+ {0x0000a558, 0x49001b96},
  1595. -+ {0x0000a55c, 0x49001b96},
  1596. -+ {0x0000a560, 0x49001b96},
  1597. -+ {0x0000a564, 0x49001b96},
  1598. -+ {0x0000a568, 0x49001b96},
  1599. -+ {0x0000a56c, 0x49001b96},
  1600. -+ {0x0000a570, 0x49001b96},
  1601. -+ {0x0000a574, 0x49001b96},
  1602. -+ {0x0000a578, 0x49001b96},
  1603. -+ {0x0000a57c, 0x49001b96},
  1604. -+ {0x0000a600, 0x00000000},
  1605. -+ {0x0000a604, 0x00000000},
  1606. -+ {0x0000a608, 0x00000000},
  1607. -+ {0x0000a60c, 0x00000000},
  1608. -+ {0x0000a610, 0x00000000},
  1609. -+ {0x0000a614, 0x00000000},
  1610. -+ {0x0000a618, 0x00804201},
  1611. -+ {0x0000a61c, 0x01408201},
  1612. -+ {0x0000a620, 0x01408502},
  1613. -+ {0x0000a624, 0x01408502},
  1614. -+ {0x0000a628, 0x01408502},
  1615. -+ {0x0000a62c, 0x01408502},
  1616. -+ {0x0000a630, 0x01408502},
  1617. -+ {0x0000a634, 0x01408502},
  1618. -+ {0x0000a638, 0x01408502},
  1619. -+ {0x0000a63c, 0x01408502},
  1620. -+ {0x0000b2dc, 0xfff55592},
  1621. -+ {0x0000b2e0, 0xfff99924},
  1622. -+ {0x0000b2e4, 0xfffe1e00},
  1623. -+ {0x0000b2e8, 0xffffe000},
  1624. -+ {0x00016044, 0x044922db},
  1625. -+ {0x00016048, 0x6c927a70},
  1626. -+ {0x00016444, 0x044922db},
  1627. -+ {0x00016448, 0x6c927a70},
  1628. -+};
  1629. -+
  1630. - static const u32 qca953x_2p0_baseband_core[][2] = {
  1631. - /* Addr allmodes */
  1632. - {0x00009800, 0xafe68e30},
  1633. diff --git a/package/kernel/mac80211/patches/303-mac80211-mesh-flush-mesh-paths-unconditionally.patch b/package/kernel/mac80211/patches/303-mac80211-mesh-flush-mesh-paths-unconditionally.patch
  1634. new file mode 100644
  1635. index 0000000..518d0a3
  1636. --- /dev/null
  1637. +++ b/package/kernel/mac80211/patches/303-mac80211-mesh-flush-mesh-paths-unconditionally.patch
  1638. @@ -0,0 +1,146 @@
  1639. +From: Bob Copeland <me@bobcopeland.com>
  1640. +Date: Sun, 15 May 2016 13:19:16 -0400
  1641. +Subject: [PATCH] mac80211: mesh: flush mesh paths unconditionally
  1642. +
  1643. +Currently, the mesh paths associated with a nexthop station are cleaned
  1644. +up in the following code path:
  1645. +
  1646. + __sta_info_destroy_part1
  1647. + synchronize_net()
  1648. + __sta_info_destroy_part2
  1649. + -> cleanup_single_sta
  1650. + -> mesh_sta_cleanup
  1651. + -> mesh_plink_deactivate
  1652. + -> mesh_path_flush_by_nexthop
  1653. +
  1654. +However, there are a couple of problems here:
  1655. +
  1656. +1) the paths aren't flushed at all if the MPM is running in userspace
  1657. + (e.g. when using wpa_supplicant or authsae)
  1658. +
  1659. +2) there is no synchronize_rcu between removing the path and readers
  1660. + accessing the nexthop, which means the following race is possible:
  1661. +
  1662. +CPU0 CPU1
  1663. +~~~~ ~~~~
  1664. + sta_info_destroy_part1()
  1665. + synchronize_net()
  1666. +rcu_read_lock()
  1667. +mesh_nexthop_resolve()
  1668. + mpath = mesh_path_lookup()
  1669. + [...] -> mesh_path_flush_by_nexthop()
  1670. + sta = rcu_dereference(
  1671. + mpath->next_hop)
  1672. + kfree(sta)
  1673. + access sta <-- CRASH
  1674. +
  1675. +Fix both of these by unconditionally flushing paths before destroying
  1676. +the sta, and by adding a synchronize_net() after path flush to ensure
  1677. +no active readers can still dereference the sta.
  1678. +
  1679. +Fixes this crash:
  1680. +
  1681. +[ 348.529295] BUG: unable to handle kernel paging request at 00020040
  1682. +[ 348.530014] IP: [<f929245d>] ieee80211_mps_set_frame_flags+0x40/0xaa [mac80211]
  1683. +[ 348.530014] *pde = 00000000
  1684. +[ 348.530014] Oops: 0000 [#1] PREEMPT
  1685. +[ 348.530014] Modules linked in: drbg ansi_cprng ctr ccm ppp_generic slhc ipt_MASQUERADE nf_nat_masquerade_ipv4 8021q ]
  1686. +[ 348.530014] CPU: 0 PID: 20597 Comm: wget Tainted: G O 4.6.0-rc5-wt=V1 #1
  1687. +[ 348.530014] Hardware name: To Be Filled By O.E.M./To be filled by O.E.M., BIOS 080016 11/07/2014
  1688. +[ 348.530014] task: f64fa280 ti: f4f9c000 task.ti: f4f9c000
  1689. +[ 348.530014] EIP: 0060:[<f929245d>] EFLAGS: 00010246 CPU: 0
  1690. +[ 348.530014] EIP is at ieee80211_mps_set_frame_flags+0x40/0xaa [mac80211]
  1691. +[ 348.530014] EAX: f4ce63e0 EBX: 00000088 ECX: f3788416 EDX: 00020008
  1692. +[ 348.530014] ESI: 00000000 EDI: 00000088 EBP: f6409a4c ESP: f6409a40
  1693. +[ 348.530014] DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 0068
  1694. +[ 348.530014] CR0: 80050033 CR2: 00020040 CR3: 33190000 CR4: 00000690
  1695. +[ 348.530014] Stack:
  1696. +[ 348.530014] 00000000 f4ce63e0 f5f9bd80 f6409a64 f9291d80 0000ce67 f5d51e00 f4ce63e0
  1697. +[ 348.530014] f3788416 f6409a80 f9291dc1 f4ce8320 f4ce63e0 f5d51e00 f4ce63e0 f4ce8320
  1698. +[ 348.530014] f6409a98 f9277f6f 00000000 00000000 0000007c 00000000 f6409b2c f9278dd1
  1699. +[ 348.530014] Call Trace:
  1700. +[ 348.530014] [<f9291d80>] mesh_nexthop_lookup+0xbb/0xc8 [mac80211]
  1701. +[ 348.530014] [<f9291dc1>] mesh_nexthop_resolve+0x34/0xd8 [mac80211]
  1702. +[ 348.530014] [<f9277f6f>] ieee80211_xmit+0x92/0xc1 [mac80211]
  1703. +[ 348.530014] [<f9278dd1>] __ieee80211_subif_start_xmit+0x807/0x83c [mac80211]
  1704. +[ 348.530014] [<c04df012>] ? sch_direct_xmit+0xd7/0x1b3
  1705. +[ 348.530014] [<c022a8c6>] ? __local_bh_enable_ip+0x5d/0x7b
  1706. +[ 348.530014] [<f956870c>] ? nf_nat_ipv4_out+0x4c/0xd0 [nf_nat_ipv4]
  1707. +[ 348.530014] [<f957e036>] ? iptable_nat_ipv4_fn+0xf/0xf [iptable_nat]
  1708. +[ 348.530014] [<c04c6f45>] ? netif_skb_features+0x14d/0x30a
  1709. +[ 348.530014] [<f9278e10>] ieee80211_subif_start_xmit+0xa/0xe [mac80211]
  1710. +[ 348.530014] [<c04c769c>] dev_hard_start_xmit+0x1f8/0x267
  1711. +[ 348.530014] [<c04c7261>] ? validate_xmit_skb.isra.120.part.121+0x10/0x253
  1712. +[ 348.530014] [<c04defc6>] sch_direct_xmit+0x8b/0x1b3
  1713. +[ 348.530014] [<c04c7a9c>] __dev_queue_xmit+0x2c8/0x513
  1714. +[ 348.530014] [<c04c7cfb>] dev_queue_xmit+0xa/0xc
  1715. +[ 348.530014] [<f91bfc7a>] batadv_send_skb_packet+0xd6/0xec [batman_adv]
  1716. +[ 348.530014] [<f91bfdc4>] batadv_send_unicast_skb+0x15/0x4a [batman_adv]
  1717. +[ 348.530014] [<f91b5938>] batadv_dat_send_data+0x27e/0x310 [batman_adv]
  1718. +[ 348.530014] [<f91c30b5>] ? batadv_tt_global_hash_find.isra.11+0x8/0xa [batman_adv]
  1719. +[ 348.530014] [<f91b63f3>] batadv_dat_snoop_outgoing_arp_request+0x208/0x23d [batman_adv]
  1720. +[ 348.530014] [<f91c0cd9>] batadv_interface_tx+0x206/0x385 [batman_adv]
  1721. +[ 348.530014] [<c04c769c>] dev_hard_start_xmit+0x1f8/0x267
  1722. +[ 348.530014] [<c04c7261>] ? validate_xmit_skb.isra.120.part.121+0x10/0x253
  1723. +[ 348.530014] [<c04defc6>] sch_direct_xmit+0x8b/0x1b3
  1724. +[ 348.530014] [<c04c7a9c>] __dev_queue_xmit+0x2c8/0x513
  1725. +[ 348.530014] [<f80cbd2a>] ? igb_xmit_frame+0x57/0x72 [igb]
  1726. +[ 348.530014] [<c04c7cfb>] dev_queue_xmit+0xa/0xc
  1727. +[ 348.530014] [<f843a326>] br_dev_queue_push_xmit+0xeb/0xfb [bridge]
  1728. +[ 348.530014] [<f843a35f>] br_forward_finish+0x29/0x74 [bridge]
  1729. +[ 348.530014] [<f843a23b>] ? deliver_clone+0x3b/0x3b [bridge]
  1730. +[ 348.530014] [<f843a714>] __br_forward+0x89/0xe7 [bridge]
  1731. +[ 348.530014] [<f843a336>] ? br_dev_queue_push_xmit+0xfb/0xfb [bridge]
  1732. +[ 348.530014] [<f843a234>] deliver_clone+0x34/0x3b [bridge]
  1733. +[ 348.530014] [<f843a68b>] ? br_flood+0x95/0x95 [bridge]
  1734. +[ 348.530014] [<f843a66d>] br_flood+0x77/0x95 [bridge]
  1735. +[ 348.530014] [<f843a809>] br_flood_forward+0x13/0x1a [bridge]
  1736. +[ 348.530014] [<f843a68b>] ? br_flood+0x95/0x95 [bridge]
  1737. +[ 348.530014] [<f843b877>] br_handle_frame_finish+0x392/0x3db [bridge]
  1738. +[ 348.530014] [<c04e9b2b>] ? nf_iterate+0x2b/0x6b
  1739. +[ 348.530014] [<f843baa6>] br_handle_frame+0x1e6/0x240 [bridge]
  1740. +[ 348.530014] [<f843b4e5>] ? br_handle_local_finish+0x6a/0x6a [bridge]
  1741. +[ 348.530014] [<c04c4ba0>] __netif_receive_skb_core+0x43a/0x66b
  1742. +[ 348.530014] [<f843b8c0>] ? br_handle_frame_finish+0x3db/0x3db [bridge]
  1743. +[ 348.530014] [<c023cea4>] ? resched_curr+0x19/0x37
  1744. +[ 348.530014] [<c0240707>] ? check_preempt_wakeup+0xbf/0xfe
  1745. +[ 348.530014] [<c0255dec>] ? ktime_get_with_offset+0x5c/0xfc
  1746. +[ 348.530014] [<c04c4fc1>] __netif_receive_skb+0x47/0x55
  1747. +[ 348.530014] [<c04c57ba>] netif_receive_skb_internal+0x40/0x5a
  1748. +[ 348.530014] [<c04c61ef>] napi_gro_receive+0x3a/0x94
  1749. +[ 348.530014] [<f80ce8d5>] igb_poll+0x6fd/0x9ad [igb]
  1750. +[ 348.530014] [<c0242bd8>] ? swake_up_locked+0x14/0x26
  1751. +[ 348.530014] [<c04c5d29>] net_rx_action+0xde/0x250
  1752. +[ 348.530014] [<c022a743>] __do_softirq+0x8a/0x163
  1753. +[ 348.530014] [<c022a6b9>] ? __hrtimer_tasklet_trampoline+0x19/0x19
  1754. +[ 348.530014] [<c021100f>] do_softirq_own_stack+0x26/0x2c
  1755. +[ 348.530014] <IRQ>
  1756. +[ 348.530014] [<c022a957>] irq_exit+0x31/0x6f
  1757. +[ 348.530014] [<c0210eb2>] do_IRQ+0x8d/0xa0
  1758. +[ 348.530014] [<c058152c>] common_interrupt+0x2c/0x40
  1759. +[ 348.530014] Code: e7 8c 00 66 81 ff 88 00 75 12 85 d2 75 0e b2 c3 b8 83 e9 29 f9 e8 a7 5f f9 c6 eb 74 66 81 e3 8c 005
  1760. +[ 348.530014] EIP: [<f929245d>] ieee80211_mps_set_frame_flags+0x40/0xaa [mac80211] SS:ESP 0068:f6409a40
  1761. +[ 348.530014] CR2: 0000000000020040
  1762. +[ 348.530014] ---[ end trace 48556ac26779732e ]---
  1763. +[ 348.530014] Kernel panic - not syncing: Fatal exception in interrupt
  1764. +[ 348.530014] Kernel Offset: disabled
  1765. +
  1766. +Cc: stable@vger.kernel.org
  1767. +Reported-by: Fred Veldini <fred.veldini@gmail.com>
  1768. +Tested-by: Fred Veldini <fred.veldini@gmail.com>
  1769. +Signed-off-by: Bob Copeland <me@bobcopeland.com>
  1770. +---
  1771. +
  1772. +--- a/net/mac80211/mesh.c
  1773. ++++ b/net/mac80211/mesh.c
  1774. +@@ -161,6 +161,10 @@ void mesh_sta_cleanup(struct sta_info *s
  1775. + del_timer_sync(&sta->mesh->plink_timer);
  1776. + }
  1777. +
  1778. ++ /* make sure no readers can access nexthop sta from here on */
  1779. ++ mesh_path_flush_by_nexthop(sta);
  1780. ++ synchronize_net();
  1781. ++
  1782. + if (changed)
  1783. + ieee80211_mbss_info_change_notify(sdata, changed);
  1784. + }
  1785. diff --git a/package/kernel/mac80211/patches/303-rt2x00-fix-monitor-mode-regression.patch b/package/kernel/mac80211/patches/303-rt2x00-fix-monitor-mode-regression.patch
  1786. deleted file mode 100644
  1787. index 7bb7435..0000000
  1788. --- a/package/kernel/mac80211/patches/303-rt2x00-fix-monitor-mode-regression.patch
  1789. +++ /dev/null
  1790. @@ -1,156 +0,0 @@
  1791. -From: Eli Cooper <elicooper@gmx.com>
  1792. -Date: Thu, 14 Jan 2016 00:07:12 +0800
  1793. -Subject: [PATCH] rt2x00: fix monitor mode regression
  1794. -
  1795. -Since commit df1404650ccbfeb76a84f301f22316be0d00a864 monitor mode for rt2x00
  1796. -has been made effectively useless because the hardware filter is configured to
  1797. -drop packets whose intended recipient is not the device, regardless of the
  1798. -presence of monitor mode interfaces.
  1799. -
  1800. -This patch fixes this regression by adding explicit monitor mode support, and
  1801. -configuring the hardware filter accordingly.
  1802. -
  1803. -Signed-off-by: Eli Cooper <elicooper@gmx.com>
  1804. ----
  1805. -
  1806. ---- a/drivers/net/wireless/ralink/rt2x00/rt2400pci.c
  1807. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2400pci.c
  1808. -@@ -273,8 +273,10 @@ static void rt2400pci_config_filter(stru
  1809. - !(filter_flags & FIF_PLCPFAIL));
  1810. - rt2x00_set_field32(&reg, RXCSR0_DROP_CONTROL,
  1811. - !(filter_flags & FIF_CONTROL));
  1812. -- rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME, 1);
  1813. -+ rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME,
  1814. -+ !rt2x00dev->is_monitoring);
  1815. - rt2x00_set_field32(&reg, RXCSR0_DROP_TODS,
  1816. -+ !rt2x00dev->is_monitoring &&
  1817. - !rt2x00dev->intf_ap_count);
  1818. - rt2x00_set_field32(&reg, RXCSR0_DROP_VERSION_ERROR, 1);
  1819. - rt2x00mmio_register_write(rt2x00dev, RXCSR0, reg);
  1820. ---- a/drivers/net/wireless/ralink/rt2x00/rt2500pci.c
  1821. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2500pci.c
  1822. -@@ -274,8 +274,10 @@ static void rt2500pci_config_filter(stru
  1823. - !(filter_flags & FIF_PLCPFAIL));
  1824. - rt2x00_set_field32(&reg, RXCSR0_DROP_CONTROL,
  1825. - !(filter_flags & FIF_CONTROL));
  1826. -- rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME, 1);
  1827. -+ rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME,
  1828. -+ !rt2x00dev->is_monitoring);
  1829. - rt2x00_set_field32(&reg, RXCSR0_DROP_TODS,
  1830. -+ !rt2x00dev->is_monitoring &&
  1831. - !rt2x00dev->intf_ap_count);
  1832. - rt2x00_set_field32(&reg, RXCSR0_DROP_VERSION_ERROR, 1);
  1833. - rt2x00_set_field32(&reg, RXCSR0_DROP_MCAST,
  1834. ---- a/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
  1835. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
  1836. -@@ -437,8 +437,10 @@ static void rt2500usb_config_filter(stru
  1837. - !(filter_flags & FIF_PLCPFAIL));
  1838. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_CONTROL,
  1839. - !(filter_flags & FIF_CONTROL));
  1840. -- rt2x00_set_field16(&reg, TXRX_CSR2_DROP_NOT_TO_ME, 1);
  1841. -+ rt2x00_set_field16(&reg, TXRX_CSR2_DROP_NOT_TO_ME,
  1842. -+ !rt2x00dev->is_monitoring);
  1843. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_TODS,
  1844. -+ !rt2x00dev->is_monitoring &&
  1845. - !rt2x00dev->intf_ap_count);
  1846. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_VERSION_ERROR, 1);
  1847. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_MULTICAST,
  1848. ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  1849. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  1850. -@@ -1490,7 +1490,8 @@ void rt2800_config_filter(struct rt2x00_
  1851. - !(filter_flags & FIF_FCSFAIL));
  1852. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_PHY_ERROR,
  1853. - !(filter_flags & FIF_PLCPFAIL));
  1854. -- rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_TO_ME, 1);
  1855. -+ rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_TO_ME,
  1856. -+ !rt2x00dev->is_monitoring);
  1857. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_MY_BSSD, 0);
  1858. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_VER_ERROR, 1);
  1859. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_MULTICAST,
  1860. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  1861. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  1862. -@@ -844,11 +844,13 @@ struct rt2x00_dev {
  1863. - * - Open sta interface count.
  1864. - * - Association count.
  1865. - * - Beaconing enabled count.
  1866. -+ * - Whether the device is monitoring.
  1867. - */
  1868. - unsigned int intf_ap_count;
  1869. - unsigned int intf_sta_count;
  1870. - unsigned int intf_associated;
  1871. - unsigned int intf_beaconing;
  1872. -+ bool is_monitoring;
  1873. -
  1874. - /*
  1875. - * Interface combinations
  1876. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00config.c
  1877. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00config.c
  1878. -@@ -244,6 +244,16 @@ void rt2x00lib_config(struct rt2x00_dev
  1879. - (ieee80211_flags & IEEE80211_CONF_CHANGE_PS))
  1880. - cancel_delayed_work_sync(&rt2x00dev->autowakeup_work);
  1881. -
  1882. -+ if (ieee80211_flags & IEEE80211_CONF_CHANGE_MONITOR) {
  1883. -+ if (conf->flags & IEEE80211_CONF_MONITOR) {
  1884. -+ rt2x00_dbg(rt2x00dev, "Monitor mode is enabled\n");
  1885. -+ rt2x00dev->is_monitoring = true;
  1886. -+ } else {
  1887. -+ rt2x00_dbg(rt2x00dev, "Monitor mode is disabled\n");
  1888. -+ rt2x00dev->is_monitoring = false;
  1889. -+ }
  1890. -+ }
  1891. -+
  1892. - /*
  1893. - * Start configuration.
  1894. - */
  1895. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  1896. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  1897. -@@ -1204,6 +1204,7 @@ int rt2x00lib_start(struct rt2x00_dev *r
  1898. - rt2x00dev->intf_ap_count = 0;
  1899. - rt2x00dev->intf_sta_count = 0;
  1900. - rt2x00dev->intf_associated = 0;
  1901. -+ rt2x00dev->is_monitoring = false;
  1902. -
  1903. - /* Enable the radio */
  1904. - retval = rt2x00lib_enable_radio(rt2x00dev);
  1905. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
  1906. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
  1907. -@@ -385,11 +385,6 @@ void rt2x00mac_configure_filter(struct i
  1908. - *total_flags |= FIF_PSPOLL;
  1909. - }
  1910. -
  1911. -- /*
  1912. -- * Check if there is any work left for us.
  1913. -- */
  1914. -- if (rt2x00dev->packet_filter == *total_flags)
  1915. -- return;
  1916. - rt2x00dev->packet_filter = *total_flags;
  1917. -
  1918. - rt2x00dev->ops->lib->config_filter(rt2x00dev, *total_flags);
  1919. ---- a/drivers/net/wireless/ralink/rt2x00/rt61pci.c
  1920. -+++ b/drivers/net/wireless/ralink/rt2x00/rt61pci.c
  1921. -@@ -530,8 +530,10 @@ static void rt61pci_config_filter(struct
  1922. - !(filter_flags & FIF_PLCPFAIL));
  1923. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_CONTROL,
  1924. - !(filter_flags & (FIF_CONTROL | FIF_PSPOLL)));
  1925. -- rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME, 1);
  1926. -+ rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME,
  1927. -+ !rt2x00dev->is_monitoring);
  1928. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_TO_DS,
  1929. -+ !rt2x00dev->is_monitoring &&
  1930. - !rt2x00dev->intf_ap_count);
  1931. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_VERSION_ERROR, 1);
  1932. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_MULTICAST,
  1933. ---- a/drivers/net/wireless/ralink/rt2x00/rt73usb.c
  1934. -+++ b/drivers/net/wireless/ralink/rt2x00/rt73usb.c
  1935. -@@ -480,8 +480,10 @@ static void rt73usb_config_filter(struct
  1936. - !(filter_flags & FIF_PLCPFAIL));
  1937. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_CONTROL,
  1938. - !(filter_flags & (FIF_CONTROL | FIF_PSPOLL)));
  1939. -- rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME, 1);
  1940. -+ rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME,
  1941. -+ !rt2x00dev->is_monitoring);
  1942. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_TO_DS,
  1943. -+ !rt2x00dev->is_monitoring &&
  1944. - !rt2x00dev->intf_ap_count);
  1945. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_VERSION_ERROR, 1);
  1946. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_MULTICAST,
  1947. diff --git a/package/kernel/mac80211/patches/304-ath9k-avoid-ANI-restart-if-no-trigger.patch b/package/kernel/mac80211/patches/304-ath9k-avoid-ANI-restart-if-no-trigger.patch
  1948. deleted file mode 100644
  1949. index 049059a..0000000
  1950. --- a/package/kernel/mac80211/patches/304-ath9k-avoid-ANI-restart-if-no-trigger.patch
  1951. +++ /dev/null
  1952. @@ -1,32 +0,0 @@
  1953. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  1954. -Date: Fri, 15 Jan 2016 18:17:17 +0800
  1955. -Subject: [PATCH] ath9k: avoid ANI restart if no trigger
  1956. -
  1957. -Fixes commit 54da20d83f0e ("ath9k_hw: improve ANI processing and rx desensitizing parameters")
  1958. -
  1959. -Call ath9k_ani_restart() only when the phy error rate reach the
  1960. -ANI immunity threshold. Sync the logic with internal code base.
  1961. -
  1962. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  1963. ----
  1964. -
  1965. ---- a/drivers/net/wireless/ath/ath9k/ani.c
  1966. -+++ b/drivers/net/wireless/ath/ath9k/ani.c
  1967. -@@ -444,14 +444,16 @@ void ath9k_hw_ani_monitor(struct ath_hw
  1968. - ofdmPhyErrRate < ah->config.ofdm_trig_low) {
  1969. - ath9k_hw_ani_lower_immunity(ah);
  1970. - aniState->ofdmsTurn = !aniState->ofdmsTurn;
  1971. -+ ath9k_ani_restart(ah);
  1972. - } else if (ofdmPhyErrRate > ah->config.ofdm_trig_high) {
  1973. - ath9k_hw_ani_ofdm_err_trigger(ah);
  1974. - aniState->ofdmsTurn = false;
  1975. -+ ath9k_ani_restart(ah);
  1976. - } else if (cckPhyErrRate > ah->config.cck_trig_high) {
  1977. - ath9k_hw_ani_cck_err_trigger(ah);
  1978. - aniState->ofdmsTurn = true;
  1979. -+ ath9k_ani_restart(ah);
  1980. - }
  1981. -- ath9k_ani_restart(ah);
  1982. - }
  1983. - }
  1984. - EXPORT_SYMBOL(ath9k_hw_ani_monitor);
  1985. diff --git a/package/kernel/mac80211/patches/304-mac80211-fix-fast_tx-header-alignment.patch b/package/kernel/mac80211/patches/304-mac80211-fix-fast_tx-header-alignment.patch
  1986. new file mode 100644
  1987. index 0000000..6316d81
  1988. --- /dev/null
  1989. +++ b/package/kernel/mac80211/patches/304-mac80211-fix-fast_tx-header-alignment.patch
  1990. @@ -0,0 +1,25 @@
  1991. +From: Felix Fietkau <nbd@nbd.name>
  1992. +Date: Thu, 19 May 2016 17:32:13 +0200
  1993. +Subject: [PATCH] mac80211: fix fast_tx header alignment
  1994. +
  1995. +The header field is defined as u8[] but also accessed as struct
  1996. +ieee80211_hdr. Enforce an alignment of 2 to prevent unnecessary
  1997. +unaligned accesses, which can be very harmful for performance on many
  1998. +platforms.
  1999. +
  2000. +Fixes: e495c24731a2 ("mac80211: extend fast-xmit for more ciphers")
  2001. +Cc: stable@vger.kernel.org
  2002. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  2003. +---
  2004. +
  2005. +--- a/net/mac80211/sta_info.h
  2006. ++++ b/net/mac80211/sta_info.h
  2007. +@@ -280,7 +280,7 @@ struct ieee80211_fast_tx {
  2008. + u8 sa_offs, da_offs, pn_offs;
  2009. + u8 band;
  2010. + u8 hdr[30 + 2 + IEEE80211_FAST_XMIT_MAX_IV +
  2011. +- sizeof(rfc1042_header)];
  2012. ++ sizeof(rfc1042_header)] __aligned(2);
  2013. +
  2014. + struct rcu_head rcu_head;
  2015. + };
  2016. diff --git a/package/kernel/mac80211/patches/305-ath10k-Ensure-txrx-compl-task-is-stopped-when-cleani.patch b/package/kernel/mac80211/patches/305-ath10k-Ensure-txrx-compl-task-is-stopped-when-cleani.patch
  2017. new file mode 100644
  2018. index 0000000..73accd8
  2019. --- /dev/null
  2020. +++ b/package/kernel/mac80211/patches/305-ath10k-Ensure-txrx-compl-task-is-stopped-when-cleani.patch
  2021. @@ -0,0 +1,21 @@
  2022. +From: Ben Greear <greearb@candelatech.com>
  2023. +Date: Fri, 1 Apr 2016 14:12:08 -0700
  2024. +Subject: [PATCH] ath10k: Ensure txrx-compl-task is stopped when cleaning
  2025. + htt-tx.
  2026. +
  2027. +Otherwise, the txrx-compl-task may access some bad memory?
  2028. +
  2029. +Signed-off-by: Ben Greear <greearb@candelatech.com>
  2030. +---
  2031. +
  2032. +--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
  2033. ++++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
  2034. +@@ -388,6 +388,8 @@ void ath10k_htt_tx_free(struct ath10k_ht
  2035. + {
  2036. + int size;
  2037. +
  2038. ++ tasklet_kill(&htt->txrx_compl_task);
  2039. ++
  2040. + idr_for_each(&htt->pending_tx, ath10k_htt_tx_clean_up_pending, htt->ar);
  2041. + idr_destroy(&htt->pending_tx);
  2042. +
  2043. diff --git a/package/kernel/mac80211/patches/305-ath9k-clean-up-ANI-per-channel-pointer-checking.patch b/package/kernel/mac80211/patches/305-ath9k-clean-up-ANI-per-channel-pointer-checking.patch
  2044. deleted file mode 100644
  2045. index a1ac67c..0000000
  2046. --- a/package/kernel/mac80211/patches/305-ath9k-clean-up-ANI-per-channel-pointer-checking.patch
  2047. +++ /dev/null
  2048. @@ -1,91 +0,0 @@
  2049. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  2050. -Date: Fri, 15 Jan 2016 18:17:18 +0800
  2051. -Subject: [PATCH] ath9k: clean up ANI per-channel pointer checking
  2052. -
  2053. -commit c24bd3620c50 ("ath9k: Do not maintain ANI state per-channel")
  2054. -removed per-channel handling, the code to check 'curchan' also
  2055. -should be removed as never used.
  2056. -
  2057. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  2058. ----
  2059. -
  2060. ---- a/drivers/net/wireless/ath/ath9k/ani.c
  2061. -+++ b/drivers/net/wireless/ath/ath9k/ani.c
  2062. -@@ -126,12 +126,8 @@ static void ath9k_hw_update_mibstats(str
  2063. -
  2064. - static void ath9k_ani_restart(struct ath_hw *ah)
  2065. - {
  2066. -- struct ar5416AniState *aniState;
  2067. --
  2068. -- if (!ah->curchan)
  2069. -- return;
  2070. -+ struct ar5416AniState *aniState = &ah->ani;
  2071. -
  2072. -- aniState = &ah->ani;
  2073. - aniState->listenTime = 0;
  2074. -
  2075. - ENABLE_REGWRITE_BUFFER(ah);
  2076. -@@ -221,12 +217,7 @@ static void ath9k_hw_set_ofdm_nil(struct
  2077. -
  2078. - static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah)
  2079. - {
  2080. -- struct ar5416AniState *aniState;
  2081. --
  2082. -- if (!ah->curchan)
  2083. -- return;
  2084. --
  2085. -- aniState = &ah->ani;
  2086. -+ struct ar5416AniState *aniState = &ah->ani;
  2087. -
  2088. - if (aniState->ofdmNoiseImmunityLevel < ATH9K_ANI_OFDM_MAX_LEVEL)
  2089. - ath9k_hw_set_ofdm_nil(ah, aniState->ofdmNoiseImmunityLevel + 1, false);
  2090. -@@ -281,12 +272,7 @@ static void ath9k_hw_set_cck_nil(struct
  2091. -
  2092. - static void ath9k_hw_ani_cck_err_trigger(struct ath_hw *ah)
  2093. - {
  2094. -- struct ar5416AniState *aniState;
  2095. --
  2096. -- if (!ah->curchan)
  2097. -- return;
  2098. --
  2099. -- aniState = &ah->ani;
  2100. -+ struct ar5416AniState *aniState = &ah->ani;
  2101. -
  2102. - if (aniState->cckNoiseImmunityLevel < ATH9K_ANI_CCK_MAX_LEVEL)
  2103. - ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel + 1,
  2104. -@@ -299,9 +285,7 @@ static void ath9k_hw_ani_cck_err_trigger
  2105. - */
  2106. - static void ath9k_hw_ani_lower_immunity(struct ath_hw *ah)
  2107. - {
  2108. -- struct ar5416AniState *aniState;
  2109. --
  2110. -- aniState = &ah->ani;
  2111. -+ struct ar5416AniState *aniState = &ah->ani;
  2112. -
  2113. - /* lower OFDM noise immunity */
  2114. - if (aniState->ofdmNoiseImmunityLevel > 0 &&
  2115. -@@ -329,7 +313,7 @@ void ath9k_ani_reset(struct ath_hw *ah,
  2116. - struct ath_common *common = ath9k_hw_common(ah);
  2117. - int ofdm_nil, cck_nil;
  2118. -
  2119. -- if (!ah->curchan)
  2120. -+ if (!chan)
  2121. - return;
  2122. -
  2123. - BUG_ON(aniState == NULL);
  2124. -@@ -416,14 +400,10 @@ static bool ath9k_hw_ani_read_counters(s
  2125. -
  2126. - void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan)
  2127. - {
  2128. -- struct ar5416AniState *aniState;
  2129. -+ struct ar5416AniState *aniState = &ah->ani;
  2130. - struct ath_common *common = ath9k_hw_common(ah);
  2131. - u32 ofdmPhyErrRate, cckPhyErrRate;
  2132. -
  2133. -- if (!ah->curchan)
  2134. -- return;
  2135. --
  2136. -- aniState = &ah->ani;
  2137. - if (!ath9k_hw_ani_read_counters(ah))
  2138. - return;
  2139. -
  2140. diff --git a/package/kernel/mac80211/patches/306-ath10k-Ensure-peer_map-references-are-cleaned-up.patch b/package/kernel/mac80211/patches/306-ath10k-Ensure-peer_map-references-are-cleaned-up.patch
  2141. new file mode 100644
  2142. index 0000000..2979b4b
  2143. --- /dev/null
  2144. +++ b/package/kernel/mac80211/patches/306-ath10k-Ensure-peer_map-references-are-cleaned-up.patch
  2145. @@ -0,0 +1,60 @@
  2146. +From: Ben Greear <greearb@candelatech.com>
  2147. +Date: Fri, 1 Apr 2016 14:12:09 -0700
  2148. +Subject: [PATCH] ath10k: Ensure peer_map references are cleaned up.
  2149. +
  2150. +While debugging OS crashes due to firmware crashes, I enabled
  2151. +kasan, and it noticed that peer objects were being used-after-freed.
  2152. +
  2153. +Looks like there are two places we could be leaving stale references
  2154. +in the peer-map, so clean that up.
  2155. +
  2156. +Signed-off-by: Ben Greear <greearb@candelatech.com>
  2157. +---
  2158. +
  2159. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  2160. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  2161. +@@ -773,6 +773,7 @@ static void ath10k_peer_cleanup(struct a
  2162. + {
  2163. + struct ath10k_peer *peer, *tmp;
  2164. + int peer_id;
  2165. ++ int i;
  2166. +
  2167. + lockdep_assert_held(&ar->conf_mutex);
  2168. +
  2169. +@@ -789,6 +790,17 @@ static void ath10k_peer_cleanup(struct a
  2170. + ar->peer_map[peer_id] = NULL;
  2171. + }
  2172. +
  2173. ++ /* Double check that peer is properly un-referenced from
  2174. ++ * the peer_map
  2175. ++ */
  2176. ++ for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) {
  2177. ++ if (ar->peer_map[i] == peer) {
  2178. ++ ath10k_warn(ar, "removing stale peer_map entry for %pM (ptr %p idx %d)\n",
  2179. ++ peer->addr, peer, i);
  2180. ++ ar->peer_map[i] = NULL;
  2181. ++ }
  2182. ++ }
  2183. ++
  2184. + list_del(&peer->list);
  2185. + kfree(peer);
  2186. + ar->num_peers--;
  2187. +@@ -799,6 +811,7 @@ static void ath10k_peer_cleanup(struct a
  2188. + static void ath10k_peer_cleanup_all(struct ath10k *ar)
  2189. + {
  2190. + struct ath10k_peer *peer, *tmp;
  2191. ++ int i;
  2192. +
  2193. + lockdep_assert_held(&ar->conf_mutex);
  2194. +
  2195. +@@ -807,6 +820,10 @@ static void ath10k_peer_cleanup_all(stru
  2196. + list_del(&peer->list);
  2197. + kfree(peer);
  2198. + }
  2199. ++
  2200. ++ for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++)
  2201. ++ ar->peer_map[i] = NULL;
  2202. ++
  2203. + spin_unlock_bh(&ar->data_lock);
  2204. +
  2205. + ar->num_peers = 0;
  2206. diff --git a/package/kernel/mac80211/patches/306-ath9k-do-not-reset-while-BB-panic-0x4000409-on-ar956.patch b/package/kernel/mac80211/patches/306-ath9k-do-not-reset-while-BB-panic-0x4000409-on-ar956.patch
  2207. deleted file mode 100644
  2208. index cf8194a..0000000
  2209. --- a/package/kernel/mac80211/patches/306-ath9k-do-not-reset-while-BB-panic-0x4000409-on-ar956.patch
  2210. +++ /dev/null
  2211. @@ -1,31 +0,0 @@
  2212. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  2213. -Date: Fri, 15 Jan 2016 18:17:19 +0800
  2214. -Subject: [PATCH] ath9k: do not reset while BB panic(0x4000409) on ar9561
  2215. -
  2216. -BB panic(0x4000409) observed while AP enabling/disabling
  2217. -bursting.
  2218. -
  2219. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  2220. ----
  2221. -
  2222. ---- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  2223. -+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  2224. -@@ -2071,7 +2071,8 @@ void ar9003_hw_attach_phy_ops(struct ath
  2225. - * to be disabled.
  2226. - *
  2227. - * 0x04000409: Packet stuck on receive.
  2228. -- * Full chip reset is required for all chips except AR9340.
  2229. -+ * Full chip reset is required for all chips except
  2230. -+ * AR9340, AR9531 and AR9561.
  2231. - */
  2232. -
  2233. - /*
  2234. -@@ -2100,7 +2101,7 @@ bool ar9003_hw_bb_watchdog_check(struct
  2235. - case 0x04000b09:
  2236. - return true;
  2237. - case 0x04000409:
  2238. -- if (AR_SREV_9340(ah) || AR_SREV_9531(ah))
  2239. -+ if (AR_SREV_9340(ah) || AR_SREV_9531(ah) || AR_SREV_9561(ah))
  2240. - return false;
  2241. - else
  2242. - return true;
  2243. diff --git a/package/kernel/mac80211/patches/307-ath10k-Clean-up-peer-when-sta-goes-away.patch b/package/kernel/mac80211/patches/307-ath10k-Clean-up-peer-when-sta-goes-away.patch
  2244. new file mode 100644
  2245. index 0000000..f814ae7
  2246. --- /dev/null
  2247. +++ b/package/kernel/mac80211/patches/307-ath10k-Clean-up-peer-when-sta-goes-away.patch
  2248. @@ -0,0 +1,32 @@
  2249. +From: Ben Greear <greearb@candelatech.com>
  2250. +Date: Fri, 1 Apr 2016 14:12:11 -0700
  2251. +Subject: [PATCH] ath10k: Clean up peer when sta goes away.
  2252. +
  2253. +If WMI and/or firmware has issues removing the peer object,
  2254. +then we still need to clean up the peer object in the driver.
  2255. +
  2256. +Signed-off-by: Ben Greear <greearb@candelatech.com>
  2257. +---
  2258. +
  2259. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  2260. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  2261. +@@ -5949,9 +5949,17 @@ static int ath10k_sta_state(struct ieee8
  2262. + continue;
  2263. +
  2264. + if (peer->sta == sta) {
  2265. +- ath10k_warn(ar, "found sta peer %pM entry on vdev %i after it was supposedly removed\n",
  2266. +- sta->addr, arvif->vdev_id);
  2267. ++ ath10k_warn(ar, "found sta peer %pM (ptr %p id %d) entry on vdev %i after it was supposedly removed\n",
  2268. ++ sta->addr, peer, i, arvif->vdev_id);
  2269. + peer->sta = NULL;
  2270. ++
  2271. ++ /* Clean up the peer object as well since we
  2272. ++ * must have failed to do this above.
  2273. ++ */
  2274. ++ list_del(&peer->list);
  2275. ++ ar->peer_map[i] = NULL;
  2276. ++ kfree(peer);
  2277. ++ ar->num_peers--;
  2278. + }
  2279. + }
  2280. + spin_unlock_bh(&ar->data_lock);
  2281. diff --git a/package/kernel/mac80211/patches/307-ath9k-fix-inconsistent-use-of-tab-and-space-in-inden.patch b/package/kernel/mac80211/patches/307-ath9k-fix-inconsistent-use-of-tab-and-space-in-inden.patch
  2282. deleted file mode 100644
  2283. index 80b781c..0000000
  2284. --- a/package/kernel/mac80211/patches/307-ath9k-fix-inconsistent-use-of-tab-and-space-in-inden.patch
  2285. +++ /dev/null
  2286. @@ -1,27 +0,0 @@
  2287. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  2288. -Date: Fri, 15 Jan 2016 18:17:20 +0800
  2289. -Subject: [PATCH] ath9k: fix inconsistent use of tab and space in
  2290. - indentation
  2291. -
  2292. -Minor changes for indenting.
  2293. -
  2294. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  2295. ----
  2296. -
  2297. ---- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  2298. -+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  2299. -@@ -5485,11 +5485,11 @@ unsigned int ar9003_get_paprd_scale_fact
  2300. - AR9300_PAPRD_SCALE_1);
  2301. - else {
  2302. - if (chan->channel >= 5700)
  2303. -- return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20),
  2304. -- AR9300_PAPRD_SCALE_1);
  2305. -+ return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20),
  2306. -+ AR9300_PAPRD_SCALE_1);
  2307. - else if (chan->channel >= 5400)
  2308. - return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt40),
  2309. -- AR9300_PAPRD_SCALE_2);
  2310. -+ AR9300_PAPRD_SCALE_2);
  2311. - else
  2312. - return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt40),
  2313. - AR9300_PAPRD_SCALE_1);
  2314. diff --git a/package/kernel/mac80211/patches/308-ath10k-remove-duplicate-and-unused-rx-rate-flags.patch b/package/kernel/mac80211/patches/308-ath10k-remove-duplicate-and-unused-rx-rate-flags.patch
  2315. new file mode 100644
  2316. index 0000000..7c5c5be
  2317. --- /dev/null
  2318. +++ b/package/kernel/mac80211/patches/308-ath10k-remove-duplicate-and-unused-rx-rate-flags.patch
  2319. @@ -0,0 +1,66 @@
  2320. +From: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
  2321. +Date: Thu, 2 Jun 2016 19:54:41 +0530
  2322. +Subject: [PATCH] ath10k: remove duplicate and unused rx rate flags
  2323. +
  2324. +All these flags are not used and their use is completely
  2325. +covered by 'ath10k_hw_rate_ofdm', 'ath10k_hw_rate_cck',
  2326. +and RX_PPDU_START_RATE_FLAG
  2327. +
  2328. +Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
  2329. +---
  2330. +
  2331. +--- a/drivers/net/wireless/ath/ath10k/rx_desc.h
  2332. ++++ b/drivers/net/wireless/ath/ath10k/rx_desc.h
  2333. +@@ -656,26 +656,6 @@ struct rx_msdu_end {
  2334. + * Reserved: HW should fill with zero. FW should ignore.
  2335. + */
  2336. +
  2337. +-#define RX_PPDU_START_SIG_RATE_SELECT_OFDM 0
  2338. +-#define RX_PPDU_START_SIG_RATE_SELECT_CCK 1
  2339. +-
  2340. +-#define RX_PPDU_START_SIG_RATE_OFDM_48 0
  2341. +-#define RX_PPDU_START_SIG_RATE_OFDM_24 1
  2342. +-#define RX_PPDU_START_SIG_RATE_OFDM_12 2
  2343. +-#define RX_PPDU_START_SIG_RATE_OFDM_6 3
  2344. +-#define RX_PPDU_START_SIG_RATE_OFDM_54 4
  2345. +-#define RX_PPDU_START_SIG_RATE_OFDM_36 5
  2346. +-#define RX_PPDU_START_SIG_RATE_OFDM_18 6
  2347. +-#define RX_PPDU_START_SIG_RATE_OFDM_9 7
  2348. +-
  2349. +-#define RX_PPDU_START_SIG_RATE_CCK_LP_11 0
  2350. +-#define RX_PPDU_START_SIG_RATE_CCK_LP_5_5 1
  2351. +-#define RX_PPDU_START_SIG_RATE_CCK_LP_2 2
  2352. +-#define RX_PPDU_START_SIG_RATE_CCK_LP_1 3
  2353. +-#define RX_PPDU_START_SIG_RATE_CCK_SP_11 4
  2354. +-#define RX_PPDU_START_SIG_RATE_CCK_SP_5_5 5
  2355. +-#define RX_PPDU_START_SIG_RATE_CCK_SP_2 6
  2356. +-
  2357. + #define HTT_RX_PPDU_START_PREAMBLE_LEGACY 0x04
  2358. + #define HTT_RX_PPDU_START_PREAMBLE_HT 0x08
  2359. + #define HTT_RX_PPDU_START_PREAMBLE_HT_WITH_TXBF 0x09
  2360. +@@ -711,25 +691,6 @@ struct rx_msdu_end {
  2361. + /* No idea what this flag means. It seems to be always set in rate. */
  2362. + #define RX_PPDU_START_RATE_FLAG BIT(3)
  2363. +
  2364. +-enum rx_ppdu_start_rate {
  2365. +- RX_PPDU_START_RATE_OFDM_48M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_OFDM_48M,
  2366. +- RX_PPDU_START_RATE_OFDM_24M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_OFDM_24M,
  2367. +- RX_PPDU_START_RATE_OFDM_12M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_OFDM_12M,
  2368. +- RX_PPDU_START_RATE_OFDM_6M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_OFDM_6M,
  2369. +- RX_PPDU_START_RATE_OFDM_54M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_OFDM_54M,
  2370. +- RX_PPDU_START_RATE_OFDM_36M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_OFDM_36M,
  2371. +- RX_PPDU_START_RATE_OFDM_18M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_OFDM_18M,
  2372. +- RX_PPDU_START_RATE_OFDM_9M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_OFDM_9M,
  2373. +-
  2374. +- RX_PPDU_START_RATE_CCK_LP_11M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_CCK_LP_11M,
  2375. +- RX_PPDU_START_RATE_CCK_LP_5_5M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_CCK_LP_5_5M,
  2376. +- RX_PPDU_START_RATE_CCK_LP_2M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_CCK_LP_2M,
  2377. +- RX_PPDU_START_RATE_CCK_LP_1M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_CCK_LP_1M,
  2378. +- RX_PPDU_START_RATE_CCK_SP_11M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_CCK_SP_11M,
  2379. +- RX_PPDU_START_RATE_CCK_SP_5_5M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_CCK_SP_5_5M,
  2380. +- RX_PPDU_START_RATE_CCK_SP_2M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_CCK_SP_2M,
  2381. +-};
  2382. +-
  2383. + struct rx_ppdu_start {
  2384. + struct {
  2385. + u8 pri20_mhz;
  2386. diff --git a/package/kernel/mac80211/patches/308-ath9k-fix-data-bus-error-on-ar9300-and-ar9580.patch b/package/kernel/mac80211/patches/308-ath9k-fix-data-bus-error-on-ar9300-and-ar9580.patch
  2387. deleted file mode 100644
  2388. index d408866..0000000
  2389. --- a/package/kernel/mac80211/patches/308-ath9k-fix-data-bus-error-on-ar9300-and-ar9580.patch
  2390. +++ /dev/null
  2391. @@ -1,65 +0,0 @@
  2392. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  2393. -Date: Fri, 15 Jan 2016 18:17:21 +0800
  2394. -Subject: [PATCH] ath9k: fix data bus error on ar9300 and ar9580
  2395. -
  2396. -One crash issue be found on ar9300: RTC_RC reg read leads crash, leading
  2397. -the data bus error, due to RTC_RC reg write not happen properly.
  2398. -
  2399. -Warm Reset trigger in continuous beacon stuck for one of the customer for
  2400. -other chip, noticed the MAC was stuck in RTC reset. After analysis noticed
  2401. -DMA did not complete when RTC was put in reset.
  2402. -
  2403. -So, before resetting the MAC need to make sure there are no pending DMA
  2404. -transactions because this reset does not reset all parts of the chip.
  2405. -
  2406. -The 12th and 11th bit of MAC _DMA_CFG register used to do that.
  2407. - 12 cfg_halt_ack 0x0
  2408. - 0 DMA has not yet halted
  2409. - 1 DMA has halted
  2410. - 11 cfg_halt_req 0x0
  2411. - 0 DMA logic operates normally
  2412. - 1 Request DMA logic to stop so software can reset the MAC
  2413. -
  2414. -The Bit [12] of this register indicates when the halt has taken effect or
  2415. -not. the DMA halt IS NOT recoverable; once software sets bit [11] to
  2416. -request a DMA halt, software must wait for bit [12] to be set and reset
  2417. -the MAC.
  2418. -
  2419. -So, the same thing we implemented for ar9580 chip.
  2420. -
  2421. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  2422. ----
  2423. -
  2424. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  2425. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  2426. -@@ -1368,6 +1368,16 @@ static bool ath9k_hw_set_reset(struct at
  2427. - if (ath9k_hw_mci_is_enabled(ah))
  2428. - ar9003_mci_check_gpm_offset(ah);
  2429. -
  2430. -+ /* DMA HALT added to resolve ar9300 and ar9580 bus error during
  2431. -+ * RTC_RC reg read
  2432. -+ */
  2433. -+ if (AR_SREV_9300(ah) || AR_SREV_9580(ah)) {
  2434. -+ REG_SET_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  2435. -+ ath9k_hw_wait(ah, AR_CFG, AR_CFG_HALT_ACK, AR_CFG_HALT_ACK,
  2436. -+ 20 * AH_WAIT_TIMEOUT);
  2437. -+ REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  2438. -+ }
  2439. -+
  2440. - REG_WRITE(ah, AR_RTC_RC, rst_flags);
  2441. -
  2442. - REGWRITE_BUFFER_FLUSH(ah);
  2443. ---- a/drivers/net/wireless/ath/ath9k/reg.h
  2444. -+++ b/drivers/net/wireless/ath/ath9k/reg.h
  2445. -@@ -34,8 +34,10 @@
  2446. - #define AR_CFG_SWRG 0x00000010
  2447. - #define AR_CFG_AP_ADHOC_INDICATION 0x00000020
  2448. - #define AR_CFG_PHOK 0x00000100
  2449. --#define AR_CFG_CLK_GATE_DIS 0x00000400
  2450. - #define AR_CFG_EEBS 0x00000200
  2451. -+#define AR_CFG_CLK_GATE_DIS 0x00000400
  2452. -+#define AR_CFG_HALT_REQ 0x00000800
  2453. -+#define AR_CFG_HALT_ACK 0x00001000
  2454. - #define AR_CFG_PCI_MASTER_REQ_Q_THRESH 0x00060000
  2455. - #define AR_CFG_PCI_MASTER_REQ_Q_THRESH_S 17
  2456. -
  2457. diff --git a/package/kernel/mac80211/patches/309-01-brcmfmac-add-missing-include.patch b/package/kernel/mac80211/patches/309-01-brcmfmac-add-missing-include.patch
  2458. deleted file mode 100644
  2459. index d9511c8..0000000
  2460. --- a/package/kernel/mac80211/patches/309-01-brcmfmac-add-missing-include.patch
  2461. +++ /dev/null
  2462. @@ -1,19 +0,0 @@
  2463. -From: Felix Fietkau <nbd@openwrt.org>
  2464. -Date: Fri, 15 Jan 2016 15:59:45 +0100
  2465. -Subject: [PATCH] brcmfmac: add missing include
  2466. -
  2467. -linux/module.h is required for defining module parameters
  2468. -
  2469. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  2470. ----
  2471. -
  2472. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  2473. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  2474. -@@ -17,6 +17,7 @@
  2475. - #include <linux/kernel.h>
  2476. - #include <linux/string.h>
  2477. - #include <linux/netdevice.h>
  2478. -+#include <linux/module.h>
  2479. - #include <brcmu_wifi.h>
  2480. - #include <brcmu_utils.h>
  2481. - #include "core.h"
  2482. diff --git a/package/kernel/mac80211/patches/309-02-brcmfmac-fix-sdio-sg-table-alloc-crash.patch b/package/kernel/mac80211/patches/309-02-brcmfmac-fix-sdio-sg-table-alloc-crash.patch
  2483. deleted file mode 100644
  2484. index 711e019..0000000
  2485. --- a/package/kernel/mac80211/patches/309-02-brcmfmac-fix-sdio-sg-table-alloc-crash.patch
  2486. +++ /dev/null
  2487. @@ -1,118 +0,0 @@
  2488. -From: Hante Meuleman <meuleman@broadcom.com>
  2489. -Date: Tue, 19 Jan 2016 12:39:24 +0100
  2490. -Subject: [PATCH] brcmfmac: fix sdio sg table alloc crash
  2491. -
  2492. -With commit 7d34b0560567 ("brcmfmac: Move all module parameters to
  2493. -one place") a bug was introduced causing a null pointer exception.
  2494. -This patch fixes the bug by initializing the sg table till after
  2495. -the settings have been initialized.
  2496. -
  2497. -Fixes: 7d34b0560567 ("brcmfmac: Move all module parameters to one place")
  2498. -Reported-by: Marc Zyngier <marc.zyngier@arm.com>
  2499. -Tested-by: Marc Zyngier <marc.zyngier@arm.com>
  2500. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  2501. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  2502. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  2503. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  2504. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  2505. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  2506. ----
  2507. -
  2508. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  2509. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  2510. -@@ -879,11 +879,24 @@ int brcmf_sdiod_abort(struct brcmf_sdio_
  2511. - return 0;
  2512. - }
  2513. -
  2514. --static void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev)
  2515. -+void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev)
  2516. - {
  2517. -+ struct sdio_func *func;
  2518. -+ struct mmc_host *host;
  2519. -+ uint max_blocks;
  2520. - uint nents;
  2521. - int err;
  2522. -
  2523. -+ func = sdiodev->func[2];
  2524. -+ host = func->card->host;
  2525. -+ sdiodev->sg_support = host->max_segs > 1;
  2526. -+ max_blocks = min_t(uint, host->max_blk_count, 511u);
  2527. -+ sdiodev->max_request_size = min_t(uint, host->max_req_size,
  2528. -+ max_blocks * func->cur_blksize);
  2529. -+ sdiodev->max_segment_count = min_t(uint, host->max_segs,
  2530. -+ SG_MAX_SINGLE_ALLOC);
  2531. -+ sdiodev->max_segment_size = host->max_seg_size;
  2532. -+
  2533. - if (!sdiodev->sg_support)
  2534. - return;
  2535. -
  2536. -@@ -1021,9 +1034,6 @@ static void brcmf_sdiod_host_fixup(struc
  2537. -
  2538. - static int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev)
  2539. - {
  2540. -- struct sdio_func *func;
  2541. -- struct mmc_host *host;
  2542. -- uint max_blocks;
  2543. - int ret = 0;
  2544. -
  2545. - sdiodev->num_funcs = 2;
  2546. -@@ -1054,26 +1064,6 @@ static int brcmf_sdiod_probe(struct brcm
  2547. - goto out;
  2548. - }
  2549. -
  2550. -- /*
  2551. -- * determine host related variables after brcmf_sdiod_probe()
  2552. -- * as func->cur_blksize is properly set and F2 init has been
  2553. -- * completed successfully.
  2554. -- */
  2555. -- func = sdiodev->func[2];
  2556. -- host = func->card->host;
  2557. -- sdiodev->sg_support = host->max_segs > 1;
  2558. -- max_blocks = min_t(uint, host->max_blk_count, 511u);
  2559. -- sdiodev->max_request_size = min_t(uint, host->max_req_size,
  2560. -- max_blocks * func->cur_blksize);
  2561. -- sdiodev->max_segment_count = min_t(uint, host->max_segs,
  2562. -- SG_MAX_SINGLE_ALLOC);
  2563. -- sdiodev->max_segment_size = host->max_seg_size;
  2564. --
  2565. -- /* allocate scatter-gather table. sg support
  2566. -- * will be disabled upon allocation failure.
  2567. -- */
  2568. -- brcmf_sdiod_sgtable_alloc(sdiodev);
  2569. --
  2570. - ret = brcmf_sdiod_freezer_attach(sdiodev);
  2571. - if (ret)
  2572. - goto out;
  2573. -@@ -1084,7 +1074,7 @@ static int brcmf_sdiod_probe(struct brcm
  2574. - ret = -ENODEV;
  2575. - goto out;
  2576. - }
  2577. -- brcmf_sdiod_host_fixup(host);
  2578. -+ brcmf_sdiod_host_fixup(sdiodev->func[2]->card->host);
  2579. - out:
  2580. - if (ret)
  2581. - brcmf_sdiod_remove(sdiodev);
  2582. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  2583. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  2584. -@@ -4114,6 +4114,11 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
  2585. - goto fail;
  2586. - }
  2587. -
  2588. -+ /* allocate scatter-gather table. sg support
  2589. -+ * will be disabled upon allocation failure.
  2590. -+ */
  2591. -+ brcmf_sdiod_sgtable_alloc(bus->sdiodev);
  2592. -+
  2593. - /* Query the F2 block size, set roundup accordingly */
  2594. - bus->blocksize = bus->sdiodev->func[2]->cur_blksize;
  2595. - bus->roundup = min(max_roundup, bus->blocksize);
  2596. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  2597. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  2598. -@@ -342,6 +342,7 @@ int brcmf_sdiod_ramrw(struct brcmf_sdio_
  2599. -
  2600. - /* Issue an abort to the specified function */
  2601. - int brcmf_sdiod_abort(struct brcmf_sdio_dev *sdiodev, uint fn);
  2602. -+void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev);
  2603. - void brcmf_sdiod_change_state(struct brcmf_sdio_dev *sdiodev,
  2604. - enum brcmf_sdiod_state state);
  2605. - #ifdef CONFIG_PM_SLEEP
  2606. diff --git a/package/kernel/mac80211/patches/309-ath10k-fix-CCK-h-w-rates-for-QCA99X0-and-newer-chips.patch b/package/kernel/mac80211/patches/309-ath10k-fix-CCK-h-w-rates-for-QCA99X0-and-newer-chips.patch
  2607. new file mode 100644
  2608. index 0000000..50ebfce
  2609. --- /dev/null
  2610. +++ b/package/kernel/mac80211/patches/309-ath10k-fix-CCK-h-w-rates-for-QCA99X0-and-newer-chips.patch
  2611. @@ -0,0 +1,141 @@
  2612. +From: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
  2613. +Date: Thu, 2 Jun 2016 19:54:42 +0530
  2614. +Subject: [PATCH] ath10k: fix CCK h/w rates for QCA99X0 and newer chipsets
  2615. +
  2616. +CCK hardware table mapping from QCA99X0 onwards got revised.
  2617. +The CCK hardware rate values are in a proper order wrt. to
  2618. +rate and preamble as below
  2619. +
  2620. +ATH10K_HW_RATE_REV2_CCK_LP_1M = 1,
  2621. +ATH10K_HW_RATE_REV2_CCK_LP_2M = 2,
  2622. +ATH10K_HW_RATE_REV2_CCK_LP_5_5M = 3,
  2623. +ATH10K_HW_RATE_REV2_CCK_LP_11M = 4,
  2624. +ATH10K_HW_RATE_REV2_CCK_SP_2M = 5,
  2625. +ATH10K_HW_RATE_REV2_CCK_SP_5_5M = 6,
  2626. +ATH10K_HW_RATE_REV2_CCK_SP_11M = 7,
  2627. +
  2628. +This results in reporting of rx frames (with CCK rates)
  2629. +totally wrong for QCA99X0, QCA4019. Fix this by having
  2630. +separate CCK rate table for these chipsets with rev2 suffix
  2631. +and registering the correct rate mapping to mac80211 based on
  2632. +the new hw_param (introduced) 'cck_rate_map_rev2' which shall
  2633. +be true for any newchipsets from QCA99X0 onwards
  2634. +
  2635. +Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
  2636. +---
  2637. +
  2638. +--- a/drivers/net/wireless/ath/ath10k/core.c
  2639. ++++ b/drivers/net/wireless/ath/ath10k/core.c
  2640. +@@ -148,6 +148,8 @@ static const struct ath10k_hw_params ath
  2641. + .uart_pin = 7,
  2642. + .otp_exe_param = 0x00000700,
  2643. + .continuous_frag_desc = true,
  2644. ++ .cck_rate_map_rev2 = true,
  2645. ++ .cck_rate_map_rev2 = true,
  2646. + .channel_counters_freq_hz = 150000,
  2647. + .max_probe_resp_desc_thres = 24,
  2648. + .hw_4addr_pad = ATH10K_HW_4ADDR_PAD_BEFORE,
  2649. +@@ -205,6 +207,7 @@ static const struct ath10k_hw_params ath
  2650. + .has_shifted_cc_wraparound = true,
  2651. + .otp_exe_param = 0x0010000,
  2652. + .continuous_frag_desc = true,
  2653. ++ .cck_rate_map_rev2 = true,
  2654. + .channel_counters_freq_hz = 125000,
  2655. + .max_probe_resp_desc_thres = 24,
  2656. + .hw_4addr_pad = ATH10K_HW_4ADDR_PAD_BEFORE,
  2657. +--- a/drivers/net/wireless/ath/ath10k/core.h
  2658. ++++ b/drivers/net/wireless/ath/ath10k/core.h
  2659. +@@ -716,6 +716,12 @@ struct ath10k {
  2660. + */
  2661. + bool continuous_frag_desc;
  2662. +
  2663. ++ /* CCK hardware rate table mapping for the newer chipsets
  2664. ++ * like QCA99X0, QCA4019 got revised. The CCK h/w rate values
  2665. ++ * are in a proper order with respect to the rate/preamble
  2666. ++ */
  2667. ++ bool cck_rate_map_rev2;
  2668. ++
  2669. + u32 channel_counters_freq_hz;
  2670. +
  2671. + /* Mgmt tx descriptors threshold for limiting probe response
  2672. +--- a/drivers/net/wireless/ath/ath10k/hw.h
  2673. ++++ b/drivers/net/wireless/ath/ath10k/hw.h
  2674. +@@ -315,6 +315,16 @@ enum ath10k_hw_rate_cck {
  2675. + ATH10K_HW_RATE_CCK_SP_2M,
  2676. + };
  2677. +
  2678. ++enum ath10k_hw_rate_rev2_cck {
  2679. ++ ATH10K_HW_RATE_REV2_CCK_LP_1M = 1,
  2680. ++ ATH10K_HW_RATE_REV2_CCK_LP_2M,
  2681. ++ ATH10K_HW_RATE_REV2_CCK_LP_5_5M,
  2682. ++ ATH10K_HW_RATE_REV2_CCK_LP_11M,
  2683. ++ ATH10K_HW_RATE_REV2_CCK_SP_2M,
  2684. ++ ATH10K_HW_RATE_REV2_CCK_SP_5_5M,
  2685. ++ ATH10K_HW_RATE_REV2_CCK_SP_11M,
  2686. ++};
  2687. ++
  2688. + enum ath10k_hw_4addr_pad {
  2689. + ATH10K_HW_4ADDR_PAD_AFTER,
  2690. + ATH10K_HW_4ADDR_PAD_BEFORE,
  2691. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  2692. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  2693. +@@ -62,6 +62,32 @@ static struct ieee80211_rate ath10k_rate
  2694. + { .bitrate = 540, .hw_value = ATH10K_HW_RATE_OFDM_54M },
  2695. + };
  2696. +
  2697. ++static struct ieee80211_rate ath10k_rates_rev2[] = {
  2698. ++ { .bitrate = 10,
  2699. ++ .hw_value = ATH10K_HW_RATE_REV2_CCK_LP_1M },
  2700. ++ { .bitrate = 20,
  2701. ++ .hw_value = ATH10K_HW_RATE_REV2_CCK_LP_2M,
  2702. ++ .hw_value_short = ATH10K_HW_RATE_REV2_CCK_SP_2M,
  2703. ++ .flags = IEEE80211_RATE_SHORT_PREAMBLE },
  2704. ++ { .bitrate = 55,
  2705. ++ .hw_value = ATH10K_HW_RATE_REV2_CCK_LP_5_5M,
  2706. ++ .hw_value_short = ATH10K_HW_RATE_REV2_CCK_SP_5_5M,
  2707. ++ .flags = IEEE80211_RATE_SHORT_PREAMBLE },
  2708. ++ { .bitrate = 110,
  2709. ++ .hw_value = ATH10K_HW_RATE_REV2_CCK_LP_11M,
  2710. ++ .hw_value_short = ATH10K_HW_RATE_REV2_CCK_SP_11M,
  2711. ++ .flags = IEEE80211_RATE_SHORT_PREAMBLE },
  2712. ++
  2713. ++ { .bitrate = 60, .hw_value = ATH10K_HW_RATE_OFDM_6M },
  2714. ++ { .bitrate = 90, .hw_value = ATH10K_HW_RATE_OFDM_9M },
  2715. ++ { .bitrate = 120, .hw_value = ATH10K_HW_RATE_OFDM_12M },
  2716. ++ { .bitrate = 180, .hw_value = ATH10K_HW_RATE_OFDM_18M },
  2717. ++ { .bitrate = 240, .hw_value = ATH10K_HW_RATE_OFDM_24M },
  2718. ++ { .bitrate = 360, .hw_value = ATH10K_HW_RATE_OFDM_36M },
  2719. ++ { .bitrate = 480, .hw_value = ATH10K_HW_RATE_OFDM_48M },
  2720. ++ { .bitrate = 540, .hw_value = ATH10K_HW_RATE_OFDM_54M },
  2721. ++};
  2722. ++
  2723. + #define ATH10K_MAC_FIRST_OFDM_RATE_IDX 4
  2724. +
  2725. + #define ath10k_a_rates (ath10k_rates + ATH10K_MAC_FIRST_OFDM_RATE_IDX)
  2726. +@@ -70,6 +96,9 @@ static struct ieee80211_rate ath10k_rate
  2727. + #define ath10k_g_rates (ath10k_rates + 0)
  2728. + #define ath10k_g_rates_size (ARRAY_SIZE(ath10k_rates))
  2729. +
  2730. ++#define ath10k_g_rates_rev2 (ath10k_rates_rev2 + 0)
  2731. ++#define ath10k_g_rates_rev2_size (ARRAY_SIZE(ath10k_rates_rev2))
  2732. ++
  2733. + static bool ath10k_mac_bitrate_is_cck(int bitrate)
  2734. + {
  2735. + switch (bitrate) {
  2736. +@@ -7720,8 +7749,14 @@ int ath10k_mac_register(struct ath10k *a
  2737. + band = &ar->mac.sbands[NL80211_BAND_2GHZ];
  2738. + band->n_channels = ARRAY_SIZE(ath10k_2ghz_channels);
  2739. + band->channels = channels;
  2740. +- band->n_bitrates = ath10k_g_rates_size;
  2741. +- band->bitrates = ath10k_g_rates;
  2742. ++
  2743. ++ if (ar->hw_params.cck_rate_map_rev2) {
  2744. ++ band->n_bitrates = ath10k_g_rates_rev2_size;
  2745. ++ band->bitrates = ath10k_g_rates_rev2;
  2746. ++ } else {
  2747. ++ band->n_bitrates = ath10k_g_rates_size;
  2748. ++ band->bitrates = ath10k_g_rates;
  2749. ++ }
  2750. +
  2751. + ar->hw->wiphy->bands[NL80211_BAND_2GHZ] = band;
  2752. + }
  2753. diff --git a/package/kernel/mac80211/patches/310-ath10k-improve-tx-scheduling.patch b/package/kernel/mac80211/patches/310-ath10k-improve-tx-scheduling.patch
  2754. new file mode 100644
  2755. index 0000000..81ac2db
  2756. --- /dev/null
  2757. +++ b/package/kernel/mac80211/patches/310-ath10k-improve-tx-scheduling.patch
  2758. @@ -0,0 +1,67 @@
  2759. +From: Michal Kazior <michal.kazior@tieto.com>
  2760. +Date: Mon, 23 May 2016 23:12:45 +0300
  2761. +Subject: [PATCH] ath10k: improve tx scheduling
  2762. +
  2763. +Recent changes revolving around implementing
  2764. +wake_tx_queue support introduced a significant
  2765. +performance regressions on some (slower, uni-proc)
  2766. +systems.
  2767. +
  2768. +Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
  2769. +Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
  2770. +---
  2771. +
  2772. +--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
  2773. ++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
  2774. +@@ -2291,7 +2291,6 @@ bool ath10k_htt_t2h_msg_handler(struct a
  2775. + ath10k_htt_tx_mgmt_dec_pending(htt);
  2776. + spin_unlock_bh(&htt->tx_lock);
  2777. + }
  2778. +- ath10k_mac_tx_push_pending(ar);
  2779. + break;
  2780. + }
  2781. + case HTT_T2H_MSG_TYPE_TX_COMPL_IND:
  2782. +@@ -2442,8 +2441,6 @@ static void ath10k_htt_txrx_compl_task(u
  2783. + dev_kfree_skb_any(skb);
  2784. + }
  2785. +
  2786. +- ath10k_mac_tx_push_pending(ar);
  2787. +-
  2788. + num_mpdus = atomic_read(&htt->num_mpdus_ready);
  2789. +
  2790. + while (num_mpdus) {
  2791. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  2792. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  2793. +@@ -3827,6 +3827,9 @@ void ath10k_mac_tx_push_pending(struct a
  2794. + int ret;
  2795. + int max;
  2796. +
  2797. ++ if (ar->htt.num_pending_tx >= (ar->htt.max_num_pending_tx / 2))
  2798. ++ return;
  2799. ++
  2800. + spin_lock_bh(&ar->txqs_lock);
  2801. + rcu_read_lock();
  2802. +
  2803. +@@ -4097,9 +4100,7 @@ static void ath10k_mac_op_wake_tx_queue(
  2804. + list_add_tail(&artxq->list, &ar->txqs);
  2805. + spin_unlock_bh(&ar->txqs_lock);
  2806. +
  2807. +- if (ath10k_mac_tx_can_push(hw, txq))
  2808. +- tasklet_schedule(&ar->htt.txrx_compl_task);
  2809. +-
  2810. ++ ath10k_mac_tx_push_pending(ar);
  2811. + ath10k_htt_tx_txq_update(hw, txq);
  2812. + }
  2813. +
  2814. +--- a/drivers/net/wireless/ath/ath10k/txrx.c
  2815. ++++ b/drivers/net/wireless/ath/ath10k/txrx.c
  2816. +@@ -117,6 +117,9 @@ int ath10k_txrx_tx_unref(struct ath10k_h
  2817. +
  2818. + ieee80211_tx_status(htt->ar->hw, msdu);
  2819. + /* we do not own the msdu anymore */
  2820. ++
  2821. ++ ath10k_mac_tx_push_pending(ar);
  2822. ++
  2823. + return 0;
  2824. + }
  2825. +
  2826. diff --git a/package/kernel/mac80211/patches/310-ath9k_hw-ignore-eeprom-magic-mismatch-on-flash-based.patch b/package/kernel/mac80211/patches/310-ath9k_hw-ignore-eeprom-magic-mismatch-on-flash-based.patch
  2827. deleted file mode 100644
  2828. index 287d6e1..0000000
  2829. --- a/package/kernel/mac80211/patches/310-ath9k_hw-ignore-eeprom-magic-mismatch-on-flash-based.patch
  2830. +++ /dev/null
  2831. @@ -1,38 +0,0 @@
  2832. -From: Felix Fietkau <nbd@openwrt.org>
  2833. -Date: Thu, 21 Jan 2016 16:28:44 +0100
  2834. -Subject: [PATCH] ath9k_hw: ignore eeprom magic mismatch on flash based devices
  2835. -
  2836. -Many AR913x based devices (maybe others too) do not have a valid EEPROM
  2837. -magic in their calibration data partition.
  2838. -
  2839. -Fixes: 6fa658fd5ab2 ("ath9k: Simplify and fix eeprom endianness swapping")
  2840. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  2841. ----
  2842. -
  2843. ---- a/drivers/net/wireless/ath/ath9k/eeprom.c
  2844. -+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
  2845. -@@ -150,18 +150,18 @@ int ath9k_hw_nvram_swap_data(struct ath_
  2846. - return -EIO;
  2847. - }
  2848. -
  2849. -- if (magic == AR5416_EEPROM_MAGIC) {
  2850. -- *swap_needed = false;
  2851. -- } else if (swab16(magic) == AR5416_EEPROM_MAGIC) {
  2852. -+ *swap_needed = false;
  2853. -+ if (swab16(magic) == AR5416_EEPROM_MAGIC) {
  2854. - if (ah->ah_flags & AH_NO_EEP_SWAP) {
  2855. - ath_info(common,
  2856. - "Ignoring endianness difference in EEPROM magic bytes.\n");
  2857. --
  2858. -- *swap_needed = false;
  2859. - } else {
  2860. - *swap_needed = true;
  2861. - }
  2862. -- } else {
  2863. -+ } else if (magic != AR5416_EEPROM_MAGIC) {
  2864. -+ if (ath9k_hw_use_flash(ah))
  2865. -+ return 0;
  2866. -+
  2867. - ath_err(common,
  2868. - "Invalid EEPROM Magic (0x%04x).\n", magic);
  2869. - return -EINVAL;
  2870. diff --git a/package/kernel/mac80211/patches/311-ath10k-fix-deadlock-while-processing-rx_in_ord_ind.patch b/package/kernel/mac80211/patches/311-ath10k-fix-deadlock-while-processing-rx_in_ord_ind.patch
  2871. new file mode 100644
  2872. index 0000000..3664d70
  2873. --- /dev/null
  2874. +++ b/package/kernel/mac80211/patches/311-ath10k-fix-deadlock-while-processing-rx_in_ord_ind.patch
  2875. @@ -0,0 +1,59 @@
  2876. +From: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
  2877. +Date: Thu, 9 Jun 2016 11:33:55 +0530
  2878. +Subject: [PATCH] ath10k: fix deadlock while processing rx_in_ord_ind
  2879. +
  2880. +commit 5c86d97bcc1d ("ath10k: combine txrx and replenish task")
  2881. +introduced deadlock while processing rx in order indication message
  2882. +for qca6174 based devices. While merging replenish and txrx tasklets,
  2883. +replenish task should be called out of htt rx ring locking since it
  2884. +is also try to acquire the same lock.
  2885. +
  2886. +Unfortunately this issue is not exposed by other solutions (qca988x,
  2887. +qca99x0 & qca4019), as rx_in_ord_ind message is specific to qca6174
  2888. +based devices. This patch fixes
  2889. +
  2890. +=============================================
  2891. +[ INFO: possible recursive locking detected ]
  2892. +4.7.0-rc2-wt-ath+ #1353 Tainted: G E
  2893. +---------------------------------------------
  2894. +swapper/3/0 is trying to acquire lock:
  2895. + (&(&htt->rx_ring.lock)->rlock){+.-...}, at: [<f8d7ef19>]
  2896. +ath10k_htt_rx_msdu_buff_replenish+0x29/0x90 [ath10k_core]
  2897. +
  2898. +but task is already holding lock:
  2899. + (&(&htt->rx_ring.lock)->rlock){+.-...}, at: [<f8d82cab>]
  2900. +ath10k_htt_txrx_compl_task+0x21b/0x250 [ath10k_core]
  2901. +
  2902. +other info that might help us debug this:
  2903. + Possible unsafe locking scenario:
  2904. +
  2905. + CPU0
  2906. + ----
  2907. + lock(&(&htt->rx_ring.lock)->rlock);
  2908. + lock(&(&htt->rx_ring.lock)->rlock);
  2909. +
  2910. + *** DEADLOCK ***
  2911. +
  2912. + May be due to missing lock nesting notation
  2913. +
  2914. +1 lock held by swapper/3/0:
  2915. + #0: (&(&htt->rx_ring.lock)->rlock){+.-...}, at: [<f8d82cab>]
  2916. +ath10k_htt_txrx_compl_task+0x21b/0x250 [ath10k_core]
  2917. +
  2918. +Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=119151
  2919. +Fixes: 5c86d97bcc1d ("ath10k: combine txrx and replenish task")
  2920. +Reported-by: Mike Lothian <mike@fireburn.co.uk>
  2921. +Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
  2922. +Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
  2923. +---
  2924. +
  2925. +--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
  2926. ++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
  2927. +@@ -1904,7 +1904,6 @@ static void ath10k_htt_rx_in_ord_ind(str
  2928. + return;
  2929. + }
  2930. + }
  2931. +- ath10k_htt_rx_msdu_buff_replenish(htt);
  2932. + }
  2933. +
  2934. + static void ath10k_htt_rx_tx_fetch_resp_id_confirm(struct ath10k *ar,
  2935. diff --git a/package/kernel/mac80211/patches/311-ath9k-do-not-limit-the-number-of-DFS-interfaces-to-1.patch b/package/kernel/mac80211/patches/311-ath9k-do-not-limit-the-number-of-DFS-interfaces-to-1.patch
  2936. deleted file mode 100644
  2937. index 070efa9..0000000
  2938. --- a/package/kernel/mac80211/patches/311-ath9k-do-not-limit-the-number-of-DFS-interfaces-to-1.patch
  2939. +++ /dev/null
  2940. @@ -1,55 +0,0 @@
  2941. -From: Felix Fietkau <nbd@openwrt.org>
  2942. -Date: Fri, 22 Jan 2016 01:05:56 +0100
  2943. -Subject: [PATCH] ath9k: do not limit the number of DFS interfaces to 1
  2944. -
  2945. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  2946. ----
  2947. -
  2948. ---- a/drivers/net/wireless/ath/ath9k/init.c
  2949. -+++ b/drivers/net/wireless/ath/ath9k/init.c
  2950. -@@ -751,14 +751,6 @@ static const struct ieee80211_iface_comb
  2951. -
  2952. - #endif /* CPTCFG_ATH9K_CHANNEL_CONTEXT */
  2953. -
  2954. --static const struct ieee80211_iface_limit if_dfs_limits[] = {
  2955. -- { .max = 1, .types = BIT(NL80211_IFTYPE_AP) |
  2956. --#ifdef CPTCFG_MAC80211_MESH
  2957. -- BIT(NL80211_IFTYPE_MESH_POINT) |
  2958. --#endif
  2959. -- BIT(NL80211_IFTYPE_ADHOC) },
  2960. --};
  2961. --
  2962. - static const struct ieee80211_iface_combination if_comb[] = {
  2963. - {
  2964. - .limits = if_limits,
  2965. -@@ -766,6 +758,11 @@ static const struct ieee80211_iface_comb
  2966. - .max_interfaces = 2048,
  2967. - .num_different_channels = 1,
  2968. - .beacon_int_infra_match = true,
  2969. -+#ifdef CPTCFG_ATH9K_DFS_CERTIFIED
  2970. -+ .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
  2971. -+ BIT(NL80211_CHAN_WIDTH_20) |
  2972. -+ BIT(NL80211_CHAN_WIDTH_40),
  2973. -+#endif
  2974. - },
  2975. - {
  2976. - .limits = wds_limits,
  2977. -@@ -774,18 +771,6 @@ static const struct ieee80211_iface_comb
  2978. - .num_different_channels = 1,
  2979. - .beacon_int_infra_match = true,
  2980. - },
  2981. --#ifdef CPTCFG_ATH9K_DFS_CERTIFIED
  2982. -- {
  2983. -- .limits = if_dfs_limits,
  2984. -- .n_limits = ARRAY_SIZE(if_dfs_limits),
  2985. -- .max_interfaces = 1,
  2986. -- .num_different_channels = 1,
  2987. -- .beacon_int_infra_match = true,
  2988. -- .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
  2989. -- BIT(NL80211_CHAN_WIDTH_20) |
  2990. -- BIT(NL80211_CHAN_WIDTH_40),
  2991. -- }
  2992. --#endif
  2993. - };
  2994. -
  2995. - #ifdef CPTCFG_ATH9K_CHANNEL_CONTEXT
  2996. diff --git a/package/kernel/mac80211/patches/312-mac80211-fix-txq-queue-related-crashes.patch b/package/kernel/mac80211/patches/312-mac80211-fix-txq-queue-related-crashes.patch
  2997. deleted file mode 100644
  2998. index 61cafc7..0000000
  2999. --- a/package/kernel/mac80211/patches/312-mac80211-fix-txq-queue-related-crashes.patch
  3000. +++ /dev/null
  3001. @@ -1,27 +0,0 @@
  3002. -From: Michal Kazior <michal.kazior@tieto.com>
  3003. -Date: Thu, 21 Jan 2016 14:23:07 +0100
  3004. -Subject: [PATCH] mac80211: fix txq queue related crashes
  3005. -
  3006. -The driver can access the queue simultanously
  3007. -while mac80211 tears down the interface. Without
  3008. -spinlock protection this could lead to corrupting
  3009. -sk_buff_head and subsequently to an invalid
  3010. -pointer dereference.
  3011. -
  3012. -Fixes: ba8c3d6f16a1 ("mac80211: add an intermediate software queue implementation")
  3013. -Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
  3014. ----
  3015. -
  3016. ---- a/net/mac80211/iface.c
  3017. -+++ b/net/mac80211/iface.c
  3018. -@@ -977,7 +977,10 @@ static void ieee80211_do_stop(struct iee
  3019. - if (sdata->vif.txq) {
  3020. - struct txq_info *txqi = to_txq_info(sdata->vif.txq);
  3021. -
  3022. -+ spin_lock_bh(&txqi->queue.lock);
  3023. - ieee80211_purge_tx_queue(&local->hw, &txqi->queue);
  3024. -+ spin_unlock_bh(&txqi->queue.lock);
  3025. -+
  3026. - atomic_set(&sdata->txqs_len[txqi->txq.ac], 0);
  3027. - }
  3028. -
  3029. diff --git a/package/kernel/mac80211/patches/313-mac80211-fix-unnecessary-frame-drops-in-mesh-fwding.patch b/package/kernel/mac80211/patches/313-mac80211-fix-unnecessary-frame-drops-in-mesh-fwding.patch
  3030. deleted file mode 100644
  3031. index 844d43b..0000000
  3032. --- a/package/kernel/mac80211/patches/313-mac80211-fix-unnecessary-frame-drops-in-mesh-fwding.patch
  3033. +++ /dev/null
  3034. @@ -1,57 +0,0 @@
  3035. -From: Michal Kazior <michal.kazior@tieto.com>
  3036. -Date: Mon, 25 Jan 2016 14:43:24 +0100
  3037. -Subject: [PATCH] mac80211: fix unnecessary frame drops in mesh fwding
  3038. -
  3039. -The ieee80211_queue_stopped() expects hw queue
  3040. -number but it was given raw WMM AC number instead.
  3041. -
  3042. -This could cause frame drops and problems with
  3043. -traffic in some cases - most notably if driver
  3044. -doesn't map AC numbers to queue numbers 1:1 and
  3045. -uses ieee80211_stop_queues() and
  3046. -ieee80211_wake_queue() only without ever calling
  3047. -ieee80211_wake_queues().
  3048. -
  3049. -On ath10k it was possible to hit this problem in
  3050. -the following case:
  3051. -
  3052. - 1. wlan0 uses queue 0
  3053. - (ath10k maps queues per vif)
  3054. - 2. offchannel uses queue 15
  3055. - 3. queues 1-14 are unused
  3056. - 4. ieee80211_stop_queues()
  3057. - 5. ieee80211_wake_queue(q=0)
  3058. - 6. ieee80211_wake_queue(q=15)
  3059. - (other queues are not woken up because both
  3060. - driver and mac80211 know other queues are
  3061. - unused)
  3062. - 7. ieee80211_rx_h_mesh_fwding()
  3063. - 8. ieee80211_select_queue_80211() returns 2
  3064. - 9. ieee80211_queue_stopped(q=2) returns true
  3065. - 10. frame is dropped (oops!)
  3066. -
  3067. -Fixes: d3c1597b8d1b ("mac80211: fix forwarded mesh frame queue mapping")
  3068. -Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
  3069. ----
  3070. -
  3071. ---- a/net/mac80211/rx.c
  3072. -+++ b/net/mac80211/rx.c
  3073. -@@ -2235,7 +2235,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  3074. - struct ieee80211_local *local = rx->local;
  3075. - struct ieee80211_sub_if_data *sdata = rx->sdata;
  3076. - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
  3077. -- u16 q, hdrlen;
  3078. -+ u16 ac, q, hdrlen;
  3079. -
  3080. - hdr = (struct ieee80211_hdr *) skb->data;
  3081. - hdrlen = ieee80211_hdrlen(hdr->frame_control);
  3082. -@@ -2304,7 +2304,8 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  3083. - ether_addr_equal(sdata->vif.addr, hdr->addr3))
  3084. - return RX_CONTINUE;
  3085. -
  3086. -- q = ieee80211_select_queue_80211(sdata, skb, hdr);
  3087. -+ ac = ieee80211_select_queue_80211(sdata, skb, hdr);
  3088. -+ q = sdata->vif.hw_queue[ac];
  3089. - if (ieee80211_queue_stopped(&local->hw, q)) {
  3090. - IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_congestion);
  3091. - return RX_DROP_MONITOR;
  3092. diff --git a/package/kernel/mac80211/patches/314-mac80211-Requeue-work-after-scan-complete-for-all-VI.patch b/package/kernel/mac80211/patches/314-mac80211-Requeue-work-after-scan-complete-for-all-VI.patch
  3093. deleted file mode 100644
  3094. index 5b3efbd..0000000
  3095. --- a/package/kernel/mac80211/patches/314-mac80211-Requeue-work-after-scan-complete-for-all-VI.patch
  3096. +++ /dev/null
  3097. @@ -1,103 +0,0 @@
  3098. -From: Sachin Kulkarni <Sachin.Kulkarni@imgtec.com>
  3099. -Date: Tue, 12 Jan 2016 14:30:19 +0530
  3100. -Subject: [PATCH] mac80211: Requeue work after scan complete for all VIF
  3101. - types.
  3102. -
  3103. -During a sw scan ieee80211_iface_work ignores work items for all vifs.
  3104. -However after the scan complete work is requeued only for STA, ADHOC
  3105. -and MESH iftypes.
  3106. -
  3107. -This occasionally results in event processing getting delayed/not
  3108. -processed for iftype AP when it coexists with a STA. This can result
  3109. -in data halt and eventually disconnection on the AP interface.
  3110. -
  3111. -Signed-off-by: Sachin Kulkarni <Sachin.Kulkarni@imgtec.com>
  3112. -Cc: linux-wireless@vger.kernel.org
  3113. -Cc: johannes@sipsolutions.net
  3114. ----
  3115. -
  3116. ---- a/net/mac80211/ibss.c
  3117. -+++ b/net/mac80211/ibss.c
  3118. -@@ -1731,7 +1731,6 @@ void ieee80211_ibss_notify_scan_complete
  3119. - if (sdata->vif.type != NL80211_IFTYPE_ADHOC)
  3120. - continue;
  3121. - sdata->u.ibss.last_scan_completed = jiffies;
  3122. -- ieee80211_queue_work(&local->hw, &sdata->work);
  3123. - }
  3124. - mutex_unlock(&local->iflist_mtx);
  3125. - }
  3126. ---- a/net/mac80211/mesh.c
  3127. -+++ b/net/mac80211/mesh.c
  3128. -@@ -1369,17 +1369,6 @@ out:
  3129. - sdata_unlock(sdata);
  3130. - }
  3131. -
  3132. --void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local)
  3133. --{
  3134. -- struct ieee80211_sub_if_data *sdata;
  3135. --
  3136. -- rcu_read_lock();
  3137. -- list_for_each_entry_rcu(sdata, &local->interfaces, list)
  3138. -- if (ieee80211_vif_is_mesh(&sdata->vif) &&
  3139. -- ieee80211_sdata_running(sdata))
  3140. -- ieee80211_queue_work(&local->hw, &sdata->work);
  3141. -- rcu_read_unlock();
  3142. --}
  3143. -
  3144. - void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata)
  3145. - {
  3146. ---- a/net/mac80211/mesh.h
  3147. -+++ b/net/mac80211/mesh.h
  3148. -@@ -362,14 +362,10 @@ static inline bool mesh_path_sel_is_hwmp
  3149. - return sdata->u.mesh.mesh_pp_id == IEEE80211_PATH_PROTOCOL_HWMP;
  3150. - }
  3151. -
  3152. --void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local);
  3153. --
  3154. - void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata);
  3155. - void mesh_sync_adjust_tbtt(struct ieee80211_sub_if_data *sdata);
  3156. - void ieee80211s_stop(void);
  3157. - #else
  3158. --static inline void
  3159. --ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local) {}
  3160. - static inline bool mesh_path_sel_is_hwmp(struct ieee80211_sub_if_data *sdata)
  3161. - { return false; }
  3162. - static inline void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata)
  3163. ---- a/net/mac80211/mlme.c
  3164. -+++ b/net/mac80211/mlme.c
  3165. -@@ -3978,8 +3978,6 @@ static void ieee80211_restart_sta_timer(
  3166. - if (!ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR))
  3167. - ieee80211_queue_work(&sdata->local->hw,
  3168. - &sdata->u.mgd.monitor_work);
  3169. -- /* and do all the other regular work too */
  3170. -- ieee80211_queue_work(&sdata->local->hw, &sdata->work);
  3171. - }
  3172. - }
  3173. -
  3174. ---- a/net/mac80211/scan.c
  3175. -+++ b/net/mac80211/scan.c
  3176. -@@ -314,6 +314,7 @@ static void __ieee80211_scan_completed(s
  3177. - bool was_scanning = local->scanning;
  3178. - struct cfg80211_scan_request *scan_req;
  3179. - struct ieee80211_sub_if_data *scan_sdata;
  3180. -+ struct ieee80211_sub_if_data *sdata;
  3181. -
  3182. - lockdep_assert_held(&local->mtx);
  3183. -
  3184. -@@ -373,7 +374,15 @@ static void __ieee80211_scan_completed(s
  3185. -
  3186. - ieee80211_mlme_notify_scan_completed(local);
  3187. - ieee80211_ibss_notify_scan_completed(local);
  3188. -- ieee80211_mesh_notify_scan_completed(local);
  3189. -+
  3190. -+ /* Requeue all the work that might have been ignored while
  3191. -+ * the scan was in progress
  3192. -+ */
  3193. -+ list_for_each_entry_rcu(sdata, &local->interfaces, list) {
  3194. -+ if (ieee80211_sdata_running(sdata))
  3195. -+ ieee80211_queue_work(&sdata->local->hw, &sdata->work);
  3196. -+ }
  3197. -+
  3198. - if (was_scanning)
  3199. - ieee80211_start_next_roc(local);
  3200. - }
  3201. diff --git a/package/kernel/mac80211/patches/315-mac80211-fix-ibss-scan-parameters.patch b/package/kernel/mac80211/patches/315-mac80211-fix-ibss-scan-parameters.patch
  3202. deleted file mode 100644
  3203. index 52fecb9..0000000
  3204. --- a/package/kernel/mac80211/patches/315-mac80211-fix-ibss-scan-parameters.patch
  3205. +++ /dev/null
  3206. @@ -1,57 +0,0 @@
  3207. -From: Sara Sharon <sara.sharon@intel.com>
  3208. -Date: Mon, 25 Jan 2016 15:46:35 +0200
  3209. -Subject: [PATCH] mac80211: fix ibss scan parameters
  3210. -
  3211. -When joining IBSS a full scan should be initiated in order to search
  3212. -for existing cell, unless the fixed_channel parameter was set.
  3213. -A default channel to create the IBSS on if no cell was found is
  3214. -provided as well.
  3215. -However - a scan is initiated only on the default channel provided
  3216. -regardless of whether ifibss->fixed_channel is set or not, with the
  3217. -obvious result of the cell not joining existing IBSS cell that is
  3218. -on another channel.
  3219. -
  3220. -Fixes: 76bed0f43b27 ("mac80211: IBSS fix scan request")
  3221. -Signed-off-by: Sara Sharon <sara.sharon@intel.com>
  3222. -Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
  3223. ----
  3224. -
  3225. ---- a/net/mac80211/ibss.c
  3226. -+++ b/net/mac80211/ibss.c
  3227. -@@ -7,6 +7,7 @@
  3228. - * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
  3229. - * Copyright 2009, Johannes Berg <johannes@sipsolutions.net>
  3230. - * Copyright 2013-2014 Intel Mobile Communications GmbH
  3231. -+ * Copyright(c) 2016 Intel Deutschland GmbH
  3232. - *
  3233. - * This program is free software; you can redistribute it and/or modify
  3234. - * it under the terms of the GNU General Public License version 2 as
  3235. -@@ -1483,14 +1484,21 @@ static void ieee80211_sta_find_ibss(stru
  3236. -
  3237. - sdata_info(sdata, "Trigger new scan to find an IBSS to join\n");
  3238. -
  3239. -- num = ieee80211_ibss_setup_scan_channels(local->hw.wiphy,
  3240. -- &ifibss->chandef,
  3241. -- channels,
  3242. -- ARRAY_SIZE(channels));
  3243. - scan_width = cfg80211_chandef_to_scan_width(&ifibss->chandef);
  3244. -- ieee80211_request_ibss_scan(sdata, ifibss->ssid,
  3245. -- ifibss->ssid_len, channels, num,
  3246. -- scan_width);
  3247. -+
  3248. -+ if (ifibss->fixed_channel) {
  3249. -+ num = ieee80211_ibss_setup_scan_channels(local->hw.wiphy,
  3250. -+ &ifibss->chandef,
  3251. -+ channels,
  3252. -+ ARRAY_SIZE(channels));
  3253. -+ ieee80211_request_ibss_scan(sdata, ifibss->ssid,
  3254. -+ ifibss->ssid_len, channels,
  3255. -+ num, scan_width);
  3256. -+ } else {
  3257. -+ ieee80211_request_ibss_scan(sdata, ifibss->ssid,
  3258. -+ ifibss->ssid_len, NULL,
  3259. -+ 0, scan_width);
  3260. -+ }
  3261. - } else {
  3262. - int interval = IEEE80211_SCAN_INTERVAL;
  3263. -
  3264. diff --git a/package/kernel/mac80211/patches/316-net-mac80211-agg-rx.c-fix-use-of-uninitialised-value.patch b/package/kernel/mac80211/patches/316-net-mac80211-agg-rx.c-fix-use-of-uninitialised-value.patch
  3265. deleted file mode 100644
  3266. index e78df36..0000000
  3267. --- a/package/kernel/mac80211/patches/316-net-mac80211-agg-rx.c-fix-use-of-uninitialised-value.patch
  3268. +++ /dev/null
  3269. @@ -1,50 +0,0 @@
  3270. -From: Chris Bainbridge <chris.bainbridge@gmail.com>
  3271. -Date: Wed, 27 Jan 2016 15:46:18 +0000
  3272. -Subject: [PATCH] net/mac80211/agg-rx.c: fix use of uninitialised values
  3273. -
  3274. -Use kzalloc instead of kmalloc for struct tid_ampdu_rx. Fixes:
  3275. -
  3276. -[ 7.976605] UBSAN: Undefined behaviour in net/mac80211/rx.c:932:29
  3277. -[ 7.976608] load of value 2 is not a valid value for type '_Bool'
  3278. -[ 7.976611] CPU: 3 PID: 1134 Comm: kworker/u16:7 Not tainted 4.5.0-rc1+ #265
  3279. -[ 7.976613] Hardware name: Apple Inc. MacBookPro10,2/Mac-AFD8A9D944EA4843, BIOS MBP102.88Z.0106.B0A.1509130955 09/13/2015
  3280. -[ 7.976616] Workqueue: phy0 rt2x00usb_work_rxdone
  3281. -[ 7.976619] 0000000000000004 ffff880254a7ba50 ffffffff8181d866 0000000000000007
  3282. -[ 7.976622] ffff880254a7ba78 ffff880254a7ba68 ffffffff8188422d ffffffff8379b500
  3283. -[ 7.976626] ffff880254a7bab8 ffffffff81884747 0000000000000202 0000000348620032
  3284. -[ 7.976629] Call Trace:
  3285. -[ 7.976633] [<ffffffff8181d866>] dump_stack+0x45/0x5f
  3286. -[ 7.976637] [<ffffffff8188422d>] ubsan_epilogue+0xd/0x40
  3287. -[ 7.976642] [<ffffffff81884747>] __ubsan_handle_load_invalid_value+0x67/0x70
  3288. -[ 7.976646] [<ffffffff82227b4d>] ieee80211_sta_reorder_release.isra.16+0x5ed/0x730
  3289. -[ 7.976650] [<ffffffff8222ca14>] ieee80211_prepare_and_rx_handle+0xd04/0x1c00
  3290. -[ 7.976654] [<ffffffff81cb27ce>] ? usb_hcd_map_urb_for_dma+0x65e/0x960
  3291. -[ 7.976659] [<ffffffff8222db03>] __ieee80211_rx_handle_packet+0x1f3/0x750
  3292. -[ 7.976663] [<ffffffff8222e4a7>] ieee80211_rx_napi+0x447/0x990
  3293. -[ 7.976667] [<ffffffff81c5fb85>] rt2x00lib_rxdone+0x305/0xbd0
  3294. -[ 7.976670] [<ffffffff811ac23f>] ? dequeue_task_fair+0x64f/0x1de0
  3295. -[ 7.976674] [<ffffffff811a1516>] ? sched_clock_cpu+0xe6/0x150
  3296. -[ 7.976678] [<ffffffff81c6c45c>] rt2x00usb_work_rxdone+0x7c/0x140
  3297. -[ 7.976682] [<ffffffff8117aef6>] process_one_work+0x226/0x860
  3298. -[ 7.976686] [<ffffffff8117b58c>] worker_thread+0x5c/0x680
  3299. -[ 7.976690] [<ffffffff8117b530>] ? process_one_work+0x860/0x860
  3300. -[ 7.976693] [<ffffffff81184f86>] kthread+0xf6/0x150
  3301. -[ 7.976697] [<ffffffff81184e90>] ? kthread_worker_fn+0x310/0x310
  3302. -[ 7.976700] [<ffffffff822a94df>] ret_from_fork+0x3f/0x70
  3303. -[ 7.976703] [<ffffffff81184e90>] ? kthread_worker_fn+0x310/0x310
  3304. -
  3305. -Link: https://lkml.org/lkml/2016/1/26/230
  3306. -Signed-off-by: Chris Bainbridge <chris.bainbridge@gmail.com>
  3307. ----
  3308. -
  3309. ---- a/net/mac80211/agg-rx.c
  3310. -+++ b/net/mac80211/agg-rx.c
  3311. -@@ -327,7 +327,7 @@ void __ieee80211_start_rx_ba_session(str
  3312. - }
  3313. -
  3314. - /* prepare A-MPDU MLME for Rx aggregation */
  3315. -- tid_agg_rx = kmalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL);
  3316. -+ tid_agg_rx = kzalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL);
  3317. - if (!tid_agg_rx)
  3318. - goto end;
  3319. -
  3320. diff --git a/package/kernel/mac80211/patches/317-mac80211-minstrel_ht-fix-out-of-bound-in-minstrel_ht.patch b/package/kernel/mac80211/patches/317-mac80211-minstrel_ht-fix-out-of-bound-in-minstrel_ht.patch
  3321. deleted file mode 100644
  3322. index 5bf53b9..0000000
  3323. --- a/package/kernel/mac80211/patches/317-mac80211-minstrel_ht-fix-out-of-bound-in-minstrel_ht.patch
  3324. +++ /dev/null
  3325. @@ -1,45 +0,0 @@
  3326. -From: Konstantin Khlebnikov <koct9i@gmail.com>
  3327. -Date: Fri, 29 Jan 2016 11:35:12 +0300
  3328. -Subject: [PATCH] mac80211: minstrel_ht: fix out-of-bound in
  3329. - minstrel_ht_set_best_prob_rate
  3330. -
  3331. -Patch fixes this splat
  3332. -
  3333. -BUG: KASAN: slab-out-of-bounds in minstrel_ht_update_stats.isra.7+0x6e1/0x9e0
  3334. -[mac80211] at addr ffff8800cee640f4 Read of size 4 by task swapper/3/0
  3335. -
  3336. -Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
  3337. -Link: http://lkml.kernel.org/r/CALYGNiNyJhSaVnE35qS6UCGaSb2Dx1_i5HcRavuOX14oTz2P+w@mail.gmail.com
  3338. ----
  3339. -
  3340. ---- a/net/mac80211/rc80211_minstrel_ht.c
  3341. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  3342. -@@ -414,15 +414,16 @@ minstrel_ht_set_best_prob_rate(struct mi
  3343. - (max_tp_group != MINSTREL_CCK_GROUP))
  3344. - return;
  3345. -
  3346. -+ max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES;
  3347. -+ max_gpr_idx = mg->max_group_prob_rate % MCS_GROUP_RATES;
  3348. -+ max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_ewma;
  3349. -+
  3350. - if (mrs->prob_ewma > MINSTREL_FRAC(75, 100)) {
  3351. - cur_tp_avg = minstrel_ht_get_tp_avg(mi, cur_group, cur_idx,
  3352. - mrs->prob_ewma);
  3353. - if (cur_tp_avg > tmp_tp_avg)
  3354. - mi->max_prob_rate = index;
  3355. -
  3356. -- max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES;
  3357. -- max_gpr_idx = mg->max_group_prob_rate % MCS_GROUP_RATES;
  3358. -- max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_ewma;
  3359. - max_gpr_tp_avg = minstrel_ht_get_tp_avg(mi, max_gpr_group,
  3360. - max_gpr_idx,
  3361. - max_gpr_prob);
  3362. -@@ -431,7 +432,7 @@ minstrel_ht_set_best_prob_rate(struct mi
  3363. - } else {
  3364. - if (mrs->prob_ewma > tmp_prob)
  3365. - mi->max_prob_rate = index;
  3366. -- if (mrs->prob_ewma > mg->rates[mg->max_group_prob_rate].prob_ewma)
  3367. -+ if (mrs->prob_ewma > max_gpr_prob)
  3368. - mg->max_group_prob_rate = index;
  3369. - }
  3370. - }
  3371. diff --git a/package/kernel/mac80211/patches/318-mac80211-move-A-MSDU-skb_linearize-call-to-ieee80211.patch b/package/kernel/mac80211/patches/318-mac80211-move-A-MSDU-skb_linearize-call-to-ieee80211.patch
  3372. deleted file mode 100644
  3373. index 655dc4b..0000000
  3374. --- a/package/kernel/mac80211/patches/318-mac80211-move-A-MSDU-skb_linearize-call-to-ieee80211.patch
  3375. +++ /dev/null
  3376. @@ -1,35 +0,0 @@
  3377. -From: Felix Fietkau <nbd@openwrt.org>
  3378. -Date: Tue, 2 Feb 2016 14:39:08 +0100
  3379. -Subject: [PATCH] mac80211: move A-MSDU skb_linearize call to
  3380. - ieee80211_amsdu_to_8023s
  3381. -
  3382. -Prepararation for zero-copy A-MSDU support with page fragment SKBs
  3383. -
  3384. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  3385. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  3386. ----
  3387. -
  3388. ---- a/net/mac80211/rx.c
  3389. -+++ b/net/mac80211/rx.c
  3390. -@@ -2203,9 +2203,6 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx
  3391. - skb->dev = dev;
  3392. - __skb_queue_head_init(&frame_list);
  3393. -
  3394. -- if (skb_linearize(skb))
  3395. -- return RX_DROP_UNUSABLE;
  3396. --
  3397. - ieee80211_amsdu_to_8023s(skb, &frame_list, dev->dev_addr,
  3398. - rx->sdata->vif.type,
  3399. - rx->local->hw.extra_tx_headroom, true);
  3400. ---- a/net/wireless/util.c
  3401. -+++ b/net/wireless/util.c
  3402. -@@ -657,6 +657,9 @@ void ieee80211_amsdu_to_8023s(struct sk_
  3403. - int remaining, err;
  3404. - u8 dst[ETH_ALEN], src[ETH_ALEN];
  3405. -
  3406. -+ if (skb_linearize(skb))
  3407. -+ goto out;
  3408. -+
  3409. - if (has_80211_header) {
  3410. - err = ieee80211_data_to_8023(skb, addr, iftype);
  3411. - if (err)
  3412. diff --git a/package/kernel/mac80211/patches/319-cfg80211-add-function-for-802.3-conversion-with-sepa.patch b/package/kernel/mac80211/patches/319-cfg80211-add-function-for-802.3-conversion-with-sepa.patch
  3413. deleted file mode 100644
  3414. index b646ab3..0000000
  3415. --- a/package/kernel/mac80211/patches/319-cfg80211-add-function-for-802.3-conversion-with-sepa.patch
  3416. +++ /dev/null
  3417. @@ -1,186 +0,0 @@
  3418. -From: Felix Fietkau <nbd@openwrt.org>
  3419. -Date: Tue, 2 Feb 2016 14:39:09 +0100
  3420. -Subject: [PATCH] cfg80211: add function for 802.3 conversion with separate
  3421. - output buffer
  3422. -
  3423. -Use skb_copy_bits in preparation for allowing fragmented skbs
  3424. -
  3425. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  3426. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  3427. ----
  3428. -
  3429. ---- a/net/wireless/util.c
  3430. -+++ b/net/wireless/util.c
  3431. -@@ -393,9 +393,9 @@ unsigned int ieee80211_get_hdrlen_from_s
  3432. - }
  3433. - EXPORT_SYMBOL(ieee80211_get_hdrlen_from_skb);
  3434. -
  3435. --unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
  3436. -+static unsigned int __ieee80211_get_mesh_hdrlen(u8 flags)
  3437. - {
  3438. -- int ae = meshhdr->flags & MESH_FLAGS_AE;
  3439. -+ int ae = flags & MESH_FLAGS_AE;
  3440. - /* 802.11-2012, 8.2.4.7.3 */
  3441. - switch (ae) {
  3442. - default:
  3443. -@@ -407,21 +407,31 @@ unsigned int ieee80211_get_mesh_hdrlen(s
  3444. - return 18;
  3445. - }
  3446. - }
  3447. -+
  3448. -+unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
  3449. -+{
  3450. -+ return __ieee80211_get_mesh_hdrlen(meshhdr->flags);
  3451. -+}
  3452. - EXPORT_SYMBOL(ieee80211_get_mesh_hdrlen);
  3453. -
  3454. --int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
  3455. -- enum nl80211_iftype iftype)
  3456. -+static int __ieee80211_data_to_8023(struct sk_buff *skb, struct ethhdr *ehdr,
  3457. -+ const u8 *addr, enum nl80211_iftype iftype)
  3458. - {
  3459. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  3460. -- u16 hdrlen, ethertype;
  3461. -- u8 *payload;
  3462. -- u8 dst[ETH_ALEN];
  3463. -- u8 src[ETH_ALEN] __aligned(2);
  3464. -+ struct {
  3465. -+ u8 hdr[ETH_ALEN] __aligned(2);
  3466. -+ __be16 proto;
  3467. -+ } payload;
  3468. -+ struct ethhdr tmp;
  3469. -+ u16 hdrlen;
  3470. -+ u8 mesh_flags = 0;
  3471. -
  3472. - if (unlikely(!ieee80211_is_data_present(hdr->frame_control)))
  3473. - return -1;
  3474. -
  3475. - hdrlen = ieee80211_hdrlen(hdr->frame_control);
  3476. -+ if (skb->len < hdrlen + 8)
  3477. -+ return -1;
  3478. -
  3479. - /* convert IEEE 802.11 header + possible LLC headers into Ethernet
  3480. - * header
  3481. -@@ -432,8 +442,11 @@ int ieee80211_data_to_8023(struct sk_buf
  3482. - * 1 0 BSSID SA DA n/a
  3483. - * 1 1 RA TA DA SA
  3484. - */
  3485. -- memcpy(dst, ieee80211_get_DA(hdr), ETH_ALEN);
  3486. -- memcpy(src, ieee80211_get_SA(hdr), ETH_ALEN);
  3487. -+ memcpy(tmp.h_dest, ieee80211_get_DA(hdr), ETH_ALEN);
  3488. -+ memcpy(tmp.h_source, ieee80211_get_SA(hdr), ETH_ALEN);
  3489. -+
  3490. -+ if (iftype == NL80211_IFTYPE_MESH_POINT)
  3491. -+ skb_copy_bits(skb, hdrlen, &mesh_flags, 1);
  3492. -
  3493. - switch (hdr->frame_control &
  3494. - cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) {
  3495. -@@ -450,44 +463,31 @@ int ieee80211_data_to_8023(struct sk_buf
  3496. - iftype != NL80211_IFTYPE_STATION))
  3497. - return -1;
  3498. - if (iftype == NL80211_IFTYPE_MESH_POINT) {
  3499. -- struct ieee80211s_hdr *meshdr =
  3500. -- (struct ieee80211s_hdr *) (skb->data + hdrlen);
  3501. -- /* make sure meshdr->flags is on the linear part */
  3502. -- if (!pskb_may_pull(skb, hdrlen + 1))
  3503. -- return -1;
  3504. -- if (meshdr->flags & MESH_FLAGS_AE_A4)
  3505. -+ if (mesh_flags & MESH_FLAGS_AE_A4)
  3506. - return -1;
  3507. -- if (meshdr->flags & MESH_FLAGS_AE_A5_A6) {
  3508. -+ if (mesh_flags & MESH_FLAGS_AE_A5_A6) {
  3509. - skb_copy_bits(skb, hdrlen +
  3510. - offsetof(struct ieee80211s_hdr, eaddr1),
  3511. -- dst, ETH_ALEN);
  3512. -- skb_copy_bits(skb, hdrlen +
  3513. -- offsetof(struct ieee80211s_hdr, eaddr2),
  3514. -- src, ETH_ALEN);
  3515. -+ tmp.h_dest, 2 * ETH_ALEN);
  3516. - }
  3517. -- hdrlen += ieee80211_get_mesh_hdrlen(meshdr);
  3518. -+ hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags);
  3519. - }
  3520. - break;
  3521. - case cpu_to_le16(IEEE80211_FCTL_FROMDS):
  3522. - if ((iftype != NL80211_IFTYPE_STATION &&
  3523. - iftype != NL80211_IFTYPE_P2P_CLIENT &&
  3524. - iftype != NL80211_IFTYPE_MESH_POINT) ||
  3525. -- (is_multicast_ether_addr(dst) &&
  3526. -- ether_addr_equal(src, addr)))
  3527. -+ (is_multicast_ether_addr(tmp.h_dest) &&
  3528. -+ ether_addr_equal(tmp.h_source, addr)))
  3529. - return -1;
  3530. - if (iftype == NL80211_IFTYPE_MESH_POINT) {
  3531. -- struct ieee80211s_hdr *meshdr =
  3532. -- (struct ieee80211s_hdr *) (skb->data + hdrlen);
  3533. -- /* make sure meshdr->flags is on the linear part */
  3534. -- if (!pskb_may_pull(skb, hdrlen + 1))
  3535. -- return -1;
  3536. -- if (meshdr->flags & MESH_FLAGS_AE_A5_A6)
  3537. -+ if (mesh_flags & MESH_FLAGS_AE_A5_A6)
  3538. - return -1;
  3539. -- if (meshdr->flags & MESH_FLAGS_AE_A4)
  3540. -+ if (mesh_flags & MESH_FLAGS_AE_A4)
  3541. - skb_copy_bits(skb, hdrlen +
  3542. - offsetof(struct ieee80211s_hdr, eaddr1),
  3543. -- src, ETH_ALEN);
  3544. -- hdrlen += ieee80211_get_mesh_hdrlen(meshdr);
  3545. -+ tmp.h_source, ETH_ALEN);
  3546. -+ hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags);
  3547. - }
  3548. - break;
  3549. - case cpu_to_le16(0):
  3550. -@@ -498,33 +498,33 @@ int ieee80211_data_to_8023(struct sk_buf
  3551. - break;
  3552. - }
  3553. -
  3554. -- if (!pskb_may_pull(skb, hdrlen + 8))
  3555. -- return -1;
  3556. --
  3557. -- payload = skb->data + hdrlen;
  3558. -- ethertype = (payload[6] << 8) | payload[7];
  3559. -+ skb_copy_bits(skb, hdrlen, &payload, sizeof(payload));
  3560. -+ tmp.h_proto = payload.proto;
  3561. -
  3562. -- if (likely((ether_addr_equal(payload, rfc1042_header) &&
  3563. -- ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) ||
  3564. -- ether_addr_equal(payload, bridge_tunnel_header))) {
  3565. -+ if (likely((ether_addr_equal(payload.hdr, rfc1042_header) &&
  3566. -+ tmp.h_proto != htons(ETH_P_AARP) &&
  3567. -+ tmp.h_proto != htons(ETH_P_IPX)) ||
  3568. -+ ether_addr_equal(payload.hdr, bridge_tunnel_header)))
  3569. - /* remove RFC1042 or Bridge-Tunnel encapsulation and
  3570. - * replace EtherType */
  3571. -- skb_pull(skb, hdrlen + 6);
  3572. -- memcpy(skb_push(skb, ETH_ALEN), src, ETH_ALEN);
  3573. -- memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN);
  3574. -- } else {
  3575. -- struct ethhdr *ehdr;
  3576. -- __be16 len;
  3577. -+ hdrlen += ETH_ALEN + 2;
  3578. -+ else
  3579. -+ tmp.h_proto = htons(skb->len);
  3580. -
  3581. -- skb_pull(skb, hdrlen);
  3582. -- len = htons(skb->len);
  3583. -+ pskb_pull(skb, hdrlen);
  3584. -+
  3585. -+ if (!ehdr)
  3586. - ehdr = (struct ethhdr *) skb_push(skb, sizeof(struct ethhdr));
  3587. -- memcpy(ehdr->h_dest, dst, ETH_ALEN);
  3588. -- memcpy(ehdr->h_source, src, ETH_ALEN);
  3589. -- ehdr->h_proto = len;
  3590. -- }
  3591. -+ memcpy(ehdr, &tmp, sizeof(tmp));
  3592. -+
  3593. - return 0;
  3594. - }
  3595. -+
  3596. -+int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
  3597. -+ enum nl80211_iftype iftype)
  3598. -+{
  3599. -+ return __ieee80211_data_to_8023(skb, NULL, addr, iftype);
  3600. -+}
  3601. - EXPORT_SYMBOL(ieee80211_data_to_8023);
  3602. -
  3603. - int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr,
  3604. diff --git a/package/kernel/mac80211/patches/320-cfg80211-add-support-for-non-linear-skbs-in-ieee8021.patch b/package/kernel/mac80211/patches/320-cfg80211-add-support-for-non-linear-skbs-in-ieee8021.patch
  3605. deleted file mode 100644
  3606. index 2eeed22..0000000
  3607. --- a/package/kernel/mac80211/patches/320-cfg80211-add-support-for-non-linear-skbs-in-ieee8021.patch
  3608. +++ /dev/null
  3609. @@ -1,159 +0,0 @@
  3610. -From: Felix Fietkau <nbd@openwrt.org>
  3611. -Date: Tue, 2 Feb 2016 14:39:10 +0100
  3612. -Subject: [PATCH] cfg80211: add support for non-linear skbs in
  3613. - ieee80211_amsdu_to_8023s
  3614. -
  3615. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  3616. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  3617. ----
  3618. -
  3619. ---- a/net/wireless/util.c
  3620. -+++ b/net/wireless/util.c
  3621. -@@ -644,73 +644,75 @@ int ieee80211_data_from_8023(struct sk_b
  3622. - }
  3623. - EXPORT_SYMBOL(ieee80211_data_from_8023);
  3624. -
  3625. -+static struct sk_buff *
  3626. -+__ieee80211_amsdu_copy(struct sk_buff *skb, unsigned int hlen,
  3627. -+ int offset, int len)
  3628. -+{
  3629. -+ struct sk_buff *frame;
  3630. -+
  3631. -+ if (skb->len - offset < len)
  3632. -+ return NULL;
  3633. -+
  3634. -+ /*
  3635. -+ * Allocate and reserve two bytes more for payload
  3636. -+ * alignment since sizeof(struct ethhdr) is 14.
  3637. -+ */
  3638. -+ frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + len);
  3639. -+
  3640. -+ skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2);
  3641. -+ skb_copy_bits(skb, offset, skb_put(frame, len), len);
  3642. -+
  3643. -+ return frame;
  3644. -+}
  3645. -
  3646. - void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
  3647. - const u8 *addr, enum nl80211_iftype iftype,
  3648. - const unsigned int extra_headroom,
  3649. - bool has_80211_header)
  3650. - {
  3651. -+ unsigned int hlen = ALIGN(extra_headroom, 4);
  3652. - struct sk_buff *frame = NULL;
  3653. - u16 ethertype;
  3654. - u8 *payload;
  3655. -- const struct ethhdr *eth;
  3656. -- int remaining, err;
  3657. -- u8 dst[ETH_ALEN], src[ETH_ALEN];
  3658. --
  3659. -- if (skb_linearize(skb))
  3660. -- goto out;
  3661. -+ int offset = 0, remaining, err;
  3662. -+ struct ethhdr eth;
  3663. -+ bool reuse_skb = true;
  3664. -+ bool last = false;
  3665. -
  3666. - if (has_80211_header) {
  3667. -- err = ieee80211_data_to_8023(skb, addr, iftype);
  3668. -+ err = __ieee80211_data_to_8023(skb, &eth, addr, iftype);
  3669. - if (err)
  3670. - goto out;
  3671. --
  3672. -- /* skip the wrapping header */
  3673. -- eth = (struct ethhdr *) skb_pull(skb, sizeof(struct ethhdr));
  3674. -- if (!eth)
  3675. -- goto out;
  3676. -- } else {
  3677. -- eth = (struct ethhdr *) skb->data;
  3678. - }
  3679. -
  3680. -- while (skb != frame) {
  3681. -+ while (!last) {
  3682. -+ unsigned int subframe_len;
  3683. -+ int len;
  3684. - u8 padding;
  3685. -- __be16 len = eth->h_proto;
  3686. -- unsigned int subframe_len = sizeof(struct ethhdr) + ntohs(len);
  3687. --
  3688. -- remaining = skb->len;
  3689. -- memcpy(dst, eth->h_dest, ETH_ALEN);
  3690. -- memcpy(src, eth->h_source, ETH_ALEN);
  3691. -
  3692. -+ skb_copy_bits(skb, offset, &eth, sizeof(eth));
  3693. -+ len = ntohs(eth.h_proto);
  3694. -+ subframe_len = sizeof(struct ethhdr) + len;
  3695. - padding = (4 - subframe_len) & 0x3;
  3696. -+
  3697. - /* the last MSDU has no padding */
  3698. -+ remaining = skb->len - offset;
  3699. - if (subframe_len > remaining)
  3700. - goto purge;
  3701. -
  3702. -- skb_pull(skb, sizeof(struct ethhdr));
  3703. -+ offset += sizeof(struct ethhdr);
  3704. - /* reuse skb for the last subframe */
  3705. -- if (remaining <= subframe_len + padding)
  3706. -+ last = remaining <= subframe_len + padding;
  3707. -+ if (!skb_is_nonlinear(skb) && last) {
  3708. -+ skb_pull(skb, offset);
  3709. - frame = skb;
  3710. -- else {
  3711. -- unsigned int hlen = ALIGN(extra_headroom, 4);
  3712. -- /*
  3713. -- * Allocate and reserve two bytes more for payload
  3714. -- * alignment since sizeof(struct ethhdr) is 14.
  3715. -- */
  3716. -- frame = dev_alloc_skb(hlen + subframe_len + 2);
  3717. -+ reuse_skb = true;
  3718. -+ } else {
  3719. -+ frame = __ieee80211_amsdu_copy(skb, hlen, offset, len);
  3720. - if (!frame)
  3721. - goto purge;
  3722. -
  3723. -- skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2);
  3724. -- memcpy(skb_put(frame, ntohs(len)), skb->data,
  3725. -- ntohs(len));
  3726. --
  3727. -- eth = (struct ethhdr *)skb_pull(skb, ntohs(len) +
  3728. -- padding);
  3729. -- if (!eth) {
  3730. -- dev_kfree_skb(frame);
  3731. -- goto purge;
  3732. -- }
  3733. -+ offset += len + padding;
  3734. - }
  3735. -
  3736. - skb_reset_network_header(frame);
  3737. -@@ -719,24 +721,20 @@ void ieee80211_amsdu_to_8023s(struct sk_
  3738. -
  3739. - payload = frame->data;
  3740. - ethertype = (payload[6] << 8) | payload[7];
  3741. --
  3742. - if (likely((ether_addr_equal(payload, rfc1042_header) &&
  3743. - ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) ||
  3744. - ether_addr_equal(payload, bridge_tunnel_header))) {
  3745. -- /* remove RFC1042 or Bridge-Tunnel
  3746. -- * encapsulation and replace EtherType */
  3747. -- skb_pull(frame, 6);
  3748. -- memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN);
  3749. -- memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN);
  3750. -- } else {
  3751. -- memcpy(skb_push(frame, sizeof(__be16)), &len,
  3752. -- sizeof(__be16));
  3753. -- memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN);
  3754. -- memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN);
  3755. -+ eth.h_proto = htons(ethertype);
  3756. -+ skb_pull(frame, ETH_ALEN + 2);
  3757. - }
  3758. -+
  3759. -+ memcpy(skb_push(frame, sizeof(eth)), &eth, sizeof(eth));
  3760. - __skb_queue_tail(list, frame);
  3761. - }
  3762. -
  3763. -+ if (!reuse_skb)
  3764. -+ dev_kfree_skb(skb);
  3765. -+
  3766. - return;
  3767. -
  3768. - purge:
  3769. diff --git a/package/kernel/mac80211/patches/321-mac80211-Parse-legacy-and-HT-rate-in-injected-frames.patch b/package/kernel/mac80211/patches/321-mac80211-Parse-legacy-and-HT-rate-in-injected-frames.patch
  3770. deleted file mode 100644
  3771. index c4155a1..0000000
  3772. --- a/package/kernel/mac80211/patches/321-mac80211-Parse-legacy-and-HT-rate-in-injected-frames.patch
  3773. +++ /dev/null
  3774. @@ -1,155 +0,0 @@
  3775. -From: Sven Eckelmann <sven@narfation.org>
  3776. -Date: Tue, 26 Jan 2016 17:11:13 +0100
  3777. -Subject: [PATCH] mac80211: Parse legacy and HT rate in injected frames
  3778. -
  3779. -Drivers/devices without their own rate control algorithm can get the
  3780. -information what rates they should use from either the radiotap header of
  3781. -injected frames or from the rate control algorithm. But the parsing of the
  3782. -legacy rate information from the radiotap header was removed in commit
  3783. -e6a9854b05c1 ("mac80211/drivers: rewrite the rate control API").
  3784. -
  3785. -The removal of this feature heavily reduced the usefulness of frame
  3786. -injection when wanting to simulate specific transmission behavior. Having
  3787. -rate parsing together with MCS rates and retry support allows a fine
  3788. -grained selection of the tx behavior of injected frames for these kind of
  3789. -tests.
  3790. -
  3791. -Signed-off-by: Sven Eckelmann <sven@narfation.org>
  3792. -Cc: Simon Wunderlich <sw@simonwunderlich.de>
  3793. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  3794. ----
  3795. -
  3796. ---- a/include/net/mac80211.h
  3797. -+++ b/include/net/mac80211.h
  3798. -@@ -708,12 +708,14 @@ enum mac80211_tx_info_flags {
  3799. - * protocol frame (e.g. EAP)
  3800. - * @IEEE80211_TX_CTRL_PS_RESPONSE: This frame is a response to a poll
  3801. - * frame (PS-Poll or uAPSD).
  3802. -+ * @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information
  3803. - *
  3804. - * These flags are used in tx_info->control.flags.
  3805. - */
  3806. - enum mac80211_tx_control_flags {
  3807. - IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0),
  3808. - IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1),
  3809. -+ IEEE80211_TX_CTRL_RATE_INJECT = BIT(2),
  3810. - };
  3811. -
  3812. - /*
  3813. ---- a/net/mac80211/tx.c
  3814. -+++ b/net/mac80211/tx.c
  3815. -@@ -710,6 +710,10 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021
  3816. -
  3817. - info->control.short_preamble = txrc.short_preamble;
  3818. -
  3819. -+ /* don't ask rate control when rate already injected via radiotap */
  3820. -+ if (info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT)
  3821. -+ return TX_CONTINUE;
  3822. -+
  3823. - if (tx->sta)
  3824. - assoc = test_sta_flag(tx->sta, WLAN_STA_ASSOC);
  3825. -
  3826. -@@ -1665,15 +1669,24 @@ void ieee80211_xmit(struct ieee80211_sub
  3827. - ieee80211_tx(sdata, sta, skb, false);
  3828. - }
  3829. -
  3830. --static bool ieee80211_parse_tx_radiotap(struct sk_buff *skb)
  3831. -+static bool ieee80211_parse_tx_radiotap(struct ieee80211_local *local,
  3832. -+ struct sk_buff *skb)
  3833. - {
  3834. - struct ieee80211_radiotap_iterator iterator;
  3835. - struct ieee80211_radiotap_header *rthdr =
  3836. - (struct ieee80211_radiotap_header *) skb->data;
  3837. - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  3838. -+ struct ieee80211_supported_band *sband =
  3839. -+ local->hw.wiphy->bands[info->band];
  3840. - int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len,
  3841. - NULL);
  3842. - u16 txflags;
  3843. -+ u16 rate = 0;
  3844. -+ bool rate_found = false;
  3845. -+ u8 rate_retries = 0;
  3846. -+ u16 rate_flags = 0;
  3847. -+ u8 mcs_known, mcs_flags;
  3848. -+ int i;
  3849. -
  3850. - info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
  3851. - IEEE80211_TX_CTL_DONTFRAG;
  3852. -@@ -1724,6 +1737,35 @@ static bool ieee80211_parse_tx_radiotap(
  3853. - info->flags |= IEEE80211_TX_CTL_NO_ACK;
  3854. - break;
  3855. -
  3856. -+ case IEEE80211_RADIOTAP_RATE:
  3857. -+ rate = *iterator.this_arg;
  3858. -+ rate_flags = 0;
  3859. -+ rate_found = true;
  3860. -+ break;
  3861. -+
  3862. -+ case IEEE80211_RADIOTAP_DATA_RETRIES:
  3863. -+ rate_retries = *iterator.this_arg;
  3864. -+ break;
  3865. -+
  3866. -+ case IEEE80211_RADIOTAP_MCS:
  3867. -+ mcs_known = iterator.this_arg[0];
  3868. -+ mcs_flags = iterator.this_arg[1];
  3869. -+ if (!(mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_MCS))
  3870. -+ break;
  3871. -+
  3872. -+ rate_found = true;
  3873. -+ rate = iterator.this_arg[2];
  3874. -+ rate_flags = IEEE80211_TX_RC_MCS;
  3875. -+
  3876. -+ if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_GI &&
  3877. -+ mcs_flags & IEEE80211_RADIOTAP_MCS_SGI)
  3878. -+ rate_flags |= IEEE80211_TX_RC_SHORT_GI;
  3879. -+
  3880. -+ if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_BW &&
  3881. -+ mcs_flags & IEEE80211_RADIOTAP_MCS_BW_40)
  3882. -+ rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
  3883. -+ break;
  3884. -+
  3885. - /*
  3886. - * Please update the file
  3887. - * Documentation/networking/mac80211-injection.txt
  3888. -@@ -1738,6 +1780,32 @@ static bool ieee80211_parse_tx_radiotap(
  3889. - if (ret != -ENOENT) /* ie, if we didn't simply run out of fields */
  3890. - return false;
  3891. -
  3892. -+ if (rate_found) {
  3893. -+ info->control.flags |= IEEE80211_TX_CTRL_RATE_INJECT;
  3894. -+
  3895. -+ for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
  3896. -+ info->control.rates[i].idx = -1;
  3897. -+ info->control.rates[i].flags = 0;
  3898. -+ info->control.rates[i].count = 0;
  3899. -+ }
  3900. -+
  3901. -+ if (rate_flags & IEEE80211_TX_RC_MCS) {
  3902. -+ info->control.rates[0].idx = rate;
  3903. -+ } else {
  3904. -+ for (i = 0; i < sband->n_bitrates; i++) {
  3905. -+ if (rate * 5 != sband->bitrates[i].bitrate)
  3906. -+ continue;
  3907. -+
  3908. -+ info->control.rates[0].idx = i;
  3909. -+ break;
  3910. -+ }
  3911. -+ }
  3912. -+
  3913. -+ info->control.rates[0].flags = rate_flags;
  3914. -+ info->control.rates[0].count = min_t(u8, rate_retries + 1,
  3915. -+ local->hw.max_rate_tries);
  3916. -+ }
  3917. -+
  3918. - /*
  3919. - * remove the radiotap header
  3920. - * iterator->_max_length was sanity-checked against
  3921. -@@ -1819,7 +1887,7 @@ netdev_tx_t ieee80211_monitor_start_xmit
  3922. - IEEE80211_TX_CTL_INJECTED;
  3923. -
  3924. - /* process and remove the injection radiotap header */
  3925. -- if (!ieee80211_parse_tx_radiotap(skb))
  3926. -+ if (!ieee80211_parse_tx_radiotap(local, skb))
  3927. - goto fail;
  3928. -
  3929. - rcu_read_lock();
  3930. diff --git a/package/kernel/mac80211/patches/322-mac80211-add-A-MSDU-tx-support.patch b/package/kernel/mac80211/patches/322-mac80211-add-A-MSDU-tx-support.patch
  3931. deleted file mode 100644
  3932. index e7bfb9c..0000000
  3933. --- a/package/kernel/mac80211/patches/322-mac80211-add-A-MSDU-tx-support.patch
  3934. +++ /dev/null
  3935. @@ -1,317 +0,0 @@
  3936. -From: Felix Fietkau <nbd@openwrt.org>
  3937. -Date: Fri, 5 Feb 2016 01:38:51 +0100
  3938. -Subject: [PATCH] mac80211: add A-MSDU tx support
  3939. -
  3940. -Requires software tx queueing support. frag_list support (for zero-copy)
  3941. -is optional.
  3942. -
  3943. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  3944. ----
  3945. -
  3946. ---- a/include/net/mac80211.h
  3947. -+++ b/include/net/mac80211.h
  3948. -@@ -709,6 +709,7 @@ enum mac80211_tx_info_flags {
  3949. - * @IEEE80211_TX_CTRL_PS_RESPONSE: This frame is a response to a poll
  3950. - * frame (PS-Poll or uAPSD).
  3951. - * @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information
  3952. -+ * @IEEE80211_TX_CTRL_AMSDU: This frame is an A-MSDU frame
  3953. - *
  3954. - * These flags are used in tx_info->control.flags.
  3955. - */
  3956. -@@ -716,6 +717,7 @@ enum mac80211_tx_control_flags {
  3957. - IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0),
  3958. - IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1),
  3959. - IEEE80211_TX_CTRL_RATE_INJECT = BIT(2),
  3960. -+ IEEE80211_TX_CTRL_AMSDU = BIT(3),
  3961. - };
  3962. -
  3963. - /*
  3964. -@@ -1728,6 +1730,7 @@ struct ieee80211_sta_rates {
  3965. - * size is min(max_amsdu_len, 7935) bytes.
  3966. - * Both additional HT limits must be enforced by the low level driver.
  3967. - * This is defined by the spec (IEEE 802.11-2012 section 8.3.2.2 NOTE 2).
  3968. -+ * @max_rc_amsdu_len: Maximum A-MSDU size in bytes recommended by rate control.
  3969. - * @txq: per-TID data TX queues (if driver uses the TXQ abstraction)
  3970. - */
  3971. - struct ieee80211_sta {
  3972. -@@ -1748,6 +1751,7 @@ struct ieee80211_sta {
  3973. - bool mfp;
  3974. - u8 max_amsdu_subframes;
  3975. - u16 max_amsdu_len;
  3976. -+ u16 max_rc_amsdu_len;
  3977. -
  3978. - struct ieee80211_txq *txq[IEEE80211_NUM_TIDS];
  3979. -
  3980. -@@ -1961,6 +1965,15 @@ struct ieee80211_txq {
  3981. - * order and does not need to manage its own reorder buffer or BA session
  3982. - * timeout.
  3983. - *
  3984. -+ * @IEEE80211_HW_TX_AMSDU: Hardware (or driver) supports software aggregated
  3985. -+ * A-MSDU frames. Requires software tx queueing and fast-xmit support.
  3986. -+ * When not using minstrel/minstrel_ht rate control, the driver should
  3987. -+ * limit the maximum A-MSDU size based on the current tx rate by setting
  3988. -+ * max_rc_amsdu_len in struct ieee80211_sta.
  3989. -+ *
  3990. -+ * @IEEE80211_HW_TX_FRAG_LIST: Hardware (or driver) supports sending frag_list
  3991. -+ * skbs, needed for zero-copy software A-MSDU.
  3992. -+ *
  3993. - * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
  3994. - */
  3995. - enum ieee80211_hw_flags {
  3996. -@@ -1998,6 +2011,8 @@ enum ieee80211_hw_flags {
  3997. - IEEE80211_HW_BEACON_TX_STATUS,
  3998. - IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR,
  3999. - IEEE80211_HW_SUPPORTS_REORDERING_BUFFER,
  4000. -+ IEEE80211_HW_TX_AMSDU,
  4001. -+ IEEE80211_HW_TX_FRAG_LIST,
  4002. -
  4003. - /* keep last, obviously */
  4004. - NUM_IEEE80211_HW_FLAGS
  4005. -@@ -2070,6 +2085,9 @@ enum ieee80211_hw_flags {
  4006. - * size is smaller (an example is LinkSys WRT120N with FW v1.0.07
  4007. - * build 002 Jun 18 2012).
  4008. - *
  4009. -+ * @max_tx_fragments: maximum number of tx buffers per (A)-MSDU, sum
  4010. -+ * of 1 + skb_shinfo(skb)->nr_frags for each skb in the frag_list.
  4011. -+ *
  4012. - * @offchannel_tx_hw_queue: HW queue ID to use for offchannel TX
  4013. - * (if %IEEE80211_HW_QUEUE_CONTROL is set)
  4014. - *
  4015. -@@ -2124,6 +2142,7 @@ struct ieee80211_hw {
  4016. - u8 max_rate_tries;
  4017. - u8 max_rx_aggregation_subframes;
  4018. - u8 max_tx_aggregation_subframes;
  4019. -+ u8 max_tx_fragments;
  4020. - u8 offchannel_tx_hw_queue;
  4021. - u8 radiotap_mcs_details;
  4022. - u16 radiotap_vht_details;
  4023. ---- a/net/mac80211/agg-tx.c
  4024. -+++ b/net/mac80211/agg-tx.c
  4025. -@@ -935,6 +935,7 @@ void ieee80211_process_addba_resp(struct
  4026. - size_t len)
  4027. - {
  4028. - struct tid_ampdu_tx *tid_tx;
  4029. -+ struct ieee80211_txq *txq;
  4030. - u16 capab, tid;
  4031. - u8 buf_size;
  4032. - bool amsdu;
  4033. -@@ -945,6 +946,10 @@ void ieee80211_process_addba_resp(struct
  4034. - buf_size = (capab & IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK) >> 6;
  4035. - buf_size = min(buf_size, local->hw.max_tx_aggregation_subframes);
  4036. -
  4037. -+ txq = sta->sta.txq[tid];
  4038. -+ if (!amsdu && txq)
  4039. -+ set_bit(IEEE80211_TXQ_NO_AMSDU, &to_txq_info(txq)->flags);
  4040. -+
  4041. - mutex_lock(&sta->ampdu_mlme.mtx);
  4042. -
  4043. - tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
  4044. ---- a/net/mac80211/debugfs.c
  4045. -+++ b/net/mac80211/debugfs.c
  4046. -@@ -127,6 +127,8 @@ static const char *hw_flag_names[NUM_IEE
  4047. - FLAG(BEACON_TX_STATUS),
  4048. - FLAG(NEEDS_UNIQUE_STA_ADDR),
  4049. - FLAG(SUPPORTS_REORDERING_BUFFER),
  4050. -+ FLAG(TX_AMSDU),
  4051. -+ FLAG(TX_FRAG_LIST),
  4052. -
  4053. - /* keep last for the build bug below */
  4054. - (void *)0x1
  4055. ---- a/net/mac80211/ieee80211_i.h
  4056. -+++ b/net/mac80211/ieee80211_i.h
  4057. -@@ -799,6 +799,7 @@ struct mac80211_qos_map {
  4058. - enum txq_info_flags {
  4059. - IEEE80211_TXQ_STOP,
  4060. - IEEE80211_TXQ_AMPDU,
  4061. -+ IEEE80211_TXQ_NO_AMSDU,
  4062. - };
  4063. -
  4064. - struct txq_info {
  4065. ---- a/net/mac80211/tx.c
  4066. -+++ b/net/mac80211/tx.c
  4067. -@@ -1318,6 +1318,10 @@ struct sk_buff *ieee80211_tx_dequeue(str
  4068. - out:
  4069. - spin_unlock_bh(&txqi->queue.lock);
  4070. -
  4071. -+ if (skb && skb_has_frag_list(skb) &&
  4072. -+ !ieee80211_hw_check(&local->hw, TX_FRAG_LIST))
  4073. -+ skb_linearize(skb);
  4074. -+
  4075. - return skb;
  4076. - }
  4077. - EXPORT_SYMBOL(ieee80211_tx_dequeue);
  4078. -@@ -2757,6 +2761,163 @@ void ieee80211_clear_fast_xmit(struct st
  4079. - kfree_rcu(fast_tx, rcu_head);
  4080. - }
  4081. -
  4082. -+static bool ieee80211_amsdu_realloc_pad(struct ieee80211_local *local,
  4083. -+ struct sk_buff *skb, int headroom,
  4084. -+ int *subframe_len)
  4085. -+{
  4086. -+ int amsdu_len = *subframe_len + sizeof(struct ethhdr);
  4087. -+ int padding = (4 - amsdu_len) & 3;
  4088. -+
  4089. -+ if (skb_headroom(skb) < headroom || skb_tailroom(skb) < padding) {
  4090. -+ I802_DEBUG_INC(local->tx_expand_skb_head);
  4091. -+
  4092. -+ if (pskb_expand_head(skb, headroom, padding, GFP_ATOMIC)) {
  4093. -+ wiphy_debug(local->hw.wiphy,
  4094. -+ "failed to reallocate TX buffer\n");
  4095. -+ return false;
  4096. -+ }
  4097. -+ }
  4098. -+
  4099. -+ if (padding) {
  4100. -+ *subframe_len += padding;
  4101. -+ memset(skb_put(skb, padding), 0, padding);
  4102. -+ }
  4103. -+
  4104. -+ return true;
  4105. -+}
  4106. -+
  4107. -+static bool ieee80211_amsdu_prepare_head(struct ieee80211_sub_if_data *sdata,
  4108. -+ struct ieee80211_fast_tx *fast_tx,
  4109. -+ struct sk_buff *skb)
  4110. -+{
  4111. -+ struct ieee80211_local *local = sdata->local;
  4112. -+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  4113. -+ struct ieee80211_hdr *hdr;
  4114. -+ struct ethhdr amsdu_hdr;
  4115. -+ int hdr_len = fast_tx->hdr_len - sizeof(rfc1042_header);
  4116. -+ int subframe_len = skb->len - hdr_len;
  4117. -+ void *data;
  4118. -+ u8 *qc;
  4119. -+
  4120. -+ if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)
  4121. -+ return false;
  4122. -+
  4123. -+ if (info->control.flags & IEEE80211_TX_CTRL_AMSDU)
  4124. -+ return true;
  4125. -+
  4126. -+ if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(amsdu_hdr),
  4127. -+ &subframe_len))
  4128. -+ return false;
  4129. -+
  4130. -+ amsdu_hdr.h_proto = cpu_to_be16(subframe_len);
  4131. -+ memcpy(amsdu_hdr.h_source, skb->data + fast_tx->sa_offs, ETH_ALEN);
  4132. -+ memcpy(amsdu_hdr.h_dest, skb->data + fast_tx->da_offs, ETH_ALEN);
  4133. -+
  4134. -+ data = skb_push(skb, sizeof(amsdu_hdr));
  4135. -+ memmove(data, data + sizeof(amsdu_hdr), hdr_len);
  4136. -+ memcpy(data + hdr_len, &amsdu_hdr, sizeof(amsdu_hdr));
  4137. -+
  4138. -+ hdr = data;
  4139. -+ qc = ieee80211_get_qos_ctl(hdr);
  4140. -+ *qc |= IEEE80211_QOS_CTL_A_MSDU_PRESENT;
  4141. -+
  4142. -+ info->control.flags |= IEEE80211_TX_CTRL_AMSDU;
  4143. -+
  4144. -+ return true;
  4145. -+}
  4146. -+
  4147. -+static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata,
  4148. -+ struct sta_info *sta,
  4149. -+ struct ieee80211_fast_tx *fast_tx,
  4150. -+ struct sk_buff *skb)
  4151. -+{
  4152. -+ struct ieee80211_local *local = sdata->local;
  4153. -+ u8 tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
  4154. -+ struct ieee80211_txq *txq = sta->sta.txq[tid];
  4155. -+ struct txq_info *txqi;
  4156. -+ struct sk_buff **frag_tail, *head;
  4157. -+ int subframe_len = skb->len - ETH_ALEN;
  4158. -+ u8 max_subframes = sta->sta.max_amsdu_subframes;
  4159. -+ int max_frags = local->hw.max_tx_fragments;
  4160. -+ int max_amsdu_len = sta->sta.max_amsdu_len;
  4161. -+ __be16 len;
  4162. -+ void *data;
  4163. -+ bool ret = false;
  4164. -+ int n = 1, nfrags;
  4165. -+
  4166. -+ if (!ieee80211_hw_check(&local->hw, TX_AMSDU))
  4167. -+ return false;
  4168. -+
  4169. -+ if (!txq)
  4170. -+ return false;
  4171. -+
  4172. -+ txqi = to_txq_info(txq);
  4173. -+ if (test_bit(IEEE80211_TXQ_NO_AMSDU, &txqi->flags))
  4174. -+ return false;
  4175. -+
  4176. -+ if (sta->sta.max_rc_amsdu_len)
  4177. -+ max_amsdu_len = min_t(int, max_amsdu_len,
  4178. -+ sta->sta.max_rc_amsdu_len);
  4179. -+
  4180. -+ spin_lock_bh(&txqi->queue.lock);
  4181. -+
  4182. -+ head = skb_peek_tail(&txqi->queue);
  4183. -+ if (!head)
  4184. -+ goto out;
  4185. -+
  4186. -+ if (skb->len + head->len > max_amsdu_len)
  4187. -+ goto out;
  4188. -+
  4189. -+ /*
  4190. -+ * HT A-MPDU limits maximum MPDU size to 4095 bytes. Since aggregation
  4191. -+ * sessions are started/stopped without txq flush, use the limit here
  4192. -+ * to avoid having to de-aggregate later.
  4193. -+ */
  4194. -+ if (skb->len + head->len > 4095 &&
  4195. -+ !sta->sta.vht_cap.vht_supported)
  4196. -+ goto out;
  4197. -+
  4198. -+ if (!ieee80211_amsdu_prepare_head(sdata, fast_tx, head))
  4199. -+ goto out;
  4200. -+
  4201. -+ nfrags = 1 + skb_shinfo(skb)->nr_frags;
  4202. -+ nfrags += 1 + skb_shinfo(head)->nr_frags;
  4203. -+ frag_tail = &skb_shinfo(head)->frag_list;
  4204. -+ while (*frag_tail) {
  4205. -+ nfrags += 1 + skb_shinfo(*frag_tail)->nr_frags;
  4206. -+ frag_tail = &(*frag_tail)->next;
  4207. -+ n++;
  4208. -+ }
  4209. -+
  4210. -+ if (max_subframes && n > max_subframes)
  4211. -+ goto out;
  4212. -+
  4213. -+ if (max_frags && nfrags > max_frags)
  4214. -+ goto out;
  4215. -+
  4216. -+ if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(rfc1042_header) + 2,
  4217. -+ &subframe_len))
  4218. -+ return false;
  4219. -+
  4220. -+ ret = true;
  4221. -+ data = skb_push(skb, ETH_ALEN + 2);
  4222. -+ memmove(data, data + ETH_ALEN + 2, 2 * ETH_ALEN);
  4223. -+
  4224. -+ data += 2 * ETH_ALEN;
  4225. -+ len = cpu_to_be16(subframe_len);
  4226. -+ memcpy(data, &len, 2);
  4227. -+ memcpy(data + 2, rfc1042_header, sizeof(rfc1042_header));
  4228. -+
  4229. -+ head->len += skb->len;
  4230. -+ head->data_len += skb->len;
  4231. -+ *frag_tail = skb;
  4232. -+
  4233. -+out:
  4234. -+ spin_unlock_bh(&txqi->queue.lock);
  4235. -+
  4236. -+ return ret;
  4237. -+}
  4238. -+
  4239. - static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
  4240. - struct net_device *dev, struct sta_info *sta,
  4241. - struct ieee80211_fast_tx *fast_tx,
  4242. -@@ -2811,6 +2972,10 @@ static bool ieee80211_xmit_fast(struct i
  4243. -
  4244. - ieee80211_tx_stats(dev, skb->len + extra_head);
  4245. -
  4246. -+ if ((hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) &&
  4247. -+ ieee80211_amsdu_aggregate(sdata, sta, fast_tx, skb))
  4248. -+ return true;
  4249. -+
  4250. - /* will not be crypto-handled beyond what we do here, so use false
  4251. - * as the may-encrypt argument for the resize to not account for
  4252. - * more room than we already have in 'extra_head'
  4253. diff --git a/package/kernel/mac80211/patches/323-0000-brcmfmac-fix-setting-primary-channel-for-80-MHz-widt.patch b/package/kernel/mac80211/patches/323-0000-brcmfmac-fix-setting-primary-channel-for-80-MHz-widt.patch
  4254. deleted file mode 100644
  4255. index 9277b2c..0000000
  4256. --- a/package/kernel/mac80211/patches/323-0000-brcmfmac-fix-setting-primary-channel-for-80-MHz-widt.patch
  4257. +++ /dev/null
  4258. @@ -1,64 +0,0 @@
  4259. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4260. -Date: Wed, 20 Jan 2016 16:46:04 +0100
  4261. -Subject: [PATCH] brcmfmac: fix setting primary channel for 80 MHz width
  4262. -MIME-Version: 1.0
  4263. -Content-Type: text/plain; charset=UTF-8
  4264. -Content-Transfer-Encoding: 8bit
  4265. -
  4266. -First of all it changes the way we calculate primary channel offset. If
  4267. -we use e.g. 80 MHz channel with primary frequency 5180 MHz (which means
  4268. -center frequency is 5210 MHz) it makes sense to calculate primary offset
  4269. -as -30 MHz.
  4270. -Then it fixes values we compare primary_offset with. We were comparing
  4271. -offset in MHz against -2 or 2 which was resulting in picking a wrong
  4272. -primary channel.
  4273. -
  4274. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4275. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4276. ----
  4277. -
  4278. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  4279. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  4280. -@@ -247,7 +247,7 @@ static u16 chandef_to_chanspec(struct br
  4281. - brcmf_dbg(TRACE, "chandef: control %d center %d width %d\n",
  4282. - ch->chan->center_freq, ch->center_freq1, ch->width);
  4283. - ch_inf.chnum = ieee80211_frequency_to_channel(ch->center_freq1);
  4284. -- primary_offset = ch->center_freq1 - ch->chan->center_freq;
  4285. -+ primary_offset = ch->chan->center_freq - ch->center_freq1;
  4286. - switch (ch->width) {
  4287. - case NL80211_CHAN_WIDTH_20:
  4288. - case NL80211_CHAN_WIDTH_20_NOHT:
  4289. -@@ -256,24 +256,21 @@ static u16 chandef_to_chanspec(struct br
  4290. - break;
  4291. - case NL80211_CHAN_WIDTH_40:
  4292. - ch_inf.bw = BRCMU_CHAN_BW_40;
  4293. -- if (primary_offset < 0)
  4294. -+ if (primary_offset > 0)
  4295. - ch_inf.sb = BRCMU_CHAN_SB_U;
  4296. - else
  4297. - ch_inf.sb = BRCMU_CHAN_SB_L;
  4298. - break;
  4299. - case NL80211_CHAN_WIDTH_80:
  4300. - ch_inf.bw = BRCMU_CHAN_BW_80;
  4301. -- if (primary_offset < 0) {
  4302. -- if (primary_offset < -CH_10MHZ_APART)
  4303. -- ch_inf.sb = BRCMU_CHAN_SB_UU;
  4304. -- else
  4305. -- ch_inf.sb = BRCMU_CHAN_SB_UL;
  4306. -- } else {
  4307. -- if (primary_offset > CH_10MHZ_APART)
  4308. -- ch_inf.sb = BRCMU_CHAN_SB_LL;
  4309. -- else
  4310. -- ch_inf.sb = BRCMU_CHAN_SB_LU;
  4311. -- }
  4312. -+ if (primary_offset == -30)
  4313. -+ ch_inf.sb = BRCMU_CHAN_SB_LL;
  4314. -+ else if (primary_offset == -10)
  4315. -+ ch_inf.sb = BRCMU_CHAN_SB_LU;
  4316. -+ else if (primary_offset == 10)
  4317. -+ ch_inf.sb = BRCMU_CHAN_SB_UL;
  4318. -+ else
  4319. -+ ch_inf.sb = BRCMU_CHAN_SB_UU;
  4320. - break;
  4321. - case NL80211_CHAN_WIDTH_80P80:
  4322. - case NL80211_CHAN_WIDTH_160:
  4323. diff --git a/package/kernel/mac80211/patches/323-0001-brcmfmac-analyze-descriptors-of-current-component-on.patch b/package/kernel/mac80211/patches/323-0001-brcmfmac-analyze-descriptors-of-current-component-on.patch
  4324. deleted file mode 100644
  4325. index d7018da..0000000
  4326. --- a/package/kernel/mac80211/patches/323-0001-brcmfmac-analyze-descriptors-of-current-component-on.patch
  4327. +++ /dev/null
  4328. @@ -1,51 +0,0 @@
  4329. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4330. -Date: Tue, 26 Jan 2016 17:57:01 +0100
  4331. -Subject: [PATCH] brcmfmac: analyze descriptors of current component only
  4332. -MIME-Version: 1.0
  4333. -Content-Type: text/plain; charset=UTF-8
  4334. -Content-Transfer-Encoding: 8bit
  4335. -
  4336. -So far we were looking for address descriptors without a check for
  4337. -crossing current component border. In case of dealing with unsupported
  4338. -descriptor or descriptor missing at all the code would incorrectly get
  4339. -data from another component.
  4340. -
  4341. -Consider this binary-described component from BCM4366 EROM:
  4342. -4bf83b01 TAG==CI CID==0x83b
  4343. -20080201 TAG==CI PORTS==0+1 WRAPPERS==0+1
  4344. -18400035 TAG==ADDR SZ_SZD TYPE_SLAVE
  4345. -00050000
  4346. -18107085 TAG==ADDR SZ_4K TYPE_SWRAP
  4347. -
  4348. -Driver was assigning invalid base address to this core:
  4349. -brcmfmac: [6 ] core 0x83b:32 base 0x18109000 wrap 0x18107000
  4350. -which came from totally different component defined in EROM:
  4351. -43b36701 TAG==CI CID==0x367
  4352. -00000201 TAG==CI PORTS==0+1 WRAPPERS==0+0
  4353. -18109005 TAG==ADDR SZ_4K TYPE_SLAVE
  4354. -
  4355. -This change will also allow us to support components without wrapper
  4356. -address in the future.
  4357. -
  4358. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4359. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4360. ----
  4361. -
  4362. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  4363. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  4364. -@@ -803,7 +803,14 @@ static int brcmf_chip_dmp_get_regaddr(st
  4365. - *eromaddr -= 4;
  4366. - return -EFAULT;
  4367. - }
  4368. -- } while (desc != DMP_DESC_ADDRESS);
  4369. -+ } while (desc != DMP_DESC_ADDRESS &&
  4370. -+ desc != DMP_DESC_COMPONENT);
  4371. -+
  4372. -+ /* stop if we crossed current component border */
  4373. -+ if (desc == DMP_DESC_COMPONENT) {
  4374. -+ *eromaddr -= 4;
  4375. -+ return 0;
  4376. -+ }
  4377. -
  4378. - /* skip upper 32-bit address descriptor */
  4379. - if (val & DMP_DESC_ADDRSIZE_GT32)
  4380. diff --git a/package/kernel/mac80211/patches/323-0002-brcmfmac-allow-storing-PMU-core-without-wrapper-addr.patch b/package/kernel/mac80211/patches/323-0002-brcmfmac-allow-storing-PMU-core-without-wrapper-addr.patch
  4381. deleted file mode 100644
  4382. index 045ab49..0000000
  4383. --- a/package/kernel/mac80211/patches/323-0002-brcmfmac-allow-storing-PMU-core-without-wrapper-addr.patch
  4384. +++ /dev/null
  4385. @@ -1,28 +0,0 @@
  4386. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4387. -Date: Tue, 26 Jan 2016 17:57:02 +0100
  4388. -Subject: [PATCH] brcmfmac: allow storing PMU core without wrapper address
  4389. -MIME-Version: 1.0
  4390. -Content-Type: text/plain; charset=UTF-8
  4391. -Content-Transfer-Encoding: 8bit
  4392. -
  4393. -Separated PMU core can be found in new devices and should be used for
  4394. -accessing PMU registers (which were routed through ChipCommon so far).
  4395. -This core is one of exceptions that doesn't have or need wrapper address
  4396. -to be still safely accessible.
  4397. -
  4398. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4399. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4400. ----
  4401. -
  4402. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  4403. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  4404. -@@ -883,7 +883,8 @@ int brcmf_chip_dmp_erom_scan(struct brcm
  4405. - rev = (val & DMP_COMP_REVISION) >> DMP_COMP_REVISION_S;
  4406. -
  4407. - /* need core with ports */
  4408. -- if (nmw + nsw == 0)
  4409. -+ if (nmw + nsw == 0 &&
  4410. -+ id != BCMA_CORE_PMU)
  4411. - continue;
  4412. -
  4413. - /* try to obtain register address info */
  4414. diff --git a/package/kernel/mac80211/patches/323-0003-brcmfmac-read-extended-capabilities-of-ChipCommon-co.patch b/package/kernel/mac80211/patches/323-0003-brcmfmac-read-extended-capabilities-of-ChipCommon-co.patch
  4415. deleted file mode 100644
  4416. index 7b7ba4f..0000000
  4417. --- a/package/kernel/mac80211/patches/323-0003-brcmfmac-read-extended-capabilities-of-ChipCommon-co.patch
  4418. +++ /dev/null
  4419. @@ -1,43 +0,0 @@
  4420. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4421. -Date: Tue, 26 Jan 2016 17:57:03 +0100
  4422. -Subject: [PATCH] brcmfmac: read extended capabilities of ChipCommon core
  4423. -MIME-Version: 1.0
  4424. -Content-Type: text/plain; charset=UTF-8
  4425. -Content-Transfer-Encoding: 8bit
  4426. -
  4427. -This is an extra bitfield with info about some present hardware.
  4428. -
  4429. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4430. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4431. ----
  4432. -
  4433. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  4434. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  4435. -@@ -1025,6 +1025,9 @@ static int brcmf_chip_setup(struct brcmf
  4436. - /* get chipcommon capabilites */
  4437. - pub->cc_caps = chip->ops->read32(chip->ctx,
  4438. - CORE_CC_REG(base, capabilities));
  4439. -+ pub->cc_caps_ext = chip->ops->read32(chip->ctx,
  4440. -+ CORE_CC_REG(base,
  4441. -+ capabilities_ext));
  4442. -
  4443. - /* get pmu caps & rev */
  4444. - if (pub->cc_caps & CC_CAP_PMU) {
  4445. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  4446. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  4447. -@@ -27,6 +27,7 @@
  4448. - * @chip: chip identifier.
  4449. - * @chiprev: chip revision.
  4450. - * @cc_caps: chipcommon core capabilities.
  4451. -+ * @cc_caps_ext: chipcommon core extended capabilities.
  4452. - * @pmucaps: PMU capabilities.
  4453. - * @pmurev: PMU revision.
  4454. - * @rambase: RAM base address (only applicable for ARM CR4 chips).
  4455. -@@ -38,6 +39,7 @@ struct brcmf_chip {
  4456. - u32 chip;
  4457. - u32 chiprev;
  4458. - u32 cc_caps;
  4459. -+ u32 cc_caps_ext;
  4460. - u32 pmucaps;
  4461. - u32 pmurev;
  4462. - u32 rambase;
  4463. diff --git a/package/kernel/mac80211/patches/323-0004-brcmfmac-access-PMU-registers-using-standalone-PMU-c.patch b/package/kernel/mac80211/patches/323-0004-brcmfmac-access-PMU-registers-using-standalone-PMU-c.patch
  4464. deleted file mode 100644
  4465. index 2af6fd9..0000000
  4466. --- a/package/kernel/mac80211/patches/323-0004-brcmfmac-access-PMU-registers-using-standalone-PMU-c.patch
  4467. +++ /dev/null
  4468. @@ -1,148 +0,0 @@
  4469. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4470. -Date: Tue, 26 Jan 2016 17:57:04 +0100
  4471. -Subject: [PATCH] brcmfmac: access PMU registers using standalone PMU core if
  4472. - available
  4473. -MIME-Version: 1.0
  4474. -Content-Type: text/plain; charset=UTF-8
  4475. -Content-Transfer-Encoding: 8bit
  4476. -
  4477. -On recent Broadcom chipsets PMU is present as separated core and it
  4478. -can't be accessed using ChipCommon anymore as it fails with e.g.:
  4479. -[ 18.198412] Unhandled fault: imprecise external abort (0x1406) at 0xb6da200f
  4480. -
  4481. -Add a new helper function that will return a proper core that should be
  4482. -used for accessing PMU registers.
  4483. -
  4484. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4485. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4486. ----
  4487. -
  4488. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  4489. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  4490. -@@ -1014,6 +1014,7 @@ static int brcmf_chip_setup(struct brcmf
  4491. - {
  4492. - struct brcmf_chip *pub;
  4493. - struct brcmf_core_priv *cc;
  4494. -+ struct brcmf_core *pmu;
  4495. - u32 base;
  4496. - u32 val;
  4497. - int ret = 0;
  4498. -@@ -1030,9 +1031,10 @@ static int brcmf_chip_setup(struct brcmf
  4499. - capabilities_ext));
  4500. -
  4501. - /* get pmu caps & rev */
  4502. -+ pmu = brcmf_chip_get_pmu(pub); /* after reading cc_caps_ext */
  4503. - if (pub->cc_caps & CC_CAP_PMU) {
  4504. - val = chip->ops->read32(chip->ctx,
  4505. -- CORE_CC_REG(base, pmucapabilities));
  4506. -+ CORE_CC_REG(pmu->base, pmucapabilities));
  4507. - pub->pmurev = val & PCAP_REV_MASK;
  4508. - pub->pmucaps = val;
  4509. - }
  4510. -@@ -1131,6 +1133,23 @@ struct brcmf_core *brcmf_chip_get_chipco
  4511. - return &cc->pub;
  4512. - }
  4513. -
  4514. -+struct brcmf_core *brcmf_chip_get_pmu(struct brcmf_chip *pub)
  4515. -+{
  4516. -+ struct brcmf_core *cc = brcmf_chip_get_chipcommon(pub);
  4517. -+ struct brcmf_core *pmu;
  4518. -+
  4519. -+ /* See if there is separated PMU core available */
  4520. -+ if (cc->rev >= 35 &&
  4521. -+ pub->cc_caps_ext & BCMA_CC_CAP_EXT_AOB_PRESENT) {
  4522. -+ pmu = brcmf_chip_get_core(pub, BCMA_CORE_PMU);
  4523. -+ if (pmu)
  4524. -+ return pmu;
  4525. -+ }
  4526. -+
  4527. -+ /* Fallback to ChipCommon core for older hardware */
  4528. -+ return cc;
  4529. -+}
  4530. -+
  4531. - bool brcmf_chip_iscoreup(struct brcmf_core *pub)
  4532. - {
  4533. - struct brcmf_core_priv *core;
  4534. -@@ -1301,6 +1320,7 @@ bool brcmf_chip_sr_capable(struct brcmf_
  4535. - {
  4536. - u32 base, addr, reg, pmu_cc3_mask = ~0;
  4537. - struct brcmf_chip_priv *chip;
  4538. -+ struct brcmf_core *pmu = brcmf_chip_get_pmu(pub);
  4539. -
  4540. - brcmf_dbg(TRACE, "Enter\n");
  4541. -
  4542. -@@ -1320,9 +1340,9 @@ bool brcmf_chip_sr_capable(struct brcmf_
  4543. - case BRCM_CC_4335_CHIP_ID:
  4544. - case BRCM_CC_4339_CHIP_ID:
  4545. - /* read PMU chipcontrol register 3 */
  4546. -- addr = CORE_CC_REG(base, chipcontrol_addr);
  4547. -+ addr = CORE_CC_REG(pmu->base, chipcontrol_addr);
  4548. - chip->ops->write32(chip->ctx, addr, 3);
  4549. -- addr = CORE_CC_REG(base, chipcontrol_data);
  4550. -+ addr = CORE_CC_REG(pmu->base, chipcontrol_data);
  4551. - reg = chip->ops->read32(chip->ctx, addr);
  4552. - return (reg & pmu_cc3_mask) != 0;
  4553. - case BRCM_CC_43430_CHIP_ID:
  4554. -@@ -1330,12 +1350,12 @@ bool brcmf_chip_sr_capable(struct brcmf_
  4555. - reg = chip->ops->read32(chip->ctx, addr);
  4556. - return reg != 0;
  4557. - default:
  4558. -- addr = CORE_CC_REG(base, pmucapabilities_ext);
  4559. -+ addr = CORE_CC_REG(pmu->base, pmucapabilities_ext);
  4560. - reg = chip->ops->read32(chip->ctx, addr);
  4561. - if ((reg & PCAPEXT_SR_SUPPORTED_MASK) == 0)
  4562. - return false;
  4563. -
  4564. -- addr = CORE_CC_REG(base, retention_ctl);
  4565. -+ addr = CORE_CC_REG(pmu->base, retention_ctl);
  4566. - reg = chip->ops->read32(chip->ctx, addr);
  4567. - return (reg & (PMU_RCTL_MACPHY_DISABLE_MASK |
  4568. - PMU_RCTL_LOGIC_DISABLE_MASK)) == 0;
  4569. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  4570. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  4571. -@@ -85,6 +85,7 @@ struct brcmf_chip *brcmf_chip_attach(voi
  4572. - void brcmf_chip_detach(struct brcmf_chip *chip);
  4573. - struct brcmf_core *brcmf_chip_get_core(struct brcmf_chip *chip, u16 coreid);
  4574. - struct brcmf_core *brcmf_chip_get_chipcommon(struct brcmf_chip *chip);
  4575. -+struct brcmf_core *brcmf_chip_get_pmu(struct brcmf_chip *pub);
  4576. - bool brcmf_chip_iscoreup(struct brcmf_core *core);
  4577. - void brcmf_chip_coredisable(struct brcmf_core *core, u32 prereset, u32 reset);
  4578. - void brcmf_chip_resetcore(struct brcmf_core *core, u32 prereset, u32 reset,
  4579. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  4580. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  4581. -@@ -3615,7 +3615,6 @@ brcmf_sdio_drivestrengthinit(struct brcm
  4582. - const struct sdiod_drive_str *str_tab = NULL;
  4583. - u32 str_mask;
  4584. - u32 str_shift;
  4585. -- u32 base;
  4586. - u32 i;
  4587. - u32 drivestrength_sel = 0;
  4588. - u32 cc_data_temp;
  4589. -@@ -3658,14 +3657,15 @@ brcmf_sdio_drivestrengthinit(struct brcm
  4590. - }
  4591. -
  4592. - if (str_tab != NULL) {
  4593. -+ struct brcmf_core *pmu = brcmf_chip_get_pmu(ci);
  4594. -+
  4595. - for (i = 0; str_tab[i].strength != 0; i++) {
  4596. - if (drivestrength >= str_tab[i].strength) {
  4597. - drivestrength_sel = str_tab[i].sel;
  4598. - break;
  4599. - }
  4600. - }
  4601. -- base = brcmf_chip_get_chipcommon(ci)->base;
  4602. -- addr = CORE_CC_REG(base, chipcontrol_addr);
  4603. -+ addr = CORE_CC_REG(pmu->base, chipcontrol_addr);
  4604. - brcmf_sdiod_regwl(sdiodev, addr, 1, NULL);
  4605. - cc_data_temp = brcmf_sdiod_regrl(sdiodev, addr, NULL);
  4606. - cc_data_temp &= ~str_mask;
  4607. -@@ -3835,8 +3835,7 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
  4608. - goto fail;
  4609. -
  4610. - /* set PMUControl so a backplane reset does PMU state reload */
  4611. -- reg_addr = CORE_CC_REG(brcmf_chip_get_chipcommon(bus->ci)->base,
  4612. -- pmucontrol);
  4613. -+ reg_addr = CORE_CC_REG(brcmf_chip_get_pmu(bus->ci)->base, pmucontrol);
  4614. - reg_val = brcmf_sdiod_regrl(bus->sdiodev, reg_addr, &err);
  4615. - if (err)
  4616. - goto fail;
  4617. diff --git a/package/kernel/mac80211/patches/323-0005-brcmfmac-add-support-for-14e4-4365-PCI-ID-with-BCM43.patch b/package/kernel/mac80211/patches/323-0005-brcmfmac-add-support-for-14e4-4365-PCI-ID-with-BCM43.patch
  4618. deleted file mode 100644
  4619. index 35887fc..0000000
  4620. --- a/package/kernel/mac80211/patches/323-0005-brcmfmac-add-support-for-14e4-4365-PCI-ID-with-BCM43.patch
  4621. +++ /dev/null
  4622. @@ -1,38 +0,0 @@
  4623. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4624. -Date: Tue, 26 Jan 2016 17:57:05 +0100
  4625. -Subject: [PATCH] brcmfmac: add support for 14e4:4365 PCI ID with BCM4366
  4626. - chipset
  4627. -MIME-Version: 1.0
  4628. -Content-Type: text/plain; charset=UTF-8
  4629. -Content-Transfer-Encoding: 8bit
  4630. -
  4631. -On Broadcom ARM routers BCM4366 cards are available with 14e4:4365 ID.
  4632. -Unfortunately this ID was already used by Broadcom for cards with
  4633. -BCM43142, a totally different chipset requiring SoftMAC driver. To avoid
  4634. -a conflict between brcmfmac and bcma use more specific ID entry with
  4635. -subvendor and subdevice specified.
  4636. -
  4637. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4638. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4639. ----
  4640. -
  4641. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  4642. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  4643. -@@ -1951,6 +1951,9 @@ static const struct dev_pm_ops brcmf_pci
  4644. -
  4645. - #define BRCMF_PCIE_DEVICE(dev_id) { BRCM_PCIE_VENDOR_ID_BROADCOM, dev_id,\
  4646. - PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 }
  4647. -+#define BRCMF_PCIE_DEVICE_SUB(dev_id, subvend, subdev) { \
  4648. -+ BRCM_PCIE_VENDOR_ID_BROADCOM, dev_id,\
  4649. -+ subvend, subdev, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 }
  4650. -
  4651. - static struct pci_device_id brcmf_pcie_devid_table[] = {
  4652. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4350_DEVICE_ID),
  4653. -@@ -1966,6 +1969,7 @@ static struct pci_device_id brcmf_pcie_d
  4654. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_DEVICE_ID),
  4655. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_2G_DEVICE_ID),
  4656. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_5G_DEVICE_ID),
  4657. -+ BRCMF_PCIE_DEVICE_SUB(0x4365, BRCM_PCIE_VENDOR_ID_BROADCOM, 0x4365),
  4658. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_DEVICE_ID),
  4659. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_2G_DEVICE_ID),
  4660. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_5G_DEVICE_ID),
  4661. diff --git a/package/kernel/mac80211/patches/324-brcmfmac-treat-NULL-character-in-NVRAM-as-separator.patch b/package/kernel/mac80211/patches/324-brcmfmac-treat-NULL-character-in-NVRAM-as-separator.patch
  4662. deleted file mode 100644
  4663. index 6ce60f1..0000000
  4664. --- a/package/kernel/mac80211/patches/324-brcmfmac-treat-NULL-character-in-NVRAM-as-separator.patch
  4665. +++ /dev/null
  4666. @@ -1,32 +0,0 @@
  4667. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4668. -Date: Sun, 31 Jan 2016 12:14:34 +0100
  4669. -Subject: [PATCH] brcmfmac: treat NULL character in NVRAM as separator
  4670. -MIME-Version: 1.0
  4671. -Content-Type: text/plain; charset=UTF-8
  4672. -Content-Transfer-Encoding: 8bit
  4673. -
  4674. -Platform NVRAM (stored on a flash partition) has entries separated by a
  4675. -NULL (\0) char. Our parsing code switches from VALUE state to IDLE
  4676. -whenever it meets a NULL (\0). When that happens our IDLE handler should
  4677. -simply consume it and analyze whatever is placed ahead.
  4678. -
  4679. -This fixes harmless warnings spamming debugging output:
  4680. -[ 155.165624] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=20: ignoring invalid character
  4681. -[ 155.180806] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=44: ignoring invalid character
  4682. -[ 155.195971] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=63: ignoring invalid character
  4683. -
  4684. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4685. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4686. ----
  4687. -
  4688. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  4689. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  4690. -@@ -93,7 +93,7 @@ static enum nvram_parser_state brcmf_nvr
  4691. - c = nvp->data[nvp->pos];
  4692. - if (c == '\n')
  4693. - return COMMENT;
  4694. -- if (is_whitespace(c))
  4695. -+ if (is_whitespace(c) || c == '\0')
  4696. - goto proceed;
  4697. - if (c == '#')
  4698. - return COMMENT;
  4699. diff --git a/package/kernel/mac80211/patches/325-brcmfmac-sdio-Increase-the-default-timeouts-a-bit.patch b/package/kernel/mac80211/patches/325-brcmfmac-sdio-Increase-the-default-timeouts-a-bit.patch
  4700. deleted file mode 100644
  4701. index 012dea1..0000000
  4702. --- a/package/kernel/mac80211/patches/325-brcmfmac-sdio-Increase-the-default-timeouts-a-bit.patch
  4703. +++ /dev/null
  4704. @@ -1,41 +0,0 @@
  4705. -From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
  4706. -Date: Mon, 25 Jan 2016 11:47:29 +0100
  4707. -Subject: [PATCH] brcmfmac: sdio: Increase the default timeouts a bit
  4708. -
  4709. -On a Radxa Rock2 board with a Ampak AP6335 (Broadcom 4339 core) it seems
  4710. -the card responds very quickly most of the time, unfortunately during
  4711. -initialisation it sometimes seems to take just a bit over 2 seconds to
  4712. -respond.
  4713. -
  4714. -This results intialization failing with message like:
  4715. - brcmf_c_preinit_dcmds: Retreiving cur_etheraddr failed, -52
  4716. - brcmf_bus_start: failed: -52
  4717. - brcmf_sdio_firmware_callback: dongle is not responding
  4718. -
  4719. -Increasing the timeout to allow for a bit more headroom allows the
  4720. -card to initialize reliably.
  4721. -
  4722. -A quick search online after diagnosing/fixing this showed that Google
  4723. -has a similar patch in their ChromeOS tree, so this doesn't seem
  4724. -specific to the board I'm using.
  4725. -
  4726. -Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
  4727. -Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
  4728. -Acked-by: Arend van Spriel <arend@broadcom.com>
  4729. -Reviewed-by: Douglas Anderson <dianders@chromium.org>
  4730. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4731. ----
  4732. -
  4733. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  4734. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  4735. -@@ -45,8 +45,8 @@
  4736. - #include "chip.h"
  4737. - #include "firmware.h"
  4738. -
  4739. --#define DCMD_RESP_TIMEOUT msecs_to_jiffies(2000)
  4740. --#define CTL_DONE_TIMEOUT msecs_to_jiffies(2000)
  4741. -+#define DCMD_RESP_TIMEOUT msecs_to_jiffies(2500)
  4742. -+#define CTL_DONE_TIMEOUT msecs_to_jiffies(2500)
  4743. -
  4744. - #ifdef DEBUG
  4745. -
  4746. diff --git a/package/kernel/mac80211/patches/326-ath9k-make-NF-load-complete-quickly-and-reliably.patch b/package/kernel/mac80211/patches/326-ath9k-make-NF-load-complete-quickly-and-reliably.patch
  4747. deleted file mode 100644
  4748. index 71f7a40..0000000
  4749. --- a/package/kernel/mac80211/patches/326-ath9k-make-NF-load-complete-quickly-and-reliably.patch
  4750. +++ /dev/null
  4751. @@ -1,87 +0,0 @@
  4752. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  4753. -Date: Fri, 5 Feb 2016 09:45:50 +0800
  4754. -Subject: [PATCH] ath9k: make NF load complete quickly and reliably
  4755. -
  4756. -Make NF load complete quickly and reliably. NF load execution
  4757. -is delayed by HW to end of frame if frame Rx or Tx is ongoing.
  4758. -Increasing timeout to max frame duration. If NF cal is ongoing
  4759. -before NF load, stop it before load, and restart it afterwards.
  4760. -
  4761. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  4762. ----
  4763. -
  4764. ---- a/drivers/net/wireless/ath/ath9k/calib.c
  4765. -+++ b/drivers/net/wireless/ath/ath9k/calib.c
  4766. -@@ -241,6 +241,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  4767. - u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask;
  4768. - struct ath_common *common = ath9k_hw_common(ah);
  4769. - s16 default_nf = ath9k_hw_get_default_nf(ah, chan);
  4770. -+ u32 bb_agc_ctl = REG_READ(ah, AR_PHY_AGC_CONTROL);
  4771. -
  4772. - if (ah->caldata)
  4773. - h = ah->caldata->nfCalHist;
  4774. -@@ -264,6 +265,16 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  4775. - }
  4776. -
  4777. - /*
  4778. -+ * stop NF cal if ongoing to ensure NF load completes immediately
  4779. -+ * (or after end rx/tx frame if ongoing)
  4780. -+ */
  4781. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NF) {
  4782. -+ REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
  4783. -+ REG_RMW_BUFFER_FLUSH(ah);
  4784. -+ ENABLE_REG_RMW_BUFFER(ah);
  4785. -+ }
  4786. -+
  4787. -+ /*
  4788. - * Load software filtered NF value into baseband internal minCCApwr
  4789. - * variable.
  4790. - */
  4791. -@@ -276,18 +287,33 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  4792. -
  4793. - /*
  4794. - * Wait for load to complete, should be fast, a few 10s of us.
  4795. -- * The max delay was changed from an original 250us to 10000us
  4796. -- * since 250us often results in NF load timeout and causes deaf
  4797. -- * condition during stress testing 12/12/2009
  4798. -+ * The max delay was changed from an original 250us to 22.2 msec.
  4799. -+ * This would increase timeout to the longest possible frame
  4800. -+ * (11n max length 22.1 msec)
  4801. - */
  4802. -- for (j = 0; j < 10000; j++) {
  4803. -+ for (j = 0; j < 22200; j++) {
  4804. - if ((REG_READ(ah, AR_PHY_AGC_CONTROL) &
  4805. -- AR_PHY_AGC_CONTROL_NF) == 0)
  4806. -+ AR_PHY_AGC_CONTROL_NF) == 0)
  4807. - break;
  4808. - udelay(10);
  4809. - }
  4810. -
  4811. - /*
  4812. -+ * Restart NF so it can continue.
  4813. -+ */
  4814. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NF) {
  4815. -+ ENABLE_REG_RMW_BUFFER(ah);
  4816. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_ENABLE_NF)
  4817. -+ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
  4818. -+ AR_PHY_AGC_CONTROL_ENABLE_NF);
  4819. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NO_UPDATE_NF)
  4820. -+ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
  4821. -+ AR_PHY_AGC_CONTROL_NO_UPDATE_NF);
  4822. -+ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
  4823. -+ REG_RMW_BUFFER_FLUSH(ah);
  4824. -+ }
  4825. -+
  4826. -+ /*
  4827. - * We timed out waiting for the noisefloor to load, probably due to an
  4828. - * in-progress rx. Simply return here and allow the load plenty of time
  4829. - * to complete before the next calibration interval. We need to avoid
  4830. -@@ -296,7 +322,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  4831. - * here, the baseband nf cal will just be capped by our present
  4832. - * noisefloor until the next calibration timer.
  4833. - */
  4834. -- if (j == 10000) {
  4835. -+ if (j == 22200) {
  4836. - ath_dbg(common, ANY,
  4837. - "Timeout while waiting for nf to load: AR_PHY_AGC_CONTROL=0x%x\n",
  4838. - REG_READ(ah, AR_PHY_AGC_CONTROL));
  4839. diff --git a/package/kernel/mac80211/patches/327-mac80211-Remove-MPP-table-entries-with-MPath.patch b/package/kernel/mac80211/patches/327-mac80211-Remove-MPP-table-entries-with-MPath.patch
  4840. deleted file mode 100644
  4841. index f7f9df9..0000000
  4842. --- a/package/kernel/mac80211/patches/327-mac80211-Remove-MPP-table-entries-with-MPath.patch
  4843. +++ /dev/null
  4844. @@ -1,54 +0,0 @@
  4845. -From: Henning Rogge <hrogge@gmail.com>
  4846. -Date: Wed, 3 Feb 2016 13:58:36 +0100
  4847. -Subject: [PATCH] mac80211: Remove MPP table entries with MPath
  4848. -
  4849. -Make the mesh_path_del() function remove all mpp table entries
  4850. -that are proxied by the removed mesh path.
  4851. -
  4852. -Acked-by: Bob Copeland <me@bobcopeland.com>
  4853. -Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
  4854. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  4855. ----
  4856. -
  4857. ---- a/net/mac80211/mesh_pathtbl.c
  4858. -+++ b/net/mac80211/mesh_pathtbl.c
  4859. -@@ -835,6 +835,29 @@ void mesh_path_flush_by_nexthop(struct s
  4860. - rcu_read_unlock();
  4861. - }
  4862. -
  4863. -+static void mpp_flush_by_proxy(struct ieee80211_sub_if_data *sdata,
  4864. -+ const u8 *proxy)
  4865. -+{
  4866. -+ struct mesh_table *tbl;
  4867. -+ struct mesh_path *mpp;
  4868. -+ struct mpath_node *node;
  4869. -+ int i;
  4870. -+
  4871. -+ rcu_read_lock();
  4872. -+ read_lock_bh(&pathtbl_resize_lock);
  4873. -+ tbl = resize_dereference_mpp_paths();
  4874. -+ for_each_mesh_entry(tbl, node, i) {
  4875. -+ mpp = node->mpath;
  4876. -+ if (ether_addr_equal(mpp->mpp, proxy)) {
  4877. -+ spin_lock(&tbl->hashwlock[i]);
  4878. -+ __mesh_path_del(tbl, node);
  4879. -+ spin_unlock(&tbl->hashwlock[i]);
  4880. -+ }
  4881. -+ }
  4882. -+ read_unlock_bh(&pathtbl_resize_lock);
  4883. -+ rcu_read_unlock();
  4884. -+}
  4885. -+
  4886. - static void table_flush_by_iface(struct mesh_table *tbl,
  4887. - struct ieee80211_sub_if_data *sdata)
  4888. - {
  4889. -@@ -892,6 +915,9 @@ int mesh_path_del(struct ieee80211_sub_i
  4890. - int hash_idx;
  4891. - int err = 0;
  4892. -
  4893. -+ /* flush relevant mpp entries first */
  4894. -+ mpp_flush_by_proxy(sdata, addr);
  4895. -+
  4896. - read_lock_bh(&pathtbl_resize_lock);
  4897. - tbl = resize_dereference_mesh_paths();
  4898. - hash_idx = mesh_table_hash(addr, sdata, tbl);
  4899. diff --git a/package/kernel/mac80211/patches/328-mac80211-let-unused-MPP-table-entries-timeout.patch b/package/kernel/mac80211/patches/328-mac80211-let-unused-MPP-table-entries-timeout.patch
  4900. deleted file mode 100644
  4901. index 740993c..0000000
  4902. --- a/package/kernel/mac80211/patches/328-mac80211-let-unused-MPP-table-entries-timeout.patch
  4903. +++ /dev/null
  4904. @@ -1,104 +0,0 @@
  4905. -From: Henning Rogge <hrogge@gmail.com>
  4906. -Date: Wed, 3 Feb 2016 13:58:37 +0100
  4907. -Subject: [PATCH] mac80211: let unused MPP table entries timeout
  4908. -
  4909. -Remember the last time when a mpp table entry is used for
  4910. -rx or tx and remove them after MESH_PATH_EXPIRE time.
  4911. -
  4912. -Acked-by: Bob Copeland <me@bobcopeland.com>
  4913. -Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
  4914. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  4915. ----
  4916. -
  4917. ---- a/net/mac80211/mesh_pathtbl.c
  4918. -+++ b/net/mac80211/mesh_pathtbl.c
  4919. -@@ -942,6 +942,46 @@ enddel:
  4920. - }
  4921. -
  4922. - /**
  4923. -+ * mpp_path_del - delete a mesh proxy path from the table
  4924. -+ *
  4925. -+ * @addr: addr address (ETH_ALEN length)
  4926. -+ * @sdata: local subif
  4927. -+ *
  4928. -+ * Returns: 0 if successful
  4929. -+ */
  4930. -+static int mpp_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  4931. -+{
  4932. -+ struct mesh_table *tbl;
  4933. -+ struct mesh_path *mpath;
  4934. -+ struct mpath_node *node;
  4935. -+ struct hlist_head *bucket;
  4936. -+ int hash_idx;
  4937. -+ int err = 0;
  4938. -+
  4939. -+ read_lock_bh(&pathtbl_resize_lock);
  4940. -+ tbl = resize_dereference_mpp_paths();
  4941. -+ hash_idx = mesh_table_hash(addr, sdata, tbl);
  4942. -+ bucket = &tbl->hash_buckets[hash_idx];
  4943. -+
  4944. -+ spin_lock(&tbl->hashwlock[hash_idx]);
  4945. -+ hlist_for_each_entry(node, bucket, list) {
  4946. -+ mpath = node->mpath;
  4947. -+ if (mpath->sdata == sdata &&
  4948. -+ ether_addr_equal(addr, mpath->dst)) {
  4949. -+ __mesh_path_del(tbl, node);
  4950. -+ goto enddel;
  4951. -+ }
  4952. -+ }
  4953. -+
  4954. -+ err = -ENXIO;
  4955. -+enddel:
  4956. -+ mesh_paths_generation++;
  4957. -+ spin_unlock(&tbl->hashwlock[hash_idx]);
  4958. -+ read_unlock_bh(&pathtbl_resize_lock);
  4959. -+ return err;
  4960. -+}
  4961. -+
  4962. -+/**
  4963. - * mesh_path_tx_pending - sends pending frames in a mesh path queue
  4964. - *
  4965. - * @mpath: mesh path to activate
  4966. -@@ -1157,6 +1197,17 @@ void mesh_path_expire(struct ieee80211_s
  4967. - time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE))
  4968. - mesh_path_del(mpath->sdata, mpath->dst);
  4969. - }
  4970. -+
  4971. -+ tbl = rcu_dereference(mpp_paths);
  4972. -+ for_each_mesh_entry(tbl, node, i) {
  4973. -+ if (node->mpath->sdata != sdata)
  4974. -+ continue;
  4975. -+ mpath = node->mpath;
  4976. -+ if ((!(mpath->flags & MESH_PATH_FIXED)) &&
  4977. -+ time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE))
  4978. -+ mpp_path_del(mpath->sdata, mpath->dst);
  4979. -+ }
  4980. -+
  4981. - rcu_read_unlock();
  4982. - }
  4983. -
  4984. ---- a/net/mac80211/rx.c
  4985. -+++ b/net/mac80211/rx.c
  4986. -@@ -2291,6 +2291,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  4987. - spin_lock_bh(&mppath->state_lock);
  4988. - if (!ether_addr_equal(mppath->mpp, mpp_addr))
  4989. - memcpy(mppath->mpp, mpp_addr, ETH_ALEN);
  4990. -+ mppath->exp_time = jiffies;
  4991. - spin_unlock_bh(&mppath->state_lock);
  4992. - }
  4993. - rcu_read_unlock();
  4994. ---- a/net/mac80211/tx.c
  4995. -+++ b/net/mac80211/tx.c
  4996. -@@ -2171,8 +2171,11 @@ static struct sk_buff *ieee80211_build_h
  4997. - mpp_lookup = true;
  4998. - }
  4999. -
  5000. -- if (mpp_lookup)
  5001. -+ if (mpp_lookup) {
  5002. - mppath = mpp_path_lookup(sdata, skb->data);
  5003. -+ if (mppath)
  5004. -+ mppath->exp_time = jiffies;
  5005. -+ }
  5006. -
  5007. - if (mppath && mpath)
  5008. - mesh_path_del(mpath->sdata, mpath->dst);
  5009. diff --git a/package/kernel/mac80211/patches/329-mac80211-Unify-mesh-and-mpp-path-removal-function.patch b/package/kernel/mac80211/patches/329-mac80211-Unify-mesh-and-mpp-path-removal-function.patch
  5010. deleted file mode 100644
  5011. index 0c36b1d..0000000
  5012. --- a/package/kernel/mac80211/patches/329-mac80211-Unify-mesh-and-mpp-path-removal-function.patch
  5013. +++ /dev/null
  5014. @@ -1,143 +0,0 @@
  5015. -From: Henning Rogge <hrogge@gmail.com>
  5016. -Date: Wed, 3 Feb 2016 13:58:38 +0100
  5017. -Subject: [PATCH] mac80211: Unify mesh and mpp path removal function
  5018. -
  5019. -mpp_path_del() and mesh_path_del() are mostly the same function.
  5020. -Move common code into a new static function.
  5021. -
  5022. -Acked-by: Bob Copeland <me@bobcopeland.com>
  5023. -Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
  5024. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  5025. ----
  5026. -
  5027. ---- a/net/mac80211/mesh_pathtbl.c
  5028. -+++ b/net/mac80211/mesh_pathtbl.c
  5029. -@@ -55,16 +55,21 @@ int mpp_paths_generation;
  5030. - static DEFINE_RWLOCK(pathtbl_resize_lock);
  5031. -
  5032. -
  5033. -+static inline struct mesh_table *resize_dereference_paths(
  5034. -+ struct mesh_table __rcu *table)
  5035. -+{
  5036. -+ return rcu_dereference_protected(table,
  5037. -+ lockdep_is_held(&pathtbl_resize_lock));
  5038. -+}
  5039. -+
  5040. - static inline struct mesh_table *resize_dereference_mesh_paths(void)
  5041. - {
  5042. -- return rcu_dereference_protected(mesh_paths,
  5043. -- lockdep_is_held(&pathtbl_resize_lock));
  5044. -+ return resize_dereference_paths(mesh_paths);
  5045. - }
  5046. -
  5047. - static inline struct mesh_table *resize_dereference_mpp_paths(void)
  5048. - {
  5049. -- return rcu_dereference_protected(mpp_paths,
  5050. -- lockdep_is_held(&pathtbl_resize_lock));
  5051. -+ return resize_dereference_paths(mpp_paths);
  5052. - }
  5053. -
  5054. - /*
  5055. -@@ -899,14 +904,17 @@ void mesh_path_flush_by_iface(struct iee
  5056. - }
  5057. -
  5058. - /**
  5059. -- * mesh_path_del - delete a mesh path from the table
  5060. -+ * table_path_del - delete a path from the mesh or mpp table
  5061. - *
  5062. -- * @addr: dst address (ETH_ALEN length)
  5063. -+ * @tbl: mesh or mpp path table
  5064. - * @sdata: local subif
  5065. -+ * @addr: dst address (ETH_ALEN length)
  5066. - *
  5067. - * Returns: 0 if successful
  5068. - */
  5069. --int mesh_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  5070. -+static int table_path_del(struct mesh_table __rcu *rcu_tbl,
  5071. -+ struct ieee80211_sub_if_data *sdata,
  5072. -+ const u8 *addr)
  5073. - {
  5074. - struct mesh_table *tbl;
  5075. - struct mesh_path *mpath;
  5076. -@@ -915,11 +923,7 @@ int mesh_path_del(struct ieee80211_sub_i
  5077. - int hash_idx;
  5078. - int err = 0;
  5079. -
  5080. -- /* flush relevant mpp entries first */
  5081. -- mpp_flush_by_proxy(sdata, addr);
  5082. --
  5083. -- read_lock_bh(&pathtbl_resize_lock);
  5084. -- tbl = resize_dereference_mesh_paths();
  5085. -+ tbl = resize_dereference_paths(rcu_tbl);
  5086. - hash_idx = mesh_table_hash(addr, sdata, tbl);
  5087. - bucket = &tbl->hash_buckets[hash_idx];
  5088. -
  5089. -@@ -935,9 +939,30 @@ int mesh_path_del(struct ieee80211_sub_i
  5090. -
  5091. - err = -ENXIO;
  5092. - enddel:
  5093. -- mesh_paths_generation++;
  5094. - spin_unlock(&tbl->hashwlock[hash_idx]);
  5095. -+ return err;
  5096. -+}
  5097. -+
  5098. -+/**
  5099. -+ * mesh_path_del - delete a mesh path from the table
  5100. -+ *
  5101. -+ * @addr: dst address (ETH_ALEN length)
  5102. -+ * @sdata: local subif
  5103. -+ *
  5104. -+ * Returns: 0 if successful
  5105. -+ */
  5106. -+int mesh_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  5107. -+{
  5108. -+ int err = 0;
  5109. -+
  5110. -+ /* flush relevant mpp entries first */
  5111. -+ mpp_flush_by_proxy(sdata, addr);
  5112. -+
  5113. -+ read_lock_bh(&pathtbl_resize_lock);
  5114. -+ err = table_path_del(mesh_paths, sdata, addr);
  5115. -+ mesh_paths_generation++;
  5116. - read_unlock_bh(&pathtbl_resize_lock);
  5117. -+
  5118. - return err;
  5119. - }
  5120. -
  5121. -@@ -951,33 +976,13 @@ enddel:
  5122. - */
  5123. - static int mpp_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  5124. - {
  5125. -- struct mesh_table *tbl;
  5126. -- struct mesh_path *mpath;
  5127. -- struct mpath_node *node;
  5128. -- struct hlist_head *bucket;
  5129. -- int hash_idx;
  5130. - int err = 0;
  5131. -
  5132. - read_lock_bh(&pathtbl_resize_lock);
  5133. -- tbl = resize_dereference_mpp_paths();
  5134. -- hash_idx = mesh_table_hash(addr, sdata, tbl);
  5135. -- bucket = &tbl->hash_buckets[hash_idx];
  5136. --
  5137. -- spin_lock(&tbl->hashwlock[hash_idx]);
  5138. -- hlist_for_each_entry(node, bucket, list) {
  5139. -- mpath = node->mpath;
  5140. -- if (mpath->sdata == sdata &&
  5141. -- ether_addr_equal(addr, mpath->dst)) {
  5142. -- __mesh_path_del(tbl, node);
  5143. -- goto enddel;
  5144. -- }
  5145. -- }
  5146. --
  5147. -- err = -ENXIO;
  5148. --enddel:
  5149. -- mesh_paths_generation++;
  5150. -- spin_unlock(&tbl->hashwlock[hash_idx]);
  5151. -+ err = table_path_del(mpp_paths, sdata, addr);
  5152. -+ mpp_paths_generation++;
  5153. - read_unlock_bh(&pathtbl_resize_lock);
  5154. -+
  5155. - return err;
  5156. - }
  5157. -
  5158. diff --git a/package/kernel/mac80211/patches/330-mac80211-minstrel-Change-expected-throughput-unit-ba.patch b/package/kernel/mac80211/patches/330-mac80211-minstrel-Change-expected-throughput-unit-ba.patch
  5159. deleted file mode 100644
  5160. index 4dc6d66..0000000
  5161. --- a/package/kernel/mac80211/patches/330-mac80211-minstrel-Change-expected-throughput-unit-ba.patch
  5162. +++ /dev/null
  5163. @@ -1,51 +0,0 @@
  5164. -From: Sven Eckelmann <sven.eckelmann@open-mesh.com>
  5165. -Date: Tue, 2 Feb 2016 08:12:26 +0100
  5166. -Subject: [PATCH] mac80211: minstrel: Change expected throughput unit back to
  5167. - Kbps
  5168. -
  5169. -The change from cur_tp to the function
  5170. -minstrel_get_tp_avg/minstrel_ht_get_tp_avg changed the unit used for the
  5171. -current throughput. For example in minstrel_ht the correct
  5172. -conversion between them would be:
  5173. -
  5174. - mrs->cur_tp / 10 == minstrel_ht_get_tp_avg(..).
  5175. -
  5176. -This factor 10 must also be included in the calculation of
  5177. -minstrel_get_expected_throughput and minstrel_ht_get_expected_throughput to
  5178. -return values with the unit [Kbps] instead of [10Kbps]. Otherwise routing
  5179. -algorithms like B.A.T.M.A.N. V will make incorrect decision based on these
  5180. -values. Its kernel based implementation expects expected_throughput always
  5181. -to have the unit [Kbps] and not sometimes [10Kbps] and sometimes [Kbps].
  5182. -
  5183. -The same requirement has iw or olsrdv2's nl80211 based statistics module
  5184. -which retrieve the same data via NL80211_STA_INFO_TX_BITRATE.
  5185. -
  5186. -Cc: stable@vger.kernel.org
  5187. -Fixes: 6a27b2c40b48 ("mac80211: restructure per-rate throughput calculation into function")
  5188. -Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  5189. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  5190. ----
  5191. -
  5192. ---- a/net/mac80211/rc80211_minstrel.c
  5193. -+++ b/net/mac80211/rc80211_minstrel.c
  5194. -@@ -711,7 +711,7 @@ static u32 minstrel_get_expected_through
  5195. - * computing cur_tp
  5196. - */
  5197. - tmp_mrs = &mi->r[idx].stats;
  5198. -- tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma);
  5199. -+ tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma) * 10;
  5200. - tmp_cur_tp = tmp_cur_tp * 1200 * 8 / 1024;
  5201. -
  5202. - return tmp_cur_tp;
  5203. ---- a/net/mac80211/rc80211_minstrel_ht.c
  5204. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  5205. -@@ -1335,7 +1335,8 @@ static u32 minstrel_ht_get_expected_thro
  5206. - prob = mi->groups[i].rates[j].prob_ewma;
  5207. -
  5208. - /* convert tp_avg from pkt per second in kbps */
  5209. -- tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * AVG_PKT_SIZE * 8 / 1024;
  5210. -+ tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * 10;
  5211. -+ tp_avg = tp_avg * AVG_PKT_SIZE * 8 / 1024;
  5212. -
  5213. - return tp_avg;
  5214. - }
  5215. diff --git a/package/kernel/mac80211/patches/331-brcmfmac-Increase-nr-of-supported-flowrings.patch b/package/kernel/mac80211/patches/331-brcmfmac-Increase-nr-of-supported-flowrings.patch
  5216. deleted file mode 100644
  5217. index 1fd016f..0000000
  5218. --- a/package/kernel/mac80211/patches/331-brcmfmac-Increase-nr-of-supported-flowrings.patch
  5219. +++ /dev/null
  5220. @@ -1,307 +0,0 @@
  5221. -From: Hante Meuleman <meuleman@broadcom.com>
  5222. -Date: Sun, 7 Feb 2016 18:08:24 +0100
  5223. -Subject: [PATCH] brcmfmac: Increase nr of supported flowrings.
  5224. -MIME-Version: 1.0
  5225. -Content-Type: text/plain; charset=UTF-8
  5226. -Content-Transfer-Encoding: 8bit
  5227. -
  5228. -New generation devices have firmware which has more than 256 flowrings.
  5229. -E.g. following debugging message comes from 14e4:4365 BCM4366:
  5230. -[ 194.606245] brcmfmac: brcmf_pcie_init_ringbuffers Nr of flowrings is 264
  5231. -
  5232. -At various code places (related to flowrings) we were using u8 which
  5233. -could lead to storing wrong number or infinite loops when indexing with
  5234. -this type. This issue was quite easy to spot in brcmf_flowring_detach
  5235. -where it led to infinite loop e.g. on failed initialization.
  5236. -
  5237. -This patch switches code to proper types and increases the maximum
  5238. -number of supported flowrings to 512.
  5239. -
  5240. -Originally this change was sent in September 2015, but back it was
  5241. -causing a regression on BCM43602 resulting in:
  5242. -Unable to handle kernel NULL pointer dereference at virtual address ...
  5243. -
  5244. -The reason for this regression was missing update (s/u8/u16) of struct
  5245. -brcmf_flowring_ring. This problem was handled in 9f64df9 ("brcmfmac: Fix
  5246. -bug in flowring management."). Starting with that it's safe to apply
  5247. -this original patch as it doesn't cause a regression anymore.
  5248. -
  5249. -This patch fixes an infinite loop on BCM4366 which is supported since
  5250. -4.4 so it makes sense to apply it to stable 4.4+.
  5251. -
  5252. -Cc: <stable@vger.kernel.org> # 4.4+
  5253. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  5254. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  5255. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  5256. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  5257. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  5258. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  5259. ----
  5260. -
  5261. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  5262. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  5263. -@@ -32,7 +32,7 @@
  5264. - #define BRCMF_FLOWRING_LOW (BRCMF_FLOWRING_HIGH - 256)
  5265. - #define BRCMF_FLOWRING_INVALID_IFIDX 0xff
  5266. -
  5267. --#define BRCMF_FLOWRING_HASH_AP(da, fifo, ifidx) (da[5] + fifo + ifidx * 16)
  5268. -+#define BRCMF_FLOWRING_HASH_AP(da, fifo, ifidx) (da[5] * 2 + fifo + ifidx * 16)
  5269. - #define BRCMF_FLOWRING_HASH_STA(fifo, ifidx) (fifo + ifidx * 16)
  5270. -
  5271. - static const u8 brcmf_flowring_prio2fifo[] = {
  5272. -@@ -68,7 +68,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  5273. - u8 prio, u8 ifidx)
  5274. - {
  5275. - struct brcmf_flowring_hash *hash;
  5276. -- u8 hash_idx;
  5277. -+ u16 hash_idx;
  5278. - u32 i;
  5279. - bool found;
  5280. - bool sta;
  5281. -@@ -88,6 +88,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  5282. - }
  5283. - hash_idx = sta ? BRCMF_FLOWRING_HASH_STA(fifo, ifidx) :
  5284. - BRCMF_FLOWRING_HASH_AP(mac, fifo, ifidx);
  5285. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  5286. - found = false;
  5287. - hash = flow->hash;
  5288. - for (i = 0; i < BRCMF_FLOWRING_HASHSIZE; i++) {
  5289. -@@ -98,6 +99,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  5290. - break;
  5291. - }
  5292. - hash_idx++;
  5293. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  5294. - }
  5295. - if (found)
  5296. - return hash[hash_idx].flowid;
  5297. -@@ -111,7 +113,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  5298. - {
  5299. - struct brcmf_flowring_ring *ring;
  5300. - struct brcmf_flowring_hash *hash;
  5301. -- u8 hash_idx;
  5302. -+ u16 hash_idx;
  5303. - u32 i;
  5304. - bool found;
  5305. - u8 fifo;
  5306. -@@ -131,6 +133,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  5307. - }
  5308. - hash_idx = sta ? BRCMF_FLOWRING_HASH_STA(fifo, ifidx) :
  5309. - BRCMF_FLOWRING_HASH_AP(mac, fifo, ifidx);
  5310. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  5311. - found = false;
  5312. - hash = flow->hash;
  5313. - for (i = 0; i < BRCMF_FLOWRING_HASHSIZE; i++) {
  5314. -@@ -140,6 +143,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  5315. - break;
  5316. - }
  5317. - hash_idx++;
  5318. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  5319. - }
  5320. - if (found) {
  5321. - for (i = 0; i < flow->nrofrings; i++) {
  5322. -@@ -169,7 +173,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  5323. - }
  5324. -
  5325. -
  5326. --u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u8 flowid)
  5327. -+u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u16 flowid)
  5328. - {
  5329. - struct brcmf_flowring_ring *ring;
  5330. -
  5331. -@@ -179,7 +183,7 @@ u8 brcmf_flowring_tid(struct brcmf_flowr
  5332. - }
  5333. -
  5334. -
  5335. --static void brcmf_flowring_block(struct brcmf_flowring *flow, u8 flowid,
  5336. -+static void brcmf_flowring_block(struct brcmf_flowring *flow, u16 flowid,
  5337. - bool blocked)
  5338. - {
  5339. - struct brcmf_flowring_ring *ring;
  5340. -@@ -228,10 +232,10 @@ static void brcmf_flowring_block(struct
  5341. - }
  5342. -
  5343. -
  5344. --void brcmf_flowring_delete(struct brcmf_flowring *flow, u8 flowid)
  5345. -+void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid)
  5346. - {
  5347. - struct brcmf_flowring_ring *ring;
  5348. -- u8 hash_idx;
  5349. -+ u16 hash_idx;
  5350. - struct sk_buff *skb;
  5351. -
  5352. - ring = flow->rings[flowid];
  5353. -@@ -253,7 +257,7 @@ void brcmf_flowring_delete(struct brcmf_
  5354. - }
  5355. -
  5356. -
  5357. --u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  5358. -+u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u16 flowid,
  5359. - struct sk_buff *skb)
  5360. - {
  5361. - struct brcmf_flowring_ring *ring;
  5362. -@@ -279,7 +283,7 @@ u32 brcmf_flowring_enqueue(struct brcmf_
  5363. - }
  5364. -
  5365. -
  5366. --struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u8 flowid)
  5367. -+struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u16 flowid)
  5368. - {
  5369. - struct brcmf_flowring_ring *ring;
  5370. - struct sk_buff *skb;
  5371. -@@ -300,7 +304,7 @@ struct sk_buff *brcmf_flowring_dequeue(s
  5372. - }
  5373. -
  5374. -
  5375. --void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u8 flowid,
  5376. -+void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u16 flowid,
  5377. - struct sk_buff *skb)
  5378. - {
  5379. - struct brcmf_flowring_ring *ring;
  5380. -@@ -311,7 +315,7 @@ void brcmf_flowring_reinsert(struct brcm
  5381. - }
  5382. -
  5383. -
  5384. --u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u8 flowid)
  5385. -+u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u16 flowid)
  5386. - {
  5387. - struct brcmf_flowring_ring *ring;
  5388. -
  5389. -@@ -326,7 +330,7 @@ u32 brcmf_flowring_qlen(struct brcmf_flo
  5390. - }
  5391. -
  5392. -
  5393. --void brcmf_flowring_open(struct brcmf_flowring *flow, u8 flowid)
  5394. -+void brcmf_flowring_open(struct brcmf_flowring *flow, u16 flowid)
  5395. - {
  5396. - struct brcmf_flowring_ring *ring;
  5397. -
  5398. -@@ -340,10 +344,10 @@ void brcmf_flowring_open(struct brcmf_fl
  5399. - }
  5400. -
  5401. -
  5402. --u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u8 flowid)
  5403. -+u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u16 flowid)
  5404. - {
  5405. - struct brcmf_flowring_ring *ring;
  5406. -- u8 hash_idx;
  5407. -+ u16 hash_idx;
  5408. -
  5409. - ring = flow->rings[flowid];
  5410. - hash_idx = ring->hash_id;
  5411. -@@ -384,7 +388,7 @@ void brcmf_flowring_detach(struct brcmf_
  5412. - struct brcmf_pub *drvr = bus_if->drvr;
  5413. - struct brcmf_flowring_tdls_entry *search;
  5414. - struct brcmf_flowring_tdls_entry *remove;
  5415. -- u8 flowid;
  5416. -+ u16 flowid;
  5417. -
  5418. - for (flowid = 0; flowid < flow->nrofrings; flowid++) {
  5419. - if (flow->rings[flowid])
  5420. -@@ -408,7 +412,7 @@ void brcmf_flowring_configure_addr_mode(
  5421. - struct brcmf_bus *bus_if = dev_get_drvdata(flow->dev);
  5422. - struct brcmf_pub *drvr = bus_if->drvr;
  5423. - u32 i;
  5424. -- u8 flowid;
  5425. -+ u16 flowid;
  5426. -
  5427. - if (flow->addr_mode[ifidx] != addr_mode) {
  5428. - for (i = 0; i < ARRAY_SIZE(flow->hash); i++) {
  5429. -@@ -434,7 +438,7 @@ void brcmf_flowring_delete_peer(struct b
  5430. - struct brcmf_flowring_tdls_entry *prev;
  5431. - struct brcmf_flowring_tdls_entry *search;
  5432. - u32 i;
  5433. -- u8 flowid;
  5434. -+ u16 flowid;
  5435. - bool sta;
  5436. -
  5437. - sta = (flow->addr_mode[ifidx] == ADDR_INDIRECT);
  5438. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.h
  5439. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.h
  5440. -@@ -16,7 +16,7 @@
  5441. - #define BRCMFMAC_FLOWRING_H
  5442. -
  5443. -
  5444. --#define BRCMF_FLOWRING_HASHSIZE 256
  5445. -+#define BRCMF_FLOWRING_HASHSIZE 512 /* has to be 2^x */
  5446. - #define BRCMF_FLOWRING_INVALID_ID 0xFFFFFFFF
  5447. -
  5448. -
  5449. -@@ -24,7 +24,7 @@ struct brcmf_flowring_hash {
  5450. - u8 mac[ETH_ALEN];
  5451. - u8 fifo;
  5452. - u8 ifidx;
  5453. -- u8 flowid;
  5454. -+ u16 flowid;
  5455. - };
  5456. -
  5457. - enum ring_status {
  5458. -@@ -61,16 +61,16 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  5459. - u8 prio, u8 ifidx);
  5460. - u32 brcmf_flowring_create(struct brcmf_flowring *flow, u8 da[ETH_ALEN],
  5461. - u8 prio, u8 ifidx);
  5462. --void brcmf_flowring_delete(struct brcmf_flowring *flow, u8 flowid);
  5463. --void brcmf_flowring_open(struct brcmf_flowring *flow, u8 flowid);
  5464. --u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u8 flowid);
  5465. --u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  5466. -+void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid);
  5467. -+void brcmf_flowring_open(struct brcmf_flowring *flow, u16 flowid);
  5468. -+u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u16 flowid);
  5469. -+u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u16 flowid,
  5470. - struct sk_buff *skb);
  5471. --struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u8 flowid);
  5472. --void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u8 flowid,
  5473. -+struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u16 flowid);
  5474. -+void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u16 flowid,
  5475. - struct sk_buff *skb);
  5476. --u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u8 flowid);
  5477. --u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u8 flowid);
  5478. -+u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u16 flowid);
  5479. -+u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u16 flowid);
  5480. - struct brcmf_flowring *brcmf_flowring_attach(struct device *dev, u16 nrofrings);
  5481. - void brcmf_flowring_detach(struct brcmf_flowring *flow);
  5482. - void brcmf_flowring_configure_addr_mode(struct brcmf_flowring *flow, int ifidx,
  5483. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  5484. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  5485. -@@ -677,7 +677,7 @@ static u32 brcmf_msgbuf_flowring_create(
  5486. - }
  5487. -
  5488. -
  5489. --static void brcmf_msgbuf_txflow(struct brcmf_msgbuf *msgbuf, u8 flowid)
  5490. -+static void brcmf_msgbuf_txflow(struct brcmf_msgbuf *msgbuf, u16 flowid)
  5491. - {
  5492. - struct brcmf_flowring *flow = msgbuf->flow;
  5493. - struct brcmf_commonring *commonring;
  5494. -@@ -1310,7 +1310,7 @@ int brcmf_proto_msgbuf_rx_trigger(struct
  5495. - }
  5496. -
  5497. -
  5498. --void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid)
  5499. -+void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u16 flowid)
  5500. - {
  5501. - struct brcmf_msgbuf *msgbuf = (struct brcmf_msgbuf *)drvr->proto->pd;
  5502. - struct msgbuf_tx_flowring_delete_req *delete;
  5503. -@@ -1415,6 +1415,13 @@ int brcmf_proto_msgbuf_attach(struct brc
  5504. - u32 count;
  5505. -
  5506. - if_msgbuf = drvr->bus_if->msgbuf;
  5507. -+
  5508. -+ if (if_msgbuf->nrof_flowrings >= BRCMF_FLOWRING_HASHSIZE) {
  5509. -+ brcmf_err("driver not configured for this many flowrings %d\n",
  5510. -+ if_msgbuf->nrof_flowrings);
  5511. -+ if_msgbuf->nrof_flowrings = BRCMF_FLOWRING_HASHSIZE - 1;
  5512. -+ }
  5513. -+
  5514. - msgbuf = kzalloc(sizeof(*msgbuf), GFP_KERNEL);
  5515. - if (!msgbuf)
  5516. - goto fail;
  5517. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h
  5518. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h
  5519. -@@ -33,7 +33,7 @@
  5520. -
  5521. -
  5522. - int brcmf_proto_msgbuf_rx_trigger(struct device *dev);
  5523. --void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid);
  5524. -+void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u16 flowid);
  5525. - int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr);
  5526. - void brcmf_proto_msgbuf_detach(struct brcmf_pub *drvr);
  5527. - #else
  5528. diff --git a/package/kernel/mac80211/patches/332-cfg80211-fix-faulty-variable-initialization-in-ieee8.patch b/package/kernel/mac80211/patches/332-cfg80211-fix-faulty-variable-initialization-in-ieee8.patch
  5529. deleted file mode 100644
  5530. index e414f23..0000000
  5531. --- a/package/kernel/mac80211/patches/332-cfg80211-fix-faulty-variable-initialization-in-ieee8.patch
  5532. +++ /dev/null
  5533. @@ -1,22 +0,0 @@
  5534. -From: Felix Fietkau <nbd@openwrt.org>
  5535. -Date: Mon, 8 Feb 2016 14:24:36 +0100
  5536. -Subject: [PATCH] cfg80211: fix faulty variable initialization in
  5537. - ieee80211_amsdu_to_8023s
  5538. -
  5539. -reuse_skb is set to true if the code decides to use the last segment.
  5540. -Fixes a memory leak
  5541. -
  5542. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  5543. ----
  5544. -
  5545. ---- a/net/wireless/util.c
  5546. -+++ b/net/wireless/util.c
  5547. -@@ -676,7 +676,7 @@ void ieee80211_amsdu_to_8023s(struct sk_
  5548. - u8 *payload;
  5549. - int offset = 0, remaining, err;
  5550. - struct ethhdr eth;
  5551. -- bool reuse_skb = true;
  5552. -+ bool reuse_skb = false;
  5553. - bool last = false;
  5554. -
  5555. - if (has_80211_header) {
  5556. diff --git a/package/kernel/mac80211/patches/333-cfg80211-reuse-existing-page-fragments-in-A-MSDU-rx.patch b/package/kernel/mac80211/patches/333-cfg80211-reuse-existing-page-fragments-in-A-MSDU-rx.patch
  5557. deleted file mode 100644
  5558. index 6e2d0cf..0000000
  5559. --- a/package/kernel/mac80211/patches/333-cfg80211-reuse-existing-page-fragments-in-A-MSDU-rx.patch
  5560. +++ /dev/null
  5561. @@ -1,132 +0,0 @@
  5562. -From: Felix Fietkau <nbd@openwrt.org>
  5563. -Date: Mon, 8 Feb 2016 14:33:19 +0100
  5564. -Subject: [PATCH] cfg80211: reuse existing page fragments in A-MSDU rx
  5565. -
  5566. -This massively reduces data copying and thus improves rx performance
  5567. -
  5568. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  5569. ----
  5570. -
  5571. ---- a/net/wireless/util.c
  5572. -+++ b/net/wireless/util.c
  5573. -@@ -644,23 +644,93 @@ int ieee80211_data_from_8023(struct sk_b
  5574. - }
  5575. - EXPORT_SYMBOL(ieee80211_data_from_8023);
  5576. -
  5577. -+static void
  5578. -+__frame_add_frag(struct sk_buff *skb, struct page *page,
  5579. -+ void *ptr, int len, int size)
  5580. -+{
  5581. -+ struct skb_shared_info *sh = skb_shinfo(skb);
  5582. -+ int page_offset;
  5583. -+
  5584. -+ atomic_inc(&page->_count);
  5585. -+ page_offset = ptr - page_address(page);
  5586. -+ skb_add_rx_frag(skb, sh->nr_frags, page, page_offset, len, size);
  5587. -+}
  5588. -+
  5589. -+static void
  5590. -+__ieee80211_amsdu_copy_frag(struct sk_buff *skb, struct sk_buff *frame,
  5591. -+ int offset, int len)
  5592. -+{
  5593. -+ struct skb_shared_info *sh = skb_shinfo(skb);
  5594. -+ const skb_frag_t *frag = &sh->frags[-1];
  5595. -+ struct page *frag_page;
  5596. -+ void *frag_ptr;
  5597. -+ int frag_len, frag_size;
  5598. -+ int head_size = skb->len - skb->data_len;
  5599. -+ int cur_len;
  5600. -+
  5601. -+ frag_page = virt_to_head_page(skb->head);
  5602. -+ frag_ptr = skb->data;
  5603. -+ frag_size = head_size;
  5604. -+
  5605. -+ while (offset >= frag_size) {
  5606. -+ offset -= frag_size;
  5607. -+ frag++;
  5608. -+ frag_page = skb_frag_page(frag);
  5609. -+ frag_ptr = skb_frag_address(frag);
  5610. -+ frag_size = skb_frag_size(frag);
  5611. -+ }
  5612. -+
  5613. -+ frag_ptr += offset;
  5614. -+ frag_len = frag_size - offset;
  5615. -+
  5616. -+ cur_len = min(len, frag_len);
  5617. -+
  5618. -+ __frame_add_frag(frame, frag_page, frag_ptr, cur_len, frag_size);
  5619. -+ len -= cur_len;
  5620. -+
  5621. -+ while (len > 0) {
  5622. -+ frag++;
  5623. -+ frag_len = skb_frag_size(frag);
  5624. -+ cur_len = min(len, frag_len);
  5625. -+ __frame_add_frag(frame, skb_frag_page(frag),
  5626. -+ skb_frag_address(frag), cur_len, frag_len);
  5627. -+ len -= cur_len;
  5628. -+ }
  5629. -+}
  5630. -+
  5631. - static struct sk_buff *
  5632. - __ieee80211_amsdu_copy(struct sk_buff *skb, unsigned int hlen,
  5633. -- int offset, int len)
  5634. -+ int offset, int len, bool reuse_frag)
  5635. - {
  5636. - struct sk_buff *frame;
  5637. -+ int cur_len = len;
  5638. -
  5639. - if (skb->len - offset < len)
  5640. - return NULL;
  5641. -
  5642. - /*
  5643. -+ * When reusing framents, copy some data to the head to simplify
  5644. -+ * ethernet header handling and speed up protocol header processing
  5645. -+ * in the stack later.
  5646. -+ */
  5647. -+ if (reuse_frag)
  5648. -+ cur_len = min_t(int, len, 32);
  5649. -+
  5650. -+ /*
  5651. - * Allocate and reserve two bytes more for payload
  5652. - * alignment since sizeof(struct ethhdr) is 14.
  5653. - */
  5654. -- frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + len);
  5655. -+ frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + cur_len);
  5656. -
  5657. - skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2);
  5658. -- skb_copy_bits(skb, offset, skb_put(frame, len), len);
  5659. -+ skb_copy_bits(skb, offset, skb_put(frame, cur_len), cur_len);
  5660. -+
  5661. -+ len -= cur_len;
  5662. -+ if (!len)
  5663. -+ return frame;
  5664. -+
  5665. -+ offset += cur_len;
  5666. -+ __ieee80211_amsdu_copy_frag(skb, frame, offset, len);
  5667. -
  5668. - return frame;
  5669. - }
  5670. -@@ -676,6 +746,7 @@ void ieee80211_amsdu_to_8023s(struct sk_
  5671. - u8 *payload;
  5672. - int offset = 0, remaining, err;
  5673. - struct ethhdr eth;
  5674. -+ bool reuse_frag = skb->head_frag && !skb_has_frag_list(skb);
  5675. - bool reuse_skb = false;
  5676. - bool last = false;
  5677. -
  5678. -@@ -703,12 +774,13 @@ void ieee80211_amsdu_to_8023s(struct sk_
  5679. - offset += sizeof(struct ethhdr);
  5680. - /* reuse skb for the last subframe */
  5681. - last = remaining <= subframe_len + padding;
  5682. -- if (!skb_is_nonlinear(skb) && last) {
  5683. -+ if (!skb_is_nonlinear(skb) && !reuse_frag && last) {
  5684. - skb_pull(skb, offset);
  5685. - frame = skb;
  5686. - reuse_skb = true;
  5687. - } else {
  5688. -- frame = __ieee80211_amsdu_copy(skb, hlen, offset, len);
  5689. -+ frame = __ieee80211_amsdu_copy(skb, hlen, offset, len,
  5690. -+ reuse_frag);
  5691. - if (!frame)
  5692. - goto purge;
  5693. -
  5694. diff --git a/package/kernel/mac80211/patches/334-mac80211-fix-wiphy-supported_band-access.patch b/package/kernel/mac80211/patches/334-mac80211-fix-wiphy-supported_band-access.patch
  5695. deleted file mode 100644
  5696. index f8f4f09..0000000
  5697. --- a/package/kernel/mac80211/patches/334-mac80211-fix-wiphy-supported_band-access.patch
  5698. +++ /dev/null
  5699. @@ -1,36 +0,0 @@
  5700. -From: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  5701. -Date: Wed, 10 Feb 2016 16:08:17 +0100
  5702. -Subject: [PATCH] mac80211: fix wiphy supported_band access
  5703. -
  5704. -Fix wiphy supported_band access in tx radiotap parsing. In particular,
  5705. -info->band is always set to 0 (IEEE80211_BAND_2GHZ) since it has not
  5706. -assigned yet. This cause a kernel crash on 5GHz only devices.
  5707. -Move ieee80211_parse_tx_radiotap() after info->band assignment
  5708. -
  5709. -Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  5710. ----
  5711. -
  5712. ---- a/net/mac80211/tx.c
  5713. -+++ b/net/mac80211/tx.c
  5714. -@@ -1890,10 +1890,6 @@ netdev_tx_t ieee80211_monitor_start_xmit
  5715. - info->flags = IEEE80211_TX_CTL_REQ_TX_STATUS |
  5716. - IEEE80211_TX_CTL_INJECTED;
  5717. -
  5718. -- /* process and remove the injection radiotap header */
  5719. -- if (!ieee80211_parse_tx_radiotap(local, skb))
  5720. -- goto fail;
  5721. --
  5722. - rcu_read_lock();
  5723. -
  5724. - /*
  5725. -@@ -1955,6 +1951,10 @@ netdev_tx_t ieee80211_monitor_start_xmit
  5726. - goto fail_rcu;
  5727. -
  5728. - info->band = chandef->chan->band;
  5729. -+ /* process and remove the injection radiotap header */
  5730. -+ if (!ieee80211_parse_tx_radiotap(local, skb))
  5731. -+ goto fail_rcu;
  5732. -+
  5733. - ieee80211_xmit(sdata, NULL, skb);
  5734. - rcu_read_unlock();
  5735. -
  5736. diff --git a/package/kernel/mac80211/patches/335-mac80211-minstrel_ht-set-A-MSDU-tx-limits-based-on-s.patch b/package/kernel/mac80211/patches/335-mac80211-minstrel_ht-set-A-MSDU-tx-limits-based-on-s.patch
  5737. deleted file mode 100644
  5738. index acaacf7..0000000
  5739. --- a/package/kernel/mac80211/patches/335-mac80211-minstrel_ht-set-A-MSDU-tx-limits-based-on-s.patch
  5740. +++ /dev/null
  5741. @@ -1,61 +0,0 @@
  5742. -From: Felix Fietkau <nbd@openwrt.org>
  5743. -Date: Thu, 18 Feb 2016 19:30:05 +0100
  5744. -Subject: [PATCH] mac80211: minstrel_ht: set A-MSDU tx limits based on selected
  5745. - max_prob_rate
  5746. -
  5747. -Prevents excessive A-MSDU aggregation at low data rates or bad
  5748. -conditions.
  5749. -
  5750. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  5751. ----
  5752. -
  5753. ---- a/net/mac80211/rc80211_minstrel_ht.c
  5754. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  5755. -@@ -883,6 +883,39 @@ minstrel_ht_set_rate(struct minstrel_pri
  5756. - ratetbl->rate[offset].flags = flags;
  5757. - }
  5758. -
  5759. -+static int
  5760. -+minstrel_ht_get_max_amsdu_len(struct minstrel_ht_sta *mi)
  5761. -+{
  5762. -+ int group = mi->max_prob_rate / MCS_GROUP_RATES;
  5763. -+ const struct mcs_group *g = &minstrel_mcs_groups[group];
  5764. -+ int rate = mi->max_prob_rate % MCS_GROUP_RATES;
  5765. -+
  5766. -+ /* Disable A-MSDU if max_prob_rate is bad */
  5767. -+ if (mi->groups[group].rates[rate].prob_ewma < MINSTREL_FRAC(50, 100))
  5768. -+ return 1;
  5769. -+
  5770. -+ /* If the rate is slower than single-stream MCS1, make A-MSDU limit small */
  5771. -+ if (g->duration[rate] > MCS_DURATION(1, 0, 52))
  5772. -+ return 500;
  5773. -+
  5774. -+ /*
  5775. -+ * If the rate is slower than single-stream MCS4, limit A-MSDU to usual
  5776. -+ * data packet size
  5777. -+ */
  5778. -+ if (g->duration[rate] > MCS_DURATION(1, 0, 104))
  5779. -+ return 1500;
  5780. -+
  5781. -+ /*
  5782. -+ * If the rate is slower than single-stream MCS7, limit A-MSDU to twice
  5783. -+ * the usual data packet size
  5784. -+ */
  5785. -+ if (g->duration[rate] > MCS_DURATION(1, 0, 260))
  5786. -+ return 3000;
  5787. -+
  5788. -+ /* unlimited */
  5789. -+ return 0;
  5790. -+}
  5791. -+
  5792. - static void
  5793. - minstrel_ht_update_rates(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
  5794. - {
  5795. -@@ -907,6 +940,7 @@ minstrel_ht_update_rates(struct minstrel
  5796. - minstrel_ht_set_rate(mp, mi, rates, i++, mi->max_prob_rate);
  5797. - }
  5798. -
  5799. -+ mi->sta->max_rc_amsdu_len = minstrel_ht_get_max_amsdu_len(mi);
  5800. - rates->rate[i].idx = -1;
  5801. - rate_control_set_rates(mp->hw, mi->sta, rates);
  5802. - }
  5803. diff --git a/package/kernel/mac80211/patches/336-mac80211-minstrel_ht-set-default-tx-aggregation-time.patch b/package/kernel/mac80211/patches/336-mac80211-minstrel_ht-set-default-tx-aggregation-time.patch
  5804. deleted file mode 100644
  5805. index 32a2ad6..0000000
  5806. --- a/package/kernel/mac80211/patches/336-mac80211-minstrel_ht-set-default-tx-aggregation-time.patch
  5807. +++ /dev/null
  5808. @@ -1,31 +0,0 @@
  5809. -From: Felix Fietkau <nbd@openwrt.org>
  5810. -Date: Thu, 18 Feb 2016 19:45:33 +0100
  5811. -Subject: [PATCH] mac80211: minstrel_ht: set default tx aggregation timeout to
  5812. - 0
  5813. -
  5814. -The value 5000 was put here with the addition of the timeout field to
  5815. -ieee80211_start_tx_ba_session. It was originally added in mac80211 to
  5816. -save resources for drivers like iwlwifi, which only supports a limited
  5817. -number of concurrent aggregation sessions.
  5818. -
  5819. -Since iwlwifi does not use minstrel_ht and other drivers don't need
  5820. -this, 0 is a better default - especially since there have been
  5821. -recent reports of aggregation setup related issues reproduced with
  5822. -ath9k. This should improve stability without causing any adverse
  5823. -effects.
  5824. -
  5825. -Cc: stable@vger.kernel.org
  5826. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  5827. ----
  5828. -
  5829. ---- a/net/mac80211/rc80211_minstrel_ht.c
  5830. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  5831. -@@ -692,7 +692,7 @@ minstrel_aggr_check(struct ieee80211_sta
  5832. - if (likely(sta->ampdu_mlme.tid_tx[tid]))
  5833. - return;
  5834. -
  5835. -- ieee80211_start_tx_ba_session(pubsta, tid, 5000);
  5836. -+ ieee80211_start_tx_ba_session(pubsta, tid, 0);
  5837. - }
  5838. -
  5839. - static void
  5840. diff --git a/package/kernel/mac80211/patches/337-mac80211-minstrel_ht-fix-a-logic-error-in-RTS-CTS-ha.patch b/package/kernel/mac80211/patches/337-mac80211-minstrel_ht-fix-a-logic-error-in-RTS-CTS-ha.patch
  5841. deleted file mode 100644
  5842. index 229351b..0000000
  5843. --- a/package/kernel/mac80211/patches/337-mac80211-minstrel_ht-fix-a-logic-error-in-RTS-CTS-ha.patch
  5844. +++ /dev/null
  5845. @@ -1,26 +0,0 @@
  5846. -From: Felix Fietkau <nbd@openwrt.org>
  5847. -Date: Wed, 24 Feb 2016 12:03:13 +0100
  5848. -Subject: [PATCH] mac80211: minstrel_ht: fix a logic error in RTS/CTS handling
  5849. -MIME-Version: 1.0
  5850. -Content-Type: text/plain; charset=UTF-8
  5851. -Content-Transfer-Encoding: 8bit
  5852. -
  5853. -RTS/CTS needs to be enabled if the rate is a fallback rate *or* if it's
  5854. -a dual-stream rate and the sta is in dynamic SMPS mode.
  5855. -
  5856. -Fixes: a3ebb4e1b763 ("mac80211: minstrel_ht: handle peers in dynamic SMPS")
  5857. -Reported-by: Matías Richart <mrichart@fing.edu.uy>
  5858. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  5859. ----
  5860. -
  5861. ---- a/net/mac80211/rc80211_minstrel_ht.c
  5862. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  5863. -@@ -872,7 +872,7 @@ minstrel_ht_set_rate(struct minstrel_pri
  5864. - * - if station is in dynamic SMPS (and streams > 1)
  5865. - * - for fallback rates, to increase chances of getting through
  5866. - */
  5867. -- if (offset > 0 &&
  5868. -+ if (offset > 0 ||
  5869. - (mi->sta->smps_mode == IEEE80211_SMPS_DYNAMIC &&
  5870. - group->streams > 1)) {
  5871. - ratetbl->rate[offset].count = ratetbl->rate[offset].count_rts;
  5872. diff --git a/package/kernel/mac80211/patches/338-mac80211-Fix-Public-Action-frame-RX-in-AP-mode.patch b/package/kernel/mac80211/patches/338-mac80211-Fix-Public-Action-frame-RX-in-AP-mode.patch
  5873. deleted file mode 100644
  5874. index 56cd94a..0000000
  5875. --- a/package/kernel/mac80211/patches/338-mac80211-Fix-Public-Action-frame-RX-in-AP-mode.patch
  5876. +++ /dev/null
  5877. @@ -1,35 +0,0 @@
  5878. -From: Jouni Malinen <jouni@qca.qualcomm.com>
  5879. -Date: Tue, 1 Mar 2016 00:29:00 +0200
  5880. -Subject: [PATCH] mac80211: Fix Public Action frame RX in AP mode
  5881. -
  5882. -Public Action frames use special rules for how the BSSID field (Address
  5883. -3) is set. A wildcard BSSID is used in cases where the transmitter and
  5884. -recipient are not members of the same BSS. As such, we need to accept
  5885. -Public Action frames with wildcard BSSID.
  5886. -
  5887. -Commit db8e17324553 ("mac80211: ignore frames between TDLS peers when
  5888. -operating as AP") added a rule that drops Action frames to TDLS-peers
  5889. -based on an Action frame having different DA (Address 1) and BSSID
  5890. -(Address 3) values. This is not correct since it misses the possibility
  5891. -of BSSID being a wildcard BSSID in which case the Address 1 would not
  5892. -necessarily match.
  5893. -
  5894. -Fix this by allowing mac80211 to accept wildcard BSSID in an Action
  5895. -frame when in AP mode.
  5896. -
  5897. -Fixes: db8e17324553 ("mac80211: ignore frames between TDLS peers when operating as AP")
  5898. -Cc: stable@vger.kernel.org
  5899. -Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
  5900. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  5901. ----
  5902. -
  5903. ---- a/net/mac80211/rx.c
  5904. -+++ b/net/mac80211/rx.c
  5905. -@@ -3374,6 +3374,7 @@ static bool ieee80211_accept_frame(struc
  5906. - return false;
  5907. - /* ignore action frames to TDLS-peers */
  5908. - if (ieee80211_is_action(hdr->frame_control) &&
  5909. -+ !is_broadcast_ether_addr(bssid) &&
  5910. - !ether_addr_equal(bssid, hdr->addr1))
  5911. - return false;
  5912. - }
  5913. diff --git a/package/kernel/mac80211/patches/339-cfg80211-add-radiotap-VHT-info-to-rtap_namespace_siz.patch b/package/kernel/mac80211/patches/339-cfg80211-add-radiotap-VHT-info-to-rtap_namespace_siz.patch
  5914. deleted file mode 100644
  5915. index 15d6cd0..0000000
  5916. --- a/package/kernel/mac80211/patches/339-cfg80211-add-radiotap-VHT-info-to-rtap_namespace_siz.patch
  5917. +++ /dev/null
  5918. @@ -1,21 +0,0 @@
  5919. -From: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  5920. -Date: Fri, 19 Feb 2016 11:43:04 +0100
  5921. -Subject: [PATCH] cfg80211: add radiotap VHT info to rtap_namespace_sizes
  5922. -
  5923. -Add IEEE80211_RADIOTAP_VHT entry to rtap_namespace_sizes array in order to
  5924. -define alignment and size of VHT info in tx radiotap
  5925. -
  5926. -Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  5927. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  5928. ----
  5929. -
  5930. ---- a/net/wireless/radiotap.c
  5931. -+++ b/net/wireless/radiotap.c
  5932. -@@ -43,6 +43,7 @@ static const struct radiotap_align_size
  5933. - [IEEE80211_RADIOTAP_DATA_RETRIES] = { .align = 1, .size = 1, },
  5934. - [IEEE80211_RADIOTAP_MCS] = { .align = 1, .size = 3, },
  5935. - [IEEE80211_RADIOTAP_AMPDU_STATUS] = { .align = 4, .size = 8, },
  5936. -+ [IEEE80211_RADIOTAP_VHT] = { .align = 2, .size = 12, },
  5937. - /*
  5938. - * add more here as they are defined in radiotap.h
  5939. - */
  5940. diff --git a/package/kernel/mac80211/patches/340-mac80211-fix-parsing-of-40Mhz-in-injected-radiotap-h.patch b/package/kernel/mac80211/patches/340-mac80211-fix-parsing-of-40Mhz-in-injected-radiotap-h.patch
  5941. deleted file mode 100644
  5942. index de1b386..0000000
  5943. --- a/package/kernel/mac80211/patches/340-mac80211-fix-parsing-of-40Mhz-in-injected-radiotap-h.patch
  5944. +++ /dev/null
  5945. @@ -1,36 +0,0 @@
  5946. -From: Sven Eckelmann <sven@narfation.org>
  5947. -Date: Wed, 24 Feb 2016 16:25:49 +0100
  5948. -Subject: [PATCH] mac80211: fix parsing of 40Mhz in injected radiotap
  5949. - header
  5950. -
  5951. -The MCS bandwidth part of the radiotap header is 2 bits wide. The full 2
  5952. -bit have to compared against IEEE80211_RADIOTAP_MCS_BW_40 and not only if
  5953. -the first bit is set. Otherwise IEEE80211_RADIOTAP_MCS_BW_40 can be
  5954. -confused with IEEE80211_RADIOTAP_MCS_BW_20U.
  5955. -
  5956. -Fixes: 5ec3aed9ba4c ("mac80211: Parse legacy and HT rate in injected frames")
  5957. -Signed-off-by: Sven Eckelmann <sven@narfation.org>
  5958. ----
  5959. -
  5960. ---- a/net/mac80211/tx.c
  5961. -+++ b/net/mac80211/tx.c
  5962. -@@ -1689,7 +1689,7 @@ static bool ieee80211_parse_tx_radiotap(
  5963. - bool rate_found = false;
  5964. - u8 rate_retries = 0;
  5965. - u16 rate_flags = 0;
  5966. -- u8 mcs_known, mcs_flags;
  5967. -+ u8 mcs_known, mcs_flags, mcs_bw;
  5968. - int i;
  5969. -
  5970. - info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
  5971. -@@ -1765,8 +1765,9 @@ static bool ieee80211_parse_tx_radiotap(
  5972. - mcs_flags & IEEE80211_RADIOTAP_MCS_SGI)
  5973. - rate_flags |= IEEE80211_TX_RC_SHORT_GI;
  5974. -
  5975. -+ mcs_bw = mcs_flags & IEEE80211_RADIOTAP_MCS_BW_MASK;
  5976. - if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_BW &&
  5977. -- mcs_flags & IEEE80211_RADIOTAP_MCS_BW_40)
  5978. -+ mcs_bw == IEEE80211_RADIOTAP_MCS_BW_40)
  5979. - rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
  5980. - break;
  5981. -
  5982. diff --git a/package/kernel/mac80211/patches/341-mac80211-parse-VHT-info-in-injected-frames.patch b/package/kernel/mac80211/patches/341-mac80211-parse-VHT-info-in-injected-frames.patch
  5983. deleted file mode 100644
  5984. index ac1f251..0000000
  5985. --- a/package/kernel/mac80211/patches/341-mac80211-parse-VHT-info-in-injected-frames.patch
  5986. +++ /dev/null
  5987. @@ -1,65 +0,0 @@
  5988. -From: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  5989. -Date: Tue, 23 Feb 2016 15:43:35 +0100
  5990. -Subject: [PATCH] mac80211: parse VHT info in injected frames
  5991. -
  5992. -Add VHT radiotap parsing support to ieee80211_parse_tx_radiotap().
  5993. -That capability has been tested using a d-link dir-860l rev b1 running
  5994. -OpenWrt trunk and mt76 driver
  5995. -
  5996. -Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  5997. ----
  5998. -
  5999. ---- a/net/mac80211/tx.c
  6000. -+++ b/net/mac80211/tx.c
  6001. -@@ -1690,6 +1690,8 @@ static bool ieee80211_parse_tx_radiotap(
  6002. - u8 rate_retries = 0;
  6003. - u16 rate_flags = 0;
  6004. - u8 mcs_known, mcs_flags, mcs_bw;
  6005. -+ u16 vht_known;
  6006. -+ u8 vht_mcs = 0, vht_nss = 0;
  6007. - int i;
  6008. -
  6009. - info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
  6010. -@@ -1771,6 +1773,32 @@ static bool ieee80211_parse_tx_radiotap(
  6011. - rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
  6012. - break;
  6013. -
  6014. -+ case IEEE80211_RADIOTAP_VHT:
  6015. -+ vht_known = get_unaligned_le16(iterator.this_arg);
  6016. -+ rate_found = true;
  6017. -+
  6018. -+ rate_flags = IEEE80211_TX_RC_VHT_MCS;
  6019. -+ if ((vht_known & IEEE80211_RADIOTAP_VHT_KNOWN_GI) &&
  6020. -+ (iterator.this_arg[2] &
  6021. -+ IEEE80211_RADIOTAP_VHT_FLAG_SGI))
  6022. -+ rate_flags |= IEEE80211_TX_RC_SHORT_GI;
  6023. -+ if (vht_known &
  6024. -+ IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH) {
  6025. -+ if (iterator.this_arg[3] == 1)
  6026. -+ rate_flags |=
  6027. -+ IEEE80211_TX_RC_40_MHZ_WIDTH;
  6028. -+ else if (iterator.this_arg[3] == 4)
  6029. -+ rate_flags |=
  6030. -+ IEEE80211_TX_RC_80_MHZ_WIDTH;
  6031. -+ else if (iterator.this_arg[3] == 11)
  6032. -+ rate_flags |=
  6033. -+ IEEE80211_TX_RC_160_MHZ_WIDTH;
  6034. -+ }
  6035. -+
  6036. -+ vht_mcs = iterator.this_arg[4] >> 4;
  6037. -+ vht_nss = iterator.this_arg[4] & 0xF;
  6038. -+ break;
  6039. -+
  6040. - /*
  6041. - * Please update the file
  6042. - * Documentation/networking/mac80211-injection.txt
  6043. -@@ -1796,6 +1824,9 @@ static bool ieee80211_parse_tx_radiotap(
  6044. -
  6045. - if (rate_flags & IEEE80211_TX_RC_MCS) {
  6046. - info->control.rates[0].idx = rate;
  6047. -+ } else if (rate_flags & IEEE80211_TX_RC_VHT_MCS) {
  6048. -+ ieee80211_rate_set_vht(info->control.rates, vht_mcs,
  6049. -+ vht_nss);
  6050. - } else {
  6051. - for (i = 0; i < sband->n_bitrates; i++) {
  6052. - if (rate * 5 != sband->bitrates[i].bitrate)
  6053. diff --git a/package/kernel/mac80211/patches/342-mac80211-do-not-pass-injected-frames-without-a-valid.patch b/package/kernel/mac80211/patches/342-mac80211-do-not-pass-injected-frames-without-a-valid.patch
  6054. deleted file mode 100644
  6055. index d7452c2..0000000
  6056. --- a/package/kernel/mac80211/patches/342-mac80211-do-not-pass-injected-frames-without-a-valid.patch
  6057. +++ /dev/null
  6058. @@ -1,23 +0,0 @@
  6059. -From: Felix Fietkau <nbd@openwrt.org>
  6060. -Date: Wed, 2 Mar 2016 15:51:40 +0100
  6061. -Subject: [PATCH] mac80211: do not pass injected frames without a valid rate to
  6062. - the driver
  6063. -
  6064. -Fall back to rate control if the requested bitrate was not found.
  6065. -
  6066. -Fixes: dfdfc2beb0dd ("mac80211: Parse legacy and HT rate in injected frames")
  6067. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  6068. ----
  6069. -
  6070. ---- a/net/mac80211/tx.c
  6071. -+++ b/net/mac80211/tx.c
  6072. -@@ -1837,6 +1837,9 @@ static bool ieee80211_parse_tx_radiotap(
  6073. - }
  6074. - }
  6075. -
  6076. -+ if (info->control.rates[0].idx < 0)
  6077. -+ info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;
  6078. -+
  6079. - info->control.rates[0].flags = rate_flags;
  6080. - info->control.rates[0].count = min_t(u8, rate_retries + 1,
  6081. - local->hw.max_rate_tries);
  6082. diff --git a/package/kernel/mac80211/patches/343-mac80211-minstrel_ht-improve-sample-rate-skip-logic.patch b/package/kernel/mac80211/patches/343-mac80211-minstrel_ht-improve-sample-rate-skip-logic.patch
  6083. deleted file mode 100644
  6084. index 55ff817..0000000
  6085. --- a/package/kernel/mac80211/patches/343-mac80211-minstrel_ht-improve-sample-rate-skip-logic.patch
  6086. +++ /dev/null
  6087. @@ -1,77 +0,0 @@
  6088. -From: Felix Fietkau <nbd@openwrt.org>
  6089. -Date: Thu, 3 Mar 2016 23:20:06 +0100
  6090. -Subject: [PATCH] mac80211: minstrel_ht: improve sample rate skip logic
  6091. -
  6092. -There were a few issues that were slowing down the process of finding
  6093. -the optimal rate, especially on devices with multi-rate retry
  6094. -limitations:
  6095. -
  6096. -When max_tp_rate[0] was slower than max_tp_rate[1], the code did not
  6097. -sample max_tp_rate[1], which would often allow it to switch places with
  6098. -max_tp_rate[0] (e.g. if only the first sampling attempts were bad, but the
  6099. -rate is otherwise good).
  6100. -
  6101. -Also, sample attempts of rates between max_tp_rate[0] and [1] were being
  6102. -ignored in this case, because the code only checked if the rate was
  6103. -slower than [1].
  6104. -
  6105. -Fix this by checking against the fastest / second fastest max_tp_rate
  6106. -instead of assuming a specific order between the two.
  6107. -
  6108. -In my tests this patch significantly reduces the time until minstrel_ht
  6109. -finds the optimal rate right after assoc
  6110. -
  6111. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  6112. ----
  6113. -
  6114. ---- a/net/mac80211/rc80211_minstrel_ht.c
  6115. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  6116. -@@ -958,6 +958,7 @@ minstrel_get_sample_rate(struct minstrel
  6117. - struct minstrel_rate_stats *mrs;
  6118. - struct minstrel_mcs_group_data *mg;
  6119. - unsigned int sample_dur, sample_group, cur_max_tp_streams;
  6120. -+ int tp_rate1, tp_rate2;
  6121. - int sample_idx = 0;
  6122. -
  6123. - if (mi->sample_wait > 0) {
  6124. -@@ -979,14 +980,22 @@ minstrel_get_sample_rate(struct minstrel
  6125. - mrs = &mg->rates[sample_idx];
  6126. - sample_idx += sample_group * MCS_GROUP_RATES;
  6127. -
  6128. -+ /* Set tp_rate1, tp_rate2 to the highest / second highest max_tp_rate */
  6129. -+ if (minstrel_get_duration(mi->max_tp_rate[0]) >
  6130. -+ minstrel_get_duration(mi->max_tp_rate[1])) {
  6131. -+ tp_rate1 = mi->max_tp_rate[1];
  6132. -+ tp_rate2 = mi->max_tp_rate[0];
  6133. -+ } else {
  6134. -+ tp_rate1 = mi->max_tp_rate[0];
  6135. -+ tp_rate2 = mi->max_tp_rate[1];
  6136. -+ }
  6137. -+
  6138. - /*
  6139. - * Sampling might add some overhead (RTS, no aggregation)
  6140. -- * to the frame. Hence, don't use sampling for the currently
  6141. -- * used rates.
  6142. -+ * to the frame. Hence, don't use sampling for the highest currently
  6143. -+ * used highest throughput or probability rate.
  6144. - */
  6145. -- if (sample_idx == mi->max_tp_rate[0] ||
  6146. -- sample_idx == mi->max_tp_rate[1] ||
  6147. -- sample_idx == mi->max_prob_rate)
  6148. -+ if (sample_idx == mi->max_tp_rate[0] || sample_idx == mi->max_prob_rate)
  6149. - return -1;
  6150. -
  6151. - /*
  6152. -@@ -1001,10 +1010,10 @@ minstrel_get_sample_rate(struct minstrel
  6153. - * if the link is working perfectly.
  6154. - */
  6155. -
  6156. -- cur_max_tp_streams = minstrel_mcs_groups[mi->max_tp_rate[0] /
  6157. -+ cur_max_tp_streams = minstrel_mcs_groups[tp_rate1 /
  6158. - MCS_GROUP_RATES].streams;
  6159. - sample_dur = minstrel_get_duration(sample_idx);
  6160. -- if (sample_dur >= minstrel_get_duration(mi->max_tp_rate[1]) &&
  6161. -+ if (sample_dur >= minstrel_get_duration(tp_rate2) &&
  6162. - (cur_max_tp_streams - 1 <
  6163. - minstrel_mcs_groups[sample_group].streams ||
  6164. - sample_dur >= minstrel_get_duration(mi->max_prob_rate))) {
  6165. diff --git a/package/kernel/mac80211/patches/344-0008-brcmfmac-use-device-memsize-config-from-fw-if-define.patch b/package/kernel/mac80211/patches/344-0008-brcmfmac-use-device-memsize-config-from-fw-if-define.patch
  6166. deleted file mode 100644
  6167. index 3de0f64..0000000
  6168. --- a/package/kernel/mac80211/patches/344-0008-brcmfmac-use-device-memsize-config-from-fw-if-define.patch
  6169. +++ /dev/null
  6170. @@ -1,73 +0,0 @@
  6171. -From: Hante Meuleman <meuleman@broadcom.com>
  6172. -Date: Wed, 17 Feb 2016 11:26:57 +0100
  6173. -Subject: [PATCH] brcmfmac: use device memsize config from fw if defined
  6174. -
  6175. -Newer type pcie devices have memory which get shared between fw and
  6176. -hw. The division of this memory is done firmware compile time. As a
  6177. -result the ramsize as used by driver needs to be adjusted for this.
  6178. -This is done by reading the memory size from the firmware.
  6179. -
  6180. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  6181. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  6182. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  6183. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  6184. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  6185. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6186. ----
  6187. -
  6188. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  6189. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  6190. -@@ -207,6 +207,10 @@ static struct brcmf_firmware_mapping brc
  6191. - #define BRCMF_PCIE_CFGREG_REG_BAR3_CONFIG 0x4F4
  6192. - #define BRCMF_PCIE_LINK_STATUS_CTRL_ASPM_ENAB 3
  6193. -
  6194. -+/* Magic number at a magic location to find RAM size */
  6195. -+#define BRCMF_RAMSIZE_MAGIC 0x534d4152 /* SMAR */
  6196. -+#define BRCMF_RAMSIZE_OFFSET 0x6c
  6197. -+
  6198. -
  6199. - struct brcmf_pcie_console {
  6200. - u32 base_addr;
  6201. -@@ -1412,6 +1416,28 @@ static const struct brcmf_bus_ops brcmf_
  6202. - };
  6203. -
  6204. -
  6205. -+static void
  6206. -+brcmf_pcie_adjust_ramsize(struct brcmf_pciedev_info *devinfo, u8 *data,
  6207. -+ u32 data_len)
  6208. -+{
  6209. -+ __le32 *field;
  6210. -+ u32 newsize;
  6211. -+
  6212. -+ if (data_len < BRCMF_RAMSIZE_OFFSET + 8)
  6213. -+ return;
  6214. -+
  6215. -+ field = (__le32 *)&data[BRCMF_RAMSIZE_OFFSET];
  6216. -+ if (le32_to_cpup(field) != BRCMF_RAMSIZE_MAGIC)
  6217. -+ return;
  6218. -+ field++;
  6219. -+ newsize = le32_to_cpup(field);
  6220. -+
  6221. -+ brcmf_dbg(PCIE, "Found ramsize info in FW, adjusting to 0x%x\n",
  6222. -+ newsize);
  6223. -+ devinfo->ci->ramsize = newsize;
  6224. -+}
  6225. -+
  6226. -+
  6227. - static int
  6228. - brcmf_pcie_init_share_ram_info(struct brcmf_pciedev_info *devinfo,
  6229. - u32 sharedram_addr)
  6230. -@@ -1694,6 +1720,13 @@ static void brcmf_pcie_setup(struct devi
  6231. -
  6232. - brcmf_pcie_attach(devinfo);
  6233. -
  6234. -+ /* Some of the firmwares have the size of the memory of the device
  6235. -+ * defined inside the firmware. This is because part of the memory in
  6236. -+ * the device is shared and the devision is determined by FW. Parse
  6237. -+ * the firmware and adjust the chip memory size now.
  6238. -+ */
  6239. -+ brcmf_pcie_adjust_ramsize(devinfo, (u8 *)fw->data, fw->size);
  6240. -+
  6241. - ret = brcmf_pcie_download_fw_nvram(devinfo, fw, nvram, nvram_len);
  6242. - if (ret)
  6243. - goto fail;
  6244. diff --git a/package/kernel/mac80211/patches/344-0009-brcmfmac-use-bar1-window-size-as-provided-by-pci-sub.patch b/package/kernel/mac80211/patches/344-0009-brcmfmac-use-bar1-window-size-as-provided-by-pci-sub.patch
  6245. deleted file mode 100644
  6246. index ca03ffe..0000000
  6247. --- a/package/kernel/mac80211/patches/344-0009-brcmfmac-use-bar1-window-size-as-provided-by-pci-sub.patch
  6248. +++ /dev/null
  6249. @@ -1,58 +0,0 @@
  6250. -From: Hante Meuleman <meuleman@broadcom.com>
  6251. -Date: Wed, 17 Feb 2016 11:26:58 +0100
  6252. -Subject: [PATCH] brcmfmac: use bar1 window size as provided by pci subsystem
  6253. -
  6254. -The PCIE bar1 window size is specified by chip. Currently the
  6255. -ioremap of bar1 was using a define which always matched the size
  6256. -of bar1, but newer chips can have a different bar1 sizes. With
  6257. -this patch the ioremap will be called with the by chip provided
  6258. -window size.
  6259. -
  6260. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  6261. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  6262. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  6263. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  6264. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  6265. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6266. ----
  6267. -
  6268. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  6269. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  6270. -@@ -72,7 +72,6 @@ static struct brcmf_firmware_mapping brc
  6271. -
  6272. - #define BRCMF_PCIE_FW_UP_TIMEOUT 2000 /* msec */
  6273. -
  6274. --#define BRCMF_PCIE_TCM_MAP_SIZE (4096 * 1024)
  6275. - #define BRCMF_PCIE_REG_MAP_SIZE (32 * 1024)
  6276. -
  6277. - /* backplane addres space accessed by BAR0 */
  6278. -@@ -252,7 +251,6 @@ struct brcmf_pciedev_info {
  6279. - char nvram_name[BRCMF_FW_NAME_LEN];
  6280. - void __iomem *regs;
  6281. - void __iomem *tcm;
  6282. -- u32 tcm_size;
  6283. - u32 ram_base;
  6284. - u32 ram_size;
  6285. - struct brcmf_chip *ci;
  6286. -@@ -1592,8 +1590,7 @@ static int brcmf_pcie_get_resource(struc
  6287. - }
  6288. -
  6289. - devinfo->regs = ioremap_nocache(bar0_addr, BRCMF_PCIE_REG_MAP_SIZE);
  6290. -- devinfo->tcm = ioremap_nocache(bar1_addr, BRCMF_PCIE_TCM_MAP_SIZE);
  6291. -- devinfo->tcm_size = BRCMF_PCIE_TCM_MAP_SIZE;
  6292. -+ devinfo->tcm = ioremap_nocache(bar1_addr, bar1_size);
  6293. -
  6294. - if (!devinfo->regs || !devinfo->tcm) {
  6295. - brcmf_err("ioremap() failed (%p,%p)\n", devinfo->regs,
  6296. -@@ -1602,8 +1599,9 @@ static int brcmf_pcie_get_resource(struc
  6297. - }
  6298. - brcmf_dbg(PCIE, "Phys addr : reg space = %p base addr %#016llx\n",
  6299. - devinfo->regs, (unsigned long long)bar0_addr);
  6300. -- brcmf_dbg(PCIE, "Phys addr : mem space = %p base addr %#016llx\n",
  6301. -- devinfo->tcm, (unsigned long long)bar1_addr);
  6302. -+ brcmf_dbg(PCIE, "Phys addr : mem space = %p base addr %#016llx size 0x%x\n",
  6303. -+ devinfo->tcm, (unsigned long long)bar1_addr,
  6304. -+ (unsigned int)bar1_size);
  6305. -
  6306. - return 0;
  6307. - }
  6308. diff --git a/package/kernel/mac80211/patches/344-0010-brcmfmac-add-support-for-the-PCIE-4366c0-chip.patch b/package/kernel/mac80211/patches/344-0010-brcmfmac-add-support-for-the-PCIE-4366c0-chip.patch
  6309. deleted file mode 100644
  6310. index e4a8f30..0000000
  6311. --- a/package/kernel/mac80211/patches/344-0010-brcmfmac-add-support-for-the-PCIE-4366c0-chip.patch
  6312. +++ /dev/null
  6313. @@ -1,34 +0,0 @@
  6314. -From: Hante Meuleman <meuleman@broadcom.com>
  6315. -Date: Wed, 17 Feb 2016 11:26:59 +0100
  6316. -Subject: [PATCH] brcmfmac: add support for the PCIE 4366c0 chip
  6317. -
  6318. -A newer version of the 4366 PCIE chip has been released. Add
  6319. -support for this version of the chip.
  6320. -
  6321. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  6322. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  6323. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  6324. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  6325. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6326. ----
  6327. -
  6328. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  6329. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  6330. -@@ -53,6 +53,7 @@ BRCMF_FW_NVRAM_DEF(4358, "brcmfmac4358-p
  6331. - BRCMF_FW_NVRAM_DEF(4359, "brcmfmac4359-pcie.bin", "brcmfmac4359-pcie.txt");
  6332. - BRCMF_FW_NVRAM_DEF(4365B, "brcmfmac4365b-pcie.bin", "brcmfmac4365b-pcie.txt");
  6333. - BRCMF_FW_NVRAM_DEF(4366B, "brcmfmac4366b-pcie.bin", "brcmfmac4366b-pcie.txt");
  6334. -+BRCMF_FW_NVRAM_DEF(4366C, "brcmfmac4366c-pcie.bin", "brcmfmac4366c-pcie.txt");
  6335. - BRCMF_FW_NVRAM_DEF(4371, "brcmfmac4371-pcie.bin", "brcmfmac4371-pcie.txt");
  6336. -
  6337. - static struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = {
  6338. -@@ -66,7 +67,8 @@ static struct brcmf_firmware_mapping brc
  6339. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4358_CHIP_ID, 0xFFFFFFFF, 4358),
  6340. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4359_CHIP_ID, 0xFFFFFFFF, 4359),
  6341. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4365_CHIP_ID, 0xFFFFFFFF, 4365B),
  6342. -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0xFFFFFFFF, 4366B),
  6343. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0x0000000F, 4366B),
  6344. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0xFFFFFFF0, 4366C),
  6345. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4371_CHIP_ID, 0xFFFFFFFF, 4371),
  6346. - };
  6347. -
  6348. diff --git a/package/kernel/mac80211/patches/344-0012-brcmfmac-increase-timeout-for-tx-eapol.patch b/package/kernel/mac80211/patches/344-0012-brcmfmac-increase-timeout-for-tx-eapol.patch
  6349. deleted file mode 100644
  6350. index c529ff2..0000000
  6351. --- a/package/kernel/mac80211/patches/344-0012-brcmfmac-increase-timeout-for-tx-eapol.patch
  6352. +++ /dev/null
  6353. @@ -1,30 +0,0 @@
  6354. -From: Hante Meuleman <meuleman@broadcom.com>
  6355. -Date: Wed, 17 Feb 2016 11:27:01 +0100
  6356. -Subject: [PATCH] brcmfmac: increase timeout for tx eapol
  6357. -
  6358. -When keys get set and updated this has to happen after eapol got
  6359. -transmitted (without key or old key) before the key can be updated.
  6360. -To make sure the order of sending eapol and configuring key is done
  6361. -correctly a timeout for tx of eapol is applied. This timeout is set
  6362. -to 50 msec, which is not always enough. Especially in AP mode and
  6363. -key updates the timeout may need to be much longer because client(s)
  6364. -can be in powersave. Increase the timeout from 50 to 950 msec.
  6365. -
  6366. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  6367. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  6368. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  6369. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  6370. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6371. ----
  6372. -
  6373. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  6374. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  6375. -@@ -40,7 +40,7 @@ MODULE_AUTHOR("Broadcom Corporation");
  6376. - MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver.");
  6377. - MODULE_LICENSE("Dual BSD/GPL");
  6378. -
  6379. --#define MAX_WAIT_FOR_8021X_TX msecs_to_jiffies(50)
  6380. -+#define MAX_WAIT_FOR_8021X_TX msecs_to_jiffies(950)
  6381. -
  6382. - /* AMPDU rx reordering definitions */
  6383. - #define BRCMF_RXREORDER_FLOWID_OFFSET 0
  6384. diff --git a/package/kernel/mac80211/patches/345-brcmfmac-insert-default-boardrev-in-nvram-data-if-mi.patch b/package/kernel/mac80211/patches/345-brcmfmac-insert-default-boardrev-in-nvram-data-if-mi.patch
  6385. deleted file mode 100644
  6386. index f293401..0000000
  6387. --- a/package/kernel/mac80211/patches/345-brcmfmac-insert-default-boardrev-in-nvram-data-if-mi.patch
  6388. +++ /dev/null
  6389. @@ -1,114 +0,0 @@
  6390. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  6391. -Date: Mon, 11 Apr 2016 11:35:23 +0200
  6392. -Subject: [PATCH] brcmfmac: insert default boardrev in nvram data if
  6393. - missing
  6394. -
  6395. -Some nvram files/stores come without the boardrev information,
  6396. -but firmware requires this to be set. When not found in nvram then
  6397. -add a default boardrev string to the nvram data.
  6398. -
  6399. -Reported-by: Rafal Milecki <zajec5@gmail.com>
  6400. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  6401. -Reviewed-by: Franky (Zhenhui) Lin <franky.lin@broadcom.com>
  6402. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  6403. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  6404. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  6405. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6406. ----
  6407. -
  6408. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  6409. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  6410. -@@ -29,6 +29,7 @@
  6411. - #define BRCMF_FW_MAX_NVRAM_SIZE 64000
  6412. - #define BRCMF_FW_NVRAM_DEVPATH_LEN 19 /* devpath0=pcie/1/4/ */
  6413. - #define BRCMF_FW_NVRAM_PCIEDEV_LEN 10 /* pcie/1/4/ + \0 */
  6414. -+#define BRCMF_FW_DEFAULT_BOARDREV "boardrev=0xff"
  6415. -
  6416. - enum nvram_parser_state {
  6417. - IDLE,
  6418. -@@ -51,6 +52,7 @@ enum nvram_parser_state {
  6419. - * @entry: start position of key,value entry.
  6420. - * @multi_dev_v1: detect pcie multi device v1 (compressed).
  6421. - * @multi_dev_v2: detect pcie multi device v2.
  6422. -+ * @boardrev_found: nvram contains boardrev information.
  6423. - */
  6424. - struct nvram_parser {
  6425. - enum nvram_parser_state state;
  6426. -@@ -63,6 +65,7 @@ struct nvram_parser {
  6427. - u32 entry;
  6428. - bool multi_dev_v1;
  6429. - bool multi_dev_v2;
  6430. -+ bool boardrev_found;
  6431. - };
  6432. -
  6433. - /**
  6434. -@@ -125,6 +128,8 @@ static enum nvram_parser_state brcmf_nvr
  6435. - nvp->multi_dev_v1 = true;
  6436. - if (strncmp(&nvp->data[nvp->entry], "pcie/", 5) == 0)
  6437. - nvp->multi_dev_v2 = true;
  6438. -+ if (strncmp(&nvp->data[nvp->entry], "boardrev", 8) == 0)
  6439. -+ nvp->boardrev_found = true;
  6440. - } else if (!is_nvram_char(c) || c == ' ') {
  6441. - brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n",
  6442. - nvp->line, nvp->column);
  6443. -@@ -284,6 +289,8 @@ static void brcmf_fw_strip_multi_v1(stru
  6444. - while (i < nvp->nvram_len) {
  6445. - if ((nvp->nvram[i] - '0' == id) && (nvp->nvram[i + 1] == ':')) {
  6446. - i += 2;
  6447. -+ if (strncmp(&nvp->nvram[i], "boardrev", 8) == 0)
  6448. -+ nvp->boardrev_found = true;
  6449. - while (nvp->nvram[i] != 0) {
  6450. - nvram[j] = nvp->nvram[i];
  6451. - i++;
  6452. -@@ -335,6 +342,8 @@ static void brcmf_fw_strip_multi_v2(stru
  6453. - while (i < nvp->nvram_len - len) {
  6454. - if (strncmp(&nvp->nvram[i], prefix, len) == 0) {
  6455. - i += len;
  6456. -+ if (strncmp(&nvp->nvram[i], "boardrev", 8) == 0)
  6457. -+ nvp->boardrev_found = true;
  6458. - while (nvp->nvram[i] != 0) {
  6459. - nvram[j] = nvp->nvram[i];
  6460. - i++;
  6461. -@@ -356,6 +365,18 @@ fail:
  6462. - nvp->nvram_len = 0;
  6463. - }
  6464. -
  6465. -+static void brcmf_fw_add_defaults(struct nvram_parser *nvp)
  6466. -+{
  6467. -+ if (nvp->boardrev_found)
  6468. -+ return;
  6469. -+
  6470. -+ memcpy(&nvp->nvram[nvp->nvram_len], &BRCMF_FW_DEFAULT_BOARDREV,
  6471. -+ strlen(BRCMF_FW_DEFAULT_BOARDREV));
  6472. -+ nvp->nvram_len += strlen(BRCMF_FW_DEFAULT_BOARDREV);
  6473. -+ nvp->nvram[nvp->nvram_len] = '\0';
  6474. -+ nvp->nvram_len++;
  6475. -+}
  6476. -+
  6477. - /* brcmf_nvram_strip :Takes a buffer of "<var>=<value>\n" lines read from a fil
  6478. - * and ending in a NUL. Removes carriage returns, empty lines, comment lines,
  6479. - * and converts newlines to NULs. Shortens buffer as needed and pads with NULs.
  6480. -@@ -377,16 +398,21 @@ static void *brcmf_fw_nvram_strip(const
  6481. - if (nvp.state == END)
  6482. - break;
  6483. - }
  6484. -- if (nvp.multi_dev_v1)
  6485. -+ if (nvp.multi_dev_v1) {
  6486. -+ nvp.boardrev_found = false;
  6487. - brcmf_fw_strip_multi_v1(&nvp, domain_nr, bus_nr);
  6488. -- else if (nvp.multi_dev_v2)
  6489. -+ } else if (nvp.multi_dev_v2) {
  6490. -+ nvp.boardrev_found = false;
  6491. - brcmf_fw_strip_multi_v2(&nvp, domain_nr, bus_nr);
  6492. -+ }
  6493. -
  6494. - if (nvp.nvram_len == 0) {
  6495. - kfree(nvp.nvram);
  6496. - return NULL;
  6497. - }
  6498. -
  6499. -+ brcmf_fw_add_defaults(&nvp);
  6500. -+
  6501. - pad = nvp.nvram_len;
  6502. - *new_length = roundup(nvp.nvram_len + 1, 4);
  6503. - while (pad != *new_length) {
  6504. diff --git a/package/kernel/mac80211/patches/402-ath_regd_optional.patch b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  6505. index 7351353..4634283 100644
  6506. --- a/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  6507. +++ b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  6508. @@ -8,7 +8,7 @@
  6509. + return;
  6510. +#endif
  6511. +
  6512. - for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
  6513. + for (band = 0; band < NUM_NL80211_BANDS; band++) {
  6514. if (!wiphy->bands[band])
  6515. continue;
  6516. @@ -374,6 +378,10 @@ ath_reg_apply_ir_flags(struct wiphy *wip
  6517. @@ -19,7 +19,7 @@
  6518. + return;
  6519. +#endif
  6520. +
  6521. - sband = wiphy->bands[IEEE80211_BAND_2GHZ];
  6522. + sband = wiphy->bands[NL80211_BAND_2GHZ];
  6523. if (!sband)
  6524. return;
  6525. @@ -402,6 +410,10 @@ static void ath_reg_apply_radar_flags(st
  6526. @@ -30,7 +30,7 @@
  6527. + return;
  6528. +#endif
  6529. +
  6530. - if (!wiphy->bands[IEEE80211_BAND_5GHZ])
  6531. + if (!wiphy->bands[NL80211_BAND_5GHZ])
  6532. return;
  6533. @@ -633,6 +645,11 @@ ath_regd_init_wiphy(struct ath_regulator
  6534. @@ -59,7 +59,7 @@
  6535. ---help---
  6536. --- a/.local-symbols
  6537. +++ b/.local-symbols
  6538. -@@ -125,6 +125,7 @@ ADM8211=
  6539. +@@ -127,6 +127,7 @@ ADM8211=
  6540. ATH_COMMON=
  6541. WLAN_VENDOR_ATH=
  6542. ATH_DEBUG=
  6543. 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
  6544. index 1a62484..819e64f 100644
  6545. --- a/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
  6546. +++ b/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
  6547. @@ -1,6 +1,6 @@
  6548. --- a/drivers/net/wireless/ath/ath9k/init.c
  6549. +++ b/drivers/net/wireless/ath/ath9k/init.c
  6550. -@@ -722,6 +722,7 @@ static const struct ieee80211_iface_limi
  6551. +@@ -728,6 +728,7 @@ static const struct ieee80211_iface_limi
  6552. BIT(NL80211_IFTYPE_AP) },
  6553. { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  6554. BIT(NL80211_IFTYPE_P2P_GO) },
  6555. diff --git a/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch b/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch
  6556. index a7f9d9f..4b6da97 100644
  6557. --- a/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch
  6558. +++ b/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch
  6559. @@ -1,6 +1,6 @@
  6560. --- a/drivers/net/wireless/ath/ath9k/debug.c
  6561. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  6562. -@@ -1301,6 +1301,53 @@ void ath9k_deinit_debug(struct ath_softc
  6563. +@@ -1319,6 +1319,53 @@ void ath9k_deinit_debug(struct ath_softc
  6564. ath9k_cmn_spectral_deinit_debug(&sc->spec_priv);
  6565. }
  6566. @@ -54,7 +54,7 @@
  6567. int ath9k_init_debug(struct ath_hw *ah)
  6568. {
  6569. struct ath_common *common = ath9k_hw_common(ah);
  6570. -@@ -1320,6 +1367,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  6571. +@@ -1338,6 +1385,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  6572. ath9k_tx99_init_debug(sc);
  6573. ath9k_cmn_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy);
  6574. diff --git a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  6575. index 5892c3e..1825d77 100644
  6576. --- a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  6577. +++ b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  6578. @@ -1,6 +1,6 @@
  6579. --- a/drivers/net/wireless/ath/ath9k/init.c
  6580. +++ b/drivers/net/wireless/ath/ath9k/init.c
  6581. -@@ -1024,23 +1024,23 @@ static int __init ath9k_init(void)
  6582. +@@ -1030,23 +1030,23 @@ static int __init ath9k_init(void)
  6583. {
  6584. int error;
  6585. diff --git a/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch b/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
  6586. index 5ecf528..a105d40 100644
  6587. --- a/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
  6588. +++ b/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
  6589. @@ -1,6 +1,6 @@
  6590. --- a/drivers/net/wireless/ath/ath9k/debug.c
  6591. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  6592. -@@ -1348,6 +1348,52 @@ static const struct file_operations fops
  6593. +@@ -1366,6 +1366,52 @@ static const struct file_operations fops
  6594. .owner = THIS_MODULE
  6595. };
  6596. @@ -53,7 +53,7 @@
  6597. int ath9k_init_debug(struct ath_hw *ah)
  6598. {
  6599. struct ath_common *common = ath9k_hw_common(ah);
  6600. -@@ -1369,6 +1415,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  6601. +@@ -1387,6 +1433,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  6602. debugfs_create_file("eeprom", S_IRUSR, sc->debug.debugfs_phy, sc,
  6603. &fops_eeprom);
  6604. @@ -90,7 +90,7 @@
  6605. ichan->channel = chan->center_freq;
  6606. ichan->chan = chan;
  6607. @@ -308,7 +310,19 @@ static void ath9k_cmn_update_ichannel(st
  6608. - if (chan->band == IEEE80211_BAND_5GHZ)
  6609. + if (chan->band == NL80211_BAND_5GHZ)
  6610. flags |= CHANNEL_5GHZ;
  6611. - switch (chandef->width) {
  6612. diff --git a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  6613. index c84d1bc..167eeff 100644
  6614. --- a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  6615. +++ b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  6616. @@ -20,7 +20,7 @@
  6617. #define AR9160_DEVID_PCI 0x0027
  6618. --- a/drivers/net/wireless/ath/ath9k/pci.c
  6619. +++ b/drivers/net/wireless/ath/ath9k/pci.c
  6620. -@@ -751,6 +751,7 @@ static const struct pci_device_id ath_pc
  6621. +@@ -761,6 +761,7 @@ static const struct pci_device_id ath_pc
  6622. .driver_data = ATH9K_PCI_BT_ANT_DIV },
  6623. #endif
  6624. diff --git a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  6625. index e151a12..28f5dcc 100644
  6626. --- a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  6627. +++ b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  6628. @@ -1,6 +1,6 @@
  6629. --- a/include/net/cfg80211.h
  6630. +++ b/include/net/cfg80211.h
  6631. -@@ -2363,6 +2363,7 @@ struct cfg80211_qos_map {
  6632. +@@ -2406,6 +2406,7 @@ struct cfg80211_qos_map {
  6633. * (as advertised by the nl80211 feature flag.)
  6634. * @get_tx_power: store the current TX power into the dbm variable;
  6635. * return 0 if successful
  6636. @@ -8,7 +8,7 @@
  6637. *
  6638. * @set_wds_peer: set the WDS peer for a WDS interface
  6639. *
  6640. -@@ -2624,6 +2625,7 @@ struct cfg80211_ops {
  6641. +@@ -2667,6 +2668,7 @@ struct cfg80211_ops {
  6642. enum nl80211_tx_power_setting type, int mbm);
  6643. int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
  6644. int *dbm);
  6645. @@ -18,7 +18,7 @@
  6646. const u8 *addr);
  6647. --- a/include/net/mac80211.h
  6648. +++ b/include/net/mac80211.h
  6649. -@@ -1286,6 +1286,7 @@ enum ieee80211_smps_mode {
  6650. +@@ -1305,6 +1305,7 @@ enum ieee80211_smps_mode {
  6651. *
  6652. * @power_level: requested transmit power (in dBm), backward compatibility
  6653. * value only that is set to the minimum of all interfaces
  6654. @@ -26,7 +26,7 @@
  6655. *
  6656. * @chandef: the channel definition to tune to
  6657. * @radar_enabled: whether radar detection is enabled
  6658. -@@ -1306,6 +1307,7 @@ enum ieee80211_smps_mode {
  6659. +@@ -1325,6 +1326,7 @@ enum ieee80211_smps_mode {
  6660. struct ieee80211_conf {
  6661. u32 flags;
  6662. int power_level, dynamic_ps_timeout;
  6663. @@ -36,9 +36,9 @@
  6664. u8 ps_dtim_period;
  6665. --- a/include/uapi/linux/nl80211.h
  6666. +++ b/include/uapi/linux/nl80211.h
  6667. -@@ -1790,6 +1790,9 @@ enum nl80211_commands {
  6668. - * between scans. The scan plans are executed sequentially.
  6669. - * Each scan plan is a nested attribute of &enum nl80211_sched_scan_plan.
  6670. +@@ -1819,6 +1819,9 @@ enum nl80211_commands {
  6671. + *
  6672. + * @NL80211_ATTR_PAD: attribute used for padding for 64-bit alignment
  6673. *
  6674. + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
  6675. + * transmit power to stay within regulatory limits. u32, dBi.
  6676. @@ -46,9 +46,9 @@
  6677. * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  6678. * @NL80211_ATTR_MAX: highest attribute number currently defined
  6679. * @__NL80211_ATTR_AFTER_LAST: internal use
  6680. -@@ -2164,6 +2167,8 @@ enum nl80211_attrs {
  6681. - NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS,
  6682. - NL80211_ATTR_SCHED_SCAN_PLANS,
  6683. +@@ -2201,6 +2204,8 @@ enum nl80211_attrs {
  6684. +
  6685. + NL80211_ATTR_PAD,
  6686. + NL80211_ATTR_WIPHY_ANTENNA_GAIN,
  6687. +
  6688. @@ -57,7 +57,7 @@
  6689. __NL80211_ATTR_AFTER_LAST,
  6690. --- a/net/mac80211/cfg.c
  6691. +++ b/net/mac80211/cfg.c
  6692. -@@ -2229,6 +2229,19 @@ static int ieee80211_get_tx_power(struct
  6693. +@@ -2238,6 +2238,19 @@ static int ieee80211_get_tx_power(struct
  6694. return 0;
  6695. }
  6696. @@ -77,7 +77,7 @@
  6697. static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev,
  6698. const u8 *addr)
  6699. {
  6700. -@@ -3403,6 +3416,7 @@ const struct cfg80211_ops mac80211_confi
  6701. +@@ -3412,6 +3425,7 @@ const struct cfg80211_ops mac80211_confi
  6702. .set_wiphy_params = ieee80211_set_wiphy_params,
  6703. .set_tx_power = ieee80211_set_tx_power,
  6704. .get_tx_power = ieee80211_get_tx_power,
  6705. @@ -87,7 +87,7 @@
  6706. CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd)
  6707. --- a/net/mac80211/ieee80211_i.h
  6708. +++ b/net/mac80211/ieee80211_i.h
  6709. -@@ -1318,6 +1318,7 @@ struct ieee80211_local {
  6710. +@@ -1322,6 +1322,7 @@ struct ieee80211_local {
  6711. int dynamic_ps_forced_timeout;
  6712. int user_power_level; /* in dBm, for all interfaces */
  6713. @@ -119,7 +119,7 @@
  6714. if (local->hw.conf.power_level != power) {
  6715. changed |= IEEE80211_CONF_CHANGE_POWER;
  6716. local->hw.conf.power_level = power;
  6717. -@@ -586,6 +592,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
  6718. +@@ -588,6 +594,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
  6719. IEEE80211_RADIOTAP_MCS_HAVE_BW;
  6720. local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI |
  6721. IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH;
  6722. @@ -129,15 +129,15 @@
  6723. local->user_power_level = IEEE80211_UNSET_POWER_LEVEL;
  6724. --- a/net/wireless/nl80211.c
  6725. +++ b/net/wireless/nl80211.c
  6726. -@@ -403,6 +403,7 @@ static const struct nla_policy nl80211_p
  6727. - [NL80211_ATTR_NETNS_FD] = { .type = NLA_U32 },
  6728. - [NL80211_ATTR_SCHED_SCAN_DELAY] = { .type = NLA_U32 },
  6729. - [NL80211_ATTR_REG_INDOOR] = { .type = NLA_FLAG },
  6730. +@@ -406,6 +406,7 @@ static const struct nla_policy nl80211_p
  6731. + [NL80211_ATTR_PBSS] = { .type = NLA_FLAG },
  6732. + [NL80211_ATTR_BSS_SELECT] = { .type = NLA_NESTED },
  6733. + [NL80211_ATTR_STA_SUPPORT_P2P_PS] = { .type = NLA_U8 },
  6734. + [NL80211_ATTR_WIPHY_ANTENNA_GAIN] = { .type = NLA_U32 },
  6735. };
  6736. /* policy for the key attributes */
  6737. -@@ -2220,6 +2221,20 @@ static int nl80211_set_wiphy(struct sk_b
  6738. +@@ -2251,6 +2252,20 @@ static int nl80211_set_wiphy(struct sk_b
  6739. if (result)
  6740. return result;
  6741. }
  6742. diff --git a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  6743. index 5a5e464..6001266 100644
  6744. --- a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  6745. +++ b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  6746. @@ -1,16 +1,16 @@
  6747. --- a/drivers/net/wireless/ath/ath9k/ath9k.h
  6748. +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  6749. -@@ -814,6 +814,9 @@ static inline int ath9k_dump_btcoex(stru
  6750. +@@ -813,6 +813,9 @@ static inline int ath9k_dump_btcoex(stru
  6751. + #ifdef CPTCFG_MAC80211_LEDS
  6752. void ath_init_leds(struct ath_softc *sc);
  6753. void ath_deinit_leds(struct ath_softc *sc);
  6754. - void ath_fill_led_pin(struct ath_softc *sc);
  6755. +int ath_create_gpio_led(struct ath_softc *sc, int gpio, const char *name,
  6756. -+ const char *trigger, bool active_low);
  6757. ++ const char *trigger, bool active_low);
  6758. +
  6759. #else
  6760. static inline void ath_init_leds(struct ath_softc *sc)
  6761. {
  6762. -@@ -953,6 +956,13 @@ void ath_ant_comb_scan(struct ath_softc
  6763. +@@ -949,6 +952,13 @@ void ath_ant_comb_scan(struct ath_softc
  6764. #define ATH9K_NUM_CHANCTX 2 /* supports 2 operating channels */
  6765. @@ -24,7 +24,7 @@
  6766. struct ath_softc {
  6767. struct ieee80211_hw *hw;
  6768. struct device *dev;
  6769. -@@ -1005,9 +1015,8 @@ struct ath_softc {
  6770. +@@ -1001,9 +1011,8 @@ struct ath_softc {
  6771. spinlock_t chan_lock;
  6772. #ifdef CPTCFG_MAC80211_LEDS
  6773. @@ -38,24 +38,33 @@
  6774. #ifdef CPTCFG_ATH9K_DEBUGFS
  6775. --- a/drivers/net/wireless/ath/ath9k/gpio.c
  6776. +++ b/drivers/net/wireless/ath/ath9k/gpio.c
  6777. -@@ -24,45 +24,102 @@
  6778. - static void ath_led_brightness(struct led_classdev *led_cdev,
  6779. - enum led_brightness brightness)
  6780. +@@ -22,7 +22,7 @@
  6781. +
  6782. + #ifdef CPTCFG_MAC80211_LEDS
  6783. +
  6784. +-void ath_fill_led_pin(struct ath_softc *sc)
  6785. ++static void ath_fill_led_pin(struct ath_softc *sc)
  6786. {
  6787. -- struct ath_softc *sc = container_of(led_cdev, struct ath_softc, led_cdev);
  6788. -- u32 val = (brightness == LED_OFF);
  6789. + struct ath_hw *ah = sc->sc_ah;
  6790. +
  6791. +@@ -39,61 +39,111 @@ void ath_fill_led_pin(struct ath_softc *
  6792. + else
  6793. + ah->led_pin = ATH_LED_PIN_DEF;
  6794. + }
  6795. ++}
  6796. ++
  6797. ++static void ath_led_brightness(struct led_classdev *led_cdev,
  6798. ++ enum led_brightness brightness)
  6799. ++{
  6800. + struct ath_led *led = container_of(led_cdev, struct ath_led, cdev);
  6801. + struct ath_softc *sc = led->sc;
  6802. -
  6803. -- if (sc->sc_ah->config.led_active_high)
  6804. -- val = !val;
  6805. ++
  6806. + ath9k_ps_wakeup(sc);
  6807. + ath9k_hw_set_gpio(sc->sc_ah, led->gpio->gpio,
  6808. + (brightness != LED_OFF) ^ led->gpio->active_low);
  6809. + ath9k_ps_restore(sc);
  6810. +}
  6811. -
  6812. -- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val);
  6813. ++
  6814. +static int ath_add_led(struct ath_softc *sc, struct ath_led *led)
  6815. +{
  6816. + const struct gpio_led *gpio = led->gpio;
  6817. @@ -71,30 +80,40 @@
  6818. +
  6819. + led->sc = sc;
  6820. + list_add(&led->list, &sc->leds);
  6821. -+
  6822. -+ /* Configure gpio for output */
  6823. -+ ath9k_hw_cfg_output(sc->sc_ah, gpio->gpio,
  6824. -+ AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  6825. -+
  6826. +
  6827. + /* Configure gpio for output */
  6828. +- ath9k_hw_gpio_request_out(ah, ah->led_pin, "ath9k-led",
  6829. ++ ath9k_hw_gpio_request_out(sc->sc_ah, gpio->gpio, gpio->name,
  6830. + AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  6831. +
  6832. +- /* LED off, active low */
  6833. +- ath9k_hw_set_gpio(ah, ah->led_pin, ah->config.led_active_high ? 0 : 1);
  6834. + /* LED off */
  6835. + ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  6836. +
  6837. + return 0;
  6838. -+}
  6839. -+
  6840. + }
  6841. +
  6842. +-static void ath_led_brightness(struct led_classdev *led_cdev,
  6843. +- enum led_brightness brightness)
  6844. +int ath_create_gpio_led(struct ath_softc *sc, int gpio_num, const char *name,
  6845. + const char *trigger, bool active_low)
  6846. -+{
  6847. + {
  6848. +- struct ath_softc *sc = container_of(led_cdev, struct ath_softc, led_cdev);
  6849. +- u32 val = (brightness == LED_OFF);
  6850. + struct ath_led *led;
  6851. + struct gpio_led *gpio;
  6852. + char *_name;
  6853. + int ret;
  6854. -+
  6855. +
  6856. +- if (sc->sc_ah->config.led_active_high)
  6857. +- val = !val;
  6858. + led = kzalloc(sizeof(*led) + sizeof(*gpio) + strlen(name) + 1,
  6859. + GFP_KERNEL);
  6860. + if (!led)
  6861. + return -ENOMEM;
  6862. -+
  6863. +
  6864. +- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val);
  6865. + led->gpio = gpio = (struct gpio_led *) (led + 1);
  6866. + _name = (char *) (led->gpio + 1);
  6867. +
  6868. @@ -115,15 +134,18 @@
  6869. {
  6870. - if (!sc->led_registered)
  6871. - return;
  6872. -+ struct ath_led *led;
  6873. -
  6874. +-
  6875. - ath_led_brightness(&sc->led_cdev, LED_OFF);
  6876. - led_classdev_unregister(&sc->led_cdev);
  6877. ++ struct ath_led *led;
  6878. +
  6879. +- ath9k_hw_gpio_free(sc->sc_ah, sc->sc_ah->led_pin);
  6880. + while (!list_empty(&sc->leds)) {
  6881. + led = list_first_entry(&sc->leds, struct ath_led, list);
  6882. + list_del(&led->list);
  6883. + ath_led_brightness(&led->cdev, LED_OFF);
  6884. + led_classdev_unregister(&led->cdev);
  6885. ++ ath9k_hw_gpio_free(sc->sc_ah, led->gpio->gpio);
  6886. + kfree(led);
  6887. + }
  6888. }
  6889. @@ -139,6 +161,8 @@
  6890. if (AR_SREV_9100(sc->sc_ah))
  6891. return;
  6892. + ath_fill_led_pin(sc);
  6893. +
  6894. - if (!ath9k_led_blink)
  6895. - sc->led_cdev.default_trigger =
  6896. - ieee80211_get_radio_led_name(sc->hw);
  6897. @@ -159,13 +183,14 @@
  6898. + trigger = ieee80211_get_radio_led_name(sc->hw);
  6899. - sc->led_registered = true;
  6900. -+ ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, !sc->sc_ah->config.led_active_high);
  6901. ++ ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
  6902. ++ !sc->sc_ah->config.led_active_high);
  6903. }
  6904. + #endif
  6905. - void ath_fill_led_pin(struct ath_softc *sc)
  6906. --- a/drivers/net/wireless/ath/ath9k/init.c
  6907. +++ b/drivers/net/wireless/ath/ath9k/init.c
  6908. -@@ -936,7 +936,7 @@ int ath9k_init_device(u16 devid, struct
  6909. +@@ -942,7 +942,7 @@ int ath9k_init_device(u16 devid, struct
  6910. #ifdef CPTCFG_MAC80211_LEDS
  6911. /* must be initialized before ieee80211_register_hw */
  6912. @@ -176,7 +201,7 @@
  6913. #endif
  6914. --- a/drivers/net/wireless/ath/ath9k/debug.c
  6915. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  6916. -@@ -1393,6 +1393,61 @@ static const struct file_operations fops
  6917. +@@ -1411,6 +1411,61 @@ static const struct file_operations fops
  6918. .llseek = default_llseek,
  6919. };
  6920. @@ -238,7 +263,7 @@
  6921. int ath9k_init_debug(struct ath_hw *ah)
  6922. {
  6923. -@@ -1417,6 +1472,10 @@ int ath9k_init_debug(struct ath_hw *ah)
  6924. +@@ -1435,6 +1490,10 @@ int ath9k_init_debug(struct ath_hw *ah)
  6925. &fops_eeprom);
  6926. debugfs_create_file("chanbw", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
  6927. sc, &fops_chanbw);
  6928. diff --git a/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch b/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
  6929. index 7c10ea6..f656697 100644
  6930. --- a/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
  6931. +++ b/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
  6932. @@ -1,6 +1,6 @@
  6933. --- a/include/linux/ath9k_platform.h
  6934. +++ b/include/linux/ath9k_platform.h
  6935. -@@ -41,6 +41,9 @@ struct ath9k_platform_data {
  6936. +@@ -45,6 +45,9 @@ struct ath9k_platform_data {
  6937. int (*external_reset)(void);
  6938. bool use_eeprom;
  6939. @@ -20,7 +20,7 @@
  6940. /********************************/
  6941. /* LED functions */
  6942. -@@ -88,6 +89,24 @@ int ath_create_gpio_led(struct ath_softc
  6943. +@@ -108,6 +109,24 @@ int ath_create_gpio_led(struct ath_softc
  6944. return ret;
  6945. }
  6946. @@ -45,7 +45,7 @@
  6947. void ath_deinit_leds(struct ath_softc *sc)
  6948. {
  6949. struct ath_led *led;
  6950. -@@ -103,8 +122,10 @@ void ath_deinit_leds(struct ath_softc *s
  6951. +@@ -124,8 +143,10 @@ void ath_deinit_leds(struct ath_softc *s
  6952. void ath_init_leds(struct ath_softc *sc)
  6953. {
  6954. @@ -56,10 +56,10 @@
  6955. INIT_LIST_HEAD(&sc->leds);
  6956. -@@ -120,6 +141,12 @@ void ath_init_leds(struct ath_softc *sc)
  6957. - trigger = ieee80211_get_radio_led_name(sc->hw);
  6958. +@@ -144,6 +165,12 @@ void ath_init_leds(struct ath_softc *sc)
  6959. - ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, !sc->sc_ah->config.led_active_high);
  6960. + ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
  6961. + !sc->sc_ah->config.led_active_high);
  6962. +
  6963. + if (!pdata)
  6964. + return;
  6965. @@ -67,5 +67,5 @@
  6966. + for (i = 0; i < pdata->num_leds; i++)
  6967. + ath_create_platform_led(sc, &pdata->leds[i]);
  6968. }
  6969. + #endif
  6970. - void ath_fill_led_pin(struct ath_softc *sc)
  6971. diff --git a/package/kernel/mac80211/patches/532-ath9k_get_led_polarity_from_platform_data.patch b/package/kernel/mac80211/patches/532-ath9k_get_led_polarity_from_platform_data.patch
  6972. index 6d62a2b..986f155 100644
  6973. --- a/package/kernel/mac80211/patches/532-ath9k_get_led_polarity_from_platform_data.patch
  6974. +++ b/package/kernel/mac80211/patches/532-ath9k_get_led_polarity_from_platform_data.patch
  6975. @@ -1,6 +1,6 @@
  6976. --- a/include/linux/ath9k_platform.h
  6977. +++ b/include/linux/ath9k_platform.h
  6978. -@@ -36,6 +36,7 @@ struct ath9k_platform_data {
  6979. +@@ -40,6 +40,7 @@ struct ath9k_platform_data {
  6980. bool tx_gain_buffalo;
  6981. bool disable_2ghz;
  6982. bool disable_5ghz;
  6983. @@ -10,7 +10,7 @@
  6984. int (*external_reset)(void);
  6985. --- a/drivers/net/wireless/ath/ath9k/init.c
  6986. +++ b/drivers/net/wireless/ath/ath9k/init.c
  6987. -@@ -577,6 +577,7 @@ static int ath9k_init_softc(u16 devid, s
  6988. +@@ -581,6 +581,7 @@ static int ath9k_init_softc(u16 devid, s
  6989. ah->external_reset = pdata->external_reset;
  6990. ah->disable_2ghz = pdata->disable_2ghz;
  6991. ah->disable_5ghz = pdata->disable_5ghz;
  6992. diff --git a/package/kernel/mac80211/patches/533-mac80211_correct_4addr_skbsize.patch b/package/kernel/mac80211/patches/533-mac80211_correct_4addr_skbsize.patch
  6993. new file mode 100644
  6994. index 0000000..afd8cca
  6995. --- /dev/null
  6996. +++ b/package/kernel/mac80211/patches/533-mac80211_correct_4addr_skbsize.patch
  6997. @@ -0,0 +1,11 @@
  6998. +--- a/net/wireless/util.c
  6999. ++++ b/net/wireless/util.c
  7000. +@@ -509,7 +509,7 @@ static int __ieee80211_data_to_8023(stru
  7001. + * replace EtherType */
  7002. + hdrlen += ETH_ALEN + 2;
  7003. + else
  7004. +- tmp.h_proto = htons(skb->len);
  7005. ++ tmp.h_proto = htons(skb->len - hdrlen);
  7006. +
  7007. + pskb_pull(skb, hdrlen);
  7008. +
  7009. diff --git a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  7010. index e83c6bf..f4bb0f2 100644
  7011. --- a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  7012. +++ b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  7013. @@ -1,6 +1,6 @@
  7014. --- a/drivers/net/wireless/ath/ath9k/debug.c
  7015. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  7016. -@@ -1449,6 +1449,50 @@ static const struct file_operations fops
  7017. +@@ -1467,6 +1467,50 @@ static const struct file_operations fops
  7018. #endif
  7019. @@ -51,7 +51,7 @@
  7020. int ath9k_init_debug(struct ath_hw *ah)
  7021. {
  7022. struct ath_common *common = ath9k_hw_common(ah);
  7023. -@@ -1476,6 +1520,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  7024. +@@ -1494,6 +1538,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  7025. debugfs_create_file("gpio_led", S_IWUSR,
  7026. sc->debug.debugfs_phy, sc, &fops_gpio_led);
  7027. #endif
  7028. @@ -62,7 +62,7 @@
  7029. debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy,
  7030. --- a/drivers/net/wireless/ath/ath9k/hw.h
  7031. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  7032. -@@ -519,6 +519,12 @@ enum {
  7033. +@@ -520,6 +520,12 @@ enum {
  7034. ATH9K_RESET_COLD,
  7035. };
  7036. @@ -75,7 +75,7 @@
  7037. struct ath9k_hw_version {
  7038. u32 magic;
  7039. u16 devid;
  7040. -@@ -804,6 +810,8 @@ struct ath_hw {
  7041. +@@ -805,6 +811,8 @@ struct ath_hw {
  7042. u32 rfkill_polarity;
  7043. u32 ah_flags;
  7044. @@ -84,7 +84,7 @@
  7045. bool reset_power_on;
  7046. bool htc_reset_init;
  7047. -@@ -1066,6 +1074,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
  7048. +@@ -1067,6 +1075,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
  7049. bool ath9k_hw_check_alive(struct ath_hw *ah);
  7050. bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode);
  7051. @@ -94,7 +94,7 @@
  7052. struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah,
  7053. --- a/drivers/net/wireless/ath/ath9k/hw.c
  7054. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  7055. -@@ -1819,6 +1819,20 @@ u32 ath9k_hw_get_tsf_offset(struct times
  7056. +@@ -1821,6 +1821,20 @@ u32 ath9k_hw_get_tsf_offset(struct times
  7057. }
  7058. EXPORT_SYMBOL(ath9k_hw_get_tsf_offset);
  7059. @@ -115,7 +115,7 @@
  7060. int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
  7061. struct ath9k_hw_cal_data *caldata, bool fastcc)
  7062. {
  7063. -@@ -2027,6 +2041,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  7064. +@@ -2029,6 +2043,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  7065. ar9003_hw_disable_phy_restart(ah);
  7066. ath9k_hw_apply_gpio_override(ah);
  7067. diff --git a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  7068. index d7bb5a1..7da7165 100644
  7069. --- a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  7070. +++ b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  7071. @@ -1,6 +1,6 @@
  7072. --- a/drivers/net/wireless/ath/ath9k/hw.h
  7073. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  7074. -@@ -720,6 +720,7 @@ struct ath_spec_scan {
  7075. +@@ -721,6 +721,7 @@ struct ath_spec_scan {
  7076. * @config_pci_powersave:
  7077. * @calibrate: periodic calibration for NF, ANI, IQ, ADC gain, ADC-DC
  7078. *
  7079. @@ -8,7 +8,7 @@
  7080. * @spectral_scan_config: set parameters for spectral scan and enable/disable it
  7081. * @spectral_scan_trigger: trigger a spectral scan run
  7082. * @spectral_scan_wait: wait for a spectral scan run to finish
  7083. -@@ -742,6 +743,7 @@ struct ath_hw_ops {
  7084. +@@ -743,6 +744,7 @@ struct ath_hw_ops {
  7085. struct ath_hw_antcomb_conf *antconf);
  7086. void (*antdiv_comb_conf_set)(struct ath_hw *ah,
  7087. struct ath_hw_antcomb_conf *antconf);
  7088. @@ -18,7 +18,7 @@
  7089. void (*spectral_scan_trigger)(struct ath_hw *ah);
  7090. --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  7091. +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  7092. -@@ -1998,6 +1998,26 @@ void ar9003_hw_init_rate_txpower(struct
  7093. +@@ -1945,6 +1945,26 @@ void ar9003_hw_init_rate_txpower(struct
  7094. }
  7095. }
  7096. @@ -45,7 +45,7 @@
  7097. void ar9003_hw_attach_phy_ops(struct ath_hw *ah)
  7098. {
  7099. struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
  7100. -@@ -2034,6 +2054,7 @@ void ar9003_hw_attach_phy_ops(struct ath
  7101. +@@ -1981,6 +2001,7 @@ void ar9003_hw_attach_phy_ops(struct ath
  7102. priv_ops->set_radar_params = ar9003_hw_set_radar_params;
  7103. priv_ops->fast_chan_change = ar9003_hw_fast_chan_change;
  7104. @@ -55,9 +55,9 @@
  7105. ops->spectral_scan_config = ar9003_hw_spectral_scan_config;
  7106. --- a/drivers/net/wireless/ath/ath9k/init.c
  7107. +++ b/drivers/net/wireless/ath/ath9k/init.c
  7108. -@@ -711,7 +711,8 @@ static void ath9k_init_txpower_limits(st
  7109. +@@ -717,7 +717,8 @@ static void ath9k_init_txpower_limits(st
  7110. if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
  7111. - ath9k_init_band_txpower(sc, IEEE80211_BAND_5GHZ);
  7112. + ath9k_init_band_txpower(sc, NL80211_BAND_5GHZ);
  7113. - ah->curchan = curchan;
  7114. + if (curchan)
  7115. @@ -65,7 +65,7 @@
  7116. }
  7117. static const struct ieee80211_iface_limit if_limits[] = {
  7118. -@@ -897,6 +898,18 @@ static void ath9k_set_hw_capab(struct at
  7119. +@@ -903,6 +904,18 @@ static void ath9k_set_hw_capab(struct at
  7120. SET_IEEE80211_PERM_ADDR(hw, common->macaddr);
  7121. }
  7122. @@ -84,7 +84,7 @@
  7123. int ath9k_init_device(u16 devid, struct ath_softc *sc,
  7124. const struct ath_bus_ops *bus_ops)
  7125. {
  7126. -@@ -942,6 +955,8 @@ int ath9k_init_device(u16 devid, struct
  7127. +@@ -948,6 +961,8 @@ int ath9k_init_device(u16 devid, struct
  7128. ARRAY_SIZE(ath9k_tpt_blink));
  7129. #endif
  7130. @@ -110,7 +110,7 @@
  7131. static inline void ath9k_hw_set_bt_ant_diversity(struct ath_hw *ah, bool enable)
  7132. --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  7133. +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  7134. -@@ -1327,9 +1327,30 @@ void ar5008_hw_init_rate_txpower(struct
  7135. +@@ -1325,9 +1325,30 @@ void ar5008_hw_init_rate_txpower(struct
  7136. }
  7137. }
  7138. @@ -141,7 +141,7 @@
  7139. static const u32 ar5416_cca_regs[6] = {
  7140. AR_PHY_CCA,
  7141. AR_PHY_CH1_CCA,
  7142. -@@ -1344,6 +1365,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
  7143. +@@ -1342,6 +1363,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
  7144. if (ret)
  7145. return ret;
  7146. 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
  7147. index 8768c5d..9462fca 100644
  7148. --- a/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch
  7149. +++ b/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch
  7150. @@ -40,7 +40,7 @@
  7151. return true;
  7152. }
  7153. -@@ -1797,8 +1816,14 @@ static int ath9k_hw_do_fastcc(struct ath
  7154. +@@ -1799,8 +1818,14 @@ static int ath9k_hw_do_fastcc(struct ath
  7155. if (AR_SREV_9271(ah))
  7156. ar9002_hw_load_ani_reg(ah, chan);
  7157. @@ -55,7 +55,7 @@
  7158. return -EINVAL;
  7159. }
  7160. -@@ -2052,6 +2077,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  7161. +@@ -2054,6 +2079,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  7162. ath9k_hw_set_radar_params(ah);
  7163. }
  7164. diff --git a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  7165. index 3d24ccd..b639f97 100644
  7166. --- a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  7167. +++ b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  7168. @@ -1,6 +1,6 @@
  7169. --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  7170. +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  7171. -@@ -956,55 +956,6 @@ static bool ar5008_hw_ani_control_new(st
  7172. +@@ -954,55 +954,6 @@ static bool ar5008_hw_ani_control_new(st
  7173. * on == 0 means more noise imm
  7174. */
  7175. u32 on = param ? 1 : 0;
  7176. @@ -58,7 +58,7 @@
  7177. REG_SET_BIT(ah, AR_PHY_SFCORR_LOW,
  7178. --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  7179. +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  7180. -@@ -41,20 +41,6 @@ static const int cycpwrThr1_table[] =
  7181. +@@ -42,20 +42,6 @@ static const int cycpwrThr1_table[] =
  7182. /* level: 0 1 2 3 4 5 6 7 8 */
  7183. { -6, -4, -2, 0, 2, 4, 6, 8 }; /* lvl 0-7, default 3 */
  7184. @@ -79,7 +79,7 @@
  7185. static const u8 ofdm2pwr[] = {
  7186. ALL_TARGET_LEGACY_6_24,
  7187. ALL_TARGET_LEGACY_6_24,
  7188. -@@ -1089,11 +1075,6 @@ static bool ar9003_hw_ani_control(struct
  7189. +@@ -1095,11 +1081,6 @@ static bool ar9003_hw_ani_control(struct
  7190. struct ath_common *common = ath9k_hw_common(ah);
  7191. struct ath9k_channel *chan = ah->curchan;
  7192. struct ar5416AniState *aniState = &ah->ani;
  7193. @@ -91,7 +91,7 @@
  7194. s32 value, value2;
  7195. switch (cmd & ah->ani_function) {
  7196. -@@ -1107,61 +1088,6 @@ static bool ar9003_hw_ani_control(struct
  7197. +@@ -1113,61 +1094,6 @@ static bool ar9003_hw_ani_control(struct
  7198. */
  7199. u32 on = param ? 1 : 0;
  7200. diff --git a/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch b/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch
  7201. new file mode 100644
  7202. index 0000000..ced72c6
  7203. --- /dev/null
  7204. +++ b/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch
  7205. @@ -0,0 +1,39 @@
  7206. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  7207. +Date: Sun, 31 Jan 2016 20:45:57 +0100
  7208. +Subject: [PATCH v4 1/8] mac80211: ath9k: enable platform WLAN LED name
  7209. +
  7210. +Enable platform-supplied WLAN LED name for ath9k device. It replaces generic
  7211. +'ath9k-phy*' label with string set during platform initialization.
  7212. +
  7213. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  7214. +---
  7215. + drivers/net/wireless/ath/ath9k/gpio.c | 10 +++++++---
  7216. + include/linux/ath9k_platform.h | 1 +
  7217. + 2 files changed, 8 insertions(+), 3 deletions(-)
  7218. +
  7219. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  7220. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  7221. +@@ -155,8 +155,11 @@ void ath_init_leds(struct ath_softc *sc)
  7222. +
  7223. + ath_fill_led_pin(sc);
  7224. +
  7225. +- snprintf(led_name, sizeof(led_name), "ath9k-%s",
  7226. +- wiphy_name(sc->hw->wiphy));
  7227. ++ if (pdata && pdata->led_name)
  7228. ++ strncpy(led_name, pdata->led_name, sizeof(led_name));
  7229. ++ else
  7230. ++ snprintf(led_name, sizeof(led_name), "ath9k-%s",
  7231. ++ wiphy_name(sc->hw->wiphy));
  7232. +
  7233. + if (ath9k_led_blink)
  7234. + trigger = sc->led_default_trigger;
  7235. +--- a/include/linux/ath9k_platform.h
  7236. ++++ b/include/linux/ath9k_platform.h
  7237. +@@ -49,6 +49,7 @@ struct ath9k_platform_data {
  7238. +
  7239. + int num_leds;
  7240. + const struct gpio_led *leds;
  7241. ++ const char *led_name;
  7242. + };
  7243. +
  7244. + #endif /* _LINUX_ATH9K_PLATFORM_H */
  7245. diff --git a/package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch b/package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch
  7246. new file mode 100644
  7247. index 0000000..5d84cf0
  7248. --- /dev/null
  7249. +++ b/package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch
  7250. @@ -0,0 +1,29 @@
  7251. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  7252. +Date: Sun, 31 Jan 2016 20:48:49 +0100
  7253. +Subject: [PATCH v4 2/8] mac80211: ath9k: set default state for platform LEDs
  7254. +
  7255. +Support default state for platform LEDs connected to ath9k device.
  7256. +Now LEDs are correctly set on or off at ath9k module initialization.
  7257. +Very useful if power LED is connected to wireless chip.
  7258. +
  7259. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  7260. +---
  7261. + gpio.c | 7 +++++--
  7262. + 1 file changed, 5 insertions(+), 2 deletions(-)
  7263. +
  7264. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  7265. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  7266. +@@ -74,8 +74,11 @@ static int ath_add_led(struct ath_softc
  7267. + ath9k_hw_gpio_request_out(sc->sc_ah, gpio->gpio, gpio->name,
  7268. + AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  7269. +
  7270. +- /* LED off */
  7271. +- ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  7272. ++ /* Set default LED state */
  7273. ++ if (gpio->default_state == LEDS_GPIO_DEFSTATE_ON)
  7274. ++ ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, !gpio->active_low);
  7275. ++ else
  7276. ++ ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  7277. +
  7278. + return 0;
  7279. + }
  7280. diff --git a/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch b/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
  7281. new file mode 100644
  7282. index 0000000..1c89e42
  7283. --- /dev/null
  7284. +++ b/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
  7285. @@ -0,0 +1,237 @@
  7286. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  7287. +Date: Sun, 31 Jan 2016 21:01:31 +0100
  7288. +Subject: [PATCH v4 4/8] mac80211: ath9k: enable access to GPIO
  7289. +
  7290. +Enable access to GPIO chip and its pins for Atheros AR92xx
  7291. +wireless devices. For now AR9285 and AR9287 are supported.
  7292. +
  7293. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  7294. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7295. +---
  7296. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  7297. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  7298. +@@ -24,6 +24,7 @@
  7299. + #include <linux/completion.h>
  7300. + #include <linux/time.h>
  7301. + #include <linux/hw_random.h>
  7302. ++#include <linux/gpio/driver.h>
  7303. +
  7304. + #include "common.h"
  7305. + #include "debug.h"
  7306. +@@ -959,6 +960,14 @@ struct ath_led {
  7307. + struct led_classdev cdev;
  7308. + };
  7309. +
  7310. ++#ifdef CONFIG_GPIOLIB
  7311. ++struct ath9k_gpio_chip {
  7312. ++ struct ath_softc *sc;
  7313. ++ char label[32];
  7314. ++ struct gpio_chip gchip;
  7315. ++};
  7316. ++#endif
  7317. ++
  7318. + struct ath_softc {
  7319. + struct ieee80211_hw *hw;
  7320. + struct device *dev;
  7321. +@@ -1013,6 +1022,9 @@ struct ath_softc {
  7322. + #ifdef CPTCFG_MAC80211_LEDS
  7323. + const char *led_default_trigger;
  7324. + struct list_head leds;
  7325. ++#ifdef CONFIG_GPIOLIB
  7326. ++ struct ath9k_gpio_chip *gpiochip;
  7327. ++#endif
  7328. + #endif
  7329. +
  7330. + #ifdef CPTCFG_ATH9K_DEBUGFS
  7331. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  7332. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  7333. +@@ -16,13 +16,138 @@
  7334. +
  7335. + #include "ath9k.h"
  7336. + #include <linux/ath9k_platform.h>
  7337. ++#include <linux/gpio.h>
  7338. ++
  7339. ++#ifdef CPTCFG_MAC80211_LEDS
  7340. ++
  7341. ++#ifdef CONFIG_GPIOLIB
  7342. ++
  7343. ++/***************/
  7344. ++/* GPIO Chip */
  7345. ++/***************/
  7346. ++
  7347. ++/* gpio_chip handler : set GPIO to input */
  7348. ++static int ath9k_gpio_pin_cfg_input(struct gpio_chip *chip, unsigned offset)
  7349. ++{
  7350. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  7351. ++ gchip);
  7352. ++
  7353. ++ ath9k_hw_gpio_request_in(gc->sc->sc_ah, offset, "ath9k-gpio");
  7354. ++
  7355. ++ return 0;
  7356. ++}
  7357. ++
  7358. ++/* gpio_chip handler : set GPIO to output */
  7359. ++static int ath9k_gpio_pin_cfg_output(struct gpio_chip *chip, unsigned offset,
  7360. ++ int value)
  7361. ++{
  7362. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  7363. ++ gchip);
  7364. ++
  7365. ++ ath9k_hw_gpio_request_out(gc->sc->sc_ah, offset, "ath9k-gpio",
  7366. ++ AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  7367. ++ ath9k_hw_set_gpio(gc->sc->sc_ah, offset, value);
  7368. ++
  7369. ++ return 0;
  7370. ++}
  7371. ++
  7372. ++/* gpio_chip handler : query GPIO direction (0=out, 1=in) */
  7373. ++static int ath9k_gpio_pin_get_dir(struct gpio_chip *chip, unsigned offset)
  7374. ++{
  7375. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  7376. ++ gchip);
  7377. ++ struct ath_hw *ah = gc->sc->sc_ah;
  7378. ++
  7379. ++ return !((REG_READ(ah, AR_GPIO_OE_OUT) >> (offset * 2)) & 3);
  7380. ++}
  7381. ++
  7382. ++/* gpio_chip handler : get GPIO pin value */
  7383. ++static int ath9k_gpio_pin_get(struct gpio_chip *chip, unsigned offset)
  7384. ++{
  7385. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  7386. ++ gchip);
  7387. ++
  7388. ++ return ath9k_hw_gpio_get(gc->sc->sc_ah, offset);
  7389. ++}
  7390. ++
  7391. ++/* gpio_chip handler : set GPIO pin to value */
  7392. ++static void ath9k_gpio_pin_set(struct gpio_chip *chip, unsigned offset,
  7393. ++ int value)
  7394. ++{
  7395. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  7396. ++ gchip);
  7397. ++
  7398. ++ ath9k_hw_set_gpio(gc->sc->sc_ah, offset, value);
  7399. ++}
  7400. ++
  7401. ++/* register GPIO chip */
  7402. ++static void ath9k_register_gpio_chip(struct ath_softc *sc)
  7403. ++{
  7404. ++ struct ath9k_gpio_chip *gc;
  7405. ++ u16 ng;
  7406. ++
  7407. ++ /* for now only AR9285 and AR9287 are recognized */
  7408. ++ if (AR_SREV_9287(sc->sc_ah))
  7409. ++ ng = AR9287_NUM_GPIO;
  7410. ++ else if (AR_SREV_9285(sc->sc_ah))
  7411. ++ ng = AR9285_NUM_GPIO;
  7412. ++ else
  7413. ++ return;
  7414. ++
  7415. ++ gc = kzalloc(sizeof(struct ath9k_gpio_chip), GFP_KERNEL);
  7416. ++ if (!gc)
  7417. ++ return;
  7418. ++
  7419. ++ snprintf(gc->label, sizeof(gc->label), "ath9k-%s",
  7420. ++ wiphy_name(sc->hw->wiphy));
  7421. ++ gc->gchip.label = gc->label;
  7422. ++ gc->gchip.base = -1; /* determine base automatically */
  7423. ++ gc->gchip.ngpio = ng;
  7424. ++ gc->gchip.direction_input = ath9k_gpio_pin_cfg_input;
  7425. ++ gc->gchip.direction_output = ath9k_gpio_pin_cfg_output;
  7426. ++ gc->gchip.get_direction = ath9k_gpio_pin_get_dir;
  7427. ++ gc->gchip.get = ath9k_gpio_pin_get;
  7428. ++ gc->gchip.set = ath9k_gpio_pin_set;
  7429. ++ gc->gchip.owner = THIS_MODULE;
  7430. ++
  7431. ++ if (gpiochip_add(&gc->gchip)) {
  7432. ++ kfree(gc);
  7433. ++ return;
  7434. ++ }
  7435. ++
  7436. ++ sc->gpiochip = gc;
  7437. ++ gc->sc = sc;
  7438. ++}
  7439. ++
  7440. ++/* remove GPIO chip */
  7441. ++static void ath9k_unregister_gpio_chip(struct ath_softc *sc)
  7442. ++{
  7443. ++ struct ath9k_gpio_chip *gc = sc->gpiochip;
  7444. ++
  7445. ++ if (!gc)
  7446. ++ return;
  7447. ++
  7448. ++ gpiochip_remove(&gc->gchip);
  7449. ++ kfree(gc);
  7450. ++ sc->gpiochip = NULL;
  7451. ++}
  7452. ++
  7453. ++#else /* CONFIG_GPIOLIB */
  7454. ++
  7455. ++static inline void ath9k_register_gpio_chip(struct ath_softc *sc)
  7456. ++{
  7457. ++}
  7458. ++
  7459. ++static inline void ath9k_unregister_gpio_chip(struct ath_softc *sc)
  7460. ++{
  7461. ++}
  7462. ++
  7463. ++#endif /* CONFIG_GPIOLIB */
  7464. +
  7465. + /********************************/
  7466. + /* LED functions */
  7467. + /********************************/
  7468. +
  7469. +-#ifdef CPTCFG_MAC80211_LEDS
  7470. +-
  7471. + static void ath_fill_led_pin(struct ath_softc *sc)
  7472. + {
  7473. + struct ath_hw *ah = sc->sc_ah;
  7474. +@@ -80,6 +205,12 @@ static int ath_add_led(struct ath_softc
  7475. + else
  7476. + ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  7477. +
  7478. ++#ifdef CONFIG_GPIOLIB
  7479. ++ /* If there is GPIO chip configured, reserve LED pin */
  7480. ++ if (sc->gpiochip)
  7481. ++ gpio_request(sc->gpiochip->gchip.base + gpio->gpio, gpio->name);
  7482. ++#endif
  7483. ++
  7484. + return 0;
  7485. + }
  7486. +
  7487. +@@ -136,12 +267,18 @@ void ath_deinit_leds(struct ath_softc *s
  7488. +
  7489. + while (!list_empty(&sc->leds)) {
  7490. + led = list_first_entry(&sc->leds, struct ath_led, list);
  7491. ++#ifdef CONFIG_GPIOLIB
  7492. ++ /* If there is GPIO chip configured, free LED pin */
  7493. ++ if (sc->gpiochip)
  7494. ++ gpio_free(sc->gpiochip->gchip.base + led->gpio->gpio);
  7495. ++#endif
  7496. + list_del(&led->list);
  7497. + ath_led_brightness(&led->cdev, LED_OFF);
  7498. + led_classdev_unregister(&led->cdev);
  7499. + ath9k_hw_gpio_free(sc->sc_ah, led->gpio->gpio);
  7500. + kfree(led);
  7501. + }
  7502. ++ ath9k_unregister_gpio_chip(sc);
  7503. + }
  7504. +
  7505. + void ath_init_leds(struct ath_softc *sc)
  7506. +@@ -158,6 +295,8 @@ void ath_init_leds(struct ath_softc *sc)
  7507. +
  7508. + ath_fill_led_pin(sc);
  7509. +
  7510. ++ ath9k_register_gpio_chip(sc);
  7511. ++
  7512. + if (pdata && pdata->led_name)
  7513. + strncpy(led_name, pdata->led_name, sizeof(led_name));
  7514. + else
  7515. +@@ -178,6 +317,7 @@ void ath_init_leds(struct ath_softc *sc)
  7516. + for (i = 0; i < pdata->num_leds; i++)
  7517. + ath_create_platform_led(sc, &pdata->leds[i]);
  7518. + }
  7519. ++
  7520. + #endif
  7521. +
  7522. + /*******************/
  7523. diff --git a/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
  7524. new file mode 100644
  7525. index 0000000..c7973bb
  7526. --- /dev/null
  7527. +++ b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
  7528. @@ -0,0 +1,149 @@
  7529. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  7530. +Subject: [PATCH v5 5/8] mac80211: ath9k: enable GPIO buttons
  7531. +
  7532. +Enable platform-defined GPIO button support for ath9k device.
  7533. +Key poller is activated for attached platform buttons.
  7534. +Requires ath9k GPIO chip access.
  7535. +
  7536. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  7537. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7538. +---
  7539. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  7540. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  7541. +@@ -1024,6 +1024,7 @@ struct ath_softc {
  7542. + struct list_head leds;
  7543. + #ifdef CONFIG_GPIOLIB
  7544. + struct ath9k_gpio_chip *gpiochip;
  7545. ++ struct platform_device *btnpdev; /* gpio-keys-polled */
  7546. + #endif
  7547. + #endif
  7548. +
  7549. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  7550. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  7551. +@@ -17,6 +17,8 @@
  7552. + #include "ath9k.h"
  7553. + #include <linux/ath9k_platform.h>
  7554. + #include <linux/gpio.h>
  7555. ++#include <linux/platform_device.h>
  7556. ++#include <linux/gpio_keys.h>
  7557. +
  7558. + #ifdef CPTCFG_MAC80211_LEDS
  7559. +
  7560. +@@ -132,6 +134,64 @@ static void ath9k_unregister_gpio_chip(s
  7561. + sc->gpiochip = NULL;
  7562. + }
  7563. +
  7564. ++/******************/
  7565. ++/* GPIO Buttons */
  7566. ++/******************/
  7567. ++
  7568. ++/* add GPIO buttons */
  7569. ++static void ath9k_init_buttons(struct ath_softc *sc)
  7570. ++{
  7571. ++ struct ath9k_platform_data *pdata = sc->dev->platform_data;
  7572. ++ struct platform_device *pdev;
  7573. ++ struct gpio_keys_platform_data gkpdata;
  7574. ++ struct gpio_keys_button *bt;
  7575. ++ int i;
  7576. ++
  7577. ++ if (!sc->gpiochip)
  7578. ++ return;
  7579. ++
  7580. ++ if (!pdata || !pdata->btns || !pdata->num_btns)
  7581. ++ return;
  7582. ++
  7583. ++ bt = devm_kmemdup(sc->dev, pdata->btns,
  7584. ++ pdata->num_btns * sizeof(struct gpio_keys_button),
  7585. ++ GFP_KERNEL);
  7586. ++ if (!bt)
  7587. ++ return;
  7588. ++
  7589. ++ for (i = 0; i < pdata->num_btns; i++) {
  7590. ++ ath9k_hw_gpio_request_in(sc->sc_ah, pdata->btns[i].gpio,
  7591. ++ "ath9k-gpio");
  7592. ++ bt[i].gpio = sc->gpiochip->gchip.base + pdata->btns[i].gpio;
  7593. ++ }
  7594. ++
  7595. ++ memset(&gkpdata, 0, sizeof(struct gpio_keys_platform_data));
  7596. ++ gkpdata.buttons = bt;
  7597. ++ gkpdata.nbuttons = pdata->num_btns;
  7598. ++ gkpdata.poll_interval = pdata->btn_poll_interval;
  7599. ++
  7600. ++ pdev = platform_device_register_data(sc->dev, "gpio-keys-polled",
  7601. ++ PLATFORM_DEVID_AUTO, &gkpdata,
  7602. ++ sizeof(gkpdata));
  7603. ++ if (!IS_ERR_OR_NULL(pdev))
  7604. ++ sc->btnpdev = pdev;
  7605. ++ else {
  7606. ++ sc->btnpdev = NULL;
  7607. ++ devm_kfree(sc->dev, bt);
  7608. ++ }
  7609. ++}
  7610. ++
  7611. ++/* remove GPIO buttons */
  7612. ++static void ath9k_deinit_buttons(struct ath_softc *sc)
  7613. ++{
  7614. ++ if (!sc->gpiochip || !sc->btnpdev)
  7615. ++ return;
  7616. ++
  7617. ++ platform_device_unregister(sc->btnpdev);
  7618. ++
  7619. ++ sc->btnpdev = NULL;
  7620. ++}
  7621. ++
  7622. + #else /* CONFIG_GPIOLIB */
  7623. +
  7624. + static inline void ath9k_register_gpio_chip(struct ath_softc *sc)
  7625. +@@ -142,6 +202,14 @@ static inline void ath9k_unregister_gpio
  7626. + {
  7627. + }
  7628. +
  7629. ++static inline void ath9k_init_buttons(struct ath_softc *sc)
  7630. ++{
  7631. ++}
  7632. ++
  7633. ++static inline void ath9k_deinit_buttons(struct ath_softc *sc)
  7634. ++{
  7635. ++}
  7636. ++
  7637. + #endif /* CONFIG_GPIOLIB */
  7638. +
  7639. + /********************************/
  7640. +@@ -265,6 +333,7 @@ void ath_deinit_leds(struct ath_softc *s
  7641. + {
  7642. + struct ath_led *led;
  7643. +
  7644. ++ ath9k_deinit_buttons(sc);
  7645. + while (!list_empty(&sc->leds)) {
  7646. + led = list_first_entry(&sc->leds, struct ath_led, list);
  7647. + #ifdef CONFIG_GPIOLIB
  7648. +@@ -296,6 +365,7 @@ void ath_init_leds(struct ath_softc *sc)
  7649. + ath_fill_led_pin(sc);
  7650. +
  7651. + ath9k_register_gpio_chip(sc);
  7652. ++ ath9k_init_buttons(sc);
  7653. +
  7654. + if (pdata && pdata->led_name)
  7655. + strncpy(led_name, pdata->led_name, sizeof(led_name));
  7656. +@@ -311,7 +381,7 @@ void ath_init_leds(struct ath_softc *sc)
  7657. + ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
  7658. + !sc->sc_ah->config.led_active_high);
  7659. +
  7660. +- if (!pdata)
  7661. ++ if (!pdata || !pdata->leds || !pdata->num_leds)
  7662. + return;
  7663. +
  7664. + for (i = 0; i < pdata->num_leds; i++)
  7665. +--- a/include/linux/ath9k_platform.h
  7666. ++++ b/include/linux/ath9k_platform.h
  7667. +@@ -50,6 +50,10 @@ struct ath9k_platform_data {
  7668. + int num_leds;
  7669. + const struct gpio_led *leds;
  7670. + const char *led_name;
  7671. ++
  7672. ++ unsigned num_btns;
  7673. ++ const struct gpio_keys_button *btns;
  7674. ++ unsigned btn_poll_interval;
  7675. + };
  7676. +
  7677. + #endif /* _LINUX_ATH9K_PLATFORM_H */
  7678. diff --git a/package/kernel/mac80211/patches/550-ath9k_add_ar9280_gpio_chip.patch b/package/kernel/mac80211/patches/550-ath9k_add_ar9280_gpio_chip.patch
  7679. new file mode 100644
  7680. index 0000000..22e2c66
  7681. --- /dev/null
  7682. +++ b/package/kernel/mac80211/patches/550-ath9k_add_ar9280_gpio_chip.patch
  7683. @@ -0,0 +1,27 @@
  7684. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  7685. +Date: Thu, 21 Apr 2016 23:00:54 +0200
  7686. +Subject: [PATCH] mac80211: ath9k: add GPIO support for AR9280 chip
  7687. +
  7688. +Enable access to GPIO on Atheros wireless chip AR9280.
  7689. +Support for 9280 is added to existing 9285/9287 subsystem
  7690. +because these 3 chips differ only in number of GPIO pins.
  7691. +
  7692. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  7693. +---
  7694. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  7695. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  7696. +@@ -88,11 +88,13 @@ static void ath9k_register_gpio_chip(str
  7697. + struct ath9k_gpio_chip *gc;
  7698. + u16 ng;
  7699. +
  7700. +- /* for now only AR9285 and AR9287 are recognized */
  7701. ++ /* supported chips are AR9280, AR9285 and AR9287 */
  7702. + if (AR_SREV_9287(sc->sc_ah))
  7703. + ng = AR9287_NUM_GPIO;
  7704. + else if (AR_SREV_9285(sc->sc_ah))
  7705. + ng = AR9285_NUM_GPIO;
  7706. ++ else if (AR_SREV_9280(sc->sc_ah))
  7707. ++ ng = AR9280_NUM_GPIO;
  7708. + else
  7709. + return;
  7710. +
  7711. 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
  7712. index 8245909..db70a33 100644
  7713. --- a/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch
  7714. +++ b/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch
  7715. @@ -24,7 +24,7 @@ Changes since v1:
  7716. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  7717. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  7718. -@@ -7722,6 +7722,7 @@ static int rt2800_probe_rt(struct rt2x00
  7719. +@@ -7726,6 +7726,7 @@ static int rt2800_probe_rt(struct rt2x00
  7720. int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
  7721. {
  7722. @@ -32,7 +32,7 @@ Changes since v1:
  7723. int retval;
  7724. u32 reg;
  7725. -@@ -7729,6 +7730,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  7726. +@@ -7733,6 +7734,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  7727. if (retval)
  7728. return retval;
  7729. 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
  7730. index 7abfcd1..a3b62bc 100644
  7731. --- a/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch
  7732. +++ b/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch
  7733. @@ -239,7 +239,7 @@ Changes since v1: ---
  7734. msleep(1);
  7735. /*
  7736. -@@ -7726,6 +7774,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  7737. +@@ -7730,6 +7778,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  7738. int retval;
  7739. u32 reg;
  7740. @@ -248,7 +248,7 @@ Changes since v1: ---
  7741. retval = rt2800_probe_rt(rt2x00dev);
  7742. if (retval)
  7743. return retval;
  7744. -@@ -7809,8 +7859,11 @@ void rt2800_get_key_seq(struct ieee80211
  7745. +@@ -7813,8 +7863,11 @@ void rt2800_get_key_seq(struct ieee80211
  7746. return;
  7747. offset = MAC_IVEIV_ENTRY(key->hw_key_idx);
  7748. 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
  7749. index 02b2acf..f41a160 100644
  7750. --- a/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch
  7751. +++ b/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch
  7752. @@ -41,7 +41,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  7753. rt2800_clear_beacon_register(rt2x00dev, i);
  7754. if (rt2x00_is_usb(rt2x00dev)) {
  7755. -@@ -7827,6 +7828,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  7756. +@@ -7831,6 +7832,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  7757. if (rt2x00_rt(rt2x00dev, RT3593))
  7758. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  7759. 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
  7760. index e909272..5099c64 100644
  7761. --- a/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch
  7762. +++ b/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch
  7763. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  7764. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  7765. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  7766. -@@ -7852,7 +7852,10 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  7767. +@@ -7856,7 +7856,10 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  7768. if (rt2x00_rt(rt2x00dev, RT3593))
  7769. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  7770. 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
  7771. index 7fe38e0..a2e7015 100644
  7772. --- a/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch
  7773. +++ b/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch
  7774. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  7775. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  7776. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  7777. -@@ -7822,6 +7822,7 @@ static int rt2800_probe_rt(struct rt2x00
  7778. +@@ -7826,6 +7826,7 @@ static int rt2800_probe_rt(struct rt2x00
  7779. case RT3390:
  7780. case RT3572:
  7781. case RT3593:
  7782. 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
  7783. index 253a0c0..89bd0ac 100644
  7784. --- a/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
  7785. +++ b/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
  7786. @@ -98,7 +98,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  7787. static const struct rf_channel rf_vals_5592_xtal20[] = {
  7788. /* Channel, N, K, mod, R */
  7789. {1, 482, 4, 10, 3},
  7790. -@@ -7669,6 +7729,11 @@ static int rt2800_probe_hw_mode(struct r
  7791. +@@ -7673,6 +7733,11 @@ static int rt2800_probe_hw_mode(struct r
  7792. spec->channels = rf_vals_3x;
  7793. break;
  7794. 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
  7795. index f15c22b..b7efc9f 100644
  7796. --- a/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
  7797. +++ b/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
  7798. @@ -18,7 +18,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  7799. case RF5360:
  7800. case RF5362:
  7801. case RF5370:
  7802. -@@ -7848,6 +7849,7 @@ static int rt2800_probe_hw_mode(struct r
  7803. +@@ -7852,6 +7853,7 @@ static int rt2800_probe_hw_mode(struct r
  7804. case RF3053:
  7805. case RF3070:
  7806. case RF3290:
  7807. 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
  7808. index 6ce224a..220e35f 100644
  7809. --- a/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch
  7810. +++ b/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch
  7811. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  7812. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  7813. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  7814. -@@ -8403,7 +8403,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  7815. +@@ -8407,7 +8407,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  7816. if (rt2x00_rt(rt2x00dev, RT3593))
  7817. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  7818. 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
  7819. index 25753af..2ffa5a4 100644
  7820. --- a/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch
  7821. +++ b/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch
  7822. @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  7823. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  7824. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  7825. -@@ -8416,7 +8416,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  7826. +@@ -8420,7 +8420,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  7827. if (retval)
  7828. return retval;
  7829. diff --git a/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00_platform_h.patch b/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00_platform_h.patch
  7830. index 7a183a4..daa5dc6 100644
  7831. --- a/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00_platform_h.patch
  7832. +++ b/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00_platform_h.patch
  7833. @@ -22,10 +22,10 @@
  7834. +#endif /* _RT2X00_PLATFORM_H */
  7835. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  7836. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  7837. -@@ -38,6 +38,7 @@
  7838. - #include <linux/kfifo.h>
  7839. +@@ -39,6 +39,7 @@
  7840. #include <linux/hrtimer.h>
  7841. #include <linux/average.h>
  7842. + #include <linux/usb.h>
  7843. +#include <linux/rt2x00_platform.h>
  7844. #include <net/mac80211.h>
  7845. diff --git a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  7846. index bc056cd..8ae5da3 100644
  7847. --- a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  7848. +++ b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  7849. @@ -1,6 +1,6 @@
  7850. --- a/.local-symbols
  7851. +++ b/.local-symbols
  7852. -@@ -329,6 +329,7 @@ RT2X00_LIB_FIRMWARE=
  7853. +@@ -331,6 +331,7 @@ RT2X00_LIB_FIRMWARE=
  7854. RT2X00_LIB_CRYPTO=
  7855. RT2X00_LIB_LEDS=
  7856. RT2X00_LIB_DEBUGFS=
  7857. @@ -105,7 +105,7 @@
  7858. .drv_init_registers = rt2800mmio_init_registers,
  7859. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  7860. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  7861. -@@ -697,6 +697,7 @@ enum rt2x00_capability_flags {
  7862. +@@ -699,6 +699,7 @@ enum rt2x00_capability_flags {
  7863. REQUIRE_HT_TX_DESC,
  7864. REQUIRE_PS_AUTOWAKE,
  7865. REQUIRE_DELAYED_RFKILL,
  7866. @@ -127,7 +127,7 @@
  7867. DECLARE_KFIFO_PTR(txstatus_fifo, u32);
  7868. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  7869. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  7870. -@@ -1335,6 +1335,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de
  7871. +@@ -1334,6 +1334,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de
  7872. INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup);
  7873. INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep);
  7874. @@ -138,7 +138,7 @@
  7875. /*
  7876. * Let the driver probe the device to detect the capabilities.
  7877. */
  7878. -@@ -1475,6 +1479,11 @@ void rt2x00lib_remove_dev(struct rt2x00_
  7879. +@@ -1477,6 +1481,11 @@ void rt2x00lib_remove_dev(struct rt2x00_
  7880. * Free the driver data.
  7881. */
  7882. kfree(rt2x00dev->drv_data);
  7883. diff --git a/package/kernel/mac80211/patches/607-rt2x00-allow_disabling_bands_through_platform_data.patch b/package/kernel/mac80211/patches/607-rt2x00-allow_disabling_bands_through_platform_data.patch
  7884. index d923e05..a2e1faf 100644
  7885. --- a/package/kernel/mac80211/patches/607-rt2x00-allow_disabling_bands_through_platform_data.patch
  7886. +++ b/package/kernel/mac80211/patches/607-rt2x00-allow_disabling_bands_through_platform_data.patch
  7887. @@ -37,7 +37,7 @@
  7888. num_rates += 4;
  7889. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  7890. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  7891. -@@ -405,6 +405,7 @@ struct hw_mode_spec {
  7892. +@@ -406,6 +406,7 @@ struct hw_mode_spec {
  7893. unsigned int supported_bands;
  7894. #define SUPPORT_BAND_2GHZ 0x00000001
  7895. #define SUPPORT_BAND_5GHZ 0x00000002
  7896. 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
  7897. index a645ba1..6704ff8 100644
  7898. --- a/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch
  7899. +++ b/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch
  7900. @@ -31,7 +31,7 @@
  7901. {
  7902. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  7903. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  7904. -@@ -1414,6 +1414,7 @@ static inline void rt2x00debug_dump_fram
  7905. +@@ -1416,6 +1416,7 @@ static inline void rt2x00debug_dump_fram
  7906. */
  7907. u32 rt2x00lib_get_bssidx(struct rt2x00_dev *rt2x00dev,
  7908. struct ieee80211_vif *vif);
  7909. 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
  7910. index c69d330..9f10fe3 100644
  7911. --- a/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
  7912. +++ b/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
  7913. @@ -200,7 +200,7 @@
  7914. * EEPROM frequency
  7915. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  7916. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  7917. -@@ -717,6 +717,8 @@ enum rt2x00_capability_flags {
  7918. +@@ -719,6 +719,8 @@ enum rt2x00_capability_flags {
  7919. CAPABILITY_DOUBLE_ANTENNA,
  7920. CAPABILITY_BT_COEXIST,
  7921. CAPABILITY_VCO_RECALIBRATION,
  7922. 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
  7923. index b44fe90..860fdc0 100644
  7924. --- a/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
  7925. +++ b/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
  7926. @@ -28,7 +28,7 @@
  7927. static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
  7928. {
  7929. struct hw_mode_spec *spec = &rt2x00dev->spec;
  7930. -@@ -8272,7 +8293,10 @@ static int rt2800_probe_hw_mode(struct r
  7931. +@@ -8276,7 +8297,10 @@ static int rt2800_probe_hw_mode(struct r
  7932. case RF5390:
  7933. case RF5392:
  7934. spec->num_channels = 14;
  7935. @@ -40,7 +40,7 @@
  7936. break;
  7937. case RF3052:
  7938. -@@ -8456,6 +8480,19 @@ static int rt2800_probe_rt(struct rt2x00
  7939. +@@ -8460,6 +8484,19 @@ static int rt2800_probe_rt(struct rt2x00
  7940. return 0;
  7941. }
  7942. @@ -60,7 +60,7 @@
  7943. int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
  7944. {
  7945. struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
  7946. -@@ -8498,6 +8535,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  7947. +@@ -8502,6 +8539,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  7948. rt2800_register_write(rt2x00dev, GPIO_CTRL, reg);
  7949. /*
  7950. @@ -78,7 +78,7 @@
  7951. retval = rt2800_probe_hw_mode(rt2x00dev);
  7952. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  7953. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  7954. -@@ -400,6 +400,7 @@ static inline struct rt2x00_intf* vif_to
  7955. +@@ -401,6 +401,7 @@ static inline struct rt2x00_intf* vif_to
  7956. * @channels: Device/chipset specific channel values (See &struct rf_channel).
  7957. * @channels_info: Additional information for channels (See &struct channel_info).
  7958. * @ht: Driver HT Capabilities (See &ieee80211_sta_ht_cap).
  7959. @@ -86,7 +86,7 @@
  7960. */
  7961. struct hw_mode_spec {
  7962. unsigned int supported_bands;
  7963. -@@ -416,6 +417,7 @@ struct hw_mode_spec {
  7964. +@@ -417,6 +418,7 @@ struct hw_mode_spec {
  7965. const struct channel_info *channels_info;
  7966. struct ieee80211_sta_ht_cap ht;
  7967. diff --git a/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch b/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  7968. index 8e3bd2a..e7b2a8c 100644
  7969. --- a/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  7970. +++ b/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  7971. @@ -8,7 +8,7 @@
  7972. #include "rt2x00.h"
  7973. #include "rt2800lib.h"
  7974. -@@ -8482,13 +8483,14 @@ static int rt2800_probe_rt(struct rt2x00
  7975. +@@ -8486,13 +8487,14 @@ static int rt2800_probe_rt(struct rt2x00
  7976. int rt2800_probe_clk(struct rt2x00_dev *rt2x00dev)
  7977. {
  7978. diff --git a/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch b/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  7979. index faa5879..44bd8a1 100644
  7980. --- a/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  7981. +++ b/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  7982. @@ -240,7 +240,7 @@
  7983. case RF5360:
  7984. case RF5362:
  7985. case RF5370:
  7986. -@@ -8287,6 +8398,7 @@ static int rt2800_probe_hw_mode(struct r
  7987. +@@ -8291,6 +8402,7 @@ static int rt2800_probe_hw_mode(struct r
  7988. case RF3290:
  7989. case RF3320:
  7990. case RF3322:
  7991. @@ -248,7 +248,7 @@
  7992. case RF5360:
  7993. case RF5362:
  7994. case RF5370:
  7995. -@@ -8426,6 +8538,7 @@ static int rt2800_probe_hw_mode(struct r
  7996. +@@ -8430,6 +8542,7 @@ static int rt2800_probe_hw_mode(struct r
  7997. case RF3070:
  7998. case RF3290:
  7999. case RF3853:
  8000. @@ -256,7 +256,7 @@
  8001. case RF5360:
  8002. case RF5362:
  8003. case RF5370:
  8004. -@@ -8466,6 +8579,7 @@ static int rt2800_probe_rt(struct rt2x00
  8005. +@@ -8470,6 +8583,7 @@ static int rt2800_probe_rt(struct rt2x00
  8006. case RT3572:
  8007. case RT3593:
  8008. case RT3883:
  8009. @@ -266,7 +266,7 @@
  8010. case RT5592:
  8011. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  8012. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  8013. -@@ -169,6 +169,7 @@ struct rt2x00_chip {
  8014. +@@ -170,6 +170,7 @@ struct rt2x00_chip {
  8015. #define RT3572 0x3572
  8016. #define RT3593 0x3593
  8017. #define RT3883 0x3883 /* WSOC */
  8018. diff --git a/package/kernel/mac80211/patches/620-rt2x00-add-AP+STA-support.patch b/package/kernel/mac80211/patches/620-rt2x00-add-AP+STA-support.patch
  8019. index 55452b9..dba6033 100644
  8020. --- a/package/kernel/mac80211/patches/620-rt2x00-add-AP+STA-support.patch
  8021. +++ b/package/kernel/mac80211/patches/620-rt2x00-add-AP+STA-support.patch
  8022. @@ -1,6 +1,6 @@
  8023. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  8024. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  8025. -@@ -1284,7 +1284,7 @@ static inline void rt2x00lib_set_if_comb
  8026. +@@ -1283,7 +1283,7 @@ static inline void rt2x00lib_set_if_comb
  8027. */
  8028. if_limit = &rt2x00dev->if_limits_ap;
  8029. if_limit->max = rt2x00dev->ops->max_ap_intf;
  8030. diff --git a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  8031. index fd885cc..02f3053 100644
  8032. --- a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  8033. +++ b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  8034. @@ -1,6 +1,6 @@
  8035. --- a/drivers/net/wireless/marvell/libertas/cfg.c
  8036. +++ b/drivers/net/wireless/marvell/libertas/cfg.c
  8037. -@@ -2084,6 +2084,8 @@ struct wireless_dev *lbs_cfg_alloc(struc
  8038. +@@ -2122,6 +2122,8 @@ struct wireless_dev *lbs_cfg_alloc(struc
  8039. goto err_wiphy_new;
  8040. }
  8041. diff --git a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  8042. index b67a95f..ad30608 100644
  8043. --- a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  8044. +++ b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  8045. @@ -1,6 +1,6 @@
  8046. --- a/drivers/net/wireless/marvell/libertas/cfg.c
  8047. +++ b/drivers/net/wireless/marvell/libertas/cfg.c
  8048. -@@ -2174,6 +2174,8 @@ int lbs_cfg_register(struct lbs_private
  8049. +@@ -2212,6 +2212,8 @@ int lbs_cfg_register(struct lbs_private
  8050. wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  8051. wdev->wiphy->reg_notifier = lbs_reg_notifier;
  8052. diff --git a/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch b/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch
  8053. deleted file mode 100644
  8054. index 74cd448..0000000
  8055. --- a/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch
  8056. +++ /dev/null
  8057. @@ -1,17 +0,0 @@
  8058. ---- a/drivers/net/wireless/broadcom/b43/main.c
  8059. -+++ b/drivers/net/wireless/broadcom/b43/main.c
  8060. -@@ -1215,10 +1215,10 @@ void b43_wireless_core_phy_pll_reset(str
  8061. - case B43_BUS_BCMA:
  8062. - bcma_cc = &dev->dev->bdev->bus->drv_cc;
  8063. -
  8064. -- bcma_cc_write32(bcma_cc, BCMA_CC_CHIPCTL_ADDR, 0);
  8065. -- bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4);
  8066. -- bcma_cc_set32(bcma_cc, BCMA_CC_CHIPCTL_DATA, 0x4);
  8067. -- bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4);
  8068. -+ bcma_cc_write32(bcma_cc, BCMA_CC_PMU_CHIPCTL_ADDR, 0);
  8069. -+ bcma_cc_mask32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, ~0x4);
  8070. -+ bcma_cc_set32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, 0x4);
  8071. -+ bcma_cc_mask32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, ~0x4);
  8072. - break;
  8073. - #endif
  8074. - #ifdef CPTCFG_B43_SSB
  8075. diff --git a/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch b/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  8076. index 06c731f..b60ef76 100644
  8077. --- a/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  8078. +++ b/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  8079. @@ -42,7 +42,7 @@
  8080. if (wl->radio_enabled != phy->radio_on) {
  8081. if (wl->radio_enabled) {
  8082. -@@ -5209,6 +5206,47 @@ static int b43_op_get_survey(struct ieee
  8083. +@@ -5207,6 +5204,47 @@ static int b43_op_get_survey(struct ieee
  8084. return 0;
  8085. }
  8086. @@ -90,7 +90,7 @@
  8087. static const struct ieee80211_ops b43_hw_ops = {
  8088. .tx = b43_op_tx,
  8089. .conf_tx = b43_op_conf_tx,
  8090. -@@ -5230,6 +5268,8 @@ static const struct ieee80211_ops b43_hw
  8091. +@@ -5228,6 +5266,8 @@ static const struct ieee80211_ops b43_hw
  8092. .sw_scan_complete = b43_op_sw_scan_complete_notifier,
  8093. .get_survey = b43_op_get_survey,
  8094. .rfkill_poll = b43_rfkill_poll,
  8095. @@ -99,7 +99,7 @@
  8096. };
  8097. /* Hard-reset the chip. Do not call this directly.
  8098. -@@ -5538,6 +5578,8 @@ static int b43_one_core_attach(struct b4
  8099. +@@ -5536,6 +5576,8 @@ static int b43_one_core_attach(struct b4
  8100. if (!wldev)
  8101. goto out;
  8102. @@ -108,7 +108,7 @@
  8103. wldev->use_pio = b43_modparam_pio;
  8104. wldev->dev = dev;
  8105. wldev->wl = wl;
  8106. -@@ -5628,6 +5670,9 @@ static struct b43_wl *b43_wireless_init(
  8107. +@@ -5626,6 +5668,9 @@ static struct b43_wl *b43_wireless_init(
  8108. hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
  8109. diff --git a/package/kernel/mac80211/patches/860-brcmfmac-add-missing-eth_type_trans-call.patch b/package/kernel/mac80211/patches/860-brcmfmac-add-missing-eth_type_trans-call.patch
  8110. new file mode 100644
  8111. index 0000000..46227c4
  8112. --- /dev/null
  8113. +++ b/package/kernel/mac80211/patches/860-brcmfmac-add-missing-eth_type_trans-call.patch
  8114. @@ -0,0 +1,26 @@
  8115. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  8116. +Subject: [PATCH] brcmfmac: add missing eth_type_trans call
  8117. +MIME-Version: 1.0
  8118. +Content-Type: text/plain; charset=UTF-8
  8119. +Content-Transfer-Encoding: 8bit
  8120. +
  8121. +There are 2 protocols supported by brcmfmac and msgbuf one was missing a
  8122. +proper skb setup before passing it to the netif. This was triggering
  8123. +"NULL pointer dereference".
  8124. +
  8125. +Fixes: 9c349892ccc9 ("brcmfmac: revise handling events in receive path")
  8126. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  8127. +---
  8128. +
  8129. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  8130. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  8131. +@@ -1157,6 +1157,9 @@ brcmf_msgbuf_process_rx_complete(struct
  8132. + brcmu_pkt_buf_free_skb(skb);
  8133. + return;
  8134. + }
  8135. ++
  8136. ++ skb->protocol = eth_type_trans(skb, ifp->ndev);
  8137. ++
  8138. + brcmf_netif_rx(ifp, skb);
  8139. + }
  8140. +
  8141. 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
  8142. index 00181f6..8cf9ea2 100644
  8143. --- a/package/kernel/mac80211/patches/861-brcmfmac-register-wiphy-s-during-module_init.patch
  8144. +++ b/package/kernel/mac80211/patches/861-brcmfmac-register-wiphy-s-during-module_init.patch
  8145. @@ -13,8 +13,8 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  8146. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  8147. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  8148. -@@ -1332,6 +1332,7 @@ static int __init brcmfmac_module_init(v
  8149. - #endif
  8150. +@@ -1232,6 +1232,7 @@ int __init brcmf_core_init(void)
  8151. + {
  8152. if (!schedule_work(&brcmf_driver_work))
  8153. return -EBUSY;
  8154. + flush_work(&brcmf_driver_work);
  8155. 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
  8156. index 4295b4b..4f22a4e 100644
  8157. --- a/package/kernel/mac80211/patches/862-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
  8158. +++ b/package/kernel/mac80211/patches/862-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
  8159. @@ -10,7 +10,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  8160. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  8161. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  8162. -@@ -615,9 +615,37 @@ static struct wireless_dev *brcmf_cfg802
  8163. +@@ -650,9 +650,37 @@ static struct wireless_dev *brcmf_cfg802
  8164. u32 *flags,
  8165. struct vif_params *params)
  8166. {
  8167. @@ -42,7 +42,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  8168. + dev = dev_get_by_name(&init_net, name);
  8169. + if (dev) {
  8170. + dev_put(dev);
  8171. -+ return ERR_PTR(-EEXIST);
  8172. ++ return ERR_PTR(-ENFILE);
  8173. + }
  8174. +
  8175. brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
  8176. diff --git a/package/kernel/mac80211/patches/863-brcmfmac-Disable-power-management.patch b/package/kernel/mac80211/patches/863-brcmfmac-Disable-power-management.patch
  8177. new file mode 100644
  8178. index 0000000..f971bb7
  8179. --- /dev/null
  8180. +++ b/package/kernel/mac80211/patches/863-brcmfmac-Disable-power-management.patch
  8181. @@ -0,0 +1,27 @@
  8182. +From 66ae1b1750720a33e29792a177b1e696f4f005fb Mon Sep 17 00:00:00 2001
  8183. +From: Phil Elwell <phil@raspberrypi.org>
  8184. +Date: Wed, 9 Mar 2016 17:25:59 +0000
  8185. +Subject: [PATCH] brcmfmac: Disable power management
  8186. +
  8187. +Disable wireless power saving in the brcmfmac WLAN driver. This is a
  8188. +temporary measure until the connectivity loss resulting from power
  8189. +saving is resolved.
  8190. +
  8191. +Signed-off-by: Phil Elwell <phil@raspberrypi.org>
  8192. +---
  8193. + drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c | 2 ++
  8194. + 1 file changed, 2 insertions(+)
  8195. +
  8196. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  8197. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  8198. +@@ -2711,6 +2711,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip
  8199. + * preference in cfg struct to apply this to
  8200. + * FW later while initializing the dongle
  8201. + */
  8202. ++#if defined(CONFIG_BCM2708) || defined(CONFIG_BCM2709)
  8203. ++ pr_info("power management disabled\n");
  8204. ++ enabled = false;
  8205. ++#endif
  8206. + cfg->pwr_save = enabled;
  8207. + if (!check_vif_up(ifp->vif)) {
  8208. +
  8209. 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
  8210. index f2e21ea..be210f2 100644
  8211. --- a/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch
  8212. +++ b/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch
  8213. @@ -1184,7 +1184,7 @@
  8214. break;
  8215. default:
  8216. rt2x00_err(rt2x00dev, "Invalid RF chipset 0x%04x detected\n",
  8217. -@@ -8423,6 +9363,7 @@ static int rt2800_probe_hw_mode(struct r
  8218. +@@ -8427,6 +9367,7 @@ static int rt2800_probe_hw_mode(struct r
  8219. case RF5372:
  8220. case RF5390:
  8221. case RF5392:
  8222. @@ -1192,7 +1192,7 @@
  8223. spec->num_channels = 14;
  8224. if (spec->clk_is_20mhz)
  8225. spec->channels = rf_vals_xtal20mhz_3x;
  8226. -@@ -8563,6 +9504,7 @@ static int rt2800_probe_hw_mode(struct r
  8227. +@@ -8567,6 +9508,7 @@ static int rt2800_probe_hw_mode(struct r
  8228. case RF5372:
  8229. case RF5390:
  8230. case RF5392:
  8231. diff --git a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  8232. index 8c6d720..9322b45 100644
  8233. --- a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  8234. +++ b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  8235. @@ -14,7 +14,7 @@ Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  8236. --- a/drivers/net/wireless/ath/ath10k/core.c
  8237. +++ b/drivers/net/wireless/ath/ath10k/core.c
  8238. -@@ -1914,6 +1914,16 @@ int ath10k_core_register(struct ath10k *
  8239. +@@ -2012,6 +2012,16 @@ int ath10k_core_register(struct ath10k *
  8240. ar->chip_id = chip_id;
  8241. queue_work(ar->workqueue, &ar->register_work);
  8242. 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
  8243. index 281b447..1bfded0 100644
  8244. --- a/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
  8245. +++ b/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
  8246. @@ -1,6 +1,6 @@
  8247. --- a/drivers/net/wireless/ath/ath10k/mac.c
  8248. +++ b/drivers/net/wireless/ath/ath10k/mac.c
  8249. -@@ -7141,6 +7141,21 @@ struct ath10k_vif *ath10k_get_arvif(stru
  8250. +@@ -7717,6 +7717,21 @@ struct ath10k_vif *ath10k_get_arvif(stru
  8251. return arvif_iter.arvif;
  8252. }
  8253. @@ -22,7 +22,7 @@
  8254. int ath10k_mac_register(struct ath10k *ar)
  8255. {
  8256. static const u32 cipher_suites[] = {
  8257. -@@ -7357,6 +7372,12 @@ int ath10k_mac_register(struct ath10k *a
  8258. +@@ -7941,6 +7956,12 @@ int ath10k_mac_register(struct ath10k *a
  8259. ar->hw->wiphy->cipher_suites = cipher_suites;
  8260. ar->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  8261. diff --git a/package/kernel/mac80211/patches/936-ath10k_skip_otp_check.patch b/package/kernel/mac80211/patches/936-ath10k_skip_otp_check.patch
  8262. new file mode 100644
  8263. index 0000000..7f51dd2
  8264. --- /dev/null
  8265. +++ b/package/kernel/mac80211/patches/936-ath10k_skip_otp_check.patch
  8266. @@ -0,0 +1,42 @@
  8267. +--- a/drivers/net/wireless/ath/ath10k/core.c
  8268. ++++ b/drivers/net/wireless/ath/ath10k/core.c
  8269. +@@ -1168,9 +1168,6 @@ static int ath10k_core_fetch_firmware_fi
  8270. + {
  8271. + int ret;
  8272. +
  8273. +- /* calibration file is optional, don't check for any errors */
  8274. +- ath10k_fetch_cal_file(ar);
  8275. +-
  8276. + ar->fw_api = 5;
  8277. + ath10k_dbg(ar, ATH10K_DBG_BOOT, "trying fw api %d\n", ar->fw_api);
  8278. +
  8279. +@@ -1873,6 +1870,9 @@ static int ath10k_core_probe_fw(struct a
  8280. + goto err_power_down;
  8281. + }
  8282. +
  8283. ++ /* calibration file is optional, don't check for any errors */
  8284. ++ int calret = ath10k_fetch_cal_file(ar);
  8285. ++
  8286. + ret = ath10k_core_fetch_firmware_files(ar);
  8287. + if (ret) {
  8288. + ath10k_err(ar, "could not fetch firmware files (%d)\n", ret);
  8289. +@@ -1895,11 +1895,14 @@ static int ath10k_core_probe_fw(struct a
  8290. + "could not load pre cal data: %d\n", ret);
  8291. + }
  8292. +
  8293. +- ret = ath10k_core_get_board_id_from_otp(ar);
  8294. +- if (ret && ret != -EOPNOTSUPP) {
  8295. +- ath10k_err(ar, "failed to get board id from otp: %d\n",
  8296. +- ret);
  8297. +- goto err_free_firmware_files;
  8298. ++ /* otp and board file not needed if calibration data is present */
  8299. ++ if (calret) {
  8300. ++ ret = ath10k_core_get_board_id_from_otp(ar);
  8301. ++ if (ret && ret != -EOPNOTSUPP) {
  8302. ++ ath10k_err(ar, "failed to get board id from otp: %d\n",
  8303. ++ ret);
  8304. ++ goto err_free_firmware_files;
  8305. ++ }
  8306. + }
  8307. +
  8308. + ret = ath10k_core_fetch_board_file(ar);
  8309. diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile
  8310. index e49dd48..0f832e4 100644
  8311. --- a/package/kernel/mt76/Makefile
  8312. +++ b/package/kernel/mt76/Makefile
  8313. @@ -1,7 +1,7 @@
  8314. include $(TOPDIR)/rules.mk
  8315. PKG_NAME:=mt76
  8316. -PKG_VERSION:=2016-03-03
  8317. +PKG_VERSION:=2016-06-17
  8318. PKG_RELEASE=1
  8319. PKG_LICENSE:=GPLv2
  8320. @@ -10,23 +10,26 @@ PKG_LICENSE_FILES:=
  8321. PKG_SOURCE_URL:=https://github.com/openwrt/mt76
  8322. PKG_SOURCE_PROTO:=git
  8323. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  8324. -PKG_SOURCE_VERSION:=310d420178c86e253a172413da30ecf479b64251
  8325. +PKG_SOURCE_VERSION:=f06ed811cda67ab2ed9932c3e87ba03229e75f4e
  8326. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
  8327. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  8328. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  8329. PKG_BUILD_PARALLEL:=1
  8330. +STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h
  8331. +
  8332. include $(INCLUDE_DIR)/kernel.mk
  8333. include $(INCLUDE_DIR)/package.mk
  8334. define KernelPackage/mt76
  8335. SUBMENU:=Wireless Drivers
  8336. - TITLE:=MediaTek MT76x2 wireless driver
  8337. - DEPENDS:=+kmod-mac80211 +@DRIVER_11N_SUPPORT @PCI_SUPPORT
  8338. + TITLE:=MediaTek MT76x2/MT7603 wireless driver
  8339. + DEPENDS:=+kmod-mac80211 +@DRIVER_11N_SUPPORT @PCI_SUPPORT @!LINUX_3_18
  8340. FILES:=\
  8341. $(PKG_BUILD_DIR)/mt76.ko \
  8342. - $(PKG_BUILD_DIR)/mt76x2e.ko
  8343. - AUTOLOAD:=$(call AutoLoad,50,mac80211 mt76 mt76x2e)
  8344. + $(PKG_BUILD_DIR)/mt76x2e.ko \
  8345. + $(PKG_BUILD_DIR)/mt7603e.ko
  8346. + AUTOLOAD:=$(call AutoLoad,50,mac80211 mt76 mt76x2e mt7603e)
  8347. endef
  8348. NOSTDINC_FLAGS = \
  8349. @@ -54,6 +57,12 @@ endef
  8350. define KernelPackage/mt76/install
  8351. $(INSTALL_DIR) $(1)/lib/firmware
  8352. cp \
  8353. + $(if $(CONFIG_TARGET_ramips_mt7628) || $(CONFIG_TARGET_ramips_mt7688), \
  8354. + $(PKG_BUILD_DIR)/firmware/mt7628_e1.bin \
  8355. + $(PKG_BUILD_DIR)/firmware/mt7628_e2.bin \
  8356. + ) \
  8357. + $(PKG_BUILD_DIR)/firmware/mt7603_e1.bin \
  8358. + $(PKG_BUILD_DIR)/firmware/mt7603_e2.bin \
  8359. $(PKG_BUILD_DIR)/firmware/mt7662_rom_patch.bin \
  8360. $(PKG_BUILD_DIR)/firmware/mt7662.bin \
  8361. $(1)/lib/firmware
  8362. diff --git a/package/kernel/mwlwifi/Makefile b/package/kernel/mwlwifi/Makefile
  8363. index 091928d..6a59a02 100644
  8364. --- a/package/kernel/mwlwifi/Makefile
  8365. +++ b/package/kernel/mwlwifi/Makefile
  8366. @@ -8,7 +8,7 @@
  8367. include $(TOPDIR)/rules.mk
  8368. PKG_NAME:=mwlwifi
  8369. -PKG_VERSION:=10.3.0.16-20160105
  8370. +PKG_VERSION:=10.3.0.17-20160520-1
  8371. PKG_RELEASE=1
  8372. PKG_LICENSE:=ISC
  8373. @@ -17,7 +17,7 @@ PKG_LICENSE_FILES:=
  8374. PKG_SOURCE_URL:=https://github.com/kaloz/mwlwifi
  8375. PKG_SOURCE_PROTO:=git
  8376. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  8377. -PKG_SOURCE_VERSION:=99d3879cc72f2a25d44fb4bee96fd84eca028b04
  8378. +PKG_SOURCE_VERSION:=7d49296d12b44025278a52c5a26fb1b4236f320f
  8379. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
  8380. PKG_MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>
  8381. diff --git a/package/kernel/mwlwifi/patches/100-drop_old_api.patch b/package/kernel/mwlwifi/patches/100-drop_old_api.patch
  8382. index d2e149e..086edeb 100644
  8383. --- a/package/kernel/mwlwifi/patches/100-drop_old_api.patch
  8384. +++ b/package/kernel/mwlwifi/patches/100-drop_old_api.patch
  8385. @@ -1,6 +1,6 @@
  8386. --- a/main.c
  8387. +++ b/main.c
  8388. -@@ -418,11 +418,7 @@ static void mwl_set_ht_caps(struct mwl_p
  8389. +@@ -423,11 +423,7 @@ static void mwl_set_ht_caps(struct mwl_p
  8390. band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_20;
  8391. band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_40;
  8392. @@ -12,7 +12,7 @@
  8393. band->ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K;
  8394. band->ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_4;
  8395. -@@ -524,29 +520,16 @@ static int mwl_wl_init(struct mwl_priv *
  8396. +@@ -563,29 +559,16 @@ static int mwl_wl_init(struct mwl_priv *
  8397. hw->queues = SYSADPT_TX_WMM_QUEUES;
  8398. /* Set rssi values to dBm */
  8399. @@ -41,10 +41,10 @@
  8400. -#endif
  8401. hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
  8402. -
  8403. + hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH;
  8404. --- a/dev.h
  8405. +++ b/dev.h
  8406. -@@ -484,10 +484,6 @@ static inline struct mwl_sta *mwl_dev_ge
  8407. +@@ -506,10 +506,6 @@ static inline struct mwl_sta *mwl_dev_ge
  8408. return (struct mwl_sta *)&sta->drv_priv;
  8409. }
  8410. @@ -57,7 +57,7 @@
  8411. --- a/mac80211.c
  8412. +++ b/mac80211.c
  8413. -@@ -572,19 +572,11 @@ static int mwl_mac80211_get_survey(struc
  8414. +@@ -598,19 +598,11 @@ static int mwl_mac80211_get_survey(struc
  8415. return 0;
  8416. }
  8417. diff --git a/package/kernel/mwlwifi/patches/110-api_sync.patch b/package/kernel/mwlwifi/patches/110-api_sync.patch
  8418. index ed3e06a..920cb8c 100644
  8419. --- a/package/kernel/mwlwifi/patches/110-api_sync.patch
  8420. +++ b/package/kernel/mwlwifi/patches/110-api_sync.patch
  8421. @@ -1,6 +1,30 @@
  8422. --- a/mac80211.c
  8423. +++ b/mac80211.c
  8424. -@@ -597,10 +597,13 @@ static int mwl_mac80211_get_survey(struc
  8425. +@@ -260,12 +260,12 @@ static int mwl_mac80211_config(struct ie
  8426. + if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
  8427. + int rate = 0;
  8428. +
  8429. +- if (conf->chandef.chan->band == IEEE80211_BAND_2GHZ) {
  8430. ++ if (conf->chandef.chan->band == NL80211_BAND_2GHZ) {
  8431. + mwl_fwcmd_set_apmode(hw, AP_MODE_2_4GHZ_11AC_MIXED);
  8432. + mwl_fwcmd_set_linkadapt_cs_mode(hw,
  8433. + LINK_CS_STATE_CONSERV);
  8434. + rate = mwl_rates_24[0].hw_value;
  8435. +- } else if (conf->chandef.chan->band == IEEE80211_BAND_5GHZ) {
  8436. ++ } else if (conf->chandef.chan->band == NL80211_BAND_5GHZ) {
  8437. + mwl_fwcmd_set_apmode(hw, AP_MODE_11AC);
  8438. + mwl_fwcmd_set_linkadapt_cs_mode(hw,
  8439. + LINK_CS_STATE_AUTO);
  8440. +@@ -333,7 +333,7 @@ static void mwl_mac80211_bss_info_change
  8441. + if (idx)
  8442. + idx--;
  8443. +
  8444. +- if (hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ)
  8445. ++ if (hw->conf.chandef.chan->band == NL80211_BAND_2GHZ)
  8446. + rate = mwl_rates_24[idx].hw_value;
  8447. + else
  8448. + rate = mwl_rates_50[idx].hw_value;
  8449. +@@ -600,10 +600,13 @@ static int mwl_mac80211_get_survey(struc
  8450. static int mwl_mac80211_ampdu_action(struct ieee80211_hw *hw,
  8451. struct ieee80211_vif *vif,
  8452. @@ -17,3 +41,227 @@
  8453. int rc = 0;
  8454. struct mwl_priv *priv = hw->priv;
  8455. struct mwl_ampdu_stream *stream;
  8456. +--- a/fwcmd.c
  8457. ++++ b/fwcmd.c
  8458. +@@ -730,9 +730,9 @@ static int mwl_fwcmd_set_country_code(st
  8459. + bool enable = false;
  8460. +
  8461. + if (b_inf->ie_country_ptr) {
  8462. +- if (bss_conf->chandef.chan->band == IEEE80211_BAND_2GHZ)
  8463. ++ if (bss_conf->chandef.chan->band == NL80211_BAND_2GHZ)
  8464. + a_band = false;
  8465. +- else if (bss_conf->chandef.chan->band == IEEE80211_BAND_5GHZ)
  8466. ++ else if (bss_conf->chandef.chan->band == NL80211_BAND_5GHZ)
  8467. + a_band = true;
  8468. + else
  8469. + return -EINVAL;
  8470. +@@ -1075,9 +1075,9 @@ int mwl_fwcmd_max_tx_power(struct ieee80
  8471. + break;
  8472. + }
  8473. +
  8474. +- if (channel->band == IEEE80211_BAND_2GHZ)
  8475. ++ if (channel->band == NL80211_BAND_2GHZ)
  8476. + band = FREQ_BAND_2DOT4GHZ;
  8477. +- else if (channel->band == IEEE80211_BAND_5GHZ)
  8478. ++ else if (channel->band == NL80211_BAND_5GHZ)
  8479. + band = FREQ_BAND_5GHZ;
  8480. +
  8481. + switch (conf->chandef.width) {
  8482. +@@ -1161,9 +1161,9 @@ int mwl_fwcmd_tx_power(struct ieee80211_
  8483. + break;
  8484. + }
  8485. +
  8486. +- if (channel->band == IEEE80211_BAND_2GHZ)
  8487. ++ if (channel->band == NL80211_BAND_2GHZ)
  8488. + band = FREQ_BAND_2DOT4GHZ;
  8489. +- else if (channel->band == IEEE80211_BAND_5GHZ)
  8490. ++ else if (channel->band == NL80211_BAND_5GHZ)
  8491. + band = FREQ_BAND_5GHZ;
  8492. +
  8493. + switch (conf->chandef.width) {
  8494. +@@ -1354,9 +1354,9 @@ int mwl_fwcmd_set_rf_channel(struct ieee
  8495. + pcmd->action = cpu_to_le16(WL_SET);
  8496. + pcmd->curr_chnl = channel->hw_value;
  8497. +
  8498. +- if (channel->band == IEEE80211_BAND_2GHZ) {
  8499. ++ if (channel->band == NL80211_BAND_2GHZ) {
  8500. + freq_band = FREQ_BAND_2DOT4GHZ;
  8501. +- } else if (channel->band == IEEE80211_BAND_5GHZ) {
  8502. ++ } else if (channel->band == NL80211_BAND_5GHZ) {
  8503. + freq_band = FREQ_BAND_5GHZ;
  8504. + } else {
  8505. + mutex_unlock(&priv->fwcmd_mutex);
  8506. +@@ -1923,10 +1923,10 @@ int mwl_fwcmd_set_new_stn_add(struct iee
  8507. + }
  8508. + ether_addr_copy(pcmd->mac_addr, sta->addr);
  8509. +
  8510. +- if (hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ)
  8511. +- rates = sta->supp_rates[IEEE80211_BAND_2GHZ];
  8512. ++ if (hw->conf.chandef.chan->band == NL80211_BAND_2GHZ)
  8513. ++ rates = sta->supp_rates[NL80211_BAND_2GHZ];
  8514. + else
  8515. +- rates = sta->supp_rates[IEEE80211_BAND_5GHZ] << 5;
  8516. ++ rates = sta->supp_rates[NL80211_BAND_5GHZ] << 5;
  8517. + pcmd->peer_info.legacy_rate_bitmap = cpu_to_le32(rates);
  8518. +
  8519. + if (sta->ht_cap.ht_supported) {
  8520. +@@ -2097,9 +2097,9 @@ int mwl_fwcmd_set_switch_channel(struct
  8521. + if (priv->csa_active)
  8522. + return 0;
  8523. +
  8524. +- if (channel->band == IEEE80211_BAND_2GHZ)
  8525. ++ if (channel->band == NL80211_BAND_2GHZ)
  8526. + freq_band = FREQ_BAND_2DOT4GHZ;
  8527. +- else if (channel->band == IEEE80211_BAND_5GHZ)
  8528. ++ else if (channel->band == NL80211_BAND_5GHZ)
  8529. + freq_band = FREQ_BAND_5GHZ;
  8530. + else
  8531. + return -EINVAL;
  8532. +--- a/main.c
  8533. ++++ b/main.c
  8534. +@@ -63,20 +63,20 @@ static struct mwl_chip_info mwl_chip_tbl
  8535. + };
  8536. +
  8537. + static const struct ieee80211_channel mwl_channels_24[] = {
  8538. +- { .band = IEEE80211_BAND_2GHZ, .center_freq = 2412, .hw_value = 1, },
  8539. +- { .band = IEEE80211_BAND_2GHZ, .center_freq = 2417, .hw_value = 2, },
  8540. +- { .band = IEEE80211_BAND_2GHZ, .center_freq = 2422, .hw_value = 3, },
  8541. +- { .band = IEEE80211_BAND_2GHZ, .center_freq = 2427, .hw_value = 4, },
  8542. +- { .band = IEEE80211_BAND_2GHZ, .center_freq = 2432, .hw_value = 5, },
  8543. +- { .band = IEEE80211_BAND_2GHZ, .center_freq = 2437, .hw_value = 6, },
  8544. +- { .band = IEEE80211_BAND_2GHZ, .center_freq = 2442, .hw_value = 7, },
  8545. +- { .band = IEEE80211_BAND_2GHZ, .center_freq = 2447, .hw_value = 8, },
  8546. +- { .band = IEEE80211_BAND_2GHZ, .center_freq = 2452, .hw_value = 9, },
  8547. +- { .band = IEEE80211_BAND_2GHZ, .center_freq = 2457, .hw_value = 10, },
  8548. +- { .band = IEEE80211_BAND_2GHZ, .center_freq = 2462, .hw_value = 11, },
  8549. +- { .band = IEEE80211_BAND_2GHZ, .center_freq = 2467, .hw_value = 12, },
  8550. +- { .band = IEEE80211_BAND_2GHZ, .center_freq = 2472, .hw_value = 13, },
  8551. +- { .band = IEEE80211_BAND_2GHZ, .center_freq = 2484, .hw_value = 14, },
  8552. ++ { .band = NL80211_BAND_2GHZ, .center_freq = 2412, .hw_value = 1, },
  8553. ++ { .band = NL80211_BAND_2GHZ, .center_freq = 2417, .hw_value = 2, },
  8554. ++ { .band = NL80211_BAND_2GHZ, .center_freq = 2422, .hw_value = 3, },
  8555. ++ { .band = NL80211_BAND_2GHZ, .center_freq = 2427, .hw_value = 4, },
  8556. ++ { .band = NL80211_BAND_2GHZ, .center_freq = 2432, .hw_value = 5, },
  8557. ++ { .band = NL80211_BAND_2GHZ, .center_freq = 2437, .hw_value = 6, },
  8558. ++ { .band = NL80211_BAND_2GHZ, .center_freq = 2442, .hw_value = 7, },
  8559. ++ { .band = NL80211_BAND_2GHZ, .center_freq = 2447, .hw_value = 8, },
  8560. ++ { .band = NL80211_BAND_2GHZ, .center_freq = 2452, .hw_value = 9, },
  8561. ++ { .band = NL80211_BAND_2GHZ, .center_freq = 2457, .hw_value = 10, },
  8562. ++ { .band = NL80211_BAND_2GHZ, .center_freq = 2462, .hw_value = 11, },
  8563. ++ { .band = NL80211_BAND_2GHZ, .center_freq = 2467, .hw_value = 12, },
  8564. ++ { .band = NL80211_BAND_2GHZ, .center_freq = 2472, .hw_value = 13, },
  8565. ++ { .band = NL80211_BAND_2GHZ, .center_freq = 2484, .hw_value = 14, },
  8566. + };
  8567. +
  8568. + static const struct ieee80211_rate mwl_rates_24[] = {
  8569. +@@ -96,30 +96,30 @@ static const struct ieee80211_rate mwl_r
  8570. + };
  8571. +
  8572. + static const struct ieee80211_channel mwl_channels_50[] = {
  8573. +- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5180, .hw_value = 36, },
  8574. +- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5200, .hw_value = 40, },
  8575. +- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5220, .hw_value = 44, },
  8576. +- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5240, .hw_value = 48, },
  8577. +- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5260, .hw_value = 52, },
  8578. +- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5280, .hw_value = 56, },
  8579. +- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5300, .hw_value = 60, },
  8580. +- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5320, .hw_value = 64, },
  8581. +- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5500, .hw_value = 100, },
  8582. +- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5520, .hw_value = 104, },
  8583. +- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5540, .hw_value = 108, },
  8584. +- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5560, .hw_value = 112, },
  8585. +- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5580, .hw_value = 116, },
  8586. +- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5600, .hw_value = 120, },
  8587. +- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5620, .hw_value = 124, },
  8588. +- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5640, .hw_value = 128, },
  8589. +- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5660, .hw_value = 132, },
  8590. +- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5680, .hw_value = 136, },
  8591. +- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5700, .hw_value = 140, },
  8592. +- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5720, .hw_value = 144, },
  8593. +- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5745, .hw_value = 149, },
  8594. +- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5765, .hw_value = 153, },
  8595. +- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5785, .hw_value = 157, },
  8596. +- { .band = IEEE80211_BAND_5GHZ, .center_freq = 5805, .hw_value = 161, },
  8597. ++ { .band = NL80211_BAND_5GHZ, .center_freq = 5180, .hw_value = 36, },
  8598. ++ { .band = NL80211_BAND_5GHZ, .center_freq = 5200, .hw_value = 40, },
  8599. ++ { .band = NL80211_BAND_5GHZ, .center_freq = 5220, .hw_value = 44, },
  8600. ++ { .band = NL80211_BAND_5GHZ, .center_freq = 5240, .hw_value = 48, },
  8601. ++ { .band = NL80211_BAND_5GHZ, .center_freq = 5260, .hw_value = 52, },
  8602. ++ { .band = NL80211_BAND_5GHZ, .center_freq = 5280, .hw_value = 56, },
  8603. ++ { .band = NL80211_BAND_5GHZ, .center_freq = 5300, .hw_value = 60, },
  8604. ++ { .band = NL80211_BAND_5GHZ, .center_freq = 5320, .hw_value = 64, },
  8605. ++ { .band = NL80211_BAND_5GHZ, .center_freq = 5500, .hw_value = 100, },
  8606. ++ { .band = NL80211_BAND_5GHZ, .center_freq = 5520, .hw_value = 104, },
  8607. ++ { .band = NL80211_BAND_5GHZ, .center_freq = 5540, .hw_value = 108, },
  8608. ++ { .band = NL80211_BAND_5GHZ, .center_freq = 5560, .hw_value = 112, },
  8609. ++ { .band = NL80211_BAND_5GHZ, .center_freq = 5580, .hw_value = 116, },
  8610. ++ { .band = NL80211_BAND_5GHZ, .center_freq = 5600, .hw_value = 120, },
  8611. ++ { .band = NL80211_BAND_5GHZ, .center_freq = 5620, .hw_value = 124, },
  8612. ++ { .band = NL80211_BAND_5GHZ, .center_freq = 5640, .hw_value = 128, },
  8613. ++ { .band = NL80211_BAND_5GHZ, .center_freq = 5660, .hw_value = 132, },
  8614. ++ { .band = NL80211_BAND_5GHZ, .center_freq = 5680, .hw_value = 136, },
  8615. ++ { .band = NL80211_BAND_5GHZ, .center_freq = 5700, .hw_value = 140, },
  8616. ++ { .band = NL80211_BAND_5GHZ, .center_freq = 5720, .hw_value = 144, },
  8617. ++ { .band = NL80211_BAND_5GHZ, .center_freq = 5745, .hw_value = 149, },
  8618. ++ { .band = NL80211_BAND_5GHZ, .center_freq = 5765, .hw_value = 153, },
  8619. ++ { .band = NL80211_BAND_5GHZ, .center_freq = 5785, .hw_value = 157, },
  8620. ++ { .band = NL80211_BAND_5GHZ, .center_freq = 5805, .hw_value = 161, },
  8621. + };
  8622. +
  8623. + static const struct ieee80211_rate mwl_rates_50[] = {
  8624. +@@ -478,7 +478,7 @@ static void mwl_set_caps(struct mwl_priv
  8625. + BUILD_BUG_ON(sizeof(priv->rates_24) != sizeof(mwl_rates_24));
  8626. + memcpy(priv->rates_24, mwl_rates_24, sizeof(mwl_rates_24));
  8627. +
  8628. +- priv->band_24.band = IEEE80211_BAND_2GHZ;
  8629. ++ priv->band_24.band = NL80211_BAND_2GHZ;
  8630. + priv->band_24.channels = priv->channels_24;
  8631. + priv->band_24.n_channels = ARRAY_SIZE(mwl_channels_24);
  8632. + priv->band_24.bitrates = priv->rates_24;
  8633. +@@ -487,7 +487,7 @@ static void mwl_set_caps(struct mwl_priv
  8634. + mwl_set_ht_caps(priv, &priv->band_24);
  8635. + mwl_set_vht_caps(priv, &priv->band_24);
  8636. +
  8637. +- hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band_24;
  8638. ++ hw->wiphy->bands[NL80211_BAND_2GHZ] = &priv->band_24;
  8639. + }
  8640. +
  8641. + /* set up band information for 5G */
  8642. +@@ -500,7 +500,7 @@ static void mwl_set_caps(struct mwl_priv
  8643. + BUILD_BUG_ON(sizeof(priv->rates_50) != sizeof(mwl_rates_50));
  8644. + memcpy(priv->rates_50, mwl_rates_50, sizeof(mwl_rates_50));
  8645. +
  8646. +- priv->band_50.band = IEEE80211_BAND_5GHZ;
  8647. ++ priv->band_50.band = NL80211_BAND_5GHZ;
  8648. + priv->band_50.channels = priv->channels_50;
  8649. + priv->band_50.n_channels = ARRAY_SIZE(mwl_channels_50);
  8650. + priv->band_50.bitrates = priv->rates_50;
  8651. +@@ -509,7 +509,7 @@ static void mwl_set_caps(struct mwl_priv
  8652. + mwl_set_ht_caps(priv, &priv->band_50);
  8653. + mwl_set_vht_caps(priv, &priv->band_50);
  8654. +
  8655. +- hw->wiphy->bands[IEEE80211_BAND_5GHZ] = &priv->band_50;
  8656. ++ hw->wiphy->bands[NL80211_BAND_5GHZ] = &priv->band_50;
  8657. + }
  8658. + }
  8659. +
  8660. +--- a/rx.c
  8661. ++++ b/rx.c
  8662. +@@ -243,7 +243,7 @@ static inline void mwl_rx_prepare_status
  8663. + status->rate_idx = rt;
  8664. +
  8665. + if (pdesc->channel > BAND_24_CHANNEL_NUM) {
  8666. +- status->band = IEEE80211_BAND_5GHZ;
  8667. ++ status->band = NL80211_BAND_5GHZ;
  8668. + if ((!(status->flag & RX_FLAG_HT)) &&
  8669. + (!(status->flag & RX_FLAG_VHT))) {
  8670. + status->rate_idx -= 5;
  8671. +@@ -251,7 +251,7 @@ static inline void mwl_rx_prepare_status
  8672. + status->rate_idx = BAND_50_RATE_NUM - 1;
  8673. + }
  8674. + } else {
  8675. +- status->band = IEEE80211_BAND_2GHZ;
  8676. ++ status->band = NL80211_BAND_2GHZ;
  8677. + if ((!(status->flag & RX_FLAG_HT)) &&
  8678. + (!(status->flag & RX_FLAG_VHT))) {
  8679. + if (status->rate_idx >= BAND_24_RATE_NUM)
  8680. diff --git a/package/kernel/mwlwifi/patches/200-fix_excessive_delays.patch b/package/kernel/mwlwifi/patches/200-fix_excessive_delays.patch
  8681. new file mode 100644
  8682. index 0000000..43523ed
  8683. --- /dev/null
  8684. +++ b/package/kernel/mwlwifi/patches/200-fix_excessive_delays.patch
  8685. @@ -0,0 +1,73 @@
  8686. +--- a/fwcmd.c
  8687. ++++ b/fwcmd.c
  8688. +@@ -132,7 +132,7 @@ static int mwl_fwcmd_wait_complete(struc
  8689. + int_code = le16_to_cpu(*((__le16 *)&priv->pcmd_buf[2]));
  8690. + else
  8691. + int_code = le16_to_cpu(*((__le16 *)&priv->pcmd_buf[0]));
  8692. +- mdelay(1);
  8693. ++ usleep_range(1000, 2000);
  8694. + } while ((int_code != cmd) && (--curr_iteration));
  8695. +
  8696. + if (curr_iteration == 0) {
  8697. +@@ -142,7 +142,7 @@ static int mwl_fwcmd_wait_complete(struc
  8698. + return -EIO;
  8699. + }
  8700. +
  8701. +- mdelay(3);
  8702. ++ usleep_range(3000, 5000);
  8703. +
  8704. + return 0;
  8705. + }
  8706. +--- a/fwdl.c
  8707. ++++ b/fwdl.c
  8708. +@@ -74,7 +74,7 @@ int mwl_fwdl_download_firmware(struct ie
  8709. + /* FW before jumping to boot rom, it will enable PCIe transaction retry,
  8710. + * wait for boot code to stop it.
  8711. + */
  8712. +- mdelay(FW_CHECK_MSECS);
  8713. ++ usleep_range(FW_CHECK_MSECS * 1000, FW_CHECK_MSECS * 2000);
  8714. +
  8715. + writel(MACREG_A2HRIC_BIT_MASK,
  8716. + priv->iobase1 + MACREG_REG_A2H_INTERRUPT_CLEAR_SEL);
  8717. +@@ -95,7 +95,7 @@ int mwl_fwdl_download_firmware(struct ie
  8718. +
  8719. + /* make sure SCRATCH2 C40 is clear, in case we are too quick */
  8720. + while (readl(priv->iobase1 + 0xc40) == 0)
  8721. +- ;
  8722. ++ cond_resched();
  8723. +
  8724. + while (size_fw_downloaded < fw->size) {
  8725. + len = readl(priv->iobase1 + 0xc40);
  8726. +@@ -125,6 +125,7 @@ int mwl_fwdl_download_firmware(struct ie
  8727. + int_code = readl(priv->iobase1 + 0xc1c);
  8728. + if (int_code != 0)
  8729. + break;
  8730. ++ cond_resched();
  8731. + curr_iteration--;
  8732. + } while (curr_iteration);
  8733. +
  8734. +@@ -133,6 +134,7 @@ int mwl_fwdl_download_firmware(struct ie
  8735. + if ((int_code & MACREG_H2ARIC_BIT_DOOR_BELL) !=
  8736. + MACREG_H2ARIC_BIT_DOOR_BELL)
  8737. + break;
  8738. ++ cond_resched();
  8739. + curr_iteration--;
  8740. + } while (curr_iteration);
  8741. +
  8742. +@@ -167,12 +169,14 @@ int mwl_fwdl_download_firmware(struct ie
  8743. + do {
  8744. + curr_iteration--;
  8745. + if (priv->mfg_mode && priv->chip_type == MWL8897) {
  8746. +- mdelay(FW_CHECK_MSECS);
  8747. ++ usleep_range(FW_CHECK_MSECS * 1000,
  8748. ++ FW_CHECK_MSECS * 2000);
  8749. + int_code = readl(priv->iobase1 + 0xc44);
  8750. + } else {
  8751. + writel(HOSTCMD_SOFTAP_MODE,
  8752. + priv->iobase1 + MACREG_REG_GEN_PTR);
  8753. +- mdelay(FW_CHECK_MSECS);
  8754. ++ usleep_range(FW_CHECK_MSECS * 1000,
  8755. ++ FW_CHECK_MSECS * 2000);
  8756. + int_code = readl(priv->iobase1 + MACREG_REG_INT_CODE);
  8757. + }
  8758. + if (!(curr_iteration % 0xff) && (int_code != 0))
  8759. diff --git a/package/kernel/mwlwifi/patches/210-fix_logspam.patch b/package/kernel/mwlwifi/patches/210-fix_logspam.patch
  8760. new file mode 100644
  8761. index 0000000..99b247f
  8762. --- /dev/null
  8763. +++ b/package/kernel/mwlwifi/patches/210-fix_logspam.patch
  8764. @@ -0,0 +1,22 @@
  8765. +--- a/fwcmd.c
  8766. ++++ b/fwcmd.c
  8767. +@@ -2393,8 +2393,6 @@ int mwl_fwcmd_check_ba(struct ieee80211_
  8768. +
  8769. + if (pcmd->cmd_hdr.result != 0) {
  8770. + mutex_unlock(&priv->fwcmd_mutex);
  8771. +- wiphy_err(hw->wiphy, "check ba result error %d\n",
  8772. +- le16_to_cpu(pcmd->cmd_hdr.result));
  8773. + return -EINVAL;
  8774. + }
  8775. +
  8776. +--- a/mac80211.c
  8777. ++++ b/mac80211.c
  8778. +@@ -644,8 +644,6 @@ static int mwl_mac80211_ampdu_action(str
  8779. + spin_lock_bh(&priv->stream_lock);
  8780. + if (rc) {
  8781. + mwl_fwcmd_remove_stream(hw, stream);
  8782. +- wiphy_err(hw->wiphy,
  8783. +- "ampdu start error code: %d\n", rc);
  8784. + rc = -EPERM;
  8785. + break;
  8786. + }
  8787. diff --git a/package/network/utils/iw/Makefile b/package/network/utils/iw/Makefile
  8788. index ad82081..d17cbca 100644
  8789. --- a/package/network/utils/iw/Makefile
  8790. +++ b/package/network/utils/iw/Makefile
  8791. @@ -12,10 +12,10 @@ PKG_VERSION:=4.3
  8792. PKG_RELEASE:=1
  8793. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  8794. -PKG_SOURCE_URL:=https://www.kernel.org/pub/software/network/iw
  8795. +PKG_SOURCE_URL:=@KERNEL/software/network/iw
  8796. PKG_MD5SUM:=7adec72e91ebdd9c55429fa34a23a6f5
  8797. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  8798. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  8799. PKG_LICENSE:=GPL-2.0
  8800. include $(INCLUDE_DIR)/package.mk
  8801. diff --git a/package/network/utils/iw/patches/001-nl80211_h_sync.patch b/package/network/utils/iw/patches/001-nl80211_h_sync.patch
  8802. index 7de2258..e5ea8f7 100644
  8803. --- a/package/network/utils/iw/patches/001-nl80211_h_sync.patch
  8804. +++ b/package/network/utils/iw/patches/001-nl80211_h_sync.patch
  8805. @@ -8,7 +8,17 @@
  8806. *
  8807. * Permission to use, copy, modify, and/or distribute this software for any
  8808. * purpose with or without fee is hereby granted, provided that the above
  8809. -@@ -328,7 +329,15 @@
  8810. +@@ -321,14 +322,24 @@
  8811. + * @NL80211_CMD_GET_SCAN: get scan results
  8812. + * @NL80211_CMD_TRIGGER_SCAN: trigger a new scan with the given parameters
  8813. + * %NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the
  8814. +- * probe requests at CCK rate or not.
  8815. ++ * probe requests at CCK rate or not. %NL80211_ATTR_MAC can be used to
  8816. ++ * specify a BSSID to scan for; if not included, the wildcard BSSID will
  8817. ++ * be used.
  8818. + * @NL80211_CMD_NEW_SCAN_RESULTS: scan notification (as a reply to
  8819. + * NL80211_CMD_GET_SCAN and on the "scan" multicast group)
  8820. + * @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons,
  8821. * partial scan results may be available
  8822. *
  8823. * @NL80211_CMD_START_SCHED_SCAN: start a scheduled scan at certain
  8824. @@ -25,7 +35,82 @@
  8825. * Like with normal scans, if SSIDs (%NL80211_ATTR_SCAN_SSIDS)
  8826. * are passed, they are used in the probe requests. For
  8827. * broadcast, a broadcast SSID must be passed (ie. an empty
  8828. -@@ -1761,6 +1770,22 @@ enum nl80211_commands {
  8829. +@@ -418,7 +429,11 @@
  8830. + * @NL80211_CMD_ASSOCIATE: association request and notification; like
  8831. + * NL80211_CMD_AUTHENTICATE but for Association and Reassociation
  8832. + * (similar to MLME-ASSOCIATE.request, MLME-REASSOCIATE.request,
  8833. +- * MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitives).
  8834. ++ * MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitives). The
  8835. ++ * %NL80211_ATTR_PREV_BSSID attribute is used to specify whether the
  8836. ++ * request is for the initial association to an ESS (that attribute not
  8837. ++ * included) or for reassociation within the ESS (that attribute is
  8838. ++ * included).
  8839. + * @NL80211_CMD_DEAUTHENTICATE: deauthentication request and notification; like
  8840. + * NL80211_CMD_AUTHENTICATE but for Deauthentication frames (similar to
  8841. + * MLME-DEAUTHENTICATION.request and MLME-DEAUTHENTICATE.indication
  8842. +@@ -468,6 +483,9 @@
  8843. + * set of BSSID,frequency parameters is used (i.e., either the enforcing
  8844. + * %NL80211_ATTR_MAC,%NL80211_ATTR_WIPHY_FREQ or the less strict
  8845. + * %NL80211_ATTR_MAC_HINT and %NL80211_ATTR_WIPHY_FREQ_HINT).
  8846. ++ * %NL80211_ATTR_PREV_BSSID can be used to request a reassociation within
  8847. ++ * the ESS in case the device is already associated and an association with
  8848. ++ * a different BSS is desired.
  8849. + * Background scan period can optionally be
  8850. + * specified in %NL80211_ATTR_BG_SCAN_PERIOD,
  8851. + * if not specified default background scan configuration
  8852. +@@ -811,6 +829,10 @@
  8853. + * as an event to indicate changes for devices with wiphy-specific regdom
  8854. + * management.
  8855. + *
  8856. ++ * @NL80211_CMD_ABORT_SCAN: Stop an ongoing scan. Returns -ENOENT if a scan is
  8857. ++ * not running. The driver indicates the status of the scan through
  8858. ++ * cfg80211_scan_done().
  8859. ++ *
  8860. + * @NL80211_CMD_MAX: highest used command number
  8861. + * @__NL80211_CMD_AFTER_LAST: internal use
  8862. + */
  8863. +@@ -997,6 +1019,8 @@ enum nl80211_commands {
  8864. +
  8865. + NL80211_CMD_WIPHY_REG_CHANGE,
  8866. +
  8867. ++ NL80211_CMD_ABORT_SCAN,
  8868. ++
  8869. + /* add new commands above here */
  8870. +
  8871. + /* used to define NL80211_CMD_MAX below */
  8872. +@@ -1270,8 +1294,11 @@ enum nl80211_commands {
  8873. + * @NL80211_ATTR_RESP_IE: (Re)association response information elements as
  8874. + * sent by peer, for ROAM and successful CONNECT events.
  8875. + *
  8876. +- * @NL80211_ATTR_PREV_BSSID: previous BSSID, to be used by in ASSOCIATE
  8877. +- * commands to specify using a reassociate frame
  8878. ++ * @NL80211_ATTR_PREV_BSSID: previous BSSID, to be used in ASSOCIATE and CONNECT
  8879. ++ * commands to specify a request to reassociate within an ESS, i.e., to use
  8880. ++ * Reassociate Request frame (with the value of this attribute in the
  8881. ++ * Current AP address field) instead of Association Request frame which is
  8882. ++ * used for the initial association to an ESS.
  8883. + *
  8884. + * @NL80211_ATTR_KEY: key information in a nested attribute with
  8885. + * %NL80211_KEY_* sub-attributes
  8886. +@@ -1712,6 +1739,8 @@ enum nl80211_commands {
  8887. + * underlying device supports these minimal RRM features:
  8888. + * %NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES,
  8889. + * %NL80211_FEATURE_QUIET,
  8890. ++ * Or, if global RRM is supported, see:
  8891. ++ * %NL80211_EXT_FEATURE_RRM
  8892. + * If this flag is used, driver must add the Power Capabilities IE to the
  8893. + * association request. In addition, it must also set the RRM capability
  8894. + * flag in the association request's Capability Info field.
  8895. +@@ -1755,12 +1784,44 @@ enum nl80211_commands {
  8896. + * over all channels.
  8897. + *
  8898. + * @NL80211_ATTR_SCHED_SCAN_DELAY: delay before the first cycle of a
  8899. +- * scheduled scan (or a WoWLAN net-detect scan) is started, u32
  8900. +- * in seconds.
  8901. ++ * scheduled scan is started. Or the delay before a WoWLAN
  8902. ++ * net-detect scan is started, counting from the moment the
  8903. ++ * system is suspended. This value is a u32, in seconds.
  8904. +
  8905. * @NL80211_ATTR_REG_INDOOR: flag attribute, if set indicates that the device
  8906. * is operating in an indoor environment.
  8907. *
  8908. @@ -41,6 +126,21 @@
  8909. + * thus it must not specify the number of iterations, only the interval
  8910. + * between scans. The scan plans are executed sequentially.
  8911. + * Each scan plan is a nested attribute of &enum nl80211_sched_scan_plan.
  8912. ++ * @NL80211_ATTR_PBSS: flag attribute. If set it means operate
  8913. ++ * in a PBSS. Specified in %NL80211_CMD_CONNECT to request
  8914. ++ * connecting to a PCP, and in %NL80211_CMD_START_AP to start
  8915. ++ * a PCP instead of AP. Relevant for DMG networks only.
  8916. ++ * @NL80211_ATTR_BSS_SELECT: nested attribute for driver supporting the
  8917. ++ * BSS selection feature. When used with %NL80211_CMD_GET_WIPHY it contains
  8918. ++ * attributes according &enum nl80211_bss_select_attr to indicate what
  8919. ++ * BSS selection behaviours are supported. When used with %NL80211_CMD_CONNECT
  8920. ++ * it contains the behaviour-specific attribute containing the parameters for
  8921. ++ * BSS selection to be done by driver and/or firmware.
  8922. ++ *
  8923. ++ * @NL80211_ATTR_STA_SUPPORT_P2P_PS: whether P2P PS mechanism supported
  8924. ++ * or not. u8, one of the values of &enum nl80211_sta_p2p_ps_status
  8925. ++ *
  8926. ++ * @NL80211_ATTR_PAD: attribute used for padding for 64-bit alignment
  8927. + *
  8928. + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
  8929. + * transmit power to stay within regulatory limits. u32, dBi.
  8930. @@ -48,7 +148,7 @@
  8931. * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  8932. * @NL80211_ATTR_MAX: highest attribute number currently defined
  8933. * @__NL80211_ATTR_AFTER_LAST: internal use
  8934. -@@ -2130,6 +2155,13 @@ enum nl80211_attrs {
  8935. +@@ -2130,6 +2191,21 @@ enum nl80211_attrs {
  8936. NL80211_ATTR_REG_INDOOR,
  8937. @@ -57,30 +157,147 @@
  8938. + NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS,
  8939. + NL80211_ATTR_SCHED_SCAN_PLANS,
  8940. +
  8941. ++ NL80211_ATTR_PBSS,
  8942. ++
  8943. ++ NL80211_ATTR_BSS_SELECT,
  8944. ++
  8945. ++ NL80211_ATTR_STA_SUPPORT_P2P_PS,
  8946. ++
  8947. ++ NL80211_ATTR_PAD,
  8948. ++
  8949. + NL80211_ATTR_WIPHY_ANTENNA_GAIN,
  8950. +
  8951. /* add attributes here, update the policy in nl80211.c */
  8952. __NL80211_ATTR_AFTER_LAST,
  8953. -@@ -3364,6 +3396,9 @@ enum nl80211_bss_scan_width {
  8954. +@@ -2273,6 +2349,20 @@ enum nl80211_sta_flags {
  8955. + NL80211_STA_FLAG_MAX = __NL80211_STA_FLAG_AFTER_LAST - 1
  8956. + };
  8957. +
  8958. ++/**
  8959. ++ * enum nl80211_sta_p2p_ps_status - station support of P2P PS
  8960. ++ *
  8961. ++ * @NL80211_P2P_PS_UNSUPPORTED: station doesn't support P2P PS mechanism
  8962. ++ * @@NL80211_P2P_PS_SUPPORTED: station supports P2P PS mechanism
  8963. ++ * @NUM_NL80211_P2P_PS_STATUS: number of values
  8964. ++ */
  8965. ++enum nl80211_sta_p2p_ps_status {
  8966. ++ NL80211_P2P_PS_UNSUPPORTED = 0,
  8967. ++ NL80211_P2P_PS_SUPPORTED,
  8968. ++
  8969. ++ NUM_NL80211_P2P_PS_STATUS,
  8970. ++};
  8971. ++
  8972. + #define NL80211_STA_FLAG_MAX_OLD_API NL80211_STA_FLAG_TDLS_PEER
  8973. +
  8974. + /**
  8975. +@@ -2430,6 +2520,9 @@ enum nl80211_sta_bss_param {
  8976. + * TID+1 and the special TID 16 (i.e. value 17) is used for non-QoS frames;
  8977. + * each one of those is again nested with &enum nl80211_tid_stats
  8978. + * attributes carrying the actual values.
  8979. ++ * @NL80211_STA_INFO_RX_DURATION: aggregate PPDU duration for all frames
  8980. ++ * received from the station (u64, usec)
  8981. ++ * @NL80211_STA_INFO_PAD: attribute used for padding for 64-bit alignment
  8982. + * @__NL80211_STA_INFO_AFTER_LAST: internal
  8983. + * @NL80211_STA_INFO_MAX: highest possible station info attribute
  8984. + */
  8985. +@@ -2466,6 +2559,8 @@ enum nl80211_sta_info {
  8986. + NL80211_STA_INFO_BEACON_RX,
  8987. + NL80211_STA_INFO_BEACON_SIGNAL_AVG,
  8988. + NL80211_STA_INFO_TID_STATS,
  8989. ++ NL80211_STA_INFO_RX_DURATION,
  8990. ++ NL80211_STA_INFO_PAD,
  8991. +
  8992. + /* keep last */
  8993. + __NL80211_STA_INFO_AFTER_LAST,
  8994. +@@ -2482,6 +2577,7 @@ enum nl80211_sta_info {
  8995. + * transmitted MSDUs (not counting the first attempt; u64)
  8996. + * @NL80211_TID_STATS_TX_MSDU_FAILED: number of failed transmitted
  8997. + * MSDUs (u64)
  8998. ++ * @NL80211_TID_STATS_PAD: attribute used for padding for 64-bit alignment
  8999. + * @NUM_NL80211_TID_STATS: number of attributes here
  9000. + * @NL80211_TID_STATS_MAX: highest numbered attribute here
  9001. + */
  9002. +@@ -2491,6 +2587,7 @@ enum nl80211_tid_stats {
  9003. + NL80211_TID_STATS_TX_MSDU,
  9004. + NL80211_TID_STATS_TX_MSDU_RETRIES,
  9005. + NL80211_TID_STATS_TX_MSDU_FAILED,
  9006. ++ NL80211_TID_STATS_PAD,
  9007. +
  9008. + /* keep last */
  9009. + NUM_NL80211_TID_STATS,
  9010. +@@ -2927,6 +3024,7 @@ enum nl80211_user_reg_hint_type {
  9011. + * transmitting data (on channel or globally)
  9012. + * @NL80211_SURVEY_INFO_TIME_SCAN: time the radio spent for scan
  9013. + * (on this channel or globally)
  9014. ++ * @NL80211_SURVEY_INFO_PAD: attribute used for padding for 64-bit alignment
  9015. + * @NL80211_SURVEY_INFO_MAX: highest survey info attribute number
  9016. + * currently defined
  9017. + * @__NL80211_SURVEY_INFO_AFTER_LAST: internal use
  9018. +@@ -2942,6 +3040,7 @@ enum nl80211_survey_info {
  9019. + NL80211_SURVEY_INFO_TIME_RX,
  9020. + NL80211_SURVEY_INFO_TIME_TX,
  9021. + NL80211_SURVEY_INFO_TIME_SCAN,
  9022. ++ NL80211_SURVEY_INFO_PAD,
  9023. +
  9024. + /* keep last */
  9025. + __NL80211_SURVEY_INFO_AFTER_LAST,
  9026. +@@ -3364,6 +3463,10 @@ enum nl80211_bss_scan_width {
  9027. * (not present if no beacon frame has been received yet)
  9028. * @NL80211_BSS_PRESP_DATA: the data in @NL80211_BSS_INFORMATION_ELEMENTS and
  9029. * @NL80211_BSS_TSF is known to be from a probe response (flag attribute)
  9030. + * @NL80211_BSS_LAST_SEEN_BOOTTIME: CLOCK_BOOTTIME timestamp when this entry
  9031. + * was last updated by a received frame. The value is expected to be
  9032. + * accurate to about 10ms. (u64, nanoseconds)
  9033. ++ * @NL80211_BSS_PAD: attribute used for padding for 64-bit alignment
  9034. * @__NL80211_BSS_AFTER_LAST: internal
  9035. * @NL80211_BSS_MAX: highest BSS attribute
  9036. */
  9037. -@@ -3383,6 +3418,7 @@ enum nl80211_bss {
  9038. +@@ -3383,6 +3486,8 @@ enum nl80211_bss {
  9039. NL80211_BSS_CHAN_WIDTH,
  9040. NL80211_BSS_BEACON_TSF,
  9041. NL80211_BSS_PRESP_DATA,
  9042. + NL80211_BSS_LAST_SEEN_BOOTTIME,
  9043. ++ NL80211_BSS_PAD,
  9044. /* keep last */
  9045. __NL80211_BSS_AFTER_LAST,
  9046. -@@ -4589,4 +4625,28 @@ enum nl80211_tdls_peer_capability {
  9047. +@@ -3568,11 +3673,15 @@ enum nl80211_txrate_gi {
  9048. + * @NL80211_BAND_2GHZ: 2.4 GHz ISM band
  9049. + * @NL80211_BAND_5GHZ: around 5 GHz band (4.9 - 5.7 GHz)
  9050. + * @NL80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz)
  9051. ++ * @NUM_NL80211_BANDS: number of bands, avoid using this in userspace
  9052. ++ * since newer kernel versions may support more bands
  9053. + */
  9054. + enum nl80211_band {
  9055. + NL80211_BAND_2GHZ,
  9056. + NL80211_BAND_5GHZ,
  9057. + NL80211_BAND_60GHZ,
  9058. ++
  9059. ++ NUM_NL80211_BANDS,
  9060. + };
  9061. +
  9062. + /**
  9063. +@@ -4358,12 +4467,18 @@ enum nl80211_feature_flags {
  9064. + /**
  9065. + * enum nl80211_ext_feature_index - bit index of extended features.
  9066. + * @NL80211_EXT_FEATURE_VHT_IBSS: This driver supports IBSS with VHT datarates.
  9067. ++ * @NL80211_EXT_FEATURE_RRM: This driver supports RRM. When featured, user can
  9068. ++ * can request to use RRM (see %NL80211_ATTR_USE_RRM) with
  9069. ++ * %NL80211_CMD_ASSOCIATE and %NL80211_CMD_CONNECT requests, which will set
  9070. ++ * the ASSOC_REQ_USE_RRM flag in the association request even if
  9071. ++ * NL80211_FEATURE_QUIET is not advertized.
  9072. + *
  9073. + * @NUM_NL80211_EXT_FEATURES: number of extended features.
  9074. + * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
  9075. + */
  9076. + enum nl80211_ext_feature_index {
  9077. + NL80211_EXT_FEATURE_VHT_IBSS,
  9078. ++ NL80211_EXT_FEATURE_RRM,
  9079. +
  9080. + /* add new features before the definition below */
  9081. + NUM_NL80211_EXT_FEATURES,
  9082. +@@ -4589,4 +4704,72 @@ enum nl80211_tdls_peer_capability {
  9083. NL80211_TDLS_PEER_WMM = 1<<2,
  9084. };
  9085. @@ -108,4 +325,48 @@
  9086. + __NL80211_SCHED_SCAN_PLAN_AFTER_LAST - 1
  9087. +};
  9088. +
  9089. ++/**
  9090. ++ * struct nl80211_bss_select_rssi_adjust - RSSI adjustment parameters.
  9091. ++ *
  9092. ++ * @band: band of BSS that must match for RSSI value adjustment.
  9093. ++ * @delta: value used to adjust the RSSI value of matching BSS.
  9094. ++ */
  9095. ++struct nl80211_bss_select_rssi_adjust {
  9096. ++ __u8 band;
  9097. ++ __s8 delta;
  9098. ++} __attribute__((packed));
  9099. ++
  9100. ++/**
  9101. ++ * enum nl80211_bss_select_attr - attributes for bss selection.
  9102. ++ *
  9103. ++ * @__NL80211_BSS_SELECT_ATTR_INVALID: reserved.
  9104. ++ * @NL80211_BSS_SELECT_ATTR_RSSI: Flag indicating only RSSI-based BSS selection
  9105. ++ * is requested.
  9106. ++ * @NL80211_BSS_SELECT_ATTR_BAND_PREF: attribute indicating BSS
  9107. ++ * selection should be done such that the specified band is preferred.
  9108. ++ * When there are multiple BSS-es in the preferred band, the driver
  9109. ++ * shall use RSSI-based BSS selection as a second step. The value of
  9110. ++ * this attribute is according to &enum nl80211_band (u32).
  9111. ++ * @NL80211_BSS_SELECT_ATTR_RSSI_ADJUST: When present the RSSI level for
  9112. ++ * BSS-es in the specified band is to be adjusted before doing
  9113. ++ * RSSI-based BSS selection. The attribute value is a packed structure
  9114. ++ * value as specified by &struct nl80211_bss_select_rssi_adjust.
  9115. ++ * @NL80211_BSS_SELECT_ATTR_MAX: highest bss select attribute number.
  9116. ++ * @__NL80211_BSS_SELECT_ATTR_AFTER_LAST: internal use.
  9117. ++ *
  9118. ++ * One and only one of these attributes are found within %NL80211_ATTR_BSS_SELECT
  9119. ++ * for %NL80211_CMD_CONNECT. It specifies the required BSS selection behaviour
  9120. ++ * which the driver shall use.
  9121. ++ */
  9122. ++enum nl80211_bss_select_attr {
  9123. ++ __NL80211_BSS_SELECT_ATTR_INVALID,
  9124. ++ NL80211_BSS_SELECT_ATTR_RSSI,
  9125. ++ NL80211_BSS_SELECT_ATTR_BAND_PREF,
  9126. ++ NL80211_BSS_SELECT_ATTR_RSSI_ADJUST,
  9127. ++
  9128. ++ /* keep last */
  9129. ++ __NL80211_BSS_SELECT_ATTR_AFTER_LAST,
  9130. ++ NL80211_BSS_SELECT_ATTR_MAX = __NL80211_BSS_SELECT_ATTR_AFTER_LAST - 1
  9131. ++};
  9132. ++
  9133. #endif /* __LINUX_NL80211_H */
  9134. diff --git a/package/network/utils/iw/patches/300-display_interface_TX_power.patch b/package/network/utils/iw/patches/300-display_interface_TX_power.patch
  9135. index 574c490..2cdf360 100644
  9136. --- a/package/network/utils/iw/patches/300-display_interface_TX_power.patch
  9137. +++ b/package/network/utils/iw/patches/300-display_interface_TX_power.patch
  9138. @@ -12,11 +12,9 @@ Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9139. interface.c | 7 +++++++
  9140. 1 file changed, 7 insertions(+)
  9141. -diff --git a/interface.c b/interface.c
  9142. -index 73ccecd..4f0821d 100644
  9143. --- a/interface.c
  9144. +++ b/interface.c
  9145. -@@ -368,6 +368,13 @@ static int print_iface_handler(struct nl_msg *msg, void *arg)
  9146. +@@ -368,6 +368,13 @@ static int print_iface_handler(struct nl
  9147. printf("\n");
  9148. }
  9149. diff --git a/package/network/utils/iw/patches/301-ibss_add_VHT80.patch b/package/network/utils/iw/patches/301-ibss_add_VHT80.patch
  9150. index 709fbb2..0627bcc 100644
  9151. --- a/package/network/utils/iw/patches/301-ibss_add_VHT80.patch
  9152. +++ b/package/network/utils/iw/patches/301-ibss_add_VHT80.patch
  9153. @@ -14,8 +14,6 @@ Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9154. ibss.c | 49 +++++++++++++++++++++++++++++++++++++++++--------
  9155. 1 file changed, 41 insertions(+), 8 deletions(-)
  9156. -diff --git a/ibss.c b/ibss.c
  9157. -index 7a0b707..a99a262 100644
  9158. --- a/ibss.c
  9159. +++ b/ibss.c
  9160. @@ -16,6 +16,39 @@
  9161. @@ -58,7 +56,7 @@ index 7a0b707..a99a262 100644
  9162. static int join_ibss(struct nl80211_state *state,
  9163. struct nl_msg *msg,
  9164. int argc, char **argv,
  9165. -@@ -30,12 +63,8 @@ static int join_ibss(struct nl80211_state *state,
  9166. +@@ -30,12 +63,8 @@ static int join_ibss(struct nl80211_stat
  9167. int bintval;
  9168. int i;
  9169. unsigned long freq;
  9170. @@ -73,7 +71,7 @@ index 7a0b707..a99a262 100644
  9171. { .name = "HT20",
  9172. .width = NL80211_CHAN_WIDTH_20,
  9173. .freq1_diff = 0,
  9174. -@@ -60,6 +89,10 @@ static int join_ibss(struct nl80211_state *state,
  9175. +@@ -60,6 +89,10 @@ static int join_ibss(struct nl80211_stat
  9176. .width = NL80211_CHAN_WIDTH_10,
  9177. .freq1_diff = 0,
  9178. .chantype = -1 },
  9179. @@ -84,7 +82,7 @@ index 7a0b707..a99a262 100644
  9180. };
  9181. if (argc < 2)
  9182. -@@ -90,7 +123,7 @@ static int join_ibss(struct nl80211_state *state,
  9183. +@@ -90,7 +123,7 @@ static int join_ibss(struct nl80211_stat
  9184. NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
  9185. chanmode_selected->width);
  9186. NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ1,
  9187. diff --git a/package/network/utils/iw/patches/302-ibss_use_MHz_instead_MHZ.patch b/package/network/utils/iw/patches/302-ibss_use_MHz_instead_MHZ.patch
  9188. index fc44427..f96d5ea 100644
  9189. --- a/package/network/utils/iw/patches/302-ibss_use_MHz_instead_MHZ.patch
  9190. +++ b/package/network/utils/iw/patches/302-ibss_use_MHz_instead_MHZ.patch
  9191. @@ -7,11 +7,9 @@ Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  9192. ibss.c | 8 ++++----
  9193. 1 file changed, 4 insertions(+), 4 deletions(-)
  9194. -diff --git a/ibss.c b/ibss.c
  9195. -index a99a262..23bda70 100644
  9196. --- a/ibss.c
  9197. +++ b/ibss.c
  9198. -@@ -81,15 +81,15 @@ static int join_ibss(struct nl80211_state *state,
  9199. +@@ -81,15 +81,15 @@ static int join_ibss(struct nl80211_stat
  9200. .width = NL80211_CHAN_WIDTH_20_NOHT,
  9201. .freq1_diff = 0,
  9202. .chantype = NL80211_CHAN_NO_HT },
  9203. diff --git a/package/network/utils/iw/patches/303-mesh_add_VHT80.patch b/package/network/utils/iw/patches/303-mesh_add_VHT80.patch
  9204. index fe8dc21..956b050 100644
  9205. --- a/package/network/utils/iw/patches/303-mesh_add_VHT80.patch
  9206. +++ b/package/network/utils/iw/patches/303-mesh_add_VHT80.patch
  9207. @@ -15,8 +15,6 @@ Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  9208. util.c | 26 ++++++++++++++++++++++++++
  9209. 4 files changed, 43 insertions(+), 41 deletions(-)
  9210. -diff --git a/ibss.c b/ibss.c
  9211. -index 23bda70..ac06fc5 100644
  9212. --- a/ibss.c
  9213. +++ b/ibss.c
  9214. @@ -16,39 +16,6 @@
  9215. @@ -59,8 +57,6 @@ index 23bda70..ac06fc5 100644
  9216. static int join_ibss(struct nl80211_state *state,
  9217. struct nl_msg *msg,
  9218. int argc, char **argv,
  9219. -diff --git a/iw.h b/iw.h
  9220. -index cef9da8..8e1a37a 100644
  9221. --- a/iw.h
  9222. +++ b/iw.h
  9223. @@ -59,6 +59,13 @@ struct cmd {
  9224. @@ -77,7 +73,7 @@ index cef9da8..8e1a37a 100644
  9225. #define ARRAY_SIZE(ar) (sizeof(ar)/sizeof(ar[0]))
  9226. #define DIV_ROUND_UP(x, y) (((x) + (y - 1)) / (y))
  9227. -@@ -174,6 +181,8 @@ void print_ies(unsigned char *ie, int ielen, bool unknown,
  9228. +@@ -174,6 +181,8 @@ void print_ies(unsigned char *ie, int ie
  9229. void parse_bitrate(struct nlattr *bitrate_attr, char *buf, int buflen);
  9230. void iw_hexdump(const char *prefix, const __u8 *data, size_t len);
  9231. @@ -86,11 +82,9 @@ index cef9da8..8e1a37a 100644
  9232. #define SCHED_SCAN_OPTIONS "interval <in_msecs> [delay <in_secs>] " \
  9233. "[freqs <freq>+] [matches [ssid <ssid>]+]] [active [ssid <ssid>]+|passive] [randomise[=<addr>/<mask>]]"
  9234. int parse_sched_scan(struct nl_msg *msg, int *argc, char ***argv);
  9235. -diff --git a/mesh.c b/mesh.c
  9236. -index 0090530..930d58f 100644
  9237. --- a/mesh.c
  9238. +++ b/mesh.c
  9239. -@@ -439,12 +439,8 @@ static int join_mesh(struct nl80211_state *state,
  9240. +@@ -439,12 +439,8 @@ static int join_mesh(struct nl80211_stat
  9241. int bintval, dtim_period, i, n_rates = 0;
  9242. char *end, *value = NULL, *sptr = NULL;
  9243. unsigned long freq = 0;
  9244. @@ -105,7 +99,7 @@ index 0090530..930d58f 100644
  9245. { .name = "HT20",
  9246. .width = NL80211_CHAN_WIDTH_20,
  9247. .freq1_diff = 0,
  9248. -@@ -461,6 +457,10 @@ static int join_mesh(struct nl80211_state *state,
  9249. +@@ -461,6 +457,10 @@ static int join_mesh(struct nl80211_stat
  9250. .width = NL80211_CHAN_WIDTH_20_NOHT,
  9251. .freq1_diff = 0,
  9252. .chantype = NL80211_CHAN_NO_HT },
  9253. @@ -116,7 +110,7 @@ index 0090530..930d58f 100644
  9254. };
  9255. if (argc < 1)
  9256. -@@ -497,7 +497,7 @@ static int join_mesh(struct nl80211_state *state,
  9257. +@@ -497,7 +497,7 @@ static int join_mesh(struct nl80211_stat
  9258. NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
  9259. chanmode_selected->width);
  9260. NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ1,
  9261. @@ -125,7 +119,7 @@ index 0090530..930d58f 100644
  9262. if (chanmode_selected->chantype != -1)
  9263. NLA_PUT_U32(msg,
  9264. NL80211_ATTR_WIPHY_CHANNEL_TYPE,
  9265. -@@ -599,7 +599,7 @@ static int join_mesh(struct nl80211_state *state,
  9266. +@@ -599,7 +599,7 @@ static int join_mesh(struct nl80211_stat
  9267. nla_put_failure:
  9268. return -ENOBUFS;
  9269. }
  9270. @@ -134,11 +128,9 @@ index 0090530..930d58f 100644
  9271. " [basic-rates <rate in Mbps,rate2,...>]], [mcast-rate <rate in Mbps>]"
  9272. " [beacon-interval <time in TUs>] [dtim-period <value>]"
  9273. " [vendor_sync on|off] [<param>=<value>]*",
  9274. -diff --git a/util.c b/util.c
  9275. -index 4efc4c8..d75ffe0 100644
  9276. --- a/util.c
  9277. +++ b/util.c
  9278. -@@ -728,3 +728,29 @@ void iw_hexdump(const char *prefix, const __u8 *buf, size_t size)
  9279. +@@ -728,3 +728,29 @@ void iw_hexdump(const char *prefix, cons
  9280. }
  9281. printf("\n\n");
  9282. }
  9283. diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c
  9284. index d382453..20bb06e 100644
  9285. --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c
  9286. +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c
  9287. @@ -39,6 +39,18 @@ __init void ap9x_pci_setup_wmac_led_pin(unsigned wmac, int pin)
  9288. }
  9289. }
  9290. +__init void ap9x_pci_setup_wmac_led_name(unsigned wmac, const char *led_name)
  9291. +{
  9292. + switch (wmac) {
  9293. + case 0:
  9294. + ap9x_wmac0_data.led_name = led_name;
  9295. + break;
  9296. + case 1:
  9297. + ap9x_wmac1_data.led_name = led_name;
  9298. + break;
  9299. + }
  9300. +}
  9301. +
  9302. __init struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac)
  9303. {
  9304. switch (wmac) {
  9305. @@ -81,6 +93,20 @@ __init void ap9x_pci_setup_wmac_leds(unsigned wmac, struct gpio_led *leds,
  9306. }
  9307. }
  9308. +__init void ap9x_pci_setup_wmac_btns(unsigned wmac,
  9309. + struct gpio_keys_button *btns,
  9310. + unsigned num_btns, unsigned poll_interval)
  9311. +{
  9312. + struct ath9k_platform_data *ap9x_wmac_data;
  9313. +
  9314. + if (!(ap9x_wmac_data = ap9x_pci_get_wmac_data(wmac)))
  9315. + return;
  9316. +
  9317. + ap9x_wmac_data->btns = btns;
  9318. + ap9x_wmac_data->num_btns = num_btns;
  9319. + ap9x_wmac_data->btn_poll_interval = poll_interval;
  9320. +}
  9321. +
  9322. static int ap91_pci_plat_dev_init(struct pci_dev *dev)
  9323. {
  9324. switch (PCI_SLOT(dev->devfn)) {
  9325. diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h
  9326. index ad288cb..d7c0185 100644
  9327. --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h
  9328. +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h
  9329. @@ -12,6 +12,7 @@
  9330. #define _ATH79_DEV_AP9X_PCI_H
  9331. struct gpio_led;
  9332. +struct gpio_keys_button;
  9333. struct ath9k_platform_data;
  9334. #if defined(CONFIG_ATH79_DEV_AP9X_PCI)
  9335. @@ -19,6 +20,9 @@ void ap9x_pci_setup_wmac_led_pin(unsigned wmac, int pin);
  9336. void ap9x_pci_setup_wmac_gpio(unsigned wmac, u32 mask, u32 val);
  9337. void ap9x_pci_setup_wmac_leds(unsigned wmac, struct gpio_led *leds,
  9338. int num_leds);
  9339. +void ap9x_pci_setup_wmac_led_name(unsigned wmac, const char *led_name);
  9340. +void ap9x_pci_setup_wmac_btns(unsigned wmac, struct gpio_keys_button *btns,
  9341. + unsigned num_btns, unsigned poll_interval);
  9342. struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac);
  9343. void ap91_pci_init(u8 *cal_data, u8 *mac_addr);
  9344. @@ -33,6 +37,12 @@ static inline void ap9x_pci_setup_wmac_gpio(unsigned wmac,
  9345. static inline void ap9x_pci_setup_wmac_leds(unsigned wmac,
  9346. struct gpio_led *leds,
  9347. int num_leds) {}
  9348. +static inline void ap9x_pci_setup_wmac_led_name(unsigned wmac,
  9349. + const char *led_name) {}
  9350. +static inline void ap9x_pci_setup_wmac_btns(unsigned wmac,
  9351. + struct gpio_keys_button *btns,
  9352. + unsigned num_btns,
  9353. + unsigned poll_interval) {}
  9354. static inline struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac)
  9355. {
  9356. return NULL;
  9357. diff --git a/target/linux/generic/files/include/linux/ath9k_platform.h b/target/linux/generic/files/include/linux/ath9k_platform.h
  9358. index 30ce216..2c19f3b 100644
  9359. --- a/target/linux/generic/files/include/linux/ath9k_platform.h
  9360. +++ b/target/linux/generic/files/include/linux/ath9k_platform.h
  9361. @@ -31,6 +31,10 @@ struct ath9k_platform_data {
  9362. u32 gpio_mask;
  9363. u32 gpio_val;
  9364. + u32 bt_active_pin;
  9365. + u32 bt_priority_pin;
  9366. + u32 wlan_active_pin;
  9367. +
  9368. bool endian_check;
  9369. bool is_clk_25mhz;
  9370. bool tx_gain_buffalo;
  9371. @@ -45,6 +49,11 @@ struct ath9k_platform_data {
  9372. int num_leds;
  9373. const struct gpio_led *leds;
  9374. + const char *led_name;
  9375. +
  9376. + unsigned num_btns;
  9377. + const struct gpio_keys_button *btns;
  9378. + unsigned btn_poll_interval;
  9379. };
  9380. #endif /* _LINUX_ATH9K_PLATFORM_H */