0007-mac80211-hostapd-iw-.-update-to-LEDE-42f559ed70897a7b74dd3e6293b42e6d2e511eaa.patch 677 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Wed, 7 Sep 2016 05:04:06 +0200
  3. Subject: mac80211, hostapd, iw, ...: update to LEDE 42f559ed70897a7b74dd3e6293b42e6d2e511eaa
  4. diff --git a/package/firmware/ath10k-firmware/Makefile b/package/firmware/ath10k-firmware/Makefile
  5. index b03d644..624da6a 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,48 @@ define Package/ath10k-firmware-default
  22. CATEGORY:=Kernel modules
  23. SUBMENU:=$(WMENU)
  24. URL:=$(PKG_SOURCE_URL)
  25. + DEPENDS:=
  26. endef
  27. +define Package/ath10k-firmware-qca9887
  28. +$(Package/ath10k-firmware-default)
  29. + TITLE:=ath10k firmware for QCA9887 devices
  30. +endef
  31. +
  32. +QCA9887_REV:=3cce88e245f2d685e49411c4f80998f94baf67b8
  33. +QCA9887_FIRMWARE_FILE:=firmware-5.bin_10.2.4-1.0-00013
  34. +QCA9887_FIRMWARE_FILE_MD5:=bd9cdcbf49561c7176432a81c29e7e87
  35. +QCA9887_FIRMWARE_FILE_DL:=$(QCA9887_FIRMWARE_FILE).$(QCA9887_FIRMWARE_FILE_MD5)
  36. +QCA9887_BOARD_FILE:=board.bin
  37. +QCA9887_BOARD_FILE_MD5:=ebf3af10160c45373f19e0b8226b02ae
  38. +QCA9887_BOARD_FILE_DL:=$(QCA9887_BOARD_FILE).$(QCA9887_BOARD_FILE_MD5)
  39. +
  40. +define Download/ath10k-qca9887-firmware
  41. + URL:=https://github.com/kvalo/ath10k-firmware/raw/$(QCA9887_REV)/QCA9887/hw1.0/
  42. + URL_FILE:=$(QCA9887_FIRMWARE_FILE)
  43. + FILE:=$(QCA9887_FIRMWARE_FILE_DL)
  44. + MD5SUM:=$(QCA9887_FIRMWARE_FILE_MD5)
  45. +endef
  46. +$(eval $(call Download,ath10k-qca9887-firmware))
  47. +
  48. +define Download/ath10k-qca9887-board
  49. + URL:=https://github.com/kvalo/ath10k-firmware/raw/$(QCA9887_REV)/QCA9887/hw1.0/
  50. + URL_FILE:=$(QCA9887_BOARD_FILE)
  51. + FILE:=$(QCA9887_BOARD_FILE_DL)
  52. + MD5SUM:=$(QCA9887_BOARD_FILE_MD5)
  53. +endef
  54. +$(eval $(call Download,ath10k-qca9887-board))
  55. +
  56. define Package/ath10k-firmware-qca988x
  57. $(Package/ath10k-firmware-default)
  58. + DEFAULT:=PACKAGE_kmod-ath10k
  59. TITLE:=ath10k firmware for QCA988x devices
  60. endef
  61. QCA988X_FIRMWARE_FILE:=firmware-5.bin_10.2.4.97-1
  62. +QCA988X_FIRMWARE_FILE_CT:=firmware-2-ct-full-community-16.1.bin-lede
  63. +QCA99X0_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-7.bin-lede.004
  64. +QCA9984_FIRMWARE_FILE_CT:=firmware-5-ct-full-community-7.bin-lede.004
  65. define Download/ath10k-firmware-qca988x
  66. URL:=https://www.codeaurora.org/cgit/quic/qsdk/oss/firmware/ath10k-firmware/plain/10.2.4/
  67. @@ -44,11 +78,83 @@ define Download/ath10k-firmware-qca988x
  68. endef
  69. $(eval $(call Download,ath10k-firmware-qca988x))
  70. +define Download/ath10k-firmware-qca988x-ct
  71. + URL:=https://www.candelatech.com/downloads/
  72. + FILE:=$(QCA988X_FIRMWARE_FILE_CT)
  73. + MD5SUM:=d7e081e9782936ed544b78994c9133fb
  74. +endef
  75. +$(eval $(call Download,ath10k-firmware-qca988x-ct))
  76. +
  77. +define Download/ath10k-firmware-qca99x0-ct
  78. + URL:=https://www.candelatech.com/downloads/ath10k-10-4/
  79. + FILE:=$(QCA99X0_FIRMWARE_FILE_CT)
  80. + MD5SUM:=809bb9bf8a18ea218a8e1b9ffc0f8447
  81. +endef
  82. +$(eval $(call Download,ath10k-firmware-qca99x0-ct))
  83. +
  84. +define Download/ath10k-firmware-qca9984-ct
  85. + URL:=https://www.candelatech.com/downloads/ath10k-9984-10-4/
  86. + FILE:=$(QCA9984_FIRMWARE_FILE_CT)
  87. + MD5SUM:=924eb8ea30de11299b13e207469a3350
  88. +endef
  89. +$(eval $(call Download,ath10k-firmware-qca9984-ct))
  90. +
  91. define Package/ath10k-firmware-qca99x0
  92. $(Package/ath10k-firmware-default)
  93. TITLE:=ath10k firmware for QCA99x0 devices
  94. endef
  95. +define Package/ath10k-firmware-qca988x-ct
  96. +$(Package/ath10k-firmware-default)
  97. + TITLE:=ath10k CT 10.1 firmware for QCA988x devices
  98. +endef
  99. +
  100. +define Package/ath10k-firmware-qca988x-ct/description
  101. +Alternative ath10k firmware for QCA988X from Candela Technologies.
  102. +Enables IBSS and other features. See:
  103. +http://www.candelatech.com/ath10k-10.1.php
  104. +This firmware will NOT be used unless the standard ath10k-firmware-qca988x
  105. +is un-selected since the driver will try to load firmware-5.bin before
  106. +firmware-2.bin
  107. +endef
  108. +
  109. +define Package/ath10k-firmware-qca99x0-ct/description
  110. +Alternative ath10k firmware for QCA99x0 from Candela Technologies.
  111. +Enables IBSS and other features. See:
  112. +http://www.candelatech.com/ath10k-10.4.php
  113. +This firmware conflicts with the standard 99x0 firmware, so select only
  114. +one.
  115. +endef
  116. +
  117. +define Package/ath10k-firmware-qca9984-ct/description
  118. +Alternative ath10k firmware for QCA9984 from Candela Technologies.
  119. +Enables IBSS and other features. See:
  120. +http://www.candelatech.com/ath10k-10.4-9984.php
  121. +This firmware conflicts with the standard 9984 firmware, so select only
  122. +one.
  123. +endef
  124. +
  125. +define Package/ath10k-firmware-qca99x0/description
  126. +Standard ath10k firmware for QCA99x0 from QCA
  127. +This firmware conflicts with the CT 99x0 firmware, so select only
  128. +one.
  129. +endef
  130. +
  131. +define Package/ath10k-firmware-qca99x0-ct
  132. +$(Package/ath10k-firmware-default)
  133. + TITLE:=ath10k CT 10.4.3 firmware for QCA99x0 devices
  134. +endef
  135. +
  136. +define Package/ath10k-firmware-qca9984-ct
  137. +$(Package/ath10k-firmware-default)
  138. + TITLE:=ath10k CT 10.4.3 firmware for QCA9984 devices
  139. +endef
  140. +
  141. +define Package/ath10k-firmware-qca9984
  142. +$(Package/ath10k-firmware-default)
  143. + TITLE:=ath10k firmware for QCA9984 devices
  144. +endef
  145. +
  146. define Package/ath10k-firmware-qca6174
  147. $(Package/ath10k-firmware-default)
  148. TITLE:=ath10k firmware for QCA6174 devices
  149. @@ -58,8 +164,8 @@ QCA99X0_BOARD_REV:=ddcec9efd245da9365c474f513a855a55f3ac7fe
  150. QCA99X0_BOARD_FILE:=board-2.bin.$(QCA99X0_BOARD_REV)
  151. define Download/qca99x0-board
  152. - URL:=https://www.codeaurora.org/cgit/quic/qsdk/oss/firmware/ath10k-firmware/plain/ath10k/QCA99X0/hw2.0
  153. - URL_FILE:=board-2.bin?id=ddcec9efd245da9365c474f513a855a55f3ac7fe
  154. + URL:=https://source.codeaurora.org/quic/qsdk/oss/firmware/ath10k-firmware/plain/ath10k/QCA99X0/hw2.0
  155. + URL_FILE:=board-2.bin?id=$(QCA99X0_BOARD_REV)
  156. FILE:=$(QCA99X0_BOARD_FILE)
  157. MD5SUM:=a2b3c653c2363a5641200051d6333d0a
  158. endef
  159. @@ -69,6 +175,16 @@ define Build/Compile
  160. endef
  161. +define Package/ath10k-firmware-qca9887/install
  162. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9887/hw1.0
  163. + $(INSTALL_DATA) \
  164. + $(DL_DIR)/$(QCA9887_FIRMWARE_FILE_DL) \
  165. + $(1)/lib/firmware/ath10k/QCA9887/hw1.0/firmware-5.bin
  166. + $(INSTALL_DATA) \
  167. + $(DL_DIR)/$(QCA9887_BOARD_FILE_DL) \
  168. + $(1)/lib/firmware/ath10k/QCA9887/hw1.0/board.bin
  169. +endef
  170. +
  171. define Package/ath10k-firmware-qca988x/install
  172. $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
  173. $(INSTALL_DATA) \
  174. @@ -79,6 +195,16 @@ define Package/ath10k-firmware-qca988x/install
  175. $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin
  176. endef
  177. +define Package/ath10k-firmware-qca988x-ct/install
  178. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA988X/hw2.0
  179. + $(INSTALL_DATA) \
  180. + $(PKG_BUILD_DIR)/QCA988X/board.bin \
  181. + $(1)/lib/firmware/ath10k/QCA988X/hw2.0/
  182. + $(INSTALL_DATA) \
  183. + $(DL_DIR)/$(QCA988X_FIRMWARE_FILE_CT) \
  184. + $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-2.bin
  185. +endef
  186. +
  187. define Package/ath10k-firmware-qca6174/install
  188. $(INSTALL_DIR) $(1)/lib/firmware/ath10k
  189. $(CP) $(PKG_BUILD_DIR)/QCA6174 $(1)/lib/firmware/ath10k/
  190. @@ -97,6 +223,51 @@ define Package/ath10k-firmware-qca99x0/install
  191. $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/firmware-5.bin
  192. endef
  193. +define Package/ath10k-firmware-qca99x0-ct/install
  194. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA99X0/hw2.0
  195. + $(INSTALL_DATA) \
  196. + $(DL_DIR)/$(QCA99X0_BOARD_FILE) \
  197. + $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board-2.bin
  198. + $(INSTALL_DATA) \
  199. + $(PKG_BUILD_DIR)/QCA99X0/hw2.0/boardData_AR900B_CUS239_5G_v2_001.bin \
  200. + $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/board.bin
  201. + $(INSTALL_DATA) \
  202. + $(DL_DIR)/$(QCA99X0_FIRMWARE_FILE_CT) \
  203. + $(1)/lib/firmware/ath10k/QCA99X0/hw2.0/firmware-5.bin
  204. +endef
  205. +
  206. +define Package/ath10k-firmware-qca9984/install
  207. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0
  208. + ln -s \
  209. + ../../cal-pci-0000:01:00.0.bin \
  210. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/board.bin
  211. + $(INSTALL_DATA) \
  212. + $(PKG_BUILD_DIR)/QCA9984/hw1.0/board-2.bin \
  213. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin
  214. + $(INSTALL_DATA) \
  215. + $(PKG_BUILD_DIR)/QCA9984/hw1.0/firmware-5.bin_10.4-3.2-00072 \
  216. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/firmware-5.bin
  217. +endef
  218. +
  219. +define Package/ath10k-firmware-qca9984-ct/install
  220. + $(INSTALL_DIR) $(1)/lib/firmware/ath10k/QCA9984/hw1.0
  221. + ln -s \
  222. + ../../cal-pci-0000:01:00.0.bin \
  223. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/board.bin
  224. + $(INSTALL_DATA) \
  225. + $(PKG_BUILD_DIR)/QCA9984/hw1.0/board-2.bin \
  226. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/board-2.bin
  227. + $(INSTALL_DATA) \
  228. + $(DL_DIR)/$(QCA9984_FIRMWARE_FILE_CT) \
  229. + $(1)/lib/firmware/ath10k/QCA9984/hw1.0/firmware-5.bin
  230. +endef
  231. +
  232. +$(eval $(call BuildPackage,ath10k-firmware-qca9887))
  233. $(eval $(call BuildPackage,ath10k-firmware-qca988x))
  234. $(eval $(call BuildPackage,ath10k-firmware-qca99x0))
  235. $(eval $(call BuildPackage,ath10k-firmware-qca6174))
  236. +$(eval $(call BuildPackage,ath10k-firmware-qca9984))
  237. +
  238. +$(eval $(call BuildPackage,ath10k-firmware-qca988x-ct))
  239. +$(eval $(call BuildPackage,ath10k-firmware-qca99x0-ct))
  240. +$(eval $(call BuildPackage,ath10k-firmware-qca9984-ct))
  241. diff --git a/package/firmware/linux-firmware/Makefile b/package/firmware/linux-firmware/Makefile
  242. index 2fcd93b..7a2e977 100644
  243. --- a/package/firmware/linux-firmware/Makefile
  244. +++ b/package/firmware/linux-firmware/Makefile
  245. @@ -16,10 +16,10 @@ PKG_SOURCE_PROTO:=git
  246. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  247. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
  248. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
  249. -PKG_SOURCE_URL:=git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
  250. -PKG_MIRROR_MD5SUM:=ca4d289ad9380471cae376fc7dd3660a
  251. +PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
  252. +PKG_MIRROR_MD5SUM:=8d44332359de89b1936b4ff608a72614
  253. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  254. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  255. SCAN_DEPS = *.mk
  256. diff --git a/package/firmware/linux-firmware/realtek.mk b/package/firmware/linux-firmware/realtek.mk
  257. index 0f8b1ce..4229ca0 100644
  258. --- a/package/firmware/linux-firmware/realtek.mk
  259. +++ b/package/firmware/linux-firmware/realtek.mk
  260. @@ -43,8 +43,15 @@ endef
  261. $(eval $(call BuildPackage,rtl8192de-firmware))
  262. Package/rtl8192se-firmware = $(call Package/firmware-default,RealTek RTL8192SE firmware)
  263. -define KernelPackage/rtl8192se/install
  264. +define Package/rtl8192se-firmware/install
  265. $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  266. $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8192sefw.bin $(1)/lib/firmware/rtlwifi
  267. endef
  268. $(eval $(call BuildPackage,rtl8192se-firmware))
  269. +
  270. +Package/rtl8192su-firmware = $(call Package/firmware-default,RealTek RTL8192SU firmware)
  271. +define Package/rtl8192su-firmware/install
  272. + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi
  273. + $(INSTALL_DATA) $(PKG_BUILD_DIR)/rtlwifi/rtl8712u.bin $(1)/lib/firmware/rtlwifi
  274. +endef
  275. +$(eval $(call BuildPackage,rtl8192su-firmware))
  276. diff --git a/package/kernel/acx-mac80211/Makefile b/package/kernel/acx-mac80211/Makefile
  277. index 1820e7a..8fce374 100644
  278. --- a/package/kernel/acx-mac80211/Makefile
  279. +++ b/package/kernel/acx-mac80211/Makefile
  280. @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk
  281. include $(INCLUDE_DIR)/kernel.mk
  282. PKG_NAME:=acx-mac80211
  283. -PKG_REV:=v20130127
  284. -PKG_VERSION:=20130909
  285. +PKG_REV:=b6fc31491020cb01d2cd1acc170cfa03ced7e726
  286. +PKG_VERSION:=20140216
  287. PKG_RELEASE:=1
  288. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  289. -PKG_SOURCE_URL:=git://acx100.git.sourceforge.net/gitroot/acx100/acx-mac80211
  290. +PKG_SOURCE_URL:=http://git.code.sf.net/p/acx100/acx-mac80211
  291. PKG_SOURCE_PROTO:=git
  292. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  293. PKG_SOURCE_VERSION:=$(PKG_REV)
  294. @@ -190,7 +190,7 @@ define Build/Compile
  295. CROSS_COMPILE="$(TARGET_CROSS)" \
  296. SUBDIRS="$(PKG_BUILD_DIR)" \
  297. $(PKG_EXTRA_KCONFIG) \
  298. - EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS) -DCONFIG_ACX_MAC80211_VERSION=\"KERNEL_VERSION(3,14,0)\"" \
  299. + EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS) -DCONFIG_ACX_MAC80211_VERSION=\"KERNEL_VERSION(4,2,0)\"" \
  300. LINUXINCLUDE="-I$(STAGING_DIR)/usr/include/mac80211-backport/uapi -I$(STAGING_DIR)/usr/include/mac80211-backport \
  301. -I$(STAGING_DIR)/usr/include/mac80211/uapi -I$(STAGING_DIR)/usr/include/mac80211 \
  302. -I$(LINUX_DIR)/include -I$(LINUX_DIR)/include/$(LINUX_UAPI_DIR) \
  303. 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
  304. deleted file mode 100644
  305. index fa4a6be..0000000
  306. --- a/package/kernel/acx-mac80211/patches/001-pci-mem-Fix-3.8-build.patch
  307. +++ /dev/null
  308. @@ -1,129 +0,0 @@
  309. -From 8a0f5890019bf43f4bc95ef0754b062ddfcfa9cd Mon Sep 17 00:00:00 2001
  310. -From: Oliver Winker <oliver@oli1170.net>
  311. -Date: Sun, 10 Mar 2013 21:04:23 +0100
  312. -Subject: [PATCH 1/3] pci, mem: Fix 3.8 build
  313. -
  314. -__devexit and __devinit not used anymore in 3.8
  315. -
  316. -Signed-off-by: Reinhard Karcher <reinhard.karcher@gmx.net>
  317. -Signed-off-by: Oliver Winker <oliver@oli1170.net>
  318. ----
  319. - mem.c | 13 ++++++++++++-
  320. - pci.c | 26 +++++++++++++++++++++++++-
  321. - 2 files changed, 37 insertions(+), 2 deletions(-)
  322. -
  323. ---- a/mem.c
  324. -+++ b/mem.c
  325. -@@ -2216,7 +2216,11 @@ int acx100mem_ioctl_set_phy_amp_bias(str
  326. - * ==================================================
  327. - */
  328. -
  329. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  330. - static int __devinit acxmem_probe(struct platform_device *pdev)
  331. -+#else
  332. -+static int acxmem_probe(struct platform_device *pdev)
  333. -+#endif
  334. - {
  335. - acx_device_t *adev = NULL;
  336. - const char *chip_name;
  337. -@@ -2392,7 +2396,11 @@ static int __devinit acxmem_probe(struct
  338. - * pdev - ptr to PCI device structure containing info about pci
  339. - * configuration
  340. - */
  341. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  342. - static int __devexit acxmem_remove(struct platform_device *pdev)
  343. -+#else
  344. -+static int acxmem_remove(struct platform_device *pdev)
  345. -+#endif
  346. - {
  347. - struct ieee80211_hw *hw = (struct ieee80211_hw *)
  348. - platform_get_drvdata(pdev);
  349. -@@ -2594,8 +2602,11 @@ static struct platform_driver acxmem_dri
  350. - .name = "acx-mem",
  351. - },
  352. - .probe = acxmem_probe,
  353. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  354. - .remove = __devexit_p(acxmem_remove),
  355. --
  356. -+#else
  357. -+ .remove = acxmem_remove,
  358. -+#endif
  359. - #ifdef CONFIG_PM
  360. - .suspend = acxmem_e_suspend,
  361. - .resume = acxmem_e_resume
  362. ---- a/pci.c
  363. -+++ b/pci.c
  364. -@@ -1039,7 +1039,11 @@ int acx100pci_ioctl_set_phy_amp_bias(str
  365. - * id - ptr to the device id entry that matched this device
  366. - */
  367. - #ifdef CONFIG_PCI
  368. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  369. - static int __devinit acxpci_probe(struct pci_dev *pdev,
  370. -+#else
  371. -+static int acxpci_probe(struct pci_dev *pdev,
  372. -+#endif
  373. - const struct pci_device_id *id)
  374. - {
  375. - unsigned long mem_region1 = 0;
  376. -@@ -1292,7 +1296,11 @@ static int __devinit acxpci_probe(struct
  377. - *
  378. - * pdev - ptr to PCI device structure containing info about pci configuration
  379. - */
  380. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  381. - static void __devexit acxpci_remove(struct pci_dev *pdev)
  382. -+#else
  383. -+static void acxpci_remove(struct pci_dev *pdev)
  384. -+#endif
  385. - {
  386. - struct ieee80211_hw *hw
  387. - = (struct ieee80211_hw *) pci_get_drvdata(pdev);
  388. -@@ -1505,7 +1513,11 @@ static struct pci_driver acxpci_driver =
  389. - .name = "acx_pci",
  390. - .id_table = acxpci_id_tbl,
  391. - .probe = acxpci_probe,
  392. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  393. - .remove = __devexit_p(acxpci_remove),
  394. -+#else
  395. -+ .remove = acxpci_remove,
  396. -+#endif
  397. - #ifdef CONFIG_PM
  398. - .suspend = acxpci_e_suspend,
  399. - .resume = acxpci_e_resume
  400. -@@ -1603,8 +1615,12 @@ static struct vlynq_device_id acx_vlynq_
  401. - };
  402. -
  403. -
  404. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  405. - static __devinit int vlynq_probe(struct vlynq_device *vdev,
  406. -- struct vlynq_device_id *id)
  407. -+#else
  408. -+static int vlynq_probe(struct vlynq_device *vdev,
  409. -+#endif
  410. -+ struct vlynq_device_id *id)
  411. - {
  412. - int result = -EIO, i;
  413. - u32 addr;
  414. -@@ -1785,7 +1801,11 @@ static __devinit int vlynq_probe(struct
  415. - return result;
  416. - }
  417. -
  418. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  419. - static __devexit void vlynq_remove(struct vlynq_device *vdev)
  420. -+#else
  421. -+static void vlynq_remove(struct vlynq_device *vdev)
  422. -+#endif
  423. - {
  424. - struct ieee80211_hw *hw = vlynq_get_drvdata(vdev);
  425. - acx_device_t *adev = hw2adev(hw);
  426. -@@ -1851,7 +1871,11 @@ static struct vlynq_driver acxvlynq_driv
  427. - .name = "acx_vlynq",
  428. - .id_table = acx_vlynq_id,
  429. - .probe = vlynq_probe,
  430. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
  431. - .remove = __devexit_p(vlynq_remove),
  432. -+#else
  433. -+ .remove = vlynq_remove,
  434. -+#endif
  435. - };
  436. - #endif /* CONFIG_VLYNQ */
  437. -
  438. 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
  439. deleted file mode 100644
  440. index c737844..0000000
  441. --- a/package/kernel/acx-mac80211/patches/003-Fix-3.10-build.patch
  442. +++ /dev/null
  443. @@ -1,31 +0,0 @@
  444. -From 1daf4bfdb072b08f3b4e412bbfa9645f88dc0a01 Mon Sep 17 00:00:00 2001
  445. -From: Oliver Winker <oliver@oli1170.net>
  446. -Date: Tue, 3 Sep 2013 20:36:36 +0200
  447. -Subject: [PATCH 3/3] Fix 3.10 build
  448. -
  449. -Signed-off-by: Reinhard Karcher <reinhard.karcher@gmx.net>
  450. -Signed-off-by: Oliver Winker <oliver@oli1170.net>
  451. ----
  452. - main.c | 7 +++++++
  453. - 1 file changed, 7 insertions(+)
  454. -
  455. ---- a/main.c
  456. -+++ b/main.c
  457. -@@ -682,10 +682,17 @@ int acx_op_config(struct ieee80211_hw *h
  458. -
  459. - if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
  460. - logf1(L_DEBUG, "IEEE80211_CONF_CHANGE_CHANNEL,"
  461. -+#if CONFIG_ACX_MAC80211_VERSION >= KERNEL_VERSION(3, 10, 0)
  462. -+ "channel->hw_value=%i\n", conf->chandef.chan->hw_value);
  463. -+
  464. -+ acx_set_channel(adev, conf->chandef.chan->hw_value,
  465. -+ conf->chandef.chan->center_freq);
  466. -+#else
  467. - "channel->hw_value=%i\n", conf->channel->hw_value);
  468. -
  469. - acx_set_channel(adev, conf->channel->hw_value,
  470. - conf->channel->center_freq);
  471. -+#endif
  472. -
  473. - changed_not_done &= ~IEEE80211_CONF_CHANGE_CHANNEL;
  474. - }
  475. 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
  476. deleted file mode 100644
  477. index 847b573..0000000
  478. --- a/package/kernel/acx-mac80211/patches/004-Fix-3.14-build.patch
  479. +++ /dev/null
  480. @@ -1,22 +0,0 @@
  481. -From d17fcac710e629463591f6bd09d76b66ec591583 Mon Sep 17 00:00:00 2001
  482. -From: Hauke Mehrtens <hauke@hauke-m.de>
  483. -Date: Wed, 5 Feb 2014 20:57:07 +0100
  484. -Subject: [PATCH] Fix 3.14 build
  485. -
  486. -Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  487. ----
  488. - main.c | 2 ++
  489. - 1 file changed, 2 insertions(+)
  490. -
  491. ---- a/main.c
  492. -+++ b/main.c
  493. -@@ -500,7 +500,9 @@ int acx_init_ieee80211(acx_device_t *ade
  494. - hw->flags &= ~IEEE80211_HW_RX_INCLUDES_FCS;
  495. - hw->queues = 1;
  496. - hw->wiphy->max_scan_ssids = 1;
  497. -+#if CONFIG_ACX_MAC80211_VERSION < KERNEL_VERSION(3, 14, 0)
  498. - hw->channel_change_time = 10000;
  499. -+#endif
  500. -
  501. - /* OW TODO Check if RTS/CTS threshold can be included here */
  502. -
  503. diff --git a/package/kernel/acx-mac80211/patches/300-api_sync.patch b/package/kernel/acx-mac80211/patches/300-api_sync.patch
  504. new file mode 100644
  505. index 0000000..94d6135
  506. --- /dev/null
  507. +++ b/package/kernel/acx-mac80211/patches/300-api_sync.patch
  508. @@ -0,0 +1,83 @@
  509. +--- a/main.c
  510. ++++ b/main.c
  511. +@@ -497,7 +497,7 @@ int acx_free_mechanics(acx_device_t *ade
  512. +
  513. + int acx_init_ieee80211(acx_device_t *adev, struct ieee80211_hw *hw)
  514. + {
  515. +- hw->flags &= ~IEEE80211_HW_RX_INCLUDES_FCS;
  516. ++ __clear_bit(IEEE80211_HW_RX_INCLUDES_FCS, hw->flags);
  517. + hw->queues = 1;
  518. + hw->wiphy->max_scan_ssids = 1;
  519. +
  520. +@@ -525,14 +525,14 @@ int acx_init_ieee80211(acx_device_t *ade
  521. + /* We base signal quality on winlevel approach of previous driver
  522. + * TODO OW 20100615 This should into a common init code
  523. + */
  524. +- hw->flags |= IEEE80211_HW_SIGNAL_UNSPEC;
  525. ++ __set_bit(IEEE80211_HW_SIGNAL_UNSPEC, hw->flags);
  526. + hw->max_signal = 100;
  527. +
  528. + if (IS_ACX100(adev)) {
  529. +- adev->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
  530. ++ adev->hw->wiphy->bands[NL80211_BAND_2GHZ] =
  531. + &acx100_band_2GHz;
  532. + } else if (IS_ACX111(adev))
  533. +- adev->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
  534. ++ adev->hw->wiphy->bands[NL80211_BAND_2GHZ] =
  535. + &acx111_band_2GHz;
  536. + else {
  537. + log(L_ANY, "Error: Unknown device");
  538. +@@ -945,8 +945,8 @@ void acx_op_configure_filter(struct ieee
  539. + changed_flags, *total_flags);
  540. +
  541. + /* OWI TODO: Set also FIF_PROBE_REQ ? */
  542. +- *total_flags &= (FIF_PROMISC_IN_BSS | FIF_ALLMULTI | FIF_FCSFAIL
  543. +- | FIF_CONTROL | FIF_OTHER_BSS);
  544. ++ *total_flags &= (FIF_ALLMULTI | FIF_FCSFAIL | FIF_CONTROL
  545. ++ | FIF_OTHER_BSS);
  546. +
  547. + logf1(L_DEBUG, "2: *total_flags=0x%08x\n", *total_flags);
  548. +
  549. +@@ -1045,9 +1045,10 @@ void acx_op_tx(struct ieee80211_hw *hw,
  550. + }
  551. +
  552. + int acx_op_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  553. +- struct cfg80211_scan_request *req)
  554. ++ struct ieee80211_scan_request *hw_req)
  555. + {
  556. + acx_device_t *adev = hw2adev(hw);
  557. ++ struct cfg80211_scan_request *req = &hw_req->req;
  558. + struct sk_buff *skb;
  559. + size_t ssid_len = 0;
  560. + u8 *ssid = NULL;
  561. +@@ -1082,7 +1083,7 @@ int acx_op_hw_scan(struct ieee80211_hw *
  562. + goto out;
  563. + }
  564. + #else
  565. +- skb = ieee80211_probereq_get(adev->hw, adev->vif, ssid, ssid_len,
  566. ++ skb = ieee80211_probereq_get(adev->hw, vif->addr, ssid, ssid_len,
  567. + req->ie_len);
  568. + if (!skb) {
  569. + ret = -ENOMEM;
  570. +--- a/main.h
  571. ++++ b/main.h
  572. +@@ -62,7 +62,7 @@ void acx_op_tx(struct ieee80211_hw *hw,
  573. + #endif
  574. +
  575. + int acx_op_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  576. +- struct cfg80211_scan_request *req);
  577. ++ struct ieee80211_scan_request *req);
  578. +
  579. + int acx_recover_hw(acx_device_t *adev);
  580. +
  581. +--- a/cardsetting.c
  582. ++++ b/cardsetting.c
  583. +@@ -159,7 +159,7 @@ int acx_set_channel(acx_device_t *adev,
  584. + int res = 0;
  585. +
  586. + adev->rx_status.freq = freq;
  587. +- adev->rx_status.band = IEEE80211_BAND_2GHZ;
  588. ++ adev->rx_status.band = NL80211_BAND_2GHZ;
  589. +
  590. + adev->channel = channel;
  591. +
  592. diff --git a/package/kernel/ath10k-ct/Makefile b/package/kernel/ath10k-ct/Makefile
  593. new file mode 100644
  594. index 0000000..bbff8d8
  595. --- /dev/null
  596. +++ b/package/kernel/ath10k-ct/Makefile
  597. @@ -0,0 +1,80 @@
  598. +include $(TOPDIR)/rules.mk
  599. +
  600. +PKG_NAME:=ath10k-ct
  601. +PKG_VERSION:=2016-08-24
  602. +PKG_RELEASE=1
  603. +
  604. +PKG_LICENSE:=GPLv2
  605. +PKG_LICENSE_FILES:=
  606. +
  607. +PKG_SOURCE_URL:=https://github.com/greearb/ath10k-ct.git
  608. +PKG_SOURCE_PROTO:=git
  609. +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  610. +PKG_SOURCE_VERSION:=cd725d5465e1d4476a504794c541afeeba84b479
  611. +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
  612. +
  613. +PKG_MAINTAINER:=Ben Greear <greearb@candelatech.com>
  614. +PKG_BUILD_PARALLEL:=1
  615. +
  616. +STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h
  617. +
  618. +include $(INCLUDE_DIR)/kernel.mk
  619. +include $(INCLUDE_DIR)/package.mk
  620. +
  621. +define KernelPackage/ath10k-ct
  622. + SUBMENU:=Wireless Drivers
  623. + TITLE:=ath10k-ct driver optimized for CT ath10k firmware
  624. + DEPENDS:=+kmod-mac80211 +kmod-ath +@DRIVER_11N_SUPPORT @PCI_SUPPORT +@KERNEL_RELAY
  625. + FILES:=\
  626. + $(PKG_BUILD_DIR)/ath10k/ath10k_pci.ko \
  627. + $(PKG_BUILD_DIR)/ath10k/ath10k_core.ko
  628. + AUTOLOAD:=$(call AutoLoad,50,mac80211 ath ath10k_core ath10k_pci)
  629. +endef
  630. +
  631. +NOSTDINC_FLAGS = \
  632. + -I$(PKG_BUILD_DIR) \
  633. + -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
  634. + -I$(STAGING_DIR)/usr/include/mac80211-backport \
  635. + -I$(STAGING_DIR)/usr/include/mac80211/uapi \
  636. + -I$(STAGING_DIR)/usr/include/mac80211 \
  637. + -include backport/autoconf.h \
  638. + -include backport/backport.h
  639. +
  640. +ifdef CONFIG_PACKAGE_MAC80211_MESH
  641. + NOSTDINC_FLAGS += -DCONFIG_MAC80211_MESH
  642. +endif
  643. +
  644. +CT_MAKEDEFS += CONFIG_ATH10K=m CONFIG_ATH10K_PCI=m
  645. +# No AHB support enabled yet. Could conditionally enable it later.
  646. +#CT_MAKEDEFS += CONFIG_ATH10K_AHB=y
  647. +#NOSTDINC_FLAGS += -DCONFIG_ATH10K_AHB
  648. +NOSTDINC_FLAGS += -DSTANDALONE_CT
  649. +
  650. +ifdef CONFIG_PACKAGE_MAC80211_DEBUGFS
  651. + CT_MAKEDEFS += CONFIG_ATH10K_DEBUGFS=y CONFIG_MAC80211_DEBUGFS=y
  652. + NOSTDINC_FLAGS += -DCONFIG_MAC80211_DEBUGFS
  653. + NOSTDINC_FLAGS += -DCONFIG_ATH10K_DEBUGFS
  654. +endif
  655. +
  656. +ifdef CONFIG_PACKAGE_ATH_DEBUG
  657. + NOSTDINC_FLAGS += -DCONFIG_ATH10K_DEBUG
  658. +endif
  659. +
  660. +define Build/Configure
  661. + cp $(STAGING_DIR)/usr/include/mac80211/ath/*.h $(PKG_BUILD_DIR)
  662. +endef
  663. +
  664. +ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
  665. + CT_MAKEDEFS += V=1
  666. +endif
  667. +
  668. +define Build/Compile
  669. + +$(MAKE) $(CT_MAKEDEFS) $(PKG_JOBS) -C "$(LINUX_DIR)" \
  670. + ARCH="$(LINUX_KARCH)" \
  671. + CROSS_COMPILE="$(TARGET_CROSS)" \
  672. + SUBDIRS="$(PKG_BUILD_DIR)/ath10k" \
  673. + NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
  674. + modules
  675. +endef
  676. +
  677. +$(eval $(call KernelPackage,ath10k-ct))
  678. diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
  679. index 30da1cf..5c0ca3f 100644
  680. --- a/package/kernel/mac80211/Makefile
  681. +++ b/package/kernel/mac80211/Makefile
  682. @@ -10,20 +10,21 @@ include $(INCLUDE_DIR)/kernel.mk
  683. PKG_NAME:=mac80211
  684. -PKG_VERSION:=2016-01-10
  685. +PKG_VERSION:=2016-06-20
  686. PKG_RELEASE:=1
  687. PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
  688. PKG_BACKPORT_VERSION:=
  689. -PKG_MD5SUM:=be5fae2e8d6f7490f9b073374fb895ba
  690. +PKG_MD5SUM:=29c79bdc3928ef5113b17042ebda9237
  691. PKG_SOURCE:=compat-wireless-$(PKG_VERSION)$(PKG_BACKPORT_VERSION).tar.bz2
  692. PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION)
  693. PKG_BUILD_PARALLEL:=1
  694. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  695. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  696. PKG_DRIVERS = \
  697. adm8211 \
  698. + airo \
  699. ath ath5k ath9k ath9k-common ath9k-htc ath10k \
  700. b43 b43legacy \
  701. carl9170 \
  702. @@ -52,6 +53,7 @@ PKG_CONFIG_DEPENDS:= \
  703. $(patsubst %,CONFIG_PACKAGE_kmod-%,$(PKG_DRIVERS)) \
  704. CONFIG_PACKAGE_MAC80211_DEBUGFS \
  705. CONFIG_PACKAGE_MAC80211_MESH \
  706. + CONFIG_PACKAGE_MAC80211_TRACING \
  707. CONFIG_PACKAGE_ATH_DEBUG \
  708. CONFIG_PACKAGE_ATH_DFS \
  709. CONFIG_PACKAGE_B43_DEBUG \
  710. @@ -63,7 +65,12 @@ PKG_CONFIG_DEPENDS:= \
  711. CONFIG_PACKAGE_B43_BUSES_BCMA_AND_SSB \
  712. CONFIG_PACKAGE_B43_BUSES_BCMA \
  713. CONFIG_PACKAGE_B43_BUSES_SSB \
  714. + CONFIG_PACKAGE_BRCM80211_DEBUG \
  715. + CONFIG_PACKAGE_IWLWIFI_DEBUG \
  716. + CONFIG_PACKAGE_IWLWIFI_DEBUGFS \
  717. CONFIG_PACKAGE_RTLWIFI_DEBUG \
  718. + CONFIG_ATH9K_SUPPORT_PCOEM \
  719. + CONFIG_ATH9K_TX99 \
  720. CONFIG_ATH_USER_REGD \
  721. include $(INCLUDE_DIR)/package.mk
  722. @@ -73,7 +80,7 @@ WMENU:=Wireless Drivers
  723. define KernelPackage/mac80211/Default
  724. SUBMENU:=$(WMENU)
  725. URL:=https://wireless.wiki.kernel.org/
  726. - MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  727. + MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  728. endef
  729. define KernelPackage/cfg80211
  730. @@ -92,7 +99,7 @@ endef
  731. define KernelPackage/mac80211
  732. $(call KernelPackage/mac80211/Default)
  733. TITLE:=Linux 802.11 Wireless Networking Stack
  734. - DEPENDS+= +kmod-cfg80211 +hostapd-common +kmod-crypto-core +kmod-crypto-arc4
  735. + DEPENDS+= +kmod-cfg80211 +hostapd-common
  736. KCONFIG:=\
  737. CONFIG_AVERAGE=y
  738. FILES:= $(PKG_BUILD_DIR)/net/mac80211/mac80211.ko
  739. @@ -138,10 +145,23 @@ define KernelPackage/adm8211
  740. AUTOLOAD:=$(call AutoProbe,adm8211)
  741. endef
  742. +define KernelPackage/airo
  743. + $(call KernelPackage/mac80211/Default)
  744. + TITLE:=Cisco Aironet driver
  745. + DEPENDS+=@PCI_SUPPORT +@DRIVER_WEXT_SUPPORT +kmod-cfg80211 @TARGET_x86
  746. + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/cisco/airo.ko
  747. + AUTOLOAD:=$(call AutoProbe,airo)
  748. +endef
  749. +
  750. +define KernelPackage/airo/description
  751. + Kernel support for Cisco Aironet cards
  752. +endef
  753. +
  754. define KernelPackage/ath/config
  755. if PACKAGE_kmod-ath
  756. config ATH_USER_REGD
  757. bool "Force Atheros drivers to respect the user's regdomain settings"
  758. + default y
  759. help
  760. Atheros' idea of regulatory handling is that the EEPROM of the card defines
  761. the regulatory limits and the user is only allowed to restrict the settings
  762. @@ -199,6 +219,7 @@ define KernelPackage/ath9k-common
  763. $(call KernelPackage/mac80211/Default)
  764. TITLE:=Atheros 802.11n wireless devices (common code for ath9k and ath9k_htc)
  765. URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
  766. + HIDDEN:=1
  767. DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY
  768. FILES:= \
  769. $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_common.ko \
  770. @@ -226,6 +247,10 @@ define KernelPackage/ath9k/config
  771. bool "Support chips used in PC OEM cards"
  772. depends on PACKAGE_kmod-ath9k
  773. + config ATH9K_TX99
  774. + bool "Enable TX99 support"
  775. + depends on PACKAGE_kmod-ath9k
  776. +
  777. endef
  778. define KernelPackage/ath9k-htc
  779. @@ -247,7 +272,7 @@ define KernelPackage/ath10k
  780. $(call KernelPackage/mac80211/Default)
  781. TITLE:=Atheros 802.11ac wireless cards support
  782. URL:=https://wireless.wiki.kernel.org/en/users/Drivers/ath10k
  783. - DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY +ath10k-firmware-qca988x
  784. + DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY
  785. FILES:= \
  786. $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_core.ko \
  787. $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_pci.ko
  788. @@ -673,6 +698,7 @@ define KernelPackage/brcmfmac/config
  789. config BRCMFMAC_SDIO
  790. bool "Enable SDIO bus interface support"
  791. + default y if TARGET_brcm2708
  792. default n
  793. help
  794. Enable support for cards attached to an SDIO bus.
  795. @@ -761,7 +787,7 @@ endef
  796. define KernelPackage/iwlwifi
  797. $(call KernelPackage/mac80211/Default)
  798. - DEPENDS:= +kmod-mac80211 @PCI_SUPPORT +@DRIVER_11N_SUPPORT +iwlwifi-firmware
  799. + DEPENDS:= +kmod-mac80211 @PCI_SUPPORT +@DRIVER_11N_SUPPORT +iwlwifi-firmware @!LINUX_3_18
  800. TITLE:=Intel AGN Wireless support
  801. FILES:= \
  802. $(PKG_BUILD_DIR)/drivers/net/wireless/intel/iwlwifi/iwlwifi.ko \
  803. @@ -870,7 +896,7 @@ endef
  804. define KernelPackage/lib80211
  805. $(call KernelPackage/mac80211/Default)
  806. TITLE:=802.11 Networking stack
  807. - DEPENDS:=+kmod-cfg80211
  808. + DEPENDS:=+kmod-cfg80211 +kmod-crypto-hash
  809. FILES:= \
  810. $(PKG_BUILD_DIR)/net/wireless/lib80211.ko \
  811. $(PKG_BUILD_DIR)/net/wireless/lib80211_crypt_wep.ko \
  812. @@ -897,7 +923,7 @@ endef
  813. define KernelPackage/libipw
  814. $(call KernelPackage/mac80211/Default)
  815. TITLE:=libipw for ipw2100 and ipw2200
  816. - DEPENDS:=@PCI_SUPPORT +kmod-crypto-michael-mic +kmod-crypto-core +kmod-crypto-arc4 +kmod-lib80211 +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT @!BIG_ENDIAN
  817. + DEPENDS:=@PCI_SUPPORT +kmod-crypto-michael-mic +kmod-lib80211 +kmod-cfg80211 +@DRIVER_WEXT_SUPPORT @!BIG_ENDIAN
  818. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intel/ipw2x00/libipw.ko
  819. AUTOLOAD:=$(call AutoProbe,libipw)
  820. endef
  821. @@ -978,7 +1004,7 @@ endef
  822. define KernelPackage/libertas-spi
  823. $(call KernelPackage/mac80211/Default)
  824. SUBMENU:=Wireless Drivers
  825. - DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +@DRIVER_WEXT_SUPPORT +libertas-spi-firmware
  826. + DEPENDS+= +kmod-cfg80211 +kmod-lib80211 +@DRIVER_WEXT_SUPPORT @!TARGET_uml +libertas-spi-firmware
  827. KCONFIG := \
  828. CONFIG_SPI=y \
  829. CONFIG_SPI_MASTER=y
  830. @@ -1036,33 +1062,6 @@ define KernelPackage/mwifiex-pcie/description
  831. Kernel modules for Marvell 802.11n/802.11ac PCIe Wireless cards
  832. endef
  833. -
  834. -# Prism54 drivers
  835. -P54PCIFW:=2.13.12.0.arm
  836. -P54USBFW:=2.13.24.0.lm87.arm
  837. -P54SPIFW:=2.13.0.0.a.13.14.arm
  838. -
  839. -define Download/p54usb
  840. - FILE:=$(P54USBFW)
  841. - URL:=http://daemonizer.de/prism54/prism54-fw/fw-usb
  842. - MD5SUM:=8e8ab005a4f8f0123bcdc51bc25b47f6
  843. -endef
  844. -$(eval $(call Download,p54usb))
  845. -
  846. -define Download/p54pci
  847. - FILE:=$(P54PCIFW)
  848. - URL:=http://daemonizer.de/prism54/prism54-fw/fw-softmac
  849. - MD5SUM:=ff7536af2092b1c4b21315bd103ef4c4
  850. -endef
  851. -$(eval $(call Download,p54pci))
  852. -
  853. -define Download/p54spi
  854. - FILE:=$(P54SPIFW)
  855. - URL:=http://daemonizer.de/prism54/prism54-fw/stlc4560
  856. - MD5SUM:=42661f8ecbadd88012807493f596081d
  857. -endef
  858. -$(eval $(call Download,p54spi))
  859. -
  860. define KernelPackage/p54/Default
  861. $(call KernelPackage/mac80211/Default)
  862. TITLE:=Prism54 Drivers
  863. @@ -1082,7 +1081,7 @@ endef
  864. define KernelPackage/p54-pci
  865. $(call KernelPackage/p54/Default)
  866. TITLE+= (PCI)
  867. - DEPENDS+= @PCI_SUPPORT +kmod-p54-common
  868. + DEPENDS+= @PCI_SUPPORT +kmod-p54-common +p54-pci-firmware
  869. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/p54/p54pci.ko
  870. AUTOLOAD:=$(call AutoProbe,p54pci)
  871. endef
  872. @@ -1090,7 +1089,7 @@ endef
  873. define KernelPackage/p54-usb
  874. $(call KernelPackage/p54/Default)
  875. TITLE+= (USB)
  876. - DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-p54-common
  877. + DEPENDS+= @USB_SUPPORT +kmod-usb-core +kmod-p54-common +p54-usb-firmware
  878. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/p54/p54usb.ko
  879. AUTOLOAD:=$(call AutoProbe,p54usb)
  880. endef
  881. @@ -1098,7 +1097,7 @@ endef
  882. define KernelPackage/p54-spi
  883. $(call KernelPackage/p54/Default)
  884. TITLE+= (SPI)
  885. - DEPENDS+= @TARGET_omap24xx +kmod-p54-common
  886. + DEPENDS+= @TARGET_omap24xx +kmod-p54-common +p54-spi-firmware
  887. FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/intersil/p54/p54spi.ko
  888. AUTOLOAD:=$(call AutoProbe,p54spi)
  889. endef
  890. @@ -1453,6 +1452,7 @@ config-y:= \
  891. WLAN_VENDOR_ATH \
  892. WLAN_VENDOR_ATMEL \
  893. WLAN_VENDOR_BROADCOM \
  894. + WLAN_VENDOR_CISCO \
  895. WLAN_VENDOR_INTEL \
  896. WLAN_VENDOR_INTERSIL \
  897. WLAN_VENDOR_MARVELL \
  898. @@ -1491,8 +1491,10 @@ endif
  899. config-$(call config_package,lib80211) += LIB80211 LIB80211_CRYPT_WEP LIB80211_CRYPT_CCMP LIB80211_CRYPT_TKIP
  900. +config-$(call config_package,airo) += AIRO
  901. +
  902. config-$(call config_package,ath) += ATH_CARDS ATH_COMMON
  903. -config-$(CONFIG_PACKAGE_ATH_DEBUG) += ATH_DEBUG ATH10K_DEBUG
  904. +config-$(CONFIG_PACKAGE_ATH_DEBUG) += ATH_DEBUG ATH10K_DEBUG ATH9K_STATION_STATISTICS
  905. config-$(CONFIG_PACKAGE_ATH_DFS) += ATH9K_DFS_CERTIFIED ATH10K_DFS_CERTIFIED
  906. config-$(call config_package,ath9k) += ATH9K
  907. @@ -1501,6 +1503,7 @@ config-$(CONFIG_TARGET_ar71xx) += ATH9K_AHB
  908. config-$(CONFIG_PCI) += ATH9K_PCI
  909. config-$(CONFIG_ATH_USER_REGD) += ATH_USER_REGD
  910. config-$(CONFIG_ATH9K_SUPPORT_PCOEM) += ATH9K_PCOEM
  911. +config-$(CONFIG_ATH9K_TX99) += ATH9K_TX99
  912. config-$(call config_package,ath9k-htc) += ATH9K_HTC
  913. config-$(call config_package,ath10k) += ATH10K ATH10K_PCI
  914. @@ -1742,21 +1745,6 @@ define KernelPackage/ipw2200/install
  915. $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(IPW2200_NAME)-$(IPW2200_VERSION)/ipw2200*.fw $(1)/lib/firmware
  916. endef
  917. -define KernelPackage/p54-pci/install
  918. - $(INSTALL_DIR) $(1)/lib/firmware
  919. - $(INSTALL_DATA) $(DL_DIR)/$(P54PCIFW) $(1)/lib/firmware/isl3886pci
  920. -endef
  921. -
  922. -define KernelPackage/p54-usb/install
  923. - $(INSTALL_DIR) $(1)/lib/firmware
  924. - $(INSTALL_DATA) $(DL_DIR)/$(P54USBFW) $(1)/lib/firmware/isl3887usb
  925. -endef
  926. -
  927. -define KernelPackage/p54-spi/install
  928. - $(INSTALL_DIR) $(1)/lib/firmware
  929. - $(INSTALL_DATA) $(DL_DIR)/$(P54SPIFW) $(1)/lib/firmware/3826.arm
  930. -endef
  931. -
  932. define KernelPackage/zd1211rw/install
  933. $(INSTALL_DIR) $(1)/lib/firmware/zd1211
  934. $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(ZD1211FW_NAME)/zd1211* $(1)/lib/firmware/zd1211
  935. @@ -1764,6 +1752,7 @@ endef
  936. $(eval $(call KernelPackage,adm8211))
  937. +$(eval $(call KernelPackage,airo))
  938. $(eval $(call KernelPackage,ath))
  939. $(eval $(call KernelPackage,ath10k))
  940. $(eval $(call KernelPackage,ath5k))
  941. diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  942. index fb2f928..e3d612e 100644
  943. --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  944. +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
  945. @@ -23,6 +23,7 @@ drv_mac80211_init_device_config() {
  946. config_add_int rxantenna txantenna antenna_gain txpower distance
  947. config_add_boolean noscan ht_coex
  948. config_add_array ht_capab
  949. + config_add_array channels
  950. config_add_boolean \
  951. rxldpc \
  952. short_gi_80 \
  953. @@ -89,6 +90,7 @@ mac80211_hostapd_setup_base() {
  954. json_select config
  955. [ "$auto_channel" -gt 0 ] && channel=acs_survey
  956. + [ "$auto_channel" -gt 0 ] && json_get_values channel_list channels
  957. json_get_vars noscan ht_coex
  958. json_get_values ht_capab_list ht_capab
  959. @@ -218,7 +220,6 @@ mac80211_hostapd_setup_base() {
  960. vht_max_a_mpdu_len_exp:7 \
  961. vht_max_mpdu:11454 \
  962. rx_stbc:4 \
  963. - tx_stbc:4 \
  964. vht_link_adapt:3 \
  965. vht160:2
  966. @@ -230,13 +231,13 @@ mac80211_hostapd_setup_base() {
  967. cap_rx_stbc=$((($vht_cap >> 8) & 7))
  968. [ "$rx_stbc" -lt "$cap_rx_stbc" ] && cap_rx_stbc="$rx_stbc"
  969. - ht_cap_mask="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))"
  970. + vht_cap="$(( ($vht_cap & ~(0x700)) | ($cap_rx_stbc << 8) ))"
  971. mac80211_add_capabilities vht_capab $vht_cap \
  972. RXLDPC:0x10::$rxldpc \
  973. SHORT-GI-80:0x20::$short_gi_80 \
  974. SHORT-GI-160:0x40::$short_gi_160 \
  975. - TX-STBC-2BY1:0x80::$tx_stbc \
  976. + TX-STBC-2BY1:0x80::$tx_stbc_2by1 \
  977. SU-BEAMFORMER:0x800::$su_beamformer \
  978. SU-BEAMFORMEE:0x1000::$su_beamformee \
  979. MU-BEAMFORMER:0x80000::$mu_beamformer \
  980. @@ -245,10 +246,10 @@ mac80211_hostapd_setup_base() {
  981. HTC-VHT:0x400000::$htc_vht \
  982. RX-ANTENNA-PATTERN:0x10000000::$rx_antenna_pattern \
  983. TX-ANTENNA-PATTERN:0x20000000::$tx_antenna_pattern \
  984. - RX-STBC1:0x700:0x100:1 \
  985. - RX-STBC12:0x700:0x200:1 \
  986. - RX-STBC123:0x700:0x300:1 \
  987. - RX-STBC1234:0x700:0x400:1 \
  988. + RX-STBC-1:0x700:0x100:1 \
  989. + RX-STBC-12:0x700:0x200:1 \
  990. + RX-STBC-123:0x700:0x300:1 \
  991. + RX-STBC-1234:0x700:0x400:1 \
  992. # supported Channel widths
  993. vht160_hw=0
  994. @@ -301,6 +302,7 @@ mac80211_hostapd_setup_base() {
  995. hostapd_prepare_device_config "$hostapd_conf_file" nl80211
  996. cat >> "$hostapd_conf_file" <<EOF
  997. ${channel:+channel=$channel}
  998. +${channel_list:+chanlist=$channel_list}
  999. ${noscan:+noscan=$noscan}
  1000. $base_cfg
  1001. @@ -391,11 +393,10 @@ mac80211_generate_mac() {
  1002. find_phy() {
  1003. [ -n "$phy" -a -d /sys/class/ieee80211/$phy ] && return 0
  1004. [ -n "$path" ] && {
  1005. - for phy in /sys/devices/$path/ieee80211/phy*; do
  1006. - [ -e "$phy" ] && {
  1007. - phy="${phy##*/}"
  1008. - return 0
  1009. - }
  1010. + for phy in $(ls /sys/class/ieee80211 2>/dev/null); do
  1011. + case "$(readlink -f /sys/class/ieee80211/$phy/device)" in
  1012. + *$path) return 0;;
  1013. + esac
  1014. done
  1015. }
  1016. [ -n "$macaddr" ] && {
  1017. @@ -481,7 +482,7 @@ mac80211_prepare_vif() {
  1018. # All interfaces must have unique mac addresses
  1019. # which can either be explicitly set in the device
  1020. # section, or automatically generated
  1021. - ifconfig "$ifname" hw ether "$macaddr"
  1022. + ip link set dev "$ifname" address "$macaddr"
  1023. fi
  1024. json_select ..
  1025. @@ -496,7 +497,7 @@ mac80211_setup_supplicant() {
  1026. mac80211_setup_adhoc_htmode() {
  1027. case "$htmode" in
  1028. VHT20|HT20) ibss_htmode=HT20;;
  1029. - HT40*|VHT40|VHT80|VHT160)
  1030. + HT40*|VHT40|VHT160)
  1031. case "$hwmode" in
  1032. a)
  1033. case "$(( ($channel / 4) % 2 ))" in
  1034. @@ -520,6 +521,9 @@ mac80211_setup_adhoc_htmode() {
  1035. esac
  1036. [ "$auto_channel" -gt 0 ] && ibss_htmode="HT40+"
  1037. ;;
  1038. + VHT80)
  1039. + ibss_htmode="80MHZ"
  1040. + ;;
  1041. NONE|NOHT)
  1042. ibss_htmode="NOHT"
  1043. ;;
  1044. @@ -580,7 +584,7 @@ mac80211_setup_vif() {
  1045. json_get_vars mode
  1046. json_get_var vif_txpower txpower
  1047. - ifconfig "$ifname" up || {
  1048. + ip link set dev "$ifname" up || {
  1049. wireless_setup_vif_failed IFUP_ERROR
  1050. json_select ..
  1051. return
  1052. @@ -643,7 +647,7 @@ mac80211_interface_cleanup() {
  1053. local phy="$1"
  1054. for wdev in $(list_phy_interfaces "$phy"); do
  1055. - ifconfig "$wdev" down 2>/dev/null
  1056. + ip link set dev "$wdev" down 2>/dev/null
  1057. iw dev "$wdev" del
  1058. done
  1059. }
  1060. diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
  1061. index ea229d6..06f3b8b 100644
  1062. --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh
  1063. +++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
  1064. @@ -9,11 +9,10 @@ lookup_phy() {
  1065. local devpath
  1066. config_get devpath "$device" path
  1067. [ -n "$devpath" ] && {
  1068. - for _phy in /sys/devices/$devpath/ieee80211/phy*; do
  1069. - [ -e "$_phy" ] && {
  1070. - phy="${_phy##*/}"
  1071. - return
  1072. - }
  1073. + for phy in $(ls /sys/class/ieee80211 2>/dev/null); do
  1074. + case "$(readlink -f /sys/class/ieee80211/$phy/device)" in
  1075. + *$devpath) return;;
  1076. + esac
  1077. done
  1078. }
  1079. @@ -102,6 +101,9 @@ detect_mac80211() {
  1080. fi
  1081. if [ -n "$path" ]; then
  1082. path="${path##/sys/devices/}"
  1083. + case "$path" in
  1084. + platform*/pci*) path="${path##platform/}";;
  1085. + esac
  1086. dev_id=" option path '$path'"
  1087. else
  1088. dev_id=" option macaddr $(cat /sys/class/ieee80211/${dev}/macaddress)"
  1089. diff --git a/package/kernel/mac80211/files/regdb.txt b/package/kernel/mac80211/files/regdb.txt
  1090. index 463ace3..c4a9b2d 100644
  1091. --- a/package/kernel/mac80211/files/regdb.txt
  1092. +++ b/package/kernel/mac80211/files/regdb.txt
  1093. @@ -136,19 +136,35 @@ country BF: DFS-FCC
  1094. (5490 - 5730 @ 160), (24), DFS
  1095. (5735 - 5835 @ 80), (30)
  1096. +# Bulgarian rules as defined by the Communications Regulation Commission in the
  1097. +# following documents:
  1098. +#
  1099. +# Rules for carrying out electronic communications through radio equipment using
  1100. +# radio spectrum, which does not need to be individually assigned (the Rules):
  1101. +# http://www.crc.bg/files/_bg/Pravila_09_06_2015.pdf
  1102. +#
  1103. +# List of radio equipment that uses harmonized within the European Union bands
  1104. +# and electronic communications terminal equipment (the List):
  1105. +# http://www.crc.bg/files/_bg/Spisak_2015.pdf
  1106. +#
  1107. +# Note: The transmit power limits in the 5250-5350 MHz and 5470-5725 MHz bands
  1108. +# can be raised by 3 dBm if TPC is enabled. Refer to BDS EN 301 893 for details.
  1109. country BG: DFS-ETSI
  1110. + # Wideband data transmission systems (WDTS) in the 2.4GHz ISM band, ref:
  1111. + # I.22 of the List, BDS EN 300 328
  1112. (2402 - 2482 @ 40), (20)
  1113. - (5170 - 5250 @ 80), (20), AUTO-BW
  1114. + # 5 GHz Radio Local Area Networks (RLANs), ref:
  1115. + # II.H01 of the List, BDS EN 301 893
  1116. + (5170 - 5250 @ 80), (23), AUTO-BW
  1117. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  1118. + # II.H01 of the List, I.54 from the List, BDS EN 301 893
  1119. (5490 - 5710 @ 160), (27), DFS
  1120. - # 5 GHz Short Range Devices, ref:
  1121. - # Etsi EN 300 440-1
  1122. - # Etsi EN 300 440-2
  1123. - # http://crc.bg/files/_bg/Spisak_2015.pdf
  1124. - # http://crc.bg/files/_bg/Pravila_2015_resh24.pdf
  1125. + # Short range devices (SRDs) in the 5725-5875 MHz frequency range, ref:
  1126. + # I.43 of the List, BDS EN 300 440-2, BDS EN 300 440-1
  1127. (5725 - 5875 @ 80), (14)
  1128. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  1129. - (57000 - 66000 @ 2160), (40)
  1130. + # 60 GHz Multiple-Gigabit RLAN Systems, ref:
  1131. + # II.H03 of the List, BDS EN 302 567-2
  1132. + (57000 - 66000 @ 2160), (40), NO-OUTDOOR
  1133. country BH: DFS-JP
  1134. (2402 - 2482 @ 40), (20)
  1135. @@ -275,6 +291,12 @@ country CR: DFS-FCC
  1136. (5490 - 5730 @ 20), (24), DFS
  1137. (5735 - 5835 @ 20), (30)
  1138. +# http://www.mincom.gob.cu/?q=marcoregulatorio
  1139. +# - Redes Informáticas
  1140. +# Resolución 127, 2011 - Reglamento Banda 2,4 GHz.
  1141. +country CU: DFS-FCC
  1142. + (2400 - 2483.5 @ 40), (200 mW)
  1143. +
  1144. country CX: DFS-FCC
  1145. (2402 - 2482 @ 40), (20)
  1146. (5170 - 5250 @ 80), (24), AUTO-BW
  1147. @@ -302,28 +324,41 @@ country CZ: DFS-ETSI
  1148. # 60 GHz band channels 1-4, ref: Etsi En 302 567
  1149. (57000 - 66000 @ 2160), (40)
  1150. -# Data from "Frequenznutzungsplan" (as published in April 2008), downloaded from
  1151. -# http://www.bundesnetzagentur.de/cae/servlet/contentblob/38448/publicationFile/2659/Frequenznutzungsplan2008_Id17448pdf.pdf
  1152. -# For the 5GHz range also see
  1153. -# http://www.bundesnetzagentur.de/cae/servlet/contentblob/38216/publicationFile/6579/WLAN5GHzVfg7_2010_28042010pdf.pdf
  1154. -# The values have been reduced by a factor of 2 (3db) for non TPC devices
  1155. -# (in other words: devices with TPC can use twice the tx power of this table).
  1156. -# Note that the docs do not require TPC for 5150--5250; the reduction to
  1157. -# 100mW thus is not strictly required -- however the conservative 100mW
  1158. +# Allocation for the 2.4 GHz band (Vfg 10 / 2013, Allgemeinzuteilung von
  1159. +# Frequenzen für die Nutzung in lokalen Netzwerken; Wireless Local Area
  1160. +# Networks (WLAN-Funkanwendungen).
  1161. +# https://www.bundesnetzagentur.de/SharedDocs/Downloads/DE/Sachgebiete/Telekommunikation/Unternehmen_Institutionen/Frequenzen/Allgemeinzuteilungen/2013_10_WLAN_2,4GHz_pdf.pdf
  1162. +#
  1163. +# Allocation for the 5 GHz band (Vfg. 7 / 2010, Allgemeinzuteilung von
  1164. +# Frequenzen in den Bereichen 5150 MHz - 5350 MHz und 5470 MHz - 5725 MHz für
  1165. +# Funkanwendungen zur breitbandigen Datenübertragung, WAS/WLAN („Wireless
  1166. +# Access Systems including Wireless Local Area Networks“).
  1167. +# https://www.bundesnetzagentur.de/SharedDocs/Downloads/DE/Sachgebiete/Telekommunikation/Unternehmen_Institutionen/Frequenzen/Allgemeinzuteilungen/2010_07_WLAN_5GHz_pdf.pdf
  1168. +# The values for the 5 GHz have been reduced by a factor of 2 (3db) for non TPC
  1169. +# devices (in other words: devices with TPC can use twice the tx power of this
  1170. +# table). Note that the docs do not require TPC for 5150--5250; the reduction
  1171. +# to 100mW thus is not strictly required -- however the conservative 100mW
  1172. # limit is used here as the non-interference with radar and satellite
  1173. # apps relies on the attenuation by the building walls only in the
  1174. # absence of DFS; the neighbour countries have 100mW limit here as well.
  1175. +#
  1176. +# The ETSI EN 300 440-1 standard for short range devices in the 5 GHz band has
  1177. +# been implemented in Germany:
  1178. +# https://www.bundesnetzagentur.de/SharedDocs/Downloads/DE/Sachgebiete/Telekommunikation/Unternehmen_Institutionen/Frequenzen/Allgemeinzuteilungen/2014_69_SRD_pdf.pdf
  1179. +#
  1180. +# Allocation for the 60 GHz band (Allgemeinzuteilung von Frequenzen im
  1181. +# Bereich 57 GHz - 66 GHz für Funkanwendungen für weitbandige
  1182. +# Datenübertragungssysteme; „Multiple Gigabit WAS/RLAN Systems (MGWS)“).
  1183. +# https://www.bundesnetzagentur.de/SharedDocs/Downloads/DE/Sachgebiete/Telekommunikation/Unternehmen_Institutionen/Frequenzen/Allgemeinzuteilungen/2011_08_MGWS_pdf.pdf
  1184. country DE: DFS-ETSI
  1185. - # entries 279004 and 280006
  1186. (2400 - 2483.5 @ 40), (100 mW)
  1187. - # entry 303005
  1188. (5150 - 5250 @ 80), (100 mW), NO-OUTDOOR, AUTO-BW
  1189. - # entries 304002 and 305002
  1190. (5250 - 5350 @ 80), (100 mW), NO-OUTDOOR, DFS, AUTO-BW
  1191. - # entries 308002, 309001 and 310003
  1192. (5470 - 5725 @ 160), (500 mW), DFS
  1193. - # 60 GHz band channels 1-4, ref: Etsi En 302 567
  1194. + # short range devices (ETSI EN 300 440-1)
  1195. + (5725 - 5875 @ 80), (25 mW)
  1196. + # 60 GHz band channels 1-4 (ETSI EN 302 567)
  1197. (57000 - 66000 @ 2160), (40)
  1198. country DK: DFS-ETSI
  1199. @@ -629,6 +664,9 @@ country KR: DFS-JP
  1200. (5250 - 5330 @ 80), (20), DFS, AUTO-BW
  1201. (5490 - 5710 @ 160), (30), DFS
  1202. (5735 - 5835 @ 80), (30)
  1203. + # 60 GHz band channels 1-4,
  1204. + # ref: http://www.law.go.kr/%ED%96%89%EC%A0%95%EA%B7%9C%EC%B9%99/%EB%AC%B4%EC%84%A0%EC%84%A4%EB%B9%84%EA%B7%9C%EC%B9%99
  1205. + (57000 - 66000 @ 2160), (43)
  1206. country KW: DFS-ETSI
  1207. (2402 - 2482 @ 40), (20)
  1208. @@ -844,11 +882,18 @@ country NI: DFS-FCC
  1209. (5490 - 5730 @ 160), (24), DFS
  1210. (5735 - 5835 @ 80), (30)
  1211. +# Regulation on the use of frequency space without a license and
  1212. +# without notification 2015
  1213. +#
  1214. +# http://wetten.overheid.nl/BWBR0036378/2015-03-05
  1215. +
  1216. country NL: DFS-ETSI
  1217. (2402 - 2482 @ 40), (20)
  1218. (5170 - 5250 @ 80), (20), NO-OUTDOOR, AUTO-BW
  1219. (5250 - 5330 @ 80), (20), NO-OUTDOOR, DFS, AUTO-BW
  1220. (5490 - 5710 @ 160), (27), DFS
  1221. + # short range devices (ETSI EN 300 440-1)
  1222. + (5725 - 5875 @ 80), (25 mW)
  1223. # 60 GHz band channels 1-4, ref: Etsi En 302 567
  1224. (57000 - 66000 @ 2160), (40)
  1225. 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
  1226. deleted file mode 100644
  1227. index 9adfd8f..0000000
  1228. --- a/package/kernel/mac80211/patches/004-backports-add-skb_free_frag.patch
  1229. +++ /dev/null
  1230. @@ -1,21 +0,0 @@
  1231. -From: Felix Fietkau <nbd@openwrt.org>
  1232. -Date: Thu, 28 Jan 2016 15:16:35 +0100
  1233. -Subject: [PATCH] backports: add skb_free_frag()
  1234. -
  1235. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1236. ----
  1237. -
  1238. ---- a/backport-include/linux/skbuff.h
  1239. -+++ b/backport-include/linux/skbuff.h
  1240. -@@ -300,4 +300,11 @@ int skb_ensure_writable(struct sk_buff *
  1241. -
  1242. - #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) */
  1243. -
  1244. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
  1245. -+static inline void skb_free_frag(void *data)
  1246. -+{
  1247. -+ put_page(virt_to_head_page(data));
  1248. -+}
  1249. -+#endif
  1250. -+
  1251. - #endif /* __BACKPORT_SKBUFF_H */
  1252. diff --git a/package/kernel/mac80211/patches/004-fix_duplicate_skcipher_backport.patch b/package/kernel/mac80211/patches/004-fix_duplicate_skcipher_backport.patch
  1253. new file mode 100644
  1254. index 0000000..38b3179
  1255. --- /dev/null
  1256. +++ b/package/kernel/mac80211/patches/004-fix_duplicate_skcipher_backport.patch
  1257. @@ -0,0 +1,11 @@
  1258. +--- a/compat/Makefile
  1259. ++++ b/compat/Makefile
  1260. +@@ -35,8 +35,6 @@ compat-$(CPTCFG_KERNEL_4_6) += backport-
  1261. +
  1262. + compat-$(CPTCFG_BPAUTO_BUILD_CRYPTO_CCM) += crypto-ccm.o
  1263. + compat-$(CPTCFG_BPAUTO_CRYPTO_SKCIPHER) += crypto-skcipher.o
  1264. +-skcipher-objs += crypto-skcipher.o
  1265. +-obj-$(CPTCFG_BPAUTO_CRYPTO_SKCIPHER) += skcipher.o
  1266. + compat-$(CPTCFG_BPAUTO_BUILD_WANT_DEV_COREDUMP) += drivers-base-devcoredump.o
  1267. + compat-$(CPTCFG_BPAUTO_RHASHTABLE) += lib-rhashtable.o
  1268. + cordic-objs += lib-cordic.o
  1269. diff --git a/package/kernel/mac80211/patches/005-backport_skb_get_hash_perturb.patch b/package/kernel/mac80211/patches/005-backport_skb_get_hash_perturb.patch
  1270. new file mode 100644
  1271. index 0000000..29bccc1
  1272. --- /dev/null
  1273. +++ b/package/kernel/mac80211/patches/005-backport_skb_get_hash_perturb.patch
  1274. @@ -0,0 +1,22 @@
  1275. +--- a/backport-include/linux/skbuff.h
  1276. ++++ b/backport-include/linux/skbuff.h
  1277. +@@ -305,6 +305,19 @@ static inline void skb_free_frag(void *d
  1278. + {
  1279. + put_page(virt_to_head_page(data));
  1280. + }
  1281. ++
  1282. ++#include <net/flow_keys.h>
  1283. ++#include <linux/jhash.h>
  1284. ++
  1285. ++static inline u32 skb_get_hash_perturb(struct sk_buff *skb, u32 key)
  1286. ++{
  1287. ++ struct flow_keys keys;
  1288. ++
  1289. ++ skb_flow_dissect(skb, &keys);
  1290. ++ return jhash_3words((__force u32)keys.dst,
  1291. ++ (__force u32)keys.src ^ keys.ip_proto,
  1292. ++ (__force u32)keys.ports, key);
  1293. ++}
  1294. + #endif
  1295. +
  1296. + #endif /* __BACKPORT_SKBUFF_H */
  1297. 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
  1298. deleted file mode 100644
  1299. index 9b672a8..0000000
  1300. --- a/package/kernel/mac80211/patches/005-backports-add-napi_alloc_frag.patch
  1301. +++ /dev/null
  1302. @@ -1,20 +0,0 @@
  1303. -From: Felix Fietkau <nbd@openwrt.org>
  1304. -Date: Thu, 28 Jan 2016 15:19:22 +0100
  1305. -Subject: [PATCH] backports: add napi_alloc_frag
  1306. -
  1307. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1308. ----
  1309. -
  1310. ---- a/backport-include/linux/netdevice.h
  1311. -+++ b/backport-include/linux/netdevice.h
  1312. -@@ -232,6 +232,10 @@ static inline void backport_unregister_n
  1313. - #define unregister_netdevice_many LINUX_BACKPORT(unregister_netdevice_many)
  1314. - #endif
  1315. -
  1316. -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
  1317. -+#define napi_alloc_frag netdev_alloc_frag
  1318. -+#endif
  1319. -+
  1320. - /*
  1321. - * Complicated way of saying: We only backport netdev_rss_key stuff on kernels
  1322. - * that either already have net_get_random_once() (>= 3.13) or where we've been
  1323. diff --git a/package/kernel/mac80211/patches/006-add-basic-register-field-manipulation-macros.patch b/package/kernel/mac80211/patches/006-add-basic-register-field-manipulation-macros.patch
  1324. new file mode 100644
  1325. index 0000000..a51edf8
  1326. --- /dev/null
  1327. +++ b/package/kernel/mac80211/patches/006-add-basic-register-field-manipulation-macros.patch
  1328. @@ -0,0 +1,145 @@
  1329. +From: Jakub Kicinski <jakub.kicinski@netronome.com>
  1330. +Date: Wed, 31 Aug 2016 12:46:44 +0100
  1331. +Subject: [PATCH] add basic register-field manipulation macros
  1332. +
  1333. +Common approach to accessing register fields is to define
  1334. +structures or sets of macros containing mask and shift pair.
  1335. +Operations on the register are then performed as follows:
  1336. +
  1337. + field = (reg >> shift) & mask;
  1338. +
  1339. + reg &= ~(mask << shift);
  1340. + reg |= (field & mask) << shift;
  1341. +
  1342. +Defining shift and mask separately is tedious. Ivo van Doorn
  1343. +came up with an idea of computing them at compilation time
  1344. +based on a single shifted mask (later refined by Felix) which
  1345. +can be used like this:
  1346. +
  1347. + #define REG_FIELD 0x000ff000
  1348. +
  1349. + field = FIELD_GET(REG_FIELD, reg);
  1350. +
  1351. + reg &= ~REG_FIELD;
  1352. + reg |= FIELD_PREP(REG_FIELD, field);
  1353. +
  1354. +FIELD_{GET,PREP} macros take care of finding out what the
  1355. +appropriate shift is based on compilation time ffs operation.
  1356. +
  1357. +GENMASK can be used to define registers (which is usually
  1358. +less error-prone and easier to match with datasheets).
  1359. +
  1360. +This approach is the most convenient I've seen so to limit code
  1361. +multiplication let's move the macros to a global header file.
  1362. +Attempts to use static inlines instead of macros failed due
  1363. +to false positive triggering of BUILD_BUG_ON()s, especially with
  1364. +GCC < 6.0.
  1365. +
  1366. +Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
  1367. +Reviewed-by: Dinan Gunawardena <dinan.gunawardena@netronome.com>
  1368. +---
  1369. + create mode 100644 include/linux/bitfield.h
  1370. +
  1371. +--- /dev/null
  1372. ++++ b/include/linux/bitfield.h
  1373. +@@ -0,0 +1,100 @@
  1374. ++/*
  1375. ++ * Copyright (C) 2014 Felix Fietkau <nbd@nbd.name>
  1376. ++ * Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
  1377. ++ *
  1378. ++ * This program is free software; you can redistribute it and/or modify
  1379. ++ * it under the terms of the GNU General Public License version 2
  1380. ++ * as published by the Free Software Foundation
  1381. ++ *
  1382. ++ * This program is distributed in the hope that it will be useful,
  1383. ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1384. ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  1385. ++ * GNU General Public License for more details.
  1386. ++ */
  1387. ++
  1388. ++#ifndef _LINUX_BITFIELD_H
  1389. ++#define _LINUX_BITFIELD_H
  1390. ++
  1391. ++#include <linux/bug.h>
  1392. ++
  1393. ++#ifdef __CHECKER__
  1394. ++#define __BUILD_BUG_ON_NOT_POWER_OF_2(n) (0)
  1395. ++#else
  1396. ++#define __BUILD_BUG_ON_NOT_POWER_OF_2(n) \
  1397. ++ BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
  1398. ++#endif
  1399. ++
  1400. ++/*
  1401. ++ * Bitfield access macros
  1402. ++ *
  1403. ++ * FIELD_{GET,PREP} macros take as first parameter shifted mask
  1404. ++ * from which they extract the base mask and shift amount.
  1405. ++ * Mask must be a compilation time constant.
  1406. ++ *
  1407. ++ * Example:
  1408. ++ *
  1409. ++ * #define REG_FIELD_A GENMASK(6, 0)
  1410. ++ * #define REG_FIELD_B BIT(7)
  1411. ++ * #define REG_FIELD_C GENMASK(15, 8)
  1412. ++ * #define REG_FIELD_D GENMASK(31, 16)
  1413. ++ *
  1414. ++ * Get:
  1415. ++ * a = FIELD_GET(REG_FIELD_A, reg);
  1416. ++ * b = FIELD_GET(REG_FIELD_B, reg);
  1417. ++ *
  1418. ++ * Set:
  1419. ++ * reg = FIELD_PREP(REG_FIELD_A, 1) |
  1420. ++ * FIELD_PREP(REG_FIELD_B, 0) |
  1421. ++ * FIELD_PREP(REG_FIELD_C, c) |
  1422. ++ * FIELD_PREP(REG_FIELD_D, 0x40);
  1423. ++ *
  1424. ++ * Modify:
  1425. ++ * reg &= ~REG_FIELD_C;
  1426. ++ * reg |= FIELD_PREP(REG_FIELD_C, c);
  1427. ++ */
  1428. ++
  1429. ++#define __bf_shf(x) (__builtin_ffsll(x) - 1)
  1430. ++
  1431. ++#define __BF_FIELD_CHECK(_mask, _reg, _val, _pfx) \
  1432. ++ ({ \
  1433. ++ BUILD_BUG_ON_MSG(!__builtin_constant_p(_mask), \
  1434. ++ _pfx "mask is not constant"); \
  1435. ++ BUILD_BUG_ON_MSG(!(_mask), _pfx "mask is zero"); \
  1436. ++ BUILD_BUG_ON_MSG(__builtin_constant_p(_val) ? \
  1437. ++ ~((_mask) >> __bf_shf(_mask)) & (_val) : 0, \
  1438. ++ _pfx "value too large for the field"); \
  1439. ++ BUILD_BUG_ON_MSG((_mask) > (typeof(_reg))~0ull, \
  1440. ++ _pfx "type of reg too small for mask"); \
  1441. ++ __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) + \
  1442. ++ (1ULL << __bf_shf(_mask))); \
  1443. ++ })
  1444. ++
  1445. ++/**
  1446. ++ * FIELD_PREP() - prepare a bitfield element
  1447. ++ * @_mask: shifted mask defining the field's length and position
  1448. ++ * @_val: value to put in the field
  1449. ++ *
  1450. ++ * FIELD_PREP() masks and shifts up the value. The result should
  1451. ++ * be combined with other fields of the bitfield using logical OR.
  1452. ++ */
  1453. ++#define FIELD_PREP(_mask, _val) \
  1454. ++ ({ \
  1455. ++ __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
  1456. ++ ((typeof(_mask))(_val) << __bf_shf(_mask)) & (_mask); \
  1457. ++ })
  1458. ++
  1459. ++/**
  1460. ++ * FIELD_GET() - extract a bitfield element
  1461. ++ * @_mask: shifted mask defining the field's length and position
  1462. ++ * @_reg: 32bit value of entire bitfield
  1463. ++ *
  1464. ++ * FIELD_GET() extracts the field specified by @_mask from the
  1465. ++ * bitfield passed in as @_reg by masking and shifting it down.
  1466. ++ */
  1467. ++#define FIELD_GET(_mask, _reg) \
  1468. ++ ({ \
  1469. ++ __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
  1470. ++ (typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \
  1471. ++ })
  1472. ++
  1473. ++#endif
  1474. diff --git a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  1475. index fd1e1cf..8be5fa1 100644
  1476. --- a/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  1477. +++ b/package/kernel/mac80211/patches/060-no_local_ssb_bcma.patch
  1478. @@ -1,6 +1,6 @@
  1479. --- a/.local-symbols
  1480. +++ b/.local-symbols
  1481. -@@ -476,44 +476,6 @@ USB_IPHETH=
  1482. +@@ -481,45 +481,6 @@ USB_IPHETH=
  1483. USB_SIERRA_NET=
  1484. USB_VL600=
  1485. USB_NET_CH9200=
  1486. @@ -37,6 +37,7 @@
  1487. -BCMA_DRIVER_PCI=
  1488. -BCMA_DRIVER_PCI_HOSTMODE=
  1489. -BCMA_DRIVER_MIPS=
  1490. +-BCMA_PFLASH=
  1491. -BCMA_SFLASH=
  1492. -BCMA_NFLASH=
  1493. -BCMA_DRIVER_GMAC_CMN=
  1494. @@ -56,7 +57,7 @@
  1495. return (bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev);
  1496. #else
  1497. return bus->chipco.dev;
  1498. -@@ -4903,7 +4903,7 @@ static int b43_wireless_core_init(struct
  1499. +@@ -4883,7 +4883,7 @@ static int b43_wireless_core_init(struct
  1500. }
  1501. if (sprom->boardflags_lo & B43_BFL_XTAL_NOSLOW)
  1502. hf |= B43_HF_DSCRQ; /* Disable slowclock requests from ucode. */
  1503. diff --git a/package/kernel/mac80211/patches/080-disable_clk_backport.patch b/package/kernel/mac80211/patches/080-disable_clk_backport.patch
  1504. deleted file mode 100644
  1505. index 3765591..0000000
  1506. --- a/package/kernel/mac80211/patches/080-disable_clk_backport.patch
  1507. +++ /dev/null
  1508. @@ -1,20 +0,0 @@
  1509. ---- a/compat/compat-3.6.c
  1510. -+++ b/compat/compat-3.6.c
  1511. -@@ -147,17 +147,3 @@ int sg_alloc_table_from_pages(struct sg_
  1512. - return 0;
  1513. - }
  1514. - EXPORT_SYMBOL_GPL(sg_alloc_table_from_pages);
  1515. --
  1516. --/* whoopsie ! */
  1517. --#ifndef CONFIG_COMMON_CLK
  1518. --int clk_enable(struct clk *clk)
  1519. --{
  1520. -- return 0;
  1521. --}
  1522. --EXPORT_SYMBOL_GPL(clk_enable);
  1523. --
  1524. --void clk_disable(struct clk *clk)
  1525. --{
  1526. --}
  1527. --EXPORT_SYMBOL_GPL(clk_disable);
  1528. --#endif
  1529. diff --git a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  1530. index 02f46c7..fbe22e5 100644
  1531. --- a/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  1532. +++ b/package/kernel/mac80211/patches/100-remove-cryptoapi-dependencies.patch
  1533. @@ -309,7 +309,7 @@
  1534. #endif /* AES_GMAC_H */
  1535. --- a/net/mac80211/key.h
  1536. +++ b/net/mac80211/key.h
  1537. -@@ -84,7 +84,7 @@ struct ieee80211_key {
  1538. +@@ -88,7 +88,7 @@ struct ieee80211_key {
  1539. * Management frames.
  1540. */
  1541. u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_CCMP_PN_LEN];
  1542. @@ -320,7 +320,7 @@
  1543. struct {
  1544. --- a/net/mac80211/wpa.c
  1545. +++ b/net/mac80211/wpa.c
  1546. -@@ -307,7 +307,8 @@ ieee80211_crypto_tkip_decrypt(struct iee
  1547. +@@ -304,7 +304,8 @@ ieee80211_crypto_tkip_decrypt(struct iee
  1548. }
  1549. @@ -330,7 +330,7 @@
  1550. {
  1551. __le16 mask_fc;
  1552. int a4_included, mgmt;
  1553. -@@ -337,14 +338,8 @@ static void ccmp_special_blocks(struct s
  1554. +@@ -334,14 +335,8 @@ static void ccmp_special_blocks(struct s
  1555. else
  1556. qos_tid = 0;
  1557. @@ -347,7 +347,7 @@
  1558. /* Nonce: Nonce Flags | A2 | PN
  1559. * Nonce Flags: Priority (b0..b3) | Management (b4) | Reserved (b5..b7)
  1560. -@@ -352,6 +347,8 @@ static void ccmp_special_blocks(struct s
  1561. +@@ -349,6 +344,8 @@ static void ccmp_special_blocks(struct s
  1562. b_0[1] = qos_tid | (mgmt << 4);
  1563. memcpy(&b_0[2], hdr->addr2, ETH_ALEN);
  1564. memcpy(&b_0[8], pn, IEEE80211_CCMP_PN_LEN);
  1565. @@ -356,7 +356,7 @@
  1566. /* AAD (extra authenticate-only data) / masked 802.11 header
  1567. * FC | A1 | A2 | A3 | SC | [A4] | [QC] */
  1568. -@@ -463,7 +460,7 @@ static int ccmp_encrypt_skb(struct ieee8
  1569. +@@ -460,7 +457,7 @@ static int ccmp_encrypt_skb(struct ieee8
  1570. return 0;
  1571. pos += IEEE80211_CCMP_HDR_LEN;
  1572. @@ -365,7 +365,7 @@
  1573. ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, b_0, aad, pos, len,
  1574. skb_put(skb, mic_len), mic_len);
  1575. -@@ -534,7 +531,7 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  1576. +@@ -537,7 +534,7 @@ ieee80211_crypto_ccmp_decrypt(struct iee
  1577. u8 aad[2 * AES_BLOCK_SIZE];
  1578. u8 b_0[AES_BLOCK_SIZE];
  1579. /* hardware didn't decrypt/verify MIC */
  1580. 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
  1581. index d1d9fbd..3ca166f 100644
  1582. --- a/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
  1583. +++ b/package/kernel/mac80211/patches/110-mac80211_keep_keys_on_stop_ap.patch
  1584. @@ -2,7 +2,7 @@ Used for AP+STA support in OpenWrt - preserve AP mode keys across STA reconnects
  1585. --- a/net/mac80211/cfg.c
  1586. +++ b/net/mac80211/cfg.c
  1587. -@@ -846,7 +846,6 @@ static int ieee80211_stop_ap(struct wiph
  1588. +@@ -850,7 +850,6 @@ static int ieee80211_stop_ap(struct wiph
  1589. sdata->u.ap.driver_smps_mode = IEEE80211_SMPS_OFF;
  1590. __sta_info_flush(sdata, true);
  1591. diff --git a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  1592. index 2855a88..16fab84 100644
  1593. --- a/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  1594. +++ b/package/kernel/mac80211/patches/150-disable_addr_notifier.patch
  1595. @@ -18,9 +18,9 @@
  1596. static int ieee80211_ifa6_changed(struct notifier_block *nb,
  1597. unsigned long data, void *arg)
  1598. {
  1599. -@@ -1087,14 +1087,14 @@ int ieee80211_register_hw(struct ieee802
  1600. -
  1601. - rtnl_unlock();
  1602. +@@ -1090,14 +1090,14 @@ int ieee80211_register_hw(struct ieee802
  1603. + if (result)
  1604. + goto fail_flows;
  1605. -#ifdef CONFIG_INET
  1606. +#ifdef __disabled__CONFIG_INET
  1607. @@ -35,7 +35,7 @@
  1608. local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed;
  1609. result = register_inet6addr_notifier(&local->ifa6_notifier);
  1610. if (result)
  1611. -@@ -1103,13 +1103,13 @@ int ieee80211_register_hw(struct ieee802
  1612. +@@ -1106,13 +1106,13 @@ int ieee80211_register_hw(struct ieee802
  1613. return 0;
  1614. @@ -51,8 +51,8 @@
  1615. +#if defined(__disabled__CONFIG_INET) || defined(__disabled__CONFIG_IPV6)
  1616. fail_ifa:
  1617. #endif
  1618. - rtnl_lock();
  1619. -@@ -1137,10 +1137,10 @@ void ieee80211_unregister_hw(struct ieee
  1620. + ieee80211_txq_teardown_flows(local);
  1621. +@@ -1142,10 +1142,10 @@ void ieee80211_unregister_hw(struct ieee
  1622. tasklet_kill(&local->tx_pending_tasklet);
  1623. tasklet_kill(&local->tasklet);
  1624. diff --git a/package/kernel/mac80211/patches/210-ap_scan.patch b/package/kernel/mac80211/patches/210-ap_scan.patch
  1625. index a99cbd2..29f05c4 100644
  1626. --- a/package/kernel/mac80211/patches/210-ap_scan.patch
  1627. +++ b/package/kernel/mac80211/patches/210-ap_scan.patch
  1628. @@ -1,6 +1,6 @@
  1629. --- a/net/mac80211/cfg.c
  1630. +++ b/net/mac80211/cfg.c
  1631. -@@ -1999,7 +1999,7 @@ static int ieee80211_scan(struct wiphy *
  1632. +@@ -2008,7 +2008,7 @@ static int ieee80211_scan(struct wiphy *
  1633. * the frames sent while scanning on other channel will be
  1634. * lost)
  1635. */
  1636. diff --git a/package/kernel/mac80211/patches/220-fq_disable_hack.patch b/package/kernel/mac80211/patches/220-fq_disable_hack.patch
  1637. new file mode 100644
  1638. index 0000000..7f420be
  1639. --- /dev/null
  1640. +++ b/package/kernel/mac80211/patches/220-fq_disable_hack.patch
  1641. @@ -0,0 +1,15 @@
  1642. +mac80211 fq has been found to cause a regression in multi-stream TCP
  1643. +performance. Disable it until the cause has been found and fixed
  1644. +
  1645. +--- a/include/net/fq_impl.h
  1646. ++++ b/include/net/fq_impl.h
  1647. +@@ -104,6 +104,9 @@ static struct fq_flow *fq_flow_classify(
  1648. +
  1649. + lockdep_assert_held(&fq->lock);
  1650. +
  1651. ++ /* HACK: disable fq for now until TCP issues are fixed */
  1652. ++ return get_default_func(fq, tin, 0, skb);
  1653. ++
  1654. + hash = skb_get_hash_perturb(skb, fq->perturbation);
  1655. + idx = reciprocal_scale(hash, fq->flows_cnt);
  1656. + flow = &fq->flows[idx];
  1657. 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
  1658. index bddb15a..098bda7 100644
  1659. --- a/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch
  1660. +++ b/package/kernel/mac80211/patches/300-ath9k-force-rx_clear-when-disabling-rx.patch
  1661. @@ -3,15 +3,16 @@ Date: Sun, 7 Jun 2015 13:53:35 +0200
  1662. Subject: [PATCH] ath9k: force rx_clear when disabling rx
  1663. This makes stopping Rx more reliable and should reduce the frequency of
  1664. -Rx related DMA stop warnings
  1665. +Rx related DMA stop warnings. Don't use rx_clear in TX99 mode.
  1666. Cc: stable@vger.kernel.org
  1667. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1668. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  1669. +Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
  1670. ---
  1671. --- a/drivers/net/wireless/ath/ath9k/mac.c
  1672. +++ b/drivers/net/wireless/ath/ath9k/mac.c
  1673. -@@ -677,13 +677,15 @@ void ath9k_hw_startpcureceive(struct ath
  1674. +@@ -677,13 +677,18 @@ void ath9k_hw_startpcureceive(struct ath
  1675. ath9k_ani_reset(ah, is_scanning);
  1676. @@ -24,8 +25,11 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1677. void ath9k_hw_abortpcurecv(struct ath_hw *ah)
  1678. {
  1679. - REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_ABORT | AR_DIAG_RX_DIS);
  1680. -+ REG_SET_BIT(ah, AR_DIAG_SW,
  1681. -+ AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT | AR_DIAG_FORCE_RX_CLEAR);
  1682. ++ u32 reg = AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT;
  1683. ++
  1684. ++ if (!config_enabled(CPTCFG_ATH9K_TX99))
  1685. ++ reg |= AR_DIAG_FORCE_RX_CLEAR;
  1686. ++ REG_SET_BIT(ah, AR_DIAG_SW, reg);
  1687. ath9k_hw_disable_mib_counters(ah);
  1688. }
  1689. 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
  1690. new file mode 100644
  1691. index 0000000..7caa9be
  1692. --- /dev/null
  1693. +++ b/package/kernel/mac80211/patches/302-Revert-ath9k-interpret-requested-txpower-in-EIRP-dom.patch
  1694. @@ -0,0 +1,37 @@
  1695. +From: Felix Fietkau <nbd@nbd.name>
  1696. +Date: Sat, 14 May 2016 14:51:02 +0200
  1697. +Subject: [PATCH] Revert "ath9k: interpret requested txpower in EIRP
  1698. + domain"
  1699. +
  1700. +This reverts commit 71f5137bf010c6faffab50c0ec15374c59c4a411.
  1701. +---
  1702. +
  1703. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  1704. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  1705. +@@ -2914,7 +2914,8 @@ void ath9k_hw_apply_txpower(struct ath_h
  1706. + {
  1707. + struct ath_regulatory *reg = ath9k_hw_regulatory(ah);
  1708. + struct ieee80211_channel *channel;
  1709. +- int chan_pwr, new_pwr;
  1710. ++ int chan_pwr, new_pwr, max_gain;
  1711. ++ int ant_gain, ant_reduction = 0;
  1712. +
  1713. + if (!chan)
  1714. + return;
  1715. +@@ -2922,10 +2923,15 @@ void ath9k_hw_apply_txpower(struct ath_h
  1716. + channel = chan->chan;
  1717. + chan_pwr = min_t(int, channel->max_power * 2, MAX_RATE_POWER);
  1718. + new_pwr = min_t(int, chan_pwr, reg->power_limit);
  1719. ++ max_gain = chan_pwr - new_pwr + channel->max_antenna_gain * 2;
  1720. ++
  1721. ++ ant_gain = get_antenna_gain(ah, chan);
  1722. ++ if (ant_gain > max_gain)
  1723. ++ ant_reduction = ant_gain - max_gain;
  1724. +
  1725. + ah->eep_ops->set_txpower(ah, chan,
  1726. + ath9k_regd_get_ctl(reg, chan),
  1727. +- get_antenna_gain(ah, chan), new_pwr, test);
  1728. ++ ant_reduction, new_pwr, test);
  1729. + }
  1730. +
  1731. + void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test)
  1732. 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
  1733. deleted file mode 100644
  1734. index 22b987a..0000000
  1735. --- a/package/kernel/mac80211/patches/302-ath9k_hw-add-low-power-tx-gain-table-for-AR953x.patch
  1736. +++ /dev/null
  1737. @@ -1,95 +0,0 @@
  1738. -From: Felix Fietkau <nbd@openwrt.org>
  1739. -Date: Thu, 14 Jan 2016 03:14:03 +0100
  1740. -Subject: [PATCH] ath9k_hw: add low power tx gain table for AR953x
  1741. -
  1742. -Used in some newer TP-Link AR9533 devices.
  1743. -
  1744. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  1745. ----
  1746. -
  1747. ---- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c
  1748. -+++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
  1749. -@@ -698,6 +698,9 @@ static void ar9003_tx_gain_table_mode2(s
  1750. - else if (AR_SREV_9340(ah))
  1751. - INIT_INI_ARRAY(&ah->iniModesTxGain,
  1752. - ar9340Modes_low_ob_db_tx_gain_table_1p0);
  1753. -+ else if (AR_SREV_9531_11(ah))
  1754. -+ INIT_INI_ARRAY(&ah->iniModesTxGain,
  1755. -+ qca953x_1p1_modes_no_xpa_low_power_tx_gain_table);
  1756. - else if (AR_SREV_9485_11_OR_LATER(ah))
  1757. - INIT_INI_ARRAY(&ah->iniModesTxGain,
  1758. - ar9485Modes_low_ob_db_tx_gain_1_1);
  1759. ---- a/drivers/net/wireless/ath/ath9k/ar953x_initvals.h
  1760. -+++ b/drivers/net/wireless/ath/ath9k/ar953x_initvals.h
  1761. -@@ -757,6 +757,71 @@ static const u32 qca953x_1p1_modes_xpa_t
  1762. - {0x00016448, 0x6c927a70},
  1763. - };
  1764. -
  1765. -+static const u32 qca953x_1p1_modes_no_xpa_low_power_tx_gain_table[][2] = {
  1766. -+ /* Addr allmodes */
  1767. -+ {0x0000a2dc, 0xfff55592},
  1768. -+ {0x0000a2e0, 0xfff99924},
  1769. -+ {0x0000a2e4, 0xfffe1e00},
  1770. -+ {0x0000a2e8, 0xffffe000},
  1771. -+ {0x0000a410, 0x000050d6},
  1772. -+ {0x0000a500, 0x00000069},
  1773. -+ {0x0000a504, 0x0400006b},
  1774. -+ {0x0000a508, 0x0800006d},
  1775. -+ {0x0000a50c, 0x0c000269},
  1776. -+ {0x0000a510, 0x1000026b},
  1777. -+ {0x0000a514, 0x1400026d},
  1778. -+ {0x0000a518, 0x18000669},
  1779. -+ {0x0000a51c, 0x1c00066b},
  1780. -+ {0x0000a520, 0x1d000a68},
  1781. -+ {0x0000a524, 0x21000a6a},
  1782. -+ {0x0000a528, 0x25000a6c},
  1783. -+ {0x0000a52c, 0x29000a6e},
  1784. -+ {0x0000a530, 0x2d0012a9},
  1785. -+ {0x0000a534, 0x310012ab},
  1786. -+ {0x0000a538, 0x350012ad},
  1787. -+ {0x0000a53c, 0x39001b0a},
  1788. -+ {0x0000a540, 0x3d001b0c},
  1789. -+ {0x0000a544, 0x41001b0e},
  1790. -+ {0x0000a548, 0x43001bae},
  1791. -+ {0x0000a54c, 0x45001914},
  1792. -+ {0x0000a550, 0x47001916},
  1793. -+ {0x0000a554, 0x49001b96},
  1794. -+ {0x0000a558, 0x49001b96},
  1795. -+ {0x0000a55c, 0x49001b96},
  1796. -+ {0x0000a560, 0x49001b96},
  1797. -+ {0x0000a564, 0x49001b96},
  1798. -+ {0x0000a568, 0x49001b96},
  1799. -+ {0x0000a56c, 0x49001b96},
  1800. -+ {0x0000a570, 0x49001b96},
  1801. -+ {0x0000a574, 0x49001b96},
  1802. -+ {0x0000a578, 0x49001b96},
  1803. -+ {0x0000a57c, 0x49001b96},
  1804. -+ {0x0000a600, 0x00000000},
  1805. -+ {0x0000a604, 0x00000000},
  1806. -+ {0x0000a608, 0x00000000},
  1807. -+ {0x0000a60c, 0x00000000},
  1808. -+ {0x0000a610, 0x00000000},
  1809. -+ {0x0000a614, 0x00000000},
  1810. -+ {0x0000a618, 0x00804201},
  1811. -+ {0x0000a61c, 0x01408201},
  1812. -+ {0x0000a620, 0x01408502},
  1813. -+ {0x0000a624, 0x01408502},
  1814. -+ {0x0000a628, 0x01408502},
  1815. -+ {0x0000a62c, 0x01408502},
  1816. -+ {0x0000a630, 0x01408502},
  1817. -+ {0x0000a634, 0x01408502},
  1818. -+ {0x0000a638, 0x01408502},
  1819. -+ {0x0000a63c, 0x01408502},
  1820. -+ {0x0000b2dc, 0xfff55592},
  1821. -+ {0x0000b2e0, 0xfff99924},
  1822. -+ {0x0000b2e4, 0xfffe1e00},
  1823. -+ {0x0000b2e8, 0xffffe000},
  1824. -+ {0x00016044, 0x044922db},
  1825. -+ {0x00016048, 0x6c927a70},
  1826. -+ {0x00016444, 0x044922db},
  1827. -+ {0x00016448, 0x6c927a70},
  1828. -+};
  1829. -+
  1830. - static const u32 qca953x_2p0_baseband_core[][2] = {
  1831. - /* Addr allmodes */
  1832. - {0x00009800, 0xafe68e30},
  1833. diff --git a/package/kernel/mac80211/patches/303-ath10k-Ensure-txrx-compl-task-is-stopped-when-cleani.patch b/package/kernel/mac80211/patches/303-ath10k-Ensure-txrx-compl-task-is-stopped-when-cleani.patch
  1834. new file mode 100644
  1835. index 0000000..73accd8
  1836. --- /dev/null
  1837. +++ b/package/kernel/mac80211/patches/303-ath10k-Ensure-txrx-compl-task-is-stopped-when-cleani.patch
  1838. @@ -0,0 +1,21 @@
  1839. +From: Ben Greear <greearb@candelatech.com>
  1840. +Date: Fri, 1 Apr 2016 14:12:08 -0700
  1841. +Subject: [PATCH] ath10k: Ensure txrx-compl-task is stopped when cleaning
  1842. + htt-tx.
  1843. +
  1844. +Otherwise, the txrx-compl-task may access some bad memory?
  1845. +
  1846. +Signed-off-by: Ben Greear <greearb@candelatech.com>
  1847. +---
  1848. +
  1849. +--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
  1850. ++++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
  1851. +@@ -388,6 +388,8 @@ void ath10k_htt_tx_free(struct ath10k_ht
  1852. + {
  1853. + int size;
  1854. +
  1855. ++ tasklet_kill(&htt->txrx_compl_task);
  1856. ++
  1857. + idr_for_each(&htt->pending_tx, ath10k_htt_tx_clean_up_pending, htt->ar);
  1858. + idr_destroy(&htt->pending_tx);
  1859. +
  1860. 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
  1861. deleted file mode 100644
  1862. index 7bb7435..0000000
  1863. --- a/package/kernel/mac80211/patches/303-rt2x00-fix-monitor-mode-regression.patch
  1864. +++ /dev/null
  1865. @@ -1,156 +0,0 @@
  1866. -From: Eli Cooper <elicooper@gmx.com>
  1867. -Date: Thu, 14 Jan 2016 00:07:12 +0800
  1868. -Subject: [PATCH] rt2x00: fix monitor mode regression
  1869. -
  1870. -Since commit df1404650ccbfeb76a84f301f22316be0d00a864 monitor mode for rt2x00
  1871. -has been made effectively useless because the hardware filter is configured to
  1872. -drop packets whose intended recipient is not the device, regardless of the
  1873. -presence of monitor mode interfaces.
  1874. -
  1875. -This patch fixes this regression by adding explicit monitor mode support, and
  1876. -configuring the hardware filter accordingly.
  1877. -
  1878. -Signed-off-by: Eli Cooper <elicooper@gmx.com>
  1879. ----
  1880. -
  1881. ---- a/drivers/net/wireless/ralink/rt2x00/rt2400pci.c
  1882. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2400pci.c
  1883. -@@ -273,8 +273,10 @@ static void rt2400pci_config_filter(stru
  1884. - !(filter_flags & FIF_PLCPFAIL));
  1885. - rt2x00_set_field32(&reg, RXCSR0_DROP_CONTROL,
  1886. - !(filter_flags & FIF_CONTROL));
  1887. -- rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME, 1);
  1888. -+ rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME,
  1889. -+ !rt2x00dev->is_monitoring);
  1890. - rt2x00_set_field32(&reg, RXCSR0_DROP_TODS,
  1891. -+ !rt2x00dev->is_monitoring &&
  1892. - !rt2x00dev->intf_ap_count);
  1893. - rt2x00_set_field32(&reg, RXCSR0_DROP_VERSION_ERROR, 1);
  1894. - rt2x00mmio_register_write(rt2x00dev, RXCSR0, reg);
  1895. ---- a/drivers/net/wireless/ralink/rt2x00/rt2500pci.c
  1896. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2500pci.c
  1897. -@@ -274,8 +274,10 @@ static void rt2500pci_config_filter(stru
  1898. - !(filter_flags & FIF_PLCPFAIL));
  1899. - rt2x00_set_field32(&reg, RXCSR0_DROP_CONTROL,
  1900. - !(filter_flags & FIF_CONTROL));
  1901. -- rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME, 1);
  1902. -+ rt2x00_set_field32(&reg, RXCSR0_DROP_NOT_TO_ME,
  1903. -+ !rt2x00dev->is_monitoring);
  1904. - rt2x00_set_field32(&reg, RXCSR0_DROP_TODS,
  1905. -+ !rt2x00dev->is_monitoring &&
  1906. - !rt2x00dev->intf_ap_count);
  1907. - rt2x00_set_field32(&reg, RXCSR0_DROP_VERSION_ERROR, 1);
  1908. - rt2x00_set_field32(&reg, RXCSR0_DROP_MCAST,
  1909. ---- a/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
  1910. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
  1911. -@@ -437,8 +437,10 @@ static void rt2500usb_config_filter(stru
  1912. - !(filter_flags & FIF_PLCPFAIL));
  1913. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_CONTROL,
  1914. - !(filter_flags & FIF_CONTROL));
  1915. -- rt2x00_set_field16(&reg, TXRX_CSR2_DROP_NOT_TO_ME, 1);
  1916. -+ rt2x00_set_field16(&reg, TXRX_CSR2_DROP_NOT_TO_ME,
  1917. -+ !rt2x00dev->is_monitoring);
  1918. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_TODS,
  1919. -+ !rt2x00dev->is_monitoring &&
  1920. - !rt2x00dev->intf_ap_count);
  1921. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_VERSION_ERROR, 1);
  1922. - rt2x00_set_field16(&reg, TXRX_CSR2_DROP_MULTICAST,
  1923. ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  1924. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  1925. -@@ -1490,7 +1490,8 @@ void rt2800_config_filter(struct rt2x00_
  1926. - !(filter_flags & FIF_FCSFAIL));
  1927. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_PHY_ERROR,
  1928. - !(filter_flags & FIF_PLCPFAIL));
  1929. -- rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_TO_ME, 1);
  1930. -+ rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_TO_ME,
  1931. -+ !rt2x00dev->is_monitoring);
  1932. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_NOT_MY_BSSD, 0);
  1933. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_VER_ERROR, 1);
  1934. - rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_MULTICAST,
  1935. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  1936. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  1937. -@@ -844,11 +844,13 @@ struct rt2x00_dev {
  1938. - * - Open sta interface count.
  1939. - * - Association count.
  1940. - * - Beaconing enabled count.
  1941. -+ * - Whether the device is monitoring.
  1942. - */
  1943. - unsigned int intf_ap_count;
  1944. - unsigned int intf_sta_count;
  1945. - unsigned int intf_associated;
  1946. - unsigned int intf_beaconing;
  1947. -+ bool is_monitoring;
  1948. -
  1949. - /*
  1950. - * Interface combinations
  1951. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00config.c
  1952. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00config.c
  1953. -@@ -244,6 +244,16 @@ void rt2x00lib_config(struct rt2x00_dev
  1954. - (ieee80211_flags & IEEE80211_CONF_CHANGE_PS))
  1955. - cancel_delayed_work_sync(&rt2x00dev->autowakeup_work);
  1956. -
  1957. -+ if (ieee80211_flags & IEEE80211_CONF_CHANGE_MONITOR) {
  1958. -+ if (conf->flags & IEEE80211_CONF_MONITOR) {
  1959. -+ rt2x00_dbg(rt2x00dev, "Monitor mode is enabled\n");
  1960. -+ rt2x00dev->is_monitoring = true;
  1961. -+ } else {
  1962. -+ rt2x00_dbg(rt2x00dev, "Monitor mode is disabled\n");
  1963. -+ rt2x00dev->is_monitoring = false;
  1964. -+ }
  1965. -+ }
  1966. -+
  1967. - /*
  1968. - * Start configuration.
  1969. - */
  1970. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  1971. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  1972. -@@ -1204,6 +1204,7 @@ int rt2x00lib_start(struct rt2x00_dev *r
  1973. - rt2x00dev->intf_ap_count = 0;
  1974. - rt2x00dev->intf_sta_count = 0;
  1975. - rt2x00dev->intf_associated = 0;
  1976. -+ rt2x00dev->is_monitoring = false;
  1977. -
  1978. - /* Enable the radio */
  1979. - retval = rt2x00lib_enable_radio(rt2x00dev);
  1980. ---- a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
  1981. -+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
  1982. -@@ -385,11 +385,6 @@ void rt2x00mac_configure_filter(struct i
  1983. - *total_flags |= FIF_PSPOLL;
  1984. - }
  1985. -
  1986. -- /*
  1987. -- * Check if there is any work left for us.
  1988. -- */
  1989. -- if (rt2x00dev->packet_filter == *total_flags)
  1990. -- return;
  1991. - rt2x00dev->packet_filter = *total_flags;
  1992. -
  1993. - rt2x00dev->ops->lib->config_filter(rt2x00dev, *total_flags);
  1994. ---- a/drivers/net/wireless/ralink/rt2x00/rt61pci.c
  1995. -+++ b/drivers/net/wireless/ralink/rt2x00/rt61pci.c
  1996. -@@ -530,8 +530,10 @@ static void rt61pci_config_filter(struct
  1997. - !(filter_flags & FIF_PLCPFAIL));
  1998. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_CONTROL,
  1999. - !(filter_flags & (FIF_CONTROL | FIF_PSPOLL)));
  2000. -- rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME, 1);
  2001. -+ rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME,
  2002. -+ !rt2x00dev->is_monitoring);
  2003. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_TO_DS,
  2004. -+ !rt2x00dev->is_monitoring &&
  2005. - !rt2x00dev->intf_ap_count);
  2006. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_VERSION_ERROR, 1);
  2007. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_MULTICAST,
  2008. ---- a/drivers/net/wireless/ralink/rt2x00/rt73usb.c
  2009. -+++ b/drivers/net/wireless/ralink/rt2x00/rt73usb.c
  2010. -@@ -480,8 +480,10 @@ static void rt73usb_config_filter(struct
  2011. - !(filter_flags & FIF_PLCPFAIL));
  2012. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_CONTROL,
  2013. - !(filter_flags & (FIF_CONTROL | FIF_PSPOLL)));
  2014. -- rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME, 1);
  2015. -+ rt2x00_set_field32(&reg, TXRX_CSR0_DROP_NOT_TO_ME,
  2016. -+ !rt2x00dev->is_monitoring);
  2017. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_TO_DS,
  2018. -+ !rt2x00dev->is_monitoring &&
  2019. - !rt2x00dev->intf_ap_count);
  2020. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_VERSION_ERROR, 1);
  2021. - rt2x00_set_field32(&reg, TXRX_CSR0_DROP_MULTICAST,
  2022. diff --git a/package/kernel/mac80211/patches/304-ath10k-Ensure-peer_map-references-are-cleaned-up.patch b/package/kernel/mac80211/patches/304-ath10k-Ensure-peer_map-references-are-cleaned-up.patch
  2023. new file mode 100644
  2024. index 0000000..7dec1fb
  2025. --- /dev/null
  2026. +++ b/package/kernel/mac80211/patches/304-ath10k-Ensure-peer_map-references-are-cleaned-up.patch
  2027. @@ -0,0 +1,60 @@
  2028. +From: Ben Greear <greearb@candelatech.com>
  2029. +Date: Fri, 1 Apr 2016 14:12:09 -0700
  2030. +Subject: [PATCH] ath10k: Ensure peer_map references are cleaned up.
  2031. +
  2032. +While debugging OS crashes due to firmware crashes, I enabled
  2033. +kasan, and it noticed that peer objects were being used-after-freed.
  2034. +
  2035. +Looks like there are two places we could be leaving stale references
  2036. +in the peer-map, so clean that up.
  2037. +
  2038. +Signed-off-by: Ben Greear <greearb@candelatech.com>
  2039. +---
  2040. +
  2041. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  2042. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  2043. +@@ -802,6 +802,7 @@ static void ath10k_peer_cleanup(struct a
  2044. + {
  2045. + struct ath10k_peer *peer, *tmp;
  2046. + int peer_id;
  2047. ++ int i;
  2048. +
  2049. + lockdep_assert_held(&ar->conf_mutex);
  2050. +
  2051. +@@ -818,6 +819,17 @@ static void ath10k_peer_cleanup(struct a
  2052. + ar->peer_map[peer_id] = NULL;
  2053. + }
  2054. +
  2055. ++ /* Double check that peer is properly un-referenced from
  2056. ++ * the peer_map
  2057. ++ */
  2058. ++ for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) {
  2059. ++ if (ar->peer_map[i] == peer) {
  2060. ++ ath10k_warn(ar, "removing stale peer_map entry for %pM (ptr %p idx %d)\n",
  2061. ++ peer->addr, peer, i);
  2062. ++ ar->peer_map[i] = NULL;
  2063. ++ }
  2064. ++ }
  2065. ++
  2066. + list_del(&peer->list);
  2067. + kfree(peer);
  2068. + ar->num_peers--;
  2069. +@@ -828,6 +840,7 @@ static void ath10k_peer_cleanup(struct a
  2070. + static void ath10k_peer_cleanup_all(struct ath10k *ar)
  2071. + {
  2072. + struct ath10k_peer *peer, *tmp;
  2073. ++ int i;
  2074. +
  2075. + lockdep_assert_held(&ar->conf_mutex);
  2076. +
  2077. +@@ -836,6 +849,10 @@ static void ath10k_peer_cleanup_all(stru
  2078. + list_del(&peer->list);
  2079. + kfree(peer);
  2080. + }
  2081. ++
  2082. ++ for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++)
  2083. ++ ar->peer_map[i] = NULL;
  2084. ++
  2085. + spin_unlock_bh(&ar->data_lock);
  2086. +
  2087. + ar->num_peers = 0;
  2088. 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
  2089. deleted file mode 100644
  2090. index 049059a..0000000
  2091. --- a/package/kernel/mac80211/patches/304-ath9k-avoid-ANI-restart-if-no-trigger.patch
  2092. +++ /dev/null
  2093. @@ -1,32 +0,0 @@
  2094. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  2095. -Date: Fri, 15 Jan 2016 18:17:17 +0800
  2096. -Subject: [PATCH] ath9k: avoid ANI restart if no trigger
  2097. -
  2098. -Fixes commit 54da20d83f0e ("ath9k_hw: improve ANI processing and rx desensitizing parameters")
  2099. -
  2100. -Call ath9k_ani_restart() only when the phy error rate reach the
  2101. -ANI immunity threshold. Sync the logic with internal code base.
  2102. -
  2103. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  2104. ----
  2105. -
  2106. ---- a/drivers/net/wireless/ath/ath9k/ani.c
  2107. -+++ b/drivers/net/wireless/ath/ath9k/ani.c
  2108. -@@ -444,14 +444,16 @@ void ath9k_hw_ani_monitor(struct ath_hw
  2109. - ofdmPhyErrRate < ah->config.ofdm_trig_low) {
  2110. - ath9k_hw_ani_lower_immunity(ah);
  2111. - aniState->ofdmsTurn = !aniState->ofdmsTurn;
  2112. -+ ath9k_ani_restart(ah);
  2113. - } else if (ofdmPhyErrRate > ah->config.ofdm_trig_high) {
  2114. - ath9k_hw_ani_ofdm_err_trigger(ah);
  2115. - aniState->ofdmsTurn = false;
  2116. -+ ath9k_ani_restart(ah);
  2117. - } else if (cckPhyErrRate > ah->config.cck_trig_high) {
  2118. - ath9k_hw_ani_cck_err_trigger(ah);
  2119. - aniState->ofdmsTurn = true;
  2120. -+ ath9k_ani_restart(ah);
  2121. - }
  2122. -- ath9k_ani_restart(ah);
  2123. - }
  2124. - }
  2125. - EXPORT_SYMBOL(ath9k_hw_ani_monitor);
  2126. diff --git a/package/kernel/mac80211/patches/305-ath10k-Clean-up-peer-when-sta-goes-away.patch b/package/kernel/mac80211/patches/305-ath10k-Clean-up-peer-when-sta-goes-away.patch
  2127. new file mode 100644
  2128. index 0000000..7248a8c
  2129. --- /dev/null
  2130. +++ b/package/kernel/mac80211/patches/305-ath10k-Clean-up-peer-when-sta-goes-away.patch
  2131. @@ -0,0 +1,32 @@
  2132. +From: Ben Greear <greearb@candelatech.com>
  2133. +Date: Fri, 1 Apr 2016 14:12:11 -0700
  2134. +Subject: [PATCH] ath10k: Clean up peer when sta goes away.
  2135. +
  2136. +If WMI and/or firmware has issues removing the peer object,
  2137. +then we still need to clean up the peer object in the driver.
  2138. +
  2139. +Signed-off-by: Ben Greear <greearb@candelatech.com>
  2140. +---
  2141. +
  2142. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  2143. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  2144. +@@ -5992,9 +5992,17 @@ static int ath10k_sta_state(struct ieee8
  2145. + continue;
  2146. +
  2147. + if (peer->sta == sta) {
  2148. +- ath10k_warn(ar, "found sta peer %pM entry on vdev %i after it was supposedly removed\n",
  2149. +- sta->addr, arvif->vdev_id);
  2150. ++ ath10k_warn(ar, "found sta peer %pM (ptr %p id %d) entry on vdev %i after it was supposedly removed\n",
  2151. ++ sta->addr, peer, i, arvif->vdev_id);
  2152. + peer->sta = NULL;
  2153. ++
  2154. ++ /* Clean up the peer object as well since we
  2155. ++ * must have failed to do this above.
  2156. ++ */
  2157. ++ list_del(&peer->list);
  2158. ++ ar->peer_map[i] = NULL;
  2159. ++ kfree(peer);
  2160. ++ ar->num_peers--;
  2161. + }
  2162. + }
  2163. + spin_unlock_bh(&ar->data_lock);
  2164. 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
  2165. deleted file mode 100644
  2166. index a1ac67c..0000000
  2167. --- a/package/kernel/mac80211/patches/305-ath9k-clean-up-ANI-per-channel-pointer-checking.patch
  2168. +++ /dev/null
  2169. @@ -1,91 +0,0 @@
  2170. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  2171. -Date: Fri, 15 Jan 2016 18:17:18 +0800
  2172. -Subject: [PATCH] ath9k: clean up ANI per-channel pointer checking
  2173. -
  2174. -commit c24bd3620c50 ("ath9k: Do not maintain ANI state per-channel")
  2175. -removed per-channel handling, the code to check 'curchan' also
  2176. -should be removed as never used.
  2177. -
  2178. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  2179. ----
  2180. -
  2181. ---- a/drivers/net/wireless/ath/ath9k/ani.c
  2182. -+++ b/drivers/net/wireless/ath/ath9k/ani.c
  2183. -@@ -126,12 +126,8 @@ static void ath9k_hw_update_mibstats(str
  2184. -
  2185. - static void ath9k_ani_restart(struct ath_hw *ah)
  2186. - {
  2187. -- struct ar5416AniState *aniState;
  2188. --
  2189. -- if (!ah->curchan)
  2190. -- return;
  2191. -+ struct ar5416AniState *aniState = &ah->ani;
  2192. -
  2193. -- aniState = &ah->ani;
  2194. - aniState->listenTime = 0;
  2195. -
  2196. - ENABLE_REGWRITE_BUFFER(ah);
  2197. -@@ -221,12 +217,7 @@ static void ath9k_hw_set_ofdm_nil(struct
  2198. -
  2199. - static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah)
  2200. - {
  2201. -- struct ar5416AniState *aniState;
  2202. --
  2203. -- if (!ah->curchan)
  2204. -- return;
  2205. --
  2206. -- aniState = &ah->ani;
  2207. -+ struct ar5416AniState *aniState = &ah->ani;
  2208. -
  2209. - if (aniState->ofdmNoiseImmunityLevel < ATH9K_ANI_OFDM_MAX_LEVEL)
  2210. - ath9k_hw_set_ofdm_nil(ah, aniState->ofdmNoiseImmunityLevel + 1, false);
  2211. -@@ -281,12 +272,7 @@ static void ath9k_hw_set_cck_nil(struct
  2212. -
  2213. - static void ath9k_hw_ani_cck_err_trigger(struct ath_hw *ah)
  2214. - {
  2215. -- struct ar5416AniState *aniState;
  2216. --
  2217. -- if (!ah->curchan)
  2218. -- return;
  2219. --
  2220. -- aniState = &ah->ani;
  2221. -+ struct ar5416AniState *aniState = &ah->ani;
  2222. -
  2223. - if (aniState->cckNoiseImmunityLevel < ATH9K_ANI_CCK_MAX_LEVEL)
  2224. - ath9k_hw_set_cck_nil(ah, aniState->cckNoiseImmunityLevel + 1,
  2225. -@@ -299,9 +285,7 @@ static void ath9k_hw_ani_cck_err_trigger
  2226. - */
  2227. - static void ath9k_hw_ani_lower_immunity(struct ath_hw *ah)
  2228. - {
  2229. -- struct ar5416AniState *aniState;
  2230. --
  2231. -- aniState = &ah->ani;
  2232. -+ struct ar5416AniState *aniState = &ah->ani;
  2233. -
  2234. - /* lower OFDM noise immunity */
  2235. - if (aniState->ofdmNoiseImmunityLevel > 0 &&
  2236. -@@ -329,7 +313,7 @@ void ath9k_ani_reset(struct ath_hw *ah,
  2237. - struct ath_common *common = ath9k_hw_common(ah);
  2238. - int ofdm_nil, cck_nil;
  2239. -
  2240. -- if (!ah->curchan)
  2241. -+ if (!chan)
  2242. - return;
  2243. -
  2244. - BUG_ON(aniState == NULL);
  2245. -@@ -416,14 +400,10 @@ static bool ath9k_hw_ani_read_counters(s
  2246. -
  2247. - void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan)
  2248. - {
  2249. -- struct ar5416AniState *aniState;
  2250. -+ struct ar5416AniState *aniState = &ah->ani;
  2251. - struct ath_common *common = ath9k_hw_common(ah);
  2252. - u32 ofdmPhyErrRate, cckPhyErrRate;
  2253. -
  2254. -- if (!ah->curchan)
  2255. -- return;
  2256. --
  2257. -- aniState = &ah->ani;
  2258. - if (!ath9k_hw_ani_read_counters(ah))
  2259. - return;
  2260. -
  2261. 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
  2262. deleted file mode 100644
  2263. index cf8194a..0000000
  2264. --- a/package/kernel/mac80211/patches/306-ath9k-do-not-reset-while-BB-panic-0x4000409-on-ar956.patch
  2265. +++ /dev/null
  2266. @@ -1,31 +0,0 @@
  2267. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  2268. -Date: Fri, 15 Jan 2016 18:17:19 +0800
  2269. -Subject: [PATCH] ath9k: do not reset while BB panic(0x4000409) on ar9561
  2270. -
  2271. -BB panic(0x4000409) observed while AP enabling/disabling
  2272. -bursting.
  2273. -
  2274. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  2275. ----
  2276. -
  2277. ---- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  2278. -+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  2279. -@@ -2071,7 +2071,8 @@ void ar9003_hw_attach_phy_ops(struct ath
  2280. - * to be disabled.
  2281. - *
  2282. - * 0x04000409: Packet stuck on receive.
  2283. -- * Full chip reset is required for all chips except AR9340.
  2284. -+ * Full chip reset is required for all chips except
  2285. -+ * AR9340, AR9531 and AR9561.
  2286. - */
  2287. -
  2288. - /*
  2289. -@@ -2100,7 +2101,7 @@ bool ar9003_hw_bb_watchdog_check(struct
  2290. - case 0x04000b09:
  2291. - return true;
  2292. - case 0x04000409:
  2293. -- if (AR_SREV_9340(ah) || AR_SREV_9531(ah))
  2294. -+ if (AR_SREV_9340(ah) || AR_SREV_9531(ah) || AR_SREV_9561(ah))
  2295. - return false;
  2296. - else
  2297. - return true;
  2298. diff --git a/package/kernel/mac80211/patches/306-mac80211-add-hdrlen-to-ieee80211_tx_data.patch b/package/kernel/mac80211/patches/306-mac80211-add-hdrlen-to-ieee80211_tx_data.patch
  2299. new file mode 100644
  2300. index 0000000..4a8f143
  2301. --- /dev/null
  2302. +++ b/package/kernel/mac80211/patches/306-mac80211-add-hdrlen-to-ieee80211_tx_data.patch
  2303. @@ -0,0 +1,203 @@
  2304. +From: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  2305. +Date: Fri, 19 Feb 2016 11:01:49 +0100
  2306. +Subject: [PATCH] mac80211: add hdrlen to ieee80211_tx_data
  2307. +
  2308. +Add hdrlen to ieee80211_tx_data and use this
  2309. +when wep/ccmd/tkip. This is preparation for
  2310. +aligned4 code.
  2311. +
  2312. +Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  2313. +---
  2314. +
  2315. +--- a/net/mac80211/ieee80211_i.h
  2316. ++++ b/net/mac80211/ieee80211_i.h
  2317. +@@ -173,6 +173,7 @@ struct ieee80211_tx_data {
  2318. + struct ieee80211_tx_rate rate;
  2319. +
  2320. + unsigned int flags;
  2321. ++ unsigned int hdrlen;
  2322. + };
  2323. +
  2324. +
  2325. +--- a/net/mac80211/tx.c
  2326. ++++ b/net/mac80211/tx.c
  2327. +@@ -922,7 +922,7 @@ ieee80211_tx_h_fragment(struct ieee80211
  2328. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2329. + struct ieee80211_hdr *hdr = (void *)skb->data;
  2330. + int frag_threshold = tx->local->hw.wiphy->frag_threshold;
  2331. +- int hdrlen;
  2332. ++ int hdrlen = tx->hdrlen;
  2333. + int fragnum;
  2334. +
  2335. + /* no matter what happens, tx->skb moves to tx->skbs */
  2336. +@@ -943,8 +943,6 @@ ieee80211_tx_h_fragment(struct ieee80211
  2337. + if (WARN_ON(info->flags & IEEE80211_TX_CTL_AMPDU))
  2338. + return TX_DROP;
  2339. +
  2340. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2341. +-
  2342. + /* internal error, why isn't DONTFRAG set? */
  2343. + if (WARN_ON(skb->len + FCS_LEN <= frag_threshold))
  2344. + return TX_DROP;
  2345. +@@ -1176,6 +1174,8 @@ ieee80211_tx_prepare(struct ieee80211_su
  2346. +
  2347. + hdr = (struct ieee80211_hdr *) skb->data;
  2348. +
  2349. ++ tx->hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2350. ++
  2351. + if (likely(sta)) {
  2352. + if (!IS_ERR(sta))
  2353. + tx->sta = sta;
  2354. +--- a/net/mac80211/util.c
  2355. ++++ b/net/mac80211/util.c
  2356. +@@ -1226,6 +1226,7 @@ void ieee80211_send_auth(struct ieee8021
  2357. + struct ieee80211_local *local = sdata->local;
  2358. + struct sk_buff *skb;
  2359. + struct ieee80211_mgmt *mgmt;
  2360. ++ unsigned int hdrlen;
  2361. + int err;
  2362. +
  2363. + /* 24 + 6 = header + auth_algo + auth_transaction + status_code */
  2364. +@@ -1250,8 +1251,10 @@ void ieee80211_send_auth(struct ieee8021
  2365. + memcpy(skb_put(skb, extra_len), extra, extra_len);
  2366. +
  2367. + if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) {
  2368. ++ hdrlen = ieee80211_hdrlen(mgmt->frame_control);
  2369. + mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
  2370. +- err = ieee80211_wep_encrypt(local, skb, key, key_len, key_idx);
  2371. ++ err = ieee80211_wep_encrypt(local, skb, hdrlen, key,
  2372. ++ key_len, key_idx);
  2373. + WARN_ON(err);
  2374. + }
  2375. +
  2376. +--- a/net/mac80211/wep.c
  2377. ++++ b/net/mac80211/wep.c
  2378. +@@ -89,11 +89,11 @@ static void ieee80211_wep_get_iv(struct
  2379. +
  2380. + static u8 *ieee80211_wep_add_iv(struct ieee80211_local *local,
  2381. + struct sk_buff *skb,
  2382. ++ unsigned int hdrlen,
  2383. + int keylen, int keyidx)
  2384. + {
  2385. + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  2386. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2387. +- unsigned int hdrlen;
  2388. + u8 *newhdr;
  2389. +
  2390. + hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
  2391. +@@ -101,7 +101,6 @@ static u8 *ieee80211_wep_add_iv(struct i
  2392. + if (WARN_ON(skb_headroom(skb) < IEEE80211_WEP_IV_LEN))
  2393. + return NULL;
  2394. +
  2395. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2396. + newhdr = skb_push(skb, IEEE80211_WEP_IV_LEN);
  2397. + memmove(newhdr, newhdr + IEEE80211_WEP_IV_LEN, hdrlen);
  2398. +
  2399. +@@ -160,6 +159,7 @@ int ieee80211_wep_encrypt_data(struct cr
  2400. + */
  2401. + int ieee80211_wep_encrypt(struct ieee80211_local *local,
  2402. + struct sk_buff *skb,
  2403. ++ unsigned int hdrlen,
  2404. + const u8 *key, int keylen, int keyidx)
  2405. + {
  2406. + u8 *iv;
  2407. +@@ -169,7 +169,7 @@ int ieee80211_wep_encrypt(struct ieee802
  2408. + if (WARN_ON(skb_tailroom(skb) < IEEE80211_WEP_ICV_LEN))
  2409. + return -1;
  2410. +
  2411. +- iv = ieee80211_wep_add_iv(local, skb, keylen, keyidx);
  2412. ++ iv = ieee80211_wep_add_iv(local, skb, hdrlen, keylen, keyidx);
  2413. + if (!iv)
  2414. + return -1;
  2415. +
  2416. +@@ -306,13 +306,14 @@ static int wep_encrypt_skb(struct ieee80
  2417. + struct ieee80211_key_conf *hw_key = info->control.hw_key;
  2418. +
  2419. + if (!hw_key) {
  2420. +- if (ieee80211_wep_encrypt(tx->local, skb, tx->key->conf.key,
  2421. ++ if (ieee80211_wep_encrypt(tx->local, skb, tx->hdrlen,
  2422. ++ tx->key->conf.key,
  2423. + tx->key->conf.keylen,
  2424. + tx->key->conf.keyidx))
  2425. + return -1;
  2426. + } else if ((hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) ||
  2427. + (hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE)) {
  2428. +- if (!ieee80211_wep_add_iv(tx->local, skb,
  2429. ++ if (!ieee80211_wep_add_iv(tx->local, skb, tx->hdrlen,
  2430. + tx->key->conf.keylen,
  2431. + tx->key->conf.keyidx))
  2432. + return -1;
  2433. +--- a/net/mac80211/wep.h
  2434. ++++ b/net/mac80211/wep.h
  2435. +@@ -22,6 +22,7 @@ int ieee80211_wep_encrypt_data(struct cr
  2436. + size_t klen, u8 *data, size_t data_len);
  2437. + int ieee80211_wep_encrypt(struct ieee80211_local *local,
  2438. + struct sk_buff *skb,
  2439. ++ unsigned int hdrlen,
  2440. + const u8 *key, int keylen, int keyidx);
  2441. + int ieee80211_wep_decrypt_data(struct crypto_cipher *tfm, u8 *rc4key,
  2442. + size_t klen, u8 *data, size_t data_len);
  2443. +--- a/net/mac80211/wpa.c
  2444. ++++ b/net/mac80211/wpa.c
  2445. +@@ -43,7 +43,7 @@ ieee80211_tx_h_michael_mic_add(struct ie
  2446. + skb->len < 24 || !ieee80211_is_data_present(hdr->frame_control))
  2447. + return TX_CONTINUE;
  2448. +
  2449. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2450. ++ hdrlen = tx->hdrlen;
  2451. + if (skb->len < hdrlen)
  2452. + return TX_DROP;
  2453. +
  2454. +@@ -186,7 +186,6 @@ mic_fail_no_key:
  2455. +
  2456. + static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
  2457. + {
  2458. +- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  2459. + struct ieee80211_key *key = tx->key;
  2460. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2461. + unsigned int hdrlen;
  2462. +@@ -201,7 +200,7 @@ static int tkip_encrypt_skb(struct ieee8
  2463. + return 0;
  2464. + }
  2465. +
  2466. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2467. ++ hdrlen = tx->hdrlen;
  2468. + len = skb->len - hdrlen;
  2469. +
  2470. + if (info->control.hw_key)
  2471. +@@ -418,7 +417,7 @@ static int ccmp_encrypt_skb(struct ieee8
  2472. + return 0;
  2473. + }
  2474. +
  2475. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2476. ++ hdrlen = tx->hdrlen;
  2477. + len = skb->len - hdrlen;
  2478. +
  2479. + if (info->control.hw_key)
  2480. +@@ -651,7 +650,7 @@ static int gcmp_encrypt_skb(struct ieee8
  2481. + return 0;
  2482. + }
  2483. +
  2484. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2485. ++ hdrlen = tx->hdrlen;
  2486. + len = skb->len - hdrlen;
  2487. +
  2488. + if (info->control.hw_key)
  2489. +@@ -791,7 +790,6 @@ static ieee80211_tx_result
  2490. + ieee80211_crypto_cs_encrypt(struct ieee80211_tx_data *tx,
  2491. + struct sk_buff *skb)
  2492. + {
  2493. +- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  2494. + struct ieee80211_key *key = tx->key;
  2495. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2496. + int hdrlen;
  2497. +@@ -807,8 +805,7 @@ ieee80211_crypto_cs_encrypt(struct ieee8
  2498. + pskb_expand_head(skb, iv_len, 0, GFP_ATOMIC)))
  2499. + return TX_DROP;
  2500. +
  2501. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2502. +-
  2503. ++ hdrlen = tx->hdrlen;
  2504. + pos = skb_push(skb, iv_len);
  2505. + memmove(pos, pos + iv_len, hdrlen);
  2506. +
  2507. 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
  2508. deleted file mode 100644
  2509. index 80b781c..0000000
  2510. --- a/package/kernel/mac80211/patches/307-ath9k-fix-inconsistent-use-of-tab-and-space-in-inden.patch
  2511. +++ /dev/null
  2512. @@ -1,27 +0,0 @@
  2513. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  2514. -Date: Fri, 15 Jan 2016 18:17:20 +0800
  2515. -Subject: [PATCH] ath9k: fix inconsistent use of tab and space in
  2516. - indentation
  2517. -
  2518. -Minor changes for indenting.
  2519. -
  2520. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  2521. ----
  2522. -
  2523. ---- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  2524. -+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  2525. -@@ -5485,11 +5485,11 @@ unsigned int ar9003_get_paprd_scale_fact
  2526. - AR9300_PAPRD_SCALE_1);
  2527. - else {
  2528. - if (chan->channel >= 5700)
  2529. -- return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20),
  2530. -- AR9300_PAPRD_SCALE_1);
  2531. -+ return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20),
  2532. -+ AR9300_PAPRD_SCALE_1);
  2533. - else if (chan->channel >= 5400)
  2534. - return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt40),
  2535. -- AR9300_PAPRD_SCALE_2);
  2536. -+ AR9300_PAPRD_SCALE_2);
  2537. - else
  2538. - return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt40),
  2539. - AR9300_PAPRD_SCALE_1);
  2540. diff --git a/package/kernel/mac80211/patches/307-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch b/package/kernel/mac80211/patches/307-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch
  2541. new file mode 100644
  2542. index 0000000..eeb881e
  2543. --- /dev/null
  2544. +++ b/package/kernel/mac80211/patches/307-mac80211-add-NEED_ALIGNED4_SKBS-hw-flag.patch
  2545. @@ -0,0 +1,235 @@
  2546. +From: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  2547. +Date: Fri, 19 Feb 2016 11:01:50 +0100
  2548. +Subject: [PATCH] mac80211: add NEED_ALIGNED4_SKBS hw flag
  2549. +
  2550. +HW/driver should set NEED_ALIGNED4_SKBS flag in case
  2551. +require aligned skbs to four-byte boundaries.
  2552. +This affect only TX direction.
  2553. +
  2554. +Padding is added after ieee80211_hdr, before IV/LLC.
  2555. +
  2556. +Before we have to do memmove(hdrlen) twice in the
  2557. +dirver. Once before we pass this to HW and next
  2558. +in tx completion (to be sure monitor will report
  2559. +this tx frame correctly).
  2560. +
  2561. +With this patch we can skip this memmove() and save CPU.
  2562. +
  2563. +Currently this was tested with ath9k, both hw/sw crypt for
  2564. +wep/tkip/ccmp.
  2565. +
  2566. +Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
  2567. +---
  2568. +
  2569. +--- a/include/net/mac80211.h
  2570. ++++ b/include/net/mac80211.h
  2571. +@@ -2014,6 +2014,9 @@ struct ieee80211_txq {
  2572. + * @IEEE80211_HW_TX_FRAG_LIST: Hardware (or driver) supports sending frag_list
  2573. + * skbs, needed for zero-copy software A-MSDU.
  2574. + *
  2575. ++ * @IEEE80211_HW_NEEDS_ALIGNED4_SKBS: Driver need aligned skbs to four-byte.
  2576. ++ * Padding will be added after ieee80211_hdr, before IV/LLC.
  2577. ++ *
  2578. + * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
  2579. + */
  2580. + enum ieee80211_hw_flags {
  2581. +@@ -2054,6 +2057,7 @@ enum ieee80211_hw_flags {
  2582. + IEEE80211_HW_USES_RSS,
  2583. + IEEE80211_HW_TX_AMSDU,
  2584. + IEEE80211_HW_TX_FRAG_LIST,
  2585. ++ IEEE80211_HW_NEEDS_ALIGNED4_SKBS,
  2586. +
  2587. + /* keep last, obviously */
  2588. + NUM_IEEE80211_HW_FLAGS
  2589. +--- a/net/mac80211/debugfs.c
  2590. ++++ b/net/mac80211/debugfs.c
  2591. +@@ -302,6 +302,7 @@ static const char *hw_flag_names[] = {
  2592. + FLAG(USES_RSS),
  2593. + FLAG(TX_AMSDU),
  2594. + FLAG(TX_FRAG_LIST),
  2595. ++ FLAG(NEEDS_ALIGNED4_SKBS),
  2596. + #undef FLAG
  2597. + };
  2598. +
  2599. +--- a/net/mac80211/ieee80211_i.h
  2600. ++++ b/net/mac80211/ieee80211_i.h
  2601. +@@ -1497,6 +1497,29 @@ ieee80211_have_rx_timestamp(struct ieee8
  2602. + return false;
  2603. + }
  2604. +
  2605. ++static inline unsigned int
  2606. ++ieee80211_hdr_padsize(struct ieee80211_hw *hw, unsigned int hdrlen)
  2607. ++{
  2608. ++ /*
  2609. ++ * While hdrlen is already aligned to two-byte boundaries,
  2610. ++ * simple check with & 2 will return correct padsize.
  2611. ++ */
  2612. ++ if (ieee80211_hw_check(hw, NEEDS_ALIGNED4_SKBS))
  2613. ++ return hdrlen & 2;
  2614. ++ return 0;
  2615. ++}
  2616. ++
  2617. ++static inline unsigned int
  2618. ++ieee80211_padded_hdrlen(struct ieee80211_hw *hw, __le16 fc)
  2619. ++{
  2620. ++ unsigned int hdrlen;
  2621. ++
  2622. ++ hdrlen = ieee80211_hdrlen(fc);
  2623. ++ hdrlen += ieee80211_hdr_padsize(hw, hdrlen);
  2624. ++
  2625. ++ return hdrlen;
  2626. ++}
  2627. ++
  2628. + u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local,
  2629. + struct ieee80211_rx_status *status,
  2630. + unsigned int mpdu_len,
  2631. +--- a/net/mac80211/sta_info.h
  2632. ++++ b/net/mac80211/sta_info.h
  2633. +@@ -279,7 +279,7 @@ struct ieee80211_fast_tx {
  2634. + u8 hdr_len;
  2635. + u8 sa_offs, da_offs, pn_offs;
  2636. + u8 band;
  2637. +- u8 hdr[30 + 2 + IEEE80211_FAST_XMIT_MAX_IV +
  2638. ++ u8 hdr[30 + 2 + 2 + IEEE80211_FAST_XMIT_MAX_IV +
  2639. + sizeof(rfc1042_header)] __aligned(2);
  2640. +
  2641. + struct rcu_head rcu_head;
  2642. +--- a/net/mac80211/status.c
  2643. ++++ b/net/mac80211/status.c
  2644. +@@ -683,9 +683,22 @@ void ieee80211_tx_monitor(struct ieee802
  2645. + struct sk_buff *skb2;
  2646. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  2647. + struct ieee80211_sub_if_data *sdata;
  2648. ++ struct ieee80211_hdr *hdr = (void *)skb->data;
  2649. + struct net_device *prev_dev = NULL;
  2650. ++ unsigned int hdrlen, padsize;
  2651. + int rtap_len;
  2652. +
  2653. ++ /* Remove padding if was added */
  2654. ++ if (ieee80211_hw_check(&local->hw, NEEDS_ALIGNED4_SKBS)) {
  2655. ++ hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2656. ++ padsize = ieee80211_hdr_padsize(&local->hw, hdrlen);
  2657. ++
  2658. ++ if (padsize && skb->len > hdrlen + padsize) {
  2659. ++ memmove(skb->data + padsize, skb->data, hdrlen);
  2660. ++ skb_pull(skb, padsize);
  2661. ++ }
  2662. ++ }
  2663. ++
  2664. + /* send frame to monitor interfaces now */
  2665. + rtap_len = ieee80211_tx_radiotap_len(info);
  2666. + if (WARN_ON_ONCE(skb_headroom(skb) < rtap_len)) {
  2667. +--- a/net/mac80211/tkip.c
  2668. ++++ b/net/mac80211/tkip.c
  2669. +@@ -201,10 +201,12 @@ void ieee80211_get_tkip_p2k(struct ieee8
  2670. + {
  2671. + struct ieee80211_key *key = (struct ieee80211_key *)
  2672. + container_of(keyconf, struct ieee80211_key, conf);
  2673. ++ struct ieee80211_hw *hw = &key->local->hw;
  2674. + const u8 *tk = &key->conf.key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY];
  2675. + struct tkip_ctx *ctx = &key->u.tkip.tx;
  2676. + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
  2677. +- const u8 *data = (u8 *)hdr + ieee80211_hdrlen(hdr->frame_control);
  2678. ++ const u8 *data = (u8 *)hdr + ieee80211_padded_hdrlen(hw,
  2679. ++ hdr->frame_control);
  2680. + u32 iv32 = get_unaligned_le32(&data[4]);
  2681. + u16 iv16 = data[2] | (data[0] << 8);
  2682. +
  2683. +--- a/net/mac80211/tx.c
  2684. ++++ b/net/mac80211/tx.c
  2685. +@@ -1173,8 +1173,7 @@ ieee80211_tx_prepare(struct ieee80211_su
  2686. + info->flags &= ~IEEE80211_TX_INTFL_NEED_TXPROCESSING;
  2687. +
  2688. + hdr = (struct ieee80211_hdr *) skb->data;
  2689. +-
  2690. +- tx->hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2691. ++ tx->hdrlen = ieee80211_padded_hdrlen(&local->hw, hdr->frame_control);
  2692. +
  2693. + if (likely(sta)) {
  2694. + if (!IS_ERR(sta))
  2695. +@@ -2108,7 +2107,7 @@ netdev_tx_t ieee80211_monitor_start_xmit
  2696. + goto fail;
  2697. +
  2698. + hdr = (struct ieee80211_hdr *)(skb->data + len_rthdr);
  2699. +- hdrlen = ieee80211_hdrlen(hdr->frame_control);
  2700. ++ hdrlen = ieee80211_padded_hdrlen(&local->hw, hdr->frame_control);
  2701. +
  2702. + if (skb->len < len_rthdr + hdrlen)
  2703. + goto fail;
  2704. +@@ -2334,7 +2333,7 @@ static struct sk_buff *ieee80211_build_h
  2705. + struct ieee80211_chanctx_conf *chanctx_conf;
  2706. + struct ieee80211_sub_if_data *ap_sdata;
  2707. + enum nl80211_band band;
  2708. +- int ret;
  2709. ++ int padsize, ret;
  2710. +
  2711. + if (IS_ERR(sta))
  2712. + sta = NULL;
  2713. +@@ -2554,6 +2553,9 @@ static struct sk_buff *ieee80211_build_h
  2714. + hdrlen += 2;
  2715. + }
  2716. +
  2717. ++ /* Check aligned4 skb required */
  2718. ++ padsize = ieee80211_hdr_padsize(&sdata->local->hw, hdrlen);
  2719. ++
  2720. + /*
  2721. + * Drop unicast frames to unauthorised stations unless they are
  2722. + * EAPOL frames from the local station.
  2723. +@@ -2640,6 +2642,7 @@ static struct sk_buff *ieee80211_build_h
  2724. + h_pos -= skip_header_bytes;
  2725. +
  2726. + head_need = hdrlen + encaps_len + meshhdrlen - skb_headroom(skb);
  2727. ++ head_need += padsize;
  2728. +
  2729. + /*
  2730. + * So we need to modify the skb header and hence need a copy of
  2731. +@@ -2678,6 +2681,9 @@ static struct sk_buff *ieee80211_build_h
  2732. + }
  2733. + #endif
  2734. +
  2735. ++ if (padsize)
  2736. ++ memset(skb_push(skb, padsize), 0, padsize);
  2737. ++
  2738. + if (ieee80211_is_data_qos(fc)) {
  2739. + __le16 *qos_control;
  2740. +
  2741. +@@ -2691,8 +2697,8 @@ static struct sk_buff *ieee80211_build_h
  2742. + } else
  2743. + memcpy(skb_push(skb, hdrlen), &hdr, hdrlen);
  2744. +
  2745. +- nh_pos += hdrlen;
  2746. +- h_pos += hdrlen;
  2747. ++ nh_pos += hdrlen + padsize;
  2748. ++ h_pos += hdrlen + padsize;
  2749. +
  2750. + /* Update skb pointers to various headers since this modified frame
  2751. + * is going to go through Linux networking code that may potentially
  2752. +@@ -2861,6 +2867,9 @@ void ieee80211_check_fast_xmit(struct st
  2753. + fc |= cpu_to_le16(IEEE80211_STYPE_QOS_DATA);
  2754. + }
  2755. +
  2756. ++ /* Check aligned4 skb required */
  2757. ++ build.hdr_len += ieee80211_hdr_padsize(&local->hw, build.hdr_len);
  2758. ++
  2759. + /* We store the key here so there's no point in using rcu_dereference()
  2760. + * but that's fine because the code that changes the pointers will call
  2761. + * this function after doing so. For a single CPU that would be enough,
  2762. +--- a/net/mac80211/util.c
  2763. ++++ b/net/mac80211/util.c
  2764. +@@ -1224,6 +1224,7 @@ void ieee80211_send_auth(struct ieee8021
  2765. + u32 tx_flags)
  2766. + {
  2767. + struct ieee80211_local *local = sdata->local;
  2768. ++ struct ieee80211_hw *hw = &local->hw;
  2769. + struct sk_buff *skb;
  2770. + struct ieee80211_mgmt *mgmt;
  2771. + unsigned int hdrlen;
  2772. +@@ -1251,7 +1252,7 @@ void ieee80211_send_auth(struct ieee8021
  2773. + memcpy(skb_put(skb, extra_len), extra, extra_len);
  2774. +
  2775. + if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) {
  2776. +- hdrlen = ieee80211_hdrlen(mgmt->frame_control);
  2777. ++ hdrlen = ieee80211_padded_hdrlen(hw, mgmt->frame_control);
  2778. + mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
  2779. + err = ieee80211_wep_encrypt(local, skb, hdrlen, key,
  2780. + key_len, key_idx);
  2781. diff --git a/package/kernel/mac80211/patches/308-ath10k-Fix-sending-NULL-Qos-NULL-data-frames-for-QCA.patch b/package/kernel/mac80211/patches/308-ath10k-Fix-sending-NULL-Qos-NULL-data-frames-for-QCA.patch
  2782. new file mode 100644
  2783. index 0000000..8590aad
  2784. --- /dev/null
  2785. +++ b/package/kernel/mac80211/patches/308-ath10k-Fix-sending-NULL-Qos-NULL-data-frames-for-QCA.patch
  2786. @@ -0,0 +1,72 @@
  2787. +From: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
  2788. +Date: Thu, 23 Jun 2016 22:10:01 +0530
  2789. +Subject: [PATCH] ath10k: Fix sending NULL/ Qos NULL data frames for
  2790. + QCA99X0 and later
  2791. +
  2792. +For chipsets like QCA99X0, IPQ4019 and later we are not getting proper
  2793. +NULL func status (always acked/successs !!) when hostapd does a
  2794. +PROBE_CLIENT via nullfunc frames when the station is powered off
  2795. +abruptly (inactive timer probes client via null func after the inactive
  2796. +time reaches beyond the threshold). Fix this by disabling the workaround
  2797. +(getting the ACK status of NULL func frames by sending via HTT mgmt-tx
  2798. + path) introduced by the change ("ath10k: fix beacon loss handling ")
  2799. +for QCA99X0 and later chipsets. The normal tx path provides the proper
  2800. +ACK status for NULL data frames. As of now disable this workaround for
  2801. +chipsets QCA99X0 and later, once the 10.1 firmware is obselete we can
  2802. +completely get rid of this workaround for all the chipsets
  2803. +
  2804. +Signed-off-by: Tamizh chelvam <c_traja@qti.qualcomm.com>
  2805. +Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
  2806. +---
  2807. +
  2808. +--- a/drivers/net/wireless/ath/ath10k/core.c
  2809. ++++ b/drivers/net/wireless/ath/ath10k/core.c
  2810. +@@ -181,6 +181,7 @@ static const struct ath10k_hw_params ath
  2811. + .board = QCA99X0_HW_2_0_BOARD_DATA_FILE,
  2812. + .board_size = QCA99X0_BOARD_DATA_SZ,
  2813. + .board_ext_size = QCA99X0_BOARD_EXT_DATA_SZ,
  2814. ++ .disable_null_func_workaround = true,
  2815. + },
  2816. + },
  2817. + {
  2818. +@@ -204,6 +205,7 @@ static const struct ath10k_hw_params ath
  2819. + .board = QCA9984_HW_1_0_BOARD_DATA_FILE,
  2820. + .board_size = QCA99X0_BOARD_DATA_SZ,
  2821. + .board_ext_size = QCA99X0_BOARD_EXT_DATA_SZ,
  2822. ++ .disable_null_func_workaround = true,
  2823. + },
  2824. + },
  2825. + {
  2826. +@@ -262,6 +264,7 @@ static const struct ath10k_hw_params ath
  2827. + .board = QCA4019_HW_1_0_BOARD_DATA_FILE,
  2828. + .board_size = QCA4019_BOARD_DATA_SZ,
  2829. + .board_ext_size = QCA4019_BOARD_EXT_DATA_SZ,
  2830. ++ .disable_null_func_workaround = true,
  2831. + },
  2832. + },
  2833. + };
  2834. +--- a/drivers/net/wireless/ath/ath10k/core.h
  2835. ++++ b/drivers/net/wireless/ath/ath10k/core.h
  2836. +@@ -750,6 +750,12 @@ struct ath10k {
  2837. + const char *board;
  2838. + size_t board_size;
  2839. + size_t board_ext_size;
  2840. ++ /* Workaround of sending NULL data frames via
  2841. ++ * HTT mgmt TX and getting the proper ACK status does
  2842. ++ * not works for chipsets QCA99X0 and later, while
  2843. ++ * Tx data path reports the ACK status properly.
  2844. ++ */
  2845. ++ bool disable_null_func_workaround;
  2846. + } fw;
  2847. + } hw_params;
  2848. +
  2849. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  2850. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  2851. +@@ -3253,6 +3253,7 @@ ath10k_mac_tx_h_get_txmode(struct ath10k
  2852. + * mode though because AP don't sleep.
  2853. + */
  2854. + if (ar->htt.target_version_major < 3 &&
  2855. ++ !ar->hw_params.fw.disable_null_func_workaround &&
  2856. + (ieee80211_is_nullfunc(fc) || ieee80211_is_qos_nullfunc(fc)) &&
  2857. + !test_bit(ATH10K_FW_FEATURE_HAS_WMI_MGMT_TX,
  2858. + ar->running_fw->fw_file.fw_features))
  2859. 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
  2860. deleted file mode 100644
  2861. index d408866..0000000
  2862. --- a/package/kernel/mac80211/patches/308-ath9k-fix-data-bus-error-on-ar9300-and-ar9580.patch
  2863. +++ /dev/null
  2864. @@ -1,65 +0,0 @@
  2865. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  2866. -Date: Fri, 15 Jan 2016 18:17:21 +0800
  2867. -Subject: [PATCH] ath9k: fix data bus error on ar9300 and ar9580
  2868. -
  2869. -One crash issue be found on ar9300: RTC_RC reg read leads crash, leading
  2870. -the data bus error, due to RTC_RC reg write not happen properly.
  2871. -
  2872. -Warm Reset trigger in continuous beacon stuck for one of the customer for
  2873. -other chip, noticed the MAC was stuck in RTC reset. After analysis noticed
  2874. -DMA did not complete when RTC was put in reset.
  2875. -
  2876. -So, before resetting the MAC need to make sure there are no pending DMA
  2877. -transactions because this reset does not reset all parts of the chip.
  2878. -
  2879. -The 12th and 11th bit of MAC _DMA_CFG register used to do that.
  2880. - 12 cfg_halt_ack 0x0
  2881. - 0 DMA has not yet halted
  2882. - 1 DMA has halted
  2883. - 11 cfg_halt_req 0x0
  2884. - 0 DMA logic operates normally
  2885. - 1 Request DMA logic to stop so software can reset the MAC
  2886. -
  2887. -The Bit [12] of this register indicates when the halt has taken effect or
  2888. -not. the DMA halt IS NOT recoverable; once software sets bit [11] to
  2889. -request a DMA halt, software must wait for bit [12] to be set and reset
  2890. -the MAC.
  2891. -
  2892. -So, the same thing we implemented for ar9580 chip.
  2893. -
  2894. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  2895. ----
  2896. -
  2897. ---- a/drivers/net/wireless/ath/ath9k/hw.c
  2898. -+++ b/drivers/net/wireless/ath/ath9k/hw.c
  2899. -@@ -1368,6 +1368,16 @@ static bool ath9k_hw_set_reset(struct at
  2900. - if (ath9k_hw_mci_is_enabled(ah))
  2901. - ar9003_mci_check_gpm_offset(ah);
  2902. -
  2903. -+ /* DMA HALT added to resolve ar9300 and ar9580 bus error during
  2904. -+ * RTC_RC reg read
  2905. -+ */
  2906. -+ if (AR_SREV_9300(ah) || AR_SREV_9580(ah)) {
  2907. -+ REG_SET_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  2908. -+ ath9k_hw_wait(ah, AR_CFG, AR_CFG_HALT_ACK, AR_CFG_HALT_ACK,
  2909. -+ 20 * AH_WAIT_TIMEOUT);
  2910. -+ REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  2911. -+ }
  2912. -+
  2913. - REG_WRITE(ah, AR_RTC_RC, rst_flags);
  2914. -
  2915. - REGWRITE_BUFFER_FLUSH(ah);
  2916. ---- a/drivers/net/wireless/ath/ath9k/reg.h
  2917. -+++ b/drivers/net/wireless/ath/ath9k/reg.h
  2918. -@@ -34,8 +34,10 @@
  2919. - #define AR_CFG_SWRG 0x00000010
  2920. - #define AR_CFG_AP_ADHOC_INDICATION 0x00000020
  2921. - #define AR_CFG_PHOK 0x00000100
  2922. --#define AR_CFG_CLK_GATE_DIS 0x00000400
  2923. - #define AR_CFG_EEBS 0x00000200
  2924. -+#define AR_CFG_CLK_GATE_DIS 0x00000400
  2925. -+#define AR_CFG_HALT_REQ 0x00000800
  2926. -+#define AR_CFG_HALT_ACK 0x00001000
  2927. - #define AR_CFG_PCI_MASTER_REQ_Q_THRESH 0x00060000
  2928. - #define AR_CFG_PCI_MASTER_REQ_Q_THRESH_S 17
  2929. -
  2930. 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
  2931. deleted file mode 100644
  2932. index d9511c8..0000000
  2933. --- a/package/kernel/mac80211/patches/309-01-brcmfmac-add-missing-include.patch
  2934. +++ /dev/null
  2935. @@ -1,19 +0,0 @@
  2936. -From: Felix Fietkau <nbd@openwrt.org>
  2937. -Date: Fri, 15 Jan 2016 15:59:45 +0100
  2938. -Subject: [PATCH] brcmfmac: add missing include
  2939. -
  2940. -linux/module.h is required for defining module parameters
  2941. -
  2942. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  2943. ----
  2944. -
  2945. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  2946. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  2947. -@@ -17,6 +17,7 @@
  2948. - #include <linux/kernel.h>
  2949. - #include <linux/string.h>
  2950. - #include <linux/netdevice.h>
  2951. -+#include <linux/module.h>
  2952. - #include <brcmu_wifi.h>
  2953. - #include <brcmu_utils.h>
  2954. - #include "core.h"
  2955. 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
  2956. deleted file mode 100644
  2957. index 711e019..0000000
  2958. --- a/package/kernel/mac80211/patches/309-02-brcmfmac-fix-sdio-sg-table-alloc-crash.patch
  2959. +++ /dev/null
  2960. @@ -1,118 +0,0 @@
  2961. -From: Hante Meuleman <meuleman@broadcom.com>
  2962. -Date: Tue, 19 Jan 2016 12:39:24 +0100
  2963. -Subject: [PATCH] brcmfmac: fix sdio sg table alloc crash
  2964. -
  2965. -With commit 7d34b0560567 ("brcmfmac: Move all module parameters to
  2966. -one place") a bug was introduced causing a null pointer exception.
  2967. -This patch fixes the bug by initializing the sg table till after
  2968. -the settings have been initialized.
  2969. -
  2970. -Fixes: 7d34b0560567 ("brcmfmac: Move all module parameters to one place")
  2971. -Reported-by: Marc Zyngier <marc.zyngier@arm.com>
  2972. -Tested-by: Marc Zyngier <marc.zyngier@arm.com>
  2973. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  2974. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  2975. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  2976. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  2977. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  2978. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  2979. ----
  2980. -
  2981. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  2982. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
  2983. -@@ -879,11 +879,24 @@ int brcmf_sdiod_abort(struct brcmf_sdio_
  2984. - return 0;
  2985. - }
  2986. -
  2987. --static void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev)
  2988. -+void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev)
  2989. - {
  2990. -+ struct sdio_func *func;
  2991. -+ struct mmc_host *host;
  2992. -+ uint max_blocks;
  2993. - uint nents;
  2994. - int err;
  2995. -
  2996. -+ func = sdiodev->func[2];
  2997. -+ host = func->card->host;
  2998. -+ sdiodev->sg_support = host->max_segs > 1;
  2999. -+ max_blocks = min_t(uint, host->max_blk_count, 511u);
  3000. -+ sdiodev->max_request_size = min_t(uint, host->max_req_size,
  3001. -+ max_blocks * func->cur_blksize);
  3002. -+ sdiodev->max_segment_count = min_t(uint, host->max_segs,
  3003. -+ SG_MAX_SINGLE_ALLOC);
  3004. -+ sdiodev->max_segment_size = host->max_seg_size;
  3005. -+
  3006. - if (!sdiodev->sg_support)
  3007. - return;
  3008. -
  3009. -@@ -1021,9 +1034,6 @@ static void brcmf_sdiod_host_fixup(struc
  3010. -
  3011. - static int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev)
  3012. - {
  3013. -- struct sdio_func *func;
  3014. -- struct mmc_host *host;
  3015. -- uint max_blocks;
  3016. - int ret = 0;
  3017. -
  3018. - sdiodev->num_funcs = 2;
  3019. -@@ -1054,26 +1064,6 @@ static int brcmf_sdiod_probe(struct brcm
  3020. - goto out;
  3021. - }
  3022. -
  3023. -- /*
  3024. -- * determine host related variables after brcmf_sdiod_probe()
  3025. -- * as func->cur_blksize is properly set and F2 init has been
  3026. -- * completed successfully.
  3027. -- */
  3028. -- func = sdiodev->func[2];
  3029. -- host = func->card->host;
  3030. -- sdiodev->sg_support = host->max_segs > 1;
  3031. -- max_blocks = min_t(uint, host->max_blk_count, 511u);
  3032. -- sdiodev->max_request_size = min_t(uint, host->max_req_size,
  3033. -- max_blocks * func->cur_blksize);
  3034. -- sdiodev->max_segment_count = min_t(uint, host->max_segs,
  3035. -- SG_MAX_SINGLE_ALLOC);
  3036. -- sdiodev->max_segment_size = host->max_seg_size;
  3037. --
  3038. -- /* allocate scatter-gather table. sg support
  3039. -- * will be disabled upon allocation failure.
  3040. -- */
  3041. -- brcmf_sdiod_sgtable_alloc(sdiodev);
  3042. --
  3043. - ret = brcmf_sdiod_freezer_attach(sdiodev);
  3044. - if (ret)
  3045. - goto out;
  3046. -@@ -1084,7 +1074,7 @@ static int brcmf_sdiod_probe(struct brcm
  3047. - ret = -ENODEV;
  3048. - goto out;
  3049. - }
  3050. -- brcmf_sdiod_host_fixup(host);
  3051. -+ brcmf_sdiod_host_fixup(sdiodev->func[2]->card->host);
  3052. - out:
  3053. - if (ret)
  3054. - brcmf_sdiod_remove(sdiodev);
  3055. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  3056. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  3057. -@@ -4114,6 +4114,11 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
  3058. - goto fail;
  3059. - }
  3060. -
  3061. -+ /* allocate scatter-gather table. sg support
  3062. -+ * will be disabled upon allocation failure.
  3063. -+ */
  3064. -+ brcmf_sdiod_sgtable_alloc(bus->sdiodev);
  3065. -+
  3066. - /* Query the F2 block size, set roundup accordingly */
  3067. - bus->blocksize = bus->sdiodev->func[2]->cur_blksize;
  3068. - bus->roundup = min(max_roundup, bus->blocksize);
  3069. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  3070. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
  3071. -@@ -342,6 +342,7 @@ int brcmf_sdiod_ramrw(struct brcmf_sdio_
  3072. -
  3073. - /* Issue an abort to the specified function */
  3074. - int brcmf_sdiod_abort(struct brcmf_sdio_dev *sdiodev, uint fn);
  3075. -+void brcmf_sdiod_sgtable_alloc(struct brcmf_sdio_dev *sdiodev);
  3076. - void brcmf_sdiod_change_state(struct brcmf_sdio_dev *sdiodev,
  3077. - enum brcmf_sdiod_state state);
  3078. - #ifdef CONFIG_PM_SLEEP
  3079. diff --git a/package/kernel/mac80211/patches/309-cfg80211-fix-proto-in-ieee80211_data_to_8023-for-fra.patch b/package/kernel/mac80211/patches/309-cfg80211-fix-proto-in-ieee80211_data_to_8023-for-fra.patch
  3080. new file mode 100644
  3081. index 0000000..41c27ca
  3082. --- /dev/null
  3083. +++ b/package/kernel/mac80211/patches/309-cfg80211-fix-proto-in-ieee80211_data_to_8023-for-fra.patch
  3084. @@ -0,0 +1,37 @@
  3085. +From: Felix Fietkau <nbd@nbd.name>
  3086. +Date: Wed, 29 Jun 2016 10:02:32 +0200
  3087. +Subject: [PATCH] cfg80211: fix proto in ieee80211_data_to_8023 for frames
  3088. + without LLC header
  3089. +
  3090. +The PDU length of incoming LLC frames is set to the total skb payload size
  3091. +in __ieee80211_data_to_8023() of net/wireless/util.c which incorrectly
  3092. +includes the length of the IEEE 802.11 header.
  3093. +
  3094. +The resulting LLC frame header has a too large PDU length, causing the
  3095. +llc_fixup_skb() function of net/llc/llc_input.c to reject the incoming
  3096. +skb, effectively breaking STP.
  3097. +
  3098. +Solve the problem by properly substracting the IEEE 802.11 frame header size
  3099. +from the PDU length, allowing the LLC processor to pick up the incoming
  3100. +control messages.
  3101. +
  3102. +Special thanks to Gerry Rozema for tracking down the regression and proposing
  3103. +a suitable patch.
  3104. +
  3105. +Fixes: 2d1c304cb2d5 ("cfg80211: add function for 802.3 conversion with separate output buffer")
  3106. +Cc: stable@vger.kernel.org
  3107. +Reported-by: Gerry Rozema <gerryr@rozeware.com>
  3108. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  3109. +---
  3110. +
  3111. +--- a/net/wireless/util.c
  3112. ++++ b/net/wireless/util.c
  3113. +@@ -509,7 +509,7 @@ static int __ieee80211_data_to_8023(stru
  3114. + * replace EtherType */
  3115. + hdrlen += ETH_ALEN + 2;
  3116. + else
  3117. +- tmp.h_proto = htons(skb->len);
  3118. ++ tmp.h_proto = htons(skb->len - hdrlen);
  3119. +
  3120. + pskb_pull(skb, hdrlen);
  3121. +
  3122. 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
  3123. deleted file mode 100644
  3124. index 287d6e1..0000000
  3125. --- a/package/kernel/mac80211/patches/310-ath9k_hw-ignore-eeprom-magic-mismatch-on-flash-based.patch
  3126. +++ /dev/null
  3127. @@ -1,38 +0,0 @@
  3128. -From: Felix Fietkau <nbd@openwrt.org>
  3129. -Date: Thu, 21 Jan 2016 16:28:44 +0100
  3130. -Subject: [PATCH] ath9k_hw: ignore eeprom magic mismatch on flash based devices
  3131. -
  3132. -Many AR913x based devices (maybe others too) do not have a valid EEPROM
  3133. -magic in their calibration data partition.
  3134. -
  3135. -Fixes: 6fa658fd5ab2 ("ath9k: Simplify and fix eeprom endianness swapping")
  3136. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  3137. ----
  3138. -
  3139. ---- a/drivers/net/wireless/ath/ath9k/eeprom.c
  3140. -+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
  3141. -@@ -150,18 +150,18 @@ int ath9k_hw_nvram_swap_data(struct ath_
  3142. - return -EIO;
  3143. - }
  3144. -
  3145. -- if (magic == AR5416_EEPROM_MAGIC) {
  3146. -- *swap_needed = false;
  3147. -- } else if (swab16(magic) == AR5416_EEPROM_MAGIC) {
  3148. -+ *swap_needed = false;
  3149. -+ if (swab16(magic) == AR5416_EEPROM_MAGIC) {
  3150. - if (ah->ah_flags & AH_NO_EEP_SWAP) {
  3151. - ath_info(common,
  3152. - "Ignoring endianness difference in EEPROM magic bytes.\n");
  3153. --
  3154. -- *swap_needed = false;
  3155. - } else {
  3156. - *swap_needed = true;
  3157. - }
  3158. -- } else {
  3159. -+ } else if (magic != AR5416_EEPROM_MAGIC) {
  3160. -+ if (ath9k_hw_use_flash(ah))
  3161. -+ return 0;
  3162. -+
  3163. - ath_err(common,
  3164. - "Invalid EEPROM Magic (0x%04x).\n", magic);
  3165. - return -EINVAL;
  3166. diff --git a/package/kernel/mac80211/patches/310-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch b/package/kernel/mac80211/patches/310-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch
  3167. new file mode 100644
  3168. index 0000000..25929c9
  3169. --- /dev/null
  3170. +++ b/package/kernel/mac80211/patches/310-mac80211-minstrel-Enable-STBC-and-LDPC-for-VHT-Rates.patch
  3171. @@ -0,0 +1,81 @@
  3172. +From: Chaitanya T K <chaitanya.mgit@gmail.com>
  3173. +Date: Mon, 27 Jun 2016 15:23:26 +0530
  3174. +Subject: [PATCH] mac80211: minstrel: Enable STBC and LDPC for VHT Rates
  3175. +
  3176. +If peer support reception of STBC and LDPC, enable them for better
  3177. +performance.
  3178. +
  3179. +Signed-off-by: Chaitanya TK <chaitanya.mgit@gmail.com>
  3180. +---
  3181. +
  3182. +--- a/include/linux/ieee80211.h
  3183. ++++ b/include/linux/ieee80211.h
  3184. +@@ -1550,6 +1550,7 @@ struct ieee80211_vht_operation {
  3185. + #define IEEE80211_VHT_CAP_RXSTBC_3 0x00000300
  3186. + #define IEEE80211_VHT_CAP_RXSTBC_4 0x00000400
  3187. + #define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700
  3188. ++#define IEEE80211_VHT_CAP_RXSTBC_SHIFT 8
  3189. + #define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800
  3190. + #define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000
  3191. + #define IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT 13
  3192. +--- a/net/mac80211/rc80211_minstrel_ht.c
  3193. ++++ b/net/mac80211/rc80211_minstrel_ht.c
  3194. +@@ -1166,13 +1166,14 @@ minstrel_ht_update_caps(void *priv, stru
  3195. + struct minstrel_ht_sta_priv *msp = priv_sta;
  3196. + struct minstrel_ht_sta *mi = &msp->ht;
  3197. + struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs;
  3198. +- u16 sta_cap = sta->ht_cap.cap;
  3199. ++ u16 ht_cap = sta->ht_cap.cap;
  3200. + struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap;
  3201. + int use_vht;
  3202. + int n_supported = 0;
  3203. + int ack_dur;
  3204. + int stbc;
  3205. + int i;
  3206. ++ bool ldpc = false;
  3207. +
  3208. + /* fall back to the old minstrel for legacy stations */
  3209. + if (!sta->ht_cap.ht_supported)
  3210. +@@ -1210,16 +1211,24 @@ minstrel_ht_update_caps(void *priv, stru
  3211. + }
  3212. + mi->sample_tries = 4;
  3213. +
  3214. +- /* TODO tx_flags for vht - ATM the RC API is not fine-grained enough */
  3215. + if (!use_vht) {
  3216. +- stbc = (sta_cap & IEEE80211_HT_CAP_RX_STBC) >>
  3217. ++ stbc = (ht_cap & IEEE80211_HT_CAP_RX_STBC) >>
  3218. + IEEE80211_HT_CAP_RX_STBC_SHIFT;
  3219. +- mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT;
  3220. +
  3221. +- if (sta_cap & IEEE80211_HT_CAP_LDPC_CODING)
  3222. +- mi->tx_flags |= IEEE80211_TX_CTL_LDPC;
  3223. ++ if (ht_cap & IEEE80211_HT_CAP_LDPC_CODING)
  3224. ++ ldpc = true;
  3225. ++ } else {
  3226. ++ stbc = (vht_cap->cap & IEEE80211_VHT_CAP_RXSTBC_MASK) >>
  3227. ++ IEEE80211_VHT_CAP_RXSTBC_SHIFT;
  3228. ++
  3229. ++ if (vht_cap->cap & IEEE80211_VHT_CAP_RXLDPC)
  3230. ++ ldpc = true;
  3231. + }
  3232. +
  3233. ++ mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT;
  3234. ++ if (ldpc)
  3235. ++ mi->tx_flags |= IEEE80211_TX_CTL_LDPC;
  3236. ++
  3237. + for (i = 0; i < ARRAY_SIZE(mi->groups); i++) {
  3238. + u32 gflags = minstrel_mcs_groups[i].flags;
  3239. + int bw, nss;
  3240. +@@ -1232,10 +1241,10 @@ minstrel_ht_update_caps(void *priv, stru
  3241. +
  3242. + if (gflags & IEEE80211_TX_RC_SHORT_GI) {
  3243. + if (gflags & IEEE80211_TX_RC_40_MHZ_WIDTH) {
  3244. +- if (!(sta_cap & IEEE80211_HT_CAP_SGI_40))
  3245. ++ if (!(ht_cap & IEEE80211_HT_CAP_SGI_40))
  3246. + continue;
  3247. + } else {
  3248. +- if (!(sta_cap & IEEE80211_HT_CAP_SGI_20))
  3249. ++ if (!(ht_cap & IEEE80211_HT_CAP_SGI_20))
  3250. + continue;
  3251. + }
  3252. + }
  3253. diff --git a/package/kernel/mac80211/patches/311-ath10k-disable-wake_tx_queue-for-older-devices.patch b/package/kernel/mac80211/patches/311-ath10k-disable-wake_tx_queue-for-older-devices.patch
  3254. new file mode 100644
  3255. index 0000000..4cf26a6
  3256. --- /dev/null
  3257. +++ b/package/kernel/mac80211/patches/311-ath10k-disable-wake_tx_queue-for-older-devices.patch
  3258. @@ -0,0 +1,73 @@
  3259. +From: Michal Kazior <michal.kazior@tieto.com>
  3260. +Date: Tue, 17 May 2016 14:47:01 +0200
  3261. +Subject: [PATCH] ath10k: disable wake_tx_queue for older devices
  3262. +
  3263. +Some setups suffer performance regressions with
  3264. +current wake_tx_queue implementation.
  3265. +
  3266. +Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
  3267. +---
  3268. +
  3269. +--- a/drivers/net/wireless/ath/ath10k/core.h
  3270. ++++ b/drivers/net/wireless/ath/ath10k/core.h
  3271. +@@ -667,6 +667,7 @@ struct ath10k_fw_components {
  3272. + struct ath10k {
  3273. + struct ath_common ath_common;
  3274. + struct ieee80211_hw *hw;
  3275. ++ struct ieee80211_ops *ops;
  3276. + struct device *dev;
  3277. + u8 mac_addr[ETH_ALEN];
  3278. +
  3279. +--- a/drivers/net/wireless/ath/ath10k/mac.c
  3280. ++++ b/drivers/net/wireless/ath/ath10k/mac.c
  3281. +@@ -7497,21 +7497,32 @@ static const struct ieee80211_channel at
  3282. + struct ath10k *ath10k_mac_create(size_t priv_size)
  3283. + {
  3284. + struct ieee80211_hw *hw;
  3285. ++ struct ieee80211_ops *ops;
  3286. + struct ath10k *ar;
  3287. +
  3288. +- hw = ieee80211_alloc_hw(sizeof(struct ath10k) + priv_size, &ath10k_ops);
  3289. +- if (!hw)
  3290. ++ ops = kmemdup(&ath10k_ops, sizeof(ath10k_ops), GFP_KERNEL);
  3291. ++ if (!ops)
  3292. ++ return NULL;
  3293. ++
  3294. ++ hw = ieee80211_alloc_hw(sizeof(struct ath10k) + priv_size, ops);
  3295. ++ if (!hw) {
  3296. ++ kfree(ops);
  3297. + return NULL;
  3298. ++ }
  3299. +
  3300. + ar = hw->priv;
  3301. + ar->hw = hw;
  3302. ++ ar->ops = ops;
  3303. +
  3304. + return ar;
  3305. + }
  3306. +
  3307. + void ath10k_mac_destroy(struct ath10k *ar)
  3308. + {
  3309. ++ struct ieee80211_ops *ops = ar->ops;
  3310. ++
  3311. + ieee80211_free_hw(ar->hw);
  3312. ++ kfree(ops);
  3313. + }
  3314. +
  3315. + static const struct ieee80211_iface_limit ath10k_if_limits[] = {
  3316. +@@ -7945,6 +7956,15 @@ int ath10k_mac_register(struct ath10k *a
  3317. + ath10k_warn(ar, "failed to initialise DFS pattern detector\n");
  3318. + }
  3319. +
  3320. ++ /* Current wake_tx_queue implementation imposes a significant
  3321. ++ * performance penalty in some setups. The tx scheduling code needs
  3322. ++ * more work anyway so disable the wake_tx_queue unless firmware
  3323. ++ * supports the pull-push mechanism.
  3324. ++ */
  3325. ++ if (!test_bit(ATH10K_FW_FEATURE_PEER_FLOW_CONTROL,
  3326. ++ ar->running_fw->fw_file.fw_features))
  3327. ++ ar->ops->wake_tx_queue = NULL;
  3328. ++
  3329. + ret = ath_regd_init(&ar->ath_common.regulatory, ar->hw->wiphy,
  3330. + ath10k_reg_notifier);
  3331. + if (ret) {
  3332. 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
  3333. deleted file mode 100644
  3334. index 070efa9..0000000
  3335. --- a/package/kernel/mac80211/patches/311-ath9k-do-not-limit-the-number-of-DFS-interfaces-to-1.patch
  3336. +++ /dev/null
  3337. @@ -1,55 +0,0 @@
  3338. -From: Felix Fietkau <nbd@openwrt.org>
  3339. -Date: Fri, 22 Jan 2016 01:05:56 +0100
  3340. -Subject: [PATCH] ath9k: do not limit the number of DFS interfaces to 1
  3341. -
  3342. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  3343. ----
  3344. -
  3345. ---- a/drivers/net/wireless/ath/ath9k/init.c
  3346. -+++ b/drivers/net/wireless/ath/ath9k/init.c
  3347. -@@ -751,14 +751,6 @@ static const struct ieee80211_iface_comb
  3348. -
  3349. - #endif /* CPTCFG_ATH9K_CHANNEL_CONTEXT */
  3350. -
  3351. --static const struct ieee80211_iface_limit if_dfs_limits[] = {
  3352. -- { .max = 1, .types = BIT(NL80211_IFTYPE_AP) |
  3353. --#ifdef CPTCFG_MAC80211_MESH
  3354. -- BIT(NL80211_IFTYPE_MESH_POINT) |
  3355. --#endif
  3356. -- BIT(NL80211_IFTYPE_ADHOC) },
  3357. --};
  3358. --
  3359. - static const struct ieee80211_iface_combination if_comb[] = {
  3360. - {
  3361. - .limits = if_limits,
  3362. -@@ -766,6 +758,11 @@ static const struct ieee80211_iface_comb
  3363. - .max_interfaces = 2048,
  3364. - .num_different_channels = 1,
  3365. - .beacon_int_infra_match = true,
  3366. -+#ifdef CPTCFG_ATH9K_DFS_CERTIFIED
  3367. -+ .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
  3368. -+ BIT(NL80211_CHAN_WIDTH_20) |
  3369. -+ BIT(NL80211_CHAN_WIDTH_40),
  3370. -+#endif
  3371. - },
  3372. - {
  3373. - .limits = wds_limits,
  3374. -@@ -774,18 +771,6 @@ static const struct ieee80211_iface_comb
  3375. - .num_different_channels = 1,
  3376. - .beacon_int_infra_match = true,
  3377. - },
  3378. --#ifdef CPTCFG_ATH9K_DFS_CERTIFIED
  3379. -- {
  3380. -- .limits = if_dfs_limits,
  3381. -- .n_limits = ARRAY_SIZE(if_dfs_limits),
  3382. -- .max_interfaces = 1,
  3383. -- .num_different_channels = 1,
  3384. -- .beacon_int_infra_match = true,
  3385. -- .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
  3386. -- BIT(NL80211_CHAN_WIDTH_20) |
  3387. -- BIT(NL80211_CHAN_WIDTH_40),
  3388. -- }
  3389. --#endif
  3390. - };
  3391. -
  3392. - #ifdef CPTCFG_ATH9K_CHANNEL_CONTEXT
  3393. diff --git a/package/kernel/mac80211/patches/312-ath9k-Correct-TSF-adjustment-to-align-the-beacon-tim.patch b/package/kernel/mac80211/patches/312-ath9k-Correct-TSF-adjustment-to-align-the-beacon-tim.patch
  3394. new file mode 100644
  3395. index 0000000..df43105
  3396. --- /dev/null
  3397. +++ b/package/kernel/mac80211/patches/312-ath9k-Correct-TSF-adjustment-to-align-the-beacon-tim.patch
  3398. @@ -0,0 +1,45 @@
  3399. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3400. +Date: Mon, 4 Jul 2016 14:37:20 +0200
  3401. +Subject: [PATCH] ath9k: Correct TSF adjustment to align the beacon time
  3402. + correctly
  3403. +
  3404. +Beacons were not send out at (timestamp % beacon_time == 0) for interfaces
  3405. +other than the primary one. To send out beacons with the correct timestamp
  3406. +according to 10.1.3.2 of the 802.11 standard the tsf_adjustment has to be
  3407. +set to the negative time difference instead of positive. This way the
  3408. +later beacons get corrected to have a lower (and similar) timestamp with
  3409. +regard to the beacon from slot 0.
  3410. +
  3411. +I am not aware about any issues that have been caused by this.
  3412. +
  3413. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3414. +---
  3415. +
  3416. +--- a/drivers/net/wireless/ath/ath9k/beacon.c
  3417. ++++ b/drivers/net/wireless/ath/ath9k/beacon.c
  3418. +@@ -279,17 +279,21 @@ static void ath9k_set_tsfadjust(struct a
  3419. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  3420. + struct ath_vif *avp = (void *)vif->drv_priv;
  3421. + struct ath_beacon_config *cur_conf = &avp->chanctx->beacon;
  3422. +- u32 tsfadjust;
  3423. ++ s64 tsfadjust;
  3424. +
  3425. + if (avp->av_bslot == 0)
  3426. + return;
  3427. +
  3428. ++ /* tsf_adjust is added to the TSF value. We send out the beacon late,
  3429. ++ * so need to adjust the TSF starting point to be later in time (i.e.
  3430. ++ * the theoretical first beacon has a TSF of 0 after correction).
  3431. ++ */
  3432. + tsfadjust = cur_conf->beacon_interval * avp->av_bslot;
  3433. +- tsfadjust = TU_TO_USEC(tsfadjust) / ATH_BCBUF;
  3434. ++ tsfadjust = -TU_TO_USEC(tsfadjust) / ATH_BCBUF;
  3435. + avp->tsf_adjust = cpu_to_le64(tsfadjust);
  3436. +
  3437. +- ath_dbg(common, CONFIG, "tsfadjust is: %llu for bslot: %d\n",
  3438. +- (unsigned long long)tsfadjust, avp->av_bslot);
  3439. ++ ath_dbg(common, CONFIG, "tsfadjust is: %lld for bslot: %d\n",
  3440. ++ (signed long long)tsfadjust, avp->av_bslot);
  3441. + }
  3442. +
  3443. + bool ath9k_csa_is_finished(struct ath_softc *sc, struct ieee80211_vif *vif)
  3444. 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
  3445. deleted file mode 100644
  3446. index 61cafc7..0000000
  3447. --- a/package/kernel/mac80211/patches/312-mac80211-fix-txq-queue-related-crashes.patch
  3448. +++ /dev/null
  3449. @@ -1,27 +0,0 @@
  3450. -From: Michal Kazior <michal.kazior@tieto.com>
  3451. -Date: Thu, 21 Jan 2016 14:23:07 +0100
  3452. -Subject: [PATCH] mac80211: fix txq queue related crashes
  3453. -
  3454. -The driver can access the queue simultanously
  3455. -while mac80211 tears down the interface. Without
  3456. -spinlock protection this could lead to corrupting
  3457. -sk_buff_head and subsequently to an invalid
  3458. -pointer dereference.
  3459. -
  3460. -Fixes: ba8c3d6f16a1 ("mac80211: add an intermediate software queue implementation")
  3461. -Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
  3462. ----
  3463. -
  3464. ---- a/net/mac80211/iface.c
  3465. -+++ b/net/mac80211/iface.c
  3466. -@@ -977,7 +977,10 @@ static void ieee80211_do_stop(struct iee
  3467. - if (sdata->vif.txq) {
  3468. - struct txq_info *txqi = to_txq_info(sdata->vif.txq);
  3469. -
  3470. -+ spin_lock_bh(&txqi->queue.lock);
  3471. - ieee80211_purge_tx_queue(&local->hw, &txqi->queue);
  3472. -+ spin_unlock_bh(&txqi->queue.lock);
  3473. -+
  3474. - atomic_set(&sdata->txqs_len[txqi->txq.ac], 0);
  3475. - }
  3476. -
  3477. diff --git a/package/kernel/mac80211/patches/313-ath9k-Handle-channel-context-in-get_-set_-reset_tsf.patch b/package/kernel/mac80211/patches/313-ath9k-Handle-channel-context-in-get_-set_-reset_tsf.patch
  3478. new file mode 100644
  3479. index 0000000..ef0afbe
  3480. --- /dev/null
  3481. +++ b/package/kernel/mac80211/patches/313-ath9k-Handle-channel-context-in-get_-set_-reset_tsf.patch
  3482. @@ -0,0 +1,70 @@
  3483. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3484. +Date: Mon, 4 Jul 2016 14:37:21 +0200
  3485. +Subject: [PATCH] ath9k: Handle channel context in get_/set_/reset_tsf
  3486. +
  3487. +The ath9k TSF handling routines need to be aware of the channel context that
  3488. +is being modified. With this change the TSF related values that are stored
  3489. +in each channel context will be correctly tracked and the harware will only
  3490. +be updated if the modified context is currently the active one.
  3491. +
  3492. +Without this change the TSF modifications done using these routines would
  3493. +for example be lost during a hardware reset as done by ath_complete_reset.
  3494. +
  3495. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3496. +---
  3497. +
  3498. +--- a/drivers/net/wireless/ath/ath9k/main.c
  3499. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  3500. +@@ -1823,11 +1823,18 @@ static void ath9k_bss_info_changed(struc
  3501. + static u64 ath9k_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
  3502. + {
  3503. + struct ath_softc *sc = hw->priv;
  3504. ++ struct ath_vif *avp = (void *)vif->drv_priv;
  3505. + u64 tsf;
  3506. +
  3507. + mutex_lock(&sc->mutex);
  3508. + ath9k_ps_wakeup(sc);
  3509. +- tsf = ath9k_hw_gettsf64(sc->sc_ah);
  3510. ++ /* Get current TSF either from HW or kernel time. */
  3511. ++ if (sc->cur_chan == avp->chanctx) {
  3512. ++ tsf = ath9k_hw_gettsf64(sc->sc_ah);
  3513. ++ } else {
  3514. ++ tsf = sc->cur_chan->tsf_val +
  3515. ++ ath9k_hw_get_tsf_offset(&sc->cur_chan->tsf_ts, NULL);
  3516. ++ }
  3517. + ath9k_ps_restore(sc);
  3518. + mutex_unlock(&sc->mutex);
  3519. +
  3520. +@@ -1839,10 +1846,14 @@ static void ath9k_set_tsf(struct ieee802
  3521. + u64 tsf)
  3522. + {
  3523. + struct ath_softc *sc = hw->priv;
  3524. ++ struct ath_vif *avp = (void *)vif->drv_priv;
  3525. +
  3526. + mutex_lock(&sc->mutex);
  3527. + ath9k_ps_wakeup(sc);
  3528. +- ath9k_hw_settsf64(sc->sc_ah, tsf);
  3529. ++ getrawmonotonic(&avp->chanctx->tsf_ts);
  3530. ++ if (sc->cur_chan == avp->chanctx)
  3531. ++ ath9k_hw_settsf64(sc->sc_ah, tsf);
  3532. ++ avp->chanctx->tsf_val = tsf;
  3533. + ath9k_ps_restore(sc);
  3534. + mutex_unlock(&sc->mutex);
  3535. + }
  3536. +@@ -1850,11 +1861,15 @@ static void ath9k_set_tsf(struct ieee802
  3537. + static void ath9k_reset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
  3538. + {
  3539. + struct ath_softc *sc = hw->priv;
  3540. ++ struct ath_vif *avp = (void *)vif->drv_priv;
  3541. +
  3542. + mutex_lock(&sc->mutex);
  3543. +
  3544. + ath9k_ps_wakeup(sc);
  3545. +- ath9k_hw_reset_tsf(sc->sc_ah);
  3546. ++ getrawmonotonic(&avp->chanctx->tsf_ts);
  3547. ++ if (sc->cur_chan == avp->chanctx)
  3548. ++ ath9k_hw_reset_tsf(sc->sc_ah);
  3549. ++ avp->chanctx->tsf_val = 0;
  3550. + ath9k_ps_restore(sc);
  3551. +
  3552. + mutex_unlock(&sc->mutex);
  3553. 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
  3554. deleted file mode 100644
  3555. index 844d43b..0000000
  3556. --- a/package/kernel/mac80211/patches/313-mac80211-fix-unnecessary-frame-drops-in-mesh-fwding.patch
  3557. +++ /dev/null
  3558. @@ -1,57 +0,0 @@
  3559. -From: Michal Kazior <michal.kazior@tieto.com>
  3560. -Date: Mon, 25 Jan 2016 14:43:24 +0100
  3561. -Subject: [PATCH] mac80211: fix unnecessary frame drops in mesh fwding
  3562. -
  3563. -The ieee80211_queue_stopped() expects hw queue
  3564. -number but it was given raw WMM AC number instead.
  3565. -
  3566. -This could cause frame drops and problems with
  3567. -traffic in some cases - most notably if driver
  3568. -doesn't map AC numbers to queue numbers 1:1 and
  3569. -uses ieee80211_stop_queues() and
  3570. -ieee80211_wake_queue() only without ever calling
  3571. -ieee80211_wake_queues().
  3572. -
  3573. -On ath10k it was possible to hit this problem in
  3574. -the following case:
  3575. -
  3576. - 1. wlan0 uses queue 0
  3577. - (ath10k maps queues per vif)
  3578. - 2. offchannel uses queue 15
  3579. - 3. queues 1-14 are unused
  3580. - 4. ieee80211_stop_queues()
  3581. - 5. ieee80211_wake_queue(q=0)
  3582. - 6. ieee80211_wake_queue(q=15)
  3583. - (other queues are not woken up because both
  3584. - driver and mac80211 know other queues are
  3585. - unused)
  3586. - 7. ieee80211_rx_h_mesh_fwding()
  3587. - 8. ieee80211_select_queue_80211() returns 2
  3588. - 9. ieee80211_queue_stopped(q=2) returns true
  3589. - 10. frame is dropped (oops!)
  3590. -
  3591. -Fixes: d3c1597b8d1b ("mac80211: fix forwarded mesh frame queue mapping")
  3592. -Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
  3593. ----
  3594. -
  3595. ---- a/net/mac80211/rx.c
  3596. -+++ b/net/mac80211/rx.c
  3597. -@@ -2235,7 +2235,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  3598. - struct ieee80211_local *local = rx->local;
  3599. - struct ieee80211_sub_if_data *sdata = rx->sdata;
  3600. - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
  3601. -- u16 q, hdrlen;
  3602. -+ u16 ac, q, hdrlen;
  3603. -
  3604. - hdr = (struct ieee80211_hdr *) skb->data;
  3605. - hdrlen = ieee80211_hdrlen(hdr->frame_control);
  3606. -@@ -2304,7 +2304,8 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  3607. - ether_addr_equal(sdata->vif.addr, hdr->addr3))
  3608. - return RX_CONTINUE;
  3609. -
  3610. -- q = ieee80211_select_queue_80211(sdata, skb, hdr);
  3611. -+ ac = ieee80211_select_queue_80211(sdata, skb, hdr);
  3612. -+ q = sdata->vif.hw_queue[ac];
  3613. - if (ieee80211_queue_stopped(&local->hw, q)) {
  3614. - IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_congestion);
  3615. - return RX_DROP_MONITOR;
  3616. diff --git a/package/kernel/mac80211/patches/314-ath9k-Use-tsf-offset-helper-in-ath9k_hw_reset.patch b/package/kernel/mac80211/patches/314-ath9k-Use-tsf-offset-helper-in-ath9k_hw_reset.patch
  3617. new file mode 100644
  3618. index 0000000..e725a8b
  3619. --- /dev/null
  3620. +++ b/package/kernel/mac80211/patches/314-ath9k-Use-tsf-offset-helper-in-ath9k_hw_reset.patch
  3621. @@ -0,0 +1,65 @@
  3622. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3623. +Date: Mon, 4 Jul 2016 14:37:22 +0200
  3624. +Subject: [PATCH] ath9k: Use tsf offset helper in ath9k_hw_reset
  3625. +
  3626. +These changes make ath9k_hw_reset more consistent with other places that
  3627. +handle the TSF value by using the same helper routine.
  3628. +
  3629. +A slight improvement is to not assume that a fixed time of 1.5ms has
  3630. +passed for the initval writes when compared to the first write attempt.
  3631. +Instead the TSF value is re-calculated which will yield a higher accuracy
  3632. +of the restored TSF timer.
  3633. +
  3634. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3635. +---
  3636. +
  3637. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  3638. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  3639. +@@ -1832,8 +1832,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  3640. + u32 saveLedState;
  3641. + u32 saveDefAntenna;
  3642. + u32 macStaId1;
  3643. ++ struct timespec tsf_ts;
  3644. ++ u32 tsf_offset;
  3645. + u64 tsf = 0;
  3646. +- s64 usec = 0;
  3647. + int r;
  3648. + bool start_mci_reset = false;
  3649. + bool save_fullsleep = ah->chip_fullsleep;
  3650. +@@ -1877,8 +1878,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  3651. + macStaId1 = REG_READ(ah, AR_STA_ID1) & AR_STA_ID1_BASE_RATE_11B;
  3652. +
  3653. + /* Save TSF before chip reset, a cold reset clears it */
  3654. ++ getrawmonotonic(&tsf_ts);
  3655. + tsf = ath9k_hw_gettsf64(ah);
  3656. +- usec = ktime_to_us(ktime_get_raw());
  3657. +
  3658. + saveLedState = REG_READ(ah, AR_CFG_LED) &
  3659. + (AR_CFG_LED_ASSOC_CTL | AR_CFG_LED_MODE_SEL |
  3660. +@@ -1911,8 +1912,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  3661. + }
  3662. +
  3663. + /* Restore TSF */
  3664. +- usec = ktime_to_us(ktime_get_raw()) - usec;
  3665. +- ath9k_hw_settsf64(ah, tsf + usec);
  3666. ++ tsf_offset = ath9k_hw_get_tsf_offset(&tsf_ts, NULL);
  3667. ++ ath9k_hw_settsf64(ah, tsf + tsf_offset);
  3668. +
  3669. + if (AR_SREV_9280_20_OR_LATER(ah))
  3670. + REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, AR_GPIO_JTAG_DISABLE);
  3671. +@@ -1932,12 +1933,11 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  3672. + /*
  3673. + * Some AR91xx SoC devices frequently fail to accept TSF writes
  3674. + * right after the chip reset. When that happens, write a new
  3675. +- * value after the initvals have been applied, with an offset
  3676. +- * based on measured time difference
  3677. ++ * value after the initvals have been applied.
  3678. + */
  3679. + if (AR_SREV_9100(ah) && (ath9k_hw_gettsf64(ah) < tsf)) {
  3680. +- tsf += 1500;
  3681. +- ath9k_hw_settsf64(ah, tsf);
  3682. ++ tsf_offset = ath9k_hw_get_tsf_offset(&tsf_ts, NULL);
  3683. ++ ath9k_hw_settsf64(ah, tsf + tsf_offset);
  3684. + }
  3685. +
  3686. + ath9k_hw_init_mfp(ah);
  3687. 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
  3688. deleted file mode 100644
  3689. index 5b3efbd..0000000
  3690. --- a/package/kernel/mac80211/patches/314-mac80211-Requeue-work-after-scan-complete-for-all-VI.patch
  3691. +++ /dev/null
  3692. @@ -1,103 +0,0 @@
  3693. -From: Sachin Kulkarni <Sachin.Kulkarni@imgtec.com>
  3694. -Date: Tue, 12 Jan 2016 14:30:19 +0530
  3695. -Subject: [PATCH] mac80211: Requeue work after scan complete for all VIF
  3696. - types.
  3697. -
  3698. -During a sw scan ieee80211_iface_work ignores work items for all vifs.
  3699. -However after the scan complete work is requeued only for STA, ADHOC
  3700. -and MESH iftypes.
  3701. -
  3702. -This occasionally results in event processing getting delayed/not
  3703. -processed for iftype AP when it coexists with a STA. This can result
  3704. -in data halt and eventually disconnection on the AP interface.
  3705. -
  3706. -Signed-off-by: Sachin Kulkarni <Sachin.Kulkarni@imgtec.com>
  3707. -Cc: linux-wireless@vger.kernel.org
  3708. -Cc: johannes@sipsolutions.net
  3709. ----
  3710. -
  3711. ---- a/net/mac80211/ibss.c
  3712. -+++ b/net/mac80211/ibss.c
  3713. -@@ -1731,7 +1731,6 @@ void ieee80211_ibss_notify_scan_complete
  3714. - if (sdata->vif.type != NL80211_IFTYPE_ADHOC)
  3715. - continue;
  3716. - sdata->u.ibss.last_scan_completed = jiffies;
  3717. -- ieee80211_queue_work(&local->hw, &sdata->work);
  3718. - }
  3719. - mutex_unlock(&local->iflist_mtx);
  3720. - }
  3721. ---- a/net/mac80211/mesh.c
  3722. -+++ b/net/mac80211/mesh.c
  3723. -@@ -1369,17 +1369,6 @@ out:
  3724. - sdata_unlock(sdata);
  3725. - }
  3726. -
  3727. --void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local)
  3728. --{
  3729. -- struct ieee80211_sub_if_data *sdata;
  3730. --
  3731. -- rcu_read_lock();
  3732. -- list_for_each_entry_rcu(sdata, &local->interfaces, list)
  3733. -- if (ieee80211_vif_is_mesh(&sdata->vif) &&
  3734. -- ieee80211_sdata_running(sdata))
  3735. -- ieee80211_queue_work(&local->hw, &sdata->work);
  3736. -- rcu_read_unlock();
  3737. --}
  3738. -
  3739. - void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata)
  3740. - {
  3741. ---- a/net/mac80211/mesh.h
  3742. -+++ b/net/mac80211/mesh.h
  3743. -@@ -362,14 +362,10 @@ static inline bool mesh_path_sel_is_hwmp
  3744. - return sdata->u.mesh.mesh_pp_id == IEEE80211_PATH_PROTOCOL_HWMP;
  3745. - }
  3746. -
  3747. --void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local);
  3748. --
  3749. - void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata);
  3750. - void mesh_sync_adjust_tbtt(struct ieee80211_sub_if_data *sdata);
  3751. - void ieee80211s_stop(void);
  3752. - #else
  3753. --static inline void
  3754. --ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local) {}
  3755. - static inline bool mesh_path_sel_is_hwmp(struct ieee80211_sub_if_data *sdata)
  3756. - { return false; }
  3757. - static inline void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata)
  3758. ---- a/net/mac80211/mlme.c
  3759. -+++ b/net/mac80211/mlme.c
  3760. -@@ -3978,8 +3978,6 @@ static void ieee80211_restart_sta_timer(
  3761. - if (!ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR))
  3762. - ieee80211_queue_work(&sdata->local->hw,
  3763. - &sdata->u.mgd.monitor_work);
  3764. -- /* and do all the other regular work too */
  3765. -- ieee80211_queue_work(&sdata->local->hw, &sdata->work);
  3766. - }
  3767. - }
  3768. -
  3769. ---- a/net/mac80211/scan.c
  3770. -+++ b/net/mac80211/scan.c
  3771. -@@ -314,6 +314,7 @@ static void __ieee80211_scan_completed(s
  3772. - bool was_scanning = local->scanning;
  3773. - struct cfg80211_scan_request *scan_req;
  3774. - struct ieee80211_sub_if_data *scan_sdata;
  3775. -+ struct ieee80211_sub_if_data *sdata;
  3776. -
  3777. - lockdep_assert_held(&local->mtx);
  3778. -
  3779. -@@ -373,7 +374,15 @@ static void __ieee80211_scan_completed(s
  3780. -
  3781. - ieee80211_mlme_notify_scan_completed(local);
  3782. - ieee80211_ibss_notify_scan_completed(local);
  3783. -- ieee80211_mesh_notify_scan_completed(local);
  3784. -+
  3785. -+ /* Requeue all the work that might have been ignored while
  3786. -+ * the scan was in progress
  3787. -+ */
  3788. -+ list_for_each_entry_rcu(sdata, &local->interfaces, list) {
  3789. -+ if (ieee80211_sdata_running(sdata))
  3790. -+ ieee80211_queue_work(&sdata->local->hw, &sdata->work);
  3791. -+ }
  3792. -+
  3793. - if (was_scanning)
  3794. - ieee80211_start_next_roc(local);
  3795. - }
  3796. diff --git a/package/kernel/mac80211/patches/315-ath9k-Expose-tsf_adjustment-in-mac80211-tsf-getters-.patch b/package/kernel/mac80211/patches/315-ath9k-Expose-tsf_adjustment-in-mac80211-tsf-getters-.patch
  3797. new file mode 100644
  3798. index 0000000..c95ab7e
  3799. --- /dev/null
  3800. +++ b/package/kernel/mac80211/patches/315-ath9k-Expose-tsf_adjustment-in-mac80211-tsf-getters-.patch
  3801. @@ -0,0 +1,32 @@
  3802. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3803. +Date: Mon, 4 Jul 2016 14:37:23 +0200
  3804. +Subject: [PATCH] ath9k: Expose tsf_adjustment in mac80211 tsf getters and
  3805. + setters.
  3806. +
  3807. +The ath9k driver modifies the TSF for VIFs for the purpose of sending
  3808. +beacons in a staggered fashion. This patch exposes this VIF specific
  3809. +adjustment of the TSF value to mac80211. Without the change the TSF
  3810. +routines handle the hardware TSF value instead of the actual TSF value as
  3811. +seen on the air.
  3812. +
  3813. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3814. +---
  3815. +
  3816. +--- a/drivers/net/wireless/ath/ath9k/main.c
  3817. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  3818. +@@ -1835,6 +1835,7 @@ static u64 ath9k_get_tsf(struct ieee8021
  3819. + tsf = sc->cur_chan->tsf_val +
  3820. + ath9k_hw_get_tsf_offset(&sc->cur_chan->tsf_ts, NULL);
  3821. + }
  3822. ++ tsf += le64_to_cpu(avp->tsf_adjust);
  3823. + ath9k_ps_restore(sc);
  3824. + mutex_unlock(&sc->mutex);
  3825. +
  3826. +@@ -1850,6 +1851,7 @@ static void ath9k_set_tsf(struct ieee802
  3827. +
  3828. + mutex_lock(&sc->mutex);
  3829. + ath9k_ps_wakeup(sc);
  3830. ++ tsf -= le64_to_cpu(avp->tsf_adjust);
  3831. + getrawmonotonic(&avp->chanctx->tsf_ts);
  3832. + if (sc->cur_chan == avp->chanctx)
  3833. + ath9k_hw_settsf64(sc->sc_ah, tsf);
  3834. 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
  3835. deleted file mode 100644
  3836. index 52fecb9..0000000
  3837. --- a/package/kernel/mac80211/patches/315-mac80211-fix-ibss-scan-parameters.patch
  3838. +++ /dev/null
  3839. @@ -1,57 +0,0 @@
  3840. -From: Sara Sharon <sara.sharon@intel.com>
  3841. -Date: Mon, 25 Jan 2016 15:46:35 +0200
  3842. -Subject: [PATCH] mac80211: fix ibss scan parameters
  3843. -
  3844. -When joining IBSS a full scan should be initiated in order to search
  3845. -for existing cell, unless the fixed_channel parameter was set.
  3846. -A default channel to create the IBSS on if no cell was found is
  3847. -provided as well.
  3848. -However - a scan is initiated only on the default channel provided
  3849. -regardless of whether ifibss->fixed_channel is set or not, with the
  3850. -obvious result of the cell not joining existing IBSS cell that is
  3851. -on another channel.
  3852. -
  3853. -Fixes: 76bed0f43b27 ("mac80211: IBSS fix scan request")
  3854. -Signed-off-by: Sara Sharon <sara.sharon@intel.com>
  3855. -Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
  3856. ----
  3857. -
  3858. ---- a/net/mac80211/ibss.c
  3859. -+++ b/net/mac80211/ibss.c
  3860. -@@ -7,6 +7,7 @@
  3861. - * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
  3862. - * Copyright 2009, Johannes Berg <johannes@sipsolutions.net>
  3863. - * Copyright 2013-2014 Intel Mobile Communications GmbH
  3864. -+ * Copyright(c) 2016 Intel Deutschland GmbH
  3865. - *
  3866. - * This program is free software; you can redistribute it and/or modify
  3867. - * it under the terms of the GNU General Public License version 2 as
  3868. -@@ -1483,14 +1484,21 @@ static void ieee80211_sta_find_ibss(stru
  3869. -
  3870. - sdata_info(sdata, "Trigger new scan to find an IBSS to join\n");
  3871. -
  3872. -- num = ieee80211_ibss_setup_scan_channels(local->hw.wiphy,
  3873. -- &ifibss->chandef,
  3874. -- channels,
  3875. -- ARRAY_SIZE(channels));
  3876. - scan_width = cfg80211_chandef_to_scan_width(&ifibss->chandef);
  3877. -- ieee80211_request_ibss_scan(sdata, ifibss->ssid,
  3878. -- ifibss->ssid_len, channels, num,
  3879. -- scan_width);
  3880. -+
  3881. -+ if (ifibss->fixed_channel) {
  3882. -+ num = ieee80211_ibss_setup_scan_channels(local->hw.wiphy,
  3883. -+ &ifibss->chandef,
  3884. -+ channels,
  3885. -+ ARRAY_SIZE(channels));
  3886. -+ ieee80211_request_ibss_scan(sdata, ifibss->ssid,
  3887. -+ ifibss->ssid_len, channels,
  3888. -+ num, scan_width);
  3889. -+ } else {
  3890. -+ ieee80211_request_ibss_scan(sdata, ifibss->ssid,
  3891. -+ ifibss->ssid_len, NULL,
  3892. -+ 0, scan_width);
  3893. -+ }
  3894. - } else {
  3895. - int interval = IEEE80211_SCAN_INTERVAL;
  3896. -
  3897. diff --git a/package/kernel/mac80211/patches/316-ath9k-Remove-some-defined-constants-to-decrease-verb.patch b/package/kernel/mac80211/patches/316-ath9k-Remove-some-defined-constants-to-decrease-verb.patch
  3898. new file mode 100644
  3899. index 0000000..36aaa10
  3900. --- /dev/null
  3901. +++ b/package/kernel/mac80211/patches/316-ath9k-Remove-some-defined-constants-to-decrease-verb.patch
  3902. @@ -0,0 +1,137 @@
  3903. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  3904. +Date: Mon, 4 Jul 2016 14:37:24 +0200
  3905. +Subject: [PATCH] ath9k: Remove some #defined constants to decrease
  3906. + verbosity
  3907. +
  3908. +The removed ATH9K_SLOT_TIME_X constants simply map the value in microseconds
  3909. +to the same integer. These constants were not used consistently, so fix the
  3910. +inconsistency issue by replacing all occurances with the integer equivalent.
  3911. +
  3912. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  3913. +---
  3914. +
  3915. +--- a/drivers/net/wireless/ath/ath9k/beacon.c
  3916. ++++ b/drivers/net/wireless/ath/ath9k/beacon.c
  3917. +@@ -50,7 +50,7 @@ static void ath9k_beaconq_config(struct
  3918. + txq = sc->tx.txq_map[IEEE80211_AC_BE];
  3919. + ath9k_hw_get_txq_props(ah, txq->axq_qnum, &qi_be);
  3920. + qi.tqi_aifs = qi_be.tqi_aifs;
  3921. +- if (ah->slottime == ATH9K_SLOT_TIME_20)
  3922. ++ if (ah->slottime == 20)
  3923. + qi.tqi_cwmin = 2*qi_be.tqi_cwmin;
  3924. + else
  3925. + qi.tqi_cwmin = 4*qi_be.tqi_cwmin;
  3926. +--- a/drivers/net/wireless/ath/ath9k/dynack.c
  3927. ++++ b/drivers/net/wireless/ath/ath9k/dynack.c
  3928. +@@ -280,7 +280,7 @@ EXPORT_SYMBOL(ath_dynack_sample_ack_ts);
  3929. + void ath_dynack_node_init(struct ath_hw *ah, struct ath_node *an)
  3930. + {
  3931. + /* ackto = slottime + sifs + air delay */
  3932. +- u32 ackto = ATH9K_SLOT_TIME_9 + 16 + 64;
  3933. ++ u32 ackto = 9 + 16 + 64;
  3934. + struct ath_dynack *da = &ah->dynack;
  3935. +
  3936. + an->ackto = ackto;
  3937. +@@ -315,7 +315,7 @@ EXPORT_SYMBOL(ath_dynack_node_deinit);
  3938. + void ath_dynack_reset(struct ath_hw *ah)
  3939. + {
  3940. + /* ackto = slottime + sifs + air delay */
  3941. +- u32 ackto = ATH9K_SLOT_TIME_9 + 16 + 64;
  3942. ++ u32 ackto = 9 + 16 + 64;
  3943. + struct ath_dynack *da = &ah->dynack;
  3944. +
  3945. + da->lto = jiffies;
  3946. +--- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
  3947. ++++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
  3948. +@@ -45,7 +45,7 @@ void ath9k_htc_beaconq_config(struct ath
  3949. + * Long slot time : 2x cwmin
  3950. + * Short slot time : 4x cwmin
  3951. + */
  3952. +- if (ah->slottime == ATH9K_SLOT_TIME_20)
  3953. ++ if (ah->slottime == 20)
  3954. + qi.tqi_cwmin = 2*qi_be.tqi_cwmin;
  3955. + else
  3956. + qi.tqi_cwmin = 4*qi_be.tqi_cwmin;
  3957. +--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
  3958. ++++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
  3959. +@@ -678,7 +678,7 @@ static int ath9k_init_priv(struct ath9k_
  3960. +
  3961. + for (i = 0; i < ATH9K_HTC_MAX_BCN_VIF; i++)
  3962. + priv->beacon.bslot[i] = NULL;
  3963. +- priv->beacon.slottime = ATH9K_SLOT_TIME_9;
  3964. ++ priv->beacon.slottime = 9;
  3965. +
  3966. + ath9k_cmn_init_channels_rates(common);
  3967. + ath9k_cmn_init_crypto(ah);
  3968. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  3969. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  3970. +@@ -454,7 +454,7 @@ static void ath9k_hw_init_defaults(struc
  3971. + if (AR_SREV_9100(ah))
  3972. + ah->sta_id1_defaults |= AR_STA_ID1_AR9100_BA_FIX;
  3973. +
  3974. +- ah->slottime = ATH9K_SLOT_TIME_9;
  3975. ++ ah->slottime = 9;
  3976. + ah->globaltxtimeout = (u32) -1;
  3977. + ah->power_mode = ATH9K_PM_UNDEFINED;
  3978. + ah->htc_reset_init = true;
  3979. +--- a/drivers/net/wireless/ath/ath9k/init.c
  3980. ++++ b/drivers/net/wireless/ath/ath9k/init.c
  3981. +@@ -372,7 +372,7 @@ static void ath9k_init_misc(struct ath_s
  3982. +
  3983. + common->last_rssi = ATH_RSSI_DUMMY_MARKER;
  3984. + memcpy(common->bssidmask, ath_bcast_mac, ETH_ALEN);
  3985. +- sc->beacon.slottime = ATH9K_SLOT_TIME_9;
  3986. ++ sc->beacon.slottime = 9;
  3987. +
  3988. + for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++)
  3989. + sc->beacon.bslot[i] = NULL;
  3990. +--- a/drivers/net/wireless/ath/ath9k/mac.h
  3991. ++++ b/drivers/net/wireless/ath/ath9k/mac.h
  3992. +@@ -65,10 +65,6 @@
  3993. + #define INIT_SSH_RETRY 32
  3994. + #define INIT_SLG_RETRY 32
  3995. +
  3996. +-#define ATH9K_SLOT_TIME_6 6
  3997. +-#define ATH9K_SLOT_TIME_9 9
  3998. +-#define ATH9K_SLOT_TIME_20 20
  3999. +-
  4000. + #define ATH9K_TXERR_XRETRY 0x01
  4001. + #define ATH9K_TXERR_FILT 0x02
  4002. + #define ATH9K_TXERR_FIFO 0x04
  4003. +--- a/drivers/net/wireless/ath/ath9k/main.c
  4004. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  4005. +@@ -926,7 +926,7 @@ static void ath9k_vif_iter(struct ath9k_
  4006. + }
  4007. +
  4008. + if (!vif->bss_conf.use_short_slot)
  4009. +- iter_data->slottime = ATH9K_SLOT_TIME_20;
  4010. ++ iter_data->slottime = 20;
  4011. +
  4012. + switch (vif->type) {
  4013. + case NL80211_IFTYPE_AP:
  4014. +@@ -999,7 +999,7 @@ void ath9k_calculate_iter_data(struct at
  4015. + */
  4016. + memset(iter_data, 0, sizeof(*iter_data));
  4017. + eth_broadcast_addr(iter_data->mask);
  4018. +- iter_data->slottime = ATH9K_SLOT_TIME_9;
  4019. ++ iter_data->slottime = 9;
  4020. +
  4021. + list_for_each_entry(avp, &ctx->vifs, list)
  4022. + ath9k_vif_iter(iter_data, avp->vif->addr, avp->vif);
  4023. +@@ -1061,7 +1061,7 @@ static void ath9k_set_offchannel_state(s
  4024. + ah->opmode = vif->type;
  4025. + ah->imask &= ~ATH9K_INT_SWBA;
  4026. + ah->imask &= ~ATH9K_INT_TSFOOR;
  4027. +- ah->slottime = ATH9K_SLOT_TIME_9;
  4028. ++ ah->slottime = 9;
  4029. +
  4030. + ath_hw_setbssidmask(common);
  4031. + ath9k_hw_setopmode(ah);
  4032. +@@ -1788,6 +1788,7 @@ static void ath9k_bss_info_changed(struc
  4033. + slottime = 9;
  4034. + else
  4035. + slottime = 20;
  4036. ++
  4037. + if (vif->type == NL80211_IFTYPE_AP) {
  4038. + /*
  4039. + * Defer update, so that connected stations can adjust
  4040. 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
  4041. deleted file mode 100644
  4042. index e78df36..0000000
  4043. --- a/package/kernel/mac80211/patches/316-net-mac80211-agg-rx.c-fix-use-of-uninitialised-value.patch
  4044. +++ /dev/null
  4045. @@ -1,50 +0,0 @@
  4046. -From: Chris Bainbridge <chris.bainbridge@gmail.com>
  4047. -Date: Wed, 27 Jan 2016 15:46:18 +0000
  4048. -Subject: [PATCH] net/mac80211/agg-rx.c: fix use of uninitialised values
  4049. -
  4050. -Use kzalloc instead of kmalloc for struct tid_ampdu_rx. Fixes:
  4051. -
  4052. -[ 7.976605] UBSAN: Undefined behaviour in net/mac80211/rx.c:932:29
  4053. -[ 7.976608] load of value 2 is not a valid value for type '_Bool'
  4054. -[ 7.976611] CPU: 3 PID: 1134 Comm: kworker/u16:7 Not tainted 4.5.0-rc1+ #265
  4055. -[ 7.976613] Hardware name: Apple Inc. MacBookPro10,2/Mac-AFD8A9D944EA4843, BIOS MBP102.88Z.0106.B0A.1509130955 09/13/2015
  4056. -[ 7.976616] Workqueue: phy0 rt2x00usb_work_rxdone
  4057. -[ 7.976619] 0000000000000004 ffff880254a7ba50 ffffffff8181d866 0000000000000007
  4058. -[ 7.976622] ffff880254a7ba78 ffff880254a7ba68 ffffffff8188422d ffffffff8379b500
  4059. -[ 7.976626] ffff880254a7bab8 ffffffff81884747 0000000000000202 0000000348620032
  4060. -[ 7.976629] Call Trace:
  4061. -[ 7.976633] [<ffffffff8181d866>] dump_stack+0x45/0x5f
  4062. -[ 7.976637] [<ffffffff8188422d>] ubsan_epilogue+0xd/0x40
  4063. -[ 7.976642] [<ffffffff81884747>] __ubsan_handle_load_invalid_value+0x67/0x70
  4064. -[ 7.976646] [<ffffffff82227b4d>] ieee80211_sta_reorder_release.isra.16+0x5ed/0x730
  4065. -[ 7.976650] [<ffffffff8222ca14>] ieee80211_prepare_and_rx_handle+0xd04/0x1c00
  4066. -[ 7.976654] [<ffffffff81cb27ce>] ? usb_hcd_map_urb_for_dma+0x65e/0x960
  4067. -[ 7.976659] [<ffffffff8222db03>] __ieee80211_rx_handle_packet+0x1f3/0x750
  4068. -[ 7.976663] [<ffffffff8222e4a7>] ieee80211_rx_napi+0x447/0x990
  4069. -[ 7.976667] [<ffffffff81c5fb85>] rt2x00lib_rxdone+0x305/0xbd0
  4070. -[ 7.976670] [<ffffffff811ac23f>] ? dequeue_task_fair+0x64f/0x1de0
  4071. -[ 7.976674] [<ffffffff811a1516>] ? sched_clock_cpu+0xe6/0x150
  4072. -[ 7.976678] [<ffffffff81c6c45c>] rt2x00usb_work_rxdone+0x7c/0x140
  4073. -[ 7.976682] [<ffffffff8117aef6>] process_one_work+0x226/0x860
  4074. -[ 7.976686] [<ffffffff8117b58c>] worker_thread+0x5c/0x680
  4075. -[ 7.976690] [<ffffffff8117b530>] ? process_one_work+0x860/0x860
  4076. -[ 7.976693] [<ffffffff81184f86>] kthread+0xf6/0x150
  4077. -[ 7.976697] [<ffffffff81184e90>] ? kthread_worker_fn+0x310/0x310
  4078. -[ 7.976700] [<ffffffff822a94df>] ret_from_fork+0x3f/0x70
  4079. -[ 7.976703] [<ffffffff81184e90>] ? kthread_worker_fn+0x310/0x310
  4080. -
  4081. -Link: https://lkml.org/lkml/2016/1/26/230
  4082. -Signed-off-by: Chris Bainbridge <chris.bainbridge@gmail.com>
  4083. ----
  4084. -
  4085. ---- a/net/mac80211/agg-rx.c
  4086. -+++ b/net/mac80211/agg-rx.c
  4087. -@@ -327,7 +327,7 @@ void __ieee80211_start_rx_ba_session(str
  4088. - }
  4089. -
  4090. - /* prepare A-MPDU MLME for Rx aggregation */
  4091. -- tid_agg_rx = kmalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL);
  4092. -+ tid_agg_rx = kzalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL);
  4093. - if (!tid_agg_rx)
  4094. - goto end;
  4095. -
  4096. diff --git a/package/kernel/mac80211/patches/317-ath9k-Fix-beacon-configuration-for-addition-removal-.patch b/package/kernel/mac80211/patches/317-ath9k-Fix-beacon-configuration-for-addition-removal-.patch
  4097. new file mode 100644
  4098. index 0000000..360dfbf
  4099. --- /dev/null
  4100. +++ b/package/kernel/mac80211/patches/317-ath9k-Fix-beacon-configuration-for-addition-removal-.patch
  4101. @@ -0,0 +1,544 @@
  4102. +From: Benjamin Berg <benjamin.berg@open-mesh.com>
  4103. +Date: Mon, 4 Jul 2016 14:37:25 +0200
  4104. +Subject: [PATCH] ath9k: Fix beacon configuration for addition/removal of
  4105. + interfaces
  4106. +
  4107. +This patch fixes some issues with interface reconfiguration. It could
  4108. +for example happen that an AP interface in beacon slot 0 was removed
  4109. +leaving an IBSS station in one of the other slots. When this happens
  4110. +the driver never sends out the beacon as it only tries to send a beacon
  4111. +from slot 0.
  4112. +
  4113. +Appart from that the tracking of required changes to the beacon config is
  4114. +relatively complicated and prone to errors.
  4115. +
  4116. +The approach taken here is to solve reconfiguration issues is to
  4117. +reconfigure the beacons when any interface changes. This means that
  4118. +the complexity of deciding whether an interface change may modify the
  4119. +beacon configuration is gone. It also means that the beacon config will
  4120. +be reliably updated when an interface is removed.
  4121. +
  4122. +The issue that a single non-AP interface might not be in beacon
  4123. +slot 0 and wouldn't be send out is solved by moving it into the
  4124. +first slot. The TSF value in hardware is adjusted accordingly so
  4125. +that the timestamp of the beacons stay consistent.
  4126. +
  4127. +Signed-off-by: Benjamin Berg <benjamin.berg@open-mesh.com>
  4128. +---
  4129. +
  4130. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  4131. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  4132. +@@ -637,6 +637,8 @@ struct ath9k_vif_iter_data {
  4133. + int nwds; /* number of WDS vifs */
  4134. + int nadhocs; /* number of adhoc vifs */
  4135. + int nocbs; /* number of OCB vifs */
  4136. ++ int nbcnvifs; /* number of beaconing vifs */
  4137. ++ struct ieee80211_vif *primary_beacon_vif;
  4138. + struct ieee80211_vif *primary_sta;
  4139. + };
  4140. +
  4141. +@@ -685,10 +687,11 @@ struct ath_beacon {
  4142. + };
  4143. +
  4144. + void ath9k_beacon_tasklet(unsigned long data);
  4145. +-void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif,
  4146. +- u32 changed);
  4147. ++void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *main_vif,
  4148. ++ bool beacons);
  4149. + void ath9k_beacon_assign_slot(struct ath_softc *sc, struct ieee80211_vif *vif);
  4150. + void ath9k_beacon_remove_slot(struct ath_softc *sc, struct ieee80211_vif *vif);
  4151. ++void ath9k_beacon_ensure_primary_slot(struct ath_softc *sc);
  4152. + void ath9k_set_beacon(struct ath_softc *sc);
  4153. + bool ath9k_csa_is_finished(struct ath_softc *sc, struct ieee80211_vif *vif);
  4154. + void ath9k_csa_update(struct ath_softc *sc);
  4155. +--- a/drivers/net/wireless/ath/ath9k/beacon.c
  4156. ++++ b/drivers/net/wireless/ath/ath9k/beacon.c
  4157. +@@ -209,7 +209,6 @@ void ath9k_beacon_assign_slot(struct ath
  4158. + }
  4159. +
  4160. + sc->beacon.bslot[avp->av_bslot] = vif;
  4161. +- sc->nbcnvifs++;
  4162. +
  4163. + ath_dbg(common, CONFIG, "Added interface at beacon slot: %d\n",
  4164. + avp->av_bslot);
  4165. +@@ -220,15 +219,12 @@ void ath9k_beacon_remove_slot(struct ath
  4166. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  4167. + struct ath_vif *avp = (void *)vif->drv_priv;
  4168. + struct ath_buf *bf = avp->av_bcbuf;
  4169. +- struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon;
  4170. +
  4171. + ath_dbg(common, CONFIG, "Removing interface at beacon slot: %d\n",
  4172. + avp->av_bslot);
  4173. +
  4174. + tasklet_disable(&sc->bcon_tasklet);
  4175. +
  4176. +- cur_conf->enable_beacon &= ~BIT(avp->av_bslot);
  4177. +-
  4178. + if (bf && bf->bf_mpdu) {
  4179. + struct sk_buff *skb = bf->bf_mpdu;
  4180. + dma_unmap_single(sc->dev, bf->bf_buf_addr,
  4181. +@@ -240,12 +236,73 @@ void ath9k_beacon_remove_slot(struct ath
  4182. +
  4183. + avp->av_bcbuf = NULL;
  4184. + sc->beacon.bslot[avp->av_bslot] = NULL;
  4185. +- sc->nbcnvifs--;
  4186. + list_add_tail(&bf->list, &sc->beacon.bbuf);
  4187. +
  4188. + tasklet_enable(&sc->bcon_tasklet);
  4189. + }
  4190. +
  4191. ++void ath9k_beacon_ensure_primary_slot(struct ath_softc *sc)
  4192. ++{
  4193. ++ struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  4194. ++ struct ieee80211_vif *vif;
  4195. ++ struct ath_vif *avp;
  4196. ++ s64 tsfadjust;
  4197. ++ u32 offset;
  4198. ++ int first_slot = ATH_BCBUF;
  4199. ++ int slot;
  4200. ++
  4201. ++ tasklet_disable(&sc->bcon_tasklet);
  4202. ++
  4203. ++ /* Find first taken slot. */
  4204. ++ for (slot = 0; slot < ATH_BCBUF; slot++) {
  4205. ++ if (sc->beacon.bslot[slot]) {
  4206. ++ first_slot = slot;
  4207. ++ break;
  4208. ++ }
  4209. ++ }
  4210. ++ if (first_slot == 0)
  4211. ++ goto out;
  4212. ++
  4213. ++ /* Re-enumarate all slots, moving them forward. */
  4214. ++ for (slot = 0; slot < ATH_BCBUF; slot++) {
  4215. ++ if (slot + first_slot < ATH_BCBUF) {
  4216. ++ vif = sc->beacon.bslot[slot + first_slot];
  4217. ++ sc->beacon.bslot[slot] = vif;
  4218. ++
  4219. ++ if (vif) {
  4220. ++ avp = (void *)vif->drv_priv;
  4221. ++ avp->av_bslot = slot;
  4222. ++ }
  4223. ++ } else {
  4224. ++ sc->beacon.bslot[slot] = NULL;
  4225. ++ }
  4226. ++ }
  4227. ++
  4228. ++ vif = sc->beacon.bslot[0];
  4229. ++ if (WARN_ON(!vif))
  4230. ++ goto out;
  4231. ++
  4232. ++ /* Get the tsf_adjust value for the new first slot. */
  4233. ++ avp = (void *)vif->drv_priv;
  4234. ++ tsfadjust = le64_to_cpu(avp->tsf_adjust);
  4235. ++
  4236. ++ ath_dbg(common, CONFIG,
  4237. ++ "Adjusting global TSF after beacon slot reassignment: %lld\n",
  4238. ++ (signed long long)tsfadjust);
  4239. ++
  4240. ++ /* Modify TSF as required and update the HW. */
  4241. ++ avp->chanctx->tsf_val += tsfadjust;
  4242. ++ if (sc->cur_chan == avp->chanctx) {
  4243. ++ offset = ath9k_hw_get_tsf_offset(&avp->chanctx->tsf_ts, NULL);
  4244. ++ ath9k_hw_settsf64(sc->sc_ah, avp->chanctx->tsf_val + offset);
  4245. ++ }
  4246. ++
  4247. ++ /* The slots tsf_adjust will be updated by ath9k_beacon_config later. */
  4248. ++
  4249. ++out:
  4250. ++ tasklet_enable(&sc->bcon_tasklet);
  4251. ++}
  4252. ++
  4253. + static int ath9k_beacon_choose_slot(struct ath_softc *sc)
  4254. + {
  4255. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  4256. +@@ -274,26 +331,33 @@ static int ath9k_beacon_choose_slot(stru
  4257. + return slot;
  4258. + }
  4259. +
  4260. +-static void ath9k_set_tsfadjust(struct ath_softc *sc, struct ieee80211_vif *vif)
  4261. ++static void ath9k_set_tsfadjust(struct ath_softc *sc,
  4262. ++ struct ath_beacon_config *cur_conf)
  4263. + {
  4264. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  4265. +- struct ath_vif *avp = (void *)vif->drv_priv;
  4266. +- struct ath_beacon_config *cur_conf = &avp->chanctx->beacon;
  4267. + s64 tsfadjust;
  4268. ++ int slot;
  4269. +
  4270. +- if (avp->av_bslot == 0)
  4271. +- return;
  4272. ++ for (slot = 0; slot < ATH_BCBUF; slot++) {
  4273. ++ struct ath_vif *avp;
  4274. +
  4275. +- /* tsf_adjust is added to the TSF value. We send out the beacon late,
  4276. +- * so need to adjust the TSF starting point to be later in time (i.e.
  4277. +- * the theoretical first beacon has a TSF of 0 after correction).
  4278. +- */
  4279. +- tsfadjust = cur_conf->beacon_interval * avp->av_bslot;
  4280. +- tsfadjust = -TU_TO_USEC(tsfadjust) / ATH_BCBUF;
  4281. +- avp->tsf_adjust = cpu_to_le64(tsfadjust);
  4282. ++ if (!sc->beacon.bslot[slot])
  4283. ++ continue;
  4284. +
  4285. +- ath_dbg(common, CONFIG, "tsfadjust is: %lld for bslot: %d\n",
  4286. +- (signed long long)tsfadjust, avp->av_bslot);
  4287. ++ avp = (void *)sc->beacon.bslot[slot]->drv_priv;
  4288. ++
  4289. ++ /* tsf_adjust is added to the TSF value. We send out the
  4290. ++ * beacon late, so need to adjust the TSF starting point to be
  4291. ++ * later in time (i.e. the theoretical first beacon has a TSF
  4292. ++ * of 0 after correction).
  4293. ++ */
  4294. ++ tsfadjust = cur_conf->beacon_interval * avp->av_bslot;
  4295. ++ tsfadjust = -TU_TO_USEC(tsfadjust) / ATH_BCBUF;
  4296. ++ avp->tsf_adjust = cpu_to_le64(tsfadjust);
  4297. ++
  4298. ++ ath_dbg(common, CONFIG, "tsfadjust is: %lld for bslot: %d\n",
  4299. ++ (signed long long)tsfadjust, avp->av_bslot);
  4300. ++ }
  4301. + }
  4302. +
  4303. + bool ath9k_csa_is_finished(struct ath_softc *sc, struct ieee80211_vif *vif)
  4304. +@@ -447,20 +511,28 @@ void ath9k_beacon_tasklet(unsigned long
  4305. + * Both nexttbtt and intval have to be in usecs.
  4306. + */
  4307. + static void ath9k_beacon_init(struct ath_softc *sc, u32 nexttbtt,
  4308. +- u32 intval, bool reset_tsf)
  4309. ++ u32 intval)
  4310. + {
  4311. + struct ath_hw *ah = sc->sc_ah;
  4312. +
  4313. + ath9k_hw_disable_interrupts(ah);
  4314. +- if (reset_tsf)
  4315. +- ath9k_hw_reset_tsf(ah);
  4316. + ath9k_beaconq_config(sc);
  4317. + ath9k_hw_beaconinit(ah, nexttbtt, intval);
  4318. ++ ah->imask |= ATH9K_INT_SWBA;
  4319. + sc->beacon.bmisscnt = 0;
  4320. + ath9k_hw_set_interrupts(ah);
  4321. + ath9k_hw_enable_interrupts(ah);
  4322. + }
  4323. +
  4324. ++static void ath9k_beacon_stop(struct ath_softc *sc)
  4325. ++{
  4326. ++ ath9k_hw_disable_interrupts(sc->sc_ah);
  4327. ++ sc->sc_ah->imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS);
  4328. ++ sc->beacon.bmisscnt = 0;
  4329. ++ ath9k_hw_set_interrupts(sc->sc_ah);
  4330. ++ ath9k_hw_enable_interrupts(sc->sc_ah);
  4331. ++}
  4332. ++
  4333. + /*
  4334. + * For multi-bss ap support beacons are either staggered evenly over N slots or
  4335. + * burst together. For the former arrange for the SWBA to be delivered for each
  4336. +@@ -472,7 +544,7 @@ static void ath9k_beacon_config_ap(struc
  4337. + struct ath_hw *ah = sc->sc_ah;
  4338. +
  4339. + ath9k_cmn_beacon_config_ap(ah, conf, ATH_BCBUF);
  4340. +- ath9k_beacon_init(sc, conf->nexttbtt, conf->intval, false);
  4341. ++ ath9k_beacon_init(sc, conf->nexttbtt, conf->intval);
  4342. + }
  4343. +
  4344. + static void ath9k_beacon_config_sta(struct ath_hw *ah,
  4345. +@@ -501,7 +573,7 @@ static void ath9k_beacon_config_adhoc(st
  4346. +
  4347. + ath9k_cmn_beacon_config_adhoc(ah, conf);
  4348. +
  4349. +- ath9k_beacon_init(sc, conf->nexttbtt, conf->intval, conf->ibss_creator);
  4350. ++ ath9k_beacon_init(sc, conf->nexttbtt, conf->intval);
  4351. +
  4352. + /*
  4353. + * Set the global 'beacon has been configured' flag for the
  4354. +@@ -511,44 +583,6 @@ static void ath9k_beacon_config_adhoc(st
  4355. + set_bit(ATH_OP_BEACONS, &common->op_flags);
  4356. + }
  4357. +
  4358. +-static bool ath9k_allow_beacon_config(struct ath_softc *sc,
  4359. +- struct ieee80211_vif *vif)
  4360. +-{
  4361. +- struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  4362. +- struct ath_vif *avp = (void *)vif->drv_priv;
  4363. +-
  4364. +- if (ath9k_is_chanctx_enabled()) {
  4365. +- /*
  4366. +- * If the VIF is not present in the current channel context,
  4367. +- * then we can't do the usual opmode checks. Allow the
  4368. +- * beacon config for the VIF to be updated in this case and
  4369. +- * return immediately.
  4370. +- */
  4371. +- if (sc->cur_chan != avp->chanctx)
  4372. +- return true;
  4373. +- }
  4374. +-
  4375. +- if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) {
  4376. +- if (vif->type != NL80211_IFTYPE_AP) {
  4377. +- ath_dbg(common, CONFIG,
  4378. +- "An AP interface is already present !\n");
  4379. +- return false;
  4380. +- }
  4381. +- }
  4382. +-
  4383. +- if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION) {
  4384. +- if ((vif->type == NL80211_IFTYPE_STATION) &&
  4385. +- test_bit(ATH_OP_BEACONS, &common->op_flags) &&
  4386. +- vif != sc->cur_chan->primary_sta) {
  4387. +- ath_dbg(common, CONFIG,
  4388. +- "Beacon already configured for a station interface\n");
  4389. +- return false;
  4390. +- }
  4391. +- }
  4392. +-
  4393. +- return true;
  4394. +-}
  4395. +-
  4396. + static void ath9k_cache_beacon_config(struct ath_softc *sc,
  4397. + struct ath_chanctx *ctx,
  4398. + struct ieee80211_bss_conf *bss_conf)
  4399. +@@ -584,87 +618,79 @@ static void ath9k_cache_beacon_config(st
  4400. + if (cur_conf->dtim_period == 0)
  4401. + cur_conf->dtim_period = 1;
  4402. +
  4403. ++ ath9k_set_tsfadjust(sc, cur_conf);
  4404. + }
  4405. +
  4406. +-void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif,
  4407. +- u32 changed)
  4408. ++void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *main_vif,
  4409. ++ bool beacons)
  4410. + {
  4411. +- struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
  4412. +- struct ath_hw *ah = sc->sc_ah;
  4413. +- struct ath_common *common = ath9k_hw_common(ah);
  4414. +- struct ath_vif *avp = (void *)vif->drv_priv;
  4415. +- struct ath_chanctx *ctx = avp->chanctx;
  4416. ++ struct ath_hw *ah = sc->sc_ah;
  4417. ++ struct ath_common *common = ath9k_hw_common(ah);
  4418. ++ struct ath_vif *avp;
  4419. ++ struct ath_chanctx *ctx;
  4420. + struct ath_beacon_config *cur_conf;
  4421. + unsigned long flags;
  4422. ++ bool enabled;
  4423. + bool skip_beacon = false;
  4424. +
  4425. +- if (!ctx)
  4426. ++ if (!beacons) {
  4427. ++ clear_bit(ATH_OP_BEACONS, &common->op_flags);
  4428. ++ ath9k_beacon_stop(sc);
  4429. + return;
  4430. ++ }
  4431. +
  4432. +- cur_conf = &avp->chanctx->beacon;
  4433. +- if (vif->type == NL80211_IFTYPE_AP)
  4434. +- ath9k_set_tsfadjust(sc, vif);
  4435. +-
  4436. +- if (!ath9k_allow_beacon_config(sc, vif))
  4437. ++ if (WARN_ON(!main_vif))
  4438. + return;
  4439. +
  4440. +- if (vif->type == NL80211_IFTYPE_STATION) {
  4441. +- ath9k_cache_beacon_config(sc, ctx, bss_conf);
  4442. +- if (ctx != sc->cur_chan)
  4443. +- return;
  4444. ++ avp = (void *)main_vif->drv_priv;
  4445. ++ ctx = avp->chanctx;
  4446. ++ cur_conf = &ctx->beacon;
  4447. ++ enabled = cur_conf->enable_beacon;
  4448. ++ cur_conf->enable_beacon = beacons;
  4449. ++
  4450. ++ if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION) {
  4451. ++ ath9k_cache_beacon_config(sc, ctx, &main_vif->bss_conf);
  4452. +
  4453. + ath9k_set_beacon(sc);
  4454. + set_bit(ATH_OP_BEACONS, &common->op_flags);
  4455. + return;
  4456. + }
  4457. +
  4458. +- /*
  4459. +- * Take care of multiple interfaces when
  4460. +- * enabling/disabling SWBA.
  4461. +- */
  4462. +- if (changed & BSS_CHANGED_BEACON_ENABLED) {
  4463. +- bool enabled = cur_conf->enable_beacon;
  4464. +-
  4465. +- if (!bss_conf->enable_beacon) {
  4466. +- cur_conf->enable_beacon &= ~BIT(avp->av_bslot);
  4467. +- } else {
  4468. +- cur_conf->enable_beacon |= BIT(avp->av_bslot);
  4469. +- if (!enabled)
  4470. +- ath9k_cache_beacon_config(sc, ctx, bss_conf);
  4471. +- }
  4472. +- }
  4473. +-
  4474. +- if (ctx != sc->cur_chan)
  4475. +- return;
  4476. ++ /* Update the beacon configuration. */
  4477. ++ ath9k_cache_beacon_config(sc, ctx, &main_vif->bss_conf);
  4478. +
  4479. + /*
  4480. + * Configure the HW beacon registers only when we have a valid
  4481. + * beacon interval.
  4482. + */
  4483. + if (cur_conf->beacon_interval) {
  4484. +- /*
  4485. +- * If we are joining an existing IBSS network, start beaconing
  4486. +- * only after a TSF-sync has taken place. Ensure that this
  4487. +- * happens by setting the appropriate flags.
  4488. ++ /* Special case to sync the TSF when joining an existing IBSS.
  4489. ++ * This is only done if no AP interface is active.
  4490. ++ * Note that mac80211 always resets the TSF when creating a new
  4491. ++ * IBSS interface.
  4492. + */
  4493. +- if ((changed & BSS_CHANGED_IBSS) && !bss_conf->ibss_creator &&
  4494. +- bss_conf->enable_beacon) {
  4495. ++ if (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC &&
  4496. ++ !enabled && beacons && !main_vif->bss_conf.ibss_creator) {
  4497. + spin_lock_irqsave(&sc->sc_pm_lock, flags);
  4498. + sc->ps_flags |= PS_BEACON_SYNC | PS_WAIT_FOR_BEACON;
  4499. + spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
  4500. + skip_beacon = true;
  4501. +- } else {
  4502. +- ath9k_set_beacon(sc);
  4503. + }
  4504. +
  4505. + /*
  4506. + * Do not set the ATH_OP_BEACONS flag for IBSS joiner mode
  4507. + * here, it is done in ath9k_beacon_config_adhoc().
  4508. + */
  4509. +- if (cur_conf->enable_beacon && !skip_beacon)
  4510. ++ if (beacons && !skip_beacon) {
  4511. + set_bit(ATH_OP_BEACONS, &common->op_flags);
  4512. +- else
  4513. ++ ath9k_set_beacon(sc);
  4514. ++ } else {
  4515. + clear_bit(ATH_OP_BEACONS, &common->op_flags);
  4516. ++ ath9k_beacon_stop(sc);
  4517. ++ }
  4518. ++ } else {
  4519. ++ clear_bit(ATH_OP_BEACONS, &common->op_flags);
  4520. ++ ath9k_beacon_stop(sc);
  4521. + }
  4522. + }
  4523. +
  4524. +--- a/drivers/net/wireless/ath/ath9k/common.h
  4525. ++++ b/drivers/net/wireless/ath/ath9k/common.h
  4526. +@@ -50,6 +50,7 @@
  4527. + #define IEEE80211_MS_TO_TU(x) (((x) * 1000) / 1024)
  4528. +
  4529. + struct ath_beacon_config {
  4530. ++ struct ieee80211_vif *main_vif;
  4531. + int beacon_interval;
  4532. + u16 dtim_period;
  4533. + u16 bmiss_timeout;
  4534. +--- a/drivers/net/wireless/ath/ath9k/main.c
  4535. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  4536. +@@ -910,6 +910,22 @@ static bool ath9k_uses_beacons(int type)
  4537. + }
  4538. + }
  4539. +
  4540. ++static void ath9k_vif_iter_set_beacon(struct ath9k_vif_iter_data *iter_data,
  4541. ++ struct ieee80211_vif *vif)
  4542. ++{
  4543. ++ /* Use the first (configured) interface, but prefering AP interfaces. */
  4544. ++ if (!iter_data->primary_beacon_vif) {
  4545. ++ iter_data->primary_beacon_vif = vif;
  4546. ++ } else {
  4547. ++ if (iter_data->primary_beacon_vif->type != NL80211_IFTYPE_AP &&
  4548. ++ vif->type == NL80211_IFTYPE_AP)
  4549. ++ iter_data->primary_beacon_vif = vif;
  4550. ++ }
  4551. ++
  4552. ++ iter_data->beacons = true;
  4553. ++ iter_data->nbcnvifs += 1;
  4554. ++}
  4555. ++
  4556. + static void ath9k_vif_iter(struct ath9k_vif_iter_data *iter_data,
  4557. + u8 *mac, struct ieee80211_vif *vif)
  4558. + {
  4559. +@@ -931,6 +947,8 @@ static void ath9k_vif_iter(struct ath9k_
  4560. + switch (vif->type) {
  4561. + case NL80211_IFTYPE_AP:
  4562. + iter_data->naps++;
  4563. ++ if (vif->bss_conf.enable_beacon)
  4564. ++ ath9k_vif_iter_set_beacon(iter_data, vif);
  4565. + break;
  4566. + case NL80211_IFTYPE_STATION:
  4567. + iter_data->nstations++;
  4568. +@@ -943,12 +961,12 @@ static void ath9k_vif_iter(struct ath9k_
  4569. + case NL80211_IFTYPE_ADHOC:
  4570. + iter_data->nadhocs++;
  4571. + if (vif->bss_conf.enable_beacon)
  4572. +- iter_data->beacons = true;
  4573. ++ ath9k_vif_iter_set_beacon(iter_data, vif);
  4574. + break;
  4575. + case NL80211_IFTYPE_MESH_POINT:
  4576. + iter_data->nmeshes++;
  4577. + if (vif->bss_conf.enable_beacon)
  4578. +- iter_data->beacons = true;
  4579. ++ ath9k_vif_iter_set_beacon(iter_data, vif);
  4580. + break;
  4581. + case NL80211_IFTYPE_WDS:
  4582. + iter_data->nwds++;
  4583. +@@ -1081,7 +1099,6 @@ void ath9k_calculate_summary_state(struc
  4584. + struct ath_hw *ah = sc->sc_ah;
  4585. + struct ath_common *common = ath9k_hw_common(ah);
  4586. + struct ath9k_vif_iter_data iter_data;
  4587. +- struct ath_beacon_config *cur_conf;
  4588. +
  4589. + ath_chanctx_check_active(sc, ctx);
  4590. +
  4591. +@@ -1103,13 +1120,12 @@ void ath9k_calculate_summary_state(struc
  4592. + ath_hw_setbssidmask(common);
  4593. +
  4594. + if (iter_data.naps > 0) {
  4595. +- cur_conf = &ctx->beacon;
  4596. + ath9k_hw_set_tsfadjust(ah, true);
  4597. + ah->opmode = NL80211_IFTYPE_AP;
  4598. +- if (cur_conf->enable_beacon)
  4599. +- iter_data.beacons = true;
  4600. + } else {
  4601. + ath9k_hw_set_tsfadjust(ah, false);
  4602. ++ if (iter_data.beacons)
  4603. ++ ath9k_beacon_ensure_primary_slot(sc);
  4604. +
  4605. + if (iter_data.nmeshes)
  4606. + ah->opmode = NL80211_IFTYPE_MESH_POINT;
  4607. +@@ -1134,7 +1150,6 @@ void ath9k_calculate_summary_state(struc
  4608. + ctx->switch_after_beacon = true;
  4609. + }
  4610. +
  4611. +- ah->imask &= ~ATH9K_INT_SWBA;
  4612. + if (ah->opmode == NL80211_IFTYPE_STATION) {
  4613. + bool changed = (iter_data.primary_sta != ctx->primary_sta);
  4614. +
  4615. +@@ -1151,16 +1166,12 @@ void ath9k_calculate_summary_state(struc
  4616. + if (ath9k_hw_mci_is_enabled(sc->sc_ah))
  4617. + ath9k_mci_update_wlan_channels(sc, true);
  4618. + }
  4619. +- } else if (iter_data.beacons) {
  4620. +- ah->imask |= ATH9K_INT_SWBA;
  4621. + }
  4622. ++ sc->nbcnvifs = iter_data.nbcnvifs;
  4623. ++ ath9k_beacon_config(sc, iter_data.primary_beacon_vif,
  4624. ++ iter_data.beacons);
  4625. + ath9k_hw_set_interrupts(ah);
  4626. +
  4627. +- if (iter_data.beacons)
  4628. +- set_bit(ATH_OP_BEACONS, &common->op_flags);
  4629. +- else
  4630. +- clear_bit(ATH_OP_BEACONS, &common->op_flags);
  4631. +-
  4632. + if (ah->slottime != iter_data.slottime) {
  4633. + ah->slottime = iter_data.slottime;
  4634. + ath9k_hw_init_global_settings(ah);
  4635. +@@ -1777,9 +1788,7 @@ static void ath9k_bss_info_changed(struc
  4636. + if ((changed & BSS_CHANGED_BEACON_ENABLED) ||
  4637. + (changed & BSS_CHANGED_BEACON_INT) ||
  4638. + (changed & BSS_CHANGED_BEACON_INFO)) {
  4639. +- ath9k_beacon_config(sc, vif, changed);
  4640. +- if (changed & BSS_CHANGED_BEACON_ENABLED)
  4641. +- ath9k_calculate_summary_state(sc, avp->chanctx);
  4642. ++ ath9k_calculate_summary_state(sc, avp->chanctx);
  4643. + }
  4644. +
  4645. + if ((avp->chanctx == sc->cur_chan) &&
  4646. 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
  4647. deleted file mode 100644
  4648. index 5bf53b9..0000000
  4649. --- a/package/kernel/mac80211/patches/317-mac80211-minstrel_ht-fix-out-of-bound-in-minstrel_ht.patch
  4650. +++ /dev/null
  4651. @@ -1,45 +0,0 @@
  4652. -From: Konstantin Khlebnikov <koct9i@gmail.com>
  4653. -Date: Fri, 29 Jan 2016 11:35:12 +0300
  4654. -Subject: [PATCH] mac80211: minstrel_ht: fix out-of-bound in
  4655. - minstrel_ht_set_best_prob_rate
  4656. -
  4657. -Patch fixes this splat
  4658. -
  4659. -BUG: KASAN: slab-out-of-bounds in minstrel_ht_update_stats.isra.7+0x6e1/0x9e0
  4660. -[mac80211] at addr ffff8800cee640f4 Read of size 4 by task swapper/3/0
  4661. -
  4662. -Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
  4663. -Link: http://lkml.kernel.org/r/CALYGNiNyJhSaVnE35qS6UCGaSb2Dx1_i5HcRavuOX14oTz2P+w@mail.gmail.com
  4664. ----
  4665. -
  4666. ---- a/net/mac80211/rc80211_minstrel_ht.c
  4667. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  4668. -@@ -414,15 +414,16 @@ minstrel_ht_set_best_prob_rate(struct mi
  4669. - (max_tp_group != MINSTREL_CCK_GROUP))
  4670. - return;
  4671. -
  4672. -+ max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES;
  4673. -+ max_gpr_idx = mg->max_group_prob_rate % MCS_GROUP_RATES;
  4674. -+ max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_ewma;
  4675. -+
  4676. - if (mrs->prob_ewma > MINSTREL_FRAC(75, 100)) {
  4677. - cur_tp_avg = minstrel_ht_get_tp_avg(mi, cur_group, cur_idx,
  4678. - mrs->prob_ewma);
  4679. - if (cur_tp_avg > tmp_tp_avg)
  4680. - mi->max_prob_rate = index;
  4681. -
  4682. -- max_gpr_group = mg->max_group_prob_rate / MCS_GROUP_RATES;
  4683. -- max_gpr_idx = mg->max_group_prob_rate % MCS_GROUP_RATES;
  4684. -- max_gpr_prob = mi->groups[max_gpr_group].rates[max_gpr_idx].prob_ewma;
  4685. - max_gpr_tp_avg = minstrel_ht_get_tp_avg(mi, max_gpr_group,
  4686. - max_gpr_idx,
  4687. - max_gpr_prob);
  4688. -@@ -431,7 +432,7 @@ minstrel_ht_set_best_prob_rate(struct mi
  4689. - } else {
  4690. - if (mrs->prob_ewma > tmp_prob)
  4691. - mi->max_prob_rate = index;
  4692. -- if (mrs->prob_ewma > mg->rates[mg->max_group_prob_rate].prob_ewma)
  4693. -+ if (mrs->prob_ewma > max_gpr_prob)
  4694. - mg->max_group_prob_rate = index;
  4695. - }
  4696. - }
  4697. diff --git a/package/kernel/mac80211/patches/318-brcmfmac-slightly-simplify-building-interface-combin.patch b/package/kernel/mac80211/patches/318-brcmfmac-slightly-simplify-building-interface-combin.patch
  4698. new file mode 100644
  4699. index 0000000..d946ecc
  4700. --- /dev/null
  4701. +++ b/package/kernel/mac80211/patches/318-brcmfmac-slightly-simplify-building-interface-combin.patch
  4702. @@ -0,0 +1,108 @@
  4703. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4704. +Date: Tue, 7 Jun 2016 21:10:18 +0200
  4705. +Subject: [PATCH] brcmfmac: slightly simplify building interface combinations
  4706. +MIME-Version: 1.0
  4707. +Content-Type: text/plain; charset=UTF-8
  4708. +Content-Transfer-Encoding: 8bit
  4709. +
  4710. +This change reorders some operations in brcmf_setup_ifmodes in hope to
  4711. +make it simpler:
  4712. +1) It allocates arrays right before filling them. This way it's easier
  4713. + to follow requested array length as it's immediately followed by
  4714. + code filling it. It's easier to check e.g. why we need 4 entries for
  4715. + P2P. Other than that it deduplicates some checks (e.g. for P2P).
  4716. +2) It reorders code to first prepare limits and then define a new combo.
  4717. + Previously this was mixed (e.g. we were setting num of channels
  4718. + before preparing limits).
  4719. +3) It modifies mbss code to use i variable just like other combos do.
  4720. +
  4721. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4722. +Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  4723. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4724. +---
  4725. +
  4726. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  4727. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  4728. +@@ -6284,29 +6284,15 @@ static int brcmf_setup_ifmodes(struct wi
  4729. + if (!combo)
  4730. + goto err;
  4731. +
  4732. +- c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
  4733. +- if (!c0_limits)
  4734. +- goto err;
  4735. +-
  4736. +- if (p2p) {
  4737. +- p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
  4738. +- if (!p2p_limits)
  4739. +- goto err;
  4740. +- }
  4741. +-
  4742. +- if (mbss) {
  4743. +- mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
  4744. +- if (!mbss_limits)
  4745. +- goto err;
  4746. +- }
  4747. +-
  4748. + wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
  4749. + BIT(NL80211_IFTYPE_ADHOC) |
  4750. + BIT(NL80211_IFTYPE_AP);
  4751. +
  4752. + c = 0;
  4753. + i = 0;
  4754. +- combo[c].num_different_channels = 1;
  4755. ++ c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
  4756. ++ if (!c0_limits)
  4757. ++ goto err;
  4758. + c0_limits[i].max = 1;
  4759. + c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  4760. + if (p2p) {
  4761. +@@ -6324,6 +6310,7 @@ static int brcmf_setup_ifmodes(struct wi
  4762. + c0_limits[i].max = 1;
  4763. + c0_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  4764. + }
  4765. ++ combo[c].num_different_channels = 1;
  4766. + combo[c].max_interfaces = i;
  4767. + combo[c].n_limits = i;
  4768. + combo[c].limits = c0_limits;
  4769. +@@ -6331,7 +6318,9 @@ static int brcmf_setup_ifmodes(struct wi
  4770. + if (p2p) {
  4771. + c++;
  4772. + i = 0;
  4773. +- combo[c].num_different_channels = 1;
  4774. ++ p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
  4775. ++ if (!p2p_limits)
  4776. ++ goto err;
  4777. + p2p_limits[i].max = 1;
  4778. + p2p_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
  4779. + p2p_limits[i].max = 1;
  4780. +@@ -6340,6 +6329,7 @@ static int brcmf_setup_ifmodes(struct wi
  4781. + p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT);
  4782. + p2p_limits[i].max = 1;
  4783. + p2p_limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
  4784. ++ combo[c].num_different_channels = 1;
  4785. + combo[c].max_interfaces = i;
  4786. + combo[c].n_limits = i;
  4787. + combo[c].limits = p2p_limits;
  4788. +@@ -6347,14 +6337,19 @@ static int brcmf_setup_ifmodes(struct wi
  4789. +
  4790. + if (mbss) {
  4791. + c++;
  4792. ++ i = 0;
  4793. ++ mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
  4794. ++ if (!mbss_limits)
  4795. ++ goto err;
  4796. ++ mbss_limits[i].max = 4;
  4797. ++ mbss_limits[i++].types = BIT(NL80211_IFTYPE_AP);
  4798. + combo[c].beacon_int_infra_match = true;
  4799. + combo[c].num_different_channels = 1;
  4800. +- mbss_limits[0].max = 4;
  4801. +- mbss_limits[0].types = BIT(NL80211_IFTYPE_AP);
  4802. + combo[c].max_interfaces = 4;
  4803. +- combo[c].n_limits = 1;
  4804. ++ combo[c].n_limits = i;
  4805. + combo[c].limits = mbss_limits;
  4806. + }
  4807. ++
  4808. + wiphy->n_iface_combinations = n_combos;
  4809. + wiphy->iface_combinations = combo;
  4810. + return 0;
  4811. 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
  4812. deleted file mode 100644
  4813. index 655dc4b..0000000
  4814. --- a/package/kernel/mac80211/patches/318-mac80211-move-A-MSDU-skb_linearize-call-to-ieee80211.patch
  4815. +++ /dev/null
  4816. @@ -1,35 +0,0 @@
  4817. -From: Felix Fietkau <nbd@openwrt.org>
  4818. -Date: Tue, 2 Feb 2016 14:39:08 +0100
  4819. -Subject: [PATCH] mac80211: move A-MSDU skb_linearize call to
  4820. - ieee80211_amsdu_to_8023s
  4821. -
  4822. -Prepararation for zero-copy A-MSDU support with page fragment SKBs
  4823. -
  4824. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  4825. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  4826. ----
  4827. -
  4828. ---- a/net/mac80211/rx.c
  4829. -+++ b/net/mac80211/rx.c
  4830. -@@ -2203,9 +2203,6 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx
  4831. - skb->dev = dev;
  4832. - __skb_queue_head_init(&frame_list);
  4833. -
  4834. -- if (skb_linearize(skb))
  4835. -- return RX_DROP_UNUSABLE;
  4836. --
  4837. - ieee80211_amsdu_to_8023s(skb, &frame_list, dev->dev_addr,
  4838. - rx->sdata->vif.type,
  4839. - rx->local->hw.extra_tx_headroom, true);
  4840. ---- a/net/wireless/util.c
  4841. -+++ b/net/wireless/util.c
  4842. -@@ -657,6 +657,9 @@ void ieee80211_amsdu_to_8023s(struct sk_
  4843. - int remaining, err;
  4844. - u8 dst[ETH_ALEN], src[ETH_ALEN];
  4845. -
  4846. -+ if (skb_linearize(skb))
  4847. -+ goto out;
  4848. -+
  4849. - if (has_80211_header) {
  4850. - err = ieee80211_data_to_8023(skb, addr, iftype);
  4851. - if (err)
  4852. diff --git a/package/kernel/mac80211/patches/319-0001-brcmfmac-fix-lockup-when-removing-P2P-interface-afte.patch b/package/kernel/mac80211/patches/319-0001-brcmfmac-fix-lockup-when-removing-P2P-interface-afte.patch
  4853. new file mode 100644
  4854. index 0000000..073d012
  4855. --- /dev/null
  4856. +++ b/package/kernel/mac80211/patches/319-0001-brcmfmac-fix-lockup-when-removing-P2P-interface-afte.patch
  4857. @@ -0,0 +1,154 @@
  4858. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  4859. +Date: Fri, 17 Jun 2016 12:29:21 +0200
  4860. +Subject: [PATCH] brcmfmac: fix lockup when removing P2P interface after
  4861. + event timeout
  4862. +MIME-Version: 1.0
  4863. +Content-Type: text/plain; charset=UTF-8
  4864. +Content-Transfer-Encoding: 8bit
  4865. +
  4866. +Removing P2P interface is handled by sending a proper request to the
  4867. +firmware. On success firmware triggers an event and driver's handler
  4868. +removes a matching interface.
  4869. +
  4870. +However on event timeout we remove interface directly from the cfg80211
  4871. +callback. Current code doesn't handle this case correctly as it always
  4872. +assumes rtnl to be unlocked.
  4873. +
  4874. +Fix it by adding an extra rtnl_locked parameter to functions and calling
  4875. +unregister_netdevice when needed.
  4876. +
  4877. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  4878. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  4879. +---
  4880. +
  4881. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  4882. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  4883. +@@ -548,12 +548,16 @@ fail:
  4884. + return -EBADE;
  4885. + }
  4886. +
  4887. +-static void brcmf_net_detach(struct net_device *ndev)
  4888. ++static void brcmf_net_detach(struct net_device *ndev, bool rtnl_locked)
  4889. + {
  4890. +- if (ndev->reg_state == NETREG_REGISTERED)
  4891. +- unregister_netdev(ndev);
  4892. +- else
  4893. ++ if (ndev->reg_state == NETREG_REGISTERED) {
  4894. ++ if (rtnl_locked)
  4895. ++ unregister_netdevice(ndev);
  4896. ++ else
  4897. ++ unregister_netdev(ndev);
  4898. ++ } else {
  4899. + brcmf_cfg80211_free_netdev(ndev);
  4900. ++ }
  4901. + }
  4902. +
  4903. + void brcmf_net_setcarrier(struct brcmf_if *ifp, bool on)
  4904. +@@ -651,7 +655,7 @@ struct brcmf_if *brcmf_add_if(struct brc
  4905. + brcmf_err("ERROR: netdev:%s already exists\n",
  4906. + ifp->ndev->name);
  4907. + netif_stop_queue(ifp->ndev);
  4908. +- brcmf_net_detach(ifp->ndev);
  4909. ++ brcmf_net_detach(ifp->ndev, false);
  4910. + drvr->iflist[bsscfgidx] = NULL;
  4911. + } else {
  4912. + brcmf_dbg(INFO, "netdev:%s ignore IF event\n",
  4913. +@@ -699,7 +703,8 @@ struct brcmf_if *brcmf_add_if(struct brc
  4914. + return ifp;
  4915. + }
  4916. +
  4917. +-static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx)
  4918. ++static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx,
  4919. ++ bool rtnl_locked)
  4920. + {
  4921. + struct brcmf_if *ifp;
  4922. +
  4923. +@@ -729,7 +734,7 @@ static void brcmf_del_if(struct brcmf_pu
  4924. + cancel_work_sync(&ifp->multicast_work);
  4925. + cancel_work_sync(&ifp->ndoffload_work);
  4926. + }
  4927. +- brcmf_net_detach(ifp->ndev);
  4928. ++ brcmf_net_detach(ifp->ndev, rtnl_locked);
  4929. + } else {
  4930. + /* Only p2p device interfaces which get dynamically created
  4931. + * end up here. In this case the p2p module should be informed
  4932. +@@ -743,14 +748,14 @@ static void brcmf_del_if(struct brcmf_pu
  4933. + }
  4934. + }
  4935. +
  4936. +-void brcmf_remove_interface(struct brcmf_if *ifp)
  4937. ++void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked)
  4938. + {
  4939. + if (!ifp || WARN_ON(ifp->drvr->iflist[ifp->bsscfgidx] != ifp))
  4940. + return;
  4941. + brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", ifp->bsscfgidx,
  4942. + ifp->ifidx);
  4943. + brcmf_fws_del_interface(ifp);
  4944. +- brcmf_del_if(ifp->drvr, ifp->bsscfgidx);
  4945. ++ brcmf_del_if(ifp->drvr, ifp->bsscfgidx, rtnl_locked);
  4946. + }
  4947. +
  4948. + #ifdef CONFIG_INET
  4949. +@@ -1057,9 +1062,9 @@ fail:
  4950. + brcmf_fws_deinit(drvr);
  4951. + }
  4952. + if (ifp)
  4953. +- brcmf_net_detach(ifp->ndev);
  4954. ++ brcmf_net_detach(ifp->ndev, false);
  4955. + if (p2p_ifp)
  4956. +- brcmf_net_detach(p2p_ifp->ndev);
  4957. ++ brcmf_net_detach(p2p_ifp->ndev, false);
  4958. + drvr->iflist[0] = NULL;
  4959. + drvr->iflist[1] = NULL;
  4960. + if (drvr->settings->ignore_probe_fail)
  4961. +@@ -1128,7 +1133,7 @@ void brcmf_detach(struct device *dev)
  4962. +
  4963. + /* make sure primary interface removed last */
  4964. + for (i = BRCMF_MAX_IFS-1; i > -1; i--)
  4965. +- brcmf_remove_interface(drvr->iflist[i]);
  4966. ++ brcmf_remove_interface(drvr->iflist[i], false);
  4967. +
  4968. + brcmf_cfg80211_detach(drvr->config);
  4969. +
  4970. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  4971. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  4972. +@@ -216,7 +216,7 @@ struct brcmf_if *brcmf_get_ifp(struct br
  4973. + int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  4974. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  4975. + bool is_p2pdev, char *name, u8 *mac_addr);
  4976. +-void brcmf_remove_interface(struct brcmf_if *ifp);
  4977. ++void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked);
  4978. + void brcmf_txflowblock_if(struct brcmf_if *ifp,
  4979. + enum brcmf_netif_stop_reason reason, bool state);
  4980. + void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success);
  4981. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  4982. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  4983. +@@ -183,7 +183,7 @@ static void brcmf_fweh_handle_if_event(s
  4984. + err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
  4985. +
  4986. + if (ifp && ifevent->action == BRCMF_E_IF_DEL)
  4987. +- brcmf_remove_interface(ifp);
  4988. ++ brcmf_remove_interface(ifp, false);
  4989. + }
  4990. +
  4991. + /**
  4992. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4993. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  4994. +@@ -2289,7 +2289,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  4995. + err = 0;
  4996. + }
  4997. + if (err)
  4998. +- brcmf_remove_interface(vif->ifp);
  4999. ++ brcmf_remove_interface(vif->ifp, true);
  5000. +
  5001. + brcmf_cfg80211_arm_vif_event(cfg, NULL);
  5002. + if (vif->wdev.iftype != NL80211_IFTYPE_P2P_DEVICE)
  5003. +@@ -2395,7 +2395,7 @@ void brcmf_p2p_detach(struct brcmf_p2p_i
  5004. + if (vif != NULL) {
  5005. + brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  5006. + brcmf_p2p_deinit_discovery(p2p);
  5007. +- brcmf_remove_interface(vif->ifp);
  5008. ++ brcmf_remove_interface(vif->ifp, false);
  5009. + }
  5010. + /* just set it all to zero */
  5011. + memset(p2p, 0, sizeof(*p2p));
  5012. diff --git a/package/kernel/mac80211/patches/319-0002-brcmfmac-use-const-char-for-interface-name-in-brcmf_.patch b/package/kernel/mac80211/patches/319-0002-brcmfmac-use-const-char-for-interface-name-in-brcmf_.patch
  5013. new file mode 100644
  5014. index 0000000..6d3f3c6
  5015. --- /dev/null
  5016. +++ b/package/kernel/mac80211/patches/319-0002-brcmfmac-use-const-char-for-interface-name-in-brcmf_.patch
  5017. @@ -0,0 +1,40 @@
  5018. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  5019. +Date: Fri, 17 Jun 2016 12:48:44 +0200
  5020. +Subject: [PATCH] brcmfmac: use const char * for interface name in
  5021. + brcmf_add_if
  5022. +MIME-Version: 1.0
  5023. +Content-Type: text/plain; charset=UTF-8
  5024. +Content-Transfer-Encoding: 8bit
  5025. +
  5026. +This function can work just fine with const pointer, it only calls
  5027. +alloc_netdev which take const as well. Moreover it makes this function
  5028. +more flexible as some cfg80211 callback may provide const char * as
  5029. +well, e.g. add_virtual_intf. This will be needed for more advanced
  5030. +interface management.
  5031. +
  5032. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  5033. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  5034. +---
  5035. +
  5036. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  5037. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  5038. +@@ -638,7 +638,7 @@ fail:
  5039. + }
  5040. +
  5041. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  5042. +- bool is_p2pdev, char *name, u8 *mac_addr)
  5043. ++ bool is_p2pdev, const char *name, u8 *mac_addr)
  5044. + {
  5045. + struct brcmf_if *ifp;
  5046. + struct net_device *ndev;
  5047. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  5048. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
  5049. +@@ -215,7 +215,7 @@ char *brcmf_ifname(struct brcmf_if *ifp)
  5050. + struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx);
  5051. + int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked);
  5052. + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
  5053. +- bool is_p2pdev, char *name, u8 *mac_addr);
  5054. ++ bool is_p2pdev, const char *name, u8 *mac_addr);
  5055. + void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked);
  5056. + void brcmf_txflowblock_if(struct brcmf_if *ifp,
  5057. + enum brcmf_netif_stop_reason reason, bool state);
  5058. diff --git a/package/kernel/mac80211/patches/319-0003-brcmfmac-include-also-core.h-header-in-cfg80211.h.patch b/package/kernel/mac80211/patches/319-0003-brcmfmac-include-also-core.h-header-in-cfg80211.h.patch
  5059. new file mode 100644
  5060. index 0000000..eeda766
  5061. --- /dev/null
  5062. +++ b/package/kernel/mac80211/patches/319-0003-brcmfmac-include-also-core.h-header-in-cfg80211.h.patch
  5063. @@ -0,0 +1,33 @@
  5064. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  5065. +Date: Sat, 18 Jun 2016 18:49:38 +0200
  5066. +Subject: [PATCH] brcmfmac: include also core.h header in cfg80211.h
  5067. +MIME-Version: 1.0
  5068. +Content-Type: text/plain; charset=UTF-8
  5069. +Content-Transfer-Encoding: 8bit
  5070. +
  5071. +This header provides two inline functions using struct brcmf_if so we
  5072. +need core.h to avoid:
  5073. +
  5074. +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h: In function ‘ndev_to_prof’:
  5075. +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:368:13: error: dereferencing pointer to incomplete type
  5076. + return &ifp->vif->profile;
  5077. + ^
  5078. +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h: In function ‘ndev_to_vif’:
  5079. +drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h:374:12: error: dereferencing pointer to incomplete type
  5080. + return ifp->vif;
  5081. + ^
  5082. +
  5083. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  5084. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  5085. +---
  5086. +
  5087. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  5088. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
  5089. +@@ -20,6 +20,7 @@
  5090. + /* for brcmu_d11inf */
  5091. + #include <brcmu_d11.h>
  5092. +
  5093. ++#include "core.h"
  5094. + #include "fwil_types.h"
  5095. + #include "p2p.h"
  5096. +
  5097. diff --git a/package/kernel/mac80211/patches/319-0004-brcmfmac-add-missing-break-when-deleting-P2P_DEVICE.patch b/package/kernel/mac80211/patches/319-0004-brcmfmac-add-missing-break-when-deleting-P2P_DEVICE.patch
  5098. new file mode 100644
  5099. index 0000000..3819248
  5100. --- /dev/null
  5101. +++ b/package/kernel/mac80211/patches/319-0004-brcmfmac-add-missing-break-when-deleting-P2P_DEVICE.patch
  5102. @@ -0,0 +1,27 @@
  5103. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  5104. +Date: Sun, 19 Jun 2016 01:55:57 +0200
  5105. +Subject: [PATCH] brcmfmac: add missing break when deleting P2P_DEVICE
  5106. +MIME-Version: 1.0
  5107. +Content-Type: text/plain; charset=UTF-8
  5108. +Content-Transfer-Encoding: 8bit
  5109. +
  5110. +We obviously don't want to fall through in that switch. With this change
  5111. +1) We wait for event (triggered by p2p_disc) as expected
  5112. +2) We remove interface manually on timeout
  5113. +3) We return 0 on success instead of -ENOTSUPP
  5114. +
  5115. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  5116. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  5117. +---
  5118. +
  5119. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  5120. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  5121. +@@ -2263,6 +2263,8 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  5122. + return 0;
  5123. + brcmf_p2p_cancel_remain_on_channel(vif->ifp);
  5124. + brcmf_p2p_deinit_discovery(p2p);
  5125. ++ break;
  5126. ++
  5127. + default:
  5128. + return -ENOTSUPP;
  5129. + }
  5130. diff --git a/package/kernel/mac80211/patches/319-0005-brcmfmac-delete-interface-directly-in-code-that-sent.patch b/package/kernel/mac80211/patches/319-0005-brcmfmac-delete-interface-directly-in-code-that-sent.patch
  5131. new file mode 100644
  5132. index 0000000..12d7eb4
  5133. --- /dev/null
  5134. +++ b/package/kernel/mac80211/patches/319-0005-brcmfmac-delete-interface-directly-in-code-that-sent.patch
  5135. @@ -0,0 +1,75 @@
  5136. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  5137. +Date: Wed, 29 Jun 2016 21:54:26 +0200
  5138. +Subject: [PATCH] brcmfmac: delete interface directly in code that sent fw
  5139. + request
  5140. +MIME-Version: 1.0
  5141. +Content-Type: text/plain; charset=UTF-8
  5142. +Content-Transfer-Encoding: 8bit
  5143. +
  5144. +So far when receiving event about in-firmware-interface removal our
  5145. +event worker was notifying listener and afterwards it was removing Linux
  5146. +interface.
  5147. +
  5148. +First of all it was resulting in slightly unexpected order. The listener
  5149. +(del_virtual_intf callback) was (usually) returning with success before
  5150. +we even called unregister_netdev(ice).
  5151. +
  5152. +Please note this couldn't be simply fixed by changing order of calls in
  5153. +brcmf_fweh_handle_if_event as unregistering interface earlier could free
  5154. +struct brcmf_if.
  5155. +
  5156. +Another problem of current implementation are possible lockups. Focus on
  5157. +the time slot between calling event handler and removing Linux
  5158. +interface. During that time original caller may leave (unlocking rtnl
  5159. +semaphore) *and* another call to the same code may be done (locking it
  5160. +again). If that happens our event handler will stuck at removing Linux
  5161. +interface, it won't handle another event and will block process holding
  5162. +rtnl lock.
  5163. +
  5164. +This can be simply solved by unregistering interface in a proper
  5165. +callback, right after receiving confirmation event from firmware. This
  5166. +only required modifying worker to don't unregister on its own if there
  5167. +is someone waiting for the event.
  5168. +
  5169. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  5170. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  5171. +---
  5172. +
  5173. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  5174. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
  5175. +@@ -18,6 +18,7 @@
  5176. + #include "brcmu_wifi.h"
  5177. + #include "brcmu_utils.h"
  5178. +
  5179. ++#include "cfg80211.h"
  5180. + #include "core.h"
  5181. + #include "debug.h"
  5182. + #include "tracepoint.h"
  5183. +@@ -182,8 +183,13 @@ static void brcmf_fweh_handle_if_event(s
  5184. +
  5185. + err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data);
  5186. +
  5187. +- if (ifp && ifevent->action == BRCMF_E_IF_DEL)
  5188. +- brcmf_remove_interface(ifp, false);
  5189. ++ if (ifp && ifevent->action == BRCMF_E_IF_DEL) {
  5190. ++ bool armed = brcmf_cfg80211_vif_event_armed(drvr->config);
  5191. ++
  5192. ++ /* Default handling in case no-one waits for this event */
  5193. ++ if (!armed)
  5194. ++ brcmf_remove_interface(ifp, false);
  5195. ++ }
  5196. + }
  5197. +
  5198. + /**
  5199. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  5200. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  5201. +@@ -2290,8 +2290,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiph
  5202. + else
  5203. + err = 0;
  5204. + }
  5205. +- if (err)
  5206. +- brcmf_remove_interface(vif->ifp, true);
  5207. ++ brcmf_remove_interface(vif->ifp, true);
  5208. +
  5209. + brcmf_cfg80211_arm_vif_event(cfg, NULL);
  5210. + if (vif->wdev.iftype != NL80211_IFTYPE_P2P_DEVICE)
  5211. diff --git a/package/kernel/mac80211/patches/319-0006-brcmfmac-support-removing-AP-interfaces-with-interfa.patch b/package/kernel/mac80211/patches/319-0006-brcmfmac-support-removing-AP-interfaces-with-interfa.patch
  5212. new file mode 100644
  5213. index 0000000..2f7165e
  5214. --- /dev/null
  5215. +++ b/package/kernel/mac80211/patches/319-0006-brcmfmac-support-removing-AP-interfaces-with-interfa.patch
  5216. @@ -0,0 +1,84 @@
  5217. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  5218. +Date: Wed, 29 Jun 2016 21:54:27 +0200
  5219. +Subject: [PATCH] brcmfmac: support removing AP interfaces with
  5220. + "interface_remove"
  5221. +MIME-Version: 1.0
  5222. +Content-Type: text/plain; charset=UTF-8
  5223. +Content-Transfer-Encoding: 8bit
  5224. +
  5225. +New firmwares (e.g. 10.10.69.36 for BCM4366) support "interface_remove"
  5226. +for removing interfaces. Try to use this method on cfg80211 request. In
  5227. +case of older firmwares (e.g. 7.35.177.56 for BCM43602 as I tested) this
  5228. +will just result in firmware rejecting command and this won't change any
  5229. +behavior.
  5230. +
  5231. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  5232. +Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  5233. +---
  5234. +
  5235. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  5236. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  5237. +@@ -785,12 +785,48 @@ s32 brcmf_notify_escan_complete(struct b
  5238. + return err;
  5239. + }
  5240. +
  5241. ++static int brcmf_cfg80211_del_ap_iface(struct wiphy *wiphy,
  5242. ++ struct wireless_dev *wdev)
  5243. ++{
  5244. ++ struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
  5245. ++ struct net_device *ndev = wdev->netdev;
  5246. ++ struct brcmf_if *ifp = netdev_priv(ndev);
  5247. ++ int ret;
  5248. ++ int err;
  5249. ++
  5250. ++ brcmf_cfg80211_arm_vif_event(cfg, ifp->vif);
  5251. ++
  5252. ++ err = brcmf_fil_bsscfg_data_set(ifp, "interface_remove", NULL, 0);
  5253. ++ if (err) {
  5254. ++ brcmf_err("interface_remove failed %d\n", err);
  5255. ++ goto err_unarm;
  5256. ++ }
  5257. ++
  5258. ++ /* wait for firmware event */
  5259. ++ ret = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_DEL,
  5260. ++ BRCMF_VIF_EVENT_TIMEOUT);
  5261. ++ if (!ret) {
  5262. ++ brcmf_err("timeout occurred\n");
  5263. ++ err = -EIO;
  5264. ++ goto err_unarm;
  5265. ++ }
  5266. ++
  5267. ++ brcmf_remove_interface(ifp, true);
  5268. ++
  5269. ++err_unarm:
  5270. ++ brcmf_cfg80211_arm_vif_event(cfg, NULL);
  5271. ++ return err;
  5272. ++}
  5273. ++
  5274. + static
  5275. + int brcmf_cfg80211_del_iface(struct wiphy *wiphy, struct wireless_dev *wdev)
  5276. + {
  5277. + struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
  5278. + struct net_device *ndev = wdev->netdev;
  5279. +
  5280. ++ if (ndev && ndev == cfg_to_ndev(cfg))
  5281. ++ return -ENOTSUPP;
  5282. ++
  5283. + /* vif event pending in firmware */
  5284. + if (brcmf_cfg80211_vif_event_armed(cfg))
  5285. + return -EBUSY;
  5286. +@@ -807,12 +843,13 @@ int brcmf_cfg80211_del_iface(struct wiph
  5287. + switch (wdev->iftype) {
  5288. + case NL80211_IFTYPE_ADHOC:
  5289. + case NL80211_IFTYPE_STATION:
  5290. +- case NL80211_IFTYPE_AP:
  5291. + case NL80211_IFTYPE_AP_VLAN:
  5292. + case NL80211_IFTYPE_WDS:
  5293. + case NL80211_IFTYPE_MONITOR:
  5294. + case NL80211_IFTYPE_MESH_POINT:
  5295. + return -EOPNOTSUPP;
  5296. ++ case NL80211_IFTYPE_AP:
  5297. ++ return brcmf_cfg80211_del_ap_iface(wiphy, wdev);
  5298. + case NL80211_IFTYPE_P2P_CLIENT:
  5299. + case NL80211_IFTYPE_P2P_GO:
  5300. + case NL80211_IFTYPE_P2P_DEVICE:
  5301. 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
  5302. deleted file mode 100644
  5303. index b646ab3..0000000
  5304. --- a/package/kernel/mac80211/patches/319-cfg80211-add-function-for-802.3-conversion-with-sepa.patch
  5305. +++ /dev/null
  5306. @@ -1,186 +0,0 @@
  5307. -From: Felix Fietkau <nbd@openwrt.org>
  5308. -Date: Tue, 2 Feb 2016 14:39:09 +0100
  5309. -Subject: [PATCH] cfg80211: add function for 802.3 conversion with separate
  5310. - output buffer
  5311. -
  5312. -Use skb_copy_bits in preparation for allowing fragmented skbs
  5313. -
  5314. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  5315. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  5316. ----
  5317. -
  5318. ---- a/net/wireless/util.c
  5319. -+++ b/net/wireless/util.c
  5320. -@@ -393,9 +393,9 @@ unsigned int ieee80211_get_hdrlen_from_s
  5321. - }
  5322. - EXPORT_SYMBOL(ieee80211_get_hdrlen_from_skb);
  5323. -
  5324. --unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
  5325. -+static unsigned int __ieee80211_get_mesh_hdrlen(u8 flags)
  5326. - {
  5327. -- int ae = meshhdr->flags & MESH_FLAGS_AE;
  5328. -+ int ae = flags & MESH_FLAGS_AE;
  5329. - /* 802.11-2012, 8.2.4.7.3 */
  5330. - switch (ae) {
  5331. - default:
  5332. -@@ -407,21 +407,31 @@ unsigned int ieee80211_get_mesh_hdrlen(s
  5333. - return 18;
  5334. - }
  5335. - }
  5336. -+
  5337. -+unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
  5338. -+{
  5339. -+ return __ieee80211_get_mesh_hdrlen(meshhdr->flags);
  5340. -+}
  5341. - EXPORT_SYMBOL(ieee80211_get_mesh_hdrlen);
  5342. -
  5343. --int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
  5344. -- enum nl80211_iftype iftype)
  5345. -+static int __ieee80211_data_to_8023(struct sk_buff *skb, struct ethhdr *ehdr,
  5346. -+ const u8 *addr, enum nl80211_iftype iftype)
  5347. - {
  5348. - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  5349. -- u16 hdrlen, ethertype;
  5350. -- u8 *payload;
  5351. -- u8 dst[ETH_ALEN];
  5352. -- u8 src[ETH_ALEN] __aligned(2);
  5353. -+ struct {
  5354. -+ u8 hdr[ETH_ALEN] __aligned(2);
  5355. -+ __be16 proto;
  5356. -+ } payload;
  5357. -+ struct ethhdr tmp;
  5358. -+ u16 hdrlen;
  5359. -+ u8 mesh_flags = 0;
  5360. -
  5361. - if (unlikely(!ieee80211_is_data_present(hdr->frame_control)))
  5362. - return -1;
  5363. -
  5364. - hdrlen = ieee80211_hdrlen(hdr->frame_control);
  5365. -+ if (skb->len < hdrlen + 8)
  5366. -+ return -1;
  5367. -
  5368. - /* convert IEEE 802.11 header + possible LLC headers into Ethernet
  5369. - * header
  5370. -@@ -432,8 +442,11 @@ int ieee80211_data_to_8023(struct sk_buf
  5371. - * 1 0 BSSID SA DA n/a
  5372. - * 1 1 RA TA DA SA
  5373. - */
  5374. -- memcpy(dst, ieee80211_get_DA(hdr), ETH_ALEN);
  5375. -- memcpy(src, ieee80211_get_SA(hdr), ETH_ALEN);
  5376. -+ memcpy(tmp.h_dest, ieee80211_get_DA(hdr), ETH_ALEN);
  5377. -+ memcpy(tmp.h_source, ieee80211_get_SA(hdr), ETH_ALEN);
  5378. -+
  5379. -+ if (iftype == NL80211_IFTYPE_MESH_POINT)
  5380. -+ skb_copy_bits(skb, hdrlen, &mesh_flags, 1);
  5381. -
  5382. - switch (hdr->frame_control &
  5383. - cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) {
  5384. -@@ -450,44 +463,31 @@ int ieee80211_data_to_8023(struct sk_buf
  5385. - iftype != NL80211_IFTYPE_STATION))
  5386. - return -1;
  5387. - if (iftype == NL80211_IFTYPE_MESH_POINT) {
  5388. -- struct ieee80211s_hdr *meshdr =
  5389. -- (struct ieee80211s_hdr *) (skb->data + hdrlen);
  5390. -- /* make sure meshdr->flags is on the linear part */
  5391. -- if (!pskb_may_pull(skb, hdrlen + 1))
  5392. -- return -1;
  5393. -- if (meshdr->flags & MESH_FLAGS_AE_A4)
  5394. -+ if (mesh_flags & MESH_FLAGS_AE_A4)
  5395. - return -1;
  5396. -- if (meshdr->flags & MESH_FLAGS_AE_A5_A6) {
  5397. -+ if (mesh_flags & MESH_FLAGS_AE_A5_A6) {
  5398. - skb_copy_bits(skb, hdrlen +
  5399. - offsetof(struct ieee80211s_hdr, eaddr1),
  5400. -- dst, ETH_ALEN);
  5401. -- skb_copy_bits(skb, hdrlen +
  5402. -- offsetof(struct ieee80211s_hdr, eaddr2),
  5403. -- src, ETH_ALEN);
  5404. -+ tmp.h_dest, 2 * ETH_ALEN);
  5405. - }
  5406. -- hdrlen += ieee80211_get_mesh_hdrlen(meshdr);
  5407. -+ hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags);
  5408. - }
  5409. - break;
  5410. - case cpu_to_le16(IEEE80211_FCTL_FROMDS):
  5411. - if ((iftype != NL80211_IFTYPE_STATION &&
  5412. - iftype != NL80211_IFTYPE_P2P_CLIENT &&
  5413. - iftype != NL80211_IFTYPE_MESH_POINT) ||
  5414. -- (is_multicast_ether_addr(dst) &&
  5415. -- ether_addr_equal(src, addr)))
  5416. -+ (is_multicast_ether_addr(tmp.h_dest) &&
  5417. -+ ether_addr_equal(tmp.h_source, addr)))
  5418. - return -1;
  5419. - if (iftype == NL80211_IFTYPE_MESH_POINT) {
  5420. -- struct ieee80211s_hdr *meshdr =
  5421. -- (struct ieee80211s_hdr *) (skb->data + hdrlen);
  5422. -- /* make sure meshdr->flags is on the linear part */
  5423. -- if (!pskb_may_pull(skb, hdrlen + 1))
  5424. -- return -1;
  5425. -- if (meshdr->flags & MESH_FLAGS_AE_A5_A6)
  5426. -+ if (mesh_flags & MESH_FLAGS_AE_A5_A6)
  5427. - return -1;
  5428. -- if (meshdr->flags & MESH_FLAGS_AE_A4)
  5429. -+ if (mesh_flags & MESH_FLAGS_AE_A4)
  5430. - skb_copy_bits(skb, hdrlen +
  5431. - offsetof(struct ieee80211s_hdr, eaddr1),
  5432. -- src, ETH_ALEN);
  5433. -- hdrlen += ieee80211_get_mesh_hdrlen(meshdr);
  5434. -+ tmp.h_source, ETH_ALEN);
  5435. -+ hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags);
  5436. - }
  5437. - break;
  5438. - case cpu_to_le16(0):
  5439. -@@ -498,33 +498,33 @@ int ieee80211_data_to_8023(struct sk_buf
  5440. - break;
  5441. - }
  5442. -
  5443. -- if (!pskb_may_pull(skb, hdrlen + 8))
  5444. -- return -1;
  5445. --
  5446. -- payload = skb->data + hdrlen;
  5447. -- ethertype = (payload[6] << 8) | payload[7];
  5448. -+ skb_copy_bits(skb, hdrlen, &payload, sizeof(payload));
  5449. -+ tmp.h_proto = payload.proto;
  5450. -
  5451. -- if (likely((ether_addr_equal(payload, rfc1042_header) &&
  5452. -- ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) ||
  5453. -- ether_addr_equal(payload, bridge_tunnel_header))) {
  5454. -+ if (likely((ether_addr_equal(payload.hdr, rfc1042_header) &&
  5455. -+ tmp.h_proto != htons(ETH_P_AARP) &&
  5456. -+ tmp.h_proto != htons(ETH_P_IPX)) ||
  5457. -+ ether_addr_equal(payload.hdr, bridge_tunnel_header)))
  5458. - /* remove RFC1042 or Bridge-Tunnel encapsulation and
  5459. - * replace EtherType */
  5460. -- skb_pull(skb, hdrlen + 6);
  5461. -- memcpy(skb_push(skb, ETH_ALEN), src, ETH_ALEN);
  5462. -- memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN);
  5463. -- } else {
  5464. -- struct ethhdr *ehdr;
  5465. -- __be16 len;
  5466. -+ hdrlen += ETH_ALEN + 2;
  5467. -+ else
  5468. -+ tmp.h_proto = htons(skb->len);
  5469. -
  5470. -- skb_pull(skb, hdrlen);
  5471. -- len = htons(skb->len);
  5472. -+ pskb_pull(skb, hdrlen);
  5473. -+
  5474. -+ if (!ehdr)
  5475. - ehdr = (struct ethhdr *) skb_push(skb, sizeof(struct ethhdr));
  5476. -- memcpy(ehdr->h_dest, dst, ETH_ALEN);
  5477. -- memcpy(ehdr->h_source, src, ETH_ALEN);
  5478. -- ehdr->h_proto = len;
  5479. -- }
  5480. -+ memcpy(ehdr, &tmp, sizeof(tmp));
  5481. -+
  5482. - return 0;
  5483. - }
  5484. -+
  5485. -+int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
  5486. -+ enum nl80211_iftype iftype)
  5487. -+{
  5488. -+ return __ieee80211_data_to_8023(skb, NULL, addr, iftype);
  5489. -+}
  5490. - EXPORT_SYMBOL(ieee80211_data_to_8023);
  5491. -
  5492. - int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr,
  5493. diff --git a/package/kernel/mac80211/patches/320-ath9k-fix-using-sta-drv_priv-before-initializing-it.patch b/package/kernel/mac80211/patches/320-ath9k-fix-using-sta-drv_priv-before-initializing-it.patch
  5494. new file mode 100644
  5495. index 0000000..aaa6706
  5496. --- /dev/null
  5497. +++ b/package/kernel/mac80211/patches/320-ath9k-fix-using-sta-drv_priv-before-initializing-it.patch
  5498. @@ -0,0 +1,33 @@
  5499. +From: Felix Fietkau <nbd@nbd.name>
  5500. +Date: Tue, 2 Aug 2016 13:00:01 +0200
  5501. +Subject: [PATCH] ath9k: fix using sta->drv_priv before initializing it
  5502. +
  5503. +A station pointer can be passed to the driver on tx, before it has been
  5504. +marked as associated. Since ath9k_sta_state was initializing the entry
  5505. +too late, it resulted in some spurious crashes.
  5506. +
  5507. +Fixes: df3c6eb34da5 ("ath9k: Use sta_state() callback")
  5508. +Cc: stable@vger.kernel.org
  5509. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  5510. +---
  5511. +
  5512. +--- a/drivers/net/wireless/ath/ath9k/main.c
  5513. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  5514. +@@ -1563,13 +1563,13 @@ static int ath9k_sta_state(struct ieee80
  5515. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  5516. + int ret = 0;
  5517. +
  5518. +- if (old_state == IEEE80211_STA_AUTH &&
  5519. +- new_state == IEEE80211_STA_ASSOC) {
  5520. ++ if (old_state == IEEE80211_STA_NOTEXIST &&
  5521. ++ new_state == IEEE80211_STA_NONE) {
  5522. + ret = ath9k_sta_add(hw, vif, sta);
  5523. + ath_dbg(common, CONFIG,
  5524. + "Add station: %pM\n", sta->addr);
  5525. +- } else if (old_state == IEEE80211_STA_ASSOC &&
  5526. +- new_state == IEEE80211_STA_AUTH) {
  5527. ++ } else if (old_state == IEEE80211_STA_NONE &&
  5528. ++ new_state == IEEE80211_STA_NOTEXIST) {
  5529. + ret = ath9k_sta_remove(hw, vif, sta);
  5530. + ath_dbg(common, CONFIG,
  5531. + "Remove station: %pM\n", sta->addr);
  5532. 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
  5533. deleted file mode 100644
  5534. index 2eeed22..0000000
  5535. --- a/package/kernel/mac80211/patches/320-cfg80211-add-support-for-non-linear-skbs-in-ieee8021.patch
  5536. +++ /dev/null
  5537. @@ -1,159 +0,0 @@
  5538. -From: Felix Fietkau <nbd@openwrt.org>
  5539. -Date: Tue, 2 Feb 2016 14:39:10 +0100
  5540. -Subject: [PATCH] cfg80211: add support for non-linear skbs in
  5541. - ieee80211_amsdu_to_8023s
  5542. -
  5543. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  5544. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  5545. ----
  5546. -
  5547. ---- a/net/wireless/util.c
  5548. -+++ b/net/wireless/util.c
  5549. -@@ -644,73 +644,75 @@ int ieee80211_data_from_8023(struct sk_b
  5550. - }
  5551. - EXPORT_SYMBOL(ieee80211_data_from_8023);
  5552. -
  5553. -+static struct sk_buff *
  5554. -+__ieee80211_amsdu_copy(struct sk_buff *skb, unsigned int hlen,
  5555. -+ int offset, int len)
  5556. -+{
  5557. -+ struct sk_buff *frame;
  5558. -+
  5559. -+ if (skb->len - offset < len)
  5560. -+ return NULL;
  5561. -+
  5562. -+ /*
  5563. -+ * Allocate and reserve two bytes more for payload
  5564. -+ * alignment since sizeof(struct ethhdr) is 14.
  5565. -+ */
  5566. -+ frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + len);
  5567. -+
  5568. -+ skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2);
  5569. -+ skb_copy_bits(skb, offset, skb_put(frame, len), len);
  5570. -+
  5571. -+ return frame;
  5572. -+}
  5573. -
  5574. - void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
  5575. - const u8 *addr, enum nl80211_iftype iftype,
  5576. - const unsigned int extra_headroom,
  5577. - bool has_80211_header)
  5578. - {
  5579. -+ unsigned int hlen = ALIGN(extra_headroom, 4);
  5580. - struct sk_buff *frame = NULL;
  5581. - u16 ethertype;
  5582. - u8 *payload;
  5583. -- const struct ethhdr *eth;
  5584. -- int remaining, err;
  5585. -- u8 dst[ETH_ALEN], src[ETH_ALEN];
  5586. --
  5587. -- if (skb_linearize(skb))
  5588. -- goto out;
  5589. -+ int offset = 0, remaining, err;
  5590. -+ struct ethhdr eth;
  5591. -+ bool reuse_skb = true;
  5592. -+ bool last = false;
  5593. -
  5594. - if (has_80211_header) {
  5595. -- err = ieee80211_data_to_8023(skb, addr, iftype);
  5596. -+ err = __ieee80211_data_to_8023(skb, &eth, addr, iftype);
  5597. - if (err)
  5598. - goto out;
  5599. --
  5600. -- /* skip the wrapping header */
  5601. -- eth = (struct ethhdr *) skb_pull(skb, sizeof(struct ethhdr));
  5602. -- if (!eth)
  5603. -- goto out;
  5604. -- } else {
  5605. -- eth = (struct ethhdr *) skb->data;
  5606. - }
  5607. -
  5608. -- while (skb != frame) {
  5609. -+ while (!last) {
  5610. -+ unsigned int subframe_len;
  5611. -+ int len;
  5612. - u8 padding;
  5613. -- __be16 len = eth->h_proto;
  5614. -- unsigned int subframe_len = sizeof(struct ethhdr) + ntohs(len);
  5615. --
  5616. -- remaining = skb->len;
  5617. -- memcpy(dst, eth->h_dest, ETH_ALEN);
  5618. -- memcpy(src, eth->h_source, ETH_ALEN);
  5619. -
  5620. -+ skb_copy_bits(skb, offset, &eth, sizeof(eth));
  5621. -+ len = ntohs(eth.h_proto);
  5622. -+ subframe_len = sizeof(struct ethhdr) + len;
  5623. - padding = (4 - subframe_len) & 0x3;
  5624. -+
  5625. - /* the last MSDU has no padding */
  5626. -+ remaining = skb->len - offset;
  5627. - if (subframe_len > remaining)
  5628. - goto purge;
  5629. -
  5630. -- skb_pull(skb, sizeof(struct ethhdr));
  5631. -+ offset += sizeof(struct ethhdr);
  5632. - /* reuse skb for the last subframe */
  5633. -- if (remaining <= subframe_len + padding)
  5634. -+ last = remaining <= subframe_len + padding;
  5635. -+ if (!skb_is_nonlinear(skb) && last) {
  5636. -+ skb_pull(skb, offset);
  5637. - frame = skb;
  5638. -- else {
  5639. -- unsigned int hlen = ALIGN(extra_headroom, 4);
  5640. -- /*
  5641. -- * Allocate and reserve two bytes more for payload
  5642. -- * alignment since sizeof(struct ethhdr) is 14.
  5643. -- */
  5644. -- frame = dev_alloc_skb(hlen + subframe_len + 2);
  5645. -+ reuse_skb = true;
  5646. -+ } else {
  5647. -+ frame = __ieee80211_amsdu_copy(skb, hlen, offset, len);
  5648. - if (!frame)
  5649. - goto purge;
  5650. -
  5651. -- skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2);
  5652. -- memcpy(skb_put(frame, ntohs(len)), skb->data,
  5653. -- ntohs(len));
  5654. --
  5655. -- eth = (struct ethhdr *)skb_pull(skb, ntohs(len) +
  5656. -- padding);
  5657. -- if (!eth) {
  5658. -- dev_kfree_skb(frame);
  5659. -- goto purge;
  5660. -- }
  5661. -+ offset += len + padding;
  5662. - }
  5663. -
  5664. - skb_reset_network_header(frame);
  5665. -@@ -719,24 +721,20 @@ void ieee80211_amsdu_to_8023s(struct sk_
  5666. -
  5667. - payload = frame->data;
  5668. - ethertype = (payload[6] << 8) | payload[7];
  5669. --
  5670. - if (likely((ether_addr_equal(payload, rfc1042_header) &&
  5671. - ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) ||
  5672. - ether_addr_equal(payload, bridge_tunnel_header))) {
  5673. -- /* remove RFC1042 or Bridge-Tunnel
  5674. -- * encapsulation and replace EtherType */
  5675. -- skb_pull(frame, 6);
  5676. -- memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN);
  5677. -- memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN);
  5678. -- } else {
  5679. -- memcpy(skb_push(frame, sizeof(__be16)), &len,
  5680. -- sizeof(__be16));
  5681. -- memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN);
  5682. -- memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN);
  5683. -+ eth.h_proto = htons(ethertype);
  5684. -+ skb_pull(frame, ETH_ALEN + 2);
  5685. - }
  5686. -+
  5687. -+ memcpy(skb_push(frame, sizeof(eth)), &eth, sizeof(eth));
  5688. - __skb_queue_tail(list, frame);
  5689. - }
  5690. -
  5691. -+ if (!reuse_skb)
  5692. -+ dev_kfree_skb(skb);
  5693. -+
  5694. - return;
  5695. -
  5696. - purge:
  5697. diff --git a/package/kernel/mac80211/patches/321-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch b/package/kernel/mac80211/patches/321-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch
  5698. new file mode 100644
  5699. index 0000000..9caa76d
  5700. --- /dev/null
  5701. +++ b/package/kernel/mac80211/patches/321-ath9k_hw-reset-AHB-WMAC-interface-on-AR91xx.patch
  5702. @@ -0,0 +1,25 @@
  5703. +From: Felix Fietkau <nbd@nbd.name>
  5704. +Date: Sat, 9 Jul 2016 15:25:24 +0200
  5705. +Subject: [PATCH] ath9k_hw: reset AHB-WMAC interface on AR91xx
  5706. +
  5707. +Should fix a few stability issues
  5708. +
  5709. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  5710. +---
  5711. +
  5712. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  5713. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  5714. +@@ -1398,8 +1398,12 @@ static bool ath9k_hw_set_reset(struct at
  5715. + if (!AR_SREV_9100(ah))
  5716. + REG_WRITE(ah, AR_RC, 0);
  5717. +
  5718. +- if (AR_SREV_9100(ah))
  5719. ++ if (AR_SREV_9100(ah)) {
  5720. ++ /* Reset the AHB-WMAC interface */
  5721. ++ if (ah->external_reset)
  5722. ++ ah->external_reset();
  5723. + udelay(50);
  5724. ++ }
  5725. +
  5726. + return true;
  5727. + }
  5728. 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
  5729. deleted file mode 100644
  5730. index c4155a1..0000000
  5731. --- a/package/kernel/mac80211/patches/321-mac80211-Parse-legacy-and-HT-rate-in-injected-frames.patch
  5732. +++ /dev/null
  5733. @@ -1,155 +0,0 @@
  5734. -From: Sven Eckelmann <sven@narfation.org>
  5735. -Date: Tue, 26 Jan 2016 17:11:13 +0100
  5736. -Subject: [PATCH] mac80211: Parse legacy and HT rate in injected frames
  5737. -
  5738. -Drivers/devices without their own rate control algorithm can get the
  5739. -information what rates they should use from either the radiotap header of
  5740. -injected frames or from the rate control algorithm. But the parsing of the
  5741. -legacy rate information from the radiotap header was removed in commit
  5742. -e6a9854b05c1 ("mac80211/drivers: rewrite the rate control API").
  5743. -
  5744. -The removal of this feature heavily reduced the usefulness of frame
  5745. -injection when wanting to simulate specific transmission behavior. Having
  5746. -rate parsing together with MCS rates and retry support allows a fine
  5747. -grained selection of the tx behavior of injected frames for these kind of
  5748. -tests.
  5749. -
  5750. -Signed-off-by: Sven Eckelmann <sven@narfation.org>
  5751. -Cc: Simon Wunderlich <sw@simonwunderlich.de>
  5752. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  5753. ----
  5754. -
  5755. ---- a/include/net/mac80211.h
  5756. -+++ b/include/net/mac80211.h
  5757. -@@ -708,12 +708,14 @@ enum mac80211_tx_info_flags {
  5758. - * protocol frame (e.g. EAP)
  5759. - * @IEEE80211_TX_CTRL_PS_RESPONSE: This frame is a response to a poll
  5760. - * frame (PS-Poll or uAPSD).
  5761. -+ * @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information
  5762. - *
  5763. - * These flags are used in tx_info->control.flags.
  5764. - */
  5765. - enum mac80211_tx_control_flags {
  5766. - IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0),
  5767. - IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1),
  5768. -+ IEEE80211_TX_CTRL_RATE_INJECT = BIT(2),
  5769. - };
  5770. -
  5771. - /*
  5772. ---- a/net/mac80211/tx.c
  5773. -+++ b/net/mac80211/tx.c
  5774. -@@ -710,6 +710,10 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021
  5775. -
  5776. - info->control.short_preamble = txrc.short_preamble;
  5777. -
  5778. -+ /* don't ask rate control when rate already injected via radiotap */
  5779. -+ if (info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT)
  5780. -+ return TX_CONTINUE;
  5781. -+
  5782. - if (tx->sta)
  5783. - assoc = test_sta_flag(tx->sta, WLAN_STA_ASSOC);
  5784. -
  5785. -@@ -1665,15 +1669,24 @@ void ieee80211_xmit(struct ieee80211_sub
  5786. - ieee80211_tx(sdata, sta, skb, false);
  5787. - }
  5788. -
  5789. --static bool ieee80211_parse_tx_radiotap(struct sk_buff *skb)
  5790. -+static bool ieee80211_parse_tx_radiotap(struct ieee80211_local *local,
  5791. -+ struct sk_buff *skb)
  5792. - {
  5793. - struct ieee80211_radiotap_iterator iterator;
  5794. - struct ieee80211_radiotap_header *rthdr =
  5795. - (struct ieee80211_radiotap_header *) skb->data;
  5796. - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  5797. -+ struct ieee80211_supported_band *sband =
  5798. -+ local->hw.wiphy->bands[info->band];
  5799. - int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len,
  5800. - NULL);
  5801. - u16 txflags;
  5802. -+ u16 rate = 0;
  5803. -+ bool rate_found = false;
  5804. -+ u8 rate_retries = 0;
  5805. -+ u16 rate_flags = 0;
  5806. -+ u8 mcs_known, mcs_flags;
  5807. -+ int i;
  5808. -
  5809. - info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
  5810. - IEEE80211_TX_CTL_DONTFRAG;
  5811. -@@ -1724,6 +1737,35 @@ static bool ieee80211_parse_tx_radiotap(
  5812. - info->flags |= IEEE80211_TX_CTL_NO_ACK;
  5813. - break;
  5814. -
  5815. -+ case IEEE80211_RADIOTAP_RATE:
  5816. -+ rate = *iterator.this_arg;
  5817. -+ rate_flags = 0;
  5818. -+ rate_found = true;
  5819. -+ break;
  5820. -+
  5821. -+ case IEEE80211_RADIOTAP_DATA_RETRIES:
  5822. -+ rate_retries = *iterator.this_arg;
  5823. -+ break;
  5824. -+
  5825. -+ case IEEE80211_RADIOTAP_MCS:
  5826. -+ mcs_known = iterator.this_arg[0];
  5827. -+ mcs_flags = iterator.this_arg[1];
  5828. -+ if (!(mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_MCS))
  5829. -+ break;
  5830. -+
  5831. -+ rate_found = true;
  5832. -+ rate = iterator.this_arg[2];
  5833. -+ rate_flags = IEEE80211_TX_RC_MCS;
  5834. -+
  5835. -+ if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_GI &&
  5836. -+ mcs_flags & IEEE80211_RADIOTAP_MCS_SGI)
  5837. -+ rate_flags |= IEEE80211_TX_RC_SHORT_GI;
  5838. -+
  5839. -+ if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_BW &&
  5840. -+ mcs_flags & IEEE80211_RADIOTAP_MCS_BW_40)
  5841. -+ rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
  5842. -+ break;
  5843. -+
  5844. - /*
  5845. - * Please update the file
  5846. - * Documentation/networking/mac80211-injection.txt
  5847. -@@ -1738,6 +1780,32 @@ static bool ieee80211_parse_tx_radiotap(
  5848. - if (ret != -ENOENT) /* ie, if we didn't simply run out of fields */
  5849. - return false;
  5850. -
  5851. -+ if (rate_found) {
  5852. -+ info->control.flags |= IEEE80211_TX_CTRL_RATE_INJECT;
  5853. -+
  5854. -+ for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
  5855. -+ info->control.rates[i].idx = -1;
  5856. -+ info->control.rates[i].flags = 0;
  5857. -+ info->control.rates[i].count = 0;
  5858. -+ }
  5859. -+
  5860. -+ if (rate_flags & IEEE80211_TX_RC_MCS) {
  5861. -+ info->control.rates[0].idx = rate;
  5862. -+ } else {
  5863. -+ for (i = 0; i < sband->n_bitrates; i++) {
  5864. -+ if (rate * 5 != sband->bitrates[i].bitrate)
  5865. -+ continue;
  5866. -+
  5867. -+ info->control.rates[0].idx = i;
  5868. -+ break;
  5869. -+ }
  5870. -+ }
  5871. -+
  5872. -+ info->control.rates[0].flags = rate_flags;
  5873. -+ info->control.rates[0].count = min_t(u8, rate_retries + 1,
  5874. -+ local->hw.max_rate_tries);
  5875. -+ }
  5876. -+
  5877. - /*
  5878. - * remove the radiotap header
  5879. - * iterator->_max_length was sanity-checked against
  5880. -@@ -1819,7 +1887,7 @@ netdev_tx_t ieee80211_monitor_start_xmit
  5881. - IEEE80211_TX_CTL_INJECTED;
  5882. -
  5883. - /* process and remove the injection radiotap header */
  5884. -- if (!ieee80211_parse_tx_radiotap(skb))
  5885. -+ if (!ieee80211_parse_tx_radiotap(local, skb))
  5886. - goto fail;
  5887. -
  5888. - rcu_read_lock();
  5889. diff --git a/package/kernel/mac80211/patches/322-ath9k_hw-issue-external-reset-for-QCA9550.patch b/package/kernel/mac80211/patches/322-ath9k_hw-issue-external-reset-for-QCA9550.patch
  5890. new file mode 100644
  5891. index 0000000..5d4e849
  5892. --- /dev/null
  5893. +++ b/package/kernel/mac80211/patches/322-ath9k_hw-issue-external-reset-for-QCA9550.patch
  5894. @@ -0,0 +1,125 @@
  5895. +From: Felix Fietkau <nbd@nbd.name>
  5896. +Date: Sat, 9 Jul 2016 15:26:44 +0200
  5897. +Subject: [PATCH] ath9k_hw: issue external reset for QCA9550
  5898. +
  5899. +The RTC interface on the SoC needs to be reset along with the rest of
  5900. +the WMAC.
  5901. +
  5902. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  5903. +---
  5904. +
  5905. +--- a/drivers/net/wireless/ath/ath9k/hw.c
  5906. ++++ b/drivers/net/wireless/ath/ath9k/hw.c
  5907. +@@ -1275,39 +1275,56 @@ void ath9k_hw_get_delta_slope_vals(struc
  5908. + *coef_exponent = coef_exp - 16;
  5909. + }
  5910. +
  5911. +-/* AR9330 WAR:
  5912. +- * call external reset function to reset WMAC if:
  5913. +- * - doing a cold reset
  5914. +- * - we have pending frames in the TX queues.
  5915. +- */
  5916. +-static bool ath9k_hw_ar9330_reset_war(struct ath_hw *ah, int type)
  5917. ++static bool ath9k_hw_need_external_reset(struct ath_hw *ah, int type)
  5918. + {
  5919. +- int i, npend = 0;
  5920. ++ int i;
  5921. +
  5922. +- for (i = 0; i < AR_NUM_QCU; i++) {
  5923. +- npend = ath9k_hw_numtxpending(ah, i);
  5924. +- if (npend)
  5925. +- break;
  5926. ++ if (type == ATH9K_RESET_COLD)
  5927. ++ return true;
  5928. ++
  5929. ++ if (AR_SREV_9550(ah))
  5930. ++ return true;
  5931. ++
  5932. ++ /* AR9330 WAR:
  5933. ++ * call external reset function to reset WMAC if:
  5934. ++ * - doing a cold reset
  5935. ++ * - we have pending frames in the TX queues.
  5936. ++ */
  5937. ++ if (AR_SREV_9330(ah)) {
  5938. ++ for (i = 0; i < AR_NUM_QCU; i++) {
  5939. ++ if (ath9k_hw_numtxpending(ah, i))
  5940. ++ return true;
  5941. ++ }
  5942. + }
  5943. +
  5944. +- if (ah->external_reset &&
  5945. +- (npend || type == ATH9K_RESET_COLD)) {
  5946. +- int reset_err = 0;
  5947. ++ return false;
  5948. ++}
  5949. +
  5950. +- ath_dbg(ath9k_hw_common(ah), RESET,
  5951. +- "reset MAC via external reset\n");
  5952. ++static bool ath9k_hw_external_reset(struct ath_hw *ah, int type)
  5953. ++{
  5954. ++ int err;
  5955. +
  5956. +- reset_err = ah->external_reset();
  5957. +- if (reset_err) {
  5958. +- ath_err(ath9k_hw_common(ah),
  5959. +- "External reset failed, err=%d\n",
  5960. +- reset_err);
  5961. +- return false;
  5962. +- }
  5963. ++ if (!ah->external_reset || !ath9k_hw_need_external_reset(ah, type))
  5964. ++ return true;
  5965. +
  5966. +- REG_WRITE(ah, AR_RTC_RESET, 1);
  5967. ++ ath_dbg(ath9k_hw_common(ah), RESET,
  5968. ++ "reset MAC via external reset\n");
  5969. ++
  5970. ++ err = ah->external_reset();
  5971. ++ if (err) {
  5972. ++ ath_err(ath9k_hw_common(ah),
  5973. ++ "External reset failed, err=%d\n", err);
  5974. ++ return false;
  5975. ++ }
  5976. ++
  5977. ++ if (AR_SREV_9550(ah)) {
  5978. ++ REG_WRITE(ah, AR_RTC_RESET, 0);
  5979. ++ udelay(10);
  5980. + }
  5981. +
  5982. ++ REG_WRITE(ah, AR_RTC_RESET, 1);
  5983. ++ udelay(10);
  5984. ++
  5985. + return true;
  5986. + }
  5987. +
  5988. +@@ -1360,24 +1377,23 @@ static bool ath9k_hw_set_reset(struct at
  5989. + rst_flags |= AR_RTC_RC_MAC_COLD;
  5990. + }
  5991. +
  5992. +- if (AR_SREV_9330(ah)) {
  5993. +- if (!ath9k_hw_ar9330_reset_war(ah, type))
  5994. +- return false;
  5995. +- }
  5996. +-
  5997. + if (ath9k_hw_mci_is_enabled(ah))
  5998. + ar9003_mci_check_gpm_offset(ah);
  5999. +
  6000. + /* DMA HALT added to resolve ar9300 and ar9580 bus error during
  6001. +- * RTC_RC reg read
  6002. ++ * RTC_RC reg read. Also needed for AR9550 external reset
  6003. + */
  6004. +- if (AR_SREV_9300(ah) || AR_SREV_9580(ah)) {
  6005. ++ if (AR_SREV_9300(ah) || AR_SREV_9580(ah) || AR_SREV_9550(ah)) {
  6006. + REG_SET_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  6007. + ath9k_hw_wait(ah, AR_CFG, AR_CFG_HALT_ACK, AR_CFG_HALT_ACK,
  6008. + 20 * AH_WAIT_TIMEOUT);
  6009. +- REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  6010. + }
  6011. +
  6012. ++ ath9k_hw_external_reset(ah, type);
  6013. ++
  6014. ++ if (AR_SREV_9300(ah) || AR_SREV_9580(ah))
  6015. ++ REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
  6016. ++
  6017. + REG_WRITE(ah, AR_RTC_RC, rst_flags);
  6018. +
  6019. + REGWRITE_BUFFER_FLUSH(ah);
  6020. 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
  6021. deleted file mode 100644
  6022. index e7bfb9c..0000000
  6023. --- a/package/kernel/mac80211/patches/322-mac80211-add-A-MSDU-tx-support.patch
  6024. +++ /dev/null
  6025. @@ -1,317 +0,0 @@
  6026. -From: Felix Fietkau <nbd@openwrt.org>
  6027. -Date: Fri, 5 Feb 2016 01:38:51 +0100
  6028. -Subject: [PATCH] mac80211: add A-MSDU tx support
  6029. -
  6030. -Requires software tx queueing support. frag_list support (for zero-copy)
  6031. -is optional.
  6032. -
  6033. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  6034. ----
  6035. -
  6036. ---- a/include/net/mac80211.h
  6037. -+++ b/include/net/mac80211.h
  6038. -@@ -709,6 +709,7 @@ enum mac80211_tx_info_flags {
  6039. - * @IEEE80211_TX_CTRL_PS_RESPONSE: This frame is a response to a poll
  6040. - * frame (PS-Poll or uAPSD).
  6041. - * @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information
  6042. -+ * @IEEE80211_TX_CTRL_AMSDU: This frame is an A-MSDU frame
  6043. - *
  6044. - * These flags are used in tx_info->control.flags.
  6045. - */
  6046. -@@ -716,6 +717,7 @@ enum mac80211_tx_control_flags {
  6047. - IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0),
  6048. - IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1),
  6049. - IEEE80211_TX_CTRL_RATE_INJECT = BIT(2),
  6050. -+ IEEE80211_TX_CTRL_AMSDU = BIT(3),
  6051. - };
  6052. -
  6053. - /*
  6054. -@@ -1728,6 +1730,7 @@ struct ieee80211_sta_rates {
  6055. - * size is min(max_amsdu_len, 7935) bytes.
  6056. - * Both additional HT limits must be enforced by the low level driver.
  6057. - * This is defined by the spec (IEEE 802.11-2012 section 8.3.2.2 NOTE 2).
  6058. -+ * @max_rc_amsdu_len: Maximum A-MSDU size in bytes recommended by rate control.
  6059. - * @txq: per-TID data TX queues (if driver uses the TXQ abstraction)
  6060. - */
  6061. - struct ieee80211_sta {
  6062. -@@ -1748,6 +1751,7 @@ struct ieee80211_sta {
  6063. - bool mfp;
  6064. - u8 max_amsdu_subframes;
  6065. - u16 max_amsdu_len;
  6066. -+ u16 max_rc_amsdu_len;
  6067. -
  6068. - struct ieee80211_txq *txq[IEEE80211_NUM_TIDS];
  6069. -
  6070. -@@ -1961,6 +1965,15 @@ struct ieee80211_txq {
  6071. - * order and does not need to manage its own reorder buffer or BA session
  6072. - * timeout.
  6073. - *
  6074. -+ * @IEEE80211_HW_TX_AMSDU: Hardware (or driver) supports software aggregated
  6075. -+ * A-MSDU frames. Requires software tx queueing and fast-xmit support.
  6076. -+ * When not using minstrel/minstrel_ht rate control, the driver should
  6077. -+ * limit the maximum A-MSDU size based on the current tx rate by setting
  6078. -+ * max_rc_amsdu_len in struct ieee80211_sta.
  6079. -+ *
  6080. -+ * @IEEE80211_HW_TX_FRAG_LIST: Hardware (or driver) supports sending frag_list
  6081. -+ * skbs, needed for zero-copy software A-MSDU.
  6082. -+ *
  6083. - * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
  6084. - */
  6085. - enum ieee80211_hw_flags {
  6086. -@@ -1998,6 +2011,8 @@ enum ieee80211_hw_flags {
  6087. - IEEE80211_HW_BEACON_TX_STATUS,
  6088. - IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR,
  6089. - IEEE80211_HW_SUPPORTS_REORDERING_BUFFER,
  6090. -+ IEEE80211_HW_TX_AMSDU,
  6091. -+ IEEE80211_HW_TX_FRAG_LIST,
  6092. -
  6093. - /* keep last, obviously */
  6094. - NUM_IEEE80211_HW_FLAGS
  6095. -@@ -2070,6 +2085,9 @@ enum ieee80211_hw_flags {
  6096. - * size is smaller (an example is LinkSys WRT120N with FW v1.0.07
  6097. - * build 002 Jun 18 2012).
  6098. - *
  6099. -+ * @max_tx_fragments: maximum number of tx buffers per (A)-MSDU, sum
  6100. -+ * of 1 + skb_shinfo(skb)->nr_frags for each skb in the frag_list.
  6101. -+ *
  6102. - * @offchannel_tx_hw_queue: HW queue ID to use for offchannel TX
  6103. - * (if %IEEE80211_HW_QUEUE_CONTROL is set)
  6104. - *
  6105. -@@ -2124,6 +2142,7 @@ struct ieee80211_hw {
  6106. - u8 max_rate_tries;
  6107. - u8 max_rx_aggregation_subframes;
  6108. - u8 max_tx_aggregation_subframes;
  6109. -+ u8 max_tx_fragments;
  6110. - u8 offchannel_tx_hw_queue;
  6111. - u8 radiotap_mcs_details;
  6112. - u16 radiotap_vht_details;
  6113. ---- a/net/mac80211/agg-tx.c
  6114. -+++ b/net/mac80211/agg-tx.c
  6115. -@@ -935,6 +935,7 @@ void ieee80211_process_addba_resp(struct
  6116. - size_t len)
  6117. - {
  6118. - struct tid_ampdu_tx *tid_tx;
  6119. -+ struct ieee80211_txq *txq;
  6120. - u16 capab, tid;
  6121. - u8 buf_size;
  6122. - bool amsdu;
  6123. -@@ -945,6 +946,10 @@ void ieee80211_process_addba_resp(struct
  6124. - buf_size = (capab & IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK) >> 6;
  6125. - buf_size = min(buf_size, local->hw.max_tx_aggregation_subframes);
  6126. -
  6127. -+ txq = sta->sta.txq[tid];
  6128. -+ if (!amsdu && txq)
  6129. -+ set_bit(IEEE80211_TXQ_NO_AMSDU, &to_txq_info(txq)->flags);
  6130. -+
  6131. - mutex_lock(&sta->ampdu_mlme.mtx);
  6132. -
  6133. - tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
  6134. ---- a/net/mac80211/debugfs.c
  6135. -+++ b/net/mac80211/debugfs.c
  6136. -@@ -127,6 +127,8 @@ static const char *hw_flag_names[NUM_IEE
  6137. - FLAG(BEACON_TX_STATUS),
  6138. - FLAG(NEEDS_UNIQUE_STA_ADDR),
  6139. - FLAG(SUPPORTS_REORDERING_BUFFER),
  6140. -+ FLAG(TX_AMSDU),
  6141. -+ FLAG(TX_FRAG_LIST),
  6142. -
  6143. - /* keep last for the build bug below */
  6144. - (void *)0x1
  6145. ---- a/net/mac80211/ieee80211_i.h
  6146. -+++ b/net/mac80211/ieee80211_i.h
  6147. -@@ -799,6 +799,7 @@ struct mac80211_qos_map {
  6148. - enum txq_info_flags {
  6149. - IEEE80211_TXQ_STOP,
  6150. - IEEE80211_TXQ_AMPDU,
  6151. -+ IEEE80211_TXQ_NO_AMSDU,
  6152. - };
  6153. -
  6154. - struct txq_info {
  6155. ---- a/net/mac80211/tx.c
  6156. -+++ b/net/mac80211/tx.c
  6157. -@@ -1318,6 +1318,10 @@ struct sk_buff *ieee80211_tx_dequeue(str
  6158. - out:
  6159. - spin_unlock_bh(&txqi->queue.lock);
  6160. -
  6161. -+ if (skb && skb_has_frag_list(skb) &&
  6162. -+ !ieee80211_hw_check(&local->hw, TX_FRAG_LIST))
  6163. -+ skb_linearize(skb);
  6164. -+
  6165. - return skb;
  6166. - }
  6167. - EXPORT_SYMBOL(ieee80211_tx_dequeue);
  6168. -@@ -2757,6 +2761,163 @@ void ieee80211_clear_fast_xmit(struct st
  6169. - kfree_rcu(fast_tx, rcu_head);
  6170. - }
  6171. -
  6172. -+static bool ieee80211_amsdu_realloc_pad(struct ieee80211_local *local,
  6173. -+ struct sk_buff *skb, int headroom,
  6174. -+ int *subframe_len)
  6175. -+{
  6176. -+ int amsdu_len = *subframe_len + sizeof(struct ethhdr);
  6177. -+ int padding = (4 - amsdu_len) & 3;
  6178. -+
  6179. -+ if (skb_headroom(skb) < headroom || skb_tailroom(skb) < padding) {
  6180. -+ I802_DEBUG_INC(local->tx_expand_skb_head);
  6181. -+
  6182. -+ if (pskb_expand_head(skb, headroom, padding, GFP_ATOMIC)) {
  6183. -+ wiphy_debug(local->hw.wiphy,
  6184. -+ "failed to reallocate TX buffer\n");
  6185. -+ return false;
  6186. -+ }
  6187. -+ }
  6188. -+
  6189. -+ if (padding) {
  6190. -+ *subframe_len += padding;
  6191. -+ memset(skb_put(skb, padding), 0, padding);
  6192. -+ }
  6193. -+
  6194. -+ return true;
  6195. -+}
  6196. -+
  6197. -+static bool ieee80211_amsdu_prepare_head(struct ieee80211_sub_if_data *sdata,
  6198. -+ struct ieee80211_fast_tx *fast_tx,
  6199. -+ struct sk_buff *skb)
  6200. -+{
  6201. -+ struct ieee80211_local *local = sdata->local;
  6202. -+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  6203. -+ struct ieee80211_hdr *hdr;
  6204. -+ struct ethhdr amsdu_hdr;
  6205. -+ int hdr_len = fast_tx->hdr_len - sizeof(rfc1042_header);
  6206. -+ int subframe_len = skb->len - hdr_len;
  6207. -+ void *data;
  6208. -+ u8 *qc;
  6209. -+
  6210. -+ if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)
  6211. -+ return false;
  6212. -+
  6213. -+ if (info->control.flags & IEEE80211_TX_CTRL_AMSDU)
  6214. -+ return true;
  6215. -+
  6216. -+ if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(amsdu_hdr),
  6217. -+ &subframe_len))
  6218. -+ return false;
  6219. -+
  6220. -+ amsdu_hdr.h_proto = cpu_to_be16(subframe_len);
  6221. -+ memcpy(amsdu_hdr.h_source, skb->data + fast_tx->sa_offs, ETH_ALEN);
  6222. -+ memcpy(amsdu_hdr.h_dest, skb->data + fast_tx->da_offs, ETH_ALEN);
  6223. -+
  6224. -+ data = skb_push(skb, sizeof(amsdu_hdr));
  6225. -+ memmove(data, data + sizeof(amsdu_hdr), hdr_len);
  6226. -+ memcpy(data + hdr_len, &amsdu_hdr, sizeof(amsdu_hdr));
  6227. -+
  6228. -+ hdr = data;
  6229. -+ qc = ieee80211_get_qos_ctl(hdr);
  6230. -+ *qc |= IEEE80211_QOS_CTL_A_MSDU_PRESENT;
  6231. -+
  6232. -+ info->control.flags |= IEEE80211_TX_CTRL_AMSDU;
  6233. -+
  6234. -+ return true;
  6235. -+}
  6236. -+
  6237. -+static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata,
  6238. -+ struct sta_info *sta,
  6239. -+ struct ieee80211_fast_tx *fast_tx,
  6240. -+ struct sk_buff *skb)
  6241. -+{
  6242. -+ struct ieee80211_local *local = sdata->local;
  6243. -+ u8 tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
  6244. -+ struct ieee80211_txq *txq = sta->sta.txq[tid];
  6245. -+ struct txq_info *txqi;
  6246. -+ struct sk_buff **frag_tail, *head;
  6247. -+ int subframe_len = skb->len - ETH_ALEN;
  6248. -+ u8 max_subframes = sta->sta.max_amsdu_subframes;
  6249. -+ int max_frags = local->hw.max_tx_fragments;
  6250. -+ int max_amsdu_len = sta->sta.max_amsdu_len;
  6251. -+ __be16 len;
  6252. -+ void *data;
  6253. -+ bool ret = false;
  6254. -+ int n = 1, nfrags;
  6255. -+
  6256. -+ if (!ieee80211_hw_check(&local->hw, TX_AMSDU))
  6257. -+ return false;
  6258. -+
  6259. -+ if (!txq)
  6260. -+ return false;
  6261. -+
  6262. -+ txqi = to_txq_info(txq);
  6263. -+ if (test_bit(IEEE80211_TXQ_NO_AMSDU, &txqi->flags))
  6264. -+ return false;
  6265. -+
  6266. -+ if (sta->sta.max_rc_amsdu_len)
  6267. -+ max_amsdu_len = min_t(int, max_amsdu_len,
  6268. -+ sta->sta.max_rc_amsdu_len);
  6269. -+
  6270. -+ spin_lock_bh(&txqi->queue.lock);
  6271. -+
  6272. -+ head = skb_peek_tail(&txqi->queue);
  6273. -+ if (!head)
  6274. -+ goto out;
  6275. -+
  6276. -+ if (skb->len + head->len > max_amsdu_len)
  6277. -+ goto out;
  6278. -+
  6279. -+ /*
  6280. -+ * HT A-MPDU limits maximum MPDU size to 4095 bytes. Since aggregation
  6281. -+ * sessions are started/stopped without txq flush, use the limit here
  6282. -+ * to avoid having to de-aggregate later.
  6283. -+ */
  6284. -+ if (skb->len + head->len > 4095 &&
  6285. -+ !sta->sta.vht_cap.vht_supported)
  6286. -+ goto out;
  6287. -+
  6288. -+ if (!ieee80211_amsdu_prepare_head(sdata, fast_tx, head))
  6289. -+ goto out;
  6290. -+
  6291. -+ nfrags = 1 + skb_shinfo(skb)->nr_frags;
  6292. -+ nfrags += 1 + skb_shinfo(head)->nr_frags;
  6293. -+ frag_tail = &skb_shinfo(head)->frag_list;
  6294. -+ while (*frag_tail) {
  6295. -+ nfrags += 1 + skb_shinfo(*frag_tail)->nr_frags;
  6296. -+ frag_tail = &(*frag_tail)->next;
  6297. -+ n++;
  6298. -+ }
  6299. -+
  6300. -+ if (max_subframes && n > max_subframes)
  6301. -+ goto out;
  6302. -+
  6303. -+ if (max_frags && nfrags > max_frags)
  6304. -+ goto out;
  6305. -+
  6306. -+ if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(rfc1042_header) + 2,
  6307. -+ &subframe_len))
  6308. -+ return false;
  6309. -+
  6310. -+ ret = true;
  6311. -+ data = skb_push(skb, ETH_ALEN + 2);
  6312. -+ memmove(data, data + ETH_ALEN + 2, 2 * ETH_ALEN);
  6313. -+
  6314. -+ data += 2 * ETH_ALEN;
  6315. -+ len = cpu_to_be16(subframe_len);
  6316. -+ memcpy(data, &len, 2);
  6317. -+ memcpy(data + 2, rfc1042_header, sizeof(rfc1042_header));
  6318. -+
  6319. -+ head->len += skb->len;
  6320. -+ head->data_len += skb->len;
  6321. -+ *frag_tail = skb;
  6322. -+
  6323. -+out:
  6324. -+ spin_unlock_bh(&txqi->queue.lock);
  6325. -+
  6326. -+ return ret;
  6327. -+}
  6328. -+
  6329. - static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
  6330. - struct net_device *dev, struct sta_info *sta,
  6331. - struct ieee80211_fast_tx *fast_tx,
  6332. -@@ -2811,6 +2972,10 @@ static bool ieee80211_xmit_fast(struct i
  6333. -
  6334. - ieee80211_tx_stats(dev, skb->len + extra_head);
  6335. -
  6336. -+ if ((hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) &&
  6337. -+ ieee80211_amsdu_aggregate(sdata, sta, fast_tx, skb))
  6338. -+ return true;
  6339. -+
  6340. - /* will not be crypto-handled beyond what we do here, so use false
  6341. - * as the may-encrypt argument for the resize to not account for
  6342. - * more room than we already have in 'extra_head'
  6343. 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
  6344. deleted file mode 100644
  6345. index 9277b2c..0000000
  6346. --- a/package/kernel/mac80211/patches/323-0000-brcmfmac-fix-setting-primary-channel-for-80-MHz-widt.patch
  6347. +++ /dev/null
  6348. @@ -1,64 +0,0 @@
  6349. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6350. -Date: Wed, 20 Jan 2016 16:46:04 +0100
  6351. -Subject: [PATCH] brcmfmac: fix setting primary channel for 80 MHz width
  6352. -MIME-Version: 1.0
  6353. -Content-Type: text/plain; charset=UTF-8
  6354. -Content-Transfer-Encoding: 8bit
  6355. -
  6356. -First of all it changes the way we calculate primary channel offset. If
  6357. -we use e.g. 80 MHz channel with primary frequency 5180 MHz (which means
  6358. -center frequency is 5210 MHz) it makes sense to calculate primary offset
  6359. -as -30 MHz.
  6360. -Then it fixes values we compare primary_offset with. We were comparing
  6361. -offset in MHz against -2 or 2 which was resulting in picking a wrong
  6362. -primary channel.
  6363. -
  6364. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6365. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6366. ----
  6367. -
  6368. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  6369. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  6370. -@@ -247,7 +247,7 @@ static u16 chandef_to_chanspec(struct br
  6371. - brcmf_dbg(TRACE, "chandef: control %d center %d width %d\n",
  6372. - ch->chan->center_freq, ch->center_freq1, ch->width);
  6373. - ch_inf.chnum = ieee80211_frequency_to_channel(ch->center_freq1);
  6374. -- primary_offset = ch->center_freq1 - ch->chan->center_freq;
  6375. -+ primary_offset = ch->chan->center_freq - ch->center_freq1;
  6376. - switch (ch->width) {
  6377. - case NL80211_CHAN_WIDTH_20:
  6378. - case NL80211_CHAN_WIDTH_20_NOHT:
  6379. -@@ -256,24 +256,21 @@ static u16 chandef_to_chanspec(struct br
  6380. - break;
  6381. - case NL80211_CHAN_WIDTH_40:
  6382. - ch_inf.bw = BRCMU_CHAN_BW_40;
  6383. -- if (primary_offset < 0)
  6384. -+ if (primary_offset > 0)
  6385. - ch_inf.sb = BRCMU_CHAN_SB_U;
  6386. - else
  6387. - ch_inf.sb = BRCMU_CHAN_SB_L;
  6388. - break;
  6389. - case NL80211_CHAN_WIDTH_80:
  6390. - ch_inf.bw = BRCMU_CHAN_BW_80;
  6391. -- if (primary_offset < 0) {
  6392. -- if (primary_offset < -CH_10MHZ_APART)
  6393. -- ch_inf.sb = BRCMU_CHAN_SB_UU;
  6394. -- else
  6395. -- ch_inf.sb = BRCMU_CHAN_SB_UL;
  6396. -- } else {
  6397. -- if (primary_offset > CH_10MHZ_APART)
  6398. -- ch_inf.sb = BRCMU_CHAN_SB_LL;
  6399. -- else
  6400. -- ch_inf.sb = BRCMU_CHAN_SB_LU;
  6401. -- }
  6402. -+ if (primary_offset == -30)
  6403. -+ ch_inf.sb = BRCMU_CHAN_SB_LL;
  6404. -+ else if (primary_offset == -10)
  6405. -+ ch_inf.sb = BRCMU_CHAN_SB_LU;
  6406. -+ else if (primary_offset == 10)
  6407. -+ ch_inf.sb = BRCMU_CHAN_SB_UL;
  6408. -+ else
  6409. -+ ch_inf.sb = BRCMU_CHAN_SB_UU;
  6410. - break;
  6411. - case NL80211_CHAN_WIDTH_80P80:
  6412. - case NL80211_CHAN_WIDTH_160:
  6413. 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
  6414. deleted file mode 100644
  6415. index d7018da..0000000
  6416. --- a/package/kernel/mac80211/patches/323-0001-brcmfmac-analyze-descriptors-of-current-component-on.patch
  6417. +++ /dev/null
  6418. @@ -1,51 +0,0 @@
  6419. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6420. -Date: Tue, 26 Jan 2016 17:57:01 +0100
  6421. -Subject: [PATCH] brcmfmac: analyze descriptors of current component only
  6422. -MIME-Version: 1.0
  6423. -Content-Type: text/plain; charset=UTF-8
  6424. -Content-Transfer-Encoding: 8bit
  6425. -
  6426. -So far we were looking for address descriptors without a check for
  6427. -crossing current component border. In case of dealing with unsupported
  6428. -descriptor or descriptor missing at all the code would incorrectly get
  6429. -data from another component.
  6430. -
  6431. -Consider this binary-described component from BCM4366 EROM:
  6432. -4bf83b01 TAG==CI CID==0x83b
  6433. -20080201 TAG==CI PORTS==0+1 WRAPPERS==0+1
  6434. -18400035 TAG==ADDR SZ_SZD TYPE_SLAVE
  6435. -00050000
  6436. -18107085 TAG==ADDR SZ_4K TYPE_SWRAP
  6437. -
  6438. -Driver was assigning invalid base address to this core:
  6439. -brcmfmac: [6 ] core 0x83b:32 base 0x18109000 wrap 0x18107000
  6440. -which came from totally different component defined in EROM:
  6441. -43b36701 TAG==CI CID==0x367
  6442. -00000201 TAG==CI PORTS==0+1 WRAPPERS==0+0
  6443. -18109005 TAG==ADDR SZ_4K TYPE_SLAVE
  6444. -
  6445. -This change will also allow us to support components without wrapper
  6446. -address in the future.
  6447. -
  6448. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6449. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6450. ----
  6451. -
  6452. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6453. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6454. -@@ -803,7 +803,14 @@ static int brcmf_chip_dmp_get_regaddr(st
  6455. - *eromaddr -= 4;
  6456. - return -EFAULT;
  6457. - }
  6458. -- } while (desc != DMP_DESC_ADDRESS);
  6459. -+ } while (desc != DMP_DESC_ADDRESS &&
  6460. -+ desc != DMP_DESC_COMPONENT);
  6461. -+
  6462. -+ /* stop if we crossed current component border */
  6463. -+ if (desc == DMP_DESC_COMPONENT) {
  6464. -+ *eromaddr -= 4;
  6465. -+ return 0;
  6466. -+ }
  6467. -
  6468. - /* skip upper 32-bit address descriptor */
  6469. - if (val & DMP_DESC_ADDRSIZE_GT32)
  6470. 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
  6471. deleted file mode 100644
  6472. index 045ab49..0000000
  6473. --- a/package/kernel/mac80211/patches/323-0002-brcmfmac-allow-storing-PMU-core-without-wrapper-addr.patch
  6474. +++ /dev/null
  6475. @@ -1,28 +0,0 @@
  6476. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6477. -Date: Tue, 26 Jan 2016 17:57:02 +0100
  6478. -Subject: [PATCH] brcmfmac: allow storing PMU core without wrapper address
  6479. -MIME-Version: 1.0
  6480. -Content-Type: text/plain; charset=UTF-8
  6481. -Content-Transfer-Encoding: 8bit
  6482. -
  6483. -Separated PMU core can be found in new devices and should be used for
  6484. -accessing PMU registers (which were routed through ChipCommon so far).
  6485. -This core is one of exceptions that doesn't have or need wrapper address
  6486. -to be still safely accessible.
  6487. -
  6488. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6489. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6490. ----
  6491. -
  6492. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6493. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6494. -@@ -883,7 +883,8 @@ int brcmf_chip_dmp_erom_scan(struct brcm
  6495. - rev = (val & DMP_COMP_REVISION) >> DMP_COMP_REVISION_S;
  6496. -
  6497. - /* need core with ports */
  6498. -- if (nmw + nsw == 0)
  6499. -+ if (nmw + nsw == 0 &&
  6500. -+ id != BCMA_CORE_PMU)
  6501. - continue;
  6502. -
  6503. - /* try to obtain register address info */
  6504. 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
  6505. deleted file mode 100644
  6506. index 7b7ba4f..0000000
  6507. --- a/package/kernel/mac80211/patches/323-0003-brcmfmac-read-extended-capabilities-of-ChipCommon-co.patch
  6508. +++ /dev/null
  6509. @@ -1,43 +0,0 @@
  6510. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6511. -Date: Tue, 26 Jan 2016 17:57:03 +0100
  6512. -Subject: [PATCH] brcmfmac: read extended capabilities of ChipCommon core
  6513. -MIME-Version: 1.0
  6514. -Content-Type: text/plain; charset=UTF-8
  6515. -Content-Transfer-Encoding: 8bit
  6516. -
  6517. -This is an extra bitfield with info about some present hardware.
  6518. -
  6519. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6520. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6521. ----
  6522. -
  6523. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6524. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6525. -@@ -1025,6 +1025,9 @@ static int brcmf_chip_setup(struct brcmf
  6526. - /* get chipcommon capabilites */
  6527. - pub->cc_caps = chip->ops->read32(chip->ctx,
  6528. - CORE_CC_REG(base, capabilities));
  6529. -+ pub->cc_caps_ext = chip->ops->read32(chip->ctx,
  6530. -+ CORE_CC_REG(base,
  6531. -+ capabilities_ext));
  6532. -
  6533. - /* get pmu caps & rev */
  6534. - if (pub->cc_caps & CC_CAP_PMU) {
  6535. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  6536. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  6537. -@@ -27,6 +27,7 @@
  6538. - * @chip: chip identifier.
  6539. - * @chiprev: chip revision.
  6540. - * @cc_caps: chipcommon core capabilities.
  6541. -+ * @cc_caps_ext: chipcommon core extended capabilities.
  6542. - * @pmucaps: PMU capabilities.
  6543. - * @pmurev: PMU revision.
  6544. - * @rambase: RAM base address (only applicable for ARM CR4 chips).
  6545. -@@ -38,6 +39,7 @@ struct brcmf_chip {
  6546. - u32 chip;
  6547. - u32 chiprev;
  6548. - u32 cc_caps;
  6549. -+ u32 cc_caps_ext;
  6550. - u32 pmucaps;
  6551. - u32 pmurev;
  6552. - u32 rambase;
  6553. 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
  6554. deleted file mode 100644
  6555. index 2af6fd9..0000000
  6556. --- a/package/kernel/mac80211/patches/323-0004-brcmfmac-access-PMU-registers-using-standalone-PMU-c.patch
  6557. +++ /dev/null
  6558. @@ -1,148 +0,0 @@
  6559. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6560. -Date: Tue, 26 Jan 2016 17:57:04 +0100
  6561. -Subject: [PATCH] brcmfmac: access PMU registers using standalone PMU core if
  6562. - available
  6563. -MIME-Version: 1.0
  6564. -Content-Type: text/plain; charset=UTF-8
  6565. -Content-Transfer-Encoding: 8bit
  6566. -
  6567. -On recent Broadcom chipsets PMU is present as separated core and it
  6568. -can't be accessed using ChipCommon anymore as it fails with e.g.:
  6569. -[ 18.198412] Unhandled fault: imprecise external abort (0x1406) at 0xb6da200f
  6570. -
  6571. -Add a new helper function that will return a proper core that should be
  6572. -used for accessing PMU registers.
  6573. -
  6574. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6575. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6576. ----
  6577. -
  6578. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6579. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
  6580. -@@ -1014,6 +1014,7 @@ static int brcmf_chip_setup(struct brcmf
  6581. - {
  6582. - struct brcmf_chip *pub;
  6583. - struct brcmf_core_priv *cc;
  6584. -+ struct brcmf_core *pmu;
  6585. - u32 base;
  6586. - u32 val;
  6587. - int ret = 0;
  6588. -@@ -1030,9 +1031,10 @@ static int brcmf_chip_setup(struct brcmf
  6589. - capabilities_ext));
  6590. -
  6591. - /* get pmu caps & rev */
  6592. -+ pmu = brcmf_chip_get_pmu(pub); /* after reading cc_caps_ext */
  6593. - if (pub->cc_caps & CC_CAP_PMU) {
  6594. - val = chip->ops->read32(chip->ctx,
  6595. -- CORE_CC_REG(base, pmucapabilities));
  6596. -+ CORE_CC_REG(pmu->base, pmucapabilities));
  6597. - pub->pmurev = val & PCAP_REV_MASK;
  6598. - pub->pmucaps = val;
  6599. - }
  6600. -@@ -1131,6 +1133,23 @@ struct brcmf_core *brcmf_chip_get_chipco
  6601. - return &cc->pub;
  6602. - }
  6603. -
  6604. -+struct brcmf_core *brcmf_chip_get_pmu(struct brcmf_chip *pub)
  6605. -+{
  6606. -+ struct brcmf_core *cc = brcmf_chip_get_chipcommon(pub);
  6607. -+ struct brcmf_core *pmu;
  6608. -+
  6609. -+ /* See if there is separated PMU core available */
  6610. -+ if (cc->rev >= 35 &&
  6611. -+ pub->cc_caps_ext & BCMA_CC_CAP_EXT_AOB_PRESENT) {
  6612. -+ pmu = brcmf_chip_get_core(pub, BCMA_CORE_PMU);
  6613. -+ if (pmu)
  6614. -+ return pmu;
  6615. -+ }
  6616. -+
  6617. -+ /* Fallback to ChipCommon core for older hardware */
  6618. -+ return cc;
  6619. -+}
  6620. -+
  6621. - bool brcmf_chip_iscoreup(struct brcmf_core *pub)
  6622. - {
  6623. - struct brcmf_core_priv *core;
  6624. -@@ -1301,6 +1320,7 @@ bool brcmf_chip_sr_capable(struct brcmf_
  6625. - {
  6626. - u32 base, addr, reg, pmu_cc3_mask = ~0;
  6627. - struct brcmf_chip_priv *chip;
  6628. -+ struct brcmf_core *pmu = brcmf_chip_get_pmu(pub);
  6629. -
  6630. - brcmf_dbg(TRACE, "Enter\n");
  6631. -
  6632. -@@ -1320,9 +1340,9 @@ bool brcmf_chip_sr_capable(struct brcmf_
  6633. - case BRCM_CC_4335_CHIP_ID:
  6634. - case BRCM_CC_4339_CHIP_ID:
  6635. - /* read PMU chipcontrol register 3 */
  6636. -- addr = CORE_CC_REG(base, chipcontrol_addr);
  6637. -+ addr = CORE_CC_REG(pmu->base, chipcontrol_addr);
  6638. - chip->ops->write32(chip->ctx, addr, 3);
  6639. -- addr = CORE_CC_REG(base, chipcontrol_data);
  6640. -+ addr = CORE_CC_REG(pmu->base, chipcontrol_data);
  6641. - reg = chip->ops->read32(chip->ctx, addr);
  6642. - return (reg & pmu_cc3_mask) != 0;
  6643. - case BRCM_CC_43430_CHIP_ID:
  6644. -@@ -1330,12 +1350,12 @@ bool brcmf_chip_sr_capable(struct brcmf_
  6645. - reg = chip->ops->read32(chip->ctx, addr);
  6646. - return reg != 0;
  6647. - default:
  6648. -- addr = CORE_CC_REG(base, pmucapabilities_ext);
  6649. -+ addr = CORE_CC_REG(pmu->base, pmucapabilities_ext);
  6650. - reg = chip->ops->read32(chip->ctx, addr);
  6651. - if ((reg & PCAPEXT_SR_SUPPORTED_MASK) == 0)
  6652. - return false;
  6653. -
  6654. -- addr = CORE_CC_REG(base, retention_ctl);
  6655. -+ addr = CORE_CC_REG(pmu->base, retention_ctl);
  6656. - reg = chip->ops->read32(chip->ctx, addr);
  6657. - return (reg & (PMU_RCTL_MACPHY_DISABLE_MASK |
  6658. - PMU_RCTL_LOGIC_DISABLE_MASK)) == 0;
  6659. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  6660. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.h
  6661. -@@ -85,6 +85,7 @@ struct brcmf_chip *brcmf_chip_attach(voi
  6662. - void brcmf_chip_detach(struct brcmf_chip *chip);
  6663. - struct brcmf_core *brcmf_chip_get_core(struct brcmf_chip *chip, u16 coreid);
  6664. - struct brcmf_core *brcmf_chip_get_chipcommon(struct brcmf_chip *chip);
  6665. -+struct brcmf_core *brcmf_chip_get_pmu(struct brcmf_chip *pub);
  6666. - bool brcmf_chip_iscoreup(struct brcmf_core *core);
  6667. - void brcmf_chip_coredisable(struct brcmf_core *core, u32 prereset, u32 reset);
  6668. - void brcmf_chip_resetcore(struct brcmf_core *core, u32 prereset, u32 reset,
  6669. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  6670. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  6671. -@@ -3615,7 +3615,6 @@ brcmf_sdio_drivestrengthinit(struct brcm
  6672. - const struct sdiod_drive_str *str_tab = NULL;
  6673. - u32 str_mask;
  6674. - u32 str_shift;
  6675. -- u32 base;
  6676. - u32 i;
  6677. - u32 drivestrength_sel = 0;
  6678. - u32 cc_data_temp;
  6679. -@@ -3658,14 +3657,15 @@ brcmf_sdio_drivestrengthinit(struct brcm
  6680. - }
  6681. -
  6682. - if (str_tab != NULL) {
  6683. -+ struct brcmf_core *pmu = brcmf_chip_get_pmu(ci);
  6684. -+
  6685. - for (i = 0; str_tab[i].strength != 0; i++) {
  6686. - if (drivestrength >= str_tab[i].strength) {
  6687. - drivestrength_sel = str_tab[i].sel;
  6688. - break;
  6689. - }
  6690. - }
  6691. -- base = brcmf_chip_get_chipcommon(ci)->base;
  6692. -- addr = CORE_CC_REG(base, chipcontrol_addr);
  6693. -+ addr = CORE_CC_REG(pmu->base, chipcontrol_addr);
  6694. - brcmf_sdiod_regwl(sdiodev, addr, 1, NULL);
  6695. - cc_data_temp = brcmf_sdiod_regrl(sdiodev, addr, NULL);
  6696. - cc_data_temp &= ~str_mask;
  6697. -@@ -3835,8 +3835,7 @@ brcmf_sdio_probe_attach(struct brcmf_sdi
  6698. - goto fail;
  6699. -
  6700. - /* set PMUControl so a backplane reset does PMU state reload */
  6701. -- reg_addr = CORE_CC_REG(brcmf_chip_get_chipcommon(bus->ci)->base,
  6702. -- pmucontrol);
  6703. -+ reg_addr = CORE_CC_REG(brcmf_chip_get_pmu(bus->ci)->base, pmucontrol);
  6704. - reg_val = brcmf_sdiod_regrl(bus->sdiodev, reg_addr, &err);
  6705. - if (err)
  6706. - goto fail;
  6707. 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
  6708. deleted file mode 100644
  6709. index 35887fc..0000000
  6710. --- a/package/kernel/mac80211/patches/323-0005-brcmfmac-add-support-for-14e4-4365-PCI-ID-with-BCM43.patch
  6711. +++ /dev/null
  6712. @@ -1,38 +0,0 @@
  6713. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6714. -Date: Tue, 26 Jan 2016 17:57:05 +0100
  6715. -Subject: [PATCH] brcmfmac: add support for 14e4:4365 PCI ID with BCM4366
  6716. - chipset
  6717. -MIME-Version: 1.0
  6718. -Content-Type: text/plain; charset=UTF-8
  6719. -Content-Transfer-Encoding: 8bit
  6720. -
  6721. -On Broadcom ARM routers BCM4366 cards are available with 14e4:4365 ID.
  6722. -Unfortunately this ID was already used by Broadcom for cards with
  6723. -BCM43142, a totally different chipset requiring SoftMAC driver. To avoid
  6724. -a conflict between brcmfmac and bcma use more specific ID entry with
  6725. -subvendor and subdevice specified.
  6726. -
  6727. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6728. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6729. ----
  6730. -
  6731. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  6732. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  6733. -@@ -1951,6 +1951,9 @@ static const struct dev_pm_ops brcmf_pci
  6734. -
  6735. - #define BRCMF_PCIE_DEVICE(dev_id) { BRCM_PCIE_VENDOR_ID_BROADCOM, dev_id,\
  6736. - PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 }
  6737. -+#define BRCMF_PCIE_DEVICE_SUB(dev_id, subvend, subdev) { \
  6738. -+ BRCM_PCIE_VENDOR_ID_BROADCOM, dev_id,\
  6739. -+ subvend, subdev, PCI_CLASS_NETWORK_OTHER << 8, 0xffff00, 0 }
  6740. -
  6741. - static struct pci_device_id brcmf_pcie_devid_table[] = {
  6742. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4350_DEVICE_ID),
  6743. -@@ -1966,6 +1969,7 @@ static struct pci_device_id brcmf_pcie_d
  6744. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_DEVICE_ID),
  6745. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_2G_DEVICE_ID),
  6746. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_5G_DEVICE_ID),
  6747. -+ BRCMF_PCIE_DEVICE_SUB(0x4365, BRCM_PCIE_VENDOR_ID_BROADCOM, 0x4365),
  6748. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_DEVICE_ID),
  6749. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_2G_DEVICE_ID),
  6750. - BRCMF_PCIE_DEVICE(BRCM_PCIE_4366_5G_DEVICE_ID),
  6751. diff --git a/package/kernel/mac80211/patches/323-ath9k-Fix-programming-of-minCCA-power-threshold.patch b/package/kernel/mac80211/patches/323-ath9k-Fix-programming-of-minCCA-power-threshold.patch
  6752. new file mode 100644
  6753. index 0000000..59ac29b
  6754. --- /dev/null
  6755. +++ b/package/kernel/mac80211/patches/323-ath9k-Fix-programming-of-minCCA-power-threshold.patch
  6756. @@ -0,0 +1,26 @@
  6757. +From: Sven Eckelmann <sven@narfation.org>
  6758. +Date: Fri, 17 Jun 2016 11:58:20 +0200
  6759. +Subject: [PATCH] ath9k: Fix programming of minCCA power threshold
  6760. +
  6761. +The function ar9003_hw_apply_minccapwr_thresh takes as second parameter not
  6762. +a pointer to the channel but a boolean value describing whether the channel
  6763. +is 2.4GHz or not. This broke (according to the origin commit) the ETSI
  6764. +regulatory compliance on 5GHz channels.
  6765. +
  6766. +Fixes: 3533bf6b15a0 ("ath9k: Fix regulatory compliance")
  6767. +Signed-off-by: Sven Eckelmann <sven@narfation.org>
  6768. +Cc: Simon Wunderlich <sw@simonwunderlich.de>
  6769. +Cc: Sujith Manoharan <c_manoha@qca.qualcomm.com>
  6770. +---
  6771. +
  6772. +--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  6773. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
  6774. +@@ -4175,7 +4175,7 @@ static void ath9k_hw_ar9300_set_board_va
  6775. + if (!AR_SREV_9330(ah) && !AR_SREV_9340(ah) && !AR_SREV_9531(ah))
  6776. + ar9003_hw_internal_regulator_apply(ah);
  6777. + ar9003_hw_apply_tuning_caps(ah);
  6778. +- ar9003_hw_apply_minccapwr_thresh(ah, chan);
  6779. ++ ar9003_hw_apply_minccapwr_thresh(ah, is2ghz);
  6780. + ar9003_hw_txend_to_xpa_off_apply(ah, is2ghz);
  6781. + ar9003_hw_thermometer_apply(ah);
  6782. + ar9003_hw_thermo_cal_apply(ah);
  6783. diff --git a/package/kernel/mac80211/patches/324-ath9k_hw-fix-spectral-scan-on-AR9285-and-newer.patch b/package/kernel/mac80211/patches/324-ath9k_hw-fix-spectral-scan-on-AR9285-and-newer.patch
  6784. new file mode 100644
  6785. index 0000000..b6f4868
  6786. --- /dev/null
  6787. +++ b/package/kernel/mac80211/patches/324-ath9k_hw-fix-spectral-scan-on-AR9285-and-newer.patch
  6788. @@ -0,0 +1,86 @@
  6789. +From: Felix Fietkau <nbd@nbd.name>
  6790. +Date: Mon, 11 Jul 2016 10:34:37 +0200
  6791. +Subject: [PATCH] ath9k_hw: fix spectral scan on AR9285 and newer
  6792. +
  6793. +The register layout of AR_PHY_SPECTRAL_SCAN has changed, only AR9280
  6794. +uses the old layout
  6795. +
  6796. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  6797. +---
  6798. +
  6799. +--- a/drivers/net/wireless/ath/ath9k/ar9002_phy.c
  6800. ++++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.c
  6801. +@@ -476,6 +476,7 @@ static void ar9002_hw_set_bt_ant_diversi
  6802. + static void ar9002_hw_spectral_scan_config(struct ath_hw *ah,
  6803. + struct ath_spec_scan *param)
  6804. + {
  6805. ++ u32 repeat_bit;
  6806. + u8 count;
  6807. +
  6808. + if (!param->enabled) {
  6809. +@@ -486,12 +487,15 @@ static void ar9002_hw_spectral_scan_conf
  6810. + REG_SET_BIT(ah, AR_PHY_RADAR_0, AR_PHY_RADAR_0_FFT_ENA);
  6811. + REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, AR_PHY_SPECTRAL_SCAN_ENABLE);
  6812. +
  6813. ++ if (AR_SREV_9280(ah))
  6814. ++ repeat_bit = AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT;
  6815. ++ else
  6816. ++ repeat_bit = AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_KIWI;
  6817. ++
  6818. + if (param->short_repeat)
  6819. +- REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN,
  6820. +- AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT);
  6821. ++ REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, repeat_bit);
  6822. + else
  6823. +- REG_CLR_BIT(ah, AR_PHY_SPECTRAL_SCAN,
  6824. +- AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT);
  6825. ++ REG_CLR_BIT(ah, AR_PHY_SPECTRAL_SCAN, repeat_bit);
  6826. +
  6827. + /* on AR92xx, the highest bit of count will make the the chip send
  6828. + * spectral samples endlessly. Check if this really was intended,
  6829. +@@ -499,15 +503,25 @@ static void ar9002_hw_spectral_scan_conf
  6830. + */
  6831. + count = param->count;
  6832. + if (param->endless) {
  6833. +- if (AR_SREV_9271(ah))
  6834. +- count = 0;
  6835. +- else
  6836. ++ if (AR_SREV_9280(ah))
  6837. + count = 0x80;
  6838. ++ else
  6839. ++ count = 0;
  6840. + } else if (count & 0x80)
  6841. + count = 0x7f;
  6842. ++ else if (!count)
  6843. ++ count = 1;
  6844. ++
  6845. ++ if (AR_SREV_9280(ah)) {
  6846. ++ REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  6847. ++ AR_PHY_SPECTRAL_SCAN_COUNT, count);
  6848. ++ } else {
  6849. ++ REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  6850. ++ AR_PHY_SPECTRAL_SCAN_COUNT_KIWI, count);
  6851. ++ REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN,
  6852. ++ AR_PHY_SPECTRAL_SCAN_PHYERR_MASK_SELECT);
  6853. ++ }
  6854. +
  6855. +- REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  6856. +- AR_PHY_SPECTRAL_SCAN_COUNT, count);
  6857. + REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  6858. + AR_PHY_SPECTRAL_SCAN_PERIOD, param->period);
  6859. + REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
  6860. +--- a/drivers/net/wireless/ath/ath9k/ar9002_phy.h
  6861. ++++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.h
  6862. +@@ -177,8 +177,11 @@
  6863. + #define AR_PHY_SPECTRAL_SCAN_PERIOD_S 8
  6864. + #define AR_PHY_SPECTRAL_SCAN_COUNT 0x00FF0000 /* Number of reports, reg 68, bits 16-23*/
  6865. + #define AR_PHY_SPECTRAL_SCAN_COUNT_S 16
  6866. ++#define AR_PHY_SPECTRAL_SCAN_COUNT_KIWI 0x0FFF0000 /* Number of reports, reg 68, bits 16-27*/
  6867. ++#define AR_PHY_SPECTRAL_SCAN_COUNT_KIWI_S 16
  6868. + #define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT 0x01000000 /* Short repeat, reg 68, bit 24*/
  6869. +-#define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_S 24 /* Short repeat, reg 68, bit 24*/
  6870. ++#define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_KIWI 0x10000000 /* Short repeat, reg 68, bit 28*/
  6871. ++#define AR_PHY_SPECTRAL_SCAN_PHYERR_MASK_SELECT 0x40000000
  6872. +
  6873. + #define AR_PHY_RX_DELAY 0x9914
  6874. + #define AR_PHY_SEARCH_START_DELAY 0x9918
  6875. 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
  6876. deleted file mode 100644
  6877. index 6ce60f1..0000000
  6878. --- a/package/kernel/mac80211/patches/324-brcmfmac-treat-NULL-character-in-NVRAM-as-separator.patch
  6879. +++ /dev/null
  6880. @@ -1,32 +0,0 @@
  6881. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  6882. -Date: Sun, 31 Jan 2016 12:14:34 +0100
  6883. -Subject: [PATCH] brcmfmac: treat NULL character in NVRAM as separator
  6884. -MIME-Version: 1.0
  6885. -Content-Type: text/plain; charset=UTF-8
  6886. -Content-Transfer-Encoding: 8bit
  6887. -
  6888. -Platform NVRAM (stored on a flash partition) has entries separated by a
  6889. -NULL (\0) char. Our parsing code switches from VALUE state to IDLE
  6890. -whenever it meets a NULL (\0). When that happens our IDLE handler should
  6891. -simply consume it and analyze whatever is placed ahead.
  6892. -
  6893. -This fixes harmless warnings spamming debugging output:
  6894. -[ 155.165624] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=20: ignoring invalid character
  6895. -[ 155.180806] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=44: ignoring invalid character
  6896. -[ 155.195971] brcmfmac: brcmf_nvram_handle_idle warning: ln=1:col=63: ignoring invalid character
  6897. -
  6898. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6899. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  6900. ----
  6901. -
  6902. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  6903. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  6904. -@@ -93,7 +93,7 @@ static enum nvram_parser_state brcmf_nvr
  6905. - c = nvp->data[nvp->pos];
  6906. - if (c == '\n')
  6907. - return COMMENT;
  6908. -- if (is_whitespace(c))
  6909. -+ if (is_whitespace(c) || c == '\0')
  6910. - goto proceed;
  6911. - if (c == '#')
  6912. - return COMMENT;
  6913. diff --git a/package/kernel/mac80211/patches/325-ath9k_hw-fix-duplicate-and-partially-wrong-definitio.patch b/package/kernel/mac80211/patches/325-ath9k_hw-fix-duplicate-and-partially-wrong-definitio.patch
  6914. new file mode 100644
  6915. index 0000000..6685f33
  6916. --- /dev/null
  6917. +++ b/package/kernel/mac80211/patches/325-ath9k_hw-fix-duplicate-and-partially-wrong-definitio.patch
  6918. @@ -0,0 +1,57 @@
  6919. +From: Felix Fietkau <nbd@nbd.name>
  6920. +Date: Mon, 11 Jul 2016 11:31:39 +0200
  6921. +Subject: [PATCH] ath9k_hw: fix duplicate (and partially wrong) definition
  6922. + of AR_CH0_THERM
  6923. +
  6924. +AR_PHY_65NM_CH0_THERM and AR_CH0_THERM were supposed to refer to the
  6925. +same register, however they had different SREV checks.
  6926. +
  6927. +Remove the duplicate and use the checks. Since there were other SREV
  6928. +checks present in the only place that uses this, this will probaby not
  6929. +affect runtime behavior.
  6930. +
  6931. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  6932. +---
  6933. +
  6934. +--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.h
  6935. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.h
  6936. +@@ -689,13 +689,6 @@
  6937. + #define AR_CH0_TOP_XPABIASLVL (AR_SREV_9550(ah) ? 0x3c0 : 0x300)
  6938. + #define AR_CH0_TOP_XPABIASLVL_S (AR_SREV_9550(ah) ? 6 : 8)
  6939. +
  6940. +-#define AR_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 : \
  6941. +- ((AR_SREV_9485(ah) ? 0x1628c : 0x16294)))
  6942. +-#define AR_CH0_THERM_XPABIASLVL_MSB 0x3
  6943. +-#define AR_CH0_THERM_XPABIASLVL_MSB_S 0
  6944. +-#define AR_CH0_THERM_XPASHORT2GND 0x4
  6945. +-#define AR_CH0_THERM_XPASHORT2GND_S 2
  6946. +-
  6947. + #define AR_SWITCH_TABLE_COM_ALL (0xffff)
  6948. + #define AR_SWITCH_TABLE_COM_ALL_S (0)
  6949. + #define AR_SWITCH_TABLE_COM_AR9462_ALL (0xffffff)
  6950. +@@ -712,15 +705,17 @@
  6951. + #define AR_SWITCH_TABLE_ALL (0xfff)
  6952. + #define AR_SWITCH_TABLE_ALL_S (0)
  6953. +
  6954. +-#define AR_PHY_65NM_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 :\
  6955. +- ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x16294 : 0x1628c))
  6956. ++#define AR_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 :\
  6957. ++ ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x16294 : 0x1628c))
  6958. ++#define AR_CH0_THERM_XPABIASLVL_MSB 0x3
  6959. ++#define AR_CH0_THERM_XPABIASLVL_MSB_S 0
  6960. ++#define AR_CH0_THERM_XPASHORT2GND 0x4
  6961. ++#define AR_CH0_THERM_XPASHORT2GND_S 2
  6962. +
  6963. +-#define AR_PHY_65NM_CH0_THERM_LOCAL 0x80000000
  6964. +-#define AR_PHY_65NM_CH0_THERM_LOCAL_S 31
  6965. +-#define AR_PHY_65NM_CH0_THERM_START 0x20000000
  6966. +-#define AR_PHY_65NM_CH0_THERM_START_S 29
  6967. +-#define AR_PHY_65NM_CH0_THERM_SAR_ADC_OUT 0x0000ff00
  6968. +-#define AR_PHY_65NM_CH0_THERM_SAR_ADC_OUT_S 8
  6969. ++#define AR_CH0_THERM_LOCAL 0x80000000
  6970. ++#define AR_CH0_THERM_START 0x20000000
  6971. ++#define AR_CH0_THERM_SAR_ADC_OUT 0x0000ff00
  6972. ++#define AR_CH0_THERM_SAR_ADC_OUT_S 8
  6973. +
  6974. + #define AR_CH0_TOP2 (AR_SREV_9300(ah) ? 0x1628c : \
  6975. + (AR_SREV_9462(ah) ? 0x16290 : 0x16284))
  6976. 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
  6977. deleted file mode 100644
  6978. index 012dea1..0000000
  6979. --- a/package/kernel/mac80211/patches/325-brcmfmac-sdio-Increase-the-default-timeouts-a-bit.patch
  6980. +++ /dev/null
  6981. @@ -1,41 +0,0 @@
  6982. -From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
  6983. -Date: Mon, 25 Jan 2016 11:47:29 +0100
  6984. -Subject: [PATCH] brcmfmac: sdio: Increase the default timeouts a bit
  6985. -
  6986. -On a Radxa Rock2 board with a Ampak AP6335 (Broadcom 4339 core) it seems
  6987. -the card responds very quickly most of the time, unfortunately during
  6988. -initialisation it sometimes seems to take just a bit over 2 seconds to
  6989. -respond.
  6990. -
  6991. -This results intialization failing with message like:
  6992. - brcmf_c_preinit_dcmds: Retreiving cur_etheraddr failed, -52
  6993. - brcmf_bus_start: failed: -52
  6994. - brcmf_sdio_firmware_callback: dongle is not responding
  6995. -
  6996. -Increasing the timeout to allow for a bit more headroom allows the
  6997. -card to initialize reliably.
  6998. -
  6999. -A quick search online after diagnosing/fixing this showed that Google
  7000. -has a similar patch in their ChromeOS tree, so this doesn't seem
  7001. -specific to the board I'm using.
  7002. -
  7003. -Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
  7004. -Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
  7005. -Acked-by: Arend van Spriel <arend@broadcom.com>
  7006. -Reviewed-by: Douglas Anderson <dianders@chromium.org>
  7007. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  7008. ----
  7009. -
  7010. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  7011. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  7012. -@@ -45,8 +45,8 @@
  7013. - #include "chip.h"
  7014. - #include "firmware.h"
  7015. -
  7016. --#define DCMD_RESP_TIMEOUT msecs_to_jiffies(2000)
  7017. --#define CTL_DONE_TIMEOUT msecs_to_jiffies(2000)
  7018. -+#define DCMD_RESP_TIMEOUT msecs_to_jiffies(2500)
  7019. -+#define CTL_DONE_TIMEOUT msecs_to_jiffies(2500)
  7020. -
  7021. - #ifdef DEBUG
  7022. -
  7023. 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
  7024. deleted file mode 100644
  7025. index 71f7a40..0000000
  7026. --- a/package/kernel/mac80211/patches/326-ath9k-make-NF-load-complete-quickly-and-reliably.patch
  7027. +++ /dev/null
  7028. @@ -1,87 +0,0 @@
  7029. -From: Miaoqing Pan <miaoqing@codeaurora.org>
  7030. -Date: Fri, 5 Feb 2016 09:45:50 +0800
  7031. -Subject: [PATCH] ath9k: make NF load complete quickly and reliably
  7032. -
  7033. -Make NF load complete quickly and reliably. NF load execution
  7034. -is delayed by HW to end of frame if frame Rx or Tx is ongoing.
  7035. -Increasing timeout to max frame duration. If NF cal is ongoing
  7036. -before NF load, stop it before load, and restart it afterwards.
  7037. -
  7038. -Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org>
  7039. ----
  7040. -
  7041. ---- a/drivers/net/wireless/ath/ath9k/calib.c
  7042. -+++ b/drivers/net/wireless/ath/ath9k/calib.c
  7043. -@@ -241,6 +241,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  7044. - u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask;
  7045. - struct ath_common *common = ath9k_hw_common(ah);
  7046. - s16 default_nf = ath9k_hw_get_default_nf(ah, chan);
  7047. -+ u32 bb_agc_ctl = REG_READ(ah, AR_PHY_AGC_CONTROL);
  7048. -
  7049. - if (ah->caldata)
  7050. - h = ah->caldata->nfCalHist;
  7051. -@@ -264,6 +265,16 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  7052. - }
  7053. -
  7054. - /*
  7055. -+ * stop NF cal if ongoing to ensure NF load completes immediately
  7056. -+ * (or after end rx/tx frame if ongoing)
  7057. -+ */
  7058. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NF) {
  7059. -+ REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
  7060. -+ REG_RMW_BUFFER_FLUSH(ah);
  7061. -+ ENABLE_REG_RMW_BUFFER(ah);
  7062. -+ }
  7063. -+
  7064. -+ /*
  7065. - * Load software filtered NF value into baseband internal minCCApwr
  7066. - * variable.
  7067. - */
  7068. -@@ -276,18 +287,33 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  7069. -
  7070. - /*
  7071. - * Wait for load to complete, should be fast, a few 10s of us.
  7072. -- * The max delay was changed from an original 250us to 10000us
  7073. -- * since 250us often results in NF load timeout and causes deaf
  7074. -- * condition during stress testing 12/12/2009
  7075. -+ * The max delay was changed from an original 250us to 22.2 msec.
  7076. -+ * This would increase timeout to the longest possible frame
  7077. -+ * (11n max length 22.1 msec)
  7078. - */
  7079. -- for (j = 0; j < 10000; j++) {
  7080. -+ for (j = 0; j < 22200; j++) {
  7081. - if ((REG_READ(ah, AR_PHY_AGC_CONTROL) &
  7082. -- AR_PHY_AGC_CONTROL_NF) == 0)
  7083. -+ AR_PHY_AGC_CONTROL_NF) == 0)
  7084. - break;
  7085. - udelay(10);
  7086. - }
  7087. -
  7088. - /*
  7089. -+ * Restart NF so it can continue.
  7090. -+ */
  7091. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NF) {
  7092. -+ ENABLE_REG_RMW_BUFFER(ah);
  7093. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_ENABLE_NF)
  7094. -+ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
  7095. -+ AR_PHY_AGC_CONTROL_ENABLE_NF);
  7096. -+ if (bb_agc_ctl & AR_PHY_AGC_CONTROL_NO_UPDATE_NF)
  7097. -+ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
  7098. -+ AR_PHY_AGC_CONTROL_NO_UPDATE_NF);
  7099. -+ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
  7100. -+ REG_RMW_BUFFER_FLUSH(ah);
  7101. -+ }
  7102. -+
  7103. -+ /*
  7104. - * We timed out waiting for the noisefloor to load, probably due to an
  7105. - * in-progress rx. Simply return here and allow the load plenty of time
  7106. - * to complete before the next calibration interval. We need to avoid
  7107. -@@ -296,7 +322,7 @@ int ath9k_hw_loadnf(struct ath_hw *ah, s
  7108. - * here, the baseband nf cal will just be capped by our present
  7109. - * noisefloor until the next calibration timer.
  7110. - */
  7111. -- if (j == 10000) {
  7112. -+ if (j == 22200) {
  7113. - ath_dbg(common, ANY,
  7114. - "Timeout while waiting for nf to load: AR_PHY_AGC_CONTROL=0x%x\n",
  7115. - REG_READ(ah, AR_PHY_AGC_CONTROL));
  7116. diff --git a/package/kernel/mac80211/patches/326-ath9k_hw-simplify-ar9003_hw_per_calibration.patch b/package/kernel/mac80211/patches/326-ath9k_hw-simplify-ar9003_hw_per_calibration.patch
  7117. new file mode 100644
  7118. index 0000000..999d993
  7119. --- /dev/null
  7120. +++ b/package/kernel/mac80211/patches/326-ath9k_hw-simplify-ar9003_hw_per_calibration.patch
  7121. @@ -0,0 +1,88 @@
  7122. +From: Felix Fietkau <nbd@nbd.name>
  7123. +Date: Mon, 11 Jul 2016 11:34:47 +0200
  7124. +Subject: [PATCH] ath9k_hw: simplify ar9003_hw_per_calibration
  7125. +
  7126. +Reduce indentation, use a variable to save a few pointer dereferences
  7127. +
  7128. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7129. +---
  7130. +
  7131. +--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  7132. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  7133. +@@ -75,50 +75,49 @@ static bool ar9003_hw_per_calibration(st
  7134. + struct ath9k_cal_list *currCal)
  7135. + {
  7136. + struct ath9k_hw_cal_data *caldata = ah->caldata;
  7137. +- /* Cal is assumed not done until explicitly set below */
  7138. +- bool iscaldone = false;
  7139. ++ const struct ath9k_percal_data *cur_caldata = currCal->calData;
  7140. +
  7141. + /* Calibration in progress. */
  7142. + if (currCal->calState == CAL_RUNNING) {
  7143. + /* Check to see if it has finished. */
  7144. +- if (!(REG_READ(ah, AR_PHY_TIMING4) & AR_PHY_TIMING4_DO_CAL)) {
  7145. +- /*
  7146. +- * Accumulate cal measures for active chains
  7147. +- */
  7148. +- currCal->calData->calCollect(ah);
  7149. +- ah->cal_samples++;
  7150. ++ if (REG_READ(ah, AR_PHY_TIMING4) & AR_PHY_TIMING4_DO_CAL)
  7151. ++ return false;
  7152. +
  7153. +- if (ah->cal_samples >=
  7154. +- currCal->calData->calNumSamples) {
  7155. +- unsigned int i, numChains = 0;
  7156. +- for (i = 0; i < AR9300_MAX_CHAINS; i++) {
  7157. +- if (rxchainmask & (1 << i))
  7158. +- numChains++;
  7159. +- }
  7160. ++ /*
  7161. ++ * Accumulate cal measures for active chains
  7162. ++ */
  7163. ++ cur_caldata->calCollect(ah);
  7164. ++ ah->cal_samples++;
  7165. +
  7166. +- /*
  7167. +- * Process accumulated data
  7168. +- */
  7169. +- currCal->calData->calPostProc(ah, numChains);
  7170. ++ if (ah->cal_samples >= cur_caldata->calNumSamples) {
  7171. ++ unsigned int i, numChains = 0;
  7172. ++ for (i = 0; i < AR9300_MAX_CHAINS; i++) {
  7173. ++ if (rxchainmask & (1 << i))
  7174. ++ numChains++;
  7175. ++ }
  7176. +
  7177. +- /* Calibration has finished. */
  7178. +- caldata->CalValid |= currCal->calData->calType;
  7179. +- currCal->calState = CAL_DONE;
  7180. +- iscaldone = true;
  7181. +- } else {
  7182. ++ /*
  7183. ++ * Process accumulated data
  7184. ++ */
  7185. ++ cur_caldata->calPostProc(ah, numChains);
  7186. ++
  7187. ++ /* Calibration has finished. */
  7188. ++ caldata->CalValid |= cur_caldata->calType;
  7189. ++ currCal->calState = CAL_DONE;
  7190. ++ return true;
  7191. ++ } else {
  7192. + /*
  7193. + * Set-up collection of another sub-sample until we
  7194. + * get desired number
  7195. + */
  7196. + ar9003_hw_setup_calibration(ah, currCal);
  7197. +- }
  7198. + }
  7199. +- } else if (!(caldata->CalValid & currCal->calData->calType)) {
  7200. ++ } else if (!(caldata->CalValid & cur_caldata->calType)) {
  7201. + /* If current cal is marked invalid in channel, kick it off */
  7202. + ath9k_hw_reset_calibration(ah, currCal);
  7203. + }
  7204. +
  7205. +- return iscaldone;
  7206. ++ return false;
  7207. + }
  7208. +
  7209. + static int ar9003_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,
  7210. diff --git a/package/kernel/mac80211/patches/327-ath9k_hw-get-rid-of-some-duplicate-code-in-calibrati.patch b/package/kernel/mac80211/patches/327-ath9k_hw-get-rid-of-some-duplicate-code-in-calibrati.patch
  7211. new file mode 100644
  7212. index 0000000..b7f3823
  7213. --- /dev/null
  7214. +++ b/package/kernel/mac80211/patches/327-ath9k_hw-get-rid-of-some-duplicate-code-in-calibrati.patch
  7215. @@ -0,0 +1,94 @@
  7216. +From: Felix Fietkau <nbd@nbd.name>
  7217. +Date: Mon, 11 Jul 2016 11:35:20 +0200
  7218. +Subject: [PATCH] ath9k_hw: get rid of some duplicate code in calibration
  7219. + init
  7220. +
  7221. +Remove a misleading debug message as well
  7222. +
  7223. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7224. +---
  7225. +
  7226. +--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  7227. ++++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
  7228. +@@ -1373,6 +1373,26 @@ static void ar9003_hw_cl_cal_post_proc(s
  7229. + }
  7230. + }
  7231. +
  7232. ++static void ar9003_hw_init_cal_common(struct ath_hw *ah)
  7233. ++{
  7234. ++ struct ath9k_hw_cal_data *caldata = ah->caldata;
  7235. ++
  7236. ++ /* Initialize list pointers */
  7237. ++ ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
  7238. ++
  7239. ++ INIT_CAL(&ah->iq_caldata);
  7240. ++ INSERT_CAL(ah, &ah->iq_caldata);
  7241. ++
  7242. ++ /* Initialize current pointer to first element in list */
  7243. ++ ah->cal_list_curr = ah->cal_list;
  7244. ++
  7245. ++ if (ah->cal_list_curr)
  7246. ++ ath9k_hw_reset_calibration(ah, ah->cal_list_curr);
  7247. ++
  7248. ++ if (caldata)
  7249. ++ caldata->CalValid = 0;
  7250. ++}
  7251. ++
  7252. + static bool ar9003_hw_init_cal_pcoem(struct ath_hw *ah,
  7253. + struct ath9k_channel *chan)
  7254. + {
  7255. +@@ -1532,21 +1552,7 @@ skip_tx_iqcal:
  7256. + /* Revert chainmask to runtime parameters */
  7257. + ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask);
  7258. +
  7259. +- /* Initialize list pointers */
  7260. +- ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
  7261. +-
  7262. +- INIT_CAL(&ah->iq_caldata);
  7263. +- INSERT_CAL(ah, &ah->iq_caldata);
  7264. +- ath_dbg(common, CALIBRATE, "enabling IQ Calibration\n");
  7265. +-
  7266. +- /* Initialize current pointer to first element in list */
  7267. +- ah->cal_list_curr = ah->cal_list;
  7268. +-
  7269. +- if (ah->cal_list_curr)
  7270. +- ath9k_hw_reset_calibration(ah, ah->cal_list_curr);
  7271. +-
  7272. +- if (caldata)
  7273. +- caldata->CalValid = 0;
  7274. ++ ar9003_hw_init_cal_common(ah);
  7275. +
  7276. + return true;
  7277. + }
  7278. +@@ -1577,8 +1583,6 @@ static bool do_ar9003_agc_cal(struct ath
  7279. + static bool ar9003_hw_init_cal_soc(struct ath_hw *ah,
  7280. + struct ath9k_channel *chan)
  7281. + {
  7282. +- struct ath_common *common = ath9k_hw_common(ah);
  7283. +- struct ath9k_hw_cal_data *caldata = ah->caldata;
  7284. + bool txiqcal_done = false;
  7285. + bool status = true;
  7286. + bool run_agc_cal = false, sep_iq_cal = false;
  7287. +@@ -1676,21 +1680,7 @@ skip_tx_iqcal:
  7288. + /* Revert chainmask to runtime parameters */
  7289. + ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask);
  7290. +
  7291. +- /* Initialize list pointers */
  7292. +- ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
  7293. +-
  7294. +- INIT_CAL(&ah->iq_caldata);
  7295. +- INSERT_CAL(ah, &ah->iq_caldata);
  7296. +- ath_dbg(common, CALIBRATE, "enabling IQ Calibration\n");
  7297. +-
  7298. +- /* Initialize current pointer to first element in list */
  7299. +- ah->cal_list_curr = ah->cal_list;
  7300. +-
  7301. +- if (ah->cal_list_curr)
  7302. +- ath9k_hw_reset_calibration(ah, ah->cal_list_curr);
  7303. +-
  7304. +- if (caldata)
  7305. +- caldata->CalValid = 0;
  7306. ++ ar9003_hw_init_cal_common(ah);
  7307. +
  7308. + return true;
  7309. + }
  7310. 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
  7311. deleted file mode 100644
  7312. index f7f9df9..0000000
  7313. --- a/package/kernel/mac80211/patches/327-mac80211-Remove-MPP-table-entries-with-MPath.patch
  7314. +++ /dev/null
  7315. @@ -1,54 +0,0 @@
  7316. -From: Henning Rogge <hrogge@gmail.com>
  7317. -Date: Wed, 3 Feb 2016 13:58:36 +0100
  7318. -Subject: [PATCH] mac80211: Remove MPP table entries with MPath
  7319. -
  7320. -Make the mesh_path_del() function remove all mpp table entries
  7321. -that are proxied by the removed mesh path.
  7322. -
  7323. -Acked-by: Bob Copeland <me@bobcopeland.com>
  7324. -Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
  7325. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  7326. ----
  7327. -
  7328. ---- a/net/mac80211/mesh_pathtbl.c
  7329. -+++ b/net/mac80211/mesh_pathtbl.c
  7330. -@@ -835,6 +835,29 @@ void mesh_path_flush_by_nexthop(struct s
  7331. - rcu_read_unlock();
  7332. - }
  7333. -
  7334. -+static void mpp_flush_by_proxy(struct ieee80211_sub_if_data *sdata,
  7335. -+ const u8 *proxy)
  7336. -+{
  7337. -+ struct mesh_table *tbl;
  7338. -+ struct mesh_path *mpp;
  7339. -+ struct mpath_node *node;
  7340. -+ int i;
  7341. -+
  7342. -+ rcu_read_lock();
  7343. -+ read_lock_bh(&pathtbl_resize_lock);
  7344. -+ tbl = resize_dereference_mpp_paths();
  7345. -+ for_each_mesh_entry(tbl, node, i) {
  7346. -+ mpp = node->mpath;
  7347. -+ if (ether_addr_equal(mpp->mpp, proxy)) {
  7348. -+ spin_lock(&tbl->hashwlock[i]);
  7349. -+ __mesh_path_del(tbl, node);
  7350. -+ spin_unlock(&tbl->hashwlock[i]);
  7351. -+ }
  7352. -+ }
  7353. -+ read_unlock_bh(&pathtbl_resize_lock);
  7354. -+ rcu_read_unlock();
  7355. -+}
  7356. -+
  7357. - static void table_flush_by_iface(struct mesh_table *tbl,
  7358. - struct ieee80211_sub_if_data *sdata)
  7359. - {
  7360. -@@ -892,6 +915,9 @@ int mesh_path_del(struct ieee80211_sub_i
  7361. - int hash_idx;
  7362. - int err = 0;
  7363. -
  7364. -+ /* flush relevant mpp entries first */
  7365. -+ mpp_flush_by_proxy(sdata, addr);
  7366. -+
  7367. - read_lock_bh(&pathtbl_resize_lock);
  7368. - tbl = resize_dereference_mesh_paths();
  7369. - hash_idx = mesh_table_hash(addr, sdata, tbl);
  7370. 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
  7371. deleted file mode 100644
  7372. index 740993c..0000000
  7373. --- a/package/kernel/mac80211/patches/328-mac80211-let-unused-MPP-table-entries-timeout.patch
  7374. +++ /dev/null
  7375. @@ -1,104 +0,0 @@
  7376. -From: Henning Rogge <hrogge@gmail.com>
  7377. -Date: Wed, 3 Feb 2016 13:58:37 +0100
  7378. -Subject: [PATCH] mac80211: let unused MPP table entries timeout
  7379. -
  7380. -Remember the last time when a mpp table entry is used for
  7381. -rx or tx and remove them after MESH_PATH_EXPIRE time.
  7382. -
  7383. -Acked-by: Bob Copeland <me@bobcopeland.com>
  7384. -Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
  7385. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  7386. ----
  7387. -
  7388. ---- a/net/mac80211/mesh_pathtbl.c
  7389. -+++ b/net/mac80211/mesh_pathtbl.c
  7390. -@@ -942,6 +942,46 @@ enddel:
  7391. - }
  7392. -
  7393. - /**
  7394. -+ * mpp_path_del - delete a mesh proxy path from the table
  7395. -+ *
  7396. -+ * @addr: addr address (ETH_ALEN length)
  7397. -+ * @sdata: local subif
  7398. -+ *
  7399. -+ * Returns: 0 if successful
  7400. -+ */
  7401. -+static int mpp_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  7402. -+{
  7403. -+ struct mesh_table *tbl;
  7404. -+ struct mesh_path *mpath;
  7405. -+ struct mpath_node *node;
  7406. -+ struct hlist_head *bucket;
  7407. -+ int hash_idx;
  7408. -+ int err = 0;
  7409. -+
  7410. -+ read_lock_bh(&pathtbl_resize_lock);
  7411. -+ tbl = resize_dereference_mpp_paths();
  7412. -+ hash_idx = mesh_table_hash(addr, sdata, tbl);
  7413. -+ bucket = &tbl->hash_buckets[hash_idx];
  7414. -+
  7415. -+ spin_lock(&tbl->hashwlock[hash_idx]);
  7416. -+ hlist_for_each_entry(node, bucket, list) {
  7417. -+ mpath = node->mpath;
  7418. -+ if (mpath->sdata == sdata &&
  7419. -+ ether_addr_equal(addr, mpath->dst)) {
  7420. -+ __mesh_path_del(tbl, node);
  7421. -+ goto enddel;
  7422. -+ }
  7423. -+ }
  7424. -+
  7425. -+ err = -ENXIO;
  7426. -+enddel:
  7427. -+ mesh_paths_generation++;
  7428. -+ spin_unlock(&tbl->hashwlock[hash_idx]);
  7429. -+ read_unlock_bh(&pathtbl_resize_lock);
  7430. -+ return err;
  7431. -+}
  7432. -+
  7433. -+/**
  7434. - * mesh_path_tx_pending - sends pending frames in a mesh path queue
  7435. - *
  7436. - * @mpath: mesh path to activate
  7437. -@@ -1157,6 +1197,17 @@ void mesh_path_expire(struct ieee80211_s
  7438. - time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE))
  7439. - mesh_path_del(mpath->sdata, mpath->dst);
  7440. - }
  7441. -+
  7442. -+ tbl = rcu_dereference(mpp_paths);
  7443. -+ for_each_mesh_entry(tbl, node, i) {
  7444. -+ if (node->mpath->sdata != sdata)
  7445. -+ continue;
  7446. -+ mpath = node->mpath;
  7447. -+ if ((!(mpath->flags & MESH_PATH_FIXED)) &&
  7448. -+ time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE))
  7449. -+ mpp_path_del(mpath->sdata, mpath->dst);
  7450. -+ }
  7451. -+
  7452. - rcu_read_unlock();
  7453. - }
  7454. -
  7455. ---- a/net/mac80211/rx.c
  7456. -+++ b/net/mac80211/rx.c
  7457. -@@ -2291,6 +2291,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  7458. - spin_lock_bh(&mppath->state_lock);
  7459. - if (!ether_addr_equal(mppath->mpp, mpp_addr))
  7460. - memcpy(mppath->mpp, mpp_addr, ETH_ALEN);
  7461. -+ mppath->exp_time = jiffies;
  7462. - spin_unlock_bh(&mppath->state_lock);
  7463. - }
  7464. - rcu_read_unlock();
  7465. ---- a/net/mac80211/tx.c
  7466. -+++ b/net/mac80211/tx.c
  7467. -@@ -2171,8 +2171,11 @@ static struct sk_buff *ieee80211_build_h
  7468. - mpp_lookup = true;
  7469. - }
  7470. -
  7471. -- if (mpp_lookup)
  7472. -+ if (mpp_lookup) {
  7473. - mppath = mpp_path_lookup(sdata, skb->data);
  7474. -+ if (mppath)
  7475. -+ mppath->exp_time = jiffies;
  7476. -+ }
  7477. -
  7478. - if (mppath && mpath)
  7479. - mesh_path_del(mpath->sdata, mpath->dst);
  7480. 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
  7481. deleted file mode 100644
  7482. index 0c36b1d..0000000
  7483. --- a/package/kernel/mac80211/patches/329-mac80211-Unify-mesh-and-mpp-path-removal-function.patch
  7484. +++ /dev/null
  7485. @@ -1,143 +0,0 @@
  7486. -From: Henning Rogge <hrogge@gmail.com>
  7487. -Date: Wed, 3 Feb 2016 13:58:38 +0100
  7488. -Subject: [PATCH] mac80211: Unify mesh and mpp path removal function
  7489. -
  7490. -mpp_path_del() and mesh_path_del() are mostly the same function.
  7491. -Move common code into a new static function.
  7492. -
  7493. -Acked-by: Bob Copeland <me@bobcopeland.com>
  7494. -Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
  7495. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  7496. ----
  7497. -
  7498. ---- a/net/mac80211/mesh_pathtbl.c
  7499. -+++ b/net/mac80211/mesh_pathtbl.c
  7500. -@@ -55,16 +55,21 @@ int mpp_paths_generation;
  7501. - static DEFINE_RWLOCK(pathtbl_resize_lock);
  7502. -
  7503. -
  7504. -+static inline struct mesh_table *resize_dereference_paths(
  7505. -+ struct mesh_table __rcu *table)
  7506. -+{
  7507. -+ return rcu_dereference_protected(table,
  7508. -+ lockdep_is_held(&pathtbl_resize_lock));
  7509. -+}
  7510. -+
  7511. - static inline struct mesh_table *resize_dereference_mesh_paths(void)
  7512. - {
  7513. -- return rcu_dereference_protected(mesh_paths,
  7514. -- lockdep_is_held(&pathtbl_resize_lock));
  7515. -+ return resize_dereference_paths(mesh_paths);
  7516. - }
  7517. -
  7518. - static inline struct mesh_table *resize_dereference_mpp_paths(void)
  7519. - {
  7520. -- return rcu_dereference_protected(mpp_paths,
  7521. -- lockdep_is_held(&pathtbl_resize_lock));
  7522. -+ return resize_dereference_paths(mpp_paths);
  7523. - }
  7524. -
  7525. - /*
  7526. -@@ -899,14 +904,17 @@ void mesh_path_flush_by_iface(struct iee
  7527. - }
  7528. -
  7529. - /**
  7530. -- * mesh_path_del - delete a mesh path from the table
  7531. -+ * table_path_del - delete a path from the mesh or mpp table
  7532. - *
  7533. -- * @addr: dst address (ETH_ALEN length)
  7534. -+ * @tbl: mesh or mpp path table
  7535. - * @sdata: local subif
  7536. -+ * @addr: dst address (ETH_ALEN length)
  7537. - *
  7538. - * Returns: 0 if successful
  7539. - */
  7540. --int mesh_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  7541. -+static int table_path_del(struct mesh_table __rcu *rcu_tbl,
  7542. -+ struct ieee80211_sub_if_data *sdata,
  7543. -+ const u8 *addr)
  7544. - {
  7545. - struct mesh_table *tbl;
  7546. - struct mesh_path *mpath;
  7547. -@@ -915,11 +923,7 @@ int mesh_path_del(struct ieee80211_sub_i
  7548. - int hash_idx;
  7549. - int err = 0;
  7550. -
  7551. -- /* flush relevant mpp entries first */
  7552. -- mpp_flush_by_proxy(sdata, addr);
  7553. --
  7554. -- read_lock_bh(&pathtbl_resize_lock);
  7555. -- tbl = resize_dereference_mesh_paths();
  7556. -+ tbl = resize_dereference_paths(rcu_tbl);
  7557. - hash_idx = mesh_table_hash(addr, sdata, tbl);
  7558. - bucket = &tbl->hash_buckets[hash_idx];
  7559. -
  7560. -@@ -935,9 +939,30 @@ int mesh_path_del(struct ieee80211_sub_i
  7561. -
  7562. - err = -ENXIO;
  7563. - enddel:
  7564. -- mesh_paths_generation++;
  7565. - spin_unlock(&tbl->hashwlock[hash_idx]);
  7566. -+ return err;
  7567. -+}
  7568. -+
  7569. -+/**
  7570. -+ * mesh_path_del - delete a mesh path from the table
  7571. -+ *
  7572. -+ * @addr: dst address (ETH_ALEN length)
  7573. -+ * @sdata: local subif
  7574. -+ *
  7575. -+ * Returns: 0 if successful
  7576. -+ */
  7577. -+int mesh_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  7578. -+{
  7579. -+ int err = 0;
  7580. -+
  7581. -+ /* flush relevant mpp entries first */
  7582. -+ mpp_flush_by_proxy(sdata, addr);
  7583. -+
  7584. -+ read_lock_bh(&pathtbl_resize_lock);
  7585. -+ err = table_path_del(mesh_paths, sdata, addr);
  7586. -+ mesh_paths_generation++;
  7587. - read_unlock_bh(&pathtbl_resize_lock);
  7588. -+
  7589. - return err;
  7590. - }
  7591. -
  7592. -@@ -951,33 +976,13 @@ enddel:
  7593. - */
  7594. - static int mpp_path_del(struct ieee80211_sub_if_data *sdata, const u8 *addr)
  7595. - {
  7596. -- struct mesh_table *tbl;
  7597. -- struct mesh_path *mpath;
  7598. -- struct mpath_node *node;
  7599. -- struct hlist_head *bucket;
  7600. -- int hash_idx;
  7601. - int err = 0;
  7602. -
  7603. - read_lock_bh(&pathtbl_resize_lock);
  7604. -- tbl = resize_dereference_mpp_paths();
  7605. -- hash_idx = mesh_table_hash(addr, sdata, tbl);
  7606. -- bucket = &tbl->hash_buckets[hash_idx];
  7607. --
  7608. -- spin_lock(&tbl->hashwlock[hash_idx]);
  7609. -- hlist_for_each_entry(node, bucket, list) {
  7610. -- mpath = node->mpath;
  7611. -- if (mpath->sdata == sdata &&
  7612. -- ether_addr_equal(addr, mpath->dst)) {
  7613. -- __mesh_path_del(tbl, node);
  7614. -- goto enddel;
  7615. -- }
  7616. -- }
  7617. --
  7618. -- err = -ENXIO;
  7619. --enddel:
  7620. -- mesh_paths_generation++;
  7621. -- spin_unlock(&tbl->hashwlock[hash_idx]);
  7622. -+ err = table_path_del(mpp_paths, sdata, addr);
  7623. -+ mpp_paths_generation++;
  7624. - read_unlock_bh(&pathtbl_resize_lock);
  7625. -+
  7626. - return err;
  7627. - }
  7628. -
  7629. diff --git a/package/kernel/mac80211/patches/329-mac80211-fix-check-for-buffered-powersave-frames-wit.patch b/package/kernel/mac80211/patches/329-mac80211-fix-check-for-buffered-powersave-frames-wit.patch
  7630. new file mode 100644
  7631. index 0000000..38e541c
  7632. --- /dev/null
  7633. +++ b/package/kernel/mac80211/patches/329-mac80211-fix-check-for-buffered-powersave-frames-wit.patch
  7634. @@ -0,0 +1,21 @@
  7635. +From: Felix Fietkau <nbd@nbd.name>
  7636. +Date: Mon, 11 Jul 2016 15:07:06 +0200
  7637. +Subject: [PATCH] mac80211: fix check for buffered powersave frames with txq
  7638. +
  7639. +The logic was inverted here, set the bit if frames are pending.
  7640. +
  7641. +Fixes: ba8c3d6f16a1 ("mac80211: add an intermediate software queue implementation")
  7642. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7643. +---
  7644. +
  7645. +--- a/net/mac80211/rx.c
  7646. ++++ b/net/mac80211/rx.c
  7647. +@@ -1268,7 +1268,7 @@ static void sta_ps_start(struct sta_info
  7648. + for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) {
  7649. + struct txq_info *txqi = to_txq_info(sta->sta.txq[tid]);
  7650. +
  7651. +- if (!txqi->tin.backlog_packets)
  7652. ++ if (txqi->tin.backlog_packets)
  7653. + set_bit(tid, &sta->txq_buffered_tids);
  7654. + else
  7655. + clear_bit(tid, &sta->txq_buffered_tids);
  7656. diff --git a/package/kernel/mac80211/patches/330-ath10k-fix-rx-status-reporting-for-A-MSDU-subframes.patch b/package/kernel/mac80211/patches/330-ath10k-fix-rx-status-reporting-for-A-MSDU-subframes.patch
  7657. new file mode 100644
  7658. index 0000000..a6031b9
  7659. --- /dev/null
  7660. +++ b/package/kernel/mac80211/patches/330-ath10k-fix-rx-status-reporting-for-A-MSDU-subframes.patch
  7661. @@ -0,0 +1,36 @@
  7662. +From: Felix Fietkau <nbd@nbd.name>
  7663. +Date: Sun, 17 Jul 2016 12:49:59 +0200
  7664. +Subject: [PATCH] ath10k: fix rx status reporting for A-MSDU subframes
  7665. +
  7666. +Patch by Nagarajan, Ashok Raj <arnagara@qti.qualcomm.com>
  7667. +
  7668. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7669. +---
  7670. +
  7671. +--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
  7672. ++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
  7673. +@@ -1525,7 +1525,7 @@ static void ath10k_htt_rx_h_filter(struc
  7674. + static int ath10k_htt_rx_handle_amsdu(struct ath10k_htt *htt)
  7675. + {
  7676. + struct ath10k *ar = htt->ar;
  7677. +- static struct ieee80211_rx_status rx_status;
  7678. ++ struct ieee80211_rx_status *rx_status = &htt->rx_status;
  7679. + struct sk_buff_head amsdu;
  7680. + int ret;
  7681. +
  7682. +@@ -1549,11 +1549,11 @@ static int ath10k_htt_rx_handle_amsdu(st
  7683. + return ret;
  7684. + }
  7685. +
  7686. +- ath10k_htt_rx_h_ppdu(ar, &amsdu, &rx_status, 0xffff);
  7687. ++ ath10k_htt_rx_h_ppdu(ar, &amsdu, rx_status, 0xffff);
  7688. + ath10k_htt_rx_h_unchain(ar, &amsdu, ret > 0);
  7689. +- ath10k_htt_rx_h_filter(ar, &amsdu, &rx_status);
  7690. +- ath10k_htt_rx_h_mpdu(ar, &amsdu, &rx_status);
  7691. +- ath10k_htt_rx_h_deliver(ar, &amsdu, &rx_status);
  7692. ++ ath10k_htt_rx_h_filter(ar, &amsdu, rx_status);
  7693. ++ ath10k_htt_rx_h_mpdu(ar, &amsdu, rx_status);
  7694. ++ ath10k_htt_rx_h_deliver(ar, &amsdu, rx_status);
  7695. +
  7696. + return 0;
  7697. + }
  7698. 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
  7699. deleted file mode 100644
  7700. index 4dc6d66..0000000
  7701. --- a/package/kernel/mac80211/patches/330-mac80211-minstrel-Change-expected-throughput-unit-ba.patch
  7702. +++ /dev/null
  7703. @@ -1,51 +0,0 @@
  7704. -From: Sven Eckelmann <sven.eckelmann@open-mesh.com>
  7705. -Date: Tue, 2 Feb 2016 08:12:26 +0100
  7706. -Subject: [PATCH] mac80211: minstrel: Change expected throughput unit back to
  7707. - Kbps
  7708. -
  7709. -The change from cur_tp to the function
  7710. -minstrel_get_tp_avg/minstrel_ht_get_tp_avg changed the unit used for the
  7711. -current throughput. For example in minstrel_ht the correct
  7712. -conversion between them would be:
  7713. -
  7714. - mrs->cur_tp / 10 == minstrel_ht_get_tp_avg(..).
  7715. -
  7716. -This factor 10 must also be included in the calculation of
  7717. -minstrel_get_expected_throughput and minstrel_ht_get_expected_throughput to
  7718. -return values with the unit [Kbps] instead of [10Kbps]. Otherwise routing
  7719. -algorithms like B.A.T.M.A.N. V will make incorrect decision based on these
  7720. -values. Its kernel based implementation expects expected_throughput always
  7721. -to have the unit [Kbps] and not sometimes [10Kbps] and sometimes [Kbps].
  7722. -
  7723. -The same requirement has iw or olsrdv2's nl80211 based statistics module
  7724. -which retrieve the same data via NL80211_STA_INFO_TX_BITRATE.
  7725. -
  7726. -Cc: stable@vger.kernel.org
  7727. -Fixes: 6a27b2c40b48 ("mac80211: restructure per-rate throughput calculation into function")
  7728. -Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  7729. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  7730. ----
  7731. -
  7732. ---- a/net/mac80211/rc80211_minstrel.c
  7733. -+++ b/net/mac80211/rc80211_minstrel.c
  7734. -@@ -711,7 +711,7 @@ static u32 minstrel_get_expected_through
  7735. - * computing cur_tp
  7736. - */
  7737. - tmp_mrs = &mi->r[idx].stats;
  7738. -- tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma);
  7739. -+ tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma) * 10;
  7740. - tmp_cur_tp = tmp_cur_tp * 1200 * 8 / 1024;
  7741. -
  7742. - return tmp_cur_tp;
  7743. ---- a/net/mac80211/rc80211_minstrel_ht.c
  7744. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  7745. -@@ -1335,7 +1335,8 @@ static u32 minstrel_ht_get_expected_thro
  7746. - prob = mi->groups[i].rates[j].prob_ewma;
  7747. -
  7748. - /* convert tp_avg from pkt per second in kbps */
  7749. -- tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * AVG_PKT_SIZE * 8 / 1024;
  7750. -+ tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * 10;
  7751. -+ tp_avg = tp_avg * AVG_PKT_SIZE * 8 / 1024;
  7752. -
  7753. - return tp_avg;
  7754. - }
  7755. 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
  7756. deleted file mode 100644
  7757. index 1fd016f..0000000
  7758. --- a/package/kernel/mac80211/patches/331-brcmfmac-Increase-nr-of-supported-flowrings.patch
  7759. +++ /dev/null
  7760. @@ -1,307 +0,0 @@
  7761. -From: Hante Meuleman <meuleman@broadcom.com>
  7762. -Date: Sun, 7 Feb 2016 18:08:24 +0100
  7763. -Subject: [PATCH] brcmfmac: Increase nr of supported flowrings.
  7764. -MIME-Version: 1.0
  7765. -Content-Type: text/plain; charset=UTF-8
  7766. -Content-Transfer-Encoding: 8bit
  7767. -
  7768. -New generation devices have firmware which has more than 256 flowrings.
  7769. -E.g. following debugging message comes from 14e4:4365 BCM4366:
  7770. -[ 194.606245] brcmfmac: brcmf_pcie_init_ringbuffers Nr of flowrings is 264
  7771. -
  7772. -At various code places (related to flowrings) we were using u8 which
  7773. -could lead to storing wrong number or infinite loops when indexing with
  7774. -this type. This issue was quite easy to spot in brcmf_flowring_detach
  7775. -where it led to infinite loop e.g. on failed initialization.
  7776. -
  7777. -This patch switches code to proper types and increases the maximum
  7778. -number of supported flowrings to 512.
  7779. -
  7780. -Originally this change was sent in September 2015, but back it was
  7781. -causing a regression on BCM43602 resulting in:
  7782. -Unable to handle kernel NULL pointer dereference at virtual address ...
  7783. -
  7784. -The reason for this regression was missing update (s/u8/u16) of struct
  7785. -brcmf_flowring_ring. This problem was handled in 9f64df9 ("brcmfmac: Fix
  7786. -bug in flowring management."). Starting with that it's safe to apply
  7787. -this original patch as it doesn't cause a regression anymore.
  7788. -
  7789. -This patch fixes an infinite loop on BCM4366 which is supported since
  7790. -4.4 so it makes sense to apply it to stable 4.4+.
  7791. -
  7792. -Cc: <stable@vger.kernel.org> # 4.4+
  7793. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  7794. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  7795. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  7796. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  7797. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  7798. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  7799. ----
  7800. -
  7801. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  7802. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c
  7803. -@@ -32,7 +32,7 @@
  7804. - #define BRCMF_FLOWRING_LOW (BRCMF_FLOWRING_HIGH - 256)
  7805. - #define BRCMF_FLOWRING_INVALID_IFIDX 0xff
  7806. -
  7807. --#define BRCMF_FLOWRING_HASH_AP(da, fifo, ifidx) (da[5] + fifo + ifidx * 16)
  7808. -+#define BRCMF_FLOWRING_HASH_AP(da, fifo, ifidx) (da[5] * 2 + fifo + ifidx * 16)
  7809. - #define BRCMF_FLOWRING_HASH_STA(fifo, ifidx) (fifo + ifidx * 16)
  7810. -
  7811. - static const u8 brcmf_flowring_prio2fifo[] = {
  7812. -@@ -68,7 +68,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  7813. - u8 prio, u8 ifidx)
  7814. - {
  7815. - struct brcmf_flowring_hash *hash;
  7816. -- u8 hash_idx;
  7817. -+ u16 hash_idx;
  7818. - u32 i;
  7819. - bool found;
  7820. - bool sta;
  7821. -@@ -88,6 +88,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  7822. - }
  7823. - hash_idx = sta ? BRCMF_FLOWRING_HASH_STA(fifo, ifidx) :
  7824. - BRCMF_FLOWRING_HASH_AP(mac, fifo, ifidx);
  7825. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  7826. - found = false;
  7827. - hash = flow->hash;
  7828. - for (i = 0; i < BRCMF_FLOWRING_HASHSIZE; i++) {
  7829. -@@ -98,6 +99,7 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  7830. - break;
  7831. - }
  7832. - hash_idx++;
  7833. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  7834. - }
  7835. - if (found)
  7836. - return hash[hash_idx].flowid;
  7837. -@@ -111,7 +113,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  7838. - {
  7839. - struct brcmf_flowring_ring *ring;
  7840. - struct brcmf_flowring_hash *hash;
  7841. -- u8 hash_idx;
  7842. -+ u16 hash_idx;
  7843. - u32 i;
  7844. - bool found;
  7845. - u8 fifo;
  7846. -@@ -131,6 +133,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  7847. - }
  7848. - hash_idx = sta ? BRCMF_FLOWRING_HASH_STA(fifo, ifidx) :
  7849. - BRCMF_FLOWRING_HASH_AP(mac, fifo, ifidx);
  7850. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  7851. - found = false;
  7852. - hash = flow->hash;
  7853. - for (i = 0; i < BRCMF_FLOWRING_HASHSIZE; i++) {
  7854. -@@ -140,6 +143,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  7855. - break;
  7856. - }
  7857. - hash_idx++;
  7858. -+ hash_idx &= (BRCMF_FLOWRING_HASHSIZE - 1);
  7859. - }
  7860. - if (found) {
  7861. - for (i = 0; i < flow->nrofrings; i++) {
  7862. -@@ -169,7 +173,7 @@ u32 brcmf_flowring_create(struct brcmf_f
  7863. - }
  7864. -
  7865. -
  7866. --u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u8 flowid)
  7867. -+u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u16 flowid)
  7868. - {
  7869. - struct brcmf_flowring_ring *ring;
  7870. -
  7871. -@@ -179,7 +183,7 @@ u8 brcmf_flowring_tid(struct brcmf_flowr
  7872. - }
  7873. -
  7874. -
  7875. --static void brcmf_flowring_block(struct brcmf_flowring *flow, u8 flowid,
  7876. -+static void brcmf_flowring_block(struct brcmf_flowring *flow, u16 flowid,
  7877. - bool blocked)
  7878. - {
  7879. - struct brcmf_flowring_ring *ring;
  7880. -@@ -228,10 +232,10 @@ static void brcmf_flowring_block(struct
  7881. - }
  7882. -
  7883. -
  7884. --void brcmf_flowring_delete(struct brcmf_flowring *flow, u8 flowid)
  7885. -+void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid)
  7886. - {
  7887. - struct brcmf_flowring_ring *ring;
  7888. -- u8 hash_idx;
  7889. -+ u16 hash_idx;
  7890. - struct sk_buff *skb;
  7891. -
  7892. - ring = flow->rings[flowid];
  7893. -@@ -253,7 +257,7 @@ void brcmf_flowring_delete(struct brcmf_
  7894. - }
  7895. -
  7896. -
  7897. --u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  7898. -+u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u16 flowid,
  7899. - struct sk_buff *skb)
  7900. - {
  7901. - struct brcmf_flowring_ring *ring;
  7902. -@@ -279,7 +283,7 @@ u32 brcmf_flowring_enqueue(struct brcmf_
  7903. - }
  7904. -
  7905. -
  7906. --struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u8 flowid)
  7907. -+struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u16 flowid)
  7908. - {
  7909. - struct brcmf_flowring_ring *ring;
  7910. - struct sk_buff *skb;
  7911. -@@ -300,7 +304,7 @@ struct sk_buff *brcmf_flowring_dequeue(s
  7912. - }
  7913. -
  7914. -
  7915. --void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u8 flowid,
  7916. -+void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u16 flowid,
  7917. - struct sk_buff *skb)
  7918. - {
  7919. - struct brcmf_flowring_ring *ring;
  7920. -@@ -311,7 +315,7 @@ void brcmf_flowring_reinsert(struct brcm
  7921. - }
  7922. -
  7923. -
  7924. --u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u8 flowid)
  7925. -+u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u16 flowid)
  7926. - {
  7927. - struct brcmf_flowring_ring *ring;
  7928. -
  7929. -@@ -326,7 +330,7 @@ u32 brcmf_flowring_qlen(struct brcmf_flo
  7930. - }
  7931. -
  7932. -
  7933. --void brcmf_flowring_open(struct brcmf_flowring *flow, u8 flowid)
  7934. -+void brcmf_flowring_open(struct brcmf_flowring *flow, u16 flowid)
  7935. - {
  7936. - struct brcmf_flowring_ring *ring;
  7937. -
  7938. -@@ -340,10 +344,10 @@ void brcmf_flowring_open(struct brcmf_fl
  7939. - }
  7940. -
  7941. -
  7942. --u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u8 flowid)
  7943. -+u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u16 flowid)
  7944. - {
  7945. - struct brcmf_flowring_ring *ring;
  7946. -- u8 hash_idx;
  7947. -+ u16 hash_idx;
  7948. -
  7949. - ring = flow->rings[flowid];
  7950. - hash_idx = ring->hash_id;
  7951. -@@ -384,7 +388,7 @@ void brcmf_flowring_detach(struct brcmf_
  7952. - struct brcmf_pub *drvr = bus_if->drvr;
  7953. - struct brcmf_flowring_tdls_entry *search;
  7954. - struct brcmf_flowring_tdls_entry *remove;
  7955. -- u8 flowid;
  7956. -+ u16 flowid;
  7957. -
  7958. - for (flowid = 0; flowid < flow->nrofrings; flowid++) {
  7959. - if (flow->rings[flowid])
  7960. -@@ -408,7 +412,7 @@ void brcmf_flowring_configure_addr_mode(
  7961. - struct brcmf_bus *bus_if = dev_get_drvdata(flow->dev);
  7962. - struct brcmf_pub *drvr = bus_if->drvr;
  7963. - u32 i;
  7964. -- u8 flowid;
  7965. -+ u16 flowid;
  7966. -
  7967. - if (flow->addr_mode[ifidx] != addr_mode) {
  7968. - for (i = 0; i < ARRAY_SIZE(flow->hash); i++) {
  7969. -@@ -434,7 +438,7 @@ void brcmf_flowring_delete_peer(struct b
  7970. - struct brcmf_flowring_tdls_entry *prev;
  7971. - struct brcmf_flowring_tdls_entry *search;
  7972. - u32 i;
  7973. -- u8 flowid;
  7974. -+ u16 flowid;
  7975. - bool sta;
  7976. -
  7977. - sta = (flow->addr_mode[ifidx] == ADDR_INDIRECT);
  7978. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.h
  7979. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.h
  7980. -@@ -16,7 +16,7 @@
  7981. - #define BRCMFMAC_FLOWRING_H
  7982. -
  7983. -
  7984. --#define BRCMF_FLOWRING_HASHSIZE 256
  7985. -+#define BRCMF_FLOWRING_HASHSIZE 512 /* has to be 2^x */
  7986. - #define BRCMF_FLOWRING_INVALID_ID 0xFFFFFFFF
  7987. -
  7988. -
  7989. -@@ -24,7 +24,7 @@ struct brcmf_flowring_hash {
  7990. - u8 mac[ETH_ALEN];
  7991. - u8 fifo;
  7992. - u8 ifidx;
  7993. -- u8 flowid;
  7994. -+ u16 flowid;
  7995. - };
  7996. -
  7997. - enum ring_status {
  7998. -@@ -61,16 +61,16 @@ u32 brcmf_flowring_lookup(struct brcmf_f
  7999. - u8 prio, u8 ifidx);
  8000. - u32 brcmf_flowring_create(struct brcmf_flowring *flow, u8 da[ETH_ALEN],
  8001. - u8 prio, u8 ifidx);
  8002. --void brcmf_flowring_delete(struct brcmf_flowring *flow, u8 flowid);
  8003. --void brcmf_flowring_open(struct brcmf_flowring *flow, u8 flowid);
  8004. --u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u8 flowid);
  8005. --u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
  8006. -+void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid);
  8007. -+void brcmf_flowring_open(struct brcmf_flowring *flow, u16 flowid);
  8008. -+u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u16 flowid);
  8009. -+u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u16 flowid,
  8010. - struct sk_buff *skb);
  8011. --struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u8 flowid);
  8012. --void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u8 flowid,
  8013. -+struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u16 flowid);
  8014. -+void brcmf_flowring_reinsert(struct brcmf_flowring *flow, u16 flowid,
  8015. - struct sk_buff *skb);
  8016. --u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u8 flowid);
  8017. --u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u8 flowid);
  8018. -+u32 brcmf_flowring_qlen(struct brcmf_flowring *flow, u16 flowid);
  8019. -+u8 brcmf_flowring_ifidx_get(struct brcmf_flowring *flow, u16 flowid);
  8020. - struct brcmf_flowring *brcmf_flowring_attach(struct device *dev, u16 nrofrings);
  8021. - void brcmf_flowring_detach(struct brcmf_flowring *flow);
  8022. - void brcmf_flowring_configure_addr_mode(struct brcmf_flowring *flow, int ifidx,
  8023. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  8024. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
  8025. -@@ -677,7 +677,7 @@ static u32 brcmf_msgbuf_flowring_create(
  8026. - }
  8027. -
  8028. -
  8029. --static void brcmf_msgbuf_txflow(struct brcmf_msgbuf *msgbuf, u8 flowid)
  8030. -+static void brcmf_msgbuf_txflow(struct brcmf_msgbuf *msgbuf, u16 flowid)
  8031. - {
  8032. - struct brcmf_flowring *flow = msgbuf->flow;
  8033. - struct brcmf_commonring *commonring;
  8034. -@@ -1310,7 +1310,7 @@ int brcmf_proto_msgbuf_rx_trigger(struct
  8035. - }
  8036. -
  8037. -
  8038. --void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid)
  8039. -+void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u16 flowid)
  8040. - {
  8041. - struct brcmf_msgbuf *msgbuf = (struct brcmf_msgbuf *)drvr->proto->pd;
  8042. - struct msgbuf_tx_flowring_delete_req *delete;
  8043. -@@ -1415,6 +1415,13 @@ int brcmf_proto_msgbuf_attach(struct brc
  8044. - u32 count;
  8045. -
  8046. - if_msgbuf = drvr->bus_if->msgbuf;
  8047. -+
  8048. -+ if (if_msgbuf->nrof_flowrings >= BRCMF_FLOWRING_HASHSIZE) {
  8049. -+ brcmf_err("driver not configured for this many flowrings %d\n",
  8050. -+ if_msgbuf->nrof_flowrings);
  8051. -+ if_msgbuf->nrof_flowrings = BRCMF_FLOWRING_HASHSIZE - 1;
  8052. -+ }
  8053. -+
  8054. - msgbuf = kzalloc(sizeof(*msgbuf), GFP_KERNEL);
  8055. - if (!msgbuf)
  8056. - goto fail;
  8057. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h
  8058. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.h
  8059. -@@ -33,7 +33,7 @@
  8060. -
  8061. -
  8062. - int brcmf_proto_msgbuf_rx_trigger(struct device *dev);
  8063. --void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid);
  8064. -+void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u16 flowid);
  8065. - int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr);
  8066. - void brcmf_proto_msgbuf_detach(struct brcmf_pub *drvr);
  8067. - #else
  8068. diff --git a/package/kernel/mac80211/patches/331-mac80211-End-the-MPSP-even-if-EOSP-frame-was-not-rec.patch b/package/kernel/mac80211/patches/331-mac80211-End-the-MPSP-even-if-EOSP-frame-was-not-rec.patch
  8069. new file mode 100644
  8070. index 0000000..5d8a8fb
  8071. --- /dev/null
  8072. +++ b/package/kernel/mac80211/patches/331-mac80211-End-the-MPSP-even-if-EOSP-frame-was-not-rec.patch
  8073. @@ -0,0 +1,42 @@
  8074. +From: Masashi Honma <masashi.honma@gmail.com>
  8075. +Date: Wed, 13 Jul 2016 16:04:35 +0900
  8076. +Subject: [PATCH] mac80211: End the MPSP even if EOSP frame was not received
  8077. +
  8078. +The mesh STA sends QoS frame with EOSP (end of service period)
  8079. +subfiled=1 to end the MPSP(mesh peer service period). Previously, if
  8080. +the frame was not acked by peer, the mesh STA did not end the MPSP.
  8081. +This patch ends the MPSP even if the QoS frame was no acked.
  8082. +
  8083. +Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
  8084. +---
  8085. +
  8086. +--- a/net/mac80211/status.c
  8087. ++++ b/net/mac80211/status.c
  8088. +@@ -784,6 +784,13 @@ void ieee80211_tx_status(struct ieee8021
  8089. + clear_sta_flag(sta, WLAN_STA_SP);
  8090. +
  8091. + acked = !!(info->flags & IEEE80211_TX_STAT_ACK);
  8092. ++
  8093. ++ /* mesh Peer Service Period support */
  8094. ++ if (ieee80211_vif_is_mesh(&sta->sdata->vif) &&
  8095. ++ ieee80211_is_data_qos(fc))
  8096. ++ ieee80211_mpsp_trigger_process(
  8097. ++ ieee80211_get_qos_ctl(hdr), sta, true, acked);
  8098. ++
  8099. + if (!acked && test_sta_flag(sta, WLAN_STA_PS_STA)) {
  8100. + /*
  8101. + * The STA is in power save mode, so assume
  8102. +@@ -794,13 +801,6 @@ void ieee80211_tx_status(struct ieee8021
  8103. + return;
  8104. + }
  8105. +
  8106. +- /* mesh Peer Service Period support */
  8107. +- if (ieee80211_vif_is_mesh(&sta->sdata->vif) &&
  8108. +- ieee80211_is_data_qos(fc))
  8109. +- ieee80211_mpsp_trigger_process(
  8110. +- ieee80211_get_qos_ctl(hdr),
  8111. +- sta, true, acked);
  8112. +-
  8113. + if (ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL) &&
  8114. + (ieee80211_is_data(hdr->frame_control)) &&
  8115. + (rates_idx != -1))
  8116. diff --git a/package/kernel/mac80211/patches/332-ath10k-implement-NAPI-support.patch b/package/kernel/mac80211/patches/332-ath10k-implement-NAPI-support.patch
  8117. new file mode 100644
  8118. index 0000000..c6cc145
  8119. --- /dev/null
  8120. +++ b/package/kernel/mac80211/patches/332-ath10k-implement-NAPI-support.patch
  8121. @@ -0,0 +1,642 @@
  8122. +From: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
  8123. +Date: Thu, 21 Jul 2016 11:50:00 +0530
  8124. +Subject: [PATCH] ath10k: implement NAPI support
  8125. +
  8126. +Add NAPI support for rx and tx completion. NAPI poll is scheduled
  8127. +from interrupt handler. The design is as below
  8128. +
  8129. + - on interrupt
  8130. + - schedule napi and mask interrupts
  8131. + - on poll
  8132. + - process all pipes (no actual Tx/Rx)
  8133. + - process Rx within budget
  8134. + - if quota exceeds budget reschedule napi poll by returning budget
  8135. + - process Tx completions and update budget if necessary
  8136. + - process Tx fetch indications (pull-push)
  8137. + - push any other pending Tx (if possible)
  8138. + - before resched or napi completion replenish htt rx ring buffer
  8139. + - if work done < budget, complete napi poll and unmask interrupts
  8140. +
  8141. +This change also get rid of two tasklets (intr_tq and txrx_compl_task).
  8142. +
  8143. +Measured peak throughput with NAPI on IPQ4019 platform in controlled
  8144. +environment. No noticeable reduction in throughput is seen and also
  8145. +observed improvements in CPU usage. Approx. 15% CPU usage got reduced
  8146. +in UDP uplink case.
  8147. +
  8148. +DL: AP DUT Tx
  8149. +UL: AP DUT Rx
  8150. +
  8151. +IPQ4019 (avg. cpu usage %)
  8152. +========
  8153. + TOT +NAPI
  8154. + =========== =============
  8155. +TCP DL 644 Mbps (42%) 645 Mbps (36%)
  8156. +TCP UL 673 Mbps (30%) 675 Mbps (26%)
  8157. +UDP DL 682 Mbps (49%) 680 Mbps (49%)
  8158. +UDP UL 720 Mbps (28%) 717 Mbps (11%)
  8159. +
  8160. +Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
  8161. +---
  8162. +
  8163. +--- a/drivers/net/wireless/ath/ath10k/ahb.c
  8164. ++++ b/drivers/net/wireless/ath/ath10k/ahb.c
  8165. +@@ -462,13 +462,13 @@ static void ath10k_ahb_halt_chip(struct
  8166. + static irqreturn_t ath10k_ahb_interrupt_handler(int irq, void *arg)
  8167. + {
  8168. + struct ath10k *ar = arg;
  8169. +- struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
  8170. +
  8171. + if (!ath10k_pci_irq_pending(ar))
  8172. + return IRQ_NONE;
  8173. +
  8174. + ath10k_pci_disable_and_clear_legacy_irq(ar);
  8175. +- tasklet_schedule(&ar_pci->intr_tq);
  8176. ++ ath10k_pci_irq_msi_fw_mask(ar);
  8177. ++ napi_schedule(&ar->napi);
  8178. +
  8179. + return IRQ_HANDLED;
  8180. + }
  8181. +@@ -831,7 +831,7 @@ static int ath10k_ahb_probe(struct platf
  8182. + goto err_resource_deinit;
  8183. + }
  8184. +
  8185. +- ath10k_pci_init_irq_tasklets(ar);
  8186. ++ ath10k_pci_init_napi(ar);
  8187. +
  8188. + ret = ath10k_ahb_request_irq_legacy(ar);
  8189. + if (ret)
  8190. +--- a/drivers/net/wireless/ath/ath10k/core.c
  8191. ++++ b/drivers/net/wireless/ath/ath10k/core.c
  8192. +@@ -2226,6 +2226,8 @@ struct ath10k *ath10k_core_create(size_t
  8193. + INIT_WORK(&ar->register_work, ath10k_core_register_work);
  8194. + INIT_WORK(&ar->restart_work, ath10k_core_restart);
  8195. +
  8196. ++ init_dummy_netdev(&ar->napi_dev);
  8197. ++
  8198. + ret = ath10k_debug_create(ar);
  8199. + if (ret)
  8200. + goto err_free_aux_wq;
  8201. +--- a/drivers/net/wireless/ath/ath10k/core.h
  8202. ++++ b/drivers/net/wireless/ath/ath10k/core.h
  8203. +@@ -65,6 +65,10 @@
  8204. + #define ATH10K_KEEPALIVE_MAX_IDLE 3895
  8205. + #define ATH10K_KEEPALIVE_MAX_UNRESPONSIVE 3900
  8206. +
  8207. ++/* NAPI poll budget */
  8208. ++#define ATH10K_NAPI_BUDGET 64
  8209. ++#define ATH10K_NAPI_QUOTA_LIMIT 60
  8210. ++
  8211. + struct ath10k;
  8212. +
  8213. + enum ath10k_bus {
  8214. +@@ -933,6 +937,10 @@ struct ath10k {
  8215. + struct ath10k_thermal thermal;
  8216. + struct ath10k_wow wow;
  8217. +
  8218. ++ /* NAPI */
  8219. ++ struct net_device napi_dev;
  8220. ++ struct napi_struct napi;
  8221. ++
  8222. + /* must be last */
  8223. + u8 drv_priv[0] __aligned(sizeof(void *));
  8224. + };
  8225. +--- a/drivers/net/wireless/ath/ath10k/htt.h
  8226. ++++ b/drivers/net/wireless/ath/ath10k/htt.h
  8227. +@@ -1666,7 +1666,6 @@ struct ath10k_htt {
  8228. +
  8229. + /* This is used to group tx/rx completions separately and process them
  8230. + * in batches to reduce cache stalls */
  8231. +- struct tasklet_struct txrx_compl_task;
  8232. + struct sk_buff_head rx_compl_q;
  8233. + struct sk_buff_head rx_in_ord_compl_q;
  8234. + struct sk_buff_head tx_fetch_ind_q;
  8235. +@@ -1799,5 +1798,6 @@ int ath10k_htt_tx(struct ath10k_htt *htt
  8236. + struct sk_buff *msdu);
  8237. + void ath10k_htt_rx_pktlog_completion_handler(struct ath10k *ar,
  8238. + struct sk_buff *skb);
  8239. ++int ath10k_htt_txrx_compl_task(struct ath10k *ar, int budget);
  8240. +
  8241. + #endif
  8242. +--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
  8243. ++++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
  8244. +@@ -34,7 +34,6 @@
  8245. + #define HTT_RX_RING_REFILL_RESCHED_MS 5
  8246. +
  8247. + static int ath10k_htt_rx_get_csum_state(struct sk_buff *skb);
  8248. +-static void ath10k_htt_txrx_compl_task(unsigned long ptr);
  8249. +
  8250. + static struct sk_buff *
  8251. + ath10k_htt_rx_find_skb_paddr(struct ath10k *ar, u32 paddr)
  8252. +@@ -226,7 +225,6 @@ int ath10k_htt_rx_ring_refill(struct ath
  8253. + void ath10k_htt_rx_free(struct ath10k_htt *htt)
  8254. + {
  8255. + del_timer_sync(&htt->rx_ring.refill_retry_timer);
  8256. +- tasklet_kill(&htt->txrx_compl_task);
  8257. +
  8258. + skb_queue_purge(&htt->rx_compl_q);
  8259. + skb_queue_purge(&htt->rx_in_ord_compl_q);
  8260. +@@ -520,9 +518,6 @@ int ath10k_htt_rx_alloc(struct ath10k_ht
  8261. + skb_queue_head_init(&htt->tx_fetch_ind_q);
  8262. + atomic_set(&htt->num_mpdus_ready, 0);
  8263. +
  8264. +- tasklet_init(&htt->txrx_compl_task, ath10k_htt_txrx_compl_task,
  8265. +- (unsigned long)htt);
  8266. +-
  8267. + ath10k_dbg(ar, ATH10K_DBG_BOOT, "htt rx ring size %d fill_level %d\n",
  8268. + htt->rx_ring.size, htt->rx_ring.fill_level);
  8269. + return 0;
  8270. +@@ -958,7 +953,7 @@ static void ath10k_process_rx(struct ath
  8271. + trace_ath10k_rx_hdr(ar, skb->data, skb->len);
  8272. + trace_ath10k_rx_payload(ar, skb->data, skb->len);
  8273. +
  8274. +- ieee80211_rx(ar->hw, skb);
  8275. ++ ieee80211_rx_napi(ar->hw, NULL, skb, &ar->napi);
  8276. + }
  8277. +
  8278. + static int ath10k_htt_rx_nwifi_hdrlen(struct ath10k *ar,
  8279. +@@ -1527,7 +1522,7 @@ static int ath10k_htt_rx_handle_amsdu(st
  8280. + struct ath10k *ar = htt->ar;
  8281. + struct ieee80211_rx_status *rx_status = &htt->rx_status;
  8282. + struct sk_buff_head amsdu;
  8283. +- int ret;
  8284. ++ int ret, num_msdus;
  8285. +
  8286. + __skb_queue_head_init(&amsdu);
  8287. +
  8288. +@@ -1549,13 +1544,14 @@ static int ath10k_htt_rx_handle_amsdu(st
  8289. + return ret;
  8290. + }
  8291. +
  8292. ++ num_msdus = skb_queue_len(&amsdu);
  8293. + ath10k_htt_rx_h_ppdu(ar, &amsdu, rx_status, 0xffff);
  8294. + ath10k_htt_rx_h_unchain(ar, &amsdu, ret > 0);
  8295. + ath10k_htt_rx_h_filter(ar, &amsdu, rx_status);
  8296. + ath10k_htt_rx_h_mpdu(ar, &amsdu, rx_status);
  8297. + ath10k_htt_rx_h_deliver(ar, &amsdu, rx_status);
  8298. +
  8299. +- return 0;
  8300. ++ return num_msdus;
  8301. + }
  8302. +
  8303. + static void ath10k_htt_rx_proc_rx_ind(struct ath10k_htt *htt,
  8304. +@@ -1579,15 +1575,6 @@ static void ath10k_htt_rx_proc_rx_ind(st
  8305. + mpdu_count += mpdu_ranges[i].mpdu_count;
  8306. +
  8307. + atomic_add(mpdu_count, &htt->num_mpdus_ready);
  8308. +-
  8309. +- tasklet_schedule(&htt->txrx_compl_task);
  8310. +-}
  8311. +-
  8312. +-static void ath10k_htt_rx_frag_handler(struct ath10k_htt *htt)
  8313. +-{
  8314. +- atomic_inc(&htt->num_mpdus_ready);
  8315. +-
  8316. +- tasklet_schedule(&htt->txrx_compl_task);
  8317. + }
  8318. +
  8319. + static void ath10k_htt_rx_tx_compl_ind(struct ath10k *ar,
  8320. +@@ -1772,14 +1759,15 @@ static void ath10k_htt_rx_h_rx_offload_p
  8321. + RX_FLAG_MMIC_STRIPPED;
  8322. + }
  8323. +
  8324. +-static void ath10k_htt_rx_h_rx_offload(struct ath10k *ar,
  8325. +- struct sk_buff_head *list)
  8326. ++static int ath10k_htt_rx_h_rx_offload(struct ath10k *ar,
  8327. ++ struct sk_buff_head *list)
  8328. + {
  8329. + struct ath10k_htt *htt = &ar->htt;
  8330. + struct ieee80211_rx_status *status = &htt->rx_status;
  8331. + struct htt_rx_offload_msdu *rx;
  8332. + struct sk_buff *msdu;
  8333. + size_t offset;
  8334. ++ int num_msdu = 0;
  8335. +
  8336. + while ((msdu = __skb_dequeue(list))) {
  8337. + /* Offloaded frames don't have Rx descriptor. Instead they have
  8338. +@@ -1819,10 +1807,12 @@ static void ath10k_htt_rx_h_rx_offload(s
  8339. + ath10k_htt_rx_h_rx_offload_prot(status, msdu);
  8340. + ath10k_htt_rx_h_channel(ar, status, NULL, rx->vdev_id);
  8341. + ath10k_process_rx(ar, status, msdu);
  8342. ++ num_msdu++;
  8343. + }
  8344. ++ return num_msdu;
  8345. + }
  8346. +
  8347. +-static void ath10k_htt_rx_in_ord_ind(struct ath10k *ar, struct sk_buff *skb)
  8348. ++static int ath10k_htt_rx_in_ord_ind(struct ath10k *ar, struct sk_buff *skb)
  8349. + {
  8350. + struct ath10k_htt *htt = &ar->htt;
  8351. + struct htt_resp *resp = (void *)skb->data;
  8352. +@@ -1835,12 +1825,12 @@ static void ath10k_htt_rx_in_ord_ind(str
  8353. + u8 tid;
  8354. + bool offload;
  8355. + bool frag;
  8356. +- int ret;
  8357. ++ int ret, num_msdus = 0;
  8358. +
  8359. + lockdep_assert_held(&htt->rx_ring.lock);
  8360. +
  8361. + if (htt->rx_confused)
  8362. +- return;
  8363. ++ return -EIO;
  8364. +
  8365. + skb_pull(skb, sizeof(resp->hdr));
  8366. + skb_pull(skb, sizeof(resp->rx_in_ord_ind));
  8367. +@@ -1859,7 +1849,7 @@ static void ath10k_htt_rx_in_ord_ind(str
  8368. +
  8369. + if (skb->len < msdu_count * sizeof(*resp->rx_in_ord_ind.msdu_descs)) {
  8370. + ath10k_warn(ar, "dropping invalid in order rx indication\n");
  8371. +- return;
  8372. ++ return -EINVAL;
  8373. + }
  8374. +
  8375. + /* The event can deliver more than 1 A-MSDU. Each A-MSDU is later
  8376. +@@ -1870,14 +1860,14 @@ static void ath10k_htt_rx_in_ord_ind(str
  8377. + if (ret < 0) {
  8378. + ath10k_warn(ar, "failed to pop paddr list: %d\n", ret);
  8379. + htt->rx_confused = true;
  8380. +- return;
  8381. ++ return -EIO;
  8382. + }
  8383. +
  8384. + /* Offloaded frames are very different and need to be handled
  8385. + * separately.
  8386. + */
  8387. + if (offload)
  8388. +- ath10k_htt_rx_h_rx_offload(ar, &list);
  8389. ++ num_msdus = ath10k_htt_rx_h_rx_offload(ar, &list);
  8390. +
  8391. + while (!skb_queue_empty(&list)) {
  8392. + __skb_queue_head_init(&amsdu);
  8393. +@@ -1890,6 +1880,7 @@ static void ath10k_htt_rx_in_ord_ind(str
  8394. + * better to report something than nothing though. This
  8395. + * should still give an idea about rx rate to the user.
  8396. + */
  8397. ++ num_msdus += skb_queue_len(&amsdu);
  8398. + ath10k_htt_rx_h_ppdu(ar, &amsdu, status, vdev_id);
  8399. + ath10k_htt_rx_h_filter(ar, &amsdu, status);
  8400. + ath10k_htt_rx_h_mpdu(ar, &amsdu, status);
  8401. +@@ -1902,9 +1893,10 @@ static void ath10k_htt_rx_in_ord_ind(str
  8402. + ath10k_warn(ar, "failed to extract amsdu: %d\n", ret);
  8403. + htt->rx_confused = true;
  8404. + __skb_queue_purge(&list);
  8405. +- return;
  8406. ++ return -EIO;
  8407. + }
  8408. + }
  8409. ++ return num_msdus;
  8410. + }
  8411. +
  8412. + static void ath10k_htt_rx_tx_fetch_resp_id_confirm(struct ath10k *ar,
  8413. +@@ -2267,7 +2259,6 @@ bool ath10k_htt_t2h_msg_handler(struct a
  8414. + }
  8415. + case HTT_T2H_MSG_TYPE_TX_COMPL_IND:
  8416. + ath10k_htt_rx_tx_compl_ind(htt->ar, skb);
  8417. +- tasklet_schedule(&htt->txrx_compl_task);
  8418. + break;
  8419. + case HTT_T2H_MSG_TYPE_SEC_IND: {
  8420. + struct ath10k *ar = htt->ar;
  8421. +@@ -2284,7 +2275,7 @@ bool ath10k_htt_t2h_msg_handler(struct a
  8422. + case HTT_T2H_MSG_TYPE_RX_FRAG_IND: {
  8423. + ath10k_dbg_dump(ar, ATH10K_DBG_HTT_DUMP, NULL, "htt event: ",
  8424. + skb->data, skb->len);
  8425. +- ath10k_htt_rx_frag_handler(htt);
  8426. ++ atomic_inc(&htt->num_mpdus_ready);
  8427. + break;
  8428. + }
  8429. + case HTT_T2H_MSG_TYPE_TEST:
  8430. +@@ -2322,8 +2313,7 @@ bool ath10k_htt_t2h_msg_handler(struct a
  8431. + break;
  8432. + }
  8433. + case HTT_T2H_MSG_TYPE_RX_IN_ORD_PADDR_IND: {
  8434. +- skb_queue_tail(&htt->rx_in_ord_compl_q, skb);
  8435. +- tasklet_schedule(&htt->txrx_compl_task);
  8436. ++ __skb_queue_tail(&htt->rx_in_ord_compl_q, skb);
  8437. + return false;
  8438. + }
  8439. + case HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND:
  8440. +@@ -2349,7 +2339,6 @@ bool ath10k_htt_t2h_msg_handler(struct a
  8441. + break;
  8442. + }
  8443. + skb_queue_tail(&htt->tx_fetch_ind_q, tx_fetch_ind);
  8444. +- tasklet_schedule(&htt->txrx_compl_task);
  8445. + break;
  8446. + }
  8447. + case HTT_T2H_MSG_TYPE_TX_FETCH_CONFIRM:
  8448. +@@ -2378,27 +2367,77 @@ void ath10k_htt_rx_pktlog_completion_han
  8449. + }
  8450. + EXPORT_SYMBOL(ath10k_htt_rx_pktlog_completion_handler);
  8451. +
  8452. +-static void ath10k_htt_txrx_compl_task(unsigned long ptr)
  8453. ++int ath10k_htt_txrx_compl_task(struct ath10k *ar, int budget)
  8454. + {
  8455. +- struct ath10k_htt *htt = (struct ath10k_htt *)ptr;
  8456. +- struct ath10k *ar = htt->ar;
  8457. ++ struct ath10k_htt *htt = &ar->htt;
  8458. + struct htt_tx_done tx_done = {};
  8459. +- struct sk_buff_head rx_ind_q;
  8460. + struct sk_buff_head tx_ind_q;
  8461. + struct sk_buff *skb;
  8462. + unsigned long flags;
  8463. +- int num_mpdus;
  8464. ++ int quota = 0, done, num_rx_msdus;
  8465. ++ bool resched_napi = false;
  8466. +
  8467. +- __skb_queue_head_init(&rx_ind_q);
  8468. + __skb_queue_head_init(&tx_ind_q);
  8469. +
  8470. +- spin_lock_irqsave(&htt->rx_in_ord_compl_q.lock, flags);
  8471. +- skb_queue_splice_init(&htt->rx_in_ord_compl_q, &rx_ind_q);
  8472. +- spin_unlock_irqrestore(&htt->rx_in_ord_compl_q.lock, flags);
  8473. ++ /* Since in-ord-ind can deliver more than 1 A-MSDU in single event,
  8474. ++ * process it first to utilize full available quota.
  8475. ++ */
  8476. ++ while (quota < budget) {
  8477. ++ if (skb_queue_empty(&htt->rx_in_ord_compl_q))
  8478. ++ break;
  8479. +
  8480. +- spin_lock_irqsave(&htt->tx_fetch_ind_q.lock, flags);
  8481. +- skb_queue_splice_init(&htt->tx_fetch_ind_q, &tx_ind_q);
  8482. +- spin_unlock_irqrestore(&htt->tx_fetch_ind_q.lock, flags);
  8483. ++ skb = __skb_dequeue(&htt->rx_in_ord_compl_q);
  8484. ++ if (!skb) {
  8485. ++ resched_napi = true;
  8486. ++ goto exit;
  8487. ++ }
  8488. ++
  8489. ++ spin_lock_bh(&htt->rx_ring.lock);
  8490. ++ num_rx_msdus = ath10k_htt_rx_in_ord_ind(ar, skb);
  8491. ++ spin_unlock_bh(&htt->rx_ring.lock);
  8492. ++ if (num_rx_msdus < 0) {
  8493. ++ resched_napi = true;
  8494. ++ goto exit;
  8495. ++ }
  8496. ++
  8497. ++ dev_kfree_skb_any(skb);
  8498. ++ if (num_rx_msdus > 0)
  8499. ++ quota += num_rx_msdus;
  8500. ++
  8501. ++ if ((quota > ATH10K_NAPI_QUOTA_LIMIT) &&
  8502. ++ !skb_queue_empty(&htt->rx_in_ord_compl_q)) {
  8503. ++ resched_napi = true;
  8504. ++ goto exit;
  8505. ++ }
  8506. ++ }
  8507. ++
  8508. ++ while (quota < budget) {
  8509. ++ /* no more data to receive */
  8510. ++ if (!atomic_read(&htt->num_mpdus_ready))
  8511. ++ break;
  8512. ++
  8513. ++ num_rx_msdus = ath10k_htt_rx_handle_amsdu(htt);
  8514. ++ if (num_rx_msdus < 0) {
  8515. ++ resched_napi = true;
  8516. ++ goto exit;
  8517. ++ }
  8518. ++
  8519. ++ quota += num_rx_msdus;
  8520. ++ atomic_dec(&htt->num_mpdus_ready);
  8521. ++ if ((quota > ATH10K_NAPI_QUOTA_LIMIT) &&
  8522. ++ atomic_read(&htt->num_mpdus_ready)) {
  8523. ++ resched_napi = true;
  8524. ++ goto exit;
  8525. ++ }
  8526. ++ }
  8527. ++
  8528. ++ /* From NAPI documentation:
  8529. ++ * The napi poll() function may also process TX completions, in which
  8530. ++ * case if it processes the entire TX ring then it should count that
  8531. ++ * work as the rest of the budget.
  8532. ++ */
  8533. ++ if ((quota < budget) && !kfifo_is_empty(&htt->txdone_fifo))
  8534. ++ quota = budget;
  8535. +
  8536. + /* kfifo_get: called only within txrx_tasklet so it's neatly serialized.
  8537. + * From kfifo_get() documentation:
  8538. +@@ -2408,27 +2447,22 @@ static void ath10k_htt_txrx_compl_task(u
  8539. + while (kfifo_get(&htt->txdone_fifo, &tx_done))
  8540. + ath10k_txrx_tx_unref(htt, &tx_done);
  8541. +
  8542. ++ spin_lock_irqsave(&htt->tx_fetch_ind_q.lock, flags);
  8543. ++ skb_queue_splice_init(&htt->tx_fetch_ind_q, &tx_ind_q);
  8544. ++ spin_unlock_irqrestore(&htt->tx_fetch_ind_q.lock, flags);
  8545. ++
  8546. + while ((skb = __skb_dequeue(&tx_ind_q))) {
  8547. + ath10k_htt_rx_tx_fetch_ind(ar, skb);
  8548. + dev_kfree_skb_any(skb);
  8549. + }
  8550. +
  8551. +- num_mpdus = atomic_read(&htt->num_mpdus_ready);
  8552. +-
  8553. +- while (num_mpdus) {
  8554. +- if (ath10k_htt_rx_handle_amsdu(htt))
  8555. +- break;
  8556. +-
  8557. +- num_mpdus--;
  8558. +- atomic_dec(&htt->num_mpdus_ready);
  8559. +- }
  8560. +-
  8561. +- while ((skb = __skb_dequeue(&rx_ind_q))) {
  8562. +- spin_lock_bh(&htt->rx_ring.lock);
  8563. +- ath10k_htt_rx_in_ord_ind(ar, skb);
  8564. +- spin_unlock_bh(&htt->rx_ring.lock);
  8565. +- dev_kfree_skb_any(skb);
  8566. +- }
  8567. +-
  8568. ++exit:
  8569. + ath10k_htt_rx_msdu_buff_replenish(htt);
  8570. ++ /* In case of rx failure or more data to read, report budget
  8571. ++ * to reschedule NAPI poll
  8572. ++ */
  8573. ++ done = resched_napi ? budget : quota;
  8574. ++
  8575. ++ return done;
  8576. + }
  8577. ++EXPORT_SYMBOL(ath10k_htt_txrx_compl_task);
  8578. +--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
  8579. ++++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
  8580. +@@ -388,8 +388,6 @@ void ath10k_htt_tx_free(struct ath10k_ht
  8581. + {
  8582. + int size;
  8583. +
  8584. +- tasklet_kill(&htt->txrx_compl_task);
  8585. +-
  8586. + idr_for_each(&htt->pending_tx, ath10k_htt_tx_clean_up_pending, htt->ar);
  8587. + idr_destroy(&htt->pending_tx);
  8588. +
  8589. +--- a/drivers/net/wireless/ath/ath10k/pci.c
  8590. ++++ b/drivers/net/wireless/ath/ath10k/pci.c
  8591. +@@ -1502,12 +1502,10 @@ void ath10k_pci_hif_send_complete_check(
  8592. + ath10k_ce_per_engine_service(ar, pipe);
  8593. + }
  8594. +
  8595. +-void ath10k_pci_kill_tasklet(struct ath10k *ar)
  8596. ++static void ath10k_pci_rx_retry_sync(struct ath10k *ar)
  8597. + {
  8598. + struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
  8599. +
  8600. +- tasklet_kill(&ar_pci->intr_tq);
  8601. +-
  8602. + del_timer_sync(&ar_pci->rx_post_retry);
  8603. + }
  8604. +
  8605. +@@ -1566,7 +1564,7 @@ void ath10k_pci_hif_get_default_pipe(str
  8606. + ul_pipe, dl_pipe);
  8607. + }
  8608. +
  8609. +-static void ath10k_pci_irq_msi_fw_mask(struct ath10k *ar)
  8610. ++void ath10k_pci_irq_msi_fw_mask(struct ath10k *ar)
  8611. + {
  8612. + u32 val;
  8613. +
  8614. +@@ -1747,7 +1745,7 @@ void ath10k_pci_ce_deinit(struct ath10k
  8615. +
  8616. + void ath10k_pci_flush(struct ath10k *ar)
  8617. + {
  8618. +- ath10k_pci_kill_tasklet(ar);
  8619. ++ ath10k_pci_rx_retry_sync(ar);
  8620. + ath10k_pci_buffer_cleanup(ar);
  8621. + }
  8622. +
  8623. +@@ -2754,35 +2752,53 @@ static irqreturn_t ath10k_pci_interrupt_
  8624. + return IRQ_NONE;
  8625. + }
  8626. +
  8627. +- if (ar_pci->oper_irq_mode == ATH10K_PCI_IRQ_LEGACY) {
  8628. +- if (!ath10k_pci_irq_pending(ar))
  8629. +- return IRQ_NONE;
  8630. +-
  8631. +- ath10k_pci_disable_and_clear_legacy_irq(ar);
  8632. +- }
  8633. ++ if ((ar_pci->oper_irq_mode == ATH10K_PCI_IRQ_LEGACY) &&
  8634. ++ !ath10k_pci_irq_pending(ar))
  8635. ++ return IRQ_NONE;
  8636. +
  8637. +- tasklet_schedule(&ar_pci->intr_tq);
  8638. ++ ath10k_pci_disable_and_clear_legacy_irq(ar);
  8639. ++ ath10k_pci_irq_msi_fw_mask(ar);
  8640. ++ napi_schedule(&ar->napi);
  8641. +
  8642. + return IRQ_HANDLED;
  8643. + }
  8644. +
  8645. +-static void ath10k_pci_tasklet(unsigned long data)
  8646. ++static int ath10k_pci_napi_poll(struct napi_struct *ctx, int budget)
  8647. + {
  8648. +- struct ath10k *ar = (struct ath10k *)data;
  8649. +- struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
  8650. ++ struct ath10k *ar = container_of(ctx, struct ath10k, napi);
  8651. ++ int done = 0;
  8652. +
  8653. + if (ath10k_pci_has_fw_crashed(ar)) {
  8654. +- ath10k_pci_irq_disable(ar);
  8655. + ath10k_pci_fw_crashed_clear(ar);
  8656. + ath10k_pci_fw_crashed_dump(ar);
  8657. +- return;
  8658. ++ napi_complete(ctx);
  8659. ++ return done;
  8660. + }
  8661. +
  8662. + ath10k_ce_per_engine_service_any(ar);
  8663. +
  8664. +- /* Re-enable legacy irq that was disabled in the irq handler */
  8665. +- if (ar_pci->oper_irq_mode == ATH10K_PCI_IRQ_LEGACY)
  8666. ++ done = ath10k_htt_txrx_compl_task(ar, budget);
  8667. ++
  8668. ++ if (done < budget) {
  8669. ++ napi_complete(ctx);
  8670. ++ /* In case of MSI, it is possible that interrupts are received
  8671. ++ * while NAPI poll is inprogress. So pending interrupts that are
  8672. ++ * received after processing all copy engine pipes by NAPI poll
  8673. ++ * will not be handled again. This is causing failure to
  8674. ++ * complete boot sequence in x86 platform. So before enabling
  8675. ++ * interrupts safer to check for pending interrupts for
  8676. ++ * immediate servicing.
  8677. ++ */
  8678. ++ if (CE_INTERRUPT_SUMMARY(ar)) {
  8679. ++ napi_reschedule(&ar->napi);
  8680. ++ goto out;
  8681. ++ }
  8682. + ath10k_pci_enable_legacy_irq(ar);
  8683. ++ ath10k_pci_irq_msi_fw_unmask(ar);
  8684. ++ }
  8685. ++
  8686. ++out:
  8687. ++ return done;
  8688. + }
  8689. +
  8690. + static int ath10k_pci_request_irq_msi(struct ath10k *ar)
  8691. +@@ -2840,11 +2856,11 @@ static void ath10k_pci_free_irq(struct a
  8692. + free_irq(ar_pci->pdev->irq, ar);
  8693. + }
  8694. +
  8695. +-void ath10k_pci_init_irq_tasklets(struct ath10k *ar)
  8696. ++void ath10k_pci_init_napi(struct ath10k *ar)
  8697. + {
  8698. +- struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
  8699. +-
  8700. +- tasklet_init(&ar_pci->intr_tq, ath10k_pci_tasklet, (unsigned long)ar);
  8701. ++ netif_napi_add(&ar->napi_dev, &ar->napi, ath10k_pci_napi_poll,
  8702. ++ ATH10K_NAPI_BUDGET);
  8703. ++ napi_enable(&ar->napi);
  8704. + }
  8705. +
  8706. + static int ath10k_pci_init_irq(struct ath10k *ar)
  8707. +@@ -2852,7 +2868,7 @@ static int ath10k_pci_init_irq(struct at
  8708. + struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
  8709. + int ret;
  8710. +
  8711. +- ath10k_pci_init_irq_tasklets(ar);
  8712. ++ ath10k_pci_init_napi(ar);
  8713. +
  8714. + if (ath10k_pci_irq_mode != ATH10K_PCI_IRQ_AUTO)
  8715. + ath10k_info(ar, "limiting irq mode to: %d\n",
  8716. +@@ -3113,7 +3129,8 @@ int ath10k_pci_setup_resource(struct ath
  8717. +
  8718. + void ath10k_pci_release_resource(struct ath10k *ar)
  8719. + {
  8720. +- ath10k_pci_kill_tasklet(ar);
  8721. ++ ath10k_pci_rx_retry_sync(ar);
  8722. ++ netif_napi_del(&ar->napi);
  8723. + ath10k_pci_ce_deinit(ar);
  8724. + ath10k_pci_free_pipes(ar);
  8725. + }
  8726. +@@ -3274,7 +3291,7 @@ static int ath10k_pci_probe(struct pci_d
  8727. +
  8728. + err_free_irq:
  8729. + ath10k_pci_free_irq(ar);
  8730. +- ath10k_pci_kill_tasklet(ar);
  8731. ++ ath10k_pci_rx_retry_sync(ar);
  8732. +
  8733. + err_deinit_irq:
  8734. + ath10k_pci_deinit_irq(ar);
  8735. +--- a/drivers/net/wireless/ath/ath10k/pci.h
  8736. ++++ b/drivers/net/wireless/ath/ath10k/pci.h
  8737. +@@ -177,8 +177,6 @@ struct ath10k_pci {
  8738. + /* Operating interrupt mode */
  8739. + enum ath10k_pci_irq_mode oper_irq_mode;
  8740. +
  8741. +- struct tasklet_struct intr_tq;
  8742. +-
  8743. + struct ath10k_pci_pipe pipe_info[CE_COUNT_MAX];
  8744. +
  8745. + /* Copy Engine used for Diagnostic Accesses */
  8746. +@@ -294,8 +292,7 @@ void ath10k_pci_free_pipes(struct ath10k
  8747. + void ath10k_pci_free_pipes(struct ath10k *ar);
  8748. + void ath10k_pci_rx_replenish_retry(unsigned long ptr);
  8749. + void ath10k_pci_ce_deinit(struct ath10k *ar);
  8750. +-void ath10k_pci_init_irq_tasklets(struct ath10k *ar);
  8751. +-void ath10k_pci_kill_tasklet(struct ath10k *ar);
  8752. ++void ath10k_pci_init_napi(struct ath10k *ar);
  8753. + int ath10k_pci_init_pipes(struct ath10k *ar);
  8754. + int ath10k_pci_init_config(struct ath10k *ar);
  8755. + void ath10k_pci_rx_post(struct ath10k *ar);
  8756. +@@ -303,6 +300,7 @@ void ath10k_pci_flush(struct ath10k *ar)
  8757. + void ath10k_pci_enable_legacy_irq(struct ath10k *ar);
  8758. + bool ath10k_pci_irq_pending(struct ath10k *ar);
  8759. + void ath10k_pci_disable_and_clear_legacy_irq(struct ath10k *ar);
  8760. ++void ath10k_pci_irq_msi_fw_mask(struct ath10k *ar);
  8761. + int ath10k_pci_wait_for_target_init(struct ath10k *ar);
  8762. + int ath10k_pci_setup_resource(struct ath10k *ar);
  8763. + void ath10k_pci_release_resource(struct ath10k *ar);
  8764. 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
  8765. deleted file mode 100644
  8766. index e414f23..0000000
  8767. --- a/package/kernel/mac80211/patches/332-cfg80211-fix-faulty-variable-initialization-in-ieee8.patch
  8768. +++ /dev/null
  8769. @@ -1,22 +0,0 @@
  8770. -From: Felix Fietkau <nbd@openwrt.org>
  8771. -Date: Mon, 8 Feb 2016 14:24:36 +0100
  8772. -Subject: [PATCH] cfg80211: fix faulty variable initialization in
  8773. - ieee80211_amsdu_to_8023s
  8774. -
  8775. -reuse_skb is set to true if the code decides to use the last segment.
  8776. -Fixes a memory leak
  8777. -
  8778. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8779. ----
  8780. -
  8781. ---- a/net/wireless/util.c
  8782. -+++ b/net/wireless/util.c
  8783. -@@ -676,7 +676,7 @@ void ieee80211_amsdu_to_8023s(struct sk_
  8784. - u8 *payload;
  8785. - int offset = 0, remaining, err;
  8786. - struct ethhdr eth;
  8787. -- bool reuse_skb = true;
  8788. -+ bool reuse_skb = false;
  8789. - bool last = false;
  8790. -
  8791. - if (has_80211_header) {
  8792. diff --git a/package/kernel/mac80211/patches/333-ath9k-fix-client-mode-beacon-configuration.patch b/package/kernel/mac80211/patches/333-ath9k-fix-client-mode-beacon-configuration.patch
  8793. new file mode 100644
  8794. index 0000000..d008ceb
  8795. --- /dev/null
  8796. +++ b/package/kernel/mac80211/patches/333-ath9k-fix-client-mode-beacon-configuration.patch
  8797. @@ -0,0 +1,69 @@
  8798. +From: Felix Fietkau <nbd@nbd.name>
  8799. +Date: Tue, 26 Jul 2016 08:05:10 +0200
  8800. +Subject: [PATCH] ath9k: fix client mode beacon configuration
  8801. +
  8802. +For pure station mode, iter_data.primary_beacon_vif was used and passed
  8803. +to ath_beacon_config, but not set to the station vif.
  8804. +This was causing the following warning:
  8805. +
  8806. +[ 100.310919] ------------[ cut here ]------------
  8807. +[ 100.315683] WARNING: CPU: 0 PID: 7 at compat-wireless-2016-06-20/drivers/net/wireless/ath/ath9k/beacon.c:642 ath9k_calculate_summary_state+0x250/0x60c [ath9k]()
  8808. +[ 100.402028] CPU: 0 PID: 7 Comm: kworker/u2:1 Tainted: G W 4.4.15 #5
  8809. +[ 100.409676] Workqueue: phy0 ieee80211_ibss_leave [mac80211]
  8810. +[ 100.415351] Stack : 8736e98c 870b4b20 87a25b54 800a6800 8782a080 80400d63 8039b96c 00000007
  8811. +[ 100.415351] 803c5edc 87875914 80400000 800a47cc 87a25b54 800a6800 803a0fd8 80400000
  8812. +[ 100.415351] 00000003 87875914 80400000 80094ae0 87a25b54 8787594c 00000000 801ef308
  8813. +[ 100.415351] 803ffe70 801ef300 87193d58 87b3a400 87b3ad00 70687930 00000000 00000000
  8814. +[ 100.415351] 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  8815. +[ 100.415351] ...
  8816. +[ 100.451703] Call Trace:
  8817. +[ 100.454235] [<800a6800>] vprintk_default+0x24/0x30
  8818. +[ 100.459110] [<800a47cc>] printk+0x2c/0x38
  8819. +[ 100.463190] [<800a6800>] vprintk_default+0x24/0x30
  8820. +[ 100.468072] [<80094ae0>] print_worker_info+0x148/0x174
  8821. +[ 100.473378] [<801ef308>] serial8250_console_putchar+0x0/0x44
  8822. +[ 100.479122] [<801ef300>] wait_for_xmitr+0xc4/0xcc
  8823. +[ 100.484014] [<87193d58>] ieee80211_ibss_leave+0xb90/0x1900 [mac80211]
  8824. +[ 100.490590] [<80081604>] warn_slowpath_common+0xa0/0xd0
  8825. +[ 100.495922] [<801a359c>] dump_stack+0x14/0x28
  8826. +[ 100.500350] [<80071a00>] show_stack+0x50/0x84
  8827. +[ 100.504784] [<80081604>] warn_slowpath_common+0xa0/0xd0
  8828. +[ 100.510106] [<87024c60>] ath9k_calculate_summary_state+0x250/0x60c [ath9k]
  8829. +[ 100.517105] [<800816b8>] warn_slowpath_null+0x18/0x24
  8830. +[ 100.522256] [<87024c60>] ath9k_calculate_summary_state+0x250/0x60c [ath9k]
  8831. +[ 100.529273] [<87025418>] ath9k_set_txpower+0x148/0x498 [ath9k]
  8832. +[ 100.535302] [<871d2c64>] cleanup_module+0xa74/0xd4c [mac80211]
  8833. +[ 100.541237] [<801ef308>] serial8250_console_putchar+0x0/0x44
  8834. +[ 100.547042] [<800a5d18>] wake_up_klogd+0x54/0x68
  8835. +[ 100.551730] [<800a6650>] vprintk_emit+0x404/0x43c
  8836. +[ 100.556623] [<871b9db8>] ieee80211_sta_rx_notify+0x258/0x32c [mac80211]
  8837. +[ 100.563475] [<871ba6a4>] ieee80211_sta_rx_queued_mgmt+0x63c/0x734 [mac80211]
  8838. +[ 100.570693] [<871aa49c>] ieee80211_tx_prepare_skb+0x210/0x230 [mac80211]
  8839. +[ 100.577609] [<800af5d4>] mod_timer+0x15c/0x190
  8840. +[ 100.582220] [<871ba8b8>] ieee80211_sta_work+0xfc/0xe1c [mac80211]
  8841. +[ 100.588539] [<871940b4>] ieee80211_ibss_leave+0xeec/0x1900 [mac80211]
  8842. +[ 100.595122] [<8009ec84>] dequeue_task_fair+0x44/0x130
  8843. +[ 100.600281] [<80092a34>] process_one_work+0x1f8/0x334
  8844. +[ 100.605454] [<80093830>] worker_thread+0x2b4/0x408
  8845. +[ 100.610317] [<8009357c>] worker_thread+0x0/0x408
  8846. +[ 100.615019] [<8009357c>] worker_thread+0x0/0x408
  8847. +[ 100.619705] [<80097b68>] kthread+0xdc/0xe8
  8848. +[ 100.623886] [<80097a8c>] kthread+0x0/0xe8
  8849. +[ 100.627961] [<80060878>] ret_from_kernel_thread+0x14/0x1c
  8850. +[ 100.633448]
  8851. +[ 100.634956] ---[ end trace aafbe57e9ae6862f ]---
  8852. +
  8853. +Fixes: cfda2d8e2314 ("ath9k: Fix beacon configuration for addition/removal of interfaces")
  8854. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  8855. +---
  8856. +
  8857. +--- a/drivers/net/wireless/ath/ath9k/main.c
  8858. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  8859. +@@ -1154,6 +1154,7 @@ void ath9k_calculate_summary_state(struc
  8860. + bool changed = (iter_data.primary_sta != ctx->primary_sta);
  8861. +
  8862. + if (iter_data.primary_sta) {
  8863. ++ iter_data.primary_beacon_vif = iter_data.primary_sta;
  8864. + iter_data.beacons = true;
  8865. + ath9k_set_assoc_state(sc, iter_data.primary_sta,
  8866. + changed);
  8867. 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
  8868. deleted file mode 100644
  8869. index 6e2d0cf..0000000
  8870. --- a/package/kernel/mac80211/patches/333-cfg80211-reuse-existing-page-fragments-in-A-MSDU-rx.patch
  8871. +++ /dev/null
  8872. @@ -1,132 +0,0 @@
  8873. -From: Felix Fietkau <nbd@openwrt.org>
  8874. -Date: Mon, 8 Feb 2016 14:33:19 +0100
  8875. -Subject: [PATCH] cfg80211: reuse existing page fragments in A-MSDU rx
  8876. -
  8877. -This massively reduces data copying and thus improves rx performance
  8878. -
  8879. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8880. ----
  8881. -
  8882. ---- a/net/wireless/util.c
  8883. -+++ b/net/wireless/util.c
  8884. -@@ -644,23 +644,93 @@ int ieee80211_data_from_8023(struct sk_b
  8885. - }
  8886. - EXPORT_SYMBOL(ieee80211_data_from_8023);
  8887. -
  8888. -+static void
  8889. -+__frame_add_frag(struct sk_buff *skb, struct page *page,
  8890. -+ void *ptr, int len, int size)
  8891. -+{
  8892. -+ struct skb_shared_info *sh = skb_shinfo(skb);
  8893. -+ int page_offset;
  8894. -+
  8895. -+ atomic_inc(&page->_count);
  8896. -+ page_offset = ptr - page_address(page);
  8897. -+ skb_add_rx_frag(skb, sh->nr_frags, page, page_offset, len, size);
  8898. -+}
  8899. -+
  8900. -+static void
  8901. -+__ieee80211_amsdu_copy_frag(struct sk_buff *skb, struct sk_buff *frame,
  8902. -+ int offset, int len)
  8903. -+{
  8904. -+ struct skb_shared_info *sh = skb_shinfo(skb);
  8905. -+ const skb_frag_t *frag = &sh->frags[-1];
  8906. -+ struct page *frag_page;
  8907. -+ void *frag_ptr;
  8908. -+ int frag_len, frag_size;
  8909. -+ int head_size = skb->len - skb->data_len;
  8910. -+ int cur_len;
  8911. -+
  8912. -+ frag_page = virt_to_head_page(skb->head);
  8913. -+ frag_ptr = skb->data;
  8914. -+ frag_size = head_size;
  8915. -+
  8916. -+ while (offset >= frag_size) {
  8917. -+ offset -= frag_size;
  8918. -+ frag++;
  8919. -+ frag_page = skb_frag_page(frag);
  8920. -+ frag_ptr = skb_frag_address(frag);
  8921. -+ frag_size = skb_frag_size(frag);
  8922. -+ }
  8923. -+
  8924. -+ frag_ptr += offset;
  8925. -+ frag_len = frag_size - offset;
  8926. -+
  8927. -+ cur_len = min(len, frag_len);
  8928. -+
  8929. -+ __frame_add_frag(frame, frag_page, frag_ptr, cur_len, frag_size);
  8930. -+ len -= cur_len;
  8931. -+
  8932. -+ while (len > 0) {
  8933. -+ frag++;
  8934. -+ frag_len = skb_frag_size(frag);
  8935. -+ cur_len = min(len, frag_len);
  8936. -+ __frame_add_frag(frame, skb_frag_page(frag),
  8937. -+ skb_frag_address(frag), cur_len, frag_len);
  8938. -+ len -= cur_len;
  8939. -+ }
  8940. -+}
  8941. -+
  8942. - static struct sk_buff *
  8943. - __ieee80211_amsdu_copy(struct sk_buff *skb, unsigned int hlen,
  8944. -- int offset, int len)
  8945. -+ int offset, int len, bool reuse_frag)
  8946. - {
  8947. - struct sk_buff *frame;
  8948. -+ int cur_len = len;
  8949. -
  8950. - if (skb->len - offset < len)
  8951. - return NULL;
  8952. -
  8953. - /*
  8954. -+ * When reusing framents, copy some data to the head to simplify
  8955. -+ * ethernet header handling and speed up protocol header processing
  8956. -+ * in the stack later.
  8957. -+ */
  8958. -+ if (reuse_frag)
  8959. -+ cur_len = min_t(int, len, 32);
  8960. -+
  8961. -+ /*
  8962. - * Allocate and reserve two bytes more for payload
  8963. - * alignment since sizeof(struct ethhdr) is 14.
  8964. - */
  8965. -- frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + len);
  8966. -+ frame = dev_alloc_skb(hlen + sizeof(struct ethhdr) + 2 + cur_len);
  8967. -
  8968. - skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2);
  8969. -- skb_copy_bits(skb, offset, skb_put(frame, len), len);
  8970. -+ skb_copy_bits(skb, offset, skb_put(frame, cur_len), cur_len);
  8971. -+
  8972. -+ len -= cur_len;
  8973. -+ if (!len)
  8974. -+ return frame;
  8975. -+
  8976. -+ offset += cur_len;
  8977. -+ __ieee80211_amsdu_copy_frag(skb, frame, offset, len);
  8978. -
  8979. - return frame;
  8980. - }
  8981. -@@ -676,6 +746,7 @@ void ieee80211_amsdu_to_8023s(struct sk_
  8982. - u8 *payload;
  8983. - int offset = 0, remaining, err;
  8984. - struct ethhdr eth;
  8985. -+ bool reuse_frag = skb->head_frag && !skb_has_frag_list(skb);
  8986. - bool reuse_skb = false;
  8987. - bool last = false;
  8988. -
  8989. -@@ -703,12 +774,13 @@ void ieee80211_amsdu_to_8023s(struct sk_
  8990. - offset += sizeof(struct ethhdr);
  8991. - /* reuse skb for the last subframe */
  8992. - last = remaining <= subframe_len + padding;
  8993. -- if (!skb_is_nonlinear(skb) && last) {
  8994. -+ if (!skb_is_nonlinear(skb) && !reuse_frag && last) {
  8995. - skb_pull(skb, offset);
  8996. - frame = skb;
  8997. - reuse_skb = true;
  8998. - } else {
  8999. -- frame = __ieee80211_amsdu_copy(skb, hlen, offset, len);
  9000. -+ frame = __ieee80211_amsdu_copy(skb, hlen, offset, len,
  9001. -+ reuse_frag);
  9002. - if (!frame)
  9003. - goto purge;
  9004. -
  9005. diff --git a/package/kernel/mac80211/patches/334-mac80211-fix-purging-multicast-PS-buffer-queue.patch b/package/kernel/mac80211/patches/334-mac80211-fix-purging-multicast-PS-buffer-queue.patch
  9006. new file mode 100644
  9007. index 0000000..dfcc6e4
  9008. --- /dev/null
  9009. +++ b/package/kernel/mac80211/patches/334-mac80211-fix-purging-multicast-PS-buffer-queue.patch
  9010. @@ -0,0 +1,54 @@
  9011. +From: Felix Fietkau <nbd@nbd.name>
  9012. +Date: Tue, 2 Aug 2016 11:11:13 +0200
  9013. +Subject: [PATCH] mac80211: fix purging multicast PS buffer queue
  9014. +
  9015. +The code currently assumes that buffered multicast PS frames don't have
  9016. +a pending ACK frame for tx status reporting.
  9017. +However, hostapd sends a broadcast deauth frame on teardown for which tx
  9018. +status is requested. This can lead to the "Have pending ack frames"
  9019. +warning on module reload.
  9020. +Fix this by using ieee80211_free_txskb/ieee80211_purge_tx_queue.
  9021. +
  9022. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  9023. +---
  9024. +
  9025. +--- a/net/mac80211/cfg.c
  9026. ++++ b/net/mac80211/cfg.c
  9027. +@@ -868,7 +868,7 @@ static int ieee80211_stop_ap(struct wiph
  9028. +
  9029. + /* free all potentially still buffered bcast frames */
  9030. + local->total_ps_buffered -= skb_queue_len(&sdata->u.ap.ps.bc_buf);
  9031. +- skb_queue_purge(&sdata->u.ap.ps.bc_buf);
  9032. ++ ieee80211_purge_tx_queue(&local->hw, &sdata->u.ap.ps.bc_buf);
  9033. +
  9034. + mutex_lock(&local->mtx);
  9035. + ieee80211_vif_copy_chanctx_to_vlans(sdata, true);
  9036. +--- a/net/mac80211/tx.c
  9037. ++++ b/net/mac80211/tx.c
  9038. +@@ -368,7 +368,7 @@ static void purge_old_ps_buffers(struct
  9039. + skb = skb_dequeue(&ps->bc_buf);
  9040. + if (skb) {
  9041. + purged++;
  9042. +- dev_kfree_skb(skb);
  9043. ++ ieee80211_free_txskb(&local->hw, skb);
  9044. + }
  9045. + total += skb_queue_len(&ps->bc_buf);
  9046. + }
  9047. +@@ -451,7 +451,7 @@ ieee80211_tx_h_multicast_ps_buf(struct i
  9048. + if (skb_queue_len(&ps->bc_buf) >= AP_MAX_BC_BUFFER) {
  9049. + ps_dbg(tx->sdata,
  9050. + "BC TX buffer full - dropping the oldest frame\n");
  9051. +- dev_kfree_skb(skb_dequeue(&ps->bc_buf));
  9052. ++ ieee80211_free_txskb(&tx->local->hw, skb_dequeue(&ps->bc_buf));
  9053. + } else
  9054. + tx->local->total_ps_buffered++;
  9055. +
  9056. +@@ -4276,7 +4276,7 @@ ieee80211_get_buffered_bc(struct ieee802
  9057. + sdata = IEEE80211_DEV_TO_SUB_IF(skb->dev);
  9058. + if (!ieee80211_tx_prepare(sdata, &tx, NULL, skb))
  9059. + break;
  9060. +- dev_kfree_skb_any(skb);
  9061. ++ ieee80211_free_txskb(hw, skb);
  9062. + }
  9063. +
  9064. + info = IEEE80211_SKB_CB(skb);
  9065. 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
  9066. deleted file mode 100644
  9067. index f8f4f09..0000000
  9068. --- a/package/kernel/mac80211/patches/334-mac80211-fix-wiphy-supported_band-access.patch
  9069. +++ /dev/null
  9070. @@ -1,36 +0,0 @@
  9071. -From: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  9072. -Date: Wed, 10 Feb 2016 16:08:17 +0100
  9073. -Subject: [PATCH] mac80211: fix wiphy supported_band access
  9074. -
  9075. -Fix wiphy supported_band access in tx radiotap parsing. In particular,
  9076. -info->band is always set to 0 (IEEE80211_BAND_2GHZ) since it has not
  9077. -assigned yet. This cause a kernel crash on 5GHz only devices.
  9078. -Move ieee80211_parse_tx_radiotap() after info->band assignment
  9079. -
  9080. -Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  9081. ----
  9082. -
  9083. ---- a/net/mac80211/tx.c
  9084. -+++ b/net/mac80211/tx.c
  9085. -@@ -1890,10 +1890,6 @@ netdev_tx_t ieee80211_monitor_start_xmit
  9086. - info->flags = IEEE80211_TX_CTL_REQ_TX_STATUS |
  9087. - IEEE80211_TX_CTL_INJECTED;
  9088. -
  9089. -- /* process and remove the injection radiotap header */
  9090. -- if (!ieee80211_parse_tx_radiotap(local, skb))
  9091. -- goto fail;
  9092. --
  9093. - rcu_read_lock();
  9094. -
  9095. - /*
  9096. -@@ -1955,6 +1951,10 @@ netdev_tx_t ieee80211_monitor_start_xmit
  9097. - goto fail_rcu;
  9098. -
  9099. - info->band = chandef->chan->band;
  9100. -+ /* process and remove the injection radiotap header */
  9101. -+ if (!ieee80211_parse_tx_radiotap(local, skb))
  9102. -+ goto fail_rcu;
  9103. -+
  9104. - ieee80211_xmit(sdata, NULL, skb);
  9105. - rcu_read_unlock();
  9106. -
  9107. diff --git a/package/kernel/mac80211/patches/335-ath9k-use-ieee80211_tx_status_noskb-where-possible.patch b/package/kernel/mac80211/patches/335-ath9k-use-ieee80211_tx_status_noskb-where-possible.patch
  9108. new file mode 100644
  9109. index 0000000..dbb5b90
  9110. --- /dev/null
  9111. +++ b/package/kernel/mac80211/patches/335-ath9k-use-ieee80211_tx_status_noskb-where-possible.patch
  9112. @@ -0,0 +1,305 @@
  9113. +From: Felix Fietkau <nbd@nbd.name>
  9114. +Date: Tue, 2 Aug 2016 12:12:18 +0200
  9115. +Subject: [PATCH] ath9k: use ieee80211_tx_status_noskb where possible
  9116. +
  9117. +It removes the need for undoing the padding changes to skb->data and it
  9118. +improves performance by eliminating one tx status lookup per MPDU in the
  9119. +status path. It is also useful for preparing a follow-up fix to better
  9120. +handle powersave filtering.
  9121. +
  9122. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  9123. +---
  9124. +
  9125. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  9126. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  9127. +@@ -50,9 +50,11 @@ static u16 bits_per_symbol[][2] = {
  9128. + static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq,
  9129. + struct ath_atx_tid *tid, struct sk_buff *skb);
  9130. + static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
  9131. +- int tx_flags, struct ath_txq *txq);
  9132. ++ int tx_flags, struct ath_txq *txq,
  9133. ++ struct ieee80211_sta *sta);
  9134. + static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
  9135. + struct ath_txq *txq, struct list_head *bf_q,
  9136. ++ struct ieee80211_sta *sta,
  9137. + struct ath_tx_status *ts, int txok);
  9138. + static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq,
  9139. + struct list_head *head, bool internal);
  9140. +@@ -77,6 +79,22 @@ enum {
  9141. + /* Aggregation logic */
  9142. + /*********************/
  9143. +
  9144. ++static void ath_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
  9145. ++{
  9146. ++ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  9147. ++ struct ieee80211_sta *sta = info->status.status_driver_data[0];
  9148. ++
  9149. ++ if (info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS) {
  9150. ++ ieee80211_tx_status(hw, skb);
  9151. ++ return;
  9152. ++ }
  9153. ++
  9154. ++ if (sta)
  9155. ++ ieee80211_tx_status_noskb(hw, sta, info);
  9156. ++
  9157. ++ dev_kfree_skb(skb);
  9158. ++}
  9159. ++
  9160. + void ath_txq_lock(struct ath_softc *sc, struct ath_txq *txq)
  9161. + __acquires(&txq->axq_lock)
  9162. + {
  9163. +@@ -92,6 +110,7 @@ void ath_txq_unlock(struct ath_softc *sc
  9164. + void ath_txq_unlock_complete(struct ath_softc *sc, struct ath_txq *txq)
  9165. + __releases(&txq->axq_lock)
  9166. + {
  9167. ++ struct ieee80211_hw *hw = sc->hw;
  9168. + struct sk_buff_head q;
  9169. + struct sk_buff *skb;
  9170. +
  9171. +@@ -100,7 +119,7 @@ void ath_txq_unlock_complete(struct ath_
  9172. + spin_unlock_bh(&txq->axq_lock);
  9173. +
  9174. + while ((skb = __skb_dequeue(&q)))
  9175. +- ieee80211_tx_status(sc->hw, skb);
  9176. ++ ath_tx_status(hw, skb);
  9177. + }
  9178. +
  9179. + static void ath_tx_queue_tid(struct ath_softc *sc, struct ath_txq *txq,
  9180. +@@ -268,7 +287,7 @@ static void ath_tx_flush_tid(struct ath_
  9181. + }
  9182. +
  9183. + list_add_tail(&bf->list, &bf_head);
  9184. +- ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
  9185. ++ ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0);
  9186. + }
  9187. +
  9188. + if (sendbar) {
  9189. +@@ -333,12 +352,12 @@ static void ath_tid_drain(struct ath_sof
  9190. + bf = fi->bf;
  9191. +
  9192. + if (!bf) {
  9193. +- ath_tx_complete(sc, skb, ATH_TX_ERROR, txq);
  9194. ++ ath_tx_complete(sc, skb, ATH_TX_ERROR, txq, NULL);
  9195. + continue;
  9196. + }
  9197. +
  9198. + list_add_tail(&bf->list, &bf_head);
  9199. +- ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
  9200. ++ ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0);
  9201. + }
  9202. + }
  9203. +
  9204. +@@ -441,12 +460,11 @@ static void ath_tx_count_frames(struct a
  9205. +
  9206. + static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
  9207. + struct ath_buf *bf, struct list_head *bf_q,
  9208. ++ struct ieee80211_sta *sta,
  9209. + struct ath_tx_status *ts, int txok)
  9210. + {
  9211. + struct ath_node *an = NULL;
  9212. + struct sk_buff *skb;
  9213. +- struct ieee80211_sta *sta;
  9214. +- struct ieee80211_hw *hw = sc->hw;
  9215. + struct ieee80211_hdr *hdr;
  9216. + struct ieee80211_tx_info *tx_info;
  9217. + struct ath_atx_tid *tid = NULL;
  9218. +@@ -475,12 +493,7 @@ static void ath_tx_complete_aggr(struct
  9219. + for (i = 0; i < ts->ts_rateindex; i++)
  9220. + retries += rates[i].count;
  9221. +
  9222. +- rcu_read_lock();
  9223. +-
  9224. +- sta = ieee80211_find_sta_by_ifaddr(hw, hdr->addr1, hdr->addr2);
  9225. + if (!sta) {
  9226. +- rcu_read_unlock();
  9227. +-
  9228. + INIT_LIST_HEAD(&bf_head);
  9229. + while (bf) {
  9230. + bf_next = bf->bf_next;
  9231. +@@ -488,7 +501,7 @@ static void ath_tx_complete_aggr(struct
  9232. + if (!bf->bf_state.stale || bf_next != NULL)
  9233. + list_move_tail(&bf->list, &bf_head);
  9234. +
  9235. +- ath_tx_complete_buf(sc, bf, txq, &bf_head, ts, 0);
  9236. ++ ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, ts, 0);
  9237. +
  9238. + bf = bf_next;
  9239. + }
  9240. +@@ -598,7 +611,7 @@ static void ath_tx_complete_aggr(struct
  9241. + ts);
  9242. + }
  9243. +
  9244. +- ath_tx_complete_buf(sc, bf, txq, &bf_head, ts,
  9245. ++ ath_tx_complete_buf(sc, bf, txq, &bf_head, sta, ts,
  9246. + !txfail);
  9247. + } else {
  9248. + if (tx_info->flags & IEEE80211_TX_STATUS_EOSP) {
  9249. +@@ -619,7 +632,8 @@ static void ath_tx_complete_aggr(struct
  9250. + ath_tx_update_baw(sc, tid, seqno);
  9251. +
  9252. + ath_tx_complete_buf(sc, bf, txq,
  9253. +- &bf_head, ts, 0);
  9254. ++ &bf_head, NULL, ts,
  9255. ++ 0);
  9256. + bar_index = max_t(int, bar_index,
  9257. + ATH_BA_INDEX(seq_first, seqno));
  9258. + break;
  9259. +@@ -663,8 +677,6 @@ static void ath_tx_complete_aggr(struct
  9260. + ath_txq_lock(sc, txq);
  9261. + }
  9262. +
  9263. +- rcu_read_unlock();
  9264. +-
  9265. + if (needreset)
  9266. + ath9k_queue_reset(sc, RESET_TYPE_TX_ERROR);
  9267. + }
  9268. +@@ -679,7 +691,10 @@ static void ath_tx_process_buffer(struct
  9269. + struct ath_tx_status *ts, struct ath_buf *bf,
  9270. + struct list_head *bf_head)
  9271. + {
  9272. ++ struct ieee80211_hw *hw = sc->hw;
  9273. + struct ieee80211_tx_info *info;
  9274. ++ struct ieee80211_sta *sta;
  9275. ++ struct ieee80211_hdr *hdr;
  9276. + bool txok, flush;
  9277. +
  9278. + txok = !(ts->ts_status & ATH9K_TXERR_MASK);
  9279. +@@ -692,6 +707,10 @@ static void ath_tx_process_buffer(struct
  9280. +
  9281. + ts->duration = ath9k_hw_get_duration(sc->sc_ah, bf->bf_desc,
  9282. + ts->ts_rateindex);
  9283. ++
  9284. ++ hdr = (struct ieee80211_hdr *) bf->bf_mpdu->data;
  9285. ++ sta = ieee80211_find_sta_by_ifaddr(hw, hdr->addr1, hdr->addr2);
  9286. ++
  9287. + if (!bf_isampdu(bf)) {
  9288. + if (!flush) {
  9289. + info = IEEE80211_SKB_CB(bf->bf_mpdu);
  9290. +@@ -700,9 +719,9 @@ static void ath_tx_process_buffer(struct
  9291. + ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok);
  9292. + ath_dynack_sample_tx_ts(sc->sc_ah, bf->bf_mpdu, ts);
  9293. + }
  9294. +- ath_tx_complete_buf(sc, bf, txq, bf_head, ts, txok);
  9295. ++ ath_tx_complete_buf(sc, bf, txq, bf_head, sta, ts, txok);
  9296. + } else
  9297. +- ath_tx_complete_aggr(sc, txq, bf, bf_head, ts, txok);
  9298. ++ ath_tx_complete_aggr(sc, txq, bf, bf_head, sta, ts, txok);
  9299. +
  9300. + if (!flush)
  9301. + ath_txq_schedule(sc, txq);
  9302. +@@ -938,7 +957,7 @@ ath_tx_get_tid_subframe(struct ath_softc
  9303. + list_add(&bf->list, &bf_head);
  9304. + __skb_unlink(skb, *q);
  9305. + ath_tx_update_baw(sc, tid, seqno);
  9306. +- ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
  9307. ++ ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0);
  9308. + continue;
  9309. + }
  9310. +
  9311. +@@ -1847,6 +1866,7 @@ static void ath_drain_txq_list(struct at
  9312. + */
  9313. + void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq)
  9314. + {
  9315. ++ rcu_read_lock();
  9316. + ath_txq_lock(sc, txq);
  9317. +
  9318. + if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) {
  9319. +@@ -1865,6 +1885,7 @@ void ath_draintxq(struct ath_softc *sc,
  9320. + ath_drain_txq_list(sc, txq, &txq->axq_q);
  9321. +
  9322. + ath_txq_unlock_complete(sc, txq);
  9323. ++ rcu_read_unlock();
  9324. + }
  9325. +
  9326. + bool ath_drain_all_txq(struct ath_softc *sc)
  9327. +@@ -2487,7 +2508,8 @@ void ath_tx_cabq(struct ieee80211_hw *hw
  9328. + /*****************/
  9329. +
  9330. + static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
  9331. +- int tx_flags, struct ath_txq *txq)
  9332. ++ int tx_flags, struct ath_txq *txq,
  9333. ++ struct ieee80211_sta *sta)
  9334. + {
  9335. + struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
  9336. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  9337. +@@ -2507,15 +2529,17 @@ static void ath_tx_complete(struct ath_s
  9338. + tx_info->flags |= IEEE80211_TX_STAT_ACK;
  9339. + }
  9340. +
  9341. +- padpos = ieee80211_hdrlen(hdr->frame_control);
  9342. +- padsize = padpos & 3;
  9343. +- if (padsize && skb->len>padpos+padsize) {
  9344. +- /*
  9345. +- * Remove MAC header padding before giving the frame back to
  9346. +- * mac80211.
  9347. +- */
  9348. +- memmove(skb->data + padsize, skb->data, padpos);
  9349. +- skb_pull(skb, padsize);
  9350. ++ if (tx_info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS) {
  9351. ++ padpos = ieee80211_hdrlen(hdr->frame_control);
  9352. ++ padsize = padpos & 3;
  9353. ++ if (padsize && skb->len>padpos+padsize) {
  9354. ++ /*
  9355. ++ * Remove MAC header padding before giving the frame back to
  9356. ++ * mac80211.
  9357. ++ */
  9358. ++ memmove(skb->data + padsize, skb->data, padpos);
  9359. ++ skb_pull(skb, padsize);
  9360. ++ }
  9361. + }
  9362. +
  9363. + spin_lock_irqsave(&sc->sc_pm_lock, flags);
  9364. +@@ -2530,12 +2554,14 @@ static void ath_tx_complete(struct ath_s
  9365. + }
  9366. + spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
  9367. +
  9368. +- __skb_queue_tail(&txq->complete_q, skb);
  9369. + ath_txq_skb_done(sc, txq, skb);
  9370. ++ tx_info->status.status_driver_data[0] = sta;
  9371. ++ __skb_queue_tail(&txq->complete_q, skb);
  9372. + }
  9373. +
  9374. + static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
  9375. + struct ath_txq *txq, struct list_head *bf_q,
  9376. ++ struct ieee80211_sta *sta,
  9377. + struct ath_tx_status *ts, int txok)
  9378. + {
  9379. + struct sk_buff *skb = bf->bf_mpdu;
  9380. +@@ -2563,7 +2589,7 @@ static void ath_tx_complete_buf(struct a
  9381. + complete(&sc->paprd_complete);
  9382. + } else {
  9383. + ath_debug_stat_tx(sc, bf, ts, txq, tx_flags);
  9384. +- ath_tx_complete(sc, skb, tx_flags, txq);
  9385. ++ ath_tx_complete(sc, skb, tx_flags, txq, sta);
  9386. + }
  9387. + skip_tx_complete:
  9388. + /* At this point, skb (bf->bf_mpdu) is consumed...make sure we don't
  9389. +@@ -2715,10 +2741,12 @@ void ath_tx_tasklet(struct ath_softc *sc
  9390. + u32 qcumask = ((1 << ATH9K_NUM_TX_QUEUES) - 1) & ah->intr_txqs;
  9391. + int i;
  9392. +
  9393. ++ rcu_read_lock();
  9394. + for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
  9395. + if (ATH_TXQ_SETUP(sc, i) && (qcumask & (1 << i)))
  9396. + ath_tx_processq(sc, &sc->tx.txq[i]);
  9397. + }
  9398. ++ rcu_read_unlock();
  9399. + }
  9400. +
  9401. + void ath_tx_edma_tasklet(struct ath_softc *sc)
  9402. +@@ -2732,6 +2760,7 @@ void ath_tx_edma_tasklet(struct ath_soft
  9403. + struct list_head *fifo_list;
  9404. + int status;
  9405. +
  9406. ++ rcu_read_lock();
  9407. + for (;;) {
  9408. + if (test_bit(ATH_OP_HW_RESET, &common->op_flags))
  9409. + break;
  9410. +@@ -2802,6 +2831,7 @@ void ath_tx_edma_tasklet(struct ath_soft
  9411. + ath_tx_process_buffer(sc, txq, &ts, bf, &bf_head);
  9412. + ath_txq_unlock_complete(sc, txq);
  9413. + }
  9414. ++ rcu_read_unlock();
  9415. + }
  9416. +
  9417. + /*****************/
  9418. 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
  9419. deleted file mode 100644
  9420. index acaacf7..0000000
  9421. --- a/package/kernel/mac80211/patches/335-mac80211-minstrel_ht-set-A-MSDU-tx-limits-based-on-s.patch
  9422. +++ /dev/null
  9423. @@ -1,61 +0,0 @@
  9424. -From: Felix Fietkau <nbd@openwrt.org>
  9425. -Date: Thu, 18 Feb 2016 19:30:05 +0100
  9426. -Subject: [PATCH] mac80211: minstrel_ht: set A-MSDU tx limits based on selected
  9427. - max_prob_rate
  9428. -
  9429. -Prevents excessive A-MSDU aggregation at low data rates or bad
  9430. -conditions.
  9431. -
  9432. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9433. ----
  9434. -
  9435. ---- a/net/mac80211/rc80211_minstrel_ht.c
  9436. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  9437. -@@ -883,6 +883,39 @@ minstrel_ht_set_rate(struct minstrel_pri
  9438. - ratetbl->rate[offset].flags = flags;
  9439. - }
  9440. -
  9441. -+static int
  9442. -+minstrel_ht_get_max_amsdu_len(struct minstrel_ht_sta *mi)
  9443. -+{
  9444. -+ int group = mi->max_prob_rate / MCS_GROUP_RATES;
  9445. -+ const struct mcs_group *g = &minstrel_mcs_groups[group];
  9446. -+ int rate = mi->max_prob_rate % MCS_GROUP_RATES;
  9447. -+
  9448. -+ /* Disable A-MSDU if max_prob_rate is bad */
  9449. -+ if (mi->groups[group].rates[rate].prob_ewma < MINSTREL_FRAC(50, 100))
  9450. -+ return 1;
  9451. -+
  9452. -+ /* If the rate is slower than single-stream MCS1, make A-MSDU limit small */
  9453. -+ if (g->duration[rate] > MCS_DURATION(1, 0, 52))
  9454. -+ return 500;
  9455. -+
  9456. -+ /*
  9457. -+ * If the rate is slower than single-stream MCS4, limit A-MSDU to usual
  9458. -+ * data packet size
  9459. -+ */
  9460. -+ if (g->duration[rate] > MCS_DURATION(1, 0, 104))
  9461. -+ return 1500;
  9462. -+
  9463. -+ /*
  9464. -+ * If the rate is slower than single-stream MCS7, limit A-MSDU to twice
  9465. -+ * the usual data packet size
  9466. -+ */
  9467. -+ if (g->duration[rate] > MCS_DURATION(1, 0, 260))
  9468. -+ return 3000;
  9469. -+
  9470. -+ /* unlimited */
  9471. -+ return 0;
  9472. -+}
  9473. -+
  9474. - static void
  9475. - minstrel_ht_update_rates(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
  9476. - {
  9477. -@@ -907,6 +940,7 @@ minstrel_ht_update_rates(struct minstrel
  9478. - minstrel_ht_set_rate(mp, mi, rates, i++, mi->max_prob_rate);
  9479. - }
  9480. -
  9481. -+ mi->sta->max_rc_amsdu_len = minstrel_ht_get_max_amsdu_len(mi);
  9482. - rates->rate[i].idx = -1;
  9483. - rate_control_set_rates(mp->hw, mi->sta, rates);
  9484. - }
  9485. diff --git a/package/kernel/mac80211/patches/336-ath9k-improve-powersave-filter-handling.patch b/package/kernel/mac80211/patches/336-ath9k-improve-powersave-filter-handling.patch
  9486. new file mode 100644
  9487. index 0000000..67a6c63
  9488. --- /dev/null
  9489. +++ b/package/kernel/mac80211/patches/336-ath9k-improve-powersave-filter-handling.patch
  9490. @@ -0,0 +1,70 @@
  9491. +From: Felix Fietkau <nbd@nbd.name>
  9492. +Date: Tue, 2 Aug 2016 12:13:35 +0200
  9493. +Subject: [PATCH] ath9k: improve powersave filter handling
  9494. +
  9495. +For non-aggregated frames, ath9k was leaving handling of powersave
  9496. +filtered packets to mac80211. This can be too slow if the intermediate
  9497. +queue is already filled with packets and mac80211 does not immediately
  9498. +send a new packet via drv_tx().
  9499. +
  9500. +Improve response time with filtered frames by triggering clearing the
  9501. +powersave filter internally.
  9502. +
  9503. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  9504. +---
  9505. +
  9506. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  9507. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  9508. +@@ -461,13 +461,13 @@ static void ath_tx_count_frames(struct a
  9509. + static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
  9510. + struct ath_buf *bf, struct list_head *bf_q,
  9511. + struct ieee80211_sta *sta,
  9512. ++ struct ath_atx_tid *tid,
  9513. + struct ath_tx_status *ts, int txok)
  9514. + {
  9515. + struct ath_node *an = NULL;
  9516. + struct sk_buff *skb;
  9517. + struct ieee80211_hdr *hdr;
  9518. + struct ieee80211_tx_info *tx_info;
  9519. +- struct ath_atx_tid *tid = NULL;
  9520. + struct ath_buf *bf_next, *bf_last = bf->bf_lastbf;
  9521. + struct list_head bf_head;
  9522. + struct sk_buff_head bf_pending;
  9523. +@@ -509,7 +509,6 @@ static void ath_tx_complete_aggr(struct
  9524. + }
  9525. +
  9526. + an = (struct ath_node *)sta->drv_priv;
  9527. +- tid = ath_get_skb_tid(sc, an, skb);
  9528. + seq_first = tid->seq_start;
  9529. + isba = ts->ts_flags & ATH9K_TX_BA;
  9530. +
  9531. +@@ -695,6 +694,7 @@ static void ath_tx_process_buffer(struct
  9532. + struct ieee80211_tx_info *info;
  9533. + struct ieee80211_sta *sta;
  9534. + struct ieee80211_hdr *hdr;
  9535. ++ struct ath_atx_tid *tid = NULL;
  9536. + bool txok, flush;
  9537. +
  9538. + txok = !(ts->ts_status & ATH9K_TXERR_MASK);
  9539. +@@ -710,6 +710,12 @@ static void ath_tx_process_buffer(struct
  9540. +
  9541. + hdr = (struct ieee80211_hdr *) bf->bf_mpdu->data;
  9542. + sta = ieee80211_find_sta_by_ifaddr(hw, hdr->addr1, hdr->addr2);
  9543. ++ if (sta) {
  9544. ++ struct ath_node *an = (struct ath_node *)sta->drv_priv;
  9545. ++ tid = ath_get_skb_tid(sc, an, bf->bf_mpdu);
  9546. ++ if (ts->ts_status & (ATH9K_TXERR_FILT | ATH9K_TXERR_XRETRY))
  9547. ++ tid->clear_ps_filter = true;
  9548. ++ }
  9549. +
  9550. + if (!bf_isampdu(bf)) {
  9551. + if (!flush) {
  9552. +@@ -721,7 +727,7 @@ static void ath_tx_process_buffer(struct
  9553. + }
  9554. + ath_tx_complete_buf(sc, bf, txq, bf_head, sta, ts, txok);
  9555. + } else
  9556. +- ath_tx_complete_aggr(sc, txq, bf, bf_head, sta, ts, txok);
  9557. ++ ath_tx_complete_aggr(sc, txq, bf, bf_head, sta, tid, ts, txok);
  9558. +
  9559. + if (!flush)
  9560. + ath_txq_schedule(sc, txq);
  9561. 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
  9562. deleted file mode 100644
  9563. index 32a2ad6..0000000
  9564. --- a/package/kernel/mac80211/patches/336-mac80211-minstrel_ht-set-default-tx-aggregation-time.patch
  9565. +++ /dev/null
  9566. @@ -1,31 +0,0 @@
  9567. -From: Felix Fietkau <nbd@openwrt.org>
  9568. -Date: Thu, 18 Feb 2016 19:45:33 +0100
  9569. -Subject: [PATCH] mac80211: minstrel_ht: set default tx aggregation timeout to
  9570. - 0
  9571. -
  9572. -The value 5000 was put here with the addition of the timeout field to
  9573. -ieee80211_start_tx_ba_session. It was originally added in mac80211 to
  9574. -save resources for drivers like iwlwifi, which only supports a limited
  9575. -number of concurrent aggregation sessions.
  9576. -
  9577. -Since iwlwifi does not use minstrel_ht and other drivers don't need
  9578. -this, 0 is a better default - especially since there have been
  9579. -recent reports of aggregation setup related issues reproduced with
  9580. -ath9k. This should improve stability without causing any adverse
  9581. -effects.
  9582. -
  9583. -Cc: stable@vger.kernel.org
  9584. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  9585. ----
  9586. -
  9587. ---- a/net/mac80211/rc80211_minstrel_ht.c
  9588. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  9589. -@@ -692,7 +692,7 @@ minstrel_aggr_check(struct ieee80211_sta
  9590. - if (likely(sta->ampdu_mlme.tid_tx[tid]))
  9591. - return;
  9592. -
  9593. -- ieee80211_start_tx_ba_session(pubsta, tid, 5000);
  9594. -+ ieee80211_start_tx_ba_session(pubsta, tid, 0);
  9595. - }
  9596. -
  9597. - static void
  9598. diff --git a/package/kernel/mac80211/patches/337-ath9k-Switch-to-using-mac80211-intermediate-software.patch b/package/kernel/mac80211/patches/337-ath9k-Switch-to-using-mac80211-intermediate-software.patch
  9599. new file mode 100644
  9600. index 0000000..adfd6df
  9601. --- /dev/null
  9602. +++ b/package/kernel/mac80211/patches/337-ath9k-Switch-to-using-mac80211-intermediate-software.patch
  9603. @@ -0,0 +1,951 @@
  9604. +From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= <toke@toke.dk>
  9605. +Date: Wed, 6 Jul 2016 21:34:17 +0200
  9606. +Subject: [PATCH] ath9k: Switch to using mac80211 intermediate software queues.
  9607. +MIME-Version: 1.0
  9608. +Content-Type: text/plain; charset=UTF-8
  9609. +Content-Transfer-Encoding: 8bit
  9610. +
  9611. +This switches ath9k over to using the mac80211 intermediate software
  9612. +queueing mechanism for data packets. It removes the queueing inside the
  9613. +driver, except for the retry queue, and instead pulls from mac80211 when
  9614. +a packet is needed. The retry queue is used to store a packet that was
  9615. +pulled but can't be sent immediately.
  9616. +
  9617. +The old code path in ath_tx_start that would queue packets has been
  9618. +removed completely, as has the qlen limit tunables (since there's no
  9619. +longer a queue in the driver to limit).
  9620. +
  9621. +Based on Tim's original patch set, but reworked quite thoroughly.
  9622. +
  9623. +Cc: Tim Shepard <shep@alum.mit.edu>
  9624. +Cc: Felix Fietkau <nbd@nbd.name>
  9625. +Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
  9626. +---
  9627. +
  9628. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  9629. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  9630. +@@ -91,7 +91,6 @@ int ath_descdma_setup(struct ath_softc *
  9631. + #define ATH_RXBUF 512
  9632. + #define ATH_TXBUF 512
  9633. + #define ATH_TXBUF_RESERVE 5
  9634. +-#define ATH_MAX_QDEPTH (ATH_TXBUF / 4 - ATH_TXBUF_RESERVE)
  9635. + #define ATH_TXMAXTRY 13
  9636. + #define ATH_MAX_SW_RETRIES 30
  9637. +
  9638. +@@ -145,7 +144,7 @@ int ath_descdma_setup(struct ath_softc *
  9639. + #define BAW_WITHIN(_start, _bawsz, _seqno) \
  9640. + ((((_seqno) - (_start)) & 4095) < (_bawsz))
  9641. +
  9642. +-#define ATH_AN_2_TID(_an, _tidno) (&(_an)->tid[(_tidno)])
  9643. ++#define ATH_AN_2_TID(_an, _tidno) ath_node_to_tid(_an, _tidno)
  9644. +
  9645. + #define IS_HT_RATE(rate) (rate & 0x80)
  9646. + #define IS_CCK_RATE(rate) ((rate >= 0x18) && (rate <= 0x1e))
  9647. +@@ -164,7 +163,6 @@ struct ath_txq {
  9648. + spinlock_t axq_lock;
  9649. + u32 axq_depth;
  9650. + u32 axq_ampdu_depth;
  9651. +- bool stopped;
  9652. + bool axq_tx_inprogress;
  9653. + struct list_head txq_fifo[ATH_TXFIFO_DEPTH];
  9654. + u8 txq_headidx;
  9655. +@@ -232,7 +230,6 @@ struct ath_buf {
  9656. +
  9657. + struct ath_atx_tid {
  9658. + struct list_head list;
  9659. +- struct sk_buff_head buf_q;
  9660. + struct sk_buff_head retry_q;
  9661. + struct ath_node *an;
  9662. + struct ath_txq *txq;
  9663. +@@ -247,13 +244,13 @@ struct ath_atx_tid {
  9664. + s8 bar_index;
  9665. + bool active;
  9666. + bool clear_ps_filter;
  9667. ++ bool has_queued;
  9668. + };
  9669. +
  9670. + struct ath_node {
  9671. + struct ath_softc *sc;
  9672. + struct ieee80211_sta *sta; /* station struct we're part of */
  9673. + struct ieee80211_vif *vif; /* interface with which we're associated */
  9674. +- struct ath_atx_tid tid[IEEE80211_NUM_TIDS];
  9675. +
  9676. + u16 maxampdu;
  9677. + u8 mpdudensity;
  9678. +@@ -276,7 +273,6 @@ struct ath_tx_control {
  9679. + struct ath_node *an;
  9680. + struct ieee80211_sta *sta;
  9681. + u8 paprd;
  9682. +- bool force_channel;
  9683. + };
  9684. +
  9685. +
  9686. +@@ -293,7 +289,6 @@ struct ath_tx {
  9687. + struct ath_descdma txdma;
  9688. + struct ath_txq *txq_map[IEEE80211_NUM_ACS];
  9689. + struct ath_txq *uapsdq;
  9690. +- u32 txq_max_pending[IEEE80211_NUM_ACS];
  9691. + u16 max_aggr_framelen[IEEE80211_NUM_ACS][4][32];
  9692. + };
  9693. +
  9694. +@@ -421,6 +416,22 @@ struct ath_offchannel {
  9695. + int duration;
  9696. + };
  9697. +
  9698. ++static inline struct ath_atx_tid *
  9699. ++ath_node_to_tid(struct ath_node *an, u8 tidno)
  9700. ++{
  9701. ++ struct ieee80211_sta *sta = an->sta;
  9702. ++ struct ieee80211_vif *vif = an->vif;
  9703. ++ struct ieee80211_txq *txq;
  9704. ++
  9705. ++ BUG_ON(!vif);
  9706. ++ if (sta)
  9707. ++ txq = sta->txq[tidno % ARRAY_SIZE(sta->txq)];
  9708. ++ else
  9709. ++ txq = vif->txq;
  9710. ++
  9711. ++ return (struct ath_atx_tid *) txq->drv_priv;
  9712. ++}
  9713. ++
  9714. + #define case_rtn_string(val) case val: return #val
  9715. +
  9716. + #define ath_for_each_chanctx(_sc, _ctx) \
  9717. +@@ -575,7 +586,6 @@ void ath_tx_edma_tasklet(struct ath_soft
  9718. + int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
  9719. + u16 tid, u16 *ssn);
  9720. + void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid);
  9721. +-void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid);
  9722. +
  9723. + void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an);
  9724. + void ath_tx_aggr_sleep(struct ieee80211_sta *sta, struct ath_softc *sc,
  9725. +@@ -585,6 +595,7 @@ void ath9k_release_buffered_frames(struc
  9726. + u16 tids, int nframes,
  9727. + enum ieee80211_frame_release_type reason,
  9728. + bool more_data);
  9729. ++void ath9k_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *queue);
  9730. +
  9731. + /********/
  9732. + /* VIFs */
  9733. +--- a/drivers/net/wireless/ath/ath9k/channel.c
  9734. ++++ b/drivers/net/wireless/ath/ath9k/channel.c
  9735. +@@ -1007,7 +1007,6 @@ static void ath_scan_send_probe(struct a
  9736. + goto error;
  9737. +
  9738. + txctl.txq = sc->tx.txq_map[IEEE80211_AC_VO];
  9739. +- txctl.force_channel = true;
  9740. + if (ath_tx_start(sc->hw, skb, &txctl))
  9741. + goto error;
  9742. +
  9743. +@@ -1130,7 +1129,6 @@ ath_chanctx_send_vif_ps_frame(struct ath
  9744. + memset(&txctl, 0, sizeof(txctl));
  9745. + txctl.txq = sc->tx.txq_map[IEEE80211_AC_VO];
  9746. + txctl.sta = sta;
  9747. +- txctl.force_channel = true;
  9748. + if (ath_tx_start(sc->hw, skb, &txctl)) {
  9749. + ieee80211_free_txskb(sc->hw, skb);
  9750. + return false;
  9751. +--- a/drivers/net/wireless/ath/ath9k/debug.c
  9752. ++++ b/drivers/net/wireless/ath/ath9k/debug.c
  9753. +@@ -600,7 +600,6 @@ static int read_file_xmit(struct seq_fil
  9754. + PR("MPDUs XRetried: ", xretries);
  9755. + PR("Aggregates: ", a_aggr);
  9756. + PR("AMPDUs Queued HW:", a_queued_hw);
  9757. +- PR("AMPDUs Queued SW:", a_queued_sw);
  9758. + PR("AMPDUs Completed:", a_completed);
  9759. + PR("AMPDUs Retried: ", a_retries);
  9760. + PR("AMPDUs XRetried: ", a_xretries);
  9761. +@@ -629,8 +628,7 @@ static void print_queue(struct ath_softc
  9762. + seq_printf(file, "%s: %d ", "qnum", txq->axq_qnum);
  9763. + seq_printf(file, "%s: %2d ", "qdepth", txq->axq_depth);
  9764. + seq_printf(file, "%s: %2d ", "ampdu-depth", txq->axq_ampdu_depth);
  9765. +- seq_printf(file, "%s: %3d ", "pending", txq->pending_frames);
  9766. +- seq_printf(file, "%s: %d\n", "stopped", txq->stopped);
  9767. ++ seq_printf(file, "%s: %3d\n", "pending", txq->pending_frames);
  9768. +
  9769. + ath_txq_unlock(sc, txq);
  9770. + }
  9771. +@@ -1208,7 +1206,6 @@ static const char ath9k_gstrings_stats[]
  9772. + AMKSTR(d_tx_mpdu_xretries),
  9773. + AMKSTR(d_tx_aggregates),
  9774. + AMKSTR(d_tx_ampdus_queued_hw),
  9775. +- AMKSTR(d_tx_ampdus_queued_sw),
  9776. + AMKSTR(d_tx_ampdus_completed),
  9777. + AMKSTR(d_tx_ampdu_retries),
  9778. + AMKSTR(d_tx_ampdu_xretries),
  9779. +@@ -1288,7 +1285,6 @@ void ath9k_get_et_stats(struct ieee80211
  9780. + AWDATA(xretries);
  9781. + AWDATA(a_aggr);
  9782. + AWDATA(a_queued_hw);
  9783. +- AWDATA(a_queued_sw);
  9784. + AWDATA(a_completed);
  9785. + AWDATA(a_retries);
  9786. + AWDATA(a_xretries);
  9787. +@@ -1346,14 +1342,6 @@ int ath9k_init_debug(struct ath_hw *ah)
  9788. + read_file_xmit);
  9789. + debugfs_create_devm_seqfile(sc->dev, "queues", sc->debug.debugfs_phy,
  9790. + read_file_queues);
  9791. +- debugfs_create_u32("qlen_bk", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
  9792. +- &sc->tx.txq_max_pending[IEEE80211_AC_BK]);
  9793. +- debugfs_create_u32("qlen_be", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
  9794. +- &sc->tx.txq_max_pending[IEEE80211_AC_BE]);
  9795. +- debugfs_create_u32("qlen_vi", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
  9796. +- &sc->tx.txq_max_pending[IEEE80211_AC_VI]);
  9797. +- debugfs_create_u32("qlen_vo", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
  9798. +- &sc->tx.txq_max_pending[IEEE80211_AC_VO]);
  9799. + debugfs_create_devm_seqfile(sc->dev, "misc", sc->debug.debugfs_phy,
  9800. + read_file_misc);
  9801. + debugfs_create_devm_seqfile(sc->dev, "reset", sc->debug.debugfs_phy,
  9802. +--- a/drivers/net/wireless/ath/ath9k/debug.h
  9803. ++++ b/drivers/net/wireless/ath/ath9k/debug.h
  9804. +@@ -147,7 +147,6 @@ struct ath_interrupt_stats {
  9805. + * @completed: Total MPDUs (non-aggr) completed
  9806. + * @a_aggr: Total no. of aggregates queued
  9807. + * @a_queued_hw: Total AMPDUs queued to hardware
  9808. +- * @a_queued_sw: Total AMPDUs queued to software queues
  9809. + * @a_completed: Total AMPDUs completed
  9810. + * @a_retries: No. of AMPDUs retried (SW)
  9811. + * @a_xretries: No. of AMPDUs dropped due to xretries
  9812. +@@ -174,7 +173,6 @@ struct ath_tx_stats {
  9813. + u32 xretries;
  9814. + u32 a_aggr;
  9815. + u32 a_queued_hw;
  9816. +- u32 a_queued_sw;
  9817. + u32 a_completed;
  9818. + u32 a_retries;
  9819. + u32 a_xretries;
  9820. +--- a/drivers/net/wireless/ath/ath9k/debug_sta.c
  9821. ++++ b/drivers/net/wireless/ath/ath9k/debug_sta.c
  9822. +@@ -52,8 +52,8 @@ static ssize_t read_file_node_aggr(struc
  9823. + "TID", "SEQ_START", "SEQ_NEXT", "BAW_SIZE",
  9824. + "BAW_HEAD", "BAW_TAIL", "BAR_IDX", "SCHED", "PAUSED");
  9825. +
  9826. +- for (tidno = 0, tid = &an->tid[tidno];
  9827. +- tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
  9828. ++ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) {
  9829. ++ tid = ath_node_to_tid(an, tidno);
  9830. + txq = tid->txq;
  9831. + ath_txq_lock(sc, txq);
  9832. + if (tid->active) {
  9833. +--- a/drivers/net/wireless/ath/ath9k/init.c
  9834. ++++ b/drivers/net/wireless/ath/ath9k/init.c
  9835. +@@ -358,7 +358,6 @@ static int ath9k_init_queues(struct ath_
  9836. + for (i = 0; i < IEEE80211_NUM_ACS; i++) {
  9837. + sc->tx.txq_map[i] = ath_txq_setup(sc, ATH9K_TX_QUEUE_DATA, i);
  9838. + sc->tx.txq_map[i]->mac80211_qnum = i;
  9839. +- sc->tx.txq_max_pending[i] = ATH_MAX_QDEPTH;
  9840. + }
  9841. + return 0;
  9842. + }
  9843. +@@ -873,6 +872,7 @@ static void ath9k_set_hw_capab(struct at
  9844. + hw->max_rate_tries = 10;
  9845. + hw->sta_data_size = sizeof(struct ath_node);
  9846. + hw->vif_data_size = sizeof(struct ath_vif);
  9847. ++ hw->txq_data_size = sizeof(struct ath_atx_tid);
  9848. + hw->extra_tx_headroom = 4;
  9849. +
  9850. + hw->wiphy->available_antennas_rx = BIT(ah->caps.max_rxchains) - 1;
  9851. +--- a/drivers/net/wireless/ath/ath9k/main.c
  9852. ++++ b/drivers/net/wireless/ath/ath9k/main.c
  9853. +@@ -1897,9 +1897,11 @@ static int ath9k_ampdu_action(struct iee
  9854. + bool flush = false;
  9855. + int ret = 0;
  9856. + struct ieee80211_sta *sta = params->sta;
  9857. ++ struct ath_node *an = (struct ath_node *)sta->drv_priv;
  9858. + enum ieee80211_ampdu_mlme_action action = params->action;
  9859. + u16 tid = params->tid;
  9860. + u16 *ssn = &params->ssn;
  9861. ++ struct ath_atx_tid *atid;
  9862. +
  9863. + mutex_lock(&sc->mutex);
  9864. +
  9865. +@@ -1932,9 +1934,9 @@ static int ath9k_ampdu_action(struct iee
  9866. + ath9k_ps_restore(sc);
  9867. + break;
  9868. + case IEEE80211_AMPDU_TX_OPERATIONAL:
  9869. +- ath9k_ps_wakeup(sc);
  9870. +- ath_tx_aggr_resume(sc, sta, tid);
  9871. +- ath9k_ps_restore(sc);
  9872. ++ atid = ath_node_to_tid(an, tid);
  9873. ++ atid->baw_size = IEEE80211_MIN_AMPDU_BUF <<
  9874. ++ sta->ht_cap.ampdu_factor;
  9875. + break;
  9876. + default:
  9877. + ath_err(ath9k_hw_common(sc->sc_ah), "Unknown AMPDU action\n");
  9878. +@@ -2696,4 +2698,5 @@ struct ieee80211_ops ath9k_ops = {
  9879. + .sw_scan_start = ath9k_sw_scan_start,
  9880. + .sw_scan_complete = ath9k_sw_scan_complete,
  9881. + .get_txpower = ath9k_get_txpower,
  9882. ++ .wake_tx_queue = ath9k_wake_tx_queue,
  9883. + };
  9884. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  9885. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  9886. +@@ -67,6 +67,8 @@ static struct ath_buf *ath_tx_setup_buff
  9887. + struct ath_txq *txq,
  9888. + struct ath_atx_tid *tid,
  9889. + struct sk_buff *skb);
  9890. ++static int ath_tx_prepare(struct ieee80211_hw *hw, struct sk_buff *skb,
  9891. ++ struct ath_tx_control *txctl);
  9892. +
  9893. + enum {
  9894. + MCS_HT20,
  9895. +@@ -137,6 +139,26 @@ static void ath_tx_queue_tid(struct ath_
  9896. + list_add_tail(&tid->list, list);
  9897. + }
  9898. +
  9899. ++void ath9k_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *queue)
  9900. ++{
  9901. ++ struct ath_softc *sc = hw->priv;
  9902. ++ struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  9903. ++ struct ath_atx_tid *tid = (struct ath_atx_tid *) queue->drv_priv;
  9904. ++ struct ath_txq *txq = tid->txq;
  9905. ++
  9906. ++ ath_dbg(common, QUEUE, "Waking TX queue: %pM (%d)\n",
  9907. ++ queue->sta ? queue->sta->addr : queue->vif->addr,
  9908. ++ tid->tidno);
  9909. ++
  9910. ++ ath_txq_lock(sc, txq);
  9911. ++
  9912. ++ tid->has_queued = true;
  9913. ++ ath_tx_queue_tid(sc, txq, tid);
  9914. ++ ath_txq_schedule(sc, txq);
  9915. ++
  9916. ++ ath_txq_unlock(sc, txq);
  9917. ++}
  9918. ++
  9919. + static struct ath_frame_info *get_frame_info(struct sk_buff *skb)
  9920. + {
  9921. + struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
  9922. +@@ -179,7 +201,6 @@ static void ath_set_rates(struct ieee802
  9923. + static void ath_txq_skb_done(struct ath_softc *sc, struct ath_txq *txq,
  9924. + struct sk_buff *skb)
  9925. + {
  9926. +- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  9927. + struct ath_frame_info *fi = get_frame_info(skb);
  9928. + int q = fi->txq;
  9929. +
  9930. +@@ -190,14 +211,6 @@ static void ath_txq_skb_done(struct ath_
  9931. + if (WARN_ON(--txq->pending_frames < 0))
  9932. + txq->pending_frames = 0;
  9933. +
  9934. +- if (txq->stopped &&
  9935. +- txq->pending_frames < sc->tx.txq_max_pending[q]) {
  9936. +- if (ath9k_is_chanctx_enabled())
  9937. +- ieee80211_wake_queue(sc->hw, info->hw_queue);
  9938. +- else
  9939. +- ieee80211_wake_queue(sc->hw, q);
  9940. +- txq->stopped = false;
  9941. +- }
  9942. + }
  9943. +
  9944. + static struct ath_atx_tid *
  9945. +@@ -207,9 +220,48 @@ ath_get_skb_tid(struct ath_softc *sc, st
  9946. + return ATH_AN_2_TID(an, tidno);
  9947. + }
  9948. +
  9949. ++static struct sk_buff *
  9950. ++ath_tid_pull(struct ath_atx_tid *tid)
  9951. ++{
  9952. ++ struct ieee80211_txq *txq = container_of((void*)tid, struct ieee80211_txq, drv_priv);
  9953. ++ struct ath_softc *sc = tid->an->sc;
  9954. ++ struct ieee80211_hw *hw = sc->hw;
  9955. ++ struct ath_tx_control txctl = {
  9956. ++ .txq = tid->txq,
  9957. ++ .sta = tid->an->sta,
  9958. ++ };
  9959. ++ struct sk_buff *skb;
  9960. ++ struct ath_frame_info *fi;
  9961. ++ int q;
  9962. ++
  9963. ++ if (!tid->has_queued)
  9964. ++ return NULL;
  9965. ++
  9966. ++ skb = ieee80211_tx_dequeue(hw, txq);
  9967. ++ if (!skb) {
  9968. ++ tid->has_queued = false;
  9969. ++ return NULL;
  9970. ++ }
  9971. ++
  9972. ++ if (ath_tx_prepare(hw, skb, &txctl)) {
  9973. ++ ieee80211_free_txskb(hw, skb);
  9974. ++ return NULL;
  9975. ++ }
  9976. ++
  9977. ++ q = skb_get_queue_mapping(skb);
  9978. ++ if (tid->txq == sc->tx.txq_map[q]) {
  9979. ++ fi = get_frame_info(skb);
  9980. ++ fi->txq = q;
  9981. ++ ++tid->txq->pending_frames;
  9982. ++ }
  9983. ++
  9984. ++ return skb;
  9985. ++ }
  9986. ++
  9987. ++
  9988. + static bool ath_tid_has_buffered(struct ath_atx_tid *tid)
  9989. + {
  9990. +- return !skb_queue_empty(&tid->buf_q) || !skb_queue_empty(&tid->retry_q);
  9991. ++ return !skb_queue_empty(&tid->retry_q) || tid->has_queued;
  9992. + }
  9993. +
  9994. + static struct sk_buff *ath_tid_dequeue(struct ath_atx_tid *tid)
  9995. +@@ -218,46 +270,11 @@ static struct sk_buff *ath_tid_dequeue(s
  9996. +
  9997. + skb = __skb_dequeue(&tid->retry_q);
  9998. + if (!skb)
  9999. +- skb = __skb_dequeue(&tid->buf_q);
  10000. ++ skb = ath_tid_pull(tid);
  10001. +
  10002. + return skb;
  10003. + }
  10004. +
  10005. +-/*
  10006. +- * ath_tx_tid_change_state:
  10007. +- * - clears a-mpdu flag of previous session
  10008. +- * - force sequence number allocation to fix next BlockAck Window
  10009. +- */
  10010. +-static void
  10011. +-ath_tx_tid_change_state(struct ath_softc *sc, struct ath_atx_tid *tid)
  10012. +-{
  10013. +- struct ath_txq *txq = tid->txq;
  10014. +- struct ieee80211_tx_info *tx_info;
  10015. +- struct sk_buff *skb, *tskb;
  10016. +- struct ath_buf *bf;
  10017. +- struct ath_frame_info *fi;
  10018. +-
  10019. +- skb_queue_walk_safe(&tid->buf_q, skb, tskb) {
  10020. +- fi = get_frame_info(skb);
  10021. +- bf = fi->bf;
  10022. +-
  10023. +- tx_info = IEEE80211_SKB_CB(skb);
  10024. +- tx_info->flags &= ~IEEE80211_TX_CTL_AMPDU;
  10025. +-
  10026. +- if (bf)
  10027. +- continue;
  10028. +-
  10029. +- bf = ath_tx_setup_buffer(sc, txq, tid, skb);
  10030. +- if (!bf) {
  10031. +- __skb_unlink(skb, &tid->buf_q);
  10032. +- ath_txq_skb_done(sc, txq, skb);
  10033. +- ieee80211_free_txskb(sc->hw, skb);
  10034. +- continue;
  10035. +- }
  10036. +- }
  10037. +-
  10038. +-}
  10039. +-
  10040. + static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
  10041. + {
  10042. + struct ath_txq *txq = tid->txq;
  10043. +@@ -898,20 +915,16 @@ static int ath_compute_num_delims(struct
  10044. +
  10045. + static struct ath_buf *
  10046. + ath_tx_get_tid_subframe(struct ath_softc *sc, struct ath_txq *txq,
  10047. +- struct ath_atx_tid *tid, struct sk_buff_head **q)
  10048. ++ struct ath_atx_tid *tid)
  10049. + {
  10050. + struct ieee80211_tx_info *tx_info;
  10051. + struct ath_frame_info *fi;
  10052. +- struct sk_buff *skb;
  10053. ++ struct sk_buff *skb, *first_skb = NULL;
  10054. + struct ath_buf *bf;
  10055. + u16 seqno;
  10056. +
  10057. + while (1) {
  10058. +- *q = &tid->retry_q;
  10059. +- if (skb_queue_empty(*q))
  10060. +- *q = &tid->buf_q;
  10061. +-
  10062. +- skb = skb_peek(*q);
  10063. ++ skb = ath_tid_dequeue(tid);
  10064. + if (!skb)
  10065. + break;
  10066. +
  10067. +@@ -923,7 +936,6 @@ ath_tx_get_tid_subframe(struct ath_softc
  10068. + bf->bf_state.stale = false;
  10069. +
  10070. + if (!bf) {
  10071. +- __skb_unlink(skb, *q);
  10072. + ath_txq_skb_done(sc, txq, skb);
  10073. + ieee80211_free_txskb(sc->hw, skb);
  10074. + continue;
  10075. +@@ -952,8 +964,19 @@ ath_tx_get_tid_subframe(struct ath_softc
  10076. + seqno = bf->bf_state.seqno;
  10077. +
  10078. + /* do not step over block-ack window */
  10079. +- if (!BAW_WITHIN(tid->seq_start, tid->baw_size, seqno))
  10080. ++ if (!BAW_WITHIN(tid->seq_start, tid->baw_size, seqno)) {
  10081. ++ __skb_queue_tail(&tid->retry_q, skb);
  10082. ++
  10083. ++ /* If there are other skbs in the retry q, they are
  10084. ++ * probably within the BAW, so loop immediately to get
  10085. ++ * one of them. Otherwise the queue can get stuck. */
  10086. ++ if (!skb_queue_is_first(&tid->retry_q, skb) && skb != first_skb) {
  10087. ++ if(!first_skb) /* infinite loop prevention */
  10088. ++ first_skb = skb;
  10089. ++ continue;
  10090. ++ }
  10091. + break;
  10092. ++ }
  10093. +
  10094. + if (tid->bar_index > ATH_BA_INDEX(tid->seq_start, seqno)) {
  10095. + struct ath_tx_status ts = {};
  10096. +@@ -961,7 +984,6 @@ ath_tx_get_tid_subframe(struct ath_softc
  10097. +
  10098. + INIT_LIST_HEAD(&bf_head);
  10099. + list_add(&bf->list, &bf_head);
  10100. +- __skb_unlink(skb, *q);
  10101. + ath_tx_update_baw(sc, tid, seqno);
  10102. + ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0);
  10103. + continue;
  10104. +@@ -973,11 +995,10 @@ ath_tx_get_tid_subframe(struct ath_softc
  10105. + return NULL;
  10106. + }
  10107. +
  10108. +-static bool
  10109. ++static int
  10110. + ath_tx_form_aggr(struct ath_softc *sc, struct ath_txq *txq,
  10111. + struct ath_atx_tid *tid, struct list_head *bf_q,
  10112. +- struct ath_buf *bf_first, struct sk_buff_head *tid_q,
  10113. +- int *aggr_len)
  10114. ++ struct ath_buf *bf_first)
  10115. + {
  10116. + #define PADBYTES(_len) ((4 - ((_len) % 4)) % 4)
  10117. + struct ath_buf *bf = bf_first, *bf_prev = NULL;
  10118. +@@ -987,12 +1008,13 @@ ath_tx_form_aggr(struct ath_softc *sc, s
  10119. + struct ieee80211_tx_info *tx_info;
  10120. + struct ath_frame_info *fi;
  10121. + struct sk_buff *skb;
  10122. +- bool closed = false;
  10123. ++
  10124. +
  10125. + bf = bf_first;
  10126. + aggr_limit = ath_lookup_rate(sc, bf, tid);
  10127. +
  10128. +- do {
  10129. ++ while (bf)
  10130. ++ {
  10131. + skb = bf->bf_mpdu;
  10132. + fi = get_frame_info(skb);
  10133. +
  10134. +@@ -1001,12 +1023,12 @@ ath_tx_form_aggr(struct ath_softc *sc, s
  10135. + if (nframes) {
  10136. + if (aggr_limit < al + bpad + al_delta ||
  10137. + ath_lookup_legacy(bf) || nframes >= h_baw)
  10138. +- break;
  10139. ++ goto stop;
  10140. +
  10141. + tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
  10142. + if ((tx_info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) ||
  10143. + !(tx_info->flags & IEEE80211_TX_CTL_AMPDU))
  10144. +- break;
  10145. ++ goto stop;
  10146. + }
  10147. +
  10148. + /* add padding for previous frame to aggregation length */
  10149. +@@ -1028,20 +1050,18 @@ ath_tx_form_aggr(struct ath_softc *sc, s
  10150. + ath_tx_addto_baw(sc, tid, bf);
  10151. + bf->bf_state.ndelim = ndelim;
  10152. +
  10153. +- __skb_unlink(skb, tid_q);
  10154. + list_add_tail(&bf->list, bf_q);
  10155. + if (bf_prev)
  10156. + bf_prev->bf_next = bf;
  10157. +
  10158. + bf_prev = bf;
  10159. +
  10160. +- bf = ath_tx_get_tid_subframe(sc, txq, tid, &tid_q);
  10161. +- if (!bf) {
  10162. +- closed = true;
  10163. +- break;
  10164. +- }
  10165. +- } while (ath_tid_has_buffered(tid));
  10166. +-
  10167. ++ bf = ath_tx_get_tid_subframe(sc, txq, tid);
  10168. ++ }
  10169. ++ goto finish;
  10170. ++stop:
  10171. ++ __skb_queue_tail(&tid->retry_q, bf->bf_mpdu);
  10172. ++finish:
  10173. + bf = bf_first;
  10174. + bf->bf_lastbf = bf_prev;
  10175. +
  10176. +@@ -1052,9 +1072,7 @@ ath_tx_form_aggr(struct ath_softc *sc, s
  10177. + TX_STAT_INC(txq->axq_qnum, a_aggr);
  10178. + }
  10179. +
  10180. +- *aggr_len = al;
  10181. +-
  10182. +- return closed;
  10183. ++ return al;
  10184. + #undef PADBYTES
  10185. + }
  10186. +
  10187. +@@ -1431,18 +1449,15 @@ static void ath_tx_fill_desc(struct ath_
  10188. + static void
  10189. + ath_tx_form_burst(struct ath_softc *sc, struct ath_txq *txq,
  10190. + struct ath_atx_tid *tid, struct list_head *bf_q,
  10191. +- struct ath_buf *bf_first, struct sk_buff_head *tid_q)
  10192. ++ struct ath_buf *bf_first)
  10193. + {
  10194. + struct ath_buf *bf = bf_first, *bf_prev = NULL;
  10195. +- struct sk_buff *skb;
  10196. + int nframes = 0;
  10197. +
  10198. + do {
  10199. + struct ieee80211_tx_info *tx_info;
  10200. +- skb = bf->bf_mpdu;
  10201. +
  10202. + nframes++;
  10203. +- __skb_unlink(skb, tid_q);
  10204. + list_add_tail(&bf->list, bf_q);
  10205. + if (bf_prev)
  10206. + bf_prev->bf_next = bf;
  10207. +@@ -1451,13 +1466,15 @@ ath_tx_form_burst(struct ath_softc *sc,
  10208. + if (nframes >= 2)
  10209. + break;
  10210. +
  10211. +- bf = ath_tx_get_tid_subframe(sc, txq, tid, &tid_q);
  10212. ++ bf = ath_tx_get_tid_subframe(sc, txq, tid);
  10213. + if (!bf)
  10214. + break;
  10215. +
  10216. + tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
  10217. +- if (tx_info->flags & IEEE80211_TX_CTL_AMPDU)
  10218. ++ if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) {
  10219. ++ __skb_queue_tail(&tid->retry_q, bf->bf_mpdu);
  10220. + break;
  10221. ++ }
  10222. +
  10223. + ath_set_rates(tid->an->vif, tid->an->sta, bf, false);
  10224. + } while (1);
  10225. +@@ -1468,34 +1485,33 @@ static bool ath_tx_sched_aggr(struct ath
  10226. + {
  10227. + struct ath_buf *bf;
  10228. + struct ieee80211_tx_info *tx_info;
  10229. +- struct sk_buff_head *tid_q;
  10230. + struct list_head bf_q;
  10231. + int aggr_len = 0;
  10232. +- bool aggr, last = true;
  10233. ++ bool aggr;
  10234. +
  10235. + if (!ath_tid_has_buffered(tid))
  10236. + return false;
  10237. +
  10238. + INIT_LIST_HEAD(&bf_q);
  10239. +
  10240. +- bf = ath_tx_get_tid_subframe(sc, txq, tid, &tid_q);
  10241. ++ bf = ath_tx_get_tid_subframe(sc, txq, tid);
  10242. + if (!bf)
  10243. + return false;
  10244. +
  10245. + tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
  10246. + aggr = !!(tx_info->flags & IEEE80211_TX_CTL_AMPDU);
  10247. + if ((aggr && txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH) ||
  10248. +- (!aggr && txq->axq_depth >= ATH_NON_AGGR_MIN_QDEPTH)) {
  10249. ++ (!aggr && txq->axq_depth >= ATH_NON_AGGR_MIN_QDEPTH)) {
  10250. ++ __skb_queue_tail(&tid->retry_q, bf->bf_mpdu);
  10251. + *stop = true;
  10252. + return false;
  10253. + }
  10254. +
  10255. + ath_set_rates(tid->an->vif, tid->an->sta, bf, false);
  10256. + if (aggr)
  10257. +- last = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf,
  10258. +- tid_q, &aggr_len);
  10259. ++ aggr_len = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf);
  10260. + else
  10261. +- ath_tx_form_burst(sc, txq, tid, &bf_q, bf, tid_q);
  10262. ++ ath_tx_form_burst(sc, txq, tid, &bf_q, bf);
  10263. +
  10264. + if (list_empty(&bf_q))
  10265. + return false;
  10266. +@@ -1538,9 +1554,6 @@ int ath_tx_aggr_start(struct ath_softc *
  10267. + an->mpdudensity = density;
  10268. + }
  10269. +
  10270. +- /* force sequence number allocation for pending frames */
  10271. +- ath_tx_tid_change_state(sc, txtid);
  10272. +-
  10273. + txtid->active = true;
  10274. + *ssn = txtid->seq_start = txtid->seq_next;
  10275. + txtid->bar_index = -1;
  10276. +@@ -1565,7 +1578,6 @@ void ath_tx_aggr_stop(struct ath_softc *
  10277. + ath_txq_lock(sc, txq);
  10278. + txtid->active = false;
  10279. + ath_tx_flush_tid(sc, txtid);
  10280. +- ath_tx_tid_change_state(sc, txtid);
  10281. + ath_txq_unlock_complete(sc, txq);
  10282. + }
  10283. +
  10284. +@@ -1575,14 +1587,12 @@ void ath_tx_aggr_sleep(struct ieee80211_
  10285. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  10286. + struct ath_atx_tid *tid;
  10287. + struct ath_txq *txq;
  10288. +- bool buffered;
  10289. + int tidno;
  10290. +
  10291. + ath_dbg(common, XMIT, "%s called\n", __func__);
  10292. +
  10293. +- for (tidno = 0, tid = &an->tid[tidno];
  10294. +- tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
  10295. +-
  10296. ++ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) {
  10297. ++ tid = ath_node_to_tid(an, tidno);
  10298. + txq = tid->txq;
  10299. +
  10300. + ath_txq_lock(sc, txq);
  10301. +@@ -1592,13 +1602,12 @@ void ath_tx_aggr_sleep(struct ieee80211_
  10302. + continue;
  10303. + }
  10304. +
  10305. +- buffered = ath_tid_has_buffered(tid);
  10306. ++ if (!skb_queue_empty(&tid->retry_q))
  10307. ++ ieee80211_sta_set_buffered(sta, tid->tidno, true);
  10308. +
  10309. + list_del_init(&tid->list);
  10310. +
  10311. + ath_txq_unlock(sc, txq);
  10312. +-
  10313. +- ieee80211_sta_set_buffered(sta, tidno, buffered);
  10314. + }
  10315. + }
  10316. +
  10317. +@@ -1611,49 +1620,20 @@ void ath_tx_aggr_wakeup(struct ath_softc
  10318. +
  10319. + ath_dbg(common, XMIT, "%s called\n", __func__);
  10320. +
  10321. +- for (tidno = 0, tid = &an->tid[tidno];
  10322. +- tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
  10323. +-
  10324. ++ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) {
  10325. ++ tid = ath_node_to_tid(an, tidno);
  10326. + txq = tid->txq;
  10327. +
  10328. + ath_txq_lock(sc, txq);
  10329. + tid->clear_ps_filter = true;
  10330. +-
  10331. + if (ath_tid_has_buffered(tid)) {
  10332. + ath_tx_queue_tid(sc, txq, tid);
  10333. + ath_txq_schedule(sc, txq);
  10334. + }
  10335. +-
  10336. + ath_txq_unlock_complete(sc, txq);
  10337. + }
  10338. + }
  10339. +
  10340. +-void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta,
  10341. +- u16 tidno)
  10342. +-{
  10343. +- struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  10344. +- struct ath_atx_tid *tid;
  10345. +- struct ath_node *an;
  10346. +- struct ath_txq *txq;
  10347. +-
  10348. +- ath_dbg(common, XMIT, "%s called\n", __func__);
  10349. +-
  10350. +- an = (struct ath_node *)sta->drv_priv;
  10351. +- tid = ATH_AN_2_TID(an, tidno);
  10352. +- txq = tid->txq;
  10353. +-
  10354. +- ath_txq_lock(sc, txq);
  10355. +-
  10356. +- tid->baw_size = IEEE80211_MIN_AMPDU_BUF << sta->ht_cap.ampdu_factor;
  10357. +-
  10358. +- if (ath_tid_has_buffered(tid)) {
  10359. +- ath_tx_queue_tid(sc, txq, tid);
  10360. +- ath_txq_schedule(sc, txq);
  10361. +- }
  10362. +-
  10363. +- ath_txq_unlock_complete(sc, txq);
  10364. +-}
  10365. +-
  10366. + void ath9k_release_buffered_frames(struct ieee80211_hw *hw,
  10367. + struct ieee80211_sta *sta,
  10368. + u16 tids, int nframes,
  10369. +@@ -1666,7 +1646,6 @@ void ath9k_release_buffered_frames(struc
  10370. + struct ieee80211_tx_info *info;
  10371. + struct list_head bf_q;
  10372. + struct ath_buf *bf_tail = NULL, *bf;
  10373. +- struct sk_buff_head *tid_q;
  10374. + int sent = 0;
  10375. + int i;
  10376. +
  10377. +@@ -1681,11 +1660,10 @@ void ath9k_release_buffered_frames(struc
  10378. +
  10379. + ath_txq_lock(sc, tid->txq);
  10380. + while (nframes > 0) {
  10381. +- bf = ath_tx_get_tid_subframe(sc, sc->tx.uapsdq, tid, &tid_q);
  10382. ++ bf = ath_tx_get_tid_subframe(sc, sc->tx.uapsdq, tid);
  10383. + if (!bf)
  10384. + break;
  10385. +
  10386. +- __skb_unlink(bf->bf_mpdu, tid_q);
  10387. + list_add_tail(&bf->list, &bf_q);
  10388. + ath_set_rates(tid->an->vif, tid->an->sta, bf, true);
  10389. + if (bf_isampdu(bf)) {
  10390. +@@ -1700,7 +1678,7 @@ void ath9k_release_buffered_frames(struc
  10391. + sent++;
  10392. + TX_STAT_INC(txq->axq_qnum, a_queued_hw);
  10393. +
  10394. +- if (an->sta && !ath_tid_has_buffered(tid))
  10395. ++ if (an->sta && skb_queue_empty(&tid->retry_q))
  10396. + ieee80211_sta_set_buffered(an->sta, i, false);
  10397. + }
  10398. + ath_txq_unlock_complete(sc, tid->txq);
  10399. +@@ -1929,13 +1907,7 @@ bool ath_drain_all_txq(struct ath_softc
  10400. + if (!ATH_TXQ_SETUP(sc, i))
  10401. + continue;
  10402. +
  10403. +- /*
  10404. +- * The caller will resume queues with ieee80211_wake_queues.
  10405. +- * Mark the queue as not stopped to prevent ath_tx_complete
  10406. +- * from waking the queue too early.
  10407. +- */
  10408. + txq = &sc->tx.txq[i];
  10409. +- txq->stopped = false;
  10410. + ath_draintxq(sc, txq);
  10411. + }
  10412. +
  10413. +@@ -2334,16 +2306,14 @@ int ath_tx_start(struct ieee80211_hw *hw
  10414. + struct ath_softc *sc = hw->priv;
  10415. + struct ath_txq *txq = txctl->txq;
  10416. + struct ath_atx_tid *tid = NULL;
  10417. ++ struct ath_node *an = NULL;
  10418. + struct ath_buf *bf;
  10419. +- bool queue, ps_resp;
  10420. ++ bool ps_resp;
  10421. + int q, ret;
  10422. +
  10423. + if (vif)
  10424. + avp = (void *)vif->drv_priv;
  10425. +
  10426. +- if (info->flags & IEEE80211_TX_CTL_TX_OFFCHAN)
  10427. +- txctl->force_channel = true;
  10428. +-
  10429. + ps_resp = !!(info->control.flags & IEEE80211_TX_CTRL_PS_RESPONSE);
  10430. +
  10431. + ret = ath_tx_prepare(hw, skb, txctl);
  10432. +@@ -2358,63 +2328,18 @@ int ath_tx_start(struct ieee80211_hw *hw
  10433. +
  10434. + q = skb_get_queue_mapping(skb);
  10435. +
  10436. +- ath_txq_lock(sc, txq);
  10437. +- if (txq == sc->tx.txq_map[q]) {
  10438. +- fi->txq = q;
  10439. +- if (++txq->pending_frames > sc->tx.txq_max_pending[q] &&
  10440. +- !txq->stopped) {
  10441. +- if (ath9k_is_chanctx_enabled())
  10442. +- ieee80211_stop_queue(sc->hw, info->hw_queue);
  10443. +- else
  10444. +- ieee80211_stop_queue(sc->hw, q);
  10445. +- txq->stopped = true;
  10446. +- }
  10447. +- }
  10448. +-
  10449. +- queue = ieee80211_is_data_present(hdr->frame_control);
  10450. +-
  10451. +- /* If chanctx, queue all null frames while NOA could be there */
  10452. +- if (ath9k_is_chanctx_enabled() &&
  10453. +- ieee80211_is_nullfunc(hdr->frame_control) &&
  10454. +- !txctl->force_channel)
  10455. +- queue = true;
  10456. +-
  10457. +- /* Force queueing of all frames that belong to a virtual interface on
  10458. +- * a different channel context, to ensure that they are sent on the
  10459. +- * correct channel.
  10460. +- */
  10461. +- if (((avp && avp->chanctx != sc->cur_chan) ||
  10462. +- sc->cur_chan->stopped) && !txctl->force_channel) {
  10463. +- if (!txctl->an)
  10464. +- txctl->an = &avp->mcast_node;
  10465. +- queue = true;
  10466. +- ps_resp = false;
  10467. +- }
  10468. +-
  10469. +- if (txctl->an && queue)
  10470. +- tid = ath_get_skb_tid(sc, txctl->an, skb);
  10471. +-
  10472. +- if (ps_resp) {
  10473. +- ath_txq_unlock(sc, txq);
  10474. ++ if (ps_resp)
  10475. + txq = sc->tx.uapsdq;
  10476. +- ath_txq_lock(sc, txq);
  10477. +- } else if (txctl->an && queue) {
  10478. +- WARN_ON(tid->txq != txctl->txq);
  10479. +-
  10480. +- if (info->flags & IEEE80211_TX_CTL_CLEAR_PS_FILT)
  10481. +- tid->clear_ps_filter = true;
  10482. +
  10483. +- /*
  10484. +- * Add this frame to software queue for scheduling later
  10485. +- * for aggregation.
  10486. +- */
  10487. +- TX_STAT_INC(txq->axq_qnum, a_queued_sw);
  10488. +- __skb_queue_tail(&tid->buf_q, skb);
  10489. +- if (!txctl->an->sleeping)
  10490. +- ath_tx_queue_tid(sc, txq, tid);
  10491. ++ if (txctl->sta) {
  10492. ++ an = (struct ath_node *) sta->drv_priv;
  10493. ++ tid = ath_get_skb_tid(sc, an, skb);
  10494. ++ }
  10495. +
  10496. +- ath_txq_schedule(sc, txq);
  10497. +- goto out;
  10498. ++ ath_txq_lock(sc, txq);
  10499. ++ if (txq == sc->tx.txq_map[q]) {
  10500. ++ fi->txq = q;
  10501. ++ ++txq->pending_frames;
  10502. + }
  10503. +
  10504. + bf = ath_tx_setup_buffer(sc, txq, tid, skb);
  10505. +@@ -2907,9 +2832,8 @@ void ath_tx_node_init(struct ath_softc *
  10506. + struct ath_atx_tid *tid;
  10507. + int tidno, acno;
  10508. +
  10509. +- for (tidno = 0, tid = &an->tid[tidno];
  10510. +- tidno < IEEE80211_NUM_TIDS;
  10511. +- tidno++, tid++) {
  10512. ++ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) {
  10513. ++ tid = ath_node_to_tid(an, tidno);
  10514. + tid->an = an;
  10515. + tid->tidno = tidno;
  10516. + tid->seq_start = tid->seq_next = 0;
  10517. +@@ -2917,11 +2841,14 @@ void ath_tx_node_init(struct ath_softc *
  10518. + tid->baw_head = tid->baw_tail = 0;
  10519. + tid->active = false;
  10520. + tid->clear_ps_filter = true;
  10521. +- __skb_queue_head_init(&tid->buf_q);
  10522. ++ tid->has_queued = false;
  10523. + __skb_queue_head_init(&tid->retry_q);
  10524. + INIT_LIST_HEAD(&tid->list);
  10525. + acno = TID_TO_WME_AC(tidno);
  10526. + tid->txq = sc->tx.txq_map[acno];
  10527. ++
  10528. ++ if (!an->sta)
  10529. ++ break; /* just one multicast ath_atx_tid */
  10530. + }
  10531. + }
  10532. +
  10533. +@@ -2931,9 +2858,8 @@ void ath_tx_node_cleanup(struct ath_soft
  10534. + struct ath_txq *txq;
  10535. + int tidno;
  10536. +
  10537. +- for (tidno = 0, tid = &an->tid[tidno];
  10538. +- tidno < IEEE80211_NUM_TIDS; tidno++, tid++) {
  10539. +-
  10540. ++ for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) {
  10541. ++ tid = ath_node_to_tid(an, tidno);
  10542. + txq = tid->txq;
  10543. +
  10544. + ath_txq_lock(sc, txq);
  10545. +@@ -2945,6 +2871,9 @@ void ath_tx_node_cleanup(struct ath_soft
  10546. + tid->active = false;
  10547. +
  10548. + ath_txq_unlock(sc, txq);
  10549. ++
  10550. ++ if (!an->sta)
  10551. ++ break; /* just one multicast ath_atx_tid */
  10552. + }
  10553. + }
  10554. +
  10555. 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
  10556. deleted file mode 100644
  10557. index 229351b..0000000
  10558. --- a/package/kernel/mac80211/patches/337-mac80211-minstrel_ht-fix-a-logic-error-in-RTS-CTS-ha.patch
  10559. +++ /dev/null
  10560. @@ -1,26 +0,0 @@
  10561. -From: Felix Fietkau <nbd@openwrt.org>
  10562. -Date: Wed, 24 Feb 2016 12:03:13 +0100
  10563. -Subject: [PATCH] mac80211: minstrel_ht: fix a logic error in RTS/CTS handling
  10564. -MIME-Version: 1.0
  10565. -Content-Type: text/plain; charset=UTF-8
  10566. -Content-Transfer-Encoding: 8bit
  10567. -
  10568. -RTS/CTS needs to be enabled if the rate is a fallback rate *or* if it's
  10569. -a dual-stream rate and the sta is in dynamic SMPS mode.
  10570. -
  10571. -Fixes: a3ebb4e1b763 ("mac80211: minstrel_ht: handle peers in dynamic SMPS")
  10572. -Reported-by: Matías Richart <mrichart@fing.edu.uy>
  10573. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  10574. ----
  10575. -
  10576. ---- a/net/mac80211/rc80211_minstrel_ht.c
  10577. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  10578. -@@ -872,7 +872,7 @@ minstrel_ht_set_rate(struct minstrel_pri
  10579. - * - if station is in dynamic SMPS (and streams > 1)
  10580. - * - for fallback rates, to increase chances of getting through
  10581. - */
  10582. -- if (offset > 0 &&
  10583. -+ if (offset > 0 ||
  10584. - (mi->sta->smps_mode == IEEE80211_SMPS_DYNAMIC &&
  10585. - group->streams > 1)) {
  10586. - ratetbl->rate[offset].count = ratetbl->rate[offset].count_rts;
  10587. 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
  10588. deleted file mode 100644
  10589. index 56cd94a..0000000
  10590. --- a/package/kernel/mac80211/patches/338-mac80211-Fix-Public-Action-frame-RX-in-AP-mode.patch
  10591. +++ /dev/null
  10592. @@ -1,35 +0,0 @@
  10593. -From: Jouni Malinen <jouni@qca.qualcomm.com>
  10594. -Date: Tue, 1 Mar 2016 00:29:00 +0200
  10595. -Subject: [PATCH] mac80211: Fix Public Action frame RX in AP mode
  10596. -
  10597. -Public Action frames use special rules for how the BSSID field (Address
  10598. -3) is set. A wildcard BSSID is used in cases where the transmitter and
  10599. -recipient are not members of the same BSS. As such, we need to accept
  10600. -Public Action frames with wildcard BSSID.
  10601. -
  10602. -Commit db8e17324553 ("mac80211: ignore frames between TDLS peers when
  10603. -operating as AP") added a rule that drops Action frames to TDLS-peers
  10604. -based on an Action frame having different DA (Address 1) and BSSID
  10605. -(Address 3) values. This is not correct since it misses the possibility
  10606. -of BSSID being a wildcard BSSID in which case the Address 1 would not
  10607. -necessarily match.
  10608. -
  10609. -Fix this by allowing mac80211 to accept wildcard BSSID in an Action
  10610. -frame when in AP mode.
  10611. -
  10612. -Fixes: db8e17324553 ("mac80211: ignore frames between TDLS peers when operating as AP")
  10613. -Cc: stable@vger.kernel.org
  10614. -Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
  10615. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  10616. ----
  10617. -
  10618. ---- a/net/mac80211/rx.c
  10619. -+++ b/net/mac80211/rx.c
  10620. -@@ -3374,6 +3374,7 @@ static bool ieee80211_accept_frame(struc
  10621. - return false;
  10622. - /* ignore action frames to TDLS-peers */
  10623. - if (ieee80211_is_action(hdr->frame_control) &&
  10624. -+ !is_broadcast_ether_addr(bssid) &&
  10625. - !ether_addr_equal(bssid, hdr->addr1))
  10626. - return false;
  10627. - }
  10628. diff --git a/package/kernel/mac80211/patches/338-mac80211-fix-tim-recalculation-after-PS-response.patch b/package/kernel/mac80211/patches/338-mac80211-fix-tim-recalculation-after-PS-response.patch
  10629. new file mode 100644
  10630. index 0000000..6c0852e
  10631. --- /dev/null
  10632. +++ b/package/kernel/mac80211/patches/338-mac80211-fix-tim-recalculation-after-PS-response.patch
  10633. @@ -0,0 +1,31 @@
  10634. +From: Felix Fietkau <nbd@nbd.name>
  10635. +Date: Fri, 26 Aug 2016 21:57:16 +0200
  10636. +Subject: [PATCH] mac80211: fix tim recalculation after PS response
  10637. +
  10638. +Handle the case where the mac80211 intermediate queues are empty and the
  10639. +driver has buffered frames
  10640. +
  10641. +Fixes: ba8c3d6f16a1 ("mac80211: add an intermediate software queue implementation")
  10642. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  10643. +---
  10644. +
  10645. +--- a/net/mac80211/sta_info.c
  10646. ++++ b/net/mac80211/sta_info.c
  10647. +@@ -1616,7 +1616,6 @@ ieee80211_sta_ps_deliver_response(struct
  10648. +
  10649. + sta_info_recalc_tim(sta);
  10650. + } else {
  10651. +- unsigned long tids = sta->txq_buffered_tids & driver_release_tids;
  10652. + int tid;
  10653. +
  10654. + /*
  10655. +@@ -1648,7 +1647,8 @@ ieee80211_sta_ps_deliver_response(struct
  10656. + for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) {
  10657. + struct txq_info *txqi = to_txq_info(sta->sta.txq[tid]);
  10658. +
  10659. +- if (!(tids & BIT(tid)) || txqi->tin.backlog_packets)
  10660. ++ if (!(driver_release_tids & BIT(tid)) ||
  10661. ++ txqi->tin.backlog_packets)
  10662. + continue;
  10663. +
  10664. + sta_info_recalc_tim(sta);
  10665. diff --git a/package/kernel/mac80211/patches/339-ath9k-fix-moredata-bit-in-PS-buffered-frame-release.patch b/package/kernel/mac80211/patches/339-ath9k-fix-moredata-bit-in-PS-buffered-frame-release.patch
  10666. new file mode 100644
  10667. index 0000000..49b37e4
  10668. --- /dev/null
  10669. +++ b/package/kernel/mac80211/patches/339-ath9k-fix-moredata-bit-in-PS-buffered-frame-release.patch
  10670. @@ -0,0 +1,49 @@
  10671. +From: Felix Fietkau <nbd@nbd.name>
  10672. +Date: Sun, 28 Aug 2016 13:13:01 +0200
  10673. +Subject: [PATCH] ath9k: fix moredata bit in PS buffered frame release
  10674. +
  10675. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  10676. +---
  10677. +
  10678. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  10679. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  10680. +@@ -1634,6 +1634,21 @@ void ath_tx_aggr_wakeup(struct ath_softc
  10681. + }
  10682. + }
  10683. +
  10684. ++static void
  10685. ++ath9k_set_moredata(struct ath_softc *sc, struct ath_buf *bf, bool val)
  10686. ++{
  10687. ++ struct ieee80211_hdr *hdr;
  10688. ++ u16 mask = cpu_to_le16(IEEE80211_FCTL_MOREDATA);
  10689. ++ u16 mask_val = mask * val;
  10690. ++
  10691. ++ hdr = (struct ieee80211_hdr *) bf->bf_mpdu->data;
  10692. ++ if ((hdr->frame_control & mask) != mask_val) {
  10693. ++ hdr->frame_control = (hdr->frame_control & ~mask) | mask_val;
  10694. ++ dma_sync_single_for_device(sc->dev, bf->bf_buf_addr,
  10695. ++ sizeof(*hdr), DMA_TO_DEVICE);
  10696. ++ }
  10697. ++}
  10698. ++
  10699. + void ath9k_release_buffered_frames(struct ieee80211_hw *hw,
  10700. + struct ieee80211_sta *sta,
  10701. + u16 tids, int nframes,
  10702. +@@ -1664,6 +1679,7 @@ void ath9k_release_buffered_frames(struc
  10703. + if (!bf)
  10704. + break;
  10705. +
  10706. ++ ath9k_set_moredata(sc, bf, true);
  10707. + list_add_tail(&bf->list, &bf_q);
  10708. + ath_set_rates(tid->an->vif, tid->an->sta, bf, true);
  10709. + if (bf_isampdu(bf)) {
  10710. +@@ -1687,6 +1703,9 @@ void ath9k_release_buffered_frames(struc
  10711. + if (list_empty(&bf_q))
  10712. + return;
  10713. +
  10714. ++ if (!more_data)
  10715. ++ ath9k_set_moredata(sc, bf_tail, false);
  10716. ++
  10717. + info = IEEE80211_SKB_CB(bf_tail->bf_mpdu);
  10718. + info->flags |= IEEE80211_TX_STATUS_EOSP;
  10719. +
  10720. 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
  10721. deleted file mode 100644
  10722. index 15d6cd0..0000000
  10723. --- a/package/kernel/mac80211/patches/339-cfg80211-add-radiotap-VHT-info-to-rtap_namespace_siz.patch
  10724. +++ /dev/null
  10725. @@ -1,21 +0,0 @@
  10726. -From: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  10727. -Date: Fri, 19 Feb 2016 11:43:04 +0100
  10728. -Subject: [PATCH] cfg80211: add radiotap VHT info to rtap_namespace_sizes
  10729. -
  10730. -Add IEEE80211_RADIOTAP_VHT entry to rtap_namespace_sizes array in order to
  10731. -define alignment and size of VHT info in tx radiotap
  10732. -
  10733. -Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  10734. -Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  10735. ----
  10736. -
  10737. ---- a/net/wireless/radiotap.c
  10738. -+++ b/net/wireless/radiotap.c
  10739. -@@ -43,6 +43,7 @@ static const struct radiotap_align_size
  10740. - [IEEE80211_RADIOTAP_DATA_RETRIES] = { .align = 1, .size = 1, },
  10741. - [IEEE80211_RADIOTAP_MCS] = { .align = 1, .size = 3, },
  10742. - [IEEE80211_RADIOTAP_AMPDU_STATUS] = { .align = 4, .size = 8, },
  10743. -+ [IEEE80211_RADIOTAP_VHT] = { .align = 2, .size = 12, },
  10744. - /*
  10745. - * add more here as they are defined in radiotap.h
  10746. - */
  10747. diff --git a/package/kernel/mac80211/patches/340-ath9k-clear-potentially-stale-EOSP-status-bit-in-int.patch b/package/kernel/mac80211/patches/340-ath9k-clear-potentially-stale-EOSP-status-bit-in-int.patch
  10748. new file mode 100644
  10749. index 0000000..929da25
  10750. --- /dev/null
  10751. +++ b/package/kernel/mac80211/patches/340-ath9k-clear-potentially-stale-EOSP-status-bit-in-int.patch
  10752. @@ -0,0 +1,22 @@
  10753. +From: Felix Fietkau <nbd@nbd.name>
  10754. +Date: Sun, 28 Aug 2016 13:13:42 +0200
  10755. +Subject: [PATCH] ath9k: clear potentially stale EOSP status bit in
  10756. + intermediate queues
  10757. +
  10758. +Prevents spurious ieee80211_sta_eosp calls.
  10759. +
  10760. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  10761. +---
  10762. +
  10763. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  10764. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  10765. +@@ -945,7 +945,8 @@ ath_tx_get_tid_subframe(struct ath_softc
  10766. + bf->bf_lastbf = bf;
  10767. +
  10768. + tx_info = IEEE80211_SKB_CB(skb);
  10769. +- tx_info->flags &= ~IEEE80211_TX_CTL_CLEAR_PS_FILT;
  10770. ++ tx_info->flags &= ~(IEEE80211_TX_CTL_CLEAR_PS_FILT |
  10771. ++ IEEE80211_TX_STATUS_EOSP);
  10772. +
  10773. + /*
  10774. + * No aggregation session is running, but there may be frames
  10775. 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
  10776. deleted file mode 100644
  10777. index de1b386..0000000
  10778. --- a/package/kernel/mac80211/patches/340-mac80211-fix-parsing-of-40Mhz-in-injected-radiotap-h.patch
  10779. +++ /dev/null
  10780. @@ -1,36 +0,0 @@
  10781. -From: Sven Eckelmann <sven@narfation.org>
  10782. -Date: Wed, 24 Feb 2016 16:25:49 +0100
  10783. -Subject: [PATCH] mac80211: fix parsing of 40Mhz in injected radiotap
  10784. - header
  10785. -
  10786. -The MCS bandwidth part of the radiotap header is 2 bits wide. The full 2
  10787. -bit have to compared against IEEE80211_RADIOTAP_MCS_BW_40 and not only if
  10788. -the first bit is set. Otherwise IEEE80211_RADIOTAP_MCS_BW_40 can be
  10789. -confused with IEEE80211_RADIOTAP_MCS_BW_20U.
  10790. -
  10791. -Fixes: 5ec3aed9ba4c ("mac80211: Parse legacy and HT rate in injected frames")
  10792. -Signed-off-by: Sven Eckelmann <sven@narfation.org>
  10793. ----
  10794. -
  10795. ---- a/net/mac80211/tx.c
  10796. -+++ b/net/mac80211/tx.c
  10797. -@@ -1689,7 +1689,7 @@ static bool ieee80211_parse_tx_radiotap(
  10798. - bool rate_found = false;
  10799. - u8 rate_retries = 0;
  10800. - u16 rate_flags = 0;
  10801. -- u8 mcs_known, mcs_flags;
  10802. -+ u8 mcs_known, mcs_flags, mcs_bw;
  10803. - int i;
  10804. -
  10805. - info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
  10806. -@@ -1765,8 +1765,9 @@ static bool ieee80211_parse_tx_radiotap(
  10807. - mcs_flags & IEEE80211_RADIOTAP_MCS_SGI)
  10808. - rate_flags |= IEEE80211_TX_RC_SHORT_GI;
  10809. -
  10810. -+ mcs_bw = mcs_flags & IEEE80211_RADIOTAP_MCS_BW_MASK;
  10811. - if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_BW &&
  10812. -- mcs_flags & IEEE80211_RADIOTAP_MCS_BW_40)
  10813. -+ mcs_bw == IEEE80211_RADIOTAP_MCS_BW_40)
  10814. - rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
  10815. - break;
  10816. -
  10817. diff --git a/package/kernel/mac80211/patches/341-ath9k-release-PS-buffered-frames-as-A-MPDU-if-enable.patch b/package/kernel/mac80211/patches/341-ath9k-release-PS-buffered-frames-as-A-MPDU-if-enable.patch
  10818. new file mode 100644
  10819. index 0000000..1cc1667
  10820. --- /dev/null
  10821. +++ b/package/kernel/mac80211/patches/341-ath9k-release-PS-buffered-frames-as-A-MPDU-if-enable.patch
  10822. @@ -0,0 +1,40 @@
  10823. +From: Felix Fietkau <nbd@nbd.name>
  10824. +Date: Sun, 28 Aug 2016 13:15:10 +0200
  10825. +Subject: [PATCH] ath9k: release PS buffered frames as A-MPDU if enabled
  10826. +
  10827. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  10828. +---
  10829. +
  10830. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  10831. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  10832. +@@ -1660,10 +1660,11 @@ void ath9k_release_buffered_frames(struc
  10833. + struct ath_node *an = (struct ath_node *)sta->drv_priv;
  10834. + struct ath_txq *txq = sc->tx.uapsdq;
  10835. + struct ieee80211_tx_info *info;
  10836. ++ struct ath_frame_info *fi;
  10837. + struct list_head bf_q;
  10838. + struct ath_buf *bf_tail = NULL, *bf;
  10839. + int sent = 0;
  10840. +- int i;
  10841. ++ int n, i;
  10842. +
  10843. + INIT_LIST_HEAD(&bf_q);
  10844. + for (i = 0; tids && nframes; i++, tids >>= 1) {
  10845. +@@ -1683,10 +1684,15 @@ void ath9k_release_buffered_frames(struc
  10846. + ath9k_set_moredata(sc, bf, true);
  10847. + list_add_tail(&bf->list, &bf_q);
  10848. + ath_set_rates(tid->an->vif, tid->an->sta, bf, true);
  10849. +- if (bf_isampdu(bf)) {
  10850. ++ if (bf_isampdu(bf))
  10851. + ath_tx_addto_baw(sc, tid, bf);
  10852. +- bf->bf_state.bf_type &= ~BUF_AGGR;
  10853. ++ if (bf_isaggr(bf)) {
  10854. ++ fi = get_frame_info(bf->bf_mpdu);
  10855. ++ n = ath_compute_num_delims(sc, tid, bf,
  10856. ++ fi->framelen, true);
  10857. ++ bf->bf_state.ndelim = n;
  10858. + }
  10859. ++
  10860. + if (bf_tail)
  10861. + bf_tail->bf_next = bf;
  10862. +
  10863. 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
  10864. deleted file mode 100644
  10865. index ac1f251..0000000
  10866. --- a/package/kernel/mac80211/patches/341-mac80211-parse-VHT-info-in-injected-frames.patch
  10867. +++ /dev/null
  10868. @@ -1,65 +0,0 @@
  10869. -From: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  10870. -Date: Tue, 23 Feb 2016 15:43:35 +0100
  10871. -Subject: [PATCH] mac80211: parse VHT info in injected frames
  10872. -
  10873. -Add VHT radiotap parsing support to ieee80211_parse_tx_radiotap().
  10874. -That capability has been tested using a d-link dir-860l rev b1 running
  10875. -OpenWrt trunk and mt76 driver
  10876. -
  10877. -Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
  10878. ----
  10879. -
  10880. ---- a/net/mac80211/tx.c
  10881. -+++ b/net/mac80211/tx.c
  10882. -@@ -1690,6 +1690,8 @@ static bool ieee80211_parse_tx_radiotap(
  10883. - u8 rate_retries = 0;
  10884. - u16 rate_flags = 0;
  10885. - u8 mcs_known, mcs_flags, mcs_bw;
  10886. -+ u16 vht_known;
  10887. -+ u8 vht_mcs = 0, vht_nss = 0;
  10888. - int i;
  10889. -
  10890. - info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
  10891. -@@ -1771,6 +1773,32 @@ static bool ieee80211_parse_tx_radiotap(
  10892. - rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
  10893. - break;
  10894. -
  10895. -+ case IEEE80211_RADIOTAP_VHT:
  10896. -+ vht_known = get_unaligned_le16(iterator.this_arg);
  10897. -+ rate_found = true;
  10898. -+
  10899. -+ rate_flags = IEEE80211_TX_RC_VHT_MCS;
  10900. -+ if ((vht_known & IEEE80211_RADIOTAP_VHT_KNOWN_GI) &&
  10901. -+ (iterator.this_arg[2] &
  10902. -+ IEEE80211_RADIOTAP_VHT_FLAG_SGI))
  10903. -+ rate_flags |= IEEE80211_TX_RC_SHORT_GI;
  10904. -+ if (vht_known &
  10905. -+ IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH) {
  10906. -+ if (iterator.this_arg[3] == 1)
  10907. -+ rate_flags |=
  10908. -+ IEEE80211_TX_RC_40_MHZ_WIDTH;
  10909. -+ else if (iterator.this_arg[3] == 4)
  10910. -+ rate_flags |=
  10911. -+ IEEE80211_TX_RC_80_MHZ_WIDTH;
  10912. -+ else if (iterator.this_arg[3] == 11)
  10913. -+ rate_flags |=
  10914. -+ IEEE80211_TX_RC_160_MHZ_WIDTH;
  10915. -+ }
  10916. -+
  10917. -+ vht_mcs = iterator.this_arg[4] >> 4;
  10918. -+ vht_nss = iterator.this_arg[4] & 0xF;
  10919. -+ break;
  10920. -+
  10921. - /*
  10922. - * Please update the file
  10923. - * Documentation/networking/mac80211-injection.txt
  10924. -@@ -1796,6 +1824,9 @@ static bool ieee80211_parse_tx_radiotap(
  10925. -
  10926. - if (rate_flags & IEEE80211_TX_RC_MCS) {
  10927. - info->control.rates[0].idx = rate;
  10928. -+ } else if (rate_flags & IEEE80211_TX_RC_VHT_MCS) {
  10929. -+ ieee80211_rate_set_vht(info->control.rates, vht_mcs,
  10930. -+ vht_nss);
  10931. - } else {
  10932. - for (i = 0; i < sband->n_bitrates; i++) {
  10933. - if (rate * 5 != sband->bitrates[i].bitrate)
  10934. diff --git a/package/kernel/mac80211/patches/342-ath9k-report-tx-status-on-EOSP.patch b/package/kernel/mac80211/patches/342-ath9k-report-tx-status-on-EOSP.patch
  10935. new file mode 100644
  10936. index 0000000..80a3074
  10937. --- /dev/null
  10938. +++ b/package/kernel/mac80211/patches/342-ath9k-report-tx-status-on-EOSP.patch
  10939. @@ -0,0 +1,19 @@
  10940. +From: Felix Fietkau <nbd@nbd.name>
  10941. +Date: Sun, 28 Aug 2016 13:23:27 +0200
  10942. +Subject: [PATCH] ath9k: report tx status on EOSP
  10943. +
  10944. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  10945. +---
  10946. +
  10947. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  10948. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  10949. +@@ -86,7 +86,8 @@ static void ath_tx_status(struct ieee802
  10950. + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  10951. + struct ieee80211_sta *sta = info->status.status_driver_data[0];
  10952. +
  10953. +- if (info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS) {
  10954. ++ if (info->flags & (IEEE80211_TX_CTL_REQ_TX_STATUS |
  10955. ++ IEEE80211_TX_STATUS_EOSP)) {
  10956. + ieee80211_tx_status(hw, skb);
  10957. + return;
  10958. + }
  10959. 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
  10960. deleted file mode 100644
  10961. index d7452c2..0000000
  10962. --- a/package/kernel/mac80211/patches/342-mac80211-do-not-pass-injected-frames-without-a-valid.patch
  10963. +++ /dev/null
  10964. @@ -1,23 +0,0 @@
  10965. -From: Felix Fietkau <nbd@openwrt.org>
  10966. -Date: Wed, 2 Mar 2016 15:51:40 +0100
  10967. -Subject: [PATCH] mac80211: do not pass injected frames without a valid rate to
  10968. - the driver
  10969. -
  10970. -Fall back to rate control if the requested bitrate was not found.
  10971. -
  10972. -Fixes: dfdfc2beb0dd ("mac80211: Parse legacy and HT rate in injected frames")
  10973. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  10974. ----
  10975. -
  10976. ---- a/net/mac80211/tx.c
  10977. -+++ b/net/mac80211/tx.c
  10978. -@@ -1837,6 +1837,9 @@ static bool ieee80211_parse_tx_radiotap(
  10979. - }
  10980. - }
  10981. -
  10982. -+ if (info->control.rates[0].idx < 0)
  10983. -+ info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;
  10984. -+
  10985. - info->control.rates[0].flags = rate_flags;
  10986. - info->control.rates[0].count = min_t(u8, rate_retries + 1,
  10987. - local->hw.max_rate_tries);
  10988. diff --git a/package/kernel/mac80211/patches/343-ath9k-fix-block-ack-window-tracking-issues.patch b/package/kernel/mac80211/patches/343-ath9k-fix-block-ack-window-tracking-issues.patch
  10989. new file mode 100644
  10990. index 0000000..007a8d7d
  10991. --- /dev/null
  10992. +++ b/package/kernel/mac80211/patches/343-ath9k-fix-block-ack-window-tracking-issues.patch
  10993. @@ -0,0 +1,111 @@
  10994. +From: Felix Fietkau <nbd@nbd.name>
  10995. +Date: Tue, 30 Aug 2016 12:44:08 +0200
  10996. +Subject: [PATCH] ath9k: fix block-ack window tracking issues
  10997. +
  10998. +Ensure that a buffer gets tracked as part of the block-ack window as
  10999. +soon as it's dequeued from the tid for the first time. Ensure that
  11000. +double calls to ath_tx_addto_baw (e.g. on retransmission) don't cause
  11001. +any issues.
  11002. +
  11003. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  11004. +---
  11005. +
  11006. +--- a/drivers/net/wireless/ath/ath9k/xmit.c
  11007. ++++ b/drivers/net/wireless/ath/ath9k/xmit.c
  11008. +@@ -62,7 +62,7 @@ static void ath_tx_rc_status(struct ath_
  11009. + struct ath_tx_status *ts, int nframes, int nbad,
  11010. + int txok);
  11011. + static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid,
  11012. +- int seqno);
  11013. ++ struct ath_buf *bf);
  11014. + static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
  11015. + struct ath_txq *txq,
  11016. + struct ath_atx_tid *tid,
  11017. +@@ -300,7 +300,7 @@ static void ath_tx_flush_tid(struct ath_
  11018. + }
  11019. +
  11020. + if (fi->baw_tracked) {
  11021. +- ath_tx_update_baw(sc, tid, bf->bf_state.seqno);
  11022. ++ ath_tx_update_baw(sc, tid, bf);
  11023. + sendbar = true;
  11024. + }
  11025. +
  11026. +@@ -316,10 +316,15 @@ static void ath_tx_flush_tid(struct ath_
  11027. + }
  11028. +
  11029. + static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid,
  11030. +- int seqno)
  11031. ++ struct ath_buf *bf)
  11032. + {
  11033. ++ struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu);
  11034. ++ u16 seqno = bf->bf_state.seqno;
  11035. + int index, cindex;
  11036. +
  11037. ++ if (!fi->baw_tracked)
  11038. ++ return;
  11039. ++
  11040. + index = ATH_BA_INDEX(tid->seq_start, seqno);
  11041. + cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1);
  11042. +
  11043. +@@ -340,6 +345,9 @@ static void ath_tx_addto_baw(struct ath_
  11044. + u16 seqno = bf->bf_state.seqno;
  11045. + int index, cindex;
  11046. +
  11047. ++ if (fi->baw_tracked)
  11048. ++ return;
  11049. ++
  11050. + index = ATH_BA_INDEX(tid->seq_start, seqno);
  11051. + cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1);
  11052. + __set_bit(cindex, tid->tx_buf);
  11053. +@@ -616,7 +624,7 @@ static void ath_tx_complete_aggr(struct
  11054. + * complete the acked-ones/xretried ones; update
  11055. + * block-ack window
  11056. + */
  11057. +- ath_tx_update_baw(sc, tid, seqno);
  11058. ++ ath_tx_update_baw(sc, tid, bf);
  11059. +
  11060. + if (rc_update && (acked_cnt == 1 || txfail_cnt == 1)) {
  11061. + memcpy(tx_info->control.rates, rates, sizeof(rates));
  11062. +@@ -646,7 +654,7 @@ static void ath_tx_complete_aggr(struct
  11063. + * run out of tx buf.
  11064. + */
  11065. + if (!tbf) {
  11066. +- ath_tx_update_baw(sc, tid, seqno);
  11067. ++ ath_tx_update_baw(sc, tid, bf);
  11068. +
  11069. + ath_tx_complete_buf(sc, bf, txq,
  11070. + &bf_head, NULL, ts,
  11071. +@@ -986,11 +994,14 @@ ath_tx_get_tid_subframe(struct ath_softc
  11072. +
  11073. + INIT_LIST_HEAD(&bf_head);
  11074. + list_add(&bf->list, &bf_head);
  11075. +- ath_tx_update_baw(sc, tid, seqno);
  11076. ++ ath_tx_update_baw(sc, tid, bf);
  11077. + ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0);
  11078. + continue;
  11079. + }
  11080. +
  11081. ++ if (bf_isampdu(bf))
  11082. ++ ath_tx_addto_baw(sc, tid, bf);
  11083. ++
  11084. + return bf;
  11085. + }
  11086. +
  11087. +@@ -1048,8 +1059,6 @@ ath_tx_form_aggr(struct ath_softc *sc, s
  11088. + bf->bf_next = NULL;
  11089. +
  11090. + /* link buffers of this frame to the aggregate */
  11091. +- if (!fi->baw_tracked)
  11092. +- ath_tx_addto_baw(sc, tid, bf);
  11093. + bf->bf_state.ndelim = ndelim;
  11094. +
  11095. + list_add_tail(&bf->list, bf_q);
  11096. +@@ -1685,8 +1694,6 @@ void ath9k_release_buffered_frames(struc
  11097. + ath9k_set_moredata(sc, bf, true);
  11098. + list_add_tail(&bf->list, &bf_q);
  11099. + ath_set_rates(tid->an->vif, tid->an->sta, bf, true);
  11100. +- if (bf_isampdu(bf))
  11101. +- ath_tx_addto_baw(sc, tid, bf);
  11102. + if (bf_isaggr(bf)) {
  11103. + fi = get_frame_info(bf->bf_mpdu);
  11104. + n = ath_compute_num_delims(sc, tid, bf,
  11105. 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
  11106. deleted file mode 100644
  11107. index 55ff817..0000000
  11108. --- a/package/kernel/mac80211/patches/343-mac80211-minstrel_ht-improve-sample-rate-skip-logic.patch
  11109. +++ /dev/null
  11110. @@ -1,77 +0,0 @@
  11111. -From: Felix Fietkau <nbd@openwrt.org>
  11112. -Date: Thu, 3 Mar 2016 23:20:06 +0100
  11113. -Subject: [PATCH] mac80211: minstrel_ht: improve sample rate skip logic
  11114. -
  11115. -There were a few issues that were slowing down the process of finding
  11116. -the optimal rate, especially on devices with multi-rate retry
  11117. -limitations:
  11118. -
  11119. -When max_tp_rate[0] was slower than max_tp_rate[1], the code did not
  11120. -sample max_tp_rate[1], which would often allow it to switch places with
  11121. -max_tp_rate[0] (e.g. if only the first sampling attempts were bad, but the
  11122. -rate is otherwise good).
  11123. -
  11124. -Also, sample attempts of rates between max_tp_rate[0] and [1] were being
  11125. -ignored in this case, because the code only checked if the rate was
  11126. -slower than [1].
  11127. -
  11128. -Fix this by checking against the fastest / second fastest max_tp_rate
  11129. -instead of assuming a specific order between the two.
  11130. -
  11131. -In my tests this patch significantly reduces the time until minstrel_ht
  11132. -finds the optimal rate right after assoc
  11133. -
  11134. -Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  11135. ----
  11136. -
  11137. ---- a/net/mac80211/rc80211_minstrel_ht.c
  11138. -+++ b/net/mac80211/rc80211_minstrel_ht.c
  11139. -@@ -958,6 +958,7 @@ minstrel_get_sample_rate(struct minstrel
  11140. - struct minstrel_rate_stats *mrs;
  11141. - struct minstrel_mcs_group_data *mg;
  11142. - unsigned int sample_dur, sample_group, cur_max_tp_streams;
  11143. -+ int tp_rate1, tp_rate2;
  11144. - int sample_idx = 0;
  11145. -
  11146. - if (mi->sample_wait > 0) {
  11147. -@@ -979,14 +980,22 @@ minstrel_get_sample_rate(struct minstrel
  11148. - mrs = &mg->rates[sample_idx];
  11149. - sample_idx += sample_group * MCS_GROUP_RATES;
  11150. -
  11151. -+ /* Set tp_rate1, tp_rate2 to the highest / second highest max_tp_rate */
  11152. -+ if (minstrel_get_duration(mi->max_tp_rate[0]) >
  11153. -+ minstrel_get_duration(mi->max_tp_rate[1])) {
  11154. -+ tp_rate1 = mi->max_tp_rate[1];
  11155. -+ tp_rate2 = mi->max_tp_rate[0];
  11156. -+ } else {
  11157. -+ tp_rate1 = mi->max_tp_rate[0];
  11158. -+ tp_rate2 = mi->max_tp_rate[1];
  11159. -+ }
  11160. -+
  11161. - /*
  11162. - * Sampling might add some overhead (RTS, no aggregation)
  11163. -- * to the frame. Hence, don't use sampling for the currently
  11164. -- * used rates.
  11165. -+ * to the frame. Hence, don't use sampling for the highest currently
  11166. -+ * used highest throughput or probability rate.
  11167. - */
  11168. -- if (sample_idx == mi->max_tp_rate[0] ||
  11169. -- sample_idx == mi->max_tp_rate[1] ||
  11170. -- sample_idx == mi->max_prob_rate)
  11171. -+ if (sample_idx == mi->max_tp_rate[0] || sample_idx == mi->max_prob_rate)
  11172. - return -1;
  11173. -
  11174. - /*
  11175. -@@ -1001,10 +1010,10 @@ minstrel_get_sample_rate(struct minstrel
  11176. - * if the link is working perfectly.
  11177. - */
  11178. -
  11179. -- cur_max_tp_streams = minstrel_mcs_groups[mi->max_tp_rate[0] /
  11180. -+ cur_max_tp_streams = minstrel_mcs_groups[tp_rate1 /
  11181. - MCS_GROUP_RATES].streams;
  11182. - sample_dur = minstrel_get_duration(sample_idx);
  11183. -- if (sample_dur >= minstrel_get_duration(mi->max_tp_rate[1]) &&
  11184. -+ if (sample_dur >= minstrel_get_duration(tp_rate2) &&
  11185. - (cur_max_tp_streams - 1 <
  11186. - minstrel_mcs_groups[sample_group].streams ||
  11187. - sample_dur >= minstrel_get_duration(mi->max_prob_rate))) {
  11188. 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
  11189. deleted file mode 100644
  11190. index 3de0f64..0000000
  11191. --- a/package/kernel/mac80211/patches/344-0008-brcmfmac-use-device-memsize-config-from-fw-if-define.patch
  11192. +++ /dev/null
  11193. @@ -1,73 +0,0 @@
  11194. -From: Hante Meuleman <meuleman@broadcom.com>
  11195. -Date: Wed, 17 Feb 2016 11:26:57 +0100
  11196. -Subject: [PATCH] brcmfmac: use device memsize config from fw if defined
  11197. -
  11198. -Newer type pcie devices have memory which get shared between fw and
  11199. -hw. The division of this memory is done firmware compile time. As a
  11200. -result the ramsize as used by driver needs to be adjusted for this.
  11201. -This is done by reading the memory size from the firmware.
  11202. -
  11203. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  11204. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11205. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11206. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  11207. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11208. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11209. ----
  11210. -
  11211. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  11212. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  11213. -@@ -207,6 +207,10 @@ static struct brcmf_firmware_mapping brc
  11214. - #define BRCMF_PCIE_CFGREG_REG_BAR3_CONFIG 0x4F4
  11215. - #define BRCMF_PCIE_LINK_STATUS_CTRL_ASPM_ENAB 3
  11216. -
  11217. -+/* Magic number at a magic location to find RAM size */
  11218. -+#define BRCMF_RAMSIZE_MAGIC 0x534d4152 /* SMAR */
  11219. -+#define BRCMF_RAMSIZE_OFFSET 0x6c
  11220. -+
  11221. -
  11222. - struct brcmf_pcie_console {
  11223. - u32 base_addr;
  11224. -@@ -1412,6 +1416,28 @@ static const struct brcmf_bus_ops brcmf_
  11225. - };
  11226. -
  11227. -
  11228. -+static void
  11229. -+brcmf_pcie_adjust_ramsize(struct brcmf_pciedev_info *devinfo, u8 *data,
  11230. -+ u32 data_len)
  11231. -+{
  11232. -+ __le32 *field;
  11233. -+ u32 newsize;
  11234. -+
  11235. -+ if (data_len < BRCMF_RAMSIZE_OFFSET + 8)
  11236. -+ return;
  11237. -+
  11238. -+ field = (__le32 *)&data[BRCMF_RAMSIZE_OFFSET];
  11239. -+ if (le32_to_cpup(field) != BRCMF_RAMSIZE_MAGIC)
  11240. -+ return;
  11241. -+ field++;
  11242. -+ newsize = le32_to_cpup(field);
  11243. -+
  11244. -+ brcmf_dbg(PCIE, "Found ramsize info in FW, adjusting to 0x%x\n",
  11245. -+ newsize);
  11246. -+ devinfo->ci->ramsize = newsize;
  11247. -+}
  11248. -+
  11249. -+
  11250. - static int
  11251. - brcmf_pcie_init_share_ram_info(struct brcmf_pciedev_info *devinfo,
  11252. - u32 sharedram_addr)
  11253. -@@ -1694,6 +1720,13 @@ static void brcmf_pcie_setup(struct devi
  11254. -
  11255. - brcmf_pcie_attach(devinfo);
  11256. -
  11257. -+ /* Some of the firmwares have the size of the memory of the device
  11258. -+ * defined inside the firmware. This is because part of the memory in
  11259. -+ * the device is shared and the devision is determined by FW. Parse
  11260. -+ * the firmware and adjust the chip memory size now.
  11261. -+ */
  11262. -+ brcmf_pcie_adjust_ramsize(devinfo, (u8 *)fw->data, fw->size);
  11263. -+
  11264. - ret = brcmf_pcie_download_fw_nvram(devinfo, fw, nvram, nvram_len);
  11265. - if (ret)
  11266. - goto fail;
  11267. 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
  11268. deleted file mode 100644
  11269. index ca03ffe..0000000
  11270. --- a/package/kernel/mac80211/patches/344-0009-brcmfmac-use-bar1-window-size-as-provided-by-pci-sub.patch
  11271. +++ /dev/null
  11272. @@ -1,58 +0,0 @@
  11273. -From: Hante Meuleman <meuleman@broadcom.com>
  11274. -Date: Wed, 17 Feb 2016 11:26:58 +0100
  11275. -Subject: [PATCH] brcmfmac: use bar1 window size as provided by pci subsystem
  11276. -
  11277. -The PCIE bar1 window size is specified by chip. Currently the
  11278. -ioremap of bar1 was using a define which always matched the size
  11279. -of bar1, but newer chips can have a different bar1 sizes. With
  11280. -this patch the ioremap will be called with the by chip provided
  11281. -window size.
  11282. -
  11283. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  11284. -Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
  11285. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11286. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  11287. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11288. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11289. ----
  11290. -
  11291. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  11292. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  11293. -@@ -72,7 +72,6 @@ static struct brcmf_firmware_mapping brc
  11294. -
  11295. - #define BRCMF_PCIE_FW_UP_TIMEOUT 2000 /* msec */
  11296. -
  11297. --#define BRCMF_PCIE_TCM_MAP_SIZE (4096 * 1024)
  11298. - #define BRCMF_PCIE_REG_MAP_SIZE (32 * 1024)
  11299. -
  11300. - /* backplane addres space accessed by BAR0 */
  11301. -@@ -252,7 +251,6 @@ struct brcmf_pciedev_info {
  11302. - char nvram_name[BRCMF_FW_NAME_LEN];
  11303. - void __iomem *regs;
  11304. - void __iomem *tcm;
  11305. -- u32 tcm_size;
  11306. - u32 ram_base;
  11307. - u32 ram_size;
  11308. - struct brcmf_chip *ci;
  11309. -@@ -1592,8 +1590,7 @@ static int brcmf_pcie_get_resource(struc
  11310. - }
  11311. -
  11312. - devinfo->regs = ioremap_nocache(bar0_addr, BRCMF_PCIE_REG_MAP_SIZE);
  11313. -- devinfo->tcm = ioremap_nocache(bar1_addr, BRCMF_PCIE_TCM_MAP_SIZE);
  11314. -- devinfo->tcm_size = BRCMF_PCIE_TCM_MAP_SIZE;
  11315. -+ devinfo->tcm = ioremap_nocache(bar1_addr, bar1_size);
  11316. -
  11317. - if (!devinfo->regs || !devinfo->tcm) {
  11318. - brcmf_err("ioremap() failed (%p,%p)\n", devinfo->regs,
  11319. -@@ -1602,8 +1599,9 @@ static int brcmf_pcie_get_resource(struc
  11320. - }
  11321. - brcmf_dbg(PCIE, "Phys addr : reg space = %p base addr %#016llx\n",
  11322. - devinfo->regs, (unsigned long long)bar0_addr);
  11323. -- brcmf_dbg(PCIE, "Phys addr : mem space = %p base addr %#016llx\n",
  11324. -- devinfo->tcm, (unsigned long long)bar1_addr);
  11325. -+ brcmf_dbg(PCIE, "Phys addr : mem space = %p base addr %#016llx size 0x%x\n",
  11326. -+ devinfo->tcm, (unsigned long long)bar1_addr,
  11327. -+ (unsigned int)bar1_size);
  11328. -
  11329. - return 0;
  11330. - }
  11331. 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
  11332. deleted file mode 100644
  11333. index e4a8f30..0000000
  11334. --- a/package/kernel/mac80211/patches/344-0010-brcmfmac-add-support-for-the-PCIE-4366c0-chip.patch
  11335. +++ /dev/null
  11336. @@ -1,34 +0,0 @@
  11337. -From: Hante Meuleman <meuleman@broadcom.com>
  11338. -Date: Wed, 17 Feb 2016 11:26:59 +0100
  11339. -Subject: [PATCH] brcmfmac: add support for the PCIE 4366c0 chip
  11340. -
  11341. -A newer version of the 4366 PCIE chip has been released. Add
  11342. -support for this version of the chip.
  11343. -
  11344. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  11345. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11346. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  11347. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11348. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11349. ----
  11350. -
  11351. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  11352. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
  11353. -@@ -53,6 +53,7 @@ BRCMF_FW_NVRAM_DEF(4358, "brcmfmac4358-p
  11354. - BRCMF_FW_NVRAM_DEF(4359, "brcmfmac4359-pcie.bin", "brcmfmac4359-pcie.txt");
  11355. - BRCMF_FW_NVRAM_DEF(4365B, "brcmfmac4365b-pcie.bin", "brcmfmac4365b-pcie.txt");
  11356. - BRCMF_FW_NVRAM_DEF(4366B, "brcmfmac4366b-pcie.bin", "brcmfmac4366b-pcie.txt");
  11357. -+BRCMF_FW_NVRAM_DEF(4366C, "brcmfmac4366c-pcie.bin", "brcmfmac4366c-pcie.txt");
  11358. - BRCMF_FW_NVRAM_DEF(4371, "brcmfmac4371-pcie.bin", "brcmfmac4371-pcie.txt");
  11359. -
  11360. - static struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = {
  11361. -@@ -66,7 +67,8 @@ static struct brcmf_firmware_mapping brc
  11362. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4358_CHIP_ID, 0xFFFFFFFF, 4358),
  11363. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4359_CHIP_ID, 0xFFFFFFFF, 4359),
  11364. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4365_CHIP_ID, 0xFFFFFFFF, 4365B),
  11365. -- BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0xFFFFFFFF, 4366B),
  11366. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0x0000000F, 4366B),
  11367. -+ BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4366_CHIP_ID, 0xFFFFFFF0, 4366C),
  11368. - BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4371_CHIP_ID, 0xFFFFFFFF, 4371),
  11369. - };
  11370. -
  11371. 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
  11372. deleted file mode 100644
  11373. index c529ff2..0000000
  11374. --- a/package/kernel/mac80211/patches/344-0012-brcmfmac-increase-timeout-for-tx-eapol.patch
  11375. +++ /dev/null
  11376. @@ -1,30 +0,0 @@
  11377. -From: Hante Meuleman <meuleman@broadcom.com>
  11378. -Date: Wed, 17 Feb 2016 11:27:01 +0100
  11379. -Subject: [PATCH] brcmfmac: increase timeout for tx eapol
  11380. -
  11381. -When keys get set and updated this has to happen after eapol got
  11382. -transmitted (without key or old key) before the key can be updated.
  11383. -To make sure the order of sending eapol and configuring key is done
  11384. -correctly a timeout for tx of eapol is applied. This timeout is set
  11385. -to 50 msec, which is not always enough. Especially in AP mode and
  11386. -key updates the timeout may need to be much longer because client(s)
  11387. -can be in powersave. Increase the timeout from 50 to 950 msec.
  11388. -
  11389. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  11390. -Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
  11391. -Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
  11392. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11393. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11394. ----
  11395. -
  11396. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  11397. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  11398. -@@ -40,7 +40,7 @@ MODULE_AUTHOR("Broadcom Corporation");
  11399. - MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver.");
  11400. - MODULE_LICENSE("Dual BSD/GPL");
  11401. -
  11402. --#define MAX_WAIT_FOR_8021X_TX msecs_to_jiffies(50)
  11403. -+#define MAX_WAIT_FOR_8021X_TX msecs_to_jiffies(950)
  11404. -
  11405. - /* AMPDU rx reordering definitions */
  11406. - #define BRCMF_RXREORDER_FLOWID_OFFSET 0
  11407. diff --git a/package/kernel/mac80211/patches/344-mac80211-send-delBA-on-unexpected-BlockAck-data-fram.patch b/package/kernel/mac80211/patches/344-mac80211-send-delBA-on-unexpected-BlockAck-data-fram.patch
  11408. new file mode 100644
  11409. index 0000000..3bbca22
  11410. --- /dev/null
  11411. +++ b/package/kernel/mac80211/patches/344-mac80211-send-delBA-on-unexpected-BlockAck-data-fram.patch
  11412. @@ -0,0 +1,64 @@
  11413. +From: Johannes Berg <johannes.berg@intel.com>
  11414. +Date: Mon, 29 Aug 2016 23:25:18 +0300
  11415. +Subject: [PATCH] mac80211: send delBA on unexpected BlockAck data frames
  11416. +
  11417. +When we receive data frames with ACK policy BlockAck, send
  11418. +delBA as requested by the 802.11 spec. Since this would be
  11419. +happening for every frame inside an A-MPDU if it's really
  11420. +received outside a session, limit it to a single attempt.
  11421. +
  11422. +Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  11423. +---
  11424. +
  11425. +--- a/net/mac80211/agg-rx.c
  11426. ++++ b/net/mac80211/agg-rx.c
  11427. +@@ -388,8 +388,10 @@ void __ieee80211_start_rx_ba_session(str
  11428. + }
  11429. +
  11430. + end:
  11431. +- if (status == WLAN_STATUS_SUCCESS)
  11432. ++ if (status == WLAN_STATUS_SUCCESS) {
  11433. + __set_bit(tid, sta->ampdu_mlme.agg_session_valid);
  11434. ++ __clear_bit(tid, sta->ampdu_mlme.unexpected_agg);
  11435. ++ }
  11436. + mutex_unlock(&sta->ampdu_mlme.mtx);
  11437. +
  11438. + end_no_lock:
  11439. +--- a/net/mac80211/rx.c
  11440. ++++ b/net/mac80211/rx.c
  11441. +@@ -1072,8 +1072,15 @@ static void ieee80211_rx_reorder_ampdu(s
  11442. + tid = *ieee80211_get_qos_ctl(hdr) & IEEE80211_QOS_CTL_TID_MASK;
  11443. +
  11444. + tid_agg_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[tid]);
  11445. +- if (!tid_agg_rx)
  11446. ++ if (!tid_agg_rx) {
  11447. ++ if (ack_policy == IEEE80211_QOS_CTL_ACK_POLICY_BLOCKACK &&
  11448. ++ !test_bit(tid, rx->sta->ampdu_mlme.agg_session_valid) &&
  11449. ++ !test_and_set_bit(tid, rx->sta->ampdu_mlme.unexpected_agg))
  11450. ++ ieee80211_send_delba(rx->sdata, rx->sta->sta.addr, tid,
  11451. ++ WLAN_BACK_RECIPIENT,
  11452. ++ WLAN_REASON_QSTA_REQUIRE_SETUP);
  11453. + goto dont_reorder;
  11454. ++ }
  11455. +
  11456. + /* qos null data frames are excluded */
  11457. + if (unlikely(hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_NULLFUNC)))
  11458. +--- a/net/mac80211/sta_info.h
  11459. ++++ b/net/mac80211/sta_info.h
  11460. +@@ -230,6 +230,8 @@ struct tid_ampdu_rx {
  11461. + * @tid_rx_stop_requested: bitmap indicating which BA sessions per TID the
  11462. + * driver requested to close until the work for it runs
  11463. + * @agg_session_valid: bitmap indicating which TID has a rx BA session open on
  11464. ++ * @unexpected_agg: bitmap indicating which TID already sent a delBA due to
  11465. ++ * unexpected aggregation related frames outside a session
  11466. + * @work: work struct for starting/stopping aggregation
  11467. + * @tid_tx: aggregation info for Tx per TID
  11468. + * @tid_start_tx: sessions where start was requested
  11469. +@@ -244,6 +246,7 @@ struct sta_ampdu_mlme {
  11470. + unsigned long tid_rx_timer_expired[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];
  11471. + unsigned long tid_rx_stop_requested[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];
  11472. + unsigned long agg_session_valid[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];
  11473. ++ unsigned long unexpected_agg[BITS_TO_LONGS(IEEE80211_NUM_TIDS)];
  11474. + /* tx */
  11475. + struct work_struct work;
  11476. + struct tid_ampdu_tx __rcu *tid_tx[IEEE80211_NUM_TIDS];
  11477. 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
  11478. deleted file mode 100644
  11479. index f293401..0000000
  11480. --- a/package/kernel/mac80211/patches/345-brcmfmac-insert-default-boardrev-in-nvram-data-if-mi.patch
  11481. +++ /dev/null
  11482. @@ -1,114 +0,0 @@
  11483. -From: Hante Meuleman <hante.meuleman@broadcom.com>
  11484. -Date: Mon, 11 Apr 2016 11:35:23 +0200
  11485. -Subject: [PATCH] brcmfmac: insert default boardrev in nvram data if
  11486. - missing
  11487. -
  11488. -Some nvram files/stores come without the boardrev information,
  11489. -but firmware requires this to be set. When not found in nvram then
  11490. -add a default boardrev string to the nvram data.
  11491. -
  11492. -Reported-by: Rafal Milecki <zajec5@gmail.com>
  11493. -Reviewed-by: Arend Van Spriel <arend@broadcom.com>
  11494. -Reviewed-by: Franky (Zhenhui) Lin <franky.lin@broadcom.com>
  11495. -Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  11496. -Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
  11497. -Signed-off-by: Arend van Spriel <arend@broadcom.com>
  11498. -Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11499. ----
  11500. -
  11501. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  11502. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  11503. -@@ -29,6 +29,7 @@
  11504. - #define BRCMF_FW_MAX_NVRAM_SIZE 64000
  11505. - #define BRCMF_FW_NVRAM_DEVPATH_LEN 19 /* devpath0=pcie/1/4/ */
  11506. - #define BRCMF_FW_NVRAM_PCIEDEV_LEN 10 /* pcie/1/4/ + \0 */
  11507. -+#define BRCMF_FW_DEFAULT_BOARDREV "boardrev=0xff"
  11508. -
  11509. - enum nvram_parser_state {
  11510. - IDLE,
  11511. -@@ -51,6 +52,7 @@ enum nvram_parser_state {
  11512. - * @entry: start position of key,value entry.
  11513. - * @multi_dev_v1: detect pcie multi device v1 (compressed).
  11514. - * @multi_dev_v2: detect pcie multi device v2.
  11515. -+ * @boardrev_found: nvram contains boardrev information.
  11516. - */
  11517. - struct nvram_parser {
  11518. - enum nvram_parser_state state;
  11519. -@@ -63,6 +65,7 @@ struct nvram_parser {
  11520. - u32 entry;
  11521. - bool multi_dev_v1;
  11522. - bool multi_dev_v2;
  11523. -+ bool boardrev_found;
  11524. - };
  11525. -
  11526. - /**
  11527. -@@ -125,6 +128,8 @@ static enum nvram_parser_state brcmf_nvr
  11528. - nvp->multi_dev_v1 = true;
  11529. - if (strncmp(&nvp->data[nvp->entry], "pcie/", 5) == 0)
  11530. - nvp->multi_dev_v2 = true;
  11531. -+ if (strncmp(&nvp->data[nvp->entry], "boardrev", 8) == 0)
  11532. -+ nvp->boardrev_found = true;
  11533. - } else if (!is_nvram_char(c) || c == ' ') {
  11534. - brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n",
  11535. - nvp->line, nvp->column);
  11536. -@@ -284,6 +289,8 @@ static void brcmf_fw_strip_multi_v1(stru
  11537. - while (i < nvp->nvram_len) {
  11538. - if ((nvp->nvram[i] - '0' == id) && (nvp->nvram[i + 1] == ':')) {
  11539. - i += 2;
  11540. -+ if (strncmp(&nvp->nvram[i], "boardrev", 8) == 0)
  11541. -+ nvp->boardrev_found = true;
  11542. - while (nvp->nvram[i] != 0) {
  11543. - nvram[j] = nvp->nvram[i];
  11544. - i++;
  11545. -@@ -335,6 +342,8 @@ static void brcmf_fw_strip_multi_v2(stru
  11546. - while (i < nvp->nvram_len - len) {
  11547. - if (strncmp(&nvp->nvram[i], prefix, len) == 0) {
  11548. - i += len;
  11549. -+ if (strncmp(&nvp->nvram[i], "boardrev", 8) == 0)
  11550. -+ nvp->boardrev_found = true;
  11551. - while (nvp->nvram[i] != 0) {
  11552. - nvram[j] = nvp->nvram[i];
  11553. - i++;
  11554. -@@ -356,6 +365,18 @@ fail:
  11555. - nvp->nvram_len = 0;
  11556. - }
  11557. -
  11558. -+static void brcmf_fw_add_defaults(struct nvram_parser *nvp)
  11559. -+{
  11560. -+ if (nvp->boardrev_found)
  11561. -+ return;
  11562. -+
  11563. -+ memcpy(&nvp->nvram[nvp->nvram_len], &BRCMF_FW_DEFAULT_BOARDREV,
  11564. -+ strlen(BRCMF_FW_DEFAULT_BOARDREV));
  11565. -+ nvp->nvram_len += strlen(BRCMF_FW_DEFAULT_BOARDREV);
  11566. -+ nvp->nvram[nvp->nvram_len] = '\0';
  11567. -+ nvp->nvram_len++;
  11568. -+}
  11569. -+
  11570. - /* brcmf_nvram_strip :Takes a buffer of "<var>=<value>\n" lines read from a fil
  11571. - * and ending in a NUL. Removes carriage returns, empty lines, comment lines,
  11572. - * and converts newlines to NULs. Shortens buffer as needed and pads with NULs.
  11573. -@@ -377,16 +398,21 @@ static void *brcmf_fw_nvram_strip(const
  11574. - if (nvp.state == END)
  11575. - break;
  11576. - }
  11577. -- if (nvp.multi_dev_v1)
  11578. -+ if (nvp.multi_dev_v1) {
  11579. -+ nvp.boardrev_found = false;
  11580. - brcmf_fw_strip_multi_v1(&nvp, domain_nr, bus_nr);
  11581. -- else if (nvp.multi_dev_v2)
  11582. -+ } else if (nvp.multi_dev_v2) {
  11583. -+ nvp.boardrev_found = false;
  11584. - brcmf_fw_strip_multi_v2(&nvp, domain_nr, bus_nr);
  11585. -+ }
  11586. -
  11587. - if (nvp.nvram_len == 0) {
  11588. - kfree(nvp.nvram);
  11589. - return NULL;
  11590. - }
  11591. -
  11592. -+ brcmf_fw_add_defaults(&nvp);
  11593. -+
  11594. - pad = nvp.nvram_len;
  11595. - *new_length = roundup(nvp.nvram_len + 1, 4);
  11596. - while (pad != *new_length) {
  11597. diff --git a/package/kernel/mac80211/patches/345-mac80211-send-delBA-on-unexpected-BlockAck-Request.patch b/package/kernel/mac80211/patches/345-mac80211-send-delBA-on-unexpected-BlockAck-Request.patch
  11598. new file mode 100644
  11599. index 0000000..c3d3118
  11600. --- /dev/null
  11601. +++ b/package/kernel/mac80211/patches/345-mac80211-send-delBA-on-unexpected-BlockAck-Request.patch
  11602. @@ -0,0 +1,26 @@
  11603. +From: Johannes Berg <johannes.berg@intel.com>
  11604. +Date: Mon, 29 Aug 2016 23:25:19 +0300
  11605. +Subject: [PATCH] mac80211: send delBA on unexpected BlockAck Request
  11606. +
  11607. +If we don't have a BA session, send delBA, as requested by the
  11608. +IEEE 802.11 spec. Apply the same limit of sending such a delBA
  11609. +only once as in the previous patch.
  11610. +
  11611. +Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  11612. +---
  11613. +
  11614. +--- a/net/mac80211/rx.c
  11615. ++++ b/net/mac80211/rx.c
  11616. +@@ -2537,6 +2537,12 @@ ieee80211_rx_h_ctrl(struct ieee80211_rx_
  11617. +
  11618. + tid = le16_to_cpu(bar_data.control) >> 12;
  11619. +
  11620. ++ if (!test_bit(tid, rx->sta->ampdu_mlme.agg_session_valid) &&
  11621. ++ !test_and_set_bit(tid, rx->sta->ampdu_mlme.unexpected_agg))
  11622. ++ ieee80211_send_delba(rx->sdata, rx->sta->sta.addr, tid,
  11623. ++ WLAN_BACK_RECIPIENT,
  11624. ++ WLAN_REASON_QSTA_REQUIRE_SETUP);
  11625. ++
  11626. + tid_agg_rx = rcu_dereference(rx->sta->ampdu_mlme.tid_rx[tid]);
  11627. + if (!tid_agg_rx)
  11628. + return RX_DROP_MONITOR;
  11629. diff --git a/package/kernel/mac80211/patches/346-mac80211-fix-sequence-number-assignment-for-PS-respo.patch b/package/kernel/mac80211/patches/346-mac80211-fix-sequence-number-assignment-for-PS-respo.patch
  11630. new file mode 100644
  11631. index 0000000..a82d12f
  11632. --- /dev/null
  11633. +++ b/package/kernel/mac80211/patches/346-mac80211-fix-sequence-number-assignment-for-PS-respo.patch
  11634. @@ -0,0 +1,107 @@
  11635. +From: Felix Fietkau <nbd@nbd.name>
  11636. +Date: Sun, 4 Sep 2016 17:46:24 +0200
  11637. +Subject: [PATCH] mac80211: fix sequence number assignment for PS response
  11638. + frames
  11639. +
  11640. +When using intermediate queues, sequence number allocation is deferred
  11641. +until dequeue. This doesn't work for PS response frames, which bypass
  11642. +those queues.
  11643. +
  11644. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  11645. +---
  11646. +
  11647. +--- a/net/mac80211/tx.c
  11648. ++++ b/net/mac80211/tx.c
  11649. +@@ -792,6 +792,36 @@ static __le16 ieee80211_tx_next_seq(stru
  11650. + return ret;
  11651. + }
  11652. +
  11653. ++static struct txq_info *ieee80211_get_txq(struct ieee80211_local *local,
  11654. ++ struct ieee80211_vif *vif,
  11655. ++ struct ieee80211_sta *pubsta,
  11656. ++ struct sk_buff *skb)
  11657. ++{
  11658. ++ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  11659. ++ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  11660. ++ struct ieee80211_txq *txq = NULL;
  11661. ++
  11662. ++ if ((info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) ||
  11663. ++ (info->control.flags & IEEE80211_TX_CTRL_PS_RESPONSE))
  11664. ++ return NULL;
  11665. ++
  11666. ++ if (!ieee80211_is_data(hdr->frame_control))
  11667. ++ return NULL;
  11668. ++
  11669. ++ if (pubsta) {
  11670. ++ u8 tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK;
  11671. ++
  11672. ++ txq = pubsta->txq[tid];
  11673. ++ } else if (vif) {
  11674. ++ txq = vif->txq;
  11675. ++ }
  11676. ++
  11677. ++ if (!txq)
  11678. ++ return NULL;
  11679. ++
  11680. ++ return to_txq_info(txq);
  11681. ++}
  11682. ++
  11683. + static ieee80211_tx_result debug_noinline
  11684. + ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx)
  11685. + {
  11686. +@@ -849,7 +879,8 @@ ieee80211_tx_h_sequence(struct ieee80211
  11687. + tid = *qc & IEEE80211_QOS_CTL_TID_MASK;
  11688. + tx->sta->tx_stats.msdu[tid]++;
  11689. +
  11690. +- if (!tx->sta->sta.txq[0])
  11691. ++ if (!ieee80211_get_txq(tx->local, info->control.vif, &tx->sta->sta,
  11692. ++ tx->skb))
  11693. + hdr->seq_ctrl = ieee80211_tx_next_seq(tx->sta, tid);
  11694. +
  11695. + return TX_CONTINUE;
  11696. +@@ -1238,36 +1269,6 @@ ieee80211_tx_prepare(struct ieee80211_su
  11697. + return TX_CONTINUE;
  11698. + }
  11699. +
  11700. +-static struct txq_info *ieee80211_get_txq(struct ieee80211_local *local,
  11701. +- struct ieee80211_vif *vif,
  11702. +- struct ieee80211_sta *pubsta,
  11703. +- struct sk_buff *skb)
  11704. +-{
  11705. +- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
  11706. +- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
  11707. +- struct ieee80211_txq *txq = NULL;
  11708. +-
  11709. +- if ((info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) ||
  11710. +- (info->control.flags & IEEE80211_TX_CTRL_PS_RESPONSE))
  11711. +- return NULL;
  11712. +-
  11713. +- if (!ieee80211_is_data(hdr->frame_control))
  11714. +- return NULL;
  11715. +-
  11716. +- if (pubsta) {
  11717. +- u8 tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK;
  11718. +-
  11719. +- txq = pubsta->txq[tid];
  11720. +- } else if (vif) {
  11721. +- txq = vif->txq;
  11722. +- }
  11723. +-
  11724. +- if (!txq)
  11725. +- return NULL;
  11726. +-
  11727. +- return to_txq_info(txq);
  11728. +-}
  11729. +-
  11730. + static void ieee80211_set_skb_enqueue_time(struct sk_buff *skb)
  11731. + {
  11732. + IEEE80211_SKB_CB(skb)->control.enqueue_time = codel_get_time();
  11733. +@@ -3265,7 +3266,7 @@ static bool ieee80211_xmit_fast(struct i
  11734. +
  11735. + if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) {
  11736. + *ieee80211_get_qos_ctl(hdr) = tid;
  11737. +- if (!sta->sta.txq[0])
  11738. ++ if (!ieee80211_get_txq(local, &sdata->vif, &sta->sta, skb))
  11739. + hdr->seq_ctrl = ieee80211_tx_next_seq(sta, tid);
  11740. + } else {
  11741. + info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ;
  11742. diff --git a/package/kernel/mac80211/patches/402-ath_regd_optional.patch b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  11743. index 7351353..4634283 100644
  11744. --- a/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  11745. +++ b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  11746. @@ -8,7 +8,7 @@
  11747. + return;
  11748. +#endif
  11749. +
  11750. - for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
  11751. + for (band = 0; band < NUM_NL80211_BANDS; band++) {
  11752. if (!wiphy->bands[band])
  11753. continue;
  11754. @@ -374,6 +378,10 @@ ath_reg_apply_ir_flags(struct wiphy *wip
  11755. @@ -19,7 +19,7 @@
  11756. + return;
  11757. +#endif
  11758. +
  11759. - sband = wiphy->bands[IEEE80211_BAND_2GHZ];
  11760. + sband = wiphy->bands[NL80211_BAND_2GHZ];
  11761. if (!sband)
  11762. return;
  11763. @@ -402,6 +410,10 @@ static void ath_reg_apply_radar_flags(st
  11764. @@ -30,7 +30,7 @@
  11765. + return;
  11766. +#endif
  11767. +
  11768. - if (!wiphy->bands[IEEE80211_BAND_5GHZ])
  11769. + if (!wiphy->bands[NL80211_BAND_5GHZ])
  11770. return;
  11771. @@ -633,6 +645,11 @@ ath_regd_init_wiphy(struct ath_regulator
  11772. @@ -59,7 +59,7 @@
  11773. ---help---
  11774. --- a/.local-symbols
  11775. +++ b/.local-symbols
  11776. -@@ -125,6 +125,7 @@ ADM8211=
  11777. +@@ -127,6 +127,7 @@ ADM8211=
  11778. ATH_COMMON=
  11779. WLAN_VENDOR_ATH=
  11780. ATH_DEBUG=
  11781. 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
  11782. index 1a62484..f2f52f9 100644
  11783. --- a/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
  11784. +++ b/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
  11785. @@ -1,6 +1,6 @@
  11786. --- a/drivers/net/wireless/ath/ath9k/init.c
  11787. +++ b/drivers/net/wireless/ath/ath9k/init.c
  11788. -@@ -722,6 +722,7 @@ static const struct ieee80211_iface_limi
  11789. +@@ -727,6 +727,7 @@ static const struct ieee80211_iface_limi
  11790. BIT(NL80211_IFTYPE_AP) },
  11791. { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
  11792. BIT(NL80211_IFTYPE_P2P_GO) },
  11793. diff --git a/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch b/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch
  11794. index a7f9d9f..f21eed1 100644
  11795. --- a/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch
  11796. +++ b/package/kernel/mac80211/patches/500-ath9k_eeprom_debugfs.patch
  11797. @@ -1,6 +1,6 @@
  11798. --- a/drivers/net/wireless/ath/ath9k/debug.c
  11799. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  11800. -@@ -1301,6 +1301,53 @@ void ath9k_deinit_debug(struct ath_softc
  11801. +@@ -1315,6 +1315,53 @@ void ath9k_deinit_debug(struct ath_softc
  11802. ath9k_cmn_spectral_deinit_debug(&sc->spec_priv);
  11803. }
  11804. @@ -54,7 +54,7 @@
  11805. int ath9k_init_debug(struct ath_hw *ah)
  11806. {
  11807. struct ath_common *common = ath9k_hw_common(ah);
  11808. -@@ -1320,6 +1367,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  11809. +@@ -1334,6 +1381,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  11810. ath9k_tx99_init_debug(sc);
  11811. ath9k_cmn_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy);
  11812. diff --git a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  11813. index 5892c3e..1825d77 100644
  11814. --- a/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  11815. +++ b/package/kernel/mac80211/patches/501-ath9k_ahb_init.patch
  11816. @@ -1,6 +1,6 @@
  11817. --- a/drivers/net/wireless/ath/ath9k/init.c
  11818. +++ b/drivers/net/wireless/ath/ath9k/init.c
  11819. -@@ -1024,23 +1024,23 @@ static int __init ath9k_init(void)
  11820. +@@ -1030,23 +1030,23 @@ static int __init ath9k_init(void)
  11821. {
  11822. int error;
  11823. diff --git a/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch b/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  11824. index 6766111..15b8d7b 100644
  11825. --- a/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  11826. +++ b/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch
  11827. @@ -8,4 +8,4 @@
  11828. +#define ATH_RXBUF 256
  11829. #define ATH_TXBUF 512
  11830. #define ATH_TXBUF_RESERVE 5
  11831. - #define ATH_MAX_QDEPTH (ATH_TXBUF / 4 - ATH_TXBUF_RESERVE)
  11832. + #define ATH_TXMAXTRY 13
  11833. diff --git a/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch b/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
  11834. index 5ecf528..c98072b 100644
  11835. --- a/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
  11836. +++ b/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch
  11837. @@ -1,6 +1,6 @@
  11838. --- a/drivers/net/wireless/ath/ath9k/debug.c
  11839. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  11840. -@@ -1348,6 +1348,52 @@ static const struct file_operations fops
  11841. +@@ -1362,6 +1362,52 @@ static const struct file_operations fops
  11842. .owner = THIS_MODULE
  11843. };
  11844. @@ -53,7 +53,7 @@
  11845. int ath9k_init_debug(struct ath_hw *ah)
  11846. {
  11847. struct ath_common *common = ath9k_hw_common(ah);
  11848. -@@ -1369,6 +1415,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  11849. +@@ -1383,6 +1429,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  11850. debugfs_create_file("eeprom", S_IRUSR, sc->debug.debugfs_phy, sc,
  11851. &fops_eeprom);
  11852. @@ -90,7 +90,7 @@
  11853. ichan->channel = chan->center_freq;
  11854. ichan->chan = chan;
  11855. @@ -308,7 +310,19 @@ static void ath9k_cmn_update_ichannel(st
  11856. - if (chan->band == IEEE80211_BAND_5GHZ)
  11857. + if (chan->band == NL80211_BAND_5GHZ)
  11858. flags |= CHANNEL_5GHZ;
  11859. - switch (chandef->width) {
  11860. diff --git a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  11861. index c84d1bc..167eeff 100644
  11862. --- a/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  11863. +++ b/package/kernel/mac80211/patches/513-ath9k_add_pci_ids.patch
  11864. @@ -20,7 +20,7 @@
  11865. #define AR9160_DEVID_PCI 0x0027
  11866. --- a/drivers/net/wireless/ath/ath9k/pci.c
  11867. +++ b/drivers/net/wireless/ath/ath9k/pci.c
  11868. -@@ -751,6 +751,7 @@ static const struct pci_device_id ath_pc
  11869. +@@ -761,6 +761,7 @@ static const struct pci_device_id ath_pc
  11870. .driver_data = ATH9K_PCI_BT_ANT_DIV },
  11871. #endif
  11872. diff --git a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  11873. index e151a12..c40598d 100644
  11874. --- a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  11875. +++ b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
  11876. @@ -1,6 +1,6 @@
  11877. --- a/include/net/cfg80211.h
  11878. +++ b/include/net/cfg80211.h
  11879. -@@ -2363,6 +2363,7 @@ struct cfg80211_qos_map {
  11880. +@@ -2410,6 +2410,7 @@ struct cfg80211_qos_map {
  11881. * (as advertised by the nl80211 feature flag.)
  11882. * @get_tx_power: store the current TX power into the dbm variable;
  11883. * return 0 if successful
  11884. @@ -8,7 +8,7 @@
  11885. *
  11886. * @set_wds_peer: set the WDS peer for a WDS interface
  11887. *
  11888. -@@ -2624,6 +2625,7 @@ struct cfg80211_ops {
  11889. +@@ -2671,6 +2672,7 @@ struct cfg80211_ops {
  11890. enum nl80211_tx_power_setting type, int mbm);
  11891. int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
  11892. int *dbm);
  11893. @@ -18,7 +18,7 @@
  11894. const u8 *addr);
  11895. --- a/include/net/mac80211.h
  11896. +++ b/include/net/mac80211.h
  11897. -@@ -1286,6 +1286,7 @@ enum ieee80211_smps_mode {
  11898. +@@ -1317,6 +1317,7 @@ enum ieee80211_smps_mode {
  11899. *
  11900. * @power_level: requested transmit power (in dBm), backward compatibility
  11901. * value only that is set to the minimum of all interfaces
  11902. @@ -26,7 +26,7 @@
  11903. *
  11904. * @chandef: the channel definition to tune to
  11905. * @radar_enabled: whether radar detection is enabled
  11906. -@@ -1306,6 +1307,7 @@ enum ieee80211_smps_mode {
  11907. +@@ -1337,6 +1338,7 @@ enum ieee80211_smps_mode {
  11908. struct ieee80211_conf {
  11909. u32 flags;
  11910. int power_level, dynamic_ps_timeout;
  11911. @@ -36,9 +36,9 @@
  11912. u8 ps_dtim_period;
  11913. --- a/include/uapi/linux/nl80211.h
  11914. +++ b/include/uapi/linux/nl80211.h
  11915. -@@ -1790,6 +1790,9 @@ enum nl80211_commands {
  11916. - * between scans. The scan plans are executed sequentially.
  11917. - * Each scan plan is a nested attribute of &enum nl80211_sched_scan_plan.
  11918. +@@ -1829,6 +1829,9 @@ enum nl80211_commands {
  11919. + * %NL80211_ATTR_EXT_CAPA_MASK, to specify the extended capabilities per
  11920. + * interface type.
  11921. *
  11922. + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
  11923. + * transmit power to stay within regulatory limits. u32, dBi.
  11924. @@ -46,9 +46,9 @@
  11925. * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  11926. * @NL80211_ATTR_MAX: highest attribute number currently defined
  11927. * @__NL80211_ATTR_AFTER_LAST: internal use
  11928. -@@ -2164,6 +2167,8 @@ enum nl80211_attrs {
  11929. - NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS,
  11930. - NL80211_ATTR_SCHED_SCAN_PLANS,
  11931. +@@ -2213,6 +2216,8 @@ enum nl80211_attrs {
  11932. +
  11933. + NL80211_ATTR_IFTYPE_EXT_CAPA,
  11934. + NL80211_ATTR_WIPHY_ANTENNA_GAIN,
  11935. +
  11936. @@ -57,7 +57,7 @@
  11937. __NL80211_ATTR_AFTER_LAST,
  11938. --- a/net/mac80211/cfg.c
  11939. +++ b/net/mac80211/cfg.c
  11940. -@@ -2229,6 +2229,19 @@ static int ieee80211_get_tx_power(struct
  11941. +@@ -2238,6 +2238,19 @@ static int ieee80211_get_tx_power(struct
  11942. return 0;
  11943. }
  11944. @@ -77,7 +77,7 @@
  11945. static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev,
  11946. const u8 *addr)
  11947. {
  11948. -@@ -3403,6 +3416,7 @@ const struct cfg80211_ops mac80211_confi
  11949. +@@ -3412,6 +3425,7 @@ const struct cfg80211_ops mac80211_confi
  11950. .set_wiphy_params = ieee80211_set_wiphy_params,
  11951. .set_tx_power = ieee80211_set_tx_power,
  11952. .get_tx_power = ieee80211_get_tx_power,
  11953. @@ -87,7 +87,7 @@
  11954. CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd)
  11955. --- a/net/mac80211/ieee80211_i.h
  11956. +++ b/net/mac80211/ieee80211_i.h
  11957. -@@ -1318,6 +1318,7 @@ struct ieee80211_local {
  11958. +@@ -1338,6 +1338,7 @@ struct ieee80211_local {
  11959. int dynamic_ps_forced_timeout;
  11960. int user_power_level; /* in dBm, for all interfaces */
  11961. @@ -119,7 +119,7 @@
  11962. if (local->hw.conf.power_level != power) {
  11963. changed |= IEEE80211_CONF_CHANGE_POWER;
  11964. local->hw.conf.power_level = power;
  11965. -@@ -586,6 +592,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
  11966. +@@ -588,6 +594,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
  11967. IEEE80211_RADIOTAP_MCS_HAVE_BW;
  11968. local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI |
  11969. IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH;
  11970. @@ -129,15 +129,15 @@
  11971. local->user_power_level = IEEE80211_UNSET_POWER_LEVEL;
  11972. --- a/net/wireless/nl80211.c
  11973. +++ b/net/wireless/nl80211.c
  11974. -@@ -403,6 +403,7 @@ static const struct nla_policy nl80211_p
  11975. - [NL80211_ATTR_NETNS_FD] = { .type = NLA_U32 },
  11976. - [NL80211_ATTR_SCHED_SCAN_DELAY] = { .type = NLA_U32 },
  11977. - [NL80211_ATTR_REG_INDOOR] = { .type = NLA_FLAG },
  11978. +@@ -407,6 +407,7 @@ static const struct nla_policy nl80211_p
  11979. + [NL80211_ATTR_PBSS] = { .type = NLA_FLAG },
  11980. + [NL80211_ATTR_BSS_SELECT] = { .type = NLA_NESTED },
  11981. + [NL80211_ATTR_STA_SUPPORT_P2P_PS] = { .type = NLA_U8 },
  11982. + [NL80211_ATTR_WIPHY_ANTENNA_GAIN] = { .type = NLA_U32 },
  11983. };
  11984. /* policy for the key attributes */
  11985. -@@ -2220,6 +2221,20 @@ static int nl80211_set_wiphy(struct sk_b
  11986. +@@ -2294,6 +2295,20 @@ static int nl80211_set_wiphy(struct sk_b
  11987. if (result)
  11988. return result;
  11989. }
  11990. diff --git a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  11991. index 5a5e464..69147f6 100644
  11992. --- a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  11993. +++ b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
  11994. @@ -1,16 +1,16 @@
  11995. --- a/drivers/net/wireless/ath/ath9k/ath9k.h
  11996. +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  11997. -@@ -814,6 +814,9 @@ static inline int ath9k_dump_btcoex(stru
  11998. +@@ -827,6 +827,9 @@ static inline int ath9k_dump_btcoex(stru
  11999. + #ifdef CPTCFG_MAC80211_LEDS
  12000. void ath_init_leds(struct ath_softc *sc);
  12001. void ath_deinit_leds(struct ath_softc *sc);
  12002. - void ath_fill_led_pin(struct ath_softc *sc);
  12003. +int ath_create_gpio_led(struct ath_softc *sc, int gpio, const char *name,
  12004. -+ const char *trigger, bool active_low);
  12005. ++ const char *trigger, bool active_low);
  12006. +
  12007. #else
  12008. static inline void ath_init_leds(struct ath_softc *sc)
  12009. {
  12010. -@@ -953,6 +956,13 @@ void ath_ant_comb_scan(struct ath_softc
  12011. +@@ -963,6 +966,13 @@ void ath_ant_comb_scan(struct ath_softc
  12012. #define ATH9K_NUM_CHANCTX 2 /* supports 2 operating channels */
  12013. @@ -24,7 +24,7 @@
  12014. struct ath_softc {
  12015. struct ieee80211_hw *hw;
  12016. struct device *dev;
  12017. -@@ -1005,9 +1015,8 @@ struct ath_softc {
  12018. +@@ -1015,9 +1025,8 @@ struct ath_softc {
  12019. spinlock_t chan_lock;
  12020. #ifdef CPTCFG_MAC80211_LEDS
  12021. @@ -38,24 +38,33 @@
  12022. #ifdef CPTCFG_ATH9K_DEBUGFS
  12023. --- a/drivers/net/wireless/ath/ath9k/gpio.c
  12024. +++ b/drivers/net/wireless/ath/ath9k/gpio.c
  12025. -@@ -24,45 +24,102 @@
  12026. - static void ath_led_brightness(struct led_classdev *led_cdev,
  12027. - enum led_brightness brightness)
  12028. +@@ -22,7 +22,7 @@
  12029. +
  12030. + #ifdef CPTCFG_MAC80211_LEDS
  12031. +
  12032. +-void ath_fill_led_pin(struct ath_softc *sc)
  12033. ++static void ath_fill_led_pin(struct ath_softc *sc)
  12034. {
  12035. -- struct ath_softc *sc = container_of(led_cdev, struct ath_softc, led_cdev);
  12036. -- u32 val = (brightness == LED_OFF);
  12037. + struct ath_hw *ah = sc->sc_ah;
  12038. +
  12039. +@@ -39,61 +39,111 @@ void ath_fill_led_pin(struct ath_softc *
  12040. + else
  12041. + ah->led_pin = ATH_LED_PIN_DEF;
  12042. + }
  12043. ++}
  12044. ++
  12045. ++static void ath_led_brightness(struct led_classdev *led_cdev,
  12046. ++ enum led_brightness brightness)
  12047. ++{
  12048. + struct ath_led *led = container_of(led_cdev, struct ath_led, cdev);
  12049. + struct ath_softc *sc = led->sc;
  12050. -
  12051. -- if (sc->sc_ah->config.led_active_high)
  12052. -- val = !val;
  12053. ++
  12054. + ath9k_ps_wakeup(sc);
  12055. + ath9k_hw_set_gpio(sc->sc_ah, led->gpio->gpio,
  12056. + (brightness != LED_OFF) ^ led->gpio->active_low);
  12057. + ath9k_ps_restore(sc);
  12058. +}
  12059. -
  12060. -- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val);
  12061. ++
  12062. +static int ath_add_led(struct ath_softc *sc, struct ath_led *led)
  12063. +{
  12064. + const struct gpio_led *gpio = led->gpio;
  12065. @@ -71,30 +80,40 @@
  12066. +
  12067. + led->sc = sc;
  12068. + list_add(&led->list, &sc->leds);
  12069. -+
  12070. -+ /* Configure gpio for output */
  12071. -+ ath9k_hw_cfg_output(sc->sc_ah, gpio->gpio,
  12072. -+ AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  12073. -+
  12074. +
  12075. + /* Configure gpio for output */
  12076. +- ath9k_hw_gpio_request_out(ah, ah->led_pin, "ath9k-led",
  12077. ++ ath9k_hw_gpio_request_out(sc->sc_ah, gpio->gpio, gpio->name,
  12078. + AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  12079. +
  12080. +- /* LED off, active low */
  12081. +- ath9k_hw_set_gpio(ah, ah->led_pin, ah->config.led_active_high ? 0 : 1);
  12082. + /* LED off */
  12083. + ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  12084. +
  12085. + return 0;
  12086. -+}
  12087. -+
  12088. + }
  12089. +
  12090. +-static void ath_led_brightness(struct led_classdev *led_cdev,
  12091. +- enum led_brightness brightness)
  12092. +int ath_create_gpio_led(struct ath_softc *sc, int gpio_num, const char *name,
  12093. + const char *trigger, bool active_low)
  12094. -+{
  12095. + {
  12096. +- struct ath_softc *sc = container_of(led_cdev, struct ath_softc, led_cdev);
  12097. +- u32 val = (brightness == LED_OFF);
  12098. + struct ath_led *led;
  12099. + struct gpio_led *gpio;
  12100. + char *_name;
  12101. + int ret;
  12102. -+
  12103. +
  12104. +- if (sc->sc_ah->config.led_active_high)
  12105. +- val = !val;
  12106. + led = kzalloc(sizeof(*led) + sizeof(*gpio) + strlen(name) + 1,
  12107. + GFP_KERNEL);
  12108. + if (!led)
  12109. + return -ENOMEM;
  12110. -+
  12111. +
  12112. +- ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val);
  12113. + led->gpio = gpio = (struct gpio_led *) (led + 1);
  12114. + _name = (char *) (led->gpio + 1);
  12115. +
  12116. @@ -115,15 +134,18 @@
  12117. {
  12118. - if (!sc->led_registered)
  12119. - return;
  12120. -+ struct ath_led *led;
  12121. -
  12122. +-
  12123. - ath_led_brightness(&sc->led_cdev, LED_OFF);
  12124. - led_classdev_unregister(&sc->led_cdev);
  12125. ++ struct ath_led *led;
  12126. +
  12127. +- ath9k_hw_gpio_free(sc->sc_ah, sc->sc_ah->led_pin);
  12128. + while (!list_empty(&sc->leds)) {
  12129. + led = list_first_entry(&sc->leds, struct ath_led, list);
  12130. + list_del(&led->list);
  12131. + ath_led_brightness(&led->cdev, LED_OFF);
  12132. + led_classdev_unregister(&led->cdev);
  12133. ++ ath9k_hw_gpio_free(sc->sc_ah, led->gpio->gpio);
  12134. + kfree(led);
  12135. + }
  12136. }
  12137. @@ -139,6 +161,8 @@
  12138. if (AR_SREV_9100(sc->sc_ah))
  12139. return;
  12140. + ath_fill_led_pin(sc);
  12141. +
  12142. - if (!ath9k_led_blink)
  12143. - sc->led_cdev.default_trigger =
  12144. - ieee80211_get_radio_led_name(sc->hw);
  12145. @@ -159,13 +183,14 @@
  12146. + trigger = ieee80211_get_radio_led_name(sc->hw);
  12147. - sc->led_registered = true;
  12148. -+ ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, !sc->sc_ah->config.led_active_high);
  12149. ++ ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
  12150. ++ !sc->sc_ah->config.led_active_high);
  12151. }
  12152. + #endif
  12153. - void ath_fill_led_pin(struct ath_softc *sc)
  12154. --- a/drivers/net/wireless/ath/ath9k/init.c
  12155. +++ b/drivers/net/wireless/ath/ath9k/init.c
  12156. -@@ -936,7 +936,7 @@ int ath9k_init_device(u16 devid, struct
  12157. +@@ -942,7 +942,7 @@ int ath9k_init_device(u16 devid, struct
  12158. #ifdef CPTCFG_MAC80211_LEDS
  12159. /* must be initialized before ieee80211_register_hw */
  12160. @@ -176,7 +201,7 @@
  12161. #endif
  12162. --- a/drivers/net/wireless/ath/ath9k/debug.c
  12163. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  12164. -@@ -1393,6 +1393,61 @@ static const struct file_operations fops
  12165. +@@ -1407,6 +1407,61 @@ static const struct file_operations fops
  12166. .llseek = default_llseek,
  12167. };
  12168. @@ -238,7 +263,7 @@
  12169. int ath9k_init_debug(struct ath_hw *ah)
  12170. {
  12171. -@@ -1417,6 +1472,10 @@ int ath9k_init_debug(struct ath_hw *ah)
  12172. +@@ -1431,6 +1486,10 @@ int ath9k_init_debug(struct ath_hw *ah)
  12173. &fops_eeprom);
  12174. debugfs_create_file("chanbw", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
  12175. sc, &fops_chanbw);
  12176. diff --git a/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch b/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
  12177. index 7c10ea6..f656697 100644
  12178. --- a/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
  12179. +++ b/package/kernel/mac80211/patches/531-ath9k_extra_platform_leds.patch
  12180. @@ -1,6 +1,6 @@
  12181. --- a/include/linux/ath9k_platform.h
  12182. +++ b/include/linux/ath9k_platform.h
  12183. -@@ -41,6 +41,9 @@ struct ath9k_platform_data {
  12184. +@@ -45,6 +45,9 @@ struct ath9k_platform_data {
  12185. int (*external_reset)(void);
  12186. bool use_eeprom;
  12187. @@ -20,7 +20,7 @@
  12188. /********************************/
  12189. /* LED functions */
  12190. -@@ -88,6 +89,24 @@ int ath_create_gpio_led(struct ath_softc
  12191. +@@ -108,6 +109,24 @@ int ath_create_gpio_led(struct ath_softc
  12192. return ret;
  12193. }
  12194. @@ -45,7 +45,7 @@
  12195. void ath_deinit_leds(struct ath_softc *sc)
  12196. {
  12197. struct ath_led *led;
  12198. -@@ -103,8 +122,10 @@ void ath_deinit_leds(struct ath_softc *s
  12199. +@@ -124,8 +143,10 @@ void ath_deinit_leds(struct ath_softc *s
  12200. void ath_init_leds(struct ath_softc *sc)
  12201. {
  12202. @@ -56,10 +56,10 @@
  12203. INIT_LIST_HEAD(&sc->leds);
  12204. -@@ -120,6 +141,12 @@ void ath_init_leds(struct ath_softc *sc)
  12205. - trigger = ieee80211_get_radio_led_name(sc->hw);
  12206. +@@ -144,6 +165,12 @@ void ath_init_leds(struct ath_softc *sc)
  12207. - ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, !sc->sc_ah->config.led_active_high);
  12208. + ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
  12209. + !sc->sc_ah->config.led_active_high);
  12210. +
  12211. + if (!pdata)
  12212. + return;
  12213. @@ -67,5 +67,5 @@
  12214. + for (i = 0; i < pdata->num_leds; i++)
  12215. + ath_create_platform_led(sc, &pdata->leds[i]);
  12216. }
  12217. + #endif
  12218. - void ath_fill_led_pin(struct ath_softc *sc)
  12219. 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
  12220. index 6d62a2b..50d8a7a 100644
  12221. --- a/package/kernel/mac80211/patches/532-ath9k_get_led_polarity_from_platform_data.patch
  12222. +++ b/package/kernel/mac80211/patches/532-ath9k_get_led_polarity_from_platform_data.patch
  12223. @@ -1,6 +1,6 @@
  12224. --- a/include/linux/ath9k_platform.h
  12225. +++ b/include/linux/ath9k_platform.h
  12226. -@@ -36,6 +36,7 @@ struct ath9k_platform_data {
  12227. +@@ -40,6 +40,7 @@ struct ath9k_platform_data {
  12228. bool tx_gain_buffalo;
  12229. bool disable_2ghz;
  12230. bool disable_5ghz;
  12231. @@ -10,7 +10,7 @@
  12232. int (*external_reset)(void);
  12233. --- a/drivers/net/wireless/ath/ath9k/init.c
  12234. +++ b/drivers/net/wireless/ath/ath9k/init.c
  12235. -@@ -577,6 +577,7 @@ static int ath9k_init_softc(u16 devid, s
  12236. +@@ -580,6 +580,7 @@ static int ath9k_init_softc(u16 devid, s
  12237. ah->external_reset = pdata->external_reset;
  12238. ah->disable_2ghz = pdata->disable_2ghz;
  12239. ah->disable_5ghz = pdata->disable_5ghz;
  12240. diff --git a/package/kernel/mac80211/patches/541-ath9k_rx_dma_stop_check.patch b/package/kernel/mac80211/patches/541-ath9k_rx_dma_stop_check.patch
  12241. index 3c5e9f5..c2d2781 100644
  12242. --- a/package/kernel/mac80211/patches/541-ath9k_rx_dma_stop_check.patch
  12243. +++ b/package/kernel/mac80211/patches/541-ath9k_rx_dma_stop_check.patch
  12244. @@ -1,6 +1,6 @@
  12245. --- a/drivers/net/wireless/ath/ath9k/mac.c
  12246. +++ b/drivers/net/wireless/ath/ath9k/mac.c
  12247. -@@ -695,7 +695,7 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
  12248. +@@ -698,7 +698,7 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
  12249. {
  12250. #define AH_RX_STOP_DMA_TIMEOUT 10000 /* usec */
  12251. struct ath_common *common = ath9k_hw_common(ah);
  12252. @@ -9,7 +9,7 @@
  12253. int i;
  12254. /* Enable access to the DMA observation bus */
  12255. -@@ -725,6 +725,16 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
  12256. +@@ -728,6 +728,16 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
  12257. }
  12258. if (i == 0) {
  12259. diff --git a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  12260. index e83c6bf..6edef09 100644
  12261. --- a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  12262. +++ b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
  12263. @@ -1,6 +1,6 @@
  12264. --- a/drivers/net/wireless/ath/ath9k/debug.c
  12265. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  12266. -@@ -1449,6 +1449,50 @@ static const struct file_operations fops
  12267. +@@ -1463,6 +1463,50 @@ static const struct file_operations fops
  12268. #endif
  12269. @@ -51,7 +51,7 @@
  12270. int ath9k_init_debug(struct ath_hw *ah)
  12271. {
  12272. struct ath_common *common = ath9k_hw_common(ah);
  12273. -@@ -1476,6 +1520,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  12274. +@@ -1490,6 +1534,8 @@ int ath9k_init_debug(struct ath_hw *ah)
  12275. debugfs_create_file("gpio_led", S_IWUSR,
  12276. sc->debug.debugfs_phy, sc, &fops_gpio_led);
  12277. #endif
  12278. @@ -62,7 +62,7 @@
  12279. debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy,
  12280. --- a/drivers/net/wireless/ath/ath9k/hw.h
  12281. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  12282. -@@ -519,6 +519,12 @@ enum {
  12283. +@@ -520,6 +520,12 @@ enum {
  12284. ATH9K_RESET_COLD,
  12285. };
  12286. @@ -75,7 +75,7 @@
  12287. struct ath9k_hw_version {
  12288. u32 magic;
  12289. u16 devid;
  12290. -@@ -804,6 +810,8 @@ struct ath_hw {
  12291. +@@ -805,6 +811,8 @@ struct ath_hw {
  12292. u32 rfkill_polarity;
  12293. u32 ah_flags;
  12294. @@ -84,7 +84,7 @@
  12295. bool reset_power_on;
  12296. bool htc_reset_init;
  12297. -@@ -1066,6 +1074,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
  12298. +@@ -1067,6 +1075,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
  12299. bool ath9k_hw_check_alive(struct ath_hw *ah);
  12300. bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode);
  12301. @@ -94,7 +94,7 @@
  12302. struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah,
  12303. --- a/drivers/net/wireless/ath/ath9k/hw.c
  12304. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  12305. -@@ -1819,6 +1819,20 @@ u32 ath9k_hw_get_tsf_offset(struct times
  12306. +@@ -1841,6 +1841,20 @@ u32 ath9k_hw_get_tsf_offset(struct times
  12307. }
  12308. EXPORT_SYMBOL(ath9k_hw_get_tsf_offset);
  12309. @@ -115,7 +115,7 @@
  12310. int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
  12311. struct ath9k_hw_cal_data *caldata, bool fastcc)
  12312. {
  12313. -@@ -2027,6 +2041,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  12314. +@@ -2049,6 +2063,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  12315. ar9003_hw_disable_phy_restart(ah);
  12316. ath9k_hw_apply_gpio_override(ah);
  12317. diff --git a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  12318. index d7bb5a1..656ed43 100644
  12319. --- a/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  12320. +++ b/package/kernel/mac80211/patches/543-ath9k_entropy_from_adc.patch
  12321. @@ -1,6 +1,6 @@
  12322. --- a/drivers/net/wireless/ath/ath9k/hw.h
  12323. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  12324. -@@ -720,6 +720,7 @@ struct ath_spec_scan {
  12325. +@@ -721,6 +721,7 @@ struct ath_spec_scan {
  12326. * @config_pci_powersave:
  12327. * @calibrate: periodic calibration for NF, ANI, IQ, ADC gain, ADC-DC
  12328. *
  12329. @@ -8,7 +8,7 @@
  12330. * @spectral_scan_config: set parameters for spectral scan and enable/disable it
  12331. * @spectral_scan_trigger: trigger a spectral scan run
  12332. * @spectral_scan_wait: wait for a spectral scan run to finish
  12333. -@@ -742,6 +743,7 @@ struct ath_hw_ops {
  12334. +@@ -743,6 +744,7 @@ struct ath_hw_ops {
  12335. struct ath_hw_antcomb_conf *antconf);
  12336. void (*antdiv_comb_conf_set)(struct ath_hw *ah,
  12337. struct ath_hw_antcomb_conf *antconf);
  12338. @@ -18,7 +18,7 @@
  12339. void (*spectral_scan_trigger)(struct ath_hw *ah);
  12340. --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  12341. +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  12342. -@@ -1998,6 +1998,26 @@ void ar9003_hw_init_rate_txpower(struct
  12343. +@@ -1945,6 +1945,26 @@ void ar9003_hw_init_rate_txpower(struct
  12344. }
  12345. }
  12346. @@ -45,7 +45,7 @@
  12347. void ar9003_hw_attach_phy_ops(struct ath_hw *ah)
  12348. {
  12349. struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
  12350. -@@ -2034,6 +2054,7 @@ void ar9003_hw_attach_phy_ops(struct ath
  12351. +@@ -1981,6 +2001,7 @@ void ar9003_hw_attach_phy_ops(struct ath
  12352. priv_ops->set_radar_params = ar9003_hw_set_radar_params;
  12353. priv_ops->fast_chan_change = ar9003_hw_fast_chan_change;
  12354. @@ -55,9 +55,9 @@
  12355. ops->spectral_scan_config = ar9003_hw_spectral_scan_config;
  12356. --- a/drivers/net/wireless/ath/ath9k/init.c
  12357. +++ b/drivers/net/wireless/ath/ath9k/init.c
  12358. -@@ -711,7 +711,8 @@ static void ath9k_init_txpower_limits(st
  12359. +@@ -716,7 +716,8 @@ static void ath9k_init_txpower_limits(st
  12360. if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
  12361. - ath9k_init_band_txpower(sc, IEEE80211_BAND_5GHZ);
  12362. + ath9k_init_band_txpower(sc, NL80211_BAND_5GHZ);
  12363. - ah->curchan = curchan;
  12364. + if (curchan)
  12365. @@ -65,7 +65,7 @@
  12366. }
  12367. static const struct ieee80211_iface_limit if_limits[] = {
  12368. -@@ -897,6 +898,18 @@ static void ath9k_set_hw_capab(struct at
  12369. +@@ -903,6 +904,18 @@ static void ath9k_set_hw_capab(struct at
  12370. SET_IEEE80211_PERM_ADDR(hw, common->macaddr);
  12371. }
  12372. @@ -84,7 +84,7 @@
  12373. int ath9k_init_device(u16 devid, struct ath_softc *sc,
  12374. const struct ath_bus_ops *bus_ops)
  12375. {
  12376. -@@ -942,6 +955,8 @@ int ath9k_init_device(u16 devid, struct
  12377. +@@ -948,6 +961,8 @@ int ath9k_init_device(u16 devid, struct
  12378. ARRAY_SIZE(ath9k_tpt_blink));
  12379. #endif
  12380. @@ -110,7 +110,7 @@
  12381. static inline void ath9k_hw_set_bt_ant_diversity(struct ath_hw *ah, bool enable)
  12382. --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  12383. +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  12384. -@@ -1327,9 +1327,30 @@ void ar5008_hw_init_rate_txpower(struct
  12385. +@@ -1325,9 +1325,30 @@ void ar5008_hw_init_rate_txpower(struct
  12386. }
  12387. }
  12388. @@ -141,7 +141,7 @@
  12389. static const u32 ar5416_cca_regs[6] = {
  12390. AR_PHY_CCA,
  12391. AR_PHY_CH1_CCA,
  12392. -@@ -1344,6 +1365,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
  12393. +@@ -1342,6 +1363,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
  12394. if (ret)
  12395. return ret;
  12396. @@ -175,7 +175,7 @@
  12397. #define AR_PHY_TIMING2 0x9810
  12398. #define AR_PHY_TIMING3 0x9814
  12399. #define AR_PHY_TIMING3_DSC_MAN 0xFFFE0000
  12400. -@@ -390,6 +399,8 @@
  12401. +@@ -393,6 +402,8 @@
  12402. #define AR_PHY_RFBUS_GRANT 0x9C20
  12403. #define AR_PHY_RFBUS_GRANT_EN 0x00000001
  12404. 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
  12405. index 8768c5d..b9c962e 100644
  12406. --- a/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch
  12407. +++ b/package/kernel/mac80211/patches/544-ath9k-ar933x-usb-hang-workaround.patch
  12408. @@ -20,9 +20,9 @@
  12409. /******************/
  12410. /* Chip Revisions */
  12411. /******************/
  12412. -@@ -1397,6 +1410,9 @@ static bool ath9k_hw_set_reset(struct at
  12413. - if (AR_SREV_9100(ah))
  12414. +@@ -1417,6 +1430,9 @@ static bool ath9k_hw_set_reset(struct at
  12415. udelay(50);
  12416. + }
  12417. + if (AR_SREV_9330(ah) || AR_SREV_9340(ah))
  12418. + ath9k_hw_disable_pll_lock_detect(ah);
  12419. @@ -30,7 +30,7 @@
  12420. return true;
  12421. }
  12422. -@@ -1496,6 +1512,9 @@ static bool ath9k_hw_chip_reset(struct a
  12423. +@@ -1516,6 +1532,9 @@ static bool ath9k_hw_chip_reset(struct a
  12424. ar9003_hw_internal_regulator_apply(ah);
  12425. ath9k_hw_init_pll(ah, chan);
  12426. @@ -40,7 +40,7 @@
  12427. return true;
  12428. }
  12429. -@@ -1797,8 +1816,14 @@ static int ath9k_hw_do_fastcc(struct ath
  12430. +@@ -1819,8 +1838,14 @@ static int ath9k_hw_do_fastcc(struct ath
  12431. if (AR_SREV_9271(ah))
  12432. ar9002_hw_load_ani_reg(ah, chan);
  12433. @@ -55,7 +55,7 @@
  12434. return -EINVAL;
  12435. }
  12436. -@@ -2052,6 +2077,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  12437. +@@ -2074,6 +2099,9 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  12438. ath9k_hw_set_radar_params(ah);
  12439. }
  12440. diff --git a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  12441. index 3d24ccd..b639f97 100644
  12442. --- a/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  12443. +++ b/package/kernel/mac80211/patches/545-ath9k_ani_ws_detect.patch
  12444. @@ -1,6 +1,6 @@
  12445. --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  12446. +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
  12447. -@@ -956,55 +956,6 @@ static bool ar5008_hw_ani_control_new(st
  12448. +@@ -954,55 +954,6 @@ static bool ar5008_hw_ani_control_new(st
  12449. * on == 0 means more noise imm
  12450. */
  12451. u32 on = param ? 1 : 0;
  12452. @@ -58,7 +58,7 @@
  12453. REG_SET_BIT(ah, AR_PHY_SFCORR_LOW,
  12454. --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  12455. +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
  12456. -@@ -41,20 +41,6 @@ static const int cycpwrThr1_table[] =
  12457. +@@ -42,20 +42,6 @@ static const int cycpwrThr1_table[] =
  12458. /* level: 0 1 2 3 4 5 6 7 8 */
  12459. { -6, -4, -2, 0, 2, 4, 6, 8 }; /* lvl 0-7, default 3 */
  12460. @@ -79,7 +79,7 @@
  12461. static const u8 ofdm2pwr[] = {
  12462. ALL_TARGET_LEGACY_6_24,
  12463. ALL_TARGET_LEGACY_6_24,
  12464. -@@ -1089,11 +1075,6 @@ static bool ar9003_hw_ani_control(struct
  12465. +@@ -1095,11 +1081,6 @@ static bool ar9003_hw_ani_control(struct
  12466. struct ath_common *common = ath9k_hw_common(ah);
  12467. struct ath9k_channel *chan = ah->curchan;
  12468. struct ar5416AniState *aniState = &ah->ani;
  12469. @@ -91,7 +91,7 @@
  12470. s32 value, value2;
  12471. switch (cmd & ah->ani_function) {
  12472. -@@ -1107,61 +1088,6 @@ static bool ar9003_hw_ani_control(struct
  12473. +@@ -1113,61 +1094,6 @@ static bool ar9003_hw_ani_control(struct
  12474. */
  12475. u32 on = param ? 1 : 0;
  12476. diff --git a/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch b/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch
  12477. new file mode 100644
  12478. index 0000000..ced72c6
  12479. --- /dev/null
  12480. +++ b/package/kernel/mac80211/patches/546-ath9k_platform_led_name.patch
  12481. @@ -0,0 +1,39 @@
  12482. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  12483. +Date: Sun, 31 Jan 2016 20:45:57 +0100
  12484. +Subject: [PATCH v4 1/8] mac80211: ath9k: enable platform WLAN LED name
  12485. +
  12486. +Enable platform-supplied WLAN LED name for ath9k device. It replaces generic
  12487. +'ath9k-phy*' label with string set during platform initialization.
  12488. +
  12489. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  12490. +---
  12491. + drivers/net/wireless/ath/ath9k/gpio.c | 10 +++++++---
  12492. + include/linux/ath9k_platform.h | 1 +
  12493. + 2 files changed, 8 insertions(+), 3 deletions(-)
  12494. +
  12495. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  12496. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  12497. +@@ -155,8 +155,11 @@ void ath_init_leds(struct ath_softc *sc)
  12498. +
  12499. + ath_fill_led_pin(sc);
  12500. +
  12501. +- snprintf(led_name, sizeof(led_name), "ath9k-%s",
  12502. +- wiphy_name(sc->hw->wiphy));
  12503. ++ if (pdata && pdata->led_name)
  12504. ++ strncpy(led_name, pdata->led_name, sizeof(led_name));
  12505. ++ else
  12506. ++ snprintf(led_name, sizeof(led_name), "ath9k-%s",
  12507. ++ wiphy_name(sc->hw->wiphy));
  12508. +
  12509. + if (ath9k_led_blink)
  12510. + trigger = sc->led_default_trigger;
  12511. +--- a/include/linux/ath9k_platform.h
  12512. ++++ b/include/linux/ath9k_platform.h
  12513. +@@ -49,6 +49,7 @@ struct ath9k_platform_data {
  12514. +
  12515. + int num_leds;
  12516. + const struct gpio_led *leds;
  12517. ++ const char *led_name;
  12518. + };
  12519. +
  12520. + #endif /* _LINUX_ATH9K_PLATFORM_H */
  12521. diff --git a/package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch b/package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch
  12522. new file mode 100644
  12523. index 0000000..5d84cf0
  12524. --- /dev/null
  12525. +++ b/package/kernel/mac80211/patches/547-ath9k_led_defstate_fix.patch
  12526. @@ -0,0 +1,29 @@
  12527. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  12528. +Date: Sun, 31 Jan 2016 20:48:49 +0100
  12529. +Subject: [PATCH v4 2/8] mac80211: ath9k: set default state for platform LEDs
  12530. +
  12531. +Support default state for platform LEDs connected to ath9k device.
  12532. +Now LEDs are correctly set on or off at ath9k module initialization.
  12533. +Very useful if power LED is connected to wireless chip.
  12534. +
  12535. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  12536. +---
  12537. + gpio.c | 7 +++++--
  12538. + 1 file changed, 5 insertions(+), 2 deletions(-)
  12539. +
  12540. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  12541. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  12542. +@@ -74,8 +74,11 @@ static int ath_add_led(struct ath_softc
  12543. + ath9k_hw_gpio_request_out(sc->sc_ah, gpio->gpio, gpio->name,
  12544. + AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  12545. +
  12546. +- /* LED off */
  12547. +- ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  12548. ++ /* Set default LED state */
  12549. ++ if (gpio->default_state == LEDS_GPIO_DEFSTATE_ON)
  12550. ++ ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, !gpio->active_low);
  12551. ++ else
  12552. ++ ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  12553. +
  12554. + return 0;
  12555. + }
  12556. diff --git a/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch b/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
  12557. new file mode 100644
  12558. index 0000000..1330dfe
  12559. --- /dev/null
  12560. +++ b/package/kernel/mac80211/patches/548-ath9k_enable_gpio_chip.patch
  12561. @@ -0,0 +1,234 @@
  12562. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  12563. +Date: Sun, 31 Jan 2016 21:01:31 +0100
  12564. +Subject: [PATCH v4 4/8] mac80211: ath9k: enable access to GPIO
  12565. +
  12566. +Enable access to GPIO chip and its pins for Atheros AR92xx
  12567. +wireless devices. For now AR9285 and AR9287 are supported.
  12568. +
  12569. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  12570. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  12571. +---
  12572. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  12573. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  12574. +@@ -24,6 +24,7 @@
  12575. + #include <linux/completion.h>
  12576. + #include <linux/time.h>
  12577. + #include <linux/hw_random.h>
  12578. ++#include <linux/gpio/driver.h>
  12579. +
  12580. + #include "common.h"
  12581. + #include "debug.h"
  12582. +@@ -973,6 +974,14 @@ struct ath_led {
  12583. + struct led_classdev cdev;
  12584. + };
  12585. +
  12586. ++#ifdef CONFIG_GPIOLIB
  12587. ++struct ath9k_gpio_chip {
  12588. ++ struct ath_softc *sc;
  12589. ++ char label[32];
  12590. ++ struct gpio_chip gchip;
  12591. ++};
  12592. ++#endif
  12593. ++
  12594. + struct ath_softc {
  12595. + struct ieee80211_hw *hw;
  12596. + struct device *dev;
  12597. +@@ -1027,6 +1036,9 @@ struct ath_softc {
  12598. + #ifdef CPTCFG_MAC80211_LEDS
  12599. + const char *led_default_trigger;
  12600. + struct list_head leds;
  12601. ++#ifdef CONFIG_GPIOLIB
  12602. ++ struct ath9k_gpio_chip *gpiochip;
  12603. ++#endif
  12604. + #endif
  12605. +
  12606. + #ifdef CPTCFG_ATH9K_DEBUGFS
  12607. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  12608. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  12609. +@@ -16,13 +16,135 @@
  12610. +
  12611. + #include "ath9k.h"
  12612. + #include <linux/ath9k_platform.h>
  12613. ++#include <linux/gpio.h>
  12614. ++
  12615. ++#ifdef CPTCFG_MAC80211_LEDS
  12616. ++
  12617. ++#ifdef CONFIG_GPIOLIB
  12618. ++
  12619. ++/***************/
  12620. ++/* GPIO Chip */
  12621. ++/***************/
  12622. ++
  12623. ++/* gpio_chip handler : set GPIO to input */
  12624. ++static int ath9k_gpio_pin_cfg_input(struct gpio_chip *chip, unsigned offset)
  12625. ++{
  12626. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  12627. ++ gchip);
  12628. ++
  12629. ++ ath9k_hw_gpio_request_in(gc->sc->sc_ah, offset, "ath9k-gpio");
  12630. ++
  12631. ++ return 0;
  12632. ++}
  12633. ++
  12634. ++/* gpio_chip handler : set GPIO to output */
  12635. ++static int ath9k_gpio_pin_cfg_output(struct gpio_chip *chip, unsigned offset,
  12636. ++ int value)
  12637. ++{
  12638. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  12639. ++ gchip);
  12640. ++
  12641. ++ ath9k_hw_gpio_request_out(gc->sc->sc_ah, offset, "ath9k-gpio",
  12642. ++ AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  12643. ++ ath9k_hw_set_gpio(gc->sc->sc_ah, offset, value);
  12644. ++
  12645. ++ return 0;
  12646. ++}
  12647. ++
  12648. ++/* gpio_chip handler : query GPIO direction (0=out, 1=in) */
  12649. ++static int ath9k_gpio_pin_get_dir(struct gpio_chip *chip, unsigned offset)
  12650. ++{
  12651. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  12652. ++ gchip);
  12653. ++ struct ath_hw *ah = gc->sc->sc_ah;
  12654. ++
  12655. ++ return !((REG_READ(ah, AR_GPIO_OE_OUT) >> (offset * 2)) & 3);
  12656. ++}
  12657. ++
  12658. ++/* gpio_chip handler : get GPIO pin value */
  12659. ++static int ath9k_gpio_pin_get(struct gpio_chip *chip, unsigned offset)
  12660. ++{
  12661. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  12662. ++ gchip);
  12663. ++
  12664. ++ return ath9k_hw_gpio_get(gc->sc->sc_ah, offset);
  12665. ++}
  12666. ++
  12667. ++/* gpio_chip handler : set GPIO pin to value */
  12668. ++static void ath9k_gpio_pin_set(struct gpio_chip *chip, unsigned offset,
  12669. ++ int value)
  12670. ++{
  12671. ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip,
  12672. ++ gchip);
  12673. ++
  12674. ++ ath9k_hw_set_gpio(gc->sc->sc_ah, offset, value);
  12675. ++}
  12676. ++
  12677. ++/* register GPIO chip */
  12678. ++static void ath9k_register_gpio_chip(struct ath_softc *sc)
  12679. ++{
  12680. ++ struct ath9k_gpio_chip *gc;
  12681. ++ struct ath_hw *ah = sc->sc_ah;
  12682. ++
  12683. ++ gc = kzalloc(sizeof(struct ath9k_gpio_chip), GFP_KERNEL);
  12684. ++ if (!gc)
  12685. ++ return;
  12686. ++
  12687. ++ snprintf(gc->label, sizeof(gc->label), "ath9k-%s",
  12688. ++ wiphy_name(sc->hw->wiphy));
  12689. ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0)
  12690. ++ gc->gchip.parent = sc->dev;
  12691. ++#else
  12692. ++ gc->gchip.dev = sc->dev;
  12693. ++#endif
  12694. ++ gc->gchip.label = gc->label;
  12695. ++ gc->gchip.base = -1; /* determine base automatically */
  12696. ++ gc->gchip.ngpio = ah->caps.num_gpio_pins;
  12697. ++ gc->gchip.direction_input = ath9k_gpio_pin_cfg_input;
  12698. ++ gc->gchip.direction_output = ath9k_gpio_pin_cfg_output;
  12699. ++ gc->gchip.get_direction = ath9k_gpio_pin_get_dir;
  12700. ++ gc->gchip.get = ath9k_gpio_pin_get;
  12701. ++ gc->gchip.set = ath9k_gpio_pin_set;
  12702. ++
  12703. ++ if (gpiochip_add(&gc->gchip)) {
  12704. ++ kfree(gc);
  12705. ++ return;
  12706. ++ }
  12707. ++
  12708. ++ gc->gchip.owner = NULL;
  12709. ++ sc->gpiochip = gc;
  12710. ++ gc->sc = sc;
  12711. ++}
  12712. ++
  12713. ++/* remove GPIO chip */
  12714. ++static void ath9k_unregister_gpio_chip(struct ath_softc *sc)
  12715. ++{
  12716. ++ struct ath9k_gpio_chip *gc = sc->gpiochip;
  12717. ++
  12718. ++ if (!gc)
  12719. ++ return;
  12720. ++
  12721. ++ gpiochip_remove(&gc->gchip);
  12722. ++ kfree(gc);
  12723. ++ sc->gpiochip = NULL;
  12724. ++}
  12725. ++
  12726. ++#else /* CONFIG_GPIOLIB */
  12727. ++
  12728. ++static inline void ath9k_register_gpio_chip(struct ath_softc *sc)
  12729. ++{
  12730. ++}
  12731. ++
  12732. ++static inline void ath9k_unregister_gpio_chip(struct ath_softc *sc)
  12733. ++{
  12734. ++}
  12735. ++
  12736. ++#endif /* CONFIG_GPIOLIB */
  12737. +
  12738. + /********************************/
  12739. + /* LED functions */
  12740. + /********************************/
  12741. +
  12742. +-#ifdef CPTCFG_MAC80211_LEDS
  12743. +-
  12744. + static void ath_fill_led_pin(struct ath_softc *sc)
  12745. + {
  12746. + struct ath_hw *ah = sc->sc_ah;
  12747. +@@ -80,6 +202,12 @@ static int ath_add_led(struct ath_softc
  12748. + else
  12749. + ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  12750. +
  12751. ++#ifdef CONFIG_GPIOLIB
  12752. ++ /* If there is GPIO chip configured, reserve LED pin */
  12753. ++ if (sc->gpiochip)
  12754. ++ gpio_request(sc->gpiochip->gchip.base + gpio->gpio, gpio->name);
  12755. ++#endif
  12756. ++
  12757. + return 0;
  12758. + }
  12759. +
  12760. +@@ -136,12 +264,18 @@ void ath_deinit_leds(struct ath_softc *s
  12761. +
  12762. + while (!list_empty(&sc->leds)) {
  12763. + led = list_first_entry(&sc->leds, struct ath_led, list);
  12764. ++#ifdef CONFIG_GPIOLIB
  12765. ++ /* If there is GPIO chip configured, free LED pin */
  12766. ++ if (sc->gpiochip)
  12767. ++ gpio_free(sc->gpiochip->gchip.base + led->gpio->gpio);
  12768. ++#endif
  12769. + list_del(&led->list);
  12770. + ath_led_brightness(&led->cdev, LED_OFF);
  12771. + led_classdev_unregister(&led->cdev);
  12772. + ath9k_hw_gpio_free(sc->sc_ah, led->gpio->gpio);
  12773. + kfree(led);
  12774. + }
  12775. ++ ath9k_unregister_gpio_chip(sc);
  12776. + }
  12777. +
  12778. + void ath_init_leds(struct ath_softc *sc)
  12779. +@@ -158,6 +292,8 @@ void ath_init_leds(struct ath_softc *sc)
  12780. +
  12781. + ath_fill_led_pin(sc);
  12782. +
  12783. ++ ath9k_register_gpio_chip(sc);
  12784. ++
  12785. + if (pdata && pdata->led_name)
  12786. + strncpy(led_name, pdata->led_name, sizeof(led_name));
  12787. + else
  12788. +@@ -178,6 +314,7 @@ void ath_init_leds(struct ath_softc *sc)
  12789. + for (i = 0; i < pdata->num_leds; i++)
  12790. + ath_create_platform_led(sc, &pdata->leds[i]);
  12791. + }
  12792. ++
  12793. + #endif
  12794. +
  12795. + /*******************/
  12796. diff --git a/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
  12797. new file mode 100644
  12798. index 0000000..f86b015
  12799. --- /dev/null
  12800. +++ b/package/kernel/mac80211/patches/549-ath9k_enable_gpio_buttons.patch
  12801. @@ -0,0 +1,149 @@
  12802. +From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  12803. +Subject: [PATCH v5 5/8] mac80211: ath9k: enable GPIO buttons
  12804. +
  12805. +Enable platform-defined GPIO button support for ath9k device.
  12806. +Key poller is activated for attached platform buttons.
  12807. +Requires ath9k GPIO chip access.
  12808. +
  12809. +Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  12810. +Signed-off-by: Felix Fietkau <nbd@nbd.name>
  12811. +---
  12812. +--- a/drivers/net/wireless/ath/ath9k/ath9k.h
  12813. ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  12814. +@@ -1038,6 +1038,7 @@ struct ath_softc {
  12815. + struct list_head leds;
  12816. + #ifdef CONFIG_GPIOLIB
  12817. + struct ath9k_gpio_chip *gpiochip;
  12818. ++ struct platform_device *btnpdev; /* gpio-keys-polled */
  12819. + #endif
  12820. + #endif
  12821. +
  12822. +--- a/drivers/net/wireless/ath/ath9k/gpio.c
  12823. ++++ b/drivers/net/wireless/ath/ath9k/gpio.c
  12824. +@@ -17,6 +17,8 @@
  12825. + #include "ath9k.h"
  12826. + #include <linux/ath9k_platform.h>
  12827. + #include <linux/gpio.h>
  12828. ++#include <linux/platform_device.h>
  12829. ++#include <linux/gpio_keys.h>
  12830. +
  12831. + #ifdef CPTCFG_MAC80211_LEDS
  12832. +
  12833. +@@ -129,6 +131,64 @@ static void ath9k_unregister_gpio_chip(s
  12834. + sc->gpiochip = NULL;
  12835. + }
  12836. +
  12837. ++/******************/
  12838. ++/* GPIO Buttons */
  12839. ++/******************/
  12840. ++
  12841. ++/* add GPIO buttons */
  12842. ++static void ath9k_init_buttons(struct ath_softc *sc)
  12843. ++{
  12844. ++ struct ath9k_platform_data *pdata = sc->dev->platform_data;
  12845. ++ struct platform_device *pdev;
  12846. ++ struct gpio_keys_platform_data gkpdata;
  12847. ++ struct gpio_keys_button *bt;
  12848. ++ int i;
  12849. ++
  12850. ++ if (!sc->gpiochip)
  12851. ++ return;
  12852. ++
  12853. ++ if (!pdata || !pdata->btns || !pdata->num_btns)
  12854. ++ return;
  12855. ++
  12856. ++ bt = devm_kmemdup(sc->dev, pdata->btns,
  12857. ++ pdata->num_btns * sizeof(struct gpio_keys_button),
  12858. ++ GFP_KERNEL);
  12859. ++ if (!bt)
  12860. ++ return;
  12861. ++
  12862. ++ for (i = 0; i < pdata->num_btns; i++) {
  12863. ++ ath9k_hw_gpio_request_in(sc->sc_ah, pdata->btns[i].gpio,
  12864. ++ "ath9k-gpio");
  12865. ++ bt[i].gpio = sc->gpiochip->gchip.base + pdata->btns[i].gpio;
  12866. ++ }
  12867. ++
  12868. ++ memset(&gkpdata, 0, sizeof(struct gpio_keys_platform_data));
  12869. ++ gkpdata.buttons = bt;
  12870. ++ gkpdata.nbuttons = pdata->num_btns;
  12871. ++ gkpdata.poll_interval = pdata->btn_poll_interval;
  12872. ++
  12873. ++ pdev = platform_device_register_data(sc->dev, "gpio-keys-polled",
  12874. ++ PLATFORM_DEVID_AUTO, &gkpdata,
  12875. ++ sizeof(gkpdata));
  12876. ++ if (!IS_ERR_OR_NULL(pdev))
  12877. ++ sc->btnpdev = pdev;
  12878. ++ else {
  12879. ++ sc->btnpdev = NULL;
  12880. ++ devm_kfree(sc->dev, bt);
  12881. ++ }
  12882. ++}
  12883. ++
  12884. ++/* remove GPIO buttons */
  12885. ++static void ath9k_deinit_buttons(struct ath_softc *sc)
  12886. ++{
  12887. ++ if (!sc->gpiochip || !sc->btnpdev)
  12888. ++ return;
  12889. ++
  12890. ++ platform_device_unregister(sc->btnpdev);
  12891. ++
  12892. ++ sc->btnpdev = NULL;
  12893. ++}
  12894. ++
  12895. + #else /* CONFIG_GPIOLIB */
  12896. +
  12897. + static inline void ath9k_register_gpio_chip(struct ath_softc *sc)
  12898. +@@ -139,6 +199,14 @@ static inline void ath9k_unregister_gpio
  12899. + {
  12900. + }
  12901. +
  12902. ++static inline void ath9k_init_buttons(struct ath_softc *sc)
  12903. ++{
  12904. ++}
  12905. ++
  12906. ++static inline void ath9k_deinit_buttons(struct ath_softc *sc)
  12907. ++{
  12908. ++}
  12909. ++
  12910. + #endif /* CONFIG_GPIOLIB */
  12911. +
  12912. + /********************************/
  12913. +@@ -262,6 +330,7 @@ void ath_deinit_leds(struct ath_softc *s
  12914. + {
  12915. + struct ath_led *led;
  12916. +
  12917. ++ ath9k_deinit_buttons(sc);
  12918. + while (!list_empty(&sc->leds)) {
  12919. + led = list_first_entry(&sc->leds, struct ath_led, list);
  12920. + #ifdef CONFIG_GPIOLIB
  12921. +@@ -293,6 +362,7 @@ void ath_init_leds(struct ath_softc *sc)
  12922. + ath_fill_led_pin(sc);
  12923. +
  12924. + ath9k_register_gpio_chip(sc);
  12925. ++ ath9k_init_buttons(sc);
  12926. +
  12927. + if (pdata && pdata->led_name)
  12928. + strncpy(led_name, pdata->led_name, sizeof(led_name));
  12929. +@@ -308,7 +378,7 @@ void ath_init_leds(struct ath_softc *sc)
  12930. + ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger,
  12931. + !sc->sc_ah->config.led_active_high);
  12932. +
  12933. +- if (!pdata)
  12934. ++ if (!pdata || !pdata->leds || !pdata->num_leds)
  12935. + return;
  12936. +
  12937. + for (i = 0; i < pdata->num_leds; i++)
  12938. +--- a/include/linux/ath9k_platform.h
  12939. ++++ b/include/linux/ath9k_platform.h
  12940. +@@ -50,6 +50,10 @@ struct ath9k_platform_data {
  12941. + int num_leds;
  12942. + const struct gpio_led *leds;
  12943. + const char *led_name;
  12944. ++
  12945. ++ unsigned num_btns;
  12946. ++ const struct gpio_keys_button *btns;
  12947. ++ unsigned btn_poll_interval;
  12948. + };
  12949. +
  12950. + #endif /* _LINUX_ATH9K_PLATFORM_H */
  12951. 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
  12952. index 8245909..db70a33 100644
  12953. --- a/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch
  12954. +++ b/package/kernel/mac80211/patches/600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch
  12955. @@ -24,7 +24,7 @@ Changes since v1:
  12956. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  12957. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  12958. -@@ -7722,6 +7722,7 @@ static int rt2800_probe_rt(struct rt2x00
  12959. +@@ -7726,6 +7726,7 @@ static int rt2800_probe_rt(struct rt2x00
  12960. int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
  12961. {
  12962. @@ -32,7 +32,7 @@ Changes since v1:
  12963. int retval;
  12964. u32 reg;
  12965. -@@ -7729,6 +7730,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  12966. +@@ -7733,6 +7734,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  12967. if (retval)
  12968. return retval;
  12969. 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
  12970. index 7abfcd1..a3b62bc 100644
  12971. --- a/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch
  12972. +++ b/package/kernel/mac80211/patches/600-0003-rt2x00-rt2800-serialize-shared-memory-access.patch
  12973. @@ -239,7 +239,7 @@ Changes since v1: ---
  12974. msleep(1);
  12975. /*
  12976. -@@ -7726,6 +7774,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  12977. +@@ -7730,6 +7778,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  12978. int retval;
  12979. u32 reg;
  12980. @@ -248,7 +248,7 @@ Changes since v1: ---
  12981. retval = rt2800_probe_rt(rt2x00dev);
  12982. if (retval)
  12983. return retval;
  12984. -@@ -7809,8 +7859,11 @@ void rt2800_get_key_seq(struct ieee80211
  12985. +@@ -7813,8 +7863,11 @@ void rt2800_get_key_seq(struct ieee80211
  12986. return;
  12987. offset = MAC_IVEIV_ENTRY(key->hw_key_idx);
  12988. 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
  12989. index 02b2acf..f41a160 100644
  12990. --- a/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch
  12991. +++ b/package/kernel/mac80211/patches/600-0005-rt2x00-rt2800lib-add-hw_beacon_count-field-to-struct.patch
  12992. @@ -41,7 +41,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  12993. rt2800_clear_beacon_register(rt2x00dev, i);
  12994. if (rt2x00_is_usb(rt2x00dev)) {
  12995. -@@ -7827,6 +7828,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  12996. +@@ -7831,6 +7832,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  12997. if (rt2x00_rt(rt2x00dev, RT3593))
  12998. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  12999. 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
  13000. index e909272..5099c64 100644
  13001. --- a/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch
  13002. +++ b/package/kernel/mac80211/patches/600-0007-rt2x00-rt2800lib-fix-max-supported-beacon-count-for-.patch
  13003. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  13004. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  13005. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  13006. -@@ -7852,7 +7852,10 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  13007. +@@ -7856,7 +7856,10 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  13008. if (rt2x00_rt(rt2x00dev, RT3593))
  13009. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  13010. 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
  13011. index 7fe38e0..a2e7015 100644
  13012. --- a/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch
  13013. +++ b/package/kernel/mac80211/patches/600-0009-rt2x00-rt2800lib-enable-support-for-RT3883.patch
  13014. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  13015. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  13016. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  13017. -@@ -7822,6 +7822,7 @@ static int rt2800_probe_rt(struct rt2x00
  13018. +@@ -7826,6 +7826,7 @@ static int rt2800_probe_rt(struct rt2x00
  13019. case RT3390:
  13020. case RT3572:
  13021. case RT3593:
  13022. 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
  13023. index 253a0c0..89bd0ac 100644
  13024. --- a/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
  13025. +++ b/package/kernel/mac80211/patches/600-0010-rt2x00-rt2800lib-add-rf_vals-for-RF3853.patch
  13026. @@ -98,7 +98,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  13027. static const struct rf_channel rf_vals_5592_xtal20[] = {
  13028. /* Channel, N, K, mod, R */
  13029. {1, 482, 4, 10, 3},
  13030. -@@ -7669,6 +7729,11 @@ static int rt2800_probe_hw_mode(struct r
  13031. +@@ -7673,6 +7733,11 @@ static int rt2800_probe_hw_mode(struct r
  13032. spec->channels = rf_vals_3x;
  13033. break;
  13034. 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
  13035. index f15c22b..b7efc9f 100644
  13036. --- a/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
  13037. +++ b/package/kernel/mac80211/patches/600-0011-rt2x00-rt2800lib-enable-VCO-calibration-for-RF3853.patch
  13038. @@ -18,7 +18,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  13039. case RF5360:
  13040. case RF5362:
  13041. case RF5370:
  13042. -@@ -7848,6 +7849,7 @@ static int rt2800_probe_hw_mode(struct r
  13043. +@@ -7852,6 +7853,7 @@ static int rt2800_probe_hw_mode(struct r
  13044. case RF3053:
  13045. case RF3070:
  13046. case RF3290:
  13047. 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
  13048. index 6ce224a..220e35f 100644
  13049. --- a/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch
  13050. +++ b/package/kernel/mac80211/patches/600-0026-rt2x00-rt2800lib-use-correct-beacon-count-for-RT3883.patch
  13051. @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  13052. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  13053. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  13054. -@@ -8403,7 +8403,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  13055. +@@ -8407,7 +8407,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  13056. if (rt2x00_rt(rt2x00dev, RT3593))
  13057. __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  13058. 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
  13059. index 25753af..2ffa5a4 100644
  13060. --- a/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch
  13061. +++ b/package/kernel/mac80211/patches/600-0032-rt2x00-rt2800lib-enable-RT2800_HAS_HIGH_SHARED_MEM-f.patch
  13062. @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  13063. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  13064. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  13065. -@@ -8416,7 +8416,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  13066. +@@ -8420,7 +8420,8 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  13067. if (retval)
  13068. return retval;
  13069. 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
  13070. index 7a183a4..daa5dc6 100644
  13071. --- a/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00_platform_h.patch
  13072. +++ b/package/kernel/mac80211/patches/602-rt2x00-introduce-rt2x00_platform_h.patch
  13073. @@ -22,10 +22,10 @@
  13074. +#endif /* _RT2X00_PLATFORM_H */
  13075. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  13076. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  13077. -@@ -38,6 +38,7 @@
  13078. - #include <linux/kfifo.h>
  13079. +@@ -39,6 +39,7 @@
  13080. #include <linux/hrtimer.h>
  13081. #include <linux/average.h>
  13082. + #include <linux/usb.h>
  13083. +#include <linux/rt2x00_platform.h>
  13084. #include <net/mac80211.h>
  13085. diff --git a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  13086. index bc056cd..8ae5da3 100644
  13087. --- a/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  13088. +++ b/package/kernel/mac80211/patches/603-rt2x00-introduce-rt2x00eeprom.patch
  13089. @@ -1,6 +1,6 @@
  13090. --- a/.local-symbols
  13091. +++ b/.local-symbols
  13092. -@@ -329,6 +329,7 @@ RT2X00_LIB_FIRMWARE=
  13093. +@@ -331,6 +331,7 @@ RT2X00_LIB_FIRMWARE=
  13094. RT2X00_LIB_CRYPTO=
  13095. RT2X00_LIB_LEDS=
  13096. RT2X00_LIB_DEBUGFS=
  13097. @@ -105,7 +105,7 @@
  13098. .drv_init_registers = rt2800mmio_init_registers,
  13099. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  13100. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  13101. -@@ -697,6 +697,7 @@ enum rt2x00_capability_flags {
  13102. +@@ -699,6 +699,7 @@ enum rt2x00_capability_flags {
  13103. REQUIRE_HT_TX_DESC,
  13104. REQUIRE_PS_AUTOWAKE,
  13105. REQUIRE_DELAYED_RFKILL,
  13106. @@ -127,7 +127,7 @@
  13107. DECLARE_KFIFO_PTR(txstatus_fifo, u32);
  13108. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  13109. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  13110. -@@ -1335,6 +1335,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de
  13111. +@@ -1334,6 +1334,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de
  13112. INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup);
  13113. INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep);
  13114. @@ -138,7 +138,7 @@
  13115. /*
  13116. * Let the driver probe the device to detect the capabilities.
  13117. */
  13118. -@@ -1475,6 +1479,11 @@ void rt2x00lib_remove_dev(struct rt2x00_
  13119. +@@ -1477,6 +1481,11 @@ void rt2x00lib_remove_dev(struct rt2x00_
  13120. * Free the driver data.
  13121. */
  13122. kfree(rt2x00dev->drv_data);
  13123. 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
  13124. index d923e05..a2e1faf 100644
  13125. --- a/package/kernel/mac80211/patches/607-rt2x00-allow_disabling_bands_through_platform_data.patch
  13126. +++ b/package/kernel/mac80211/patches/607-rt2x00-allow_disabling_bands_through_platform_data.patch
  13127. @@ -37,7 +37,7 @@
  13128. num_rates += 4;
  13129. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  13130. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  13131. -@@ -405,6 +405,7 @@ struct hw_mode_spec {
  13132. +@@ -406,6 +406,7 @@ struct hw_mode_spec {
  13133. unsigned int supported_bands;
  13134. #define SUPPORT_BAND_2GHZ 0x00000001
  13135. #define SUPPORT_BAND_5GHZ 0x00000002
  13136. 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
  13137. index a645ba1..6704ff8 100644
  13138. --- a/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch
  13139. +++ b/package/kernel/mac80211/patches/608-add_platform_data_mac_addr.patch
  13140. @@ -31,7 +31,7 @@
  13141. {
  13142. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  13143. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  13144. -@@ -1414,6 +1414,7 @@ static inline void rt2x00debug_dump_fram
  13145. +@@ -1416,6 +1416,7 @@ static inline void rt2x00debug_dump_fram
  13146. */
  13147. u32 rt2x00lib_get_bssidx(struct rt2x00_dev *rt2x00dev,
  13148. struct ieee80211_vif *vif);
  13149. 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
  13150. index c69d330..9f10fe3 100644
  13151. --- a/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
  13152. +++ b/package/kernel/mac80211/patches/610-rt2x00-fix-rt3352-ext-pa.patch
  13153. @@ -200,7 +200,7 @@
  13154. * EEPROM frequency
  13155. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  13156. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  13157. -@@ -717,6 +717,8 @@ enum rt2x00_capability_flags {
  13158. +@@ -719,6 +719,8 @@ enum rt2x00_capability_flags {
  13159. CAPABILITY_DOUBLE_ANTENNA,
  13160. CAPABILITY_BT_COEXIST,
  13161. CAPABILITY_VCO_RECALIBRATION,
  13162. 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
  13163. index b44fe90..860fdc0 100644
  13164. --- a/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
  13165. +++ b/package/kernel/mac80211/patches/611-rt2x00-rf_vals-rt3352-xtal20.patch
  13166. @@ -28,7 +28,7 @@
  13167. static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
  13168. {
  13169. struct hw_mode_spec *spec = &rt2x00dev->spec;
  13170. -@@ -8272,7 +8293,10 @@ static int rt2800_probe_hw_mode(struct r
  13171. +@@ -8276,7 +8297,10 @@ static int rt2800_probe_hw_mode(struct r
  13172. case RF5390:
  13173. case RF5392:
  13174. spec->num_channels = 14;
  13175. @@ -40,7 +40,7 @@
  13176. break;
  13177. case RF3052:
  13178. -@@ -8456,6 +8480,19 @@ static int rt2800_probe_rt(struct rt2x00
  13179. +@@ -8460,6 +8484,19 @@ static int rt2800_probe_rt(struct rt2x00
  13180. return 0;
  13181. }
  13182. @@ -60,7 +60,7 @@
  13183. int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
  13184. {
  13185. struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
  13186. -@@ -8498,6 +8535,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  13187. +@@ -8502,6 +8539,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  13188. rt2800_register_write(rt2x00dev, GPIO_CTRL, reg);
  13189. /*
  13190. @@ -78,7 +78,7 @@
  13191. retval = rt2800_probe_hw_mode(rt2x00dev);
  13192. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  13193. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  13194. -@@ -400,6 +400,7 @@ static inline struct rt2x00_intf* vif_to
  13195. +@@ -401,6 +401,7 @@ static inline struct rt2x00_intf* vif_to
  13196. * @channels: Device/chipset specific channel values (See &struct rf_channel).
  13197. * @channels_info: Additional information for channels (See &struct channel_info).
  13198. * @ht: Driver HT Capabilities (See &ieee80211_sta_ht_cap).
  13199. @@ -86,7 +86,7 @@
  13200. */
  13201. struct hw_mode_spec {
  13202. unsigned int supported_bands;
  13203. -@@ -416,6 +417,7 @@ struct hw_mode_spec {
  13204. +@@ -417,6 +418,7 @@ struct hw_mode_spec {
  13205. const struct channel_info *channels_info;
  13206. struct ieee80211_sta_ht_cap ht;
  13207. diff --git a/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch b/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  13208. index 8e3bd2a..e7b2a8c 100644
  13209. --- a/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  13210. +++ b/package/kernel/mac80211/patches/615-rt2x00-fix_20mhz_clk.patch
  13211. @@ -8,7 +8,7 @@
  13212. #include "rt2x00.h"
  13213. #include "rt2800lib.h"
  13214. -@@ -8482,13 +8483,14 @@ static int rt2800_probe_rt(struct rt2x00
  13215. +@@ -8486,13 +8487,14 @@ static int rt2800_probe_rt(struct rt2x00
  13216. int rt2800_probe_clk(struct rt2x00_dev *rt2x00dev)
  13217. {
  13218. diff --git a/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch b/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  13219. index faa5879..44bd8a1 100644
  13220. --- a/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  13221. +++ b/package/kernel/mac80211/patches/616-rt2x00-support-rt5350.patch
  13222. @@ -240,7 +240,7 @@
  13223. case RF5360:
  13224. case RF5362:
  13225. case RF5370:
  13226. -@@ -8287,6 +8398,7 @@ static int rt2800_probe_hw_mode(struct r
  13227. +@@ -8291,6 +8402,7 @@ static int rt2800_probe_hw_mode(struct r
  13228. case RF3290:
  13229. case RF3320:
  13230. case RF3322:
  13231. @@ -248,7 +248,7 @@
  13232. case RF5360:
  13233. case RF5362:
  13234. case RF5370:
  13235. -@@ -8426,6 +8538,7 @@ static int rt2800_probe_hw_mode(struct r
  13236. +@@ -8430,6 +8542,7 @@ static int rt2800_probe_hw_mode(struct r
  13237. case RF3070:
  13238. case RF3290:
  13239. case RF3853:
  13240. @@ -256,7 +256,7 @@
  13241. case RF5360:
  13242. case RF5362:
  13243. case RF5370:
  13244. -@@ -8466,6 +8579,7 @@ static int rt2800_probe_rt(struct rt2x00
  13245. +@@ -8470,6 +8583,7 @@ static int rt2800_probe_rt(struct rt2x00
  13246. case RT3572:
  13247. case RT3593:
  13248. case RT3883:
  13249. @@ -266,7 +266,7 @@
  13250. case RT5592:
  13251. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  13252. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  13253. -@@ -169,6 +169,7 @@ struct rt2x00_chip {
  13254. +@@ -170,6 +170,7 @@ struct rt2x00_chip {
  13255. #define RT3572 0x3572
  13256. #define RT3593 0x3593
  13257. #define RT3883 0x3883 /* WSOC */
  13258. 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
  13259. index 55452b9..dba6033 100644
  13260. --- a/package/kernel/mac80211/patches/620-rt2x00-add-AP+STA-support.patch
  13261. +++ b/package/kernel/mac80211/patches/620-rt2x00-add-AP+STA-support.patch
  13262. @@ -1,6 +1,6 @@
  13263. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  13264. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  13265. -@@ -1284,7 +1284,7 @@ static inline void rt2x00lib_set_if_comb
  13266. +@@ -1283,7 +1283,7 @@ static inline void rt2x00lib_set_if_comb
  13267. */
  13268. if_limit = &rt2x00dev->if_limits_ap;
  13269. if_limit->max = rt2x00dev->ops->max_ap_intf;
  13270. diff --git a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  13271. index fd885cc..02f3053 100644
  13272. --- a/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  13273. +++ b/package/kernel/mac80211/patches/801-libertas-configure-sysfs-links.patch
  13274. @@ -1,6 +1,6 @@
  13275. --- a/drivers/net/wireless/marvell/libertas/cfg.c
  13276. +++ b/drivers/net/wireless/marvell/libertas/cfg.c
  13277. -@@ -2084,6 +2084,8 @@ struct wireless_dev *lbs_cfg_alloc(struc
  13278. +@@ -2122,6 +2122,8 @@ struct wireless_dev *lbs_cfg_alloc(struc
  13279. goto err_wiphy_new;
  13280. }
  13281. diff --git a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  13282. index b67a95f..ad30608 100644
  13283. --- a/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  13284. +++ b/package/kernel/mac80211/patches/802-libertas-set-wireless-macaddr.patch
  13285. @@ -1,6 +1,6 @@
  13286. --- a/drivers/net/wireless/marvell/libertas/cfg.c
  13287. +++ b/drivers/net/wireless/marvell/libertas/cfg.c
  13288. -@@ -2174,6 +2174,8 @@ int lbs_cfg_register(struct lbs_private
  13289. +@@ -2212,6 +2212,8 @@ int lbs_cfg_register(struct lbs_private
  13290. wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  13291. wdev->wiphy->reg_notifier = lbs_reg_notifier;
  13292. diff --git a/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch b/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch
  13293. deleted file mode 100644
  13294. index 74cd448..0000000
  13295. --- a/package/kernel/mac80211/patches/804-b43-sync-with-bcma.patch
  13296. +++ /dev/null
  13297. @@ -1,17 +0,0 @@
  13298. ---- a/drivers/net/wireless/broadcom/b43/main.c
  13299. -+++ b/drivers/net/wireless/broadcom/b43/main.c
  13300. -@@ -1215,10 +1215,10 @@ void b43_wireless_core_phy_pll_reset(str
  13301. - case B43_BUS_BCMA:
  13302. - bcma_cc = &dev->dev->bdev->bus->drv_cc;
  13303. -
  13304. -- bcma_cc_write32(bcma_cc, BCMA_CC_CHIPCTL_ADDR, 0);
  13305. -- bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4);
  13306. -- bcma_cc_set32(bcma_cc, BCMA_CC_CHIPCTL_DATA, 0x4);
  13307. -- bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4);
  13308. -+ bcma_cc_write32(bcma_cc, BCMA_CC_PMU_CHIPCTL_ADDR, 0);
  13309. -+ bcma_cc_mask32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, ~0x4);
  13310. -+ bcma_cc_set32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, 0x4);
  13311. -+ bcma_cc_mask32(bcma_cc, BCMA_CC_PMU_CHIPCTL_DATA, ~0x4);
  13312. - break;
  13313. - #endif
  13314. - #ifdef CPTCFG_B43_SSB
  13315. diff --git a/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch b/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  13316. index 06c731f..f8f555f 100644
  13317. --- a/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  13318. +++ b/package/kernel/mac80211/patches/820-b43-add-antenna-control.patch
  13319. @@ -9,7 +9,7 @@
  13320. antenna = b43_antenna_to_phyctl(antenna);
  13321. ctl = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_BEACPHYCTL);
  13322. /* We can't send beacons with short preamble. Would get PHY errors. */
  13323. -@@ -3300,8 +3300,8 @@ static int b43_chip_init(struct b43_wlde
  13324. +@@ -3297,8 +3297,8 @@ static int b43_chip_init(struct b43_wlde
  13325. /* Select the antennae */
  13326. if (phy->ops->set_rx_antenna)
  13327. @@ -20,7 +20,7 @@
  13328. if (phy->type == B43_PHYTYPE_B) {
  13329. value16 = b43_read16(dev, 0x005E);
  13330. -@@ -4001,7 +4001,6 @@ static int b43_op_config(struct ieee8021
  13331. +@@ -3998,7 +3998,6 @@ static int b43_op_config(struct ieee8021
  13332. struct b43_wldev *dev = wl->current_dev;
  13333. struct b43_phy *phy = &dev->phy;
  13334. struct ieee80211_conf *conf = &hw->conf;
  13335. @@ -28,7 +28,7 @@
  13336. int err = 0;
  13337. mutex_lock(&wl->mutex);
  13338. -@@ -4044,11 +4043,9 @@ static int b43_op_config(struct ieee8021
  13339. +@@ -4041,11 +4040,9 @@ static int b43_op_config(struct ieee8021
  13340. }
  13341. /* Antennas for RX and management frame TX. */
  13342. @@ -42,7 +42,7 @@
  13343. if (wl->radio_enabled != phy->radio_on) {
  13344. if (wl->radio_enabled) {
  13345. -@@ -5209,6 +5206,47 @@ static int b43_op_get_survey(struct ieee
  13346. +@@ -5189,6 +5186,47 @@ static int b43_op_get_survey(struct ieee
  13347. return 0;
  13348. }
  13349. @@ -90,7 +90,7 @@
  13350. static const struct ieee80211_ops b43_hw_ops = {
  13351. .tx = b43_op_tx,
  13352. .conf_tx = b43_op_conf_tx,
  13353. -@@ -5230,6 +5268,8 @@ static const struct ieee80211_ops b43_hw
  13354. +@@ -5210,6 +5248,8 @@ static const struct ieee80211_ops b43_hw
  13355. .sw_scan_complete = b43_op_sw_scan_complete_notifier,
  13356. .get_survey = b43_op_get_survey,
  13357. .rfkill_poll = b43_rfkill_poll,
  13358. @@ -99,7 +99,7 @@
  13359. };
  13360. /* Hard-reset the chip. Do not call this directly.
  13361. -@@ -5538,6 +5578,8 @@ static int b43_one_core_attach(struct b4
  13362. +@@ -5513,6 +5553,8 @@ static int b43_one_core_attach(struct b4
  13363. if (!wldev)
  13364. goto out;
  13365. @@ -108,7 +108,7 @@
  13366. wldev->use_pio = b43_modparam_pio;
  13367. wldev->dev = dev;
  13368. wldev->wl = wl;
  13369. -@@ -5628,6 +5670,9 @@ static struct b43_wl *b43_wireless_init(
  13370. +@@ -5603,6 +5645,9 @@ static struct b43_wl *b43_wireless_init(
  13371. hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
  13372. diff --git a/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch b/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch
  13373. new file mode 100644
  13374. index 0000000..ae571c9
  13375. --- /dev/null
  13376. +++ b/package/kernel/mac80211/patches/860-brcmfmac-register-wiphy-s-during-module_init.patch
  13377. @@ -0,0 +1,97 @@
  13378. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  13379. +Date: Mon, 8 Jun 2015 16:11:40 +0200
  13380. +Subject: [PATCH] brcmfmac: register wiphy(s) during module_init
  13381. +MIME-Version: 1.0
  13382. +Content-Type: text/plain; charset=UTF-8
  13383. +Content-Transfer-Encoding: 8bit
  13384. +
  13385. +This is needed by OpenWrt which expects all PHYs to be created after
  13386. +module loads successfully.
  13387. +
  13388. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  13389. +---
  13390. +
  13391. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  13392. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  13393. +@@ -1213,6 +1213,7 @@ int __init brcmf_core_init(void)
  13394. + {
  13395. + if (!schedule_work(&brcmf_driver_work))
  13396. + return -EBUSY;
  13397. ++ flush_work(&brcmf_driver_work);
  13398. +
  13399. + return 0;
  13400. + }
  13401. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  13402. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  13403. +@@ -444,6 +444,7 @@ struct brcmf_fw {
  13404. + u16 bus_nr;
  13405. + void (*done)(struct device *dev, const struct firmware *fw,
  13406. + void *nvram_image, u32 nvram_len);
  13407. ++ struct completion *completion;
  13408. + };
  13409. +
  13410. + static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx)
  13411. +@@ -478,6 +479,8 @@ static void brcmf_fw_request_nvram_done(
  13412. + goto fail;
  13413. +
  13414. + fwctx->done(fwctx->dev, fwctx->code, nvram, nvram_length);
  13415. ++ if (fwctx->completion)
  13416. ++ complete(fwctx->completion);
  13417. + kfree(fwctx);
  13418. + return;
  13419. +
  13420. +@@ -485,6 +488,8 @@ fail:
  13421. + brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  13422. + release_firmware(fwctx->code);
  13423. + device_release_driver(fwctx->dev);
  13424. ++ if (fwctx->completion)
  13425. ++ complete(fwctx->completion);
  13426. + kfree(fwctx);
  13427. + }
  13428. +
  13429. +@@ -500,6 +505,8 @@ static void brcmf_fw_request_code_done(c
  13430. + /* only requested code so done here */
  13431. + if (!(fwctx->flags & BRCMF_FW_REQUEST_NVRAM)) {
  13432. + fwctx->done(fwctx->dev, fw, NULL, 0);
  13433. ++ if (fwctx->completion)
  13434. ++ complete(fwctx->completion);
  13435. + kfree(fwctx);
  13436. + return;
  13437. + }
  13438. +@@ -517,6 +524,8 @@ static void brcmf_fw_request_code_done(c
  13439. + fail:
  13440. + brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  13441. + device_release_driver(fwctx->dev);
  13442. ++ if (fwctx->completion)
  13443. ++ complete(fwctx->completion);
  13444. + kfree(fwctx);
  13445. + }
  13446. +
  13447. +@@ -528,6 +537,8 @@ int brcmf_fw_get_firmwares_pcie(struct d
  13448. + u16 domain_nr, u16 bus_nr)
  13449. + {
  13450. + struct brcmf_fw *fwctx;
  13451. ++ struct completion completion;
  13452. ++ int err;
  13453. +
  13454. + brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev));
  13455. + if (!fw_cb || !code)
  13456. +@@ -548,9 +559,17 @@ int brcmf_fw_get_firmwares_pcie(struct d
  13457. + fwctx->domain_nr = domain_nr;
  13458. + fwctx->bus_nr = bus_nr;
  13459. +
  13460. +- return request_firmware_nowait(THIS_MODULE, true, code, dev,
  13461. ++ init_completion(&completion);
  13462. ++ fwctx->completion = &completion;
  13463. ++
  13464. ++ err = request_firmware_nowait(THIS_MODULE, true, code, dev,
  13465. + GFP_KERNEL, fwctx,
  13466. + brcmf_fw_request_code_done);
  13467. ++ if (!err)
  13468. ++ wait_for_completion_timeout(fwctx->completion,
  13469. ++ msecs_to_jiffies(5000));
  13470. ++ fwctx->completion = NULL;
  13471. ++ return err;
  13472. + }
  13473. +
  13474. + int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  13475. 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
  13476. deleted file mode 100644
  13477. index 00181f6..0000000
  13478. --- a/package/kernel/mac80211/patches/861-brcmfmac-register-wiphy-s-during-module_init.patch
  13479. +++ /dev/null
  13480. @@ -1,97 +0,0 @@
  13481. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  13482. -Date: Mon, 8 Jun 2015 16:11:40 +0200
  13483. -Subject: [PATCH] brcmfmac: register wiphy(s) during module_init
  13484. -MIME-Version: 1.0
  13485. -Content-Type: text/plain; charset=UTF-8
  13486. -Content-Transfer-Encoding: 8bit
  13487. -
  13488. -This is needed by OpenWrt which expects all PHYs to be created after
  13489. -module loads successfully.
  13490. -
  13491. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  13492. ----
  13493. -
  13494. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  13495. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
  13496. -@@ -1332,6 +1332,7 @@ static int __init brcmfmac_module_init(v
  13497. - #endif
  13498. - if (!schedule_work(&brcmf_driver_work))
  13499. - return -EBUSY;
  13500. -+ flush_work(&brcmf_driver_work);
  13501. -
  13502. - return 0;
  13503. - }
  13504. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  13505. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
  13506. -@@ -444,6 +444,7 @@ struct brcmf_fw {
  13507. - u16 bus_nr;
  13508. - void (*done)(struct device *dev, const struct firmware *fw,
  13509. - void *nvram_image, u32 nvram_len);
  13510. -+ struct completion *completion;
  13511. - };
  13512. -
  13513. - static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx)
  13514. -@@ -478,6 +479,8 @@ static void brcmf_fw_request_nvram_done(
  13515. - goto fail;
  13516. -
  13517. - fwctx->done(fwctx->dev, fwctx->code, nvram, nvram_length);
  13518. -+ if (fwctx->completion)
  13519. -+ complete(fwctx->completion);
  13520. - kfree(fwctx);
  13521. - return;
  13522. -
  13523. -@@ -485,6 +488,8 @@ fail:
  13524. - brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  13525. - release_firmware(fwctx->code);
  13526. - device_release_driver(fwctx->dev);
  13527. -+ if (fwctx->completion)
  13528. -+ complete(fwctx->completion);
  13529. - kfree(fwctx);
  13530. - }
  13531. -
  13532. -@@ -500,6 +505,8 @@ static void brcmf_fw_request_code_done(c
  13533. - /* only requested code so done here */
  13534. - if (!(fwctx->flags & BRCMF_FW_REQUEST_NVRAM)) {
  13535. - fwctx->done(fwctx->dev, fw, NULL, 0);
  13536. -+ if (fwctx->completion)
  13537. -+ complete(fwctx->completion);
  13538. - kfree(fwctx);
  13539. - return;
  13540. - }
  13541. -@@ -517,6 +524,8 @@ static void brcmf_fw_request_code_done(c
  13542. - fail:
  13543. - brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev));
  13544. - device_release_driver(fwctx->dev);
  13545. -+ if (fwctx->completion)
  13546. -+ complete(fwctx->completion);
  13547. - kfree(fwctx);
  13548. - }
  13549. -
  13550. -@@ -528,6 +537,8 @@ int brcmf_fw_get_firmwares_pcie(struct d
  13551. - u16 domain_nr, u16 bus_nr)
  13552. - {
  13553. - struct brcmf_fw *fwctx;
  13554. -+ struct completion completion;
  13555. -+ int err;
  13556. -
  13557. - brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev));
  13558. - if (!fw_cb || !code)
  13559. -@@ -548,9 +559,17 @@ int brcmf_fw_get_firmwares_pcie(struct d
  13560. - fwctx->domain_nr = domain_nr;
  13561. - fwctx->bus_nr = bus_nr;
  13562. -
  13563. -- return request_firmware_nowait(THIS_MODULE, true, code, dev,
  13564. -+ init_completion(&completion);
  13565. -+ fwctx->completion = &completion;
  13566. -+
  13567. -+ err = request_firmware_nowait(THIS_MODULE, true, code, dev,
  13568. - GFP_KERNEL, fwctx,
  13569. - brcmf_fw_request_code_done);
  13570. -+ if (!err)
  13571. -+ wait_for_completion_timeout(fwctx->completion,
  13572. -+ msecs_to_jiffies(5000));
  13573. -+ fwctx->completion = NULL;
  13574. -+ return err;
  13575. - }
  13576. -
  13577. - int brcmf_fw_get_firmwares(struct device *dev, u16 flags,
  13578. diff --git a/package/kernel/mac80211/patches/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch b/package/kernel/mac80211/patches/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
  13579. new file mode 100644
  13580. index 0000000..8721155
  13581. --- /dev/null
  13582. +++ b/package/kernel/mac80211/patches/861-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
  13583. @@ -0,0 +1,50 @@
  13584. +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  13585. +Date: Thu, 9 Jul 2015 00:07:59 +0200
  13586. +Subject: [PATCH] brcmfmac: workaround bug with some inconsistent BSSes state
  13587. +MIME-Version: 1.0
  13588. +Content-Type: text/plain; charset=UTF-8
  13589. +Content-Transfer-Encoding: 8bit
  13590. +
  13591. +Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  13592. +---
  13593. +
  13594. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  13595. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  13596. +@@ -665,9 +665,37 @@ static struct wireless_dev *brcmf_cfg802
  13597. + u32 *flags,
  13598. + struct vif_params *params)
  13599. + {
  13600. ++ struct net_device *dev;
  13601. + struct wireless_dev *wdev;
  13602. + int err;
  13603. +
  13604. ++ /*
  13605. ++ * There is a bug with in-firmware BSS management. When adding virtual
  13606. ++ * interface brcmfmac first tells firmware to create new BSS and then
  13607. ++ * it creates new struct net_device.
  13608. ++ *
  13609. ++ * If creating/registering netdev(ice) fails, BSS remains in some bugged
  13610. ++ * state. It conflicts with existing BSSes by overtaking their auth
  13611. ++ * requests.
  13612. ++ *
  13613. ++ * It results in one BSS (addresss X) sending beacons and another BSS
  13614. ++ * (address Y) replying to authentication requests. This makes interface
  13615. ++ * unusable as AP.
  13616. ++ *
  13617. ++ * To workaround this bug we may try to guess if register_netdev(ice)
  13618. ++ * will fail. The most obvious case is using interface name that already
  13619. ++ * exists. This is actually quite likely with brcmfmac & some user space
  13620. ++ * scripts as brcmfmac doesn't allow deleting virtual interfaces.
  13621. ++ * So this bug can be triggered even by something trivial like:
  13622. ++ * iw dev wlan0 delete
  13623. ++ * iw phy phy0 interface add wlan0 type __ap
  13624. ++ */
  13625. ++ dev = dev_get_by_name(&init_net, name);
  13626. ++ if (dev) {
  13627. ++ dev_put(dev);
  13628. ++ return ERR_PTR(-ENFILE);
  13629. ++ }
  13630. ++
  13631. + brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
  13632. + err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
  13633. + if (err) {
  13634. diff --git a/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch b/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch
  13635. new file mode 100644
  13636. index 0000000..f301fe1
  13637. --- /dev/null
  13638. +++ b/package/kernel/mac80211/patches/862-brcmfmac-Disable-power-management.patch
  13639. @@ -0,0 +1,27 @@
  13640. +From 66ae1b1750720a33e29792a177b1e696f4f005fb Mon Sep 17 00:00:00 2001
  13641. +From: Phil Elwell <phil@raspberrypi.org>
  13642. +Date: Wed, 9 Mar 2016 17:25:59 +0000
  13643. +Subject: [PATCH] brcmfmac: Disable power management
  13644. +
  13645. +Disable wireless power saving in the brcmfmac WLAN driver. This is a
  13646. +temporary measure until the connectivity loss resulting from power
  13647. +saving is resolved.
  13648. +
  13649. +Signed-off-by: Phil Elwell <phil@raspberrypi.org>
  13650. +---
  13651. + drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c | 2 ++
  13652. + 1 file changed, 2 insertions(+)
  13653. +
  13654. +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  13655. ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  13656. +@@ -2783,6 +2783,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip
  13657. + * preference in cfg struct to apply this to
  13658. + * FW later while initializing the dongle
  13659. + */
  13660. ++#if defined(CONFIG_BCM2708) || defined(CONFIG_BCM2709)
  13661. ++ pr_info("power management disabled\n");
  13662. ++ enabled = false;
  13663. ++#endif
  13664. + cfg->pwr_save = enabled;
  13665. + if (!check_vif_up(ifp->vif)) {
  13666. +
  13667. 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
  13668. deleted file mode 100644
  13669. index 4295b4b..0000000
  13670. --- a/package/kernel/mac80211/patches/862-brcmfmac-workaround-bug-with-some-inconsistent-BSSes.patch
  13671. +++ /dev/null
  13672. @@ -1,50 +0,0 @@
  13673. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  13674. -Date: Thu, 9 Jul 2015 00:07:59 +0200
  13675. -Subject: [PATCH] brcmfmac: workaround bug with some inconsistent BSSes state
  13676. -MIME-Version: 1.0
  13677. -Content-Type: text/plain; charset=UTF-8
  13678. -Content-Transfer-Encoding: 8bit
  13679. -
  13680. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  13681. ----
  13682. -
  13683. ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  13684. -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  13685. -@@ -615,9 +615,37 @@ static struct wireless_dev *brcmf_cfg802
  13686. - u32 *flags,
  13687. - struct vif_params *params)
  13688. - {
  13689. -+ struct net_device *dev;
  13690. - struct wireless_dev *wdev;
  13691. - int err;
  13692. -
  13693. -+ /*
  13694. -+ * There is a bug with in-firmware BSS management. When adding virtual
  13695. -+ * interface brcmfmac first tells firmware to create new BSS and then
  13696. -+ * it creates new struct net_device.
  13697. -+ *
  13698. -+ * If creating/registering netdev(ice) fails, BSS remains in some bugged
  13699. -+ * state. It conflicts with existing BSSes by overtaking their auth
  13700. -+ * requests.
  13701. -+ *
  13702. -+ * It results in one BSS (addresss X) sending beacons and another BSS
  13703. -+ * (address Y) replying to authentication requests. This makes interface
  13704. -+ * unusable as AP.
  13705. -+ *
  13706. -+ * To workaround this bug we may try to guess if register_netdev(ice)
  13707. -+ * will fail. The most obvious case is using interface name that already
  13708. -+ * exists. This is actually quite likely with brcmfmac & some user space
  13709. -+ * scripts as brcmfmac doesn't allow deleting virtual interfaces.
  13710. -+ * So this bug can be triggered even by something trivial like:
  13711. -+ * iw dev wlan0 delete
  13712. -+ * iw phy phy0 interface add wlan0 type __ap
  13713. -+ */
  13714. -+ dev = dev_get_by_name(&init_net, name);
  13715. -+ if (dev) {
  13716. -+ dev_put(dev);
  13717. -+ return ERR_PTR(-EEXIST);
  13718. -+ }
  13719. -+
  13720. - brcmf_dbg(TRACE, "enter: %s type %d\n", name, type);
  13721. - err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
  13722. - if (err) {
  13723. 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
  13724. index f2e21ea..be210f2 100644
  13725. --- a/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch
  13726. +++ b/package/kernel/mac80211/patches/910-01-add-support-for-mt7620.patch
  13727. @@ -1184,7 +1184,7 @@
  13728. break;
  13729. default:
  13730. rt2x00_err(rt2x00dev, "Invalid RF chipset 0x%04x detected\n",
  13731. -@@ -8423,6 +9363,7 @@ static int rt2800_probe_hw_mode(struct r
  13732. +@@ -8427,6 +9367,7 @@ static int rt2800_probe_hw_mode(struct r
  13733. case RF5372:
  13734. case RF5390:
  13735. case RF5392:
  13736. @@ -1192,7 +1192,7 @@
  13737. spec->num_channels = 14;
  13738. if (spec->clk_is_20mhz)
  13739. spec->channels = rf_vals_xtal20mhz_3x;
  13740. -@@ -8563,6 +9504,7 @@ static int rt2800_probe_hw_mode(struct r
  13741. +@@ -8567,6 +9508,7 @@ static int rt2800_probe_hw_mode(struct r
  13742. case RF5372:
  13743. case RF5390:
  13744. case RF5392:
  13745. diff --git a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  13746. index 8c6d720..e842d61 100644
  13747. --- a/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  13748. +++ b/package/kernel/mac80211/patches/921-ath10k_init_devices_synchronously.patch
  13749. @@ -14,7 +14,7 @@ Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  13750. --- a/drivers/net/wireless/ath/ath10k/core.c
  13751. +++ b/drivers/net/wireless/ath/ath10k/core.c
  13752. -@@ -1914,6 +1914,16 @@ int ath10k_core_register(struct ath10k *
  13753. +@@ -2107,6 +2107,16 @@ int ath10k_core_register(struct ath10k *
  13754. ar->chip_id = chip_id;
  13755. queue_work(ar->workqueue, &ar->register_work);
  13756. 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
  13757. index 281b447..a501b99 100644
  13758. --- a/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
  13759. +++ b/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
  13760. @@ -1,6 +1,6 @@
  13761. --- a/drivers/net/wireless/ath/ath10k/mac.c
  13762. +++ b/drivers/net/wireless/ath/ath10k/mac.c
  13763. -@@ -7141,6 +7141,21 @@ struct ath10k_vif *ath10k_get_arvif(stru
  13764. +@@ -7742,6 +7742,21 @@ struct ath10k_vif *ath10k_get_arvif(stru
  13765. return arvif_iter.arvif;
  13766. }
  13767. @@ -22,11 +22,11 @@
  13768. int ath10k_mac_register(struct ath10k *ar)
  13769. {
  13770. static const u32 cipher_suites[] = {
  13771. -@@ -7357,6 +7372,12 @@ int ath10k_mac_register(struct ath10k *a
  13772. +@@ -7975,6 +7990,12 @@ int ath10k_mac_register(struct ath10k *a
  13773. ar->hw->wiphy->cipher_suites = cipher_suites;
  13774. ar->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  13775. -+#if CPTCFG_MAC80211_LEDS
  13776. ++#ifdef CPTCFG_MAC80211_LEDS
  13777. + ieee80211_create_tpt_led_trigger(ar->hw,
  13778. + IEEE80211_TPT_LEDTRIG_FL_RADIO, ath10k_tpt_blink,
  13779. + ARRAY_SIZE(ath10k_tpt_blink));
  13780. diff --git a/package/kernel/mac80211/patches/936-ath10k_skip_otp_check.patch b/package/kernel/mac80211/patches/936-ath10k_skip_otp_check.patch
  13781. new file mode 100644
  13782. index 0000000..596ef98
  13783. --- /dev/null
  13784. +++ b/package/kernel/mac80211/patches/936-ath10k_skip_otp_check.patch
  13785. @@ -0,0 +1,51 @@
  13786. +--- a/drivers/net/wireless/ath/ath10k/core.c
  13787. ++++ b/drivers/net/wireless/ath/ath10k/core.c
  13788. +@@ -1243,9 +1243,6 @@ static int ath10k_core_fetch_firmware_fi
  13789. + {
  13790. + int ret;
  13791. +
  13792. +- /* calibration file is optional, don't check for any errors */
  13793. +- ath10k_fetch_cal_file(ar);
  13794. +-
  13795. + ar->fw_api = 5;
  13796. + ath10k_dbg(ar, ATH10K_DBG_BOOT, "trying fw api %d\n", ar->fw_api);
  13797. +
  13798. +@@ -1944,7 +1941,7 @@ EXPORT_SYMBOL(ath10k_core_stop);
  13799. + static int ath10k_core_probe_fw(struct ath10k *ar)
  13800. + {
  13801. + struct bmi_target_info target_info;
  13802. +- int ret = 0;
  13803. ++ int calret, ret = 0;
  13804. +
  13805. + ret = ath10k_hif_power_up(ar);
  13806. + if (ret) {
  13807. +@@ -1968,6 +1965,9 @@ static int ath10k_core_probe_fw(struct a
  13808. + goto err_power_down;
  13809. + }
  13810. +
  13811. ++ /* calibration file is optional, don't check for any errors */
  13812. ++ calret = ath10k_fetch_cal_file(ar);
  13813. ++
  13814. + ret = ath10k_core_fetch_firmware_files(ar);
  13815. + if (ret) {
  13816. + ath10k_err(ar, "could not fetch firmware files (%d)\n", ret);
  13817. +@@ -1990,11 +1990,14 @@ static int ath10k_core_probe_fw(struct a
  13818. + "could not load pre cal data: %d\n", ret);
  13819. + }
  13820. +
  13821. +- ret = ath10k_core_get_board_id_from_otp(ar);
  13822. +- if (ret && ret != -EOPNOTSUPP) {
  13823. +- ath10k_err(ar, "failed to get board id from otp: %d\n",
  13824. +- ret);
  13825. +- goto err_free_firmware_files;
  13826. ++ /* otp and board file not needed if calibration data is present */
  13827. ++ if (calret) {
  13828. ++ ret = ath10k_core_get_board_id_from_otp(ar);
  13829. ++ if (ret && ret != -EOPNOTSUPP) {
  13830. ++ ath10k_err(ar, "failed to get board id from otp: %d\n",
  13831. ++ ret);
  13832. ++ goto err_free_firmware_files;
  13833. ++ }
  13834. + }
  13835. +
  13836. + ret = ath10k_core_fetch_board_file(ar);
  13837. diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile
  13838. index e49dd48..bd851e6 100644
  13839. --- a/package/kernel/mt76/Makefile
  13840. +++ b/package/kernel/mt76/Makefile
  13841. @@ -1,7 +1,7 @@
  13842. include $(TOPDIR)/rules.mk
  13843. PKG_NAME:=mt76
  13844. -PKG_VERSION:=2016-03-03
  13845. +PKG_VERSION:=2016-08-25
  13846. PKG_RELEASE=1
  13847. PKG_LICENSE:=GPLv2
  13848. @@ -10,23 +10,26 @@ PKG_LICENSE_FILES:=
  13849. PKG_SOURCE_URL:=https://github.com/openwrt/mt76
  13850. PKG_SOURCE_PROTO:=git
  13851. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  13852. -PKG_SOURCE_VERSION:=310d420178c86e253a172413da30ecf479b64251
  13853. +PKG_SOURCE_VERSION:=c3127d2acc354b4a27c8604716b0591093601971
  13854. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
  13855. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  13856. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  13857. PKG_BUILD_PARALLEL:=1
  13858. +STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h
  13859. +
  13860. include $(INCLUDE_DIR)/kernel.mk
  13861. include $(INCLUDE_DIR)/package.mk
  13862. define KernelPackage/mt76
  13863. SUBMENU:=Wireless Drivers
  13864. - TITLE:=MediaTek MT76x2 wireless driver
  13865. - DEPENDS:=+kmod-mac80211 +@DRIVER_11N_SUPPORT @PCI_SUPPORT
  13866. + TITLE:=MediaTek MT76x2/MT7603 wireless driver
  13867. + DEPENDS:=+kmod-mac80211 +@DRIVER_11N_SUPPORT @PCI_SUPPORT @!LINUX_3_18
  13868. FILES:=\
  13869. $(PKG_BUILD_DIR)/mt76.ko \
  13870. - $(PKG_BUILD_DIR)/mt76x2e.ko
  13871. - AUTOLOAD:=$(call AutoLoad,50,mac80211 mt76 mt76x2e)
  13872. + $(PKG_BUILD_DIR)/mt76x2e.ko \
  13873. + $(PKG_BUILD_DIR)/mt7603e.ko
  13874. + AUTOLOAD:=$(call AutoLoad,50,mac80211 mt76 mt76x2e mt7603e)
  13875. endef
  13876. NOSTDINC_FLAGS = \
  13877. @@ -54,6 +57,12 @@ endef
  13878. define KernelPackage/mt76/install
  13879. $(INSTALL_DIR) $(1)/lib/firmware
  13880. cp \
  13881. + $(if $(CONFIG_TARGET_ramips_mt7628) || $(CONFIG_TARGET_ramips_mt7688), \
  13882. + $(PKG_BUILD_DIR)/firmware/mt7628_e1.bin \
  13883. + $(PKG_BUILD_DIR)/firmware/mt7628_e2.bin \
  13884. + ) \
  13885. + $(PKG_BUILD_DIR)/firmware/mt7603_e1.bin \
  13886. + $(PKG_BUILD_DIR)/firmware/mt7603_e2.bin \
  13887. $(PKG_BUILD_DIR)/firmware/mt7662_rom_patch.bin \
  13888. $(PKG_BUILD_DIR)/firmware/mt7662.bin \
  13889. $(1)/lib/firmware
  13890. diff --git a/package/kernel/mwlwifi/Makefile b/package/kernel/mwlwifi/Makefile
  13891. index 091928d..b36486d 100644
  13892. --- a/package/kernel/mwlwifi/Makefile
  13893. +++ b/package/kernel/mwlwifi/Makefile
  13894. @@ -8,7 +8,7 @@
  13895. include $(TOPDIR)/rules.mk
  13896. PKG_NAME:=mwlwifi
  13897. -PKG_VERSION:=10.3.0.16-20160105
  13898. +PKG_VERSION:=10.3.0.18-20160823-1
  13899. PKG_RELEASE=1
  13900. PKG_LICENSE:=ISC
  13901. @@ -17,7 +17,7 @@ PKG_LICENSE_FILES:=
  13902. PKG_SOURCE_URL:=https://github.com/kaloz/mwlwifi
  13903. PKG_SOURCE_PROTO:=git
  13904. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  13905. -PKG_SOURCE_VERSION:=99d3879cc72f2a25d44fb4bee96fd84eca028b04
  13906. +PKG_SOURCE_VERSION:=af606563453c819fac156faf2b15b9caef844329
  13907. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
  13908. PKG_MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>
  13909. @@ -29,7 +29,7 @@ include $(INCLUDE_DIR)/package.mk
  13910. define KernelPackage/mwlwifi
  13911. SUBMENU:=Wireless Drivers
  13912. TITLE:=Marvell 88W8864 wireless driver
  13913. - DEPENDS:=+kmod-mac80211 +@DRIVER_11N_SUPPORT @PCI_SUPPORT @TARGET_mvebu
  13914. + DEPENDS:=+kmod-mac80211 +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT @PCI_SUPPORT @TARGET_mvebu
  13915. FILES:=$(PKG_BUILD_DIR)/mwlwifi.ko
  13916. AUTOLOAD:=$(call AutoLoad,50,mac80211 mwlwifi)
  13917. endef
  13918. diff --git a/package/kernel/mwlwifi/patches/100-drop_old_api.patch b/package/kernel/mwlwifi/patches/100-drop_old_api.patch
  13919. deleted file mode 100644
  13920. index d2e149e..0000000
  13921. --- a/package/kernel/mwlwifi/patches/100-drop_old_api.patch
  13922. +++ /dev/null
  13923. @@ -1,92 +0,0 @@
  13924. ---- a/main.c
  13925. -+++ b/main.c
  13926. -@@ -418,11 +418,7 @@ static void mwl_set_ht_caps(struct mwl_p
  13927. - band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_20;
  13928. - band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_40;
  13929. -
  13930. --#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
  13931. -- hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;
  13932. --#else
  13933. - ieee80211_hw_set(hw, AMPDU_AGGREGATION);
  13934. --#endif
  13935. - band->ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K;
  13936. - band->ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_4;
  13937. -
  13938. -@@ -524,29 +520,16 @@ static int mwl_wl_init(struct mwl_priv *
  13939. - hw->queues = SYSADPT_TX_WMM_QUEUES;
  13940. -
  13941. - /* Set rssi values to dBm */
  13942. --#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
  13943. -- hw->flags |= IEEE80211_HW_SIGNAL_DBM | IEEE80211_HW_HAS_RATE_CONTROL;
  13944. --#else
  13945. - ieee80211_hw_set(hw, SIGNAL_DBM);
  13946. - ieee80211_hw_set(hw, HAS_RATE_CONTROL);
  13947. --#endif
  13948. -
  13949. - /* Ask mac80211 not to trigger PS mode
  13950. - * based on PM bit of incoming frames.
  13951. - */
  13952. --#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
  13953. -- hw->flags |= IEEE80211_HW_AP_LINK_PS;
  13954. --#else
  13955. - ieee80211_hw_set(hw, AP_LINK_PS);
  13956. --#endif
  13957. -
  13958. --#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
  13959. -- hw->flags |= IEEE80211_HW_SUPPORTS_PER_STA_GTK |
  13960. -- IEEE80211_HW_MFP_CAPABLE;
  13961. --#else
  13962. - ieee80211_hw_set(hw, SUPPORTS_PER_STA_GTK);
  13963. - ieee80211_hw_set(hw, MFP_CAPABLE);
  13964. --#endif
  13965. -
  13966. - hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
  13967. -
  13968. ---- a/dev.h
  13969. -+++ b/dev.h
  13970. -@@ -484,10 +484,6 @@ static inline struct mwl_sta *mwl_dev_ge
  13971. - return (struct mwl_sta *)&sta->drv_priv;
  13972. - }
  13973. -
  13974. --#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)
  13975. --#define ether_addr_copy(dst, src) memcpy(dst, src, ETH_ALEN)
  13976. --#endif
  13977. --
  13978. - /* Defined in mac80211.c. */
  13979. - extern const struct ieee80211_ops mwl_mac80211_ops;
  13980. -
  13981. ---- a/mac80211.c
  13982. -+++ b/mac80211.c
  13983. -@@ -572,19 +572,11 @@ static int mwl_mac80211_get_survey(struc
  13984. - return 0;
  13985. - }
  13986. -
  13987. --#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
  13988. --static int mwl_mac80211_ampdu_action(struct ieee80211_hw *hw,
  13989. -- struct ieee80211_vif *vif,
  13990. -- enum ieee80211_ampdu_mlme_action action,
  13991. -- struct ieee80211_sta *sta,
  13992. -- u16 tid, u16 *ssn, u8 buf_size)
  13993. --#else
  13994. - static int mwl_mac80211_ampdu_action(struct ieee80211_hw *hw,
  13995. - struct ieee80211_vif *vif,
  13996. - enum ieee80211_ampdu_mlme_action action,
  13997. - struct ieee80211_sta *sta,
  13998. - u16 tid, u16 *ssn, u8 buf_size, bool amsdu)
  13999. --#endif
  14000. - {
  14001. - int rc = 0;
  14002. - struct mwl_priv *priv = hw->priv;
  14003. ---- a/rx.c
  14004. -+++ b/rx.c
  14005. -@@ -232,10 +232,8 @@ static inline void mwl_rx_prepare_status
  14006. - status->flag |= RX_FLAG_VHT;
  14007. - if (bw == RX_RATE_INFO_HT40)
  14008. - status->flag |= RX_FLAG_40MHZ;
  14009. --#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 18, 0)
  14010. - if (bw == RX_RATE_INFO_HT80)
  14011. - status->vht_flag |= RX_VHT_FLAG_80MHZ;
  14012. --#endif
  14013. - if (gi == RX_RATE_INFO_SHORT_INTERVAL)
  14014. - status->flag |= RX_FLAG_SHORT_GI;
  14015. - status->vht_nss = (nss + 1);
  14016. diff --git a/package/kernel/mwlwifi/patches/110-api_sync.patch b/package/kernel/mwlwifi/patches/110-api_sync.patch
  14017. deleted file mode 100644
  14018. index ed3e06a..0000000
  14019. --- a/package/kernel/mwlwifi/patches/110-api_sync.patch
  14020. +++ /dev/null
  14021. @@ -1,19 +0,0 @@
  14022. ---- a/mac80211.c
  14023. -+++ b/mac80211.c
  14024. -@@ -597,10 +597,13 @@ static int mwl_mac80211_get_survey(struc
  14025. -
  14026. - static int mwl_mac80211_ampdu_action(struct ieee80211_hw *hw,
  14027. - struct ieee80211_vif *vif,
  14028. -- enum ieee80211_ampdu_mlme_action action,
  14029. -- struct ieee80211_sta *sta,
  14030. -- u16 tid, u16 *ssn, u8 buf_size, bool amsdu)
  14031. -+ struct ieee80211_ampdu_params *params)
  14032. - {
  14033. -+ enum ieee80211_ampdu_mlme_action action = params->action;
  14034. -+ struct ieee80211_sta *sta = params->sta;
  14035. -+ u16 tid = params->tid;
  14036. -+ u16 *ssn = &params->ssn;
  14037. -+ u8 buf_size = params->buf_size;
  14038. - int rc = 0;
  14039. - struct mwl_priv *priv = hw->priv;
  14040. - struct mwl_ampdu_stream *stream;
  14041. diff --git a/package/network/services/hostapd/Config.in b/package/network/services/hostapd/Config.in
  14042. index aee2a15..645888e 100644
  14043. --- a/package/network/services/hostapd/Config.in
  14044. +++ b/package/network/services/hostapd/Config.in
  14045. @@ -10,11 +10,10 @@ config WPA_SUPPLICANT_NO_TIMESTAMP_CHECK
  14046. choice
  14047. prompt "Choose TLS provider"
  14048. default WPA_SUPPLICANT_INTERNAL
  14049. - depends on PACKAGE_wpa-supplicant || PACKAGE_wpa-supplicant-mesh || PACKAGE_wpad || PACKAGE_wpad-mesh
  14050. + depends on PACKAGE_wpa-supplicant || PACKAGE_wpad
  14051. config WPA_SUPPLICANT_INTERNAL
  14052. bool "internal"
  14053. - depends on PACKAGE_wpa-supplicant || PACKAGE_wpad
  14054. config WPA_SUPPLICANT_OPENSSL
  14055. bool "openssl"
  14056. diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile
  14057. index 8e706dc..5caf3e3 100644
  14058. --- a/package/network/services/hostapd/Makefile
  14059. +++ b/package/network/services/hostapd/Makefile
  14060. @@ -7,18 +7,18 @@
  14061. include $(TOPDIR)/rules.mk
  14062. PKG_NAME:=hostapd
  14063. -PKG_VERSION:=2015-03-25
  14064. +PKG_VERSION:=2016-06-15
  14065. PKG_RELEASE:=1
  14066. -PKG_REV:=8278138e679174b1ec8af7f169c2810a8888e202
  14067. +PKG_REV:=31d3692fe5d56c05753ed4a70c7943979e1d29e7
  14068. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  14069. -PKG_SOURCE_URL:=git://w1.fi/srv/git/hostap.git
  14070. +PKG_SOURCE_URL:=http://w1.fi/hostap.git
  14071. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  14072. PKG_SOURCE_VERSION:=$(PKG_REV)
  14073. PKG_SOURCE_PROTO:=git
  14074. # PKG_MIRROR_MD5SUM:=4e7c1f97edd7514535056fce54ae053a
  14075. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  14076. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  14077. PKG_LICENSE:=BSD-3-Clause
  14078. PKG_BUILD_PARALLEL:=1
  14079. @@ -29,7 +29,6 @@ PKG_CONFIG_DEPENDS:= \
  14080. CONFIG_PACKAGE_kmod-cfg80211 \
  14081. CONFIG_PACKAGE_hostapd \
  14082. CONFIG_PACKAGE_hostapd-mini \
  14083. - CONFIG_PACKAGE_kmod-hostap \
  14084. CONFIG_WPA_RFKILL_SUPPORT \
  14085. CONFIG_DRIVER_WEXT_SUPPORT \
  14086. CONFIG_DRIVER_11N_SUPPORT
  14087. @@ -40,6 +39,10 @@ LOCAL_TYPE=$(strip \
  14088. hostapd \
  14089. )))
  14090. LOCAL_VARIANT=$(patsubst wpad-%,%,$(patsubst supplicant-%,%,$(BUILD_VARIANT)))
  14091. +CONFIG_VARIANT:=$(LOCAL_VARIANT)
  14092. +ifeq ($(LOCAL_VARIANT),mesh)
  14093. + CONFIG_VARIANT:=full
  14094. +endif
  14095. ifeq ($(LOCAL_TYPE),supplicant)
  14096. ifeq ($(LOCAL_VARIANT),full)
  14097. @@ -47,10 +50,6 @@ ifeq ($(LOCAL_TYPE),supplicant)
  14098. CONFIG_WPA_SUPPLICANT_INTERNAL \
  14099. CONFIG_WPA_SUPPLICANT_OPENSSL
  14100. endif
  14101. - ifeq ($(LOCAL_VARIANT),mesh)
  14102. - PKG_CONFIG_DEPENDS += \
  14103. - CONFIG_WPA_SUPPLICANT_OPENSSL
  14104. - endif
  14105. endif
  14106. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  14107. @@ -66,7 +65,6 @@ endif
  14108. DRIVER_MAKEOPTS= \
  14109. CONFIG_ACS=$(CONFIG_PACKAGE_kmod-cfg80211) \
  14110. CONFIG_DRIVER_NL80211=$(CONFIG_PACKAGE_kmod-cfg80211) \
  14111. - CONFIG_DRIVER_HOSTAP=$(CONFIG_PACKAGE_kmod-hostap) \
  14112. CONFIG_IEEE80211N=$(HOSTAPD_IEEE80211N) \
  14113. CONFIG_DRIVER_WEXT=$(CONFIG_DRIVER_WEXT_SUPPORT) \
  14114. @@ -82,7 +80,7 @@ ifneq ($(LOCAL_TYPE),hostapd)
  14115. endif
  14116. endif
  14117. ifeq ($(LOCAL_VARIANT),mesh)
  14118. - DRIVER_MAKEOPTS += CONFIG_TLS=openssl
  14119. + DRIVER_MAKEOPTS += CONFIG_TLS=openssl CONFIG_AP=y CONFIG_SAE=y CONFIG_MESH=y
  14120. TARGET_LDFLAGS += -lcrypto -lssl
  14121. endif
  14122. ifdef CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK
  14123. @@ -177,8 +175,7 @@ endef
  14124. define Package/wpad-mesh
  14125. $(call Package/wpad/Default)
  14126. TITLE+= (with 802.11s mesh and SAE support)
  14127. - DEPENDS:=$(DRV_DEPENDS) +libubus +libopenssl +@CONFIG_WPA_SUPPLICANT_OPENSSL @(!TARGET_uml||BROKEN)
  14128. - CONFLICTS:=@WPA_SUPPLICANT_INTERNAL
  14129. + DEPENDS:=$(DRV_DEPENDS) +libubus +PACKAGE_wpad-mesh:libopenssl @(!TARGET_uml||BROKEN)
  14130. VARIANT:=wpad-mesh
  14131. endef
  14132. @@ -257,12 +254,6 @@ define Package/hostapd-common
  14133. CATEGORY:=Network
  14134. endef
  14135. -define Package/hostapd-common-old
  14136. - TITLE:=hostapd/wpa_supplicant common support files (legacy drivers)
  14137. - SECTION:=net
  14138. - CATEGORY:=Network
  14139. -endef
  14140. -
  14141. define Package/eapol-test
  14142. TITLE:=802.1x authentication test utility
  14143. SECTION:=net
  14144. @@ -284,10 +275,10 @@ endif
  14145. define Build/Configure
  14146. $(Build/Configure/rebuild)
  14147. - $(if $(wildcard ./files/hostapd-$(LOCAL_VARIANT).config), \
  14148. - $(CP) ./files/hostapd-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config \
  14149. + $(if $(wildcard ./files/hostapd-$(CONFIG_VARIANT).config), \
  14150. + $(CP) ./files/hostapd-$(CONFIG_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config \
  14151. )
  14152. - $(CP) ./files/wpa_supplicant-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/wpa_supplicant/.config
  14153. + $(CP) ./files/wpa_supplicant-$(CONFIG_VARIANT).config $(PKG_BUILD_DIR)/wpa_supplicant/.config
  14154. endef
  14155. TARGET_CPPFLAGS := \
  14156. @@ -379,12 +370,6 @@ define Package/hostapd-common/install
  14157. $(INSTALL_DATA) ./files/netifd.sh $(1)/lib/netifd/hostapd.sh
  14158. endef
  14159. -define Package/hostapd-common-old/install
  14160. - $(INSTALL_DIR) $(1)/lib/wifi
  14161. - $(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/wifi/hostapd.sh
  14162. - $(INSTALL_DATA) ./files/wpa_supplicant.sh $(1)/lib/wifi/wpa_supplicant.sh
  14163. -endef
  14164. -
  14165. define Package/hostapd/install
  14166. $(call Install/hostapd,$(1))
  14167. $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd $(1)/usr/sbin/
  14168. @@ -442,5 +427,4 @@ $(eval $(call BuildPackage,wpa-supplicant-p2p))
  14169. $(eval $(call BuildPackage,wpa-cli))
  14170. $(eval $(call BuildPackage,hostapd-utils))
  14171. $(eval $(call BuildPackage,hostapd-common))
  14172. -$(eval $(call BuildPackage,hostapd-common-old))
  14173. $(eval $(call BuildPackage,eapol-test))
  14174. diff --git a/package/network/services/hostapd/files/hostapd-full.config b/package/network/services/hostapd/files/hostapd-full.config
  14175. index f1b2655..e388109 100644
  14176. --- a/package/network/services/hostapd/files/hostapd-full.config
  14177. +++ b/package/network/services/hostapd/files/hostapd-full.config
  14178. @@ -10,7 +10,7 @@
  14179. # to override previous values of the variables.
  14180. # Driver interface for Host AP driver
  14181. -CONFIG_DRIVER_HOSTAP=y
  14182. +#CONFIG_DRIVER_HOSTAP=y
  14183. # Driver interface for wired authenticator
  14184. CONFIG_DRIVER_WIRED=y
  14185. @@ -53,6 +53,9 @@ CONFIG_PEERKEY=y
  14186. # Integrated EAP server
  14187. CONFIG_EAP=y
  14188. +# EAP-FAST for the integrated EAP server
  14189. +CONFIG_EAP_FAST=y
  14190. +
  14191. # EAP-MD5 for the integrated EAP server
  14192. CONFIG_EAP_MD5=y
  14193. diff --git a/package/network/services/hostapd/files/hostapd-mini.config b/package/network/services/hostapd/files/hostapd-mini.config
  14194. index 118d97c..8baff18 100644
  14195. --- a/package/network/services/hostapd/files/hostapd-mini.config
  14196. +++ b/package/network/services/hostapd/files/hostapd-mini.config
  14197. @@ -10,7 +10,7 @@
  14198. # to override previous values of the variables.
  14199. # Driver interface for Host AP driver
  14200. -CONFIG_DRIVER_HOSTAP=y
  14201. +#CONFIG_DRIVER_HOSTAP=y
  14202. # Driver interface for wired authenticator
  14203. CONFIG_DRIVER_WIRED=y
  14204. diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
  14205. deleted file mode 100644
  14206. index 7aec7ad..0000000
  14207. --- a/package/network/services/hostapd/files/hostapd.sh
  14208. +++ /dev/null
  14209. @@ -1,394 +0,0 @@
  14210. -hostapd_set_bss_options() {
  14211. - local var="$1"
  14212. - local vif="$2"
  14213. - local enc wep_rekey wpa_group_rekey wpa_pair_rekey wpa_master_rekey wps_possible wpa_key_mgmt
  14214. -
  14215. - config_get enc "$vif" encryption "none"
  14216. - config_get wep_rekey "$vif" wep_rekey # 300
  14217. - config_get wpa_group_rekey "$vif" wpa_group_rekey # 300
  14218. - config_get wpa_pair_rekey "$vif" wpa_pair_rekey # 300
  14219. - config_get wpa_master_rekey "$vif" wpa_master_rekey # 640
  14220. - config_get_bool ap_isolate "$vif" isolate 0
  14221. - config_get_bool disassoc_low_ack "$vif" disassoc_low_ack 1
  14222. - config_get max_num_sta "$vif" max_num_sta 0
  14223. - config_get max_inactivity "$vif" max_inactivity 0
  14224. - config_get_bool preamble "$vif" short_preamble 1
  14225. -
  14226. - config_get device "$vif" device
  14227. - config_get hwmode "$device" hwmode
  14228. - config_get phy "$device" phy
  14229. -
  14230. - append "$var" "ctrl_interface=/var/run/hostapd-$phy" "$N"
  14231. -
  14232. - if [ "$ap_isolate" -gt 0 ]; then
  14233. - append "$var" "ap_isolate=$ap_isolate" "$N"
  14234. - fi
  14235. - if [ "$max_num_sta" -gt 0 ]; then
  14236. - append "$var" "max_num_sta=$max_num_sta" "$N"
  14237. - fi
  14238. - if [ "$max_inactivity" -gt 0 ]; then
  14239. - append "$var" "ap_max_inactivity=$max_inactivity" "$N"
  14240. - fi
  14241. - append "$var" "disassoc_low_ack=$disassoc_low_ack" "$N"
  14242. - if [ "$preamble" -gt 0 ]; then
  14243. - append "$var" "preamble=$preamble" "$N"
  14244. - fi
  14245. -
  14246. - # Examples:
  14247. - # psk-mixed/tkip => WPA1+2 PSK, TKIP
  14248. - # wpa-psk2/tkip+aes => WPA2 PSK, CCMP+TKIP
  14249. - # wpa2/tkip+aes => WPA2 RADIUS, CCMP+TKIP
  14250. - # ...
  14251. -
  14252. - # TODO: move this parsing function somewhere generic, so that
  14253. - # later it can be reused by drivers that don't use hostapd
  14254. -
  14255. - # crypto defaults: WPA2 vs WPA1
  14256. - case "$enc" in
  14257. - wpa2*|*psk2*)
  14258. - wpa=2
  14259. - crypto="CCMP"
  14260. - ;;
  14261. - *mixed*)
  14262. - wpa=3
  14263. - crypto="CCMP TKIP"
  14264. - ;;
  14265. - *)
  14266. - wpa=1
  14267. - crypto="TKIP"
  14268. - ;;
  14269. - esac
  14270. -
  14271. - # explicit override for crypto setting
  14272. - case "$enc" in
  14273. - *tkip+aes|*tkip+ccmp|*aes+tkip|*ccmp+tkip) crypto="CCMP TKIP";;
  14274. - *aes|*ccmp) crypto="CCMP";;
  14275. - *tkip) crypto="TKIP";;
  14276. - esac
  14277. -
  14278. - # enforce CCMP for 11ng and 11na
  14279. - case "$hwmode:$crypto" in
  14280. - *ng:TKIP|*na:TKIP) crypto="CCMP TKIP";;
  14281. - esac
  14282. -
  14283. - # use crypto/auth settings for building the hostapd config
  14284. - case "$enc" in
  14285. - none)
  14286. - wps_possible=1
  14287. - wpa=0
  14288. - crypto=
  14289. - # Here we make the assumption that if we're in open mode
  14290. - # with WPS enabled, we got to be in unconfigured state.
  14291. - wps_not_configured=1
  14292. - ;;
  14293. - *psk*)
  14294. - config_get psk "$vif" key
  14295. - if [ ${#psk} -eq 64 ]; then
  14296. - append "$var" "wpa_psk=$psk" "$N"
  14297. - else
  14298. - append "$var" "wpa_passphrase=$psk" "$N"
  14299. - fi
  14300. - wps_possible=1
  14301. - [ -n "$wpa_group_rekey" ] && append "$var" "wpa_group_rekey=$wpa_group_rekey" "$N"
  14302. - [ -n "$wpa_pair_rekey" ] && append "$var" "wpa_ptk_rekey=$wpa_pair_rekey" "$N"
  14303. - [ -n "$wpa_master_rekey" ] && append "$var" "wpa_gmk_rekey=$wpa_master_rekey" "$N"
  14304. - append wpa_key_mgmt "WPA-PSK"
  14305. - ;;
  14306. - *wpa*|*8021x*)
  14307. - # required fields? formats?
  14308. - # hostapd is particular, maybe a default configuration for failures
  14309. - config_get auth_server "$vif" auth_server
  14310. - [ -z "$auth_server" ] && config_get auth_server "$vif" server
  14311. - append "$var" "auth_server_addr=$auth_server" "$N"
  14312. - config_get auth_port "$vif" auth_port
  14313. - [ -z "$auth_port" ] && config_get auth_port "$vif" port
  14314. - auth_port=${auth_port:-1812}
  14315. - append "$var" "auth_server_port=$auth_port" "$N"
  14316. - config_get auth_secret "$vif" auth_secret
  14317. - [ -z "$auth_secret" ] && config_get auth_secret "$vif" key
  14318. - append "$var" "auth_server_shared_secret=$auth_secret" "$N"
  14319. - # You don't really want to enable this unless you are doing
  14320. - # some corner case testing or are using OpenWrt as a work around
  14321. - # for some systematic issues.
  14322. - config_get_bool auth_cache "$vif" auth_cache 0
  14323. - config_get rsn_preauth "$vif" rsn_preauth
  14324. - [ "$auth_cache" -gt 0 ] || [[ "$rsn_preauth" = 1 ]] || append "$var" "disable_pmksa_caching=1" "$N"
  14325. - [ "$auth_cache" -gt 0 ] || [[ "$rsn_preauth" = 1 ]] || append "$var" "okc=0" "$N"
  14326. - config_get acct_server "$vif" acct_server
  14327. - [ -n "$acct_server" ] && append "$var" "acct_server_addr=$acct_server" "$N"
  14328. - config_get acct_port "$vif" acct_port
  14329. - [ -n "$acct_port" ] && acct_port=${acct_port:-1813}
  14330. - [ -n "$acct_port" ] && append "$var" "acct_server_port=$acct_port" "$N"
  14331. - config_get acct_secret "$vif" acct_secret
  14332. - [ -n "$acct_secret" ] && append "$var" "acct_server_shared_secret=$acct_secret" "$N"
  14333. - config_get eap_reauth_period "$vif" eap_reauth_period
  14334. - [ -n "$eap_reauth_period" ] && append "$var" "eap_reauth_period=$eap_reauth_period" "$N"
  14335. - config_get dae_client "$vif" dae_client
  14336. - config_get dae_secret "$vif" dae_secret
  14337. - [ -n "$dae_client" -a -n "$dae_secret" ] && {
  14338. - config_get dae_port "$vif" dae_port
  14339. - append "$var" "radius_das_port=${dae_port:-3799}" "$N"
  14340. - append "$var" "radius_das_client=$dae_client $dae_secret" "$N"
  14341. - }
  14342. - config_get ownip "$vif" ownip
  14343. - append "$var" "own_ip_addr=$ownip" "$N"
  14344. - append "$var" "eapol_key_index_workaround=1" "$N"
  14345. - append "$var" "ieee8021x=1" "$N"
  14346. - append wpa_key_mgmt "WPA-EAP"
  14347. - [ -n "$wpa_group_rekey" ] && append "$var" "wpa_group_rekey=$wpa_group_rekey" "$N"
  14348. - [ -n "$wpa_pair_rekey" ] && append "$var" "wpa_ptk_rekey=$wpa_pair_rekey" "$N"
  14349. - [ -n "$wpa_master_rekey" ] && append "$var" "wpa_gmk_rekey=$wpa_master_rekey" "$N"
  14350. - ;;
  14351. - *wep*)
  14352. - config_get key "$vif" key
  14353. - key="${key:-1}"
  14354. - case "$key" in
  14355. - [1234])
  14356. - for idx in 1 2 3 4; do
  14357. - local zidx
  14358. - zidx=$(($idx - 1))
  14359. - config_get ckey "$vif" "key${idx}"
  14360. - [ -n "$ckey" ] && \
  14361. - append "$var" "wep_key${zidx}=$(prepare_key_wep "$ckey")" "$N"
  14362. - done
  14363. - append "$var" "wep_default_key=$((key - 1))" "$N"
  14364. - ;;
  14365. - *)
  14366. - append "$var" "wep_key0=$(prepare_key_wep "$key")" "$N"
  14367. - append "$var" "wep_default_key=0" "$N"
  14368. - [ -n "$wep_rekey" ] && append "$var" "wep_rekey_period=$wep_rekey" "$N"
  14369. - ;;
  14370. - esac
  14371. - case "$enc" in
  14372. - *shared*)
  14373. - auth_algs=2
  14374. - ;;
  14375. - *mixed*)
  14376. - auth_algs=3
  14377. - ;;
  14378. - esac
  14379. - wpa=0
  14380. - crypto=
  14381. - ;;
  14382. - *)
  14383. - wpa=0
  14384. - crypto=
  14385. - ;;
  14386. - esac
  14387. - append "$var" "auth_algs=${auth_algs:-1}" "$N"
  14388. - append "$var" "wpa=$wpa" "$N"
  14389. - [ -n "$crypto" ] && append "$var" "wpa_pairwise=$crypto" "$N"
  14390. - [ -n "$wpa_group_rekey" ] && append "$var" "wpa_group_rekey=$wpa_group_rekey" "$N"
  14391. -
  14392. - config_get ssid "$vif" ssid
  14393. - config_get bridge "$vif" bridge
  14394. - config_get ieee80211d "$vif" ieee80211d
  14395. - config_get iapp_interface "$vif" iapp_interface
  14396. -
  14397. - config_get_bool wps_pbc "$vif" wps_pushbutton 0
  14398. - config_get_bool wps_label "$vif" wps_label 0
  14399. -
  14400. - config_get config_methods "$vif" wps_config
  14401. - [ "$wps_pbc" -gt 0 ] && append config_methods push_button
  14402. -
  14403. - [ -n "$wps_possible" -a -n "$config_methods" ] && {
  14404. - config_get device_type "$vif" wps_device_type "6-0050F204-1"
  14405. - config_get device_name "$vif" wps_device_name "OpenWrt AP"
  14406. - config_get manufacturer "$vif" wps_manufacturer "openwrt.org"
  14407. - config_get wps_pin "$vif" wps_pin
  14408. -
  14409. - config_get_bool ext_registrar "$vif" ext_registrar 0
  14410. - [ "$ext_registrar" -gt 0 -a -n "$bridge" ] && append "$var" "upnp_iface=$bridge" "$N"
  14411. -
  14412. - append "$var" "eap_server=1" "$N"
  14413. - [ -n "$wps_pin" ] && append "$var" "ap_pin=$wps_pin" "$N"
  14414. - append "$var" "wps_state=${wps_not_configured:-2}" "$N"
  14415. - append "$var" "ap_setup_locked=0" "$N"
  14416. - append "$var" "device_type=$device_type" "$N"
  14417. - append "$var" "device_name=$device_name" "$N"
  14418. - append "$var" "manufacturer=$manufacturer" "$N"
  14419. - append "$var" "config_methods=$config_methods" "$N"
  14420. - }
  14421. -
  14422. - append "$var" "ssid=$ssid" "$N"
  14423. - [ -n "$bridge" ] && append "$var" "bridge=$bridge" "$N"
  14424. - [ -n "$ieee80211d" ] && append "$var" "ieee80211d=$ieee80211d" "$N"
  14425. - [ -n "$iapp_interface" ] && append "$var" iapp_interface=$(uci_get_state network "$iapp_interface" ifname "$iapp_interface") "$N"
  14426. -
  14427. - if [ "$wpa" -ge "1" ]
  14428. - then
  14429. - config_get nasid "$vif" nasid
  14430. - [ -n "$nasid" ] && append "$var" "nas_identifier=$nasid" "$N"
  14431. -
  14432. - config_get_bool ieee80211r "$vif" ieee80211r 0
  14433. - if [ "$ieee80211r" -gt 0 ]
  14434. - then
  14435. - config_get mobility_domain "$vif" mobility_domain "4f57"
  14436. - config_get r0_key_lifetime "$vif" r0_key_lifetime "10000"
  14437. - config_get r1_key_holder "$vif" r1_key_holder "00004f577274"
  14438. - config_get reassociation_deadline "$vif" reassociation_deadline "1000"
  14439. - config_get r0kh "$vif" r0kh
  14440. - config_get r1kh "$vif" r1kh
  14441. - config_get_bool pmk_r1_push "$vif" pmk_r1_push 0
  14442. -
  14443. - append "$var" "mobility_domain=$mobility_domain" "$N"
  14444. - append "$var" "r0_key_lifetime=$r0_key_lifetime" "$N"
  14445. - append "$var" "r1_key_holder=$r1_key_holder" "$N"
  14446. - append "$var" "reassociation_deadline=$reassociation_deadline" "$N"
  14447. - append "$var" "pmk_r1_push=$pmk_r1_push" "$N"
  14448. -
  14449. - for kh in $r0kh; do
  14450. - "$var" "r0kh=${kh//,/ }" "$N"
  14451. - done
  14452. - for kh in $r1kh; do
  14453. - "$var" "r1kh=${kh//,/ }" "$N"
  14454. - done
  14455. -
  14456. - [ "$wpa_key_mgmt" != "${wpa_key_mgmt/EAP/}" ] && append wpa_key_mgmt "FT-EAP"
  14457. - [ "$wpa_key_mgmt" != "${wpa_key_mgmt/PSK/}" ] && append wpa_key_mgmt "FT-PSK"
  14458. - fi
  14459. -
  14460. - [ -n "wpa_key_mgmt" ] && append "$var" "wpa_key_mgmt=$wpa_key_mgmt"
  14461. - fi
  14462. -
  14463. - if [ "$wpa" -ge "2" ]
  14464. - then
  14465. - # RSN -> allow preauthentication. You have two
  14466. - # options, rsn_preauth for production or rsn_preauth_testing
  14467. - # for validation / testing.
  14468. - if [ -n "$bridge" -a "$rsn_preauth" = 1 ]
  14469. - then
  14470. - append "$var" "rsn_preauth=1" "$N"
  14471. - append "$var" "rsn_preauth_interfaces=$bridge" "$N"
  14472. - append "$var" "okc=1" "$N"
  14473. - else
  14474. - # RSN preauthentication testings hould disable
  14475. - # Opportunistic Key Caching (okc) as otherwise the PMKSA
  14476. - # entry for a test could come from the Opportunistic Key Caching
  14477. - config_get rsn_preauth_testing "$vif" rsn_preauth_testing
  14478. - if [ -n "$bridge" -a "$rsn_preauth_testing" = 1 ]
  14479. - then
  14480. - append "$var" "rsn_preauth=1" "$N"
  14481. - append "$var" "rsn_preauth_interfaces=$bridge" "$N"
  14482. - append "$var" "okc=0" "$N"
  14483. - fi
  14484. - fi
  14485. -
  14486. - # RSN -> allow management frame protection
  14487. - config_get ieee80211w "$vif" ieee80211w
  14488. - case "$ieee80211w" in
  14489. - [012])
  14490. - append "$var" "ieee80211w=$ieee80211w" "$N"
  14491. - [ "$ieee80211w" -gt "0" ] && {
  14492. - config_get ieee80211w_max_timeout "$vif" ieee80211w_max_timeout
  14493. - config_get ieee80211w_retry_timeout "$vif" ieee80211w_retry_timeout
  14494. - [ -n "$ieee80211w_max_timeout" ] && \
  14495. - append "$var" "assoc_sa_query_max_timeout=$ieee80211w_max_timeout" "$N"
  14496. - [ -n "$ieee80211w_retry_timeout" ] && \
  14497. - append "$var" "assoc_sa_query_retry_timeout=$ieee80211w_retry_timeout" "$N"
  14498. - }
  14499. - ;;
  14500. - esac
  14501. - fi
  14502. -
  14503. - config_get macfile "$vif" macfile
  14504. - config_get maclist "$vif" maclist
  14505. - if [ -z "$macfile" ]
  14506. - then
  14507. - # if no macfile has been specified, fallback to the default name
  14508. - # and truncate file to avoid aggregating entries over time
  14509. - macfile="/var/run/hostapd-$ifname.maclist"
  14510. - echo "" > "$macfile"
  14511. - else
  14512. - if [ -n "$maclist" ]
  14513. - then
  14514. - # to avoid to overwrite the original file, make a copy
  14515. - # before appending the entries specified by the maclist
  14516. - # option
  14517. - cp $macfile $macfile.maclist
  14518. - macfile=$macfile.maclist
  14519. - fi
  14520. - fi
  14521. -
  14522. - if [ -n "$maclist" ]
  14523. - then
  14524. - for mac in $maclist; do
  14525. - echo "$mac" >> $macfile
  14526. - done
  14527. - fi
  14528. -
  14529. - config_get macfilter "$vif" macfilter
  14530. - case "$macfilter" in
  14531. - allow)
  14532. - append "$var" "macaddr_acl=1" "$N"
  14533. - append "$var" "accept_mac_file=$macfile" "$N"
  14534. - ;;
  14535. - deny)
  14536. - append "$var" "macaddr_acl=0" "$N"
  14537. - append "$var" "deny_mac_file=$macfile" "$N"
  14538. - ;;
  14539. - esac
  14540. -}
  14541. -
  14542. -hostapd_set_log_options() {
  14543. - local var="$1"
  14544. - local cfg="$2"
  14545. - local log_level log_80211 log_8021x log_radius log_wpa log_driver log_iapp log_mlme
  14546. -
  14547. - config_get log_level "$cfg" log_level 2
  14548. -
  14549. - config_get_bool log_80211 "$cfg" log_80211 1
  14550. - config_get_bool log_8021x "$cfg" log_8021x 1
  14551. - config_get_bool log_radius "$cfg" log_radius 1
  14552. - config_get_bool log_wpa "$cfg" log_wpa 1
  14553. - config_get_bool log_driver "$cfg" log_driver 1
  14554. - config_get_bool log_iapp "$cfg" log_iapp 1
  14555. - config_get_bool log_mlme "$cfg" log_mlme 1
  14556. -
  14557. - local log_mask=$(( \
  14558. - ($log_80211 << 0) | \
  14559. - ($log_8021x << 1) | \
  14560. - ($log_radius << 2) | \
  14561. - ($log_wpa << 3) | \
  14562. - ($log_driver << 4) | \
  14563. - ($log_iapp << 5) | \
  14564. - ($log_mlme << 6) \
  14565. - ))
  14566. -
  14567. - append "$var" "logger_syslog=$log_mask" "$N"
  14568. - append "$var" "logger_syslog_level=$log_level" "$N"
  14569. - append "$var" "logger_stdout=$log_mask" "$N"
  14570. - append "$var" "logger_stdout_level=$log_level" "$N"
  14571. -}
  14572. -
  14573. -hostapd_setup_vif() {
  14574. - local vif="$1"
  14575. - local driver="$2"
  14576. - local ifname device channel hwmode
  14577. -
  14578. - hostapd_cfg=
  14579. -
  14580. - config_get ifname "$vif" ifname
  14581. - config_get device "$vif" device
  14582. - config_get channel "$device" channel
  14583. - config_get hwmode "$device" hwmode
  14584. -
  14585. - hostapd_set_log_options hostapd_cfg "$device"
  14586. - hostapd_set_bss_options hostapd_cfg "$vif"
  14587. -
  14588. - case "$hwmode" in
  14589. - *bg|*gdt|*gst|*fh) hwmode=g;;
  14590. - *adt|*ast) hwmode=a;;
  14591. - esac
  14592. - [ "$channel" = auto ] && channel=
  14593. - [ -n "$channel" -a -z "$hwmode" ] && wifi_fixup_hwmode "$device"
  14594. - cat > /var/run/hostapd-$ifname.conf <<EOF
  14595. -driver=$driver
  14596. -interface=$ifname
  14597. -${hwmode:+hw_mode=${hwmode#11}}
  14598. -${channel:+channel=$channel}
  14599. -$hostapd_cfg
  14600. -EOF
  14601. - hostapd -P /var/run/wifi-$ifname.pid -B /var/run/hostapd-$ifname.conf
  14602. -}
  14603. -
  14604. diff --git a/package/network/services/hostapd/files/netifd.sh b/package/network/services/hostapd/files/netifd.sh
  14605. index 23d2e7e..e6b0b0d 100644
  14606. --- a/package/network/services/hostapd/files/netifd.sh
  14607. +++ b/package/network/services/hostapd/files/netifd.sh
  14608. @@ -1,3 +1,5 @@
  14609. +. /lib/functions/network.sh
  14610. +
  14611. wpa_supplicant_add_rate() {
  14612. local var="$1"
  14613. local val="$(($2 / 1000))"
  14614. @@ -120,6 +122,7 @@ hostapd_common_add_bss_config() {
  14615. config_add_boolean rsn_preauth auth_cache
  14616. config_add_int ieee80211w
  14617. + config_add_int eapol_version
  14618. config_add_string 'auth_server:host' 'server:host'
  14619. config_add_string auth_secret
  14620. @@ -136,10 +139,11 @@ hostapd_common_add_bss_config() {
  14621. config_add_string nasid
  14622. config_add_string ownip
  14623. config_add_string iapp_interface
  14624. - config_add_string eap_type ca_cert client_cert identity auth priv_key priv_key_pwd
  14625. + config_add_string eap_type ca_cert client_cert identity anonymous_identity auth priv_key priv_key_pwd
  14626. config_add_int dynamic_vlan vlan_naming
  14627. config_add_string vlan_tagged_interface vlan_bridge
  14628. + config_add_string vlan_file
  14629. config_add_string 'key1:wepkey' 'key2:wepkey' 'key3:wepkey' 'key4:wepkey' 'password:wpakey'
  14630. @@ -182,7 +186,7 @@ hostapd_set_bss_options() {
  14631. wps_pushbutton wps_label ext_registrar wps_pbc_in_m1 \
  14632. wps_device_type wps_device_name wps_manufacturer wps_pin \
  14633. macfilter ssid wmm uapsd hidden short_preamble rsn_preauth \
  14634. - iapp_interface
  14635. + iapp_interface eapol_version acct_server acct_secret acct_port
  14636. set_default isolate 0
  14637. set_default maxassoc 0
  14638. @@ -192,6 +196,8 @@ hostapd_set_bss_options() {
  14639. set_default hidden 0
  14640. set_default wmm 1
  14641. set_default uapsd 1
  14642. + set_default eapol_version 0
  14643. + set_default acct_port 1813
  14644. append bss_conf "ctrl_interface=/var/run/hostapd"
  14645. if [ "$isolate" -gt 0 ]; then
  14646. @@ -216,6 +222,13 @@ hostapd_set_bss_options() {
  14647. [ -n "$wpa_master_rekey" ] && append bss_conf "wpa_gmk_rekey=$wpa_master_rekey" "$N"
  14648. }
  14649. + [ -n "$acct_server" ] && {
  14650. + append bss_conf "acct_server_addr=$acct_server" "$N"
  14651. + append bss_conf "acct_server_port=$acct_port" "$N"
  14652. + [ -n "$acct_secret" ] && \
  14653. + append bss_conf "acct_server_shared_secret=$acct_secret" "$N"
  14654. + }
  14655. +
  14656. case "$auth_type" in
  14657. none)
  14658. wps_possible=1
  14659. @@ -237,18 +250,19 @@ hostapd_set_bss_options() {
  14660. [ -e "$wpa_psk_file" ] || touch "$wpa_psk_file"
  14661. append bss_conf "wpa_psk_file=$wpa_psk_file" "$N"
  14662. }
  14663. + [ "$eapol_version" -ge "1" -a "$eapol_version" -le "2" ] && append bss_conf "eapol_version=$eapol_version" "$N"
  14664. +
  14665. wps_possible=1
  14666. append wpa_key_mgmt "WPA-PSK"
  14667. ;;
  14668. eap)
  14669. json_get_vars \
  14670. auth_server auth_secret auth_port \
  14671. - acct_server acct_secret acct_port \
  14672. dae_client dae_secret dae_port \
  14673. ownip \
  14674. eap_reauth_period dynamic_vlan \
  14675. vlan_naming vlan_tagged_interface \
  14676. - vlan_bridge
  14677. + vlan_bridge vlan_file
  14678. # legacy compatibility
  14679. [ -n "$auth_server" ] || json_get_var auth_server server
  14680. @@ -256,7 +270,6 @@ hostapd_set_bss_options() {
  14681. [ -n "$auth_secret" ] || json_get_var auth_secret key
  14682. set_default auth_port 1812
  14683. - set_default acct_port 1813
  14684. set_default dae_port 3799
  14685. set_default vlan_naming 1
  14686. @@ -265,13 +278,6 @@ hostapd_set_bss_options() {
  14687. append bss_conf "auth_server_port=$auth_port" "$N"
  14688. append bss_conf "auth_server_shared_secret=$auth_secret" "$N"
  14689. - [ -n "$acct_server" ] && {
  14690. - append bss_conf "acct_server_addr=$acct_server" "$N"
  14691. - append bss_conf "acct_server_port=$acct_port" "$N"
  14692. - [ -n "$acct_secret" ] && \
  14693. - append bss_conf "acct_server_shared_secret=$acct_secret" "$N"
  14694. - }
  14695. -
  14696. [ -n "$eap_reauth_period" ] && append bss_conf "eap_reauth_period=$eap_reauth_period" "$N"
  14697. [ -n "$dae_client" -a -n "$dae_secret" ] && {
  14698. @@ -291,7 +297,13 @@ hostapd_set_bss_options() {
  14699. append bss_conf "vlan_bridge=$vlan_bridge" "$N"
  14700. [ -n "$vlan_tagged_interface" ] && \
  14701. append bss_conf "vlan_tagged_interface=$vlan_tagged_interface" "$N"
  14702. + [ -n "$vlan_file" ] && {
  14703. + [ -e "$vlan_file" ] || touch "$vlan_file"
  14704. + append bss_conf "vlan_file=$vlan_file" "$N"
  14705. + }
  14706. }
  14707. +
  14708. + [ "$eapol_version" -ge "1" -a "$eapol_version" -le "2" ] && append bss_conf "eapol_version=$eapol_version" "$N"
  14709. ;;
  14710. wep)
  14711. local wep_keyidx=0
  14712. @@ -318,8 +330,8 @@ hostapd_set_bss_options() {
  14713. [ -n "$wps_possible" -a -n "$config_methods" ] && {
  14714. set_default ext_registrar 0
  14715. set_default wps_device_type "6-0050F204-1"
  14716. - set_default wps_device_name "OpenWrt AP"
  14717. - set_default wps_manufacturer "openwrt.org"
  14718. + set_default wps_device_name "Lede AP"
  14719. + set_default wps_manufacturer "www.lede-project.org"
  14720. wps_state=2
  14721. [ -n "$wps_configured" ] && wps_state=1
  14722. @@ -340,8 +352,9 @@ hostapd_set_bss_options() {
  14723. append bss_conf "ssid=$ssid" "$N"
  14724. [ -n "$network_bridge" ] && append bss_conf "bridge=$network_bridge" "$N"
  14725. [ -n "$iapp_interface" ] && {
  14726. - iapp_interface="$(uci_get_state network "$iapp_interface" ifname "$iapp_interface")"
  14727. - [ -n "$iapp_interface" ] && append bss_conf "iapp_interface=$iapp_interface" "$N"
  14728. + local ifname
  14729. + network_get_device ifname "$iapp_interface" || ifname = "$iapp_interface"
  14730. + append bss_conf "iapp_interface=$ifname" "$N"
  14731. }
  14732. if [ "$wpa" -ge "1" ]; then
  14733. @@ -522,9 +535,15 @@ wpa_supplicant_prepare_interface() {
  14734. _w_modestr="mode=1"
  14735. }
  14736. + local country_str=
  14737. + [ -n "$country" ] && {
  14738. + country_str="country=$country"
  14739. + }
  14740. +
  14741. wpa_supplicant_teardown_interface "$ifname"
  14742. cat > "$_config" <<EOF
  14743. $ap_scan
  14744. +$country_str
  14745. EOF
  14746. return 0
  14747. }
  14748. @@ -538,7 +557,9 @@ wpa_supplicant_add_network() {
  14749. json_get_vars \
  14750. ssid bssid key \
  14751. basic_rate mcast_rate \
  14752. - ieee80211w
  14753. + ieee80211w ieee80211r
  14754. +
  14755. + set_default ieee80211r 0
  14756. local key_mgmt='NONE'
  14757. local enc_str=
  14758. @@ -549,6 +570,8 @@ wpa_supplicant_add_network() {
  14759. local scan_ssid="scan_ssid=1"
  14760. local freq
  14761. + [ "$ieee80211r" -gt 0 ] && wpa_key_mgmt="FT-PSK $wpa_key_mgmt"
  14762. +
  14763. [[ "$_w_mode" = "adhoc" ]] && {
  14764. append network_data "mode=1" "$N$T"
  14765. [ -n "$channel" ] && {
  14766. @@ -563,6 +586,9 @@ wpa_supplicant_add_network() {
  14767. }
  14768. [[ "$_w_mode" = "mesh" ]] && {
  14769. + json_get_vars mesh_id
  14770. + ssid="${mesh_id}"
  14771. +
  14772. append network_data "mode=5" "$N$T"
  14773. [ -n "$channel" ] && {
  14774. freq="$(get_freq "$phy" "$channel")"
  14775. @@ -594,10 +620,12 @@ wpa_supplicant_add_network() {
  14776. ;;
  14777. eap)
  14778. key_mgmt='WPA-EAP'
  14779. + [ "$ieee80211r" -gt 0 ] && key_mgmt="FT-EAP $key_mgmt"
  14780. - json_get_vars eap_type identity ca_cert
  14781. + json_get_vars eap_type identity anonymous_identity ca_cert
  14782. [ -n "$ca_cert" ] && append network_data "ca_cert=\"$ca_cert\"" "$N$T"
  14783. [ -n "$identity" ] && append network_data "identity=\"$identity\"" "$N$T"
  14784. + [ -n "$anonymous_identity" ] && append network_data "anonymous_identity=\"$anonymous_identity\"" "$N$T"
  14785. case "$eap_type" in
  14786. tls)
  14787. json_get_vars client_cert priv_key priv_key_pwd
  14788. @@ -605,11 +633,32 @@ wpa_supplicant_add_network() {
  14789. append network_data "private_key=\"$priv_key\"" "$N$T"
  14790. append network_data "private_key_passwd=\"$priv_key_pwd\"" "$N$T"
  14791. ;;
  14792. - peap|ttls)
  14793. - json_get_vars auth password
  14794. + fast|peap|ttls)
  14795. + json_get_vars auth password ca_cert2 client_cert2 priv_key2 priv_key2_pwd
  14796. set_default auth MSCHAPV2
  14797. - append network_data "phase2=\"$auth\"" "$N$T"
  14798. - append network_data "password=\"$password\"" "$N$T"
  14799. +
  14800. + if [ "$auth" = "EAP-TLS" ]; then
  14801. + [ -n "$ca_cert2" ] &&
  14802. + append network_data "ca_cert2=\"$ca_cert2\"" "$N$T"
  14803. + append network_data "client_cert2=\"$client_cert2\"" "$N$T"
  14804. + append network_data "private_key2=\"$priv_key2\"" "$N$T"
  14805. + append network_data "private_key2_passwd=\"$priv_key2_pwd\"" "$N$T"
  14806. + else
  14807. + append network_data "password=\"$password\"" "$N$T"
  14808. + fi
  14809. +
  14810. + phase2proto="auth="
  14811. + case "$auth" in
  14812. + "auth"*)
  14813. + phase2proto=""
  14814. + ;;
  14815. + "EAP-"*)
  14816. + auth="$(echo $auth | cut -b 5- )"
  14817. + [ "$eap_type" = "ttls" ] &&
  14818. + phase2proto="autheap="
  14819. + ;;
  14820. + esac
  14821. + append network_data "phase2=\"$phase2proto$auth\"" "$N$T"
  14822. ;;
  14823. esac
  14824. append network_data "eap=$(echo $eap_type | tr 'a-z' 'A-Z')" "$N$T"
  14825. diff --git a/package/network/services/hostapd/files/wpa_supplicant-full.config b/package/network/services/hostapd/files/wpa_supplicant-full.config
  14826. index a9d04ab..18c3f9a 100644
  14827. --- a/package/network/services/hostapd/files/wpa_supplicant-full.config
  14828. +++ b/package/network/services/hostapd/files/wpa_supplicant-full.config
  14829. @@ -41,7 +41,7 @@
  14830. # Driver interface for Host AP driver
  14831. -CONFIG_DRIVER_HOSTAP=y
  14832. +#CONFIG_DRIVER_HOSTAP=y
  14833. # Driver interface for Agere driver
  14834. #CONFIG_DRIVER_HERMES=y
  14835. @@ -121,6 +121,9 @@ CONFIG_DRIVER_WIRED=y
  14836. # included)
  14837. CONFIG_IEEE8021X_EAPOL=y
  14838. +# EAP-FAST
  14839. +CONFIG_EAP_FAST=y
  14840. +
  14841. # EAP-MD5
  14842. CONFIG_EAP_MD5=y
  14843. @@ -367,7 +370,7 @@ CONFIG_INTERNAL_LIBTOMMATH_FAST=y
  14844. #CONFIG_DYNAMIC_EAP_METHODS=y
  14845. # IEEE Std 802.11r-2008 (Fast BSS Transition)
  14846. -#CONFIG_IEEE80211R=y
  14847. +CONFIG_IEEE80211R=y
  14848. # Add support for writing debug log to a file (/tmp/wpa_supplicant-log-#.txt)
  14849. #CONFIG_DEBUG_FILE=y
  14850. diff --git a/package/network/services/hostapd/files/wpa_supplicant-mesh.config b/package/network/services/hostapd/files/wpa_supplicant-mesh.config
  14851. deleted file mode 100644
  14852. index 36e2908..0000000
  14853. --- a/package/network/services/hostapd/files/wpa_supplicant-mesh.config
  14854. +++ /dev/null
  14855. @@ -1,407 +0,0 @@
  14856. -# Example wpa_supplicant build time configuration
  14857. -#
  14858. -# This file lists the configuration options that are used when building the
  14859. -# hostapd binary. All lines starting with # are ignored. Configuration option
  14860. -# lines must be commented out complete, if they are not to be included, i.e.,
  14861. -# just setting VARIABLE=n is not disabling that variable.
  14862. -#
  14863. -# This file is included in Makefile, so variables like CFLAGS and LIBS can also
  14864. -# be modified from here. In most cases, these lines should use += in order not
  14865. -# to override previous values of the variables.
  14866. -
  14867. -
  14868. -# Uncomment following two lines and fix the paths if you have installed OpenSSL
  14869. -# or GnuTLS in non-default location
  14870. -#CFLAGS += -I/usr/local/openssl/include
  14871. -#LIBS += -L/usr/local/openssl/lib
  14872. -
  14873. -# Some Red Hat versions seem to include kerberos header files from OpenSSL, but
  14874. -# the kerberos files are not in the default include path. Following line can be
  14875. -# used to fix build issues on such systems (krb5.h not found).
  14876. -#CFLAGS += -I/usr/include/kerberos
  14877. -
  14878. -# Example configuration for various cross-compilation platforms
  14879. -
  14880. -#### sveasoft (e.g., for Linksys WRT54G) ######################################
  14881. -#CC=mipsel-uclibc-gcc
  14882. -#CC=/opt/brcm/hndtools-mipsel-uclibc/bin/mipsel-uclibc-gcc
  14883. -#CFLAGS += -Os
  14884. -#CPPFLAGS += -I../src/include -I../../src/router/openssl/include
  14885. -#LIBS += -L/opt/brcm/hndtools-mipsel-uclibc-0.9.19/lib -lssl
  14886. -###############################################################################
  14887. -
  14888. -#### openwrt (e.g., for Linksys WRT54G) #######################################
  14889. -#CC=mipsel-uclibc-gcc
  14890. -#CC=/opt/brcm/hndtools-mipsel-uclibc/bin/mipsel-uclibc-gcc
  14891. -#CFLAGS += -Os
  14892. -#CPPFLAGS=-I../src/include -I../openssl-0.9.7d/include \
  14893. -# -I../WRT54GS/release/src/include
  14894. -#LIBS = -lssl
  14895. -###############################################################################
  14896. -
  14897. -
  14898. -# Driver interface for Host AP driver
  14899. -CONFIG_DRIVER_HOSTAP=y
  14900. -
  14901. -# Driver interface for Agere driver
  14902. -#CONFIG_DRIVER_HERMES=y
  14903. -# Change include directories to match with the local setup
  14904. -#CFLAGS += -I../../hcf -I../../include -I../../include/hcf
  14905. -#CFLAGS += -I../../include/wireless
  14906. -
  14907. -# Driver interface for ndiswrapper
  14908. -# Deprecated; use CONFIG_DRIVER_WEXT=y instead.
  14909. -#CONFIG_DRIVER_NDISWRAPPER=y
  14910. -
  14911. -# Driver interface for Atmel driver
  14912. -# CONFIG_DRIVER_ATMEL=y
  14913. -
  14914. -# Driver interface for old Broadcom driver
  14915. -# Please note that the newer Broadcom driver ("hybrid Linux driver") supports
  14916. -# Linux wireless extensions and does not need (or even work) with the old
  14917. -# driver wrapper. Use CONFIG_DRIVER_WEXT=y with that driver.
  14918. -#CONFIG_DRIVER_BROADCOM=y
  14919. -# Example path for wlioctl.h; change to match your configuration
  14920. -#CFLAGS += -I/opt/WRT54GS/release/src/include
  14921. -
  14922. -# Driver interface for Intel ipw2100/2200 driver
  14923. -# Deprecated; use CONFIG_DRIVER_WEXT=y instead.
  14924. -#CONFIG_DRIVER_IPW=y
  14925. -
  14926. -# Driver interface for Ralink driver
  14927. -#CONFIG_DRIVER_RALINK=y
  14928. -
  14929. -# Driver interface for generic Linux wireless extensions
  14930. -CONFIG_DRIVER_WEXT=y
  14931. -
  14932. -# Driver interface for Linux drivers using the nl80211 kernel interface
  14933. -CONFIG_DRIVER_NL80211=y
  14934. -
  14935. -# Driver interface for FreeBSD net80211 layer (e.g., Atheros driver)
  14936. -#CONFIG_DRIVER_BSD=y
  14937. -#CFLAGS += -I/usr/local/include
  14938. -#LIBS += -L/usr/local/lib
  14939. -#LIBS_p += -L/usr/local/lib
  14940. -#LIBS_c += -L/usr/local/lib
  14941. -
  14942. -# Driver interface for Windows NDIS
  14943. -#CONFIG_DRIVER_NDIS=y
  14944. -#CFLAGS += -I/usr/include/w32api/ddk
  14945. -#LIBS += -L/usr/local/lib
  14946. -# For native build using mingw
  14947. -#CONFIG_NATIVE_WINDOWS=y
  14948. -# Additional directories for cross-compilation on Linux host for mingw target
  14949. -#CFLAGS += -I/opt/mingw/mingw32/include/ddk
  14950. -#LIBS += -L/opt/mingw/mingw32/lib
  14951. -#CC=mingw32-gcc
  14952. -# By default, driver_ndis uses WinPcap for low-level operations. This can be
  14953. -# replaced with the following option which replaces WinPcap calls with NDISUIO.
  14954. -# However, this requires that WZC is disabled (net stop wzcsvc) before starting
  14955. -# wpa_supplicant.
  14956. -# CONFIG_USE_NDISUIO=y
  14957. -
  14958. -# Driver interface for development testing
  14959. -#CONFIG_DRIVER_TEST=y
  14960. -
  14961. -# Include client MLME (management frame processing) for test driver
  14962. -# This can be used to test MLME operations in hostapd with the test interface.
  14963. -# space.
  14964. -#CONFIG_CLIENT_MLME=y
  14965. -
  14966. -# Driver interface for wired Ethernet drivers
  14967. -CONFIG_DRIVER_WIRED=y
  14968. -
  14969. -# Driver interface for the Broadcom RoboSwitch family
  14970. -#CONFIG_DRIVER_ROBOSWITCH=y
  14971. -
  14972. -# Driver interface for no driver (e.g., WPS ER only)
  14973. -#CONFIG_DRIVER_NONE=y
  14974. -
  14975. -# Enable IEEE 802.1X Supplicant (automatically included if any EAP method is
  14976. -# included)
  14977. -CONFIG_IEEE8021X_EAPOL=y
  14978. -
  14979. -# EAP-MD5
  14980. -CONFIG_EAP_MD5=y
  14981. -
  14982. -# EAP-MSCHAPv2
  14983. -CONFIG_EAP_MSCHAPV2=y
  14984. -
  14985. -# EAP-TLS
  14986. -CONFIG_EAP_TLS=y
  14987. -
  14988. -# EAL-PEAP
  14989. -CONFIG_EAP_PEAP=y
  14990. -
  14991. -# EAP-TTLS
  14992. -CONFIG_EAP_TTLS=y
  14993. -
  14994. -# EAP-FAST
  14995. -# Note: Default OpenSSL package does not include support for all the
  14996. -# functionality needed for EAP-FAST. If EAP-FAST is enabled with OpenSSL,
  14997. -# the OpenSSL library must be patched (openssl-0.9.8d-tls-extensions.patch)
  14998. -# to add the needed functions.
  14999. -#CONFIG_EAP_FAST=y
  15000. -
  15001. -# EAP-GTC
  15002. -CONFIG_EAP_GTC=y
  15003. -
  15004. -# EAP-OTP
  15005. -CONFIG_EAP_OTP=y
  15006. -
  15007. -# EAP-SIM (enable CONFIG_PCSC, if EAP-SIM is used)
  15008. -#CONFIG_EAP_SIM=y
  15009. -
  15010. -# EAP-PSK (experimental; this is _not_ needed for WPA-PSK)
  15011. -#CONFIG_EAP_PSK=y
  15012. -
  15013. -# EAP-PAX
  15014. -#CONFIG_EAP_PAX=y
  15015. -
  15016. -# LEAP
  15017. -CONFIG_EAP_LEAP=y
  15018. -
  15019. -# EAP-AKA (enable CONFIG_PCSC, if EAP-AKA is used)
  15020. -#CONFIG_EAP_AKA=y
  15021. -
  15022. -# EAP-AKA' (enable CONFIG_PCSC, if EAP-AKA' is used).
  15023. -# This requires CONFIG_EAP_AKA to be enabled, too.
  15024. -#CONFIG_EAP_AKA_PRIME=y
  15025. -
  15026. -# Enable USIM simulator (Milenage) for EAP-AKA
  15027. -#CONFIG_USIM_SIMULATOR=y
  15028. -
  15029. -# EAP-SAKE
  15030. -#CONFIG_EAP_SAKE=y
  15031. -
  15032. -# EAP-GPSK
  15033. -#CONFIG_EAP_GPSK=y
  15034. -# Include support for optional SHA256 cipher suite in EAP-GPSK
  15035. -#CONFIG_EAP_GPSK_SHA256=y
  15036. -
  15037. -# EAP-TNC and related Trusted Network Connect support (experimental)
  15038. -#CONFIG_EAP_TNC=y
  15039. -
  15040. -# Wi-Fi Protected Setup (WPS)
  15041. -CONFIG_WPS=y
  15042. -
  15043. -# EAP-IKEv2
  15044. -#CONFIG_EAP_IKEV2=y
  15045. -
  15046. -# PKCS#12 (PFX) support (used to read private key and certificate file from
  15047. -# a file that usually has extension .p12 or .pfx)
  15048. -CONFIG_PKCS12=y
  15049. -
  15050. -# Smartcard support (i.e., private key on a smartcard), e.g., with openssl
  15051. -# engine.
  15052. -CONFIG_SMARTCARD=y
  15053. -
  15054. -# PC/SC interface for smartcards (USIM, GSM SIM)
  15055. -# Enable this if EAP-SIM or EAP-AKA is included
  15056. -#CONFIG_PCSC=y
  15057. -
  15058. -# Development testing
  15059. -#CONFIG_EAPOL_TEST=y
  15060. -
  15061. -# Select control interface backend for external programs, e.g, wpa_cli:
  15062. -# unix = UNIX domain sockets (default for Linux/*BSD)
  15063. -# udp = UDP sockets using localhost (127.0.0.1)
  15064. -# named_pipe = Windows Named Pipe (default for Windows)
  15065. -# y = use default (backwards compatibility)
  15066. -# If this option is commented out, control interface is not included in the
  15067. -# build.
  15068. -CONFIG_CTRL_IFACE=y
  15069. -
  15070. -# Include support for GNU Readline and History Libraries in wpa_cli.
  15071. -# When building a wpa_cli binary for distribution, please note that these
  15072. -# libraries are licensed under GPL and as such, BSD license may not apply for
  15073. -# the resulting binary.
  15074. -#CONFIG_READLINE=y
  15075. -
  15076. -# Remove debugging code that is printing out debug message to stdout.
  15077. -# This can be used to reduce the size of the wpa_supplicant considerably
  15078. -# if debugging code is not needed. The size reduction can be around 35%
  15079. -# (e.g., 90 kB).
  15080. -#CONFIG_NO_STDOUT_DEBUG=y
  15081. -
  15082. -# Remove WPA support, e.g., for wired-only IEEE 802.1X supplicant, to save
  15083. -# 35-50 kB in code size.
  15084. -#CONFIG_NO_WPA=y
  15085. -
  15086. -# Remove WPA2 support. This allows WPA to be used, but removes WPA2 code to
  15087. -# save about 1 kB in code size when building only WPA-Personal (no EAP support)
  15088. -# or 6 kB if building for WPA-Enterprise.
  15089. -#CONFIG_NO_WPA2=y
  15090. -
  15091. -# Remove IEEE 802.11i/WPA-Personal ASCII passphrase support
  15092. -# This option can be used to reduce code size by removing support for
  15093. -# converting ASCII passphrases into PSK. If this functionality is removed, the
  15094. -# PSK can only be configured as the 64-octet hexstring (e.g., from
  15095. -# wpa_passphrase). This saves about 0.5 kB in code size.
  15096. -#CONFIG_NO_WPA_PASSPHRASE=y
  15097. -
  15098. -# Disable scan result processing (ap_mode=1) to save code size by about 1 kB.
  15099. -# This can be used if ap_scan=1 mode is never enabled.
  15100. -#CONFIG_NO_SCAN_PROCESSING=y
  15101. -
  15102. -# Select configuration backend:
  15103. -# file = text file (e.g., wpa_supplicant.conf; note: the configuration file
  15104. -# path is given on command line, not here; this option is just used to
  15105. -# select the backend that allows configuration files to be used)
  15106. -# winreg = Windows registry (see win_example.reg for an example)
  15107. -CONFIG_BACKEND=file
  15108. -
  15109. -# Remove configuration write functionality (i.e., to allow the configuration
  15110. -# file to be updated based on runtime configuration changes). The runtime
  15111. -# configuration can still be changed, the changes are just not going to be
  15112. -# persistent over restarts. This option can be used to reduce code size by
  15113. -# about 3.5 kB.
  15114. -#CONFIG_NO_CONFIG_WRITE=y
  15115. -
  15116. -# Remove support for configuration blobs to reduce code size by about 1.5 kB.
  15117. -#CONFIG_NO_CONFIG_BLOBS=y
  15118. -
  15119. -# Select program entry point implementation:
  15120. -# main = UNIX/POSIX like main() function (default)
  15121. -# main_winsvc = Windows service (read parameters from registry)
  15122. -# main_none = Very basic example (development use only)
  15123. -#CONFIG_MAIN=main
  15124. -
  15125. -# Select wrapper for operatins system and C library specific functions
  15126. -# unix = UNIX/POSIX like systems (default)
  15127. -# win32 = Windows systems
  15128. -# none = Empty template
  15129. -#CONFIG_OS=unix
  15130. -
  15131. -# Select event loop implementation
  15132. -# eloop = select() loop (default)
  15133. -# eloop_win = Windows events and WaitForMultipleObject() loop
  15134. -# eloop_none = Empty template
  15135. -#CONFIG_ELOOP=eloop
  15136. -
  15137. -# Select layer 2 packet implementation
  15138. -# linux = Linux packet socket (default)
  15139. -# pcap = libpcap/libdnet/WinPcap
  15140. -# freebsd = FreeBSD libpcap
  15141. -# winpcap = WinPcap with receive thread
  15142. -# ndis = Windows NDISUIO (note: requires CONFIG_USE_NDISUIO=y)
  15143. -# none = Empty template
  15144. -#CONFIG_L2_PACKET=linux
  15145. -
  15146. -# PeerKey handshake for Station to Station Link (IEEE 802.11e DLS)
  15147. -CONFIG_PEERKEY=y
  15148. -
  15149. -# IEEE 802.11w (management frame protection)
  15150. -# This version is an experimental implementation based on IEEE 802.11w/D1.0
  15151. -# draft and is subject to change since the standard has not yet been finalized.
  15152. -# Driver support is also needed for IEEE 802.11w.
  15153. -CONFIG_IEEE80211W=y
  15154. -
  15155. -# Select TLS implementation
  15156. -# openssl = OpenSSL (default)
  15157. -# gnutls = GnuTLS (needed for TLS/IA, see also CONFIG_GNUTLS_EXTRA)
  15158. -# internal = Internal TLSv1 implementation (experimental)
  15159. -# none = Empty template
  15160. -CONFIG_TLS=internal
  15161. -
  15162. -# Whether to enable TLS/IA support, which is required for EAP-TTLSv1.
  15163. -# You need CONFIG_TLS=gnutls for this to have any effect. Please note that
  15164. -# even though the core GnuTLS library is released under LGPL, this extra
  15165. -# library uses GPL and as such, the terms of GPL apply to the combination
  15166. -# of wpa_supplicant and GnuTLS if this option is enabled. BSD license may not
  15167. -# apply for distribution of the resulting binary.
  15168. -#CONFIG_GNUTLS_EXTRA=y
  15169. -
  15170. -# If CONFIG_TLS=internal is used, additional library and include paths are
  15171. -# needed for LibTomMath. Alternatively, an integrated, minimal version of
  15172. -# LibTomMath can be used. See beginning of libtommath.c for details on benefits
  15173. -# and drawbacks of this option.
  15174. -CONFIG_INTERNAL_LIBTOMMATH=y
  15175. -#ifndef CONFIG_INTERNAL_LIBTOMMATH
  15176. -#LTM_PATH=/usr/src/libtommath-0.39
  15177. -#CFLAGS += -I$(LTM_PATH)
  15178. -#LIBS += -L$(LTM_PATH)
  15179. -#LIBS_p += -L$(LTM_PATH)
  15180. -#endif
  15181. -# At the cost of about 4 kB of additional binary size, the internal LibTomMath
  15182. -# can be configured to include faster routines for exptmod, sqr, and div to
  15183. -# speed up DH and RSA calculation considerably
  15184. -CONFIG_INTERNAL_LIBTOMMATH_FAST=y
  15185. -
  15186. -# Include NDIS event processing through WMI into wpa_supplicant/wpasvc.
  15187. -# This is only for Windows builds and requires WMI-related header files and
  15188. -# WbemUuid.Lib from Platform SDK even when building with MinGW.
  15189. -#CONFIG_NDIS_EVENTS_INTEGRATED=y
  15190. -#PLATFORMSDKLIB="/opt/Program Files/Microsoft Platform SDK/Lib"
  15191. -
  15192. -# Add support for old DBus control interface
  15193. -# (fi.epitest.hostap.WPASupplicant)
  15194. -#CONFIG_CTRL_IFACE_DBUS=y
  15195. -
  15196. -# Add support for new DBus control interface
  15197. -# (fi.w1.hostap.wpa_supplicant1)
  15198. -#CONFIG_CTRL_IFACE_DBUS_NEW=y
  15199. -
  15200. -# Add introspection support for new DBus control interface
  15201. -#CONFIG_CTRL_IFACE_DBUS_INTRO=y
  15202. -
  15203. -# Add support for loading EAP methods dynamically as shared libraries.
  15204. -# When this option is enabled, each EAP method can be either included
  15205. -# statically (CONFIG_EAP_<method>=y) or dynamically (CONFIG_EAP_<method>=dyn).
  15206. -# Dynamic EAP methods are build as shared objects (eap_*.so) and they need to
  15207. -# be loaded in the beginning of the wpa_supplicant configuration file
  15208. -# (see load_dynamic_eap parameter in the example file) before being used in
  15209. -# the network blocks.
  15210. -#
  15211. -# Note that some shared parts of EAP methods are included in the main program
  15212. -# and in order to be able to use dynamic EAP methods using these parts, the
  15213. -# main program must have been build with the EAP method enabled (=y or =dyn).
  15214. -# This means that EAP-TLS/PEAP/TTLS/FAST cannot be added as dynamic libraries
  15215. -# unless at least one of them was included in the main build to force inclusion
  15216. -# of the shared code. Similarly, at least one of EAP-SIM/AKA must be included
  15217. -# in the main build to be able to load these methods dynamically.
  15218. -#
  15219. -# Please also note that using dynamic libraries will increase the total binary
  15220. -# size. Thus, it may not be the best option for targets that have limited
  15221. -# amount of memory/flash.
  15222. -#CONFIG_DYNAMIC_EAP_METHODS=y
  15223. -
  15224. -# IEEE Std 802.11r-2008 (Fast BSS Transition)
  15225. -#CONFIG_IEEE80211R=y
  15226. -
  15227. -# Add support for writing debug log to a file (/tmp/wpa_supplicant-log-#.txt)
  15228. -#CONFIG_DEBUG_FILE=y
  15229. -
  15230. -# Enable privilege separation (see README 'Privilege separation' for details)
  15231. -#CONFIG_PRIVSEP=y
  15232. -
  15233. -# Enable mitigation against certain attacks against TKIP by delaying Michael
  15234. -# MIC error reports by a random amount of time between 0 and 60 seconds
  15235. -#CONFIG_DELAYED_MIC_ERROR_REPORT=y
  15236. -
  15237. -# Enable tracing code for developer debugging
  15238. -# This tracks use of memory allocations and other registrations and reports
  15239. -# incorrect use with a backtrace of call (or allocation) location.
  15240. -#CONFIG_WPA_TRACE=y
  15241. -# For BSD, comment out these.
  15242. -#LIBS += -lexecinfo
  15243. -#LIBS_p += -lexecinfo
  15244. -#LIBS_c += -lexecinfo
  15245. -
  15246. -# Use libbfd to get more details for developer debugging
  15247. -# This enables use of libbfd to get more detailed symbols for the backtraces
  15248. -# generated by CONFIG_WPA_TRACE=y.
  15249. -#CONFIG_WPA_TRACE_BFD=y
  15250. -# For BSD, comment out these.
  15251. -#LIBS += -lbfd -liberty -lz
  15252. -#LIBS_p += -lbfd -liberty -lz
  15253. -#LIBS_c += -lbfd -liberty -lz
  15254. -
  15255. -CONFIG_NO_RANDOM_POOL=y
  15256. -NEED_80211_COMMON=y
  15257. -
  15258. -CONFIG_IBSS_RSN=y
  15259. -
  15260. -CONFIG_MESH=y
  15261. -CONFIG_SAE=y
  15262. -CONFIG_AP=y
  15263. diff --git a/package/network/services/hostapd/files/wpa_supplicant-mini.config b/package/network/services/hostapd/files/wpa_supplicant-mini.config
  15264. index a8d334d..c272153 100644
  15265. --- a/package/network/services/hostapd/files/wpa_supplicant-mini.config
  15266. +++ b/package/network/services/hostapd/files/wpa_supplicant-mini.config
  15267. @@ -41,7 +41,7 @@
  15268. # Driver interface for Host AP driver
  15269. -CONFIG_DRIVER_HOSTAP=y
  15270. +#CONFIG_DRIVER_HOSTAP=y
  15271. # Driver interface for Agere driver
  15272. #CONFIG_DRIVER_HERMES=y
  15273. diff --git a/package/network/services/hostapd/files/wpa_supplicant-p2p.config b/package/network/services/hostapd/files/wpa_supplicant-p2p.config
  15274. index 1c307d0..563dace 100644
  15275. --- a/package/network/services/hostapd/files/wpa_supplicant-p2p.config
  15276. +++ b/package/network/services/hostapd/files/wpa_supplicant-p2p.config
  15277. @@ -41,7 +41,7 @@
  15278. # Driver interface for Host AP driver
  15279. -CONFIG_DRIVER_HOSTAP=y
  15280. +#CONFIG_DRIVER_HOSTAP=y
  15281. # Driver interface for Agere driver
  15282. #CONFIG_DRIVER_HERMES=y
  15283. diff --git a/package/network/services/hostapd/files/wpa_supplicant.sh b/package/network/services/hostapd/files/wpa_supplicant.sh
  15284. deleted file mode 100644
  15285. index b678484..0000000
  15286. --- a/package/network/services/hostapd/files/wpa_supplicant.sh
  15287. +++ /dev/null
  15288. @@ -1,194 +0,0 @@
  15289. -wpa_supplicant_setup_vif() {
  15290. - local vif="$1"
  15291. - local driver="$2"
  15292. - local key="$key"
  15293. - local options="$3"
  15294. - local freq=""
  15295. - local ht="$5"
  15296. - local ap_scan=""
  15297. - local scan_ssid="1"
  15298. - [ -n "$4" ] && freq="frequency=$4"
  15299. -
  15300. - config_get enc "$vif" encryption
  15301. - config_get key "$vif" key
  15302. -
  15303. - local net_cfg bridge
  15304. - config_get bridge "$vif" bridge
  15305. - [ -z "$bridge" ] && {
  15306. - net_cfg="$(find_net_config "$vif")"
  15307. - [ -z "$net_cfg" ] || bridge="$(bridge_interface "$net_cfg")"
  15308. - config_set "$vif" bridge "$bridge"
  15309. - }
  15310. -
  15311. - local mode ifname wds modestr=""
  15312. - config_get mode "$vif" mode
  15313. - config_get ifname "$vif" ifname
  15314. - config_get_bool wds "$vif" wds 0
  15315. - [ -z "$bridge" ] || [ "$mode" = ap ] || [ "$mode" = sta -a $wds -eq 1 ] || {
  15316. - echo "wpa_supplicant_setup_vif($ifname): Refusing to bridge $mode mode interface"
  15317. - return 1
  15318. - }
  15319. - [ "$mode" = "adhoc" ] && {
  15320. - modestr="mode=1"
  15321. - scan_ssid="0"
  15322. - ap_scan="ap_scan=2"
  15323. - }
  15324. -
  15325. - key_mgmt='NONE'
  15326. - case "$enc" in
  15327. - *none*) ;;
  15328. - *wep*)
  15329. - config_get key "$vif" key
  15330. - key="${key:-1}"
  15331. - case "$key" in
  15332. - [1234])
  15333. - for idx in 1 2 3 4; do
  15334. - local zidx
  15335. - zidx=$(($idx - 1))
  15336. - config_get ckey "$vif" "key${idx}"
  15337. - [ -n "$ckey" ] && \
  15338. - append "wep_key${zidx}" "wep_key${zidx}=$(prepare_key_wep "$ckey")"
  15339. - done
  15340. - wep_tx_keyidx="wep_tx_keyidx=$((key - 1))"
  15341. - ;;
  15342. - *)
  15343. - wep_key0="wep_key0=$(prepare_key_wep "$key")"
  15344. - wep_tx_keyidx="wep_tx_keyidx=0"
  15345. - ;;
  15346. - esac
  15347. - ;;
  15348. - *psk*)
  15349. - key_mgmt='WPA-PSK'
  15350. - # if you want to use PSK with a non-nl80211 driver you
  15351. - # have to use WPA-NONE and wext driver for wpa_s
  15352. - [ "$mode" = "adhoc" -a "$driver" != "nl80211" ] && {
  15353. - key_mgmt='WPA-NONE'
  15354. - driver='wext'
  15355. - }
  15356. - if [ ${#key} -eq 64 ]; then
  15357. - passphrase="psk=${key}"
  15358. - else
  15359. - passphrase="psk=\"${key}\""
  15360. - fi
  15361. - case "$enc" in
  15362. - *psk2*)
  15363. - proto='proto=RSN'
  15364. - config_get ieee80211w "$vif" ieee80211w
  15365. - ;;
  15366. - *psk*)
  15367. - proto='proto=WPA'
  15368. - ;;
  15369. - esac
  15370. - ;;
  15371. - *wpa*|*8021x*)
  15372. - proto='proto=WPA2'
  15373. - key_mgmt='WPA-EAP'
  15374. - config_get ieee80211w "$vif" ieee80211w
  15375. - config_get ca_cert "$vif" ca_cert
  15376. - config_get eap_type "$vif" eap_type
  15377. - ca_cert=${ca_cert:+"ca_cert=\"$ca_cert\""}
  15378. - case "$eap_type" in
  15379. - tls)
  15380. - pairwise='pairwise=CCMP'
  15381. - group='group=CCMP'
  15382. - config_get identity "$vif" identity
  15383. - config_get client_cert "$vif" client_cert
  15384. - config_get priv_key "$vif" priv_key
  15385. - config_get priv_key_pwd "$vif" priv_key_pwd
  15386. - identity="identity=\"$identity\""
  15387. - client_cert="client_cert=\"$client_cert\""
  15388. - priv_key="private_key=\"$priv_key\""
  15389. - priv_key_pwd="private_key_passwd=\"$priv_key_pwd\""
  15390. - ;;
  15391. - peap|ttls)
  15392. - config_get auth "$vif" auth
  15393. - config_get identity "$vif" identity
  15394. - config_get password "$vif" password
  15395. - phase2="phase2=\"auth=${auth:-MSCHAPV2}\""
  15396. - identity="identity=\"$identity\""
  15397. - password="${password:+password=\"$password\"}"
  15398. - ;;
  15399. - esac
  15400. - eap_type="eap=$(echo $eap_type | tr 'a-z' 'A-Z')"
  15401. - ;;
  15402. - esac
  15403. -
  15404. - case "$ieee80211w" in
  15405. - [012])
  15406. - ieee80211w="ieee80211w=$ieee80211w"
  15407. - ;;
  15408. - esac
  15409. -
  15410. - local fixed_freq bssid1 beacon_int brates mrate
  15411. - config_get ifname "$vif" ifname
  15412. - config_get bridge "$vif" bridge
  15413. - config_get ssid "$vif" ssid
  15414. - config_get bssid "$vif" bssid
  15415. - bssid1=${bssid:+"bssid=$bssid"}
  15416. - beacon_int=${beacon_int:+"beacon_int=$beacon_int"}
  15417. -
  15418. - local br brval brsub brstr
  15419. - [ -n "$basic_rate_list" ] && {
  15420. - for br in $basic_rate_list; do
  15421. - brval="$(($br / 1000))"
  15422. - brsub="$((($br / 100) % 10))"
  15423. - [ "$brsub" -gt 0 ] && brval="$brval.$brsub"
  15424. - [ -n "$brstr" ] && brstr="$brstr,"
  15425. - brstr="$brstr$brval"
  15426. - done
  15427. - brates=${basic_rate_list:+"rates=$brstr"}
  15428. - }
  15429. -
  15430. - local mcval=""
  15431. - [ -n "$mcast_rate" ] && {
  15432. - mcval="$(($mcast_rate / 1000))"
  15433. - mcsub="$(( ($mcast_rate / 100) % 10 ))"
  15434. - [ "$mcsub" -gt 0 ] && mcval="$mcval.$mcsub"
  15435. - mrate=${mcast_rate:+"mcast_rate=$mcval"}
  15436. - }
  15437. -
  15438. - local ht_str
  15439. - [ -n "$ht" ] && ht_str="htmode=$ht"
  15440. -
  15441. - rm -rf /var/run/wpa_supplicant-$ifname
  15442. - cat > /var/run/wpa_supplicant-$ifname.conf <<EOF
  15443. -ctrl_interface=/var/run/wpa_supplicant-$ifname
  15444. -$ap_scan
  15445. -network={
  15446. - $modestr
  15447. - scan_ssid=$scan_ssid
  15448. - ssid="$ssid"
  15449. - $bssid1
  15450. - key_mgmt=$key_mgmt
  15451. - $proto
  15452. - $freq
  15453. - ${fixed:+"fixed_freq=1"}
  15454. - $beacon_int
  15455. - $brates
  15456. - $mrate
  15457. - $ht_str
  15458. - $ieee80211w
  15459. - $passphrase
  15460. - $pairwise
  15461. - $group
  15462. - $eap_type
  15463. - $ca_cert
  15464. - $client_cert
  15465. - $priv_key
  15466. - $priv_key_pwd
  15467. - $phase2
  15468. - $identity
  15469. - $password
  15470. - $wep_key0
  15471. - $wep_key1
  15472. - $wep_key2
  15473. - $wep_key3
  15474. - $wep_tx_keyidx
  15475. -}
  15476. -EOF
  15477. - if [ -n "$proto" -o "$key_mgmt" = "NONE" ]; then
  15478. - wpa_supplicant ${bridge:+ -b $bridge} -B -P "/var/run/wifi-${ifname}.pid" -D ${driver:-wext} -i "$ifname" -c /var/run/wpa_supplicant-$ifname.conf $options
  15479. - else
  15480. - return 0
  15481. - fi
  15482. -}
  15483. diff --git a/package/network/services/hostapd/patches/001-4addr-fix-reconnecting-client-on-connection-lost.patch b/package/network/services/hostapd/patches/001-4addr-fix-reconnecting-client-on-connection-lost.patch
  15484. new file mode 100644
  15485. index 0000000..5c8b662
  15486. --- /dev/null
  15487. +++ b/package/network/services/hostapd/patches/001-4addr-fix-reconnecting-client-on-connection-lost.patch
  15488. @@ -0,0 +1,25 @@
  15489. +From: Matthias May <matthias.may@neratec.com>
  15490. +Date: Tue, 5 Jul 2016 15:00:43 +0200
  15491. +Subject: [PATCH] 4addr: fix reconnecting client on connection lost
  15492. +
  15493. +When a 4addr client suddenly looses its connection (no deauth/deassoc)
  15494. +the AP still thinks it is connected.
  15495. +If the client reconnects before the AP timeoutes the client, traffic
  15496. +cannot flow.
  15497. +
  15498. +Fix this by making sure the WLAN_STA_WDS flag is unset in the sta->flags
  15499. +when the client completes association.
  15500. +
  15501. +Signed-off-by: Matthias May <matthias.may@neratec.com>
  15502. +---
  15503. +
  15504. +--- a/src/ap/ieee802_11.c
  15505. ++++ b/src/ap/ieee802_11.c
  15506. +@@ -2826,6 +2826,7 @@ static void handle_assoc_cb(struct hosta
  15507. + new_assoc = 0;
  15508. + sta->flags |= WLAN_STA_ASSOC;
  15509. + sta->flags &= ~WLAN_STA_WNM_SLEEP_MODE;
  15510. ++ sta->flags &= ~WLAN_STA_WDS;
  15511. + if ((!hapd->conf->ieee802_1x && !hapd->conf->wpa && !hapd->conf->osen) ||
  15512. + sta->auth_alg == WLAN_AUTH_FT) {
  15513. + /*
  15514. diff --git a/package/network/services/hostapd/patches/001-P2P-Validate-SSID-element-length-before-copying-it-C.patch b/package/network/services/hostapd/patches/001-P2P-Validate-SSID-element-length-before-copying-it-C.patch
  15515. deleted file mode 100644
  15516. index e408fbe..0000000
  15517. --- a/package/network/services/hostapd/patches/001-P2P-Validate-SSID-element-length-before-copying-it-C.patch
  15518. +++ /dev/null
  15519. @@ -1,37 +0,0 @@
  15520. -From 9ed4eee345f85e3025c33c6e20aa25696e341ccd Mon Sep 17 00:00:00 2001
  15521. -From: Jouni Malinen <jouni@qca.qualcomm.com>
  15522. -Date: Tue, 7 Apr 2015 11:32:11 +0300
  15523. -Subject: [PATCH] P2P: Validate SSID element length before copying it
  15524. - (CVE-2015-1863)
  15525. -
  15526. -This fixes a possible memcpy overflow for P2P dev->oper_ssid in
  15527. -p2p_add_device(). The length provided by the peer device (0..255 bytes)
  15528. -was used without proper bounds checking and that could have resulted in
  15529. -arbitrary data of up to 223 bytes being written beyond the end of the
  15530. -dev->oper_ssid[] array (of which about 150 bytes would be beyond the
  15531. -heap allocation) when processing a corrupted management frame for P2P
  15532. -peer discovery purposes.
  15533. -
  15534. -This could result in corrupted state in heap, unexpected program
  15535. -behavior due to corrupted P2P peer device information, denial of service
  15536. -due to process crash, exposure of memory contents during GO Negotiation,
  15537. -and potentially arbitrary code execution.
  15538. -
  15539. -Thanks to Google security team for reporting this issue and smart
  15540. -hardware research group of Alibaba security team for discovering it.
  15541. -
  15542. -Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
  15543. ----
  15544. - src/p2p/p2p.c | 1 +
  15545. - 1 file changed, 1 insertion(+)
  15546. -
  15547. ---- a/src/p2p/p2p.c
  15548. -+++ b/src/p2p/p2p.c
  15549. -@@ -778,6 +778,7 @@ int p2p_add_device(struct p2p_data *p2p,
  15550. - if (os_memcmp(addr, p2p_dev_addr, ETH_ALEN) != 0)
  15551. - os_memcpy(dev->interface_addr, addr, ETH_ALEN);
  15552. - if (msg.ssid &&
  15553. -+ msg.ssid[1] <= sizeof(dev->oper_ssid) &&
  15554. - (msg.ssid[1] != P2P_WILDCARD_SSID_LEN ||
  15555. - os_memcmp(msg.ssid + 2, P2P_WILDCARD_SSID, P2P_WILDCARD_SSID_LEN)
  15556. - != 0)) {
  15557. diff --git a/package/network/services/hostapd/patches/002-AP-WMM-Fix-integer-underflow-in-WMM-Action-frame-par.patch b/package/network/services/hostapd/patches/002-AP-WMM-Fix-integer-underflow-in-WMM-Action-frame-par.patch
  15558. deleted file mode 100644
  15559. index bc4d60f..0000000
  15560. --- a/package/network/services/hostapd/patches/002-AP-WMM-Fix-integer-underflow-in-WMM-Action-frame-par.patch
  15561. +++ /dev/null
  15562. @@ -1,36 +0,0 @@
  15563. -From ef566a4d4f74022e1fdb0a2addfe81e6de9f4aae Mon Sep 17 00:00:00 2001
  15564. -From: Jouni Malinen <j@w1.fi>
  15565. -Date: Wed, 29 Apr 2015 02:21:53 +0300
  15566. -Subject: [PATCH] AP WMM: Fix integer underflow in WMM Action frame parser
  15567. -
  15568. -The length of the WMM Action frame was not properly validated and the
  15569. -length of the information elements (int left) could end up being
  15570. -negative. This would result in reading significantly past the stack
  15571. -buffer while parsing the IEs in ieee802_11_parse_elems() and while doing
  15572. -so, resulting in segmentation fault.
  15573. -
  15574. -This can result in an invalid frame being used for a denial of service
  15575. -attack (hostapd process killed) against an AP with a driver that uses
  15576. -hostapd for management frame processing (e.g., all mac80211-based
  15577. -drivers).
  15578. -
  15579. -Thanks to Kostya Kortchinsky of Google security team for discovering and
  15580. -reporting this issue.
  15581. -
  15582. -Signed-off-by: Jouni Malinen <j@w1.fi>
  15583. ----
  15584. - src/ap/wmm.c | 3 +++
  15585. - 1 file changed, 3 insertions(+)
  15586. -
  15587. ---- a/src/ap/wmm.c
  15588. -+++ b/src/ap/wmm.c
  15589. -@@ -274,6 +274,9 @@ void hostapd_wmm_action(struct hostapd_d
  15590. - return;
  15591. - }
  15592. -
  15593. -+ if (left < 0)
  15594. -+ return; /* not a valid WMM Action frame */
  15595. -+
  15596. - /* extract the tspec info element */
  15597. - if (ieee802_11_parse_elems(pos, left, &elems, 1) == ParseFailed) {
  15598. - hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211,
  15599. diff --git a/package/network/services/hostapd/patches/002-mesh-Set-correct-secondary-channel-offset-if-HT40-is.patch b/package/network/services/hostapd/patches/002-mesh-Set-correct-secondary-channel-offset-if-HT40-is.patch
  15600. new file mode 100644
  15601. index 0000000..2439220
  15602. --- /dev/null
  15603. +++ b/package/network/services/hostapd/patches/002-mesh-Set-correct-secondary-channel-offset-if-HT40-is.patch
  15604. @@ -0,0 +1,61 @@
  15605. +From: Masashi Honma <masashi.honma@gmail.com>
  15606. +Date: Tue, 26 Jul 2016 11:45:40 +0900
  15607. +Subject: [PATCH] mesh: Set correct secondary channel offset if HT40 is
  15608. + disabled
  15609. +
  15610. +Previously, secondary channel offset could be non zero even though
  15611. +disable_ht40=1. This patch fixes it.
  15612. +
  15613. +Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
  15614. +---
  15615. +
  15616. +--- a/wpa_supplicant/wpa_supplicant.c
  15617. ++++ b/wpa_supplicant/wpa_supplicant.c
  15618. +@@ -1901,20 +1901,27 @@ void ibss_mesh_setup_freq(struct wpa_sup
  15619. + break;
  15620. + }
  15621. + }
  15622. ++#ifdef CONFIG_HT_OVERRIDES
  15623. ++ if (ssid->disable_ht40)
  15624. ++ ht40 = 0;
  15625. ++#endif /* CONFIG_HT_OVERRIDES */
  15626. +
  15627. +- /* Find secondary channel */
  15628. +- for (i = 0; i < mode->num_channels; i++) {
  15629. +- sec_chan = &mode->channels[i];
  15630. +- if (sec_chan->chan == channel + ht40 * 4)
  15631. +- break;
  15632. +- sec_chan = NULL;
  15633. +- }
  15634. +- if (!sec_chan)
  15635. +- return;
  15636. ++ if (ht40) {
  15637. ++ /* Find secondary channel */
  15638. ++ for (i = 0; i < mode->num_channels; i++) {
  15639. ++ sec_chan = &mode->channels[i];
  15640. ++ if (sec_chan->chan == channel + ht40 * 4)
  15641. ++ break;
  15642. ++ sec_chan = NULL;
  15643. ++ }
  15644. ++ if (!sec_chan)
  15645. ++ return;
  15646. +
  15647. +- /* Check secondary channel flags */
  15648. +- if (sec_chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
  15649. +- return;
  15650. ++ /* Check secondary channel flags */
  15651. ++ if (sec_chan->flag &
  15652. ++ (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
  15653. ++ return;
  15654. ++ }
  15655. +
  15656. + freq->channel = pri_chan->chan;
  15657. +
  15658. +@@ -1930,6 +1937,7 @@ void ibss_mesh_setup_freq(struct wpa_sup
  15659. + freq->sec_channel_offset = 1;
  15660. + break;
  15661. + default:
  15662. ++ freq->sec_channel_offset = 0;
  15663. + break;
  15664. + }
  15665. +
  15666. diff --git a/package/network/services/hostapd/patches/003-WPS-Fix-HTTP-chunked-transfer-encoding-parser.patch b/package/network/services/hostapd/patches/003-WPS-Fix-HTTP-chunked-transfer-encoding-parser.patch
  15667. deleted file mode 100644
  15668. index 36b4ca2..0000000
  15669. --- a/package/network/services/hostapd/patches/003-WPS-Fix-HTTP-chunked-transfer-encoding-parser.patch
  15670. +++ /dev/null
  15671. @@ -1,49 +0,0 @@
  15672. -From 5acd23f4581da58683f3cf5e36cb71bbe4070bd7 Mon Sep 17 00:00:00 2001
  15673. -From: Jouni Malinen <j@w1.fi>
  15674. -Date: Tue, 28 Apr 2015 17:08:33 +0300
  15675. -Subject: [PATCH] WPS: Fix HTTP chunked transfer encoding parser
  15676. -
  15677. -strtoul() return value may end up overflowing the int h->chunk_size and
  15678. -resulting in a negative value to be stored as the chunk_size. This could
  15679. -result in the following memcpy operation using a very large length
  15680. -argument which would result in a buffer overflow and segmentation fault.
  15681. -
  15682. -This could have been used to cause a denial service by any device that
  15683. -has been authorized for network access (either wireless or wired). This
  15684. -would affect both the WPS UPnP functionality in a WPS AP (hostapd with
  15685. -upnp_iface parameter set in the configuration) and WPS ER
  15686. -(wpa_supplicant with WPS_ER_START control interface command used).
  15687. -
  15688. -Validate the parsed chunk length value to avoid this. In addition to
  15689. -rejecting negative values, we can also reject chunk size that would be
  15690. -larger than the maximum configured body length.
  15691. -
  15692. -Thanks to Kostya Kortchinsky of Google security team for discovering and
  15693. -reporting this issue.
  15694. -
  15695. -Signed-off-by: Jouni Malinen <j@w1.fi>
  15696. ----
  15697. - src/wps/httpread.c | 7 +++++++
  15698. - 1 file changed, 7 insertions(+)
  15699. -
  15700. -diff --git a/src/wps/httpread.c b/src/wps/httpread.c
  15701. -index 2f08f37..d2855e3 100644
  15702. ---- a/src/wps/httpread.c
  15703. -+++ b/src/wps/httpread.c
  15704. -@@ -533,6 +533,13 @@ static void httpread_read_handler(int sd, void *eloop_ctx, void *sock_ctx)
  15705. - if (!isxdigit(*cbp))
  15706. - goto bad;
  15707. - h->chunk_size = strtoul(cbp, NULL, 16);
  15708. -+ if (h->chunk_size < 0 ||
  15709. -+ h->chunk_size > h->max_bytes) {
  15710. -+ wpa_printf(MSG_DEBUG,
  15711. -+ "httpread: Invalid chunk size %d",
  15712. -+ h->chunk_size);
  15713. -+ goto bad;
  15714. -+ }
  15715. - /* throw away chunk header
  15716. - * so we have only real data
  15717. - */
  15718. ---
  15719. -1.9.1
  15720. -
  15721. diff --git a/package/network/services/hostapd/patches/004-EAP-pwd-peer-Fix-payload-length-validation-for-Commi.patch b/package/network/services/hostapd/patches/004-EAP-pwd-peer-Fix-payload-length-validation-for-Commi.patch
  15722. deleted file mode 100644
  15723. index 91627fb..0000000
  15724. --- a/package/network/services/hostapd/patches/004-EAP-pwd-peer-Fix-payload-length-validation-for-Commi.patch
  15725. +++ /dev/null
  15726. @@ -1,73 +0,0 @@
  15727. -From dd2f043c9c43d156494e33d7ce22db96e6ef42c7 Mon Sep 17 00:00:00 2001
  15728. -From: Jouni Malinen <j@w1.fi>
  15729. -Date: Fri, 1 May 2015 16:37:45 +0300
  15730. -Subject: [PATCH 1/5] EAP-pwd peer: Fix payload length validation for Commit
  15731. - and Confirm
  15732. -
  15733. -The length of the received Commit and Confirm message payloads was not
  15734. -checked before reading them. This could result in a buffer read
  15735. -overflow when processing an invalid message.
  15736. -
  15737. -Fix this by verifying that the payload is of expected length before
  15738. -processing it. In addition, enforce correct state transition sequence to
  15739. -make sure there is no unexpected behavior if receiving a Commit/Confirm
  15740. -message before the previous exchanges have been completed.
  15741. -
  15742. -Thanks to Kostya Kortchinsky of Google security team for discovering and
  15743. -reporting this issue.
  15744. -
  15745. -Signed-off-by: Jouni Malinen <j@w1.fi>
  15746. ----
  15747. - src/eap_peer/eap_pwd.c | 29 +++++++++++++++++++++++++++++
  15748. - 1 file changed, 29 insertions(+)
  15749. -
  15750. -diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
  15751. -index f2b0926..a629437 100644
  15752. ---- a/src/eap_peer/eap_pwd.c
  15753. -+++ b/src/eap_peer/eap_pwd.c
  15754. -@@ -355,6 +355,23 @@ eap_pwd_perform_commit_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
  15755. - BIGNUM *mask = NULL, *x = NULL, *y = NULL, *cofactor = NULL;
  15756. - u16 offset;
  15757. - u8 *ptr, *scalar = NULL, *element = NULL;
  15758. -+ size_t prime_len, order_len;
  15759. -+
  15760. -+ if (data->state != PWD_Commit_Req) {
  15761. -+ ret->ignore = TRUE;
  15762. -+ goto fin;
  15763. -+ }
  15764. -+
  15765. -+ prime_len = BN_num_bytes(data->grp->prime);
  15766. -+ order_len = BN_num_bytes(data->grp->order);
  15767. -+
  15768. -+ if (payload_len != 2 * prime_len + order_len) {
  15769. -+ wpa_printf(MSG_INFO,
  15770. -+ "EAP-pwd: Unexpected Commit payload length %u (expected %u)",
  15771. -+ (unsigned int) payload_len,
  15772. -+ (unsigned int) (2 * prime_len + order_len));
  15773. -+ goto fin;
  15774. -+ }
  15775. -
  15776. - if (((data->private_value = BN_new()) == NULL) ||
  15777. - ((data->my_element = EC_POINT_new(data->grp->group)) == NULL) ||
  15778. -@@ -554,6 +571,18 @@ eap_pwd_perform_confirm_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
  15779. - u8 conf[SHA256_MAC_LEN], *cruft = NULL, *ptr;
  15780. - int offset;
  15781. -
  15782. -+ if (data->state != PWD_Confirm_Req) {
  15783. -+ ret->ignore = TRUE;
  15784. -+ goto fin;
  15785. -+ }
  15786. -+
  15787. -+ if (payload_len != SHA256_MAC_LEN) {
  15788. -+ wpa_printf(MSG_INFO,
  15789. -+ "EAP-pwd: Unexpected Confirm payload length %u (expected %u)",
  15790. -+ (unsigned int) payload_len, SHA256_MAC_LEN);
  15791. -+ goto fin;
  15792. -+ }
  15793. -+
  15794. - /*
  15795. - * first build up the ciphersuite which is group | random_function |
  15796. - * prf
  15797. ---
  15798. -1.9.1
  15799. -
  15800. diff --git a/package/network/services/hostapd/patches/005-EAP-pwd-server-Fix-payload-length-validation-for-Com.patch b/package/network/services/hostapd/patches/005-EAP-pwd-server-Fix-payload-length-validation-for-Com.patch
  15801. deleted file mode 100644
  15802. index 5dca20b..0000000
  15803. --- a/package/network/services/hostapd/patches/005-EAP-pwd-server-Fix-payload-length-validation-for-Com.patch
  15804. +++ /dev/null
  15805. @@ -1,66 +0,0 @@
  15806. -From e28a58be26184c2a23f80b410e0997ef1bd5d578 Mon Sep 17 00:00:00 2001
  15807. -From: Jouni Malinen <j@w1.fi>
  15808. -Date: Fri, 1 May 2015 16:40:44 +0300
  15809. -Subject: [PATCH 2/5] EAP-pwd server: Fix payload length validation for Commit
  15810. - and Confirm
  15811. -
  15812. -The length of the received Commit and Confirm message payloads was not
  15813. -checked before reading them. This could result in a buffer read
  15814. -overflow when processing an invalid message.
  15815. -
  15816. -Fix this by verifying that the payload is of expected length before
  15817. -processing it. In addition, enforce correct state transition sequence to
  15818. -make sure there is no unexpected behavior if receiving a Commit/Confirm
  15819. -message before the previous exchanges have been completed.
  15820. -
  15821. -Thanks to Kostya Kortchinsky of Google security team for discovering and
  15822. -reporting this issue.
  15823. -
  15824. -Signed-off-by: Jouni Malinen <j@w1.fi>
  15825. ----
  15826. - src/eap_server/eap_server_pwd.c | 19 +++++++++++++++++++
  15827. - 1 file changed, 19 insertions(+)
  15828. -
  15829. -diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c
  15830. -index 66bd5d2..3189105 100644
  15831. ---- a/src/eap_server/eap_server_pwd.c
  15832. -+++ b/src/eap_server/eap_server_pwd.c
  15833. -@@ -656,9 +656,21 @@ eap_pwd_process_commit_resp(struct eap_sm *sm, struct eap_pwd_data *data,
  15834. - BIGNUM *x = NULL, *y = NULL, *cofactor = NULL;
  15835. - EC_POINT *K = NULL, *point = NULL;
  15836. - int res = 0;
  15837. -+ size_t prime_len, order_len;
  15838. -
  15839. - wpa_printf(MSG_DEBUG, "EAP-pwd: Received commit response");
  15840. -
  15841. -+ prime_len = BN_num_bytes(data->grp->prime);
  15842. -+ order_len = BN_num_bytes(data->grp->order);
  15843. -+
  15844. -+ if (payload_len != 2 * prime_len + order_len) {
  15845. -+ wpa_printf(MSG_INFO,
  15846. -+ "EAP-pwd: Unexpected Commit payload length %u (expected %u)",
  15847. -+ (unsigned int) payload_len,
  15848. -+ (unsigned int) (2 * prime_len + order_len));
  15849. -+ goto fin;
  15850. -+ }
  15851. -+
  15852. - if (((data->peer_scalar = BN_new()) == NULL) ||
  15853. - ((data->k = BN_new()) == NULL) ||
  15854. - ((cofactor = BN_new()) == NULL) ||
  15855. -@@ -774,6 +786,13 @@ eap_pwd_process_confirm_resp(struct eap_sm *sm, struct eap_pwd_data *data,
  15856. - u8 conf[SHA256_MAC_LEN], *cruft = NULL, *ptr;
  15857. - int offset;
  15858. -
  15859. -+ if (payload_len != SHA256_MAC_LEN) {
  15860. -+ wpa_printf(MSG_INFO,
  15861. -+ "EAP-pwd: Unexpected Confirm payload length %u (expected %u)",
  15862. -+ (unsigned int) payload_len, SHA256_MAC_LEN);
  15863. -+ goto fin;
  15864. -+ }
  15865. -+
  15866. - /* build up the ciphersuite: group | random_function | prf */
  15867. - grp = htons(data->group_num);
  15868. - ptr = (u8 *) &cs;
  15869. ---
  15870. -1.9.1
  15871. -
  15872. diff --git a/package/network/services/hostapd/patches/006-EAP-pwd-peer-Fix-Total-Length-parsing-for-fragment-r.patch b/package/network/services/hostapd/patches/006-EAP-pwd-peer-Fix-Total-Length-parsing-for-fragment-r.patch
  15873. deleted file mode 100644
  15874. index 4d2f9d8..0000000
  15875. --- a/package/network/services/hostapd/patches/006-EAP-pwd-peer-Fix-Total-Length-parsing-for-fragment-r.patch
  15876. +++ /dev/null
  15877. @@ -1,52 +0,0 @@
  15878. -From 477c74395acd0123340457ba6f15ab345d42016e Mon Sep 17 00:00:00 2001
  15879. -From: Jouni Malinen <j@w1.fi>
  15880. -Date: Sat, 2 May 2015 19:23:04 +0300
  15881. -Subject: [PATCH 3/5] EAP-pwd peer: Fix Total-Length parsing for fragment
  15882. - reassembly
  15883. -
  15884. -The remaining number of bytes in the message could be smaller than the
  15885. -Total-Length field size, so the length needs to be explicitly checked
  15886. -prior to reading the field and decrementing the len variable. This could
  15887. -have resulted in the remaining length becoming negative and interpreted
  15888. -as a huge positive integer.
  15889. -
  15890. -In addition, check that there is no already started fragment in progress
  15891. -before allocating a new buffer for reassembling fragments. This avoid a
  15892. -potential memory leak when processing invalid message.
  15893. -
  15894. -Signed-off-by: Jouni Malinen <j@w1.fi>
  15895. ----
  15896. - src/eap_peer/eap_pwd.c | 12 ++++++++++++
  15897. - 1 file changed, 12 insertions(+)
  15898. -
  15899. -diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
  15900. -index a629437..1d2079b 100644
  15901. ---- a/src/eap_peer/eap_pwd.c
  15902. -+++ b/src/eap_peer/eap_pwd.c
  15903. -@@ -866,11 +866,23 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
  15904. - * if it's the first fragment there'll be a length field
  15905. - */
  15906. - if (EAP_PWD_GET_LENGTH_BIT(lm_exch)) {
  15907. -+ if (len < 2) {
  15908. -+ wpa_printf(MSG_DEBUG,
  15909. -+ "EAP-pwd: Frame too short to contain Total-Length field");
  15910. -+ ret->ignore = TRUE;
  15911. -+ return NULL;
  15912. -+ }
  15913. - tot_len = WPA_GET_BE16(pos);
  15914. - wpa_printf(MSG_DEBUG, "EAP-pwd: Incoming fragments whose "
  15915. - "total length = %d", tot_len);
  15916. - if (tot_len > 15000)
  15917. - return NULL;
  15918. -+ if (data->inbuf) {
  15919. -+ wpa_printf(MSG_DEBUG,
  15920. -+ "EAP-pwd: Unexpected new fragment start when previous fragment is still in use");
  15921. -+ ret->ignore = TRUE;
  15922. -+ return NULL;
  15923. -+ }
  15924. - data->inbuf = wpabuf_alloc(tot_len);
  15925. - if (data->inbuf == NULL) {
  15926. - wpa_printf(MSG_INFO, "Out of memory to buffer "
  15927. ---
  15928. -1.9.1
  15929. -
  15930. diff --git a/package/network/services/hostapd/patches/007-EAP-pwd-server-Fix-Total-Length-parsing-for-fragment.patch b/package/network/services/hostapd/patches/007-EAP-pwd-server-Fix-Total-Length-parsing-for-fragment.patch
  15931. deleted file mode 100644
  15932. index 7edef09..0000000
  15933. --- a/package/network/services/hostapd/patches/007-EAP-pwd-server-Fix-Total-Length-parsing-for-fragment.patch
  15934. +++ /dev/null
  15935. @@ -1,50 +0,0 @@
  15936. -From 3035cc2894e08319b905bd6561e8bddc8c2db9fa Mon Sep 17 00:00:00 2001
  15937. -From: Jouni Malinen <j@w1.fi>
  15938. -Date: Sat, 2 May 2015 19:26:06 +0300
  15939. -Subject: [PATCH 4/5] EAP-pwd server: Fix Total-Length parsing for fragment
  15940. - reassembly
  15941. -
  15942. -The remaining number of bytes in the message could be smaller than the
  15943. -Total-Length field size, so the length needs to be explicitly checked
  15944. -prior to reading the field and decrementing the len variable. This could
  15945. -have resulted in the remaining length becoming negative and interpreted
  15946. -as a huge positive integer.
  15947. -
  15948. -In addition, check that there is no already started fragment in progress
  15949. -before allocating a new buffer for reassembling fragments. This avoid a
  15950. -potential memory leak when processing invalid message.
  15951. -
  15952. -Signed-off-by: Jouni Malinen <j@w1.fi>
  15953. ----
  15954. - src/eap_server/eap_server_pwd.c | 10 ++++++++++
  15955. - 1 file changed, 10 insertions(+)
  15956. -
  15957. -diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c
  15958. -index 3189105..2bfc3c2 100644
  15959. ---- a/src/eap_server/eap_server_pwd.c
  15960. -+++ b/src/eap_server/eap_server_pwd.c
  15961. -@@ -942,11 +942,21 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv,
  15962. - * the first fragment has a total length
  15963. - */
  15964. - if (EAP_PWD_GET_LENGTH_BIT(lm_exch)) {
  15965. -+ if (len < 2) {
  15966. -+ wpa_printf(MSG_DEBUG,
  15967. -+ "EAP-pwd: Frame too short to contain Total-Length field");
  15968. -+ return;
  15969. -+ }
  15970. - tot_len = WPA_GET_BE16(pos);
  15971. - wpa_printf(MSG_DEBUG, "EAP-pwd: Incoming fragments, total "
  15972. - "length = %d", tot_len);
  15973. - if (tot_len > 15000)
  15974. - return;
  15975. -+ if (data->inbuf) {
  15976. -+ wpa_printf(MSG_DEBUG,
  15977. -+ "EAP-pwd: Unexpected new fragment start when previous fragment is still in use");
  15978. -+ return;
  15979. -+ }
  15980. - data->inbuf = wpabuf_alloc(tot_len);
  15981. - if (data->inbuf == NULL) {
  15982. - wpa_printf(MSG_INFO, "EAP-pwd: Out of memory to "
  15983. ---
  15984. -1.9.1
  15985. -
  15986. diff --git a/package/network/services/hostapd/patches/008-EAP-pwd-peer-Fix-asymmetric-fragmentation-behavior.patch b/package/network/services/hostapd/patches/008-EAP-pwd-peer-Fix-asymmetric-fragmentation-behavior.patch
  15987. deleted file mode 100644
  15988. index a601323..0000000
  15989. --- a/package/network/services/hostapd/patches/008-EAP-pwd-peer-Fix-asymmetric-fragmentation-behavior.patch
  15990. +++ /dev/null
  15991. @@ -1,32 +0,0 @@
  15992. -From 28a069a545b06b99eb55ad53f63f2c99e65a98f6 Mon Sep 17 00:00:00 2001
  15993. -From: Jouni Malinen <j@w1.fi>
  15994. -Date: Sat, 2 May 2015 19:26:28 +0300
  15995. -Subject: [PATCH 5/5] EAP-pwd peer: Fix asymmetric fragmentation behavior
  15996. -
  15997. -The L (Length) and M (More) flags needs to be cleared before deciding
  15998. -whether the locally generated response requires fragmentation. This
  15999. -fixes an issue where these flags from the server could have been invalid
  16000. -for the following message. In some cases, this could have resulted in
  16001. -triggering the wpabuf security check that would terminate the process
  16002. -due to invalid buffer allocation.
  16003. -
  16004. -Signed-off-by: Jouni Malinen <j@w1.fi>
  16005. ----
  16006. - src/eap_peer/eap_pwd.c | 1 +
  16007. - 1 file changed, 1 insertion(+)
  16008. -
  16009. -diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
  16010. -index 1d2079b..e58b13a 100644
  16011. ---- a/src/eap_peer/eap_pwd.c
  16012. -+++ b/src/eap_peer/eap_pwd.c
  16013. -@@ -968,6 +968,7 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
  16014. - /*
  16015. - * we have output! Do we need to fragment it?
  16016. - */
  16017. -+ lm_exch = EAP_PWD_GET_EXCHANGE(lm_exch);
  16018. - len = wpabuf_len(data->outbuf);
  16019. - if ((len + EAP_PWD_HDR_SIZE) > data->mtu) {
  16020. - resp = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_PWD, data->mtu,
  16021. ---
  16022. -1.9.1
  16023. -
  16024. diff --git a/package/network/services/hostapd/patches/009-NFC-Fix-payload-length-validation-in-NDEF-record-par.patch b/package/network/services/hostapd/patches/009-NFC-Fix-payload-length-validation-in-NDEF-record-par.patch
  16025. deleted file mode 100644
  16026. index dd34624..0000000
  16027. --- a/package/network/services/hostapd/patches/009-NFC-Fix-payload-length-validation-in-NDEF-record-par.patch
  16028. +++ /dev/null
  16029. @@ -1,61 +0,0 @@
  16030. -From df9079e72760ceb7ebe7fb11538200c516bdd886 Mon Sep 17 00:00:00 2001
  16031. -From: Jouni Malinen <j@w1.fi>
  16032. -Date: Tue, 7 Jul 2015 21:57:28 +0300
  16033. -Subject: [PATCH] NFC: Fix payload length validation in NDEF record parser
  16034. -
  16035. -It was possible for the 32-bit record->total_length value to end up
  16036. -wrapping around due to integer overflow if the longer form of payload
  16037. -length field is used and record->payload_length gets a value close to
  16038. -2^32. This could result in ndef_parse_record() accepting a too large
  16039. -payload length value and the record type filter reading up to about 20
  16040. -bytes beyond the end of the buffer and potentially killing the process.
  16041. -This could also result in an attempt to allocate close to 2^32 bytes of
  16042. -heap memory and if that were to succeed, a buffer read overflow of the
  16043. -same length which would most likely result in the process termination.
  16044. -In case of record->total_length ending up getting the value 0, there
  16045. -would be no buffer read overflow, but record parsing would result in an
  16046. -infinite loop in ndef_parse_records().
  16047. -
  16048. -Any of these error cases could potentially be used for denial of service
  16049. -attacks over NFC by using a malformed NDEF record on an NFC Tag or
  16050. -sending them during NFC connection handover if the application providing
  16051. -the NDEF message to hostapd/wpa_supplicant did no validation of the
  16052. -received records. While such validation is likely done in the NFC stack
  16053. -that needs to parse the NFC messages before further processing,
  16054. -hostapd/wpa_supplicant better be prepared for any data being included
  16055. -here.
  16056. -
  16057. -Fix this by validating record->payload_length value in a way that
  16058. -detects integer overflow. (CID 122668)
  16059. -
  16060. -Signed-off-by: Jouni Malinen <j@w1.fi>
  16061. ----
  16062. - src/wps/ndef.c | 5 ++++-
  16063. - 1 file changed, 4 insertions(+), 1 deletion(-)
  16064. -
  16065. -diff --git a/src/wps/ndef.c b/src/wps/ndef.c
  16066. -index 5604b0a..50d018f 100644
  16067. ---- a/src/wps/ndef.c
  16068. -+++ b/src/wps/ndef.c
  16069. -@@ -48,6 +48,8 @@ static int ndef_parse_record(const u8 *data, u32 size,
  16070. - if (size < 6)
  16071. - return -1;
  16072. - record->payload_length = ntohl(*(u32 *)pos);
  16073. -+ if (record->payload_length > size - 6)
  16074. -+ return -1;
  16075. - pos += sizeof(u32);
  16076. - }
  16077. -
  16078. -@@ -68,7 +70,8 @@ static int ndef_parse_record(const u8 *data, u32 size,
  16079. - pos += record->payload_length;
  16080. -
  16081. - record->total_length = pos - data;
  16082. -- if (record->total_length > size)
  16083. -+ if (record->total_length > size ||
  16084. -+ record->total_length < record->payload_length)
  16085. - return -1;
  16086. - return 0;
  16087. - }
  16088. ---
  16089. -1.9.1
  16090. -
  16091. diff --git a/package/network/services/hostapd/patches/010-WNM-Ignore-Key-Data-in-WNM-Sleep-Mode-Response-frame.patch b/package/network/services/hostapd/patches/010-WNM-Ignore-Key-Data-in-WNM-Sleep-Mode-Response-frame.patch
  16092. deleted file mode 100644
  16093. index 00e5b7c..0000000
  16094. --- a/package/network/services/hostapd/patches/010-WNM-Ignore-Key-Data-in-WNM-Sleep-Mode-Response-frame.patch
  16095. +++ /dev/null
  16096. @@ -1,32 +0,0 @@
  16097. -From 6b12d93d2c7428a34bfd4b3813ba339ed57b698a Mon Sep 17 00:00:00 2001
  16098. -From: Jouni Malinen <j@w1.fi>
  16099. -Date: Sun, 25 Oct 2015 15:45:50 +0200
  16100. -Subject: [PATCH] WNM: Ignore Key Data in WNM Sleep Mode Response frame if no
  16101. - PMF in use
  16102. -
  16103. -WNM Sleep Mode Response frame is used to update GTK/IGTK only if PMF is
  16104. -enabled. Verify that PMF is in use before using this field on station
  16105. -side to avoid accepting unauthenticated key updates. (CVE-2015-5310)
  16106. -
  16107. -Signed-off-by: Jouni Malinen <j@w1.fi>
  16108. ----
  16109. - wpa_supplicant/wnm_sta.c | 6 ++++++
  16110. - 1 file changed, 6 insertions(+)
  16111. -
  16112. -diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c
  16113. -index 954de67..7d79499 100644
  16114. ---- a/wpa_supplicant/wnm_sta.c
  16115. -+++ b/wpa_supplicant/wnm_sta.c
  16116. -@@ -187,6 +187,12 @@ static void wnm_sleep_mode_exit_success(struct wpa_supplicant *wpa_s,
  16117. - end = ptr + key_len_total;
  16118. - wpa_hexdump_key(MSG_DEBUG, "WNM: Key Data", ptr, key_len_total);
  16119. -
  16120. -+ if (key_len_total && !wpa_sm_pmf_enabled(wpa_s->wpa)) {
  16121. -+ wpa_msg(wpa_s, MSG_INFO,
  16122. -+ "WNM: Ignore Key Data in WNM-Sleep Mode Response - PMF not enabled");
  16123. -+ return;
  16124. -+ }
  16125. -+
  16126. - while (ptr + 1 < end) {
  16127. - if (ptr + 2 + ptr[1] > end) {
  16128. - wpa_printf(MSG_DEBUG, "WNM: Invalid Key Data element "
  16129. diff --git a/package/network/services/hostapd/patches/011-EAP-pwd-peer-Fix-last-fragment-length-validation.patch b/package/network/services/hostapd/patches/011-EAP-pwd-peer-Fix-last-fragment-length-validation.patch
  16130. deleted file mode 100644
  16131. index 82c2639..0000000
  16132. --- a/package/network/services/hostapd/patches/011-EAP-pwd-peer-Fix-last-fragment-length-validation.patch
  16133. +++ /dev/null
  16134. @@ -1,54 +0,0 @@
  16135. -From 8057821706784608b828e769ccefbced95591e50 Mon Sep 17 00:00:00 2001
  16136. -From: Jouni Malinen <j@w1.fi>
  16137. -Date: Sun, 1 Nov 2015 18:18:17 +0200
  16138. -Subject: [PATCH] EAP-pwd peer: Fix last fragment length validation
  16139. -
  16140. -All but the last fragment had their length checked against the remaining
  16141. -room in the reassembly buffer. This allowed a suitably constructed last
  16142. -fragment frame to try to add extra data that would go beyond the buffer.
  16143. -The length validation code in wpabuf_put_data() prevents an actual
  16144. -buffer write overflow from occurring, but this results in process
  16145. -termination. (CVE-2015-5315)
  16146. -
  16147. -Signed-off-by: Jouni Malinen <j@w1.fi>
  16148. ----
  16149. - src/eap_peer/eap_pwd.c | 7 +++----
  16150. - 1 file changed, 3 insertions(+), 4 deletions(-)
  16151. -
  16152. -diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
  16153. -index 1f78544..75ceef1 100644
  16154. ---- a/src/eap_peer/eap_pwd.c
  16155. -+++ b/src/eap_peer/eap_pwd.c
  16156. -@@ -903,7 +903,7 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
  16157. - /*
  16158. - * buffer and ACK the fragment
  16159. - */
  16160. -- if (EAP_PWD_GET_MORE_BIT(lm_exch)) {
  16161. -+ if (EAP_PWD_GET_MORE_BIT(lm_exch) || data->in_frag_pos) {
  16162. - data->in_frag_pos += len;
  16163. - if (data->in_frag_pos > wpabuf_size(data->inbuf)) {
  16164. - wpa_printf(MSG_INFO, "EAP-pwd: Buffer overflow attack "
  16165. -@@ -916,7 +916,8 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
  16166. - return NULL;
  16167. - }
  16168. - wpabuf_put_data(data->inbuf, pos, len);
  16169. --
  16170. -+ }
  16171. -+ if (EAP_PWD_GET_MORE_BIT(lm_exch)) {
  16172. - resp = eap_msg_alloc(EAP_VENDOR_IETF, EAP_TYPE_PWD,
  16173. - EAP_PWD_HDR_SIZE,
  16174. - EAP_CODE_RESPONSE, eap_get_id(reqData));
  16175. -@@ -930,10 +931,8 @@ eap_pwd_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret,
  16176. - * we're buffering and this is the last fragment
  16177. - */
  16178. - if (data->in_frag_pos) {
  16179. -- wpabuf_put_data(data->inbuf, pos, len);
  16180. - wpa_printf(MSG_DEBUG, "EAP-pwd: Last fragment, %d bytes",
  16181. - (int) len);
  16182. -- data->in_frag_pos += len;
  16183. - pos = wpabuf_head_u8(data->inbuf);
  16184. - len = data->in_frag_pos;
  16185. - }
  16186. ---
  16187. -1.9.1
  16188. -
  16189. diff --git a/package/network/services/hostapd/patches/012-EAP-pwd-server-Fix-last-fragment-length-validation.patch b/package/network/services/hostapd/patches/012-EAP-pwd-server-Fix-last-fragment-length-validation.patch
  16190. deleted file mode 100644
  16191. index bfc4c74..0000000
  16192. --- a/package/network/services/hostapd/patches/012-EAP-pwd-server-Fix-last-fragment-length-validation.patch
  16193. +++ /dev/null
  16194. @@ -1,51 +0,0 @@
  16195. -From bef802ece03f9ae9d52a21f0cf4f1bc2c5a1f8aa Mon Sep 17 00:00:00 2001
  16196. -From: Jouni Malinen <j@w1.fi>
  16197. -Date: Sun, 1 Nov 2015 18:24:16 +0200
  16198. -Subject: [PATCH] EAP-pwd server: Fix last fragment length validation
  16199. -
  16200. -All but the last fragment had their length checked against the remaining
  16201. -room in the reassembly buffer. This allowed a suitably constructed last
  16202. -fragment frame to try to add extra data that would go beyond the buffer.
  16203. -The length validation code in wpabuf_put_data() prevents an actual
  16204. -buffer write overflow from occurring, but this results in process
  16205. -termination. (CVE-2015-5314)
  16206. -
  16207. -Signed-off-by: Jouni Malinen <j@w1.fi>
  16208. ----
  16209. - src/eap_server/eap_server_pwd.c | 6 +++---
  16210. - 1 file changed, 3 insertions(+), 3 deletions(-)
  16211. -
  16212. -diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c
  16213. -index cb83ff7..9f787ab 100644
  16214. ---- a/src/eap_server/eap_server_pwd.c
  16215. -+++ b/src/eap_server/eap_server_pwd.c
  16216. -@@ -970,7 +970,7 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv,
  16217. - /*
  16218. - * the first and all intermediate fragments have the M bit set
  16219. - */
  16220. -- if (EAP_PWD_GET_MORE_BIT(lm_exch)) {
  16221. -+ if (EAP_PWD_GET_MORE_BIT(lm_exch) || data->in_frag_pos) {
  16222. - if ((data->in_frag_pos + len) > wpabuf_size(data->inbuf)) {
  16223. - wpa_printf(MSG_DEBUG, "EAP-pwd: Buffer overflow "
  16224. - "attack detected! (%d+%d > %d)",
  16225. -@@ -981,6 +981,8 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv,
  16226. - }
  16227. - wpabuf_put_data(data->inbuf, pos, len);
  16228. - data->in_frag_pos += len;
  16229. -+ }
  16230. -+ if (EAP_PWD_GET_MORE_BIT(lm_exch)) {
  16231. - wpa_printf(MSG_DEBUG, "EAP-pwd: Got a %d byte fragment",
  16232. - (int) len);
  16233. - return;
  16234. -@@ -990,8 +992,6 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv,
  16235. - * buffering fragments so that's how we know it's the last)
  16236. - */
  16237. - if (data->in_frag_pos) {
  16238. -- wpabuf_put_data(data->inbuf, pos, len);
  16239. -- data->in_frag_pos += len;
  16240. - pos = wpabuf_head_u8(data->inbuf);
  16241. - len = data->in_frag_pos;
  16242. - wpa_printf(MSG_DEBUG, "EAP-pwd: Last fragment, %d bytes",
  16243. ---
  16244. -1.9.1
  16245. -
  16246. diff --git a/package/network/services/hostapd/patches/013-EAP-pwd-peer-Fix-error-path-for-unexpected-Confirm-m.patch b/package/network/services/hostapd/patches/013-EAP-pwd-peer-Fix-error-path-for-unexpected-Confirm-m.patch
  16247. deleted file mode 100644
  16248. index 3088f6a..0000000
  16249. --- a/package/network/services/hostapd/patches/013-EAP-pwd-peer-Fix-error-path-for-unexpected-Confirm-m.patch
  16250. +++ /dev/null
  16251. @@ -1,34 +0,0 @@
  16252. -From 95577884ca4fa76be91344ff7a8d5d1e6dc3da61 Mon Sep 17 00:00:00 2001
  16253. -From: Jouni Malinen <j@w1.fi>
  16254. -Date: Sun, 1 Nov 2015 19:35:44 +0200
  16255. -Subject: [PATCH] EAP-pwd peer: Fix error path for unexpected Confirm message
  16256. -
  16257. -If the Confirm message is received from the server before the Identity
  16258. -exchange has been completed, the group has not yet been determined and
  16259. -data->grp is NULL. The error path in eap_pwd_perform_confirm_exchange()
  16260. -did not take this corner case into account and could end up
  16261. -dereferencing a NULL pointer and terminating the process if invalid
  16262. -message sequence is received. (CVE-2015-5316)
  16263. -
  16264. -Signed-off-by: Jouni Malinen <j@w1.fi>
  16265. ----
  16266. - src/eap_peer/eap_pwd.c | 3 ++-
  16267. - 1 file changed, 2 insertions(+), 1 deletion(-)
  16268. -
  16269. -diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
  16270. -index 75ceef1..892b590 100644
  16271. ---- a/src/eap_peer/eap_pwd.c
  16272. -+++ b/src/eap_peer/eap_pwd.c
  16273. -@@ -774,7 +774,8 @@ eap_pwd_perform_confirm_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
  16274. - wpabuf_put_data(data->outbuf, conf, SHA256_MAC_LEN);
  16275. -
  16276. - fin:
  16277. -- bin_clear_free(cruft, BN_num_bytes(data->grp->prime));
  16278. -+ if (data->grp)
  16279. -+ bin_clear_free(cruft, BN_num_bytes(data->grp->prime));
  16280. - BN_clear_free(x);
  16281. - BN_clear_free(y);
  16282. - if (data->outbuf == NULL) {
  16283. ---
  16284. -1.9.1
  16285. -
  16286. diff --git a/package/network/services/hostapd/patches/100-mesh_mode_fix.patch b/package/network/services/hostapd/patches/100-mesh_mode_fix.patch
  16287. new file mode 100644
  16288. index 0000000..ceb4c53
  16289. --- /dev/null
  16290. +++ b/package/network/services/hostapd/patches/100-mesh_mode_fix.patch
  16291. @@ -0,0 +1,12 @@
  16292. +--- a/src/drivers/driver_nl80211.c
  16293. ++++ b/src/drivers/driver_nl80211.c
  16294. +@@ -2332,7 +2332,8 @@ wpa_driver_nl80211_finish_drv_init(struc
  16295. +
  16296. + if (drv->hostapd || bss->static_ap)
  16297. + nlmode = NL80211_IFTYPE_AP;
  16298. +- else if (bss->if_dynamic)
  16299. ++ else if (bss->if_dynamic ||
  16300. ++ nl80211_get_ifmode(bss) == NL80211_IFTYPE_MESH_POINT)
  16301. + nlmode = nl80211_get_ifmode(bss);
  16302. + else
  16303. + nlmode = NL80211_IFTYPE_STATION;
  16304. diff --git a/package/network/services/hostapd/patches/110-bool_fix.patch b/package/network/services/hostapd/patches/110-bool_fix.patch
  16305. deleted file mode 100644
  16306. index 865c014..0000000
  16307. --- a/package/network/services/hostapd/patches/110-bool_fix.patch
  16308. +++ /dev/null
  16309. @@ -1,14 +0,0 @@
  16310. ---- a/src/ap/ieee802_1x.c
  16311. -+++ b/src/ap/ieee802_1x.c
  16312. -@@ -2332,9 +2332,9 @@ void ieee802_1x_notify_pre_auth(struct e
  16313. - }
  16314. -
  16315. -
  16316. --static const char * bool_txt(Boolean bool)
  16317. -+static const char * bool_txt(Boolean bool_val)
  16318. - {
  16319. -- return bool ? "TRUE" : "FALSE";
  16320. -+ return bool_val ? "TRUE" : "FALSE";
  16321. - }
  16322. -
  16323. -
  16324. diff --git a/package/network/services/hostapd/patches/110-fix_parse_das_client.patch b/package/network/services/hostapd/patches/110-fix_parse_das_client.patch
  16325. new file mode 100644
  16326. index 0000000..67fb899
  16327. --- /dev/null
  16328. +++ b/package/network/services/hostapd/patches/110-fix_parse_das_client.patch
  16329. @@ -0,0 +1,10 @@
  16330. +--- a/hostapd/config_file.c
  16331. ++++ b/hostapd/config_file.c
  16332. +@@ -645,6 +645,7 @@ static int hostapd_parse_das_client(stru
  16333. + if (secret == NULL)
  16334. + return -1;
  16335. +
  16336. ++ *secret = 0;
  16337. + secret++;
  16338. +
  16339. + if (hostapd_parse_ip_addr(val, &bss->radius_das_client_addr))
  16340. diff --git a/package/network/services/hostapd/patches/120-daemonize_fix.patch b/package/network/services/hostapd/patches/120-daemonize_fix.patch
  16341. index 032e207..0389406 100644
  16342. --- a/package/network/services/hostapd/patches/120-daemonize_fix.patch
  16343. +++ b/package/network/services/hostapd/patches/120-daemonize_fix.patch
  16344. @@ -8,7 +8,7 @@
  16345. #ifdef ANDROID
  16346. #include <sys/capability.h>
  16347. -@@ -155,59 +156,46 @@ int os_gmtime(os_time_t t, struct os_tm
  16348. +@@ -179,59 +180,46 @@ int os_gmtime(os_time_t t, struct os_tm
  16349. return 0;
  16350. }
  16351. @@ -60,13 +60,13 @@
  16352. + if (chdir("/") < 0)
  16353. return -1;
  16354. - }
  16355. --
  16356. +
  16357. - return 0;
  16358. -}
  16359. -#else /* __APPLE__ */
  16360. -#define os_daemon daemon
  16361. -#endif /* __APPLE__ */
  16362. -
  16363. +-
  16364. -
  16365. -int os_daemonize(const char *pid_file)
  16366. -{
  16367. diff --git a/package/network/services/hostapd/patches/130-no_eapol_fix.patch b/package/network/services/hostapd/patches/130-no_eapol_fix.patch
  16368. index d23b47b..5aee3d0 100644
  16369. --- a/package/network/services/hostapd/patches/130-no_eapol_fix.patch
  16370. +++ b/package/network/services/hostapd/patches/130-no_eapol_fix.patch
  16371. @@ -1,6 +1,6 @@
  16372. --- a/wpa_supplicant/wpa_supplicant.c
  16373. +++ b/wpa_supplicant/wpa_supplicant.c
  16374. -@@ -252,9 +252,10 @@ void wpa_supplicant_cancel_auth_timeout(
  16375. +@@ -257,9 +257,10 @@ void wpa_supplicant_cancel_auth_timeout(
  16376. */
  16377. void wpa_supplicant_initiate_eapol(struct wpa_supplicant *wpa_s)
  16378. {
  16379. diff --git a/package/network/services/hostapd/patches/140-disable_bridge_packet_workaround.patch b/package/network/services/hostapd/patches/140-disable_bridge_packet_workaround.patch
  16380. index 6337d8d..fdd5da9 100644
  16381. --- a/package/network/services/hostapd/patches/140-disable_bridge_packet_workaround.patch
  16382. +++ b/package/network/services/hostapd/patches/140-disable_bridge_packet_workaround.patch
  16383. @@ -1,6 +1,6 @@
  16384. --- a/src/l2_packet/l2_packet_linux.c
  16385. +++ b/src/l2_packet/l2_packet_linux.c
  16386. -@@ -307,8 +307,7 @@ struct l2_packet_data * l2_packet_init_b
  16387. +@@ -337,8 +337,7 @@ struct l2_packet_data * l2_packet_init_b
  16388. l2 = l2_packet_init(br_ifname, own_addr, protocol, rx_callback,
  16389. rx_callback_ctx, l2_hdr);
  16390. @@ -8,5 +8,5 @@
  16391. - return NULL;
  16392. + return l2;
  16393. + #ifndef CONFIG_NO_LINUX_PACKET_SOCKET_WAR
  16394. /*
  16395. - * The Linux packet socket behavior has changed over the years and there
  16396. diff --git a/package/network/services/hostapd/patches/150-nl80211-Report-disassociated-STA-lost-peer-for-the-c.patch b/package/network/services/hostapd/patches/150-nl80211-Report-disassociated-STA-lost-peer-for-the-c.patch
  16397. deleted file mode 100644
  16398. index 66c682f..0000000
  16399. --- a/package/network/services/hostapd/patches/150-nl80211-Report-disassociated-STA-lost-peer-for-the-c.patch
  16400. +++ /dev/null
  16401. @@ -1,67 +0,0 @@
  16402. -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  16403. -Date: Mon, 11 Jan 2016 19:18:06 +0100
  16404. -Subject: [PATCH] nl80211: Report disassociated STA / lost peer for the correct
  16405. - BSS
  16406. -MIME-Version: 1.0
  16407. -Content-Type: text/plain; charset=UTF-8
  16408. -Content-Transfer-Encoding: 8bit
  16409. -
  16410. -We shouldn't use drv->ctx as it always points to the first BSS. When
  16411. -using FullMAC driver with multi-BSS support it resulted in incorrect
  16412. -treating nl80211 events. I noticed with with brcmfmac and BCM43602.
  16413. -
  16414. -Before my change I was getting "disassociated" on a wrong interface:
  16415. -wlan0-1: STA 78:d6:f0:00:11:22 IEEE 802.11: associated
  16416. -wlan0-1: STA 78:d6:f0:00:11:22 WPA: pairwise key handshake completed (RSN)
  16417. -wlan0: STA 78:d6:f0:00:11:22 IEEE 802.11: disassociated
  16418. -
  16419. -With this patch it works as expected:
  16420. -wlan0-1: STA 78:d6:f0:00:11:22 IEEE 802.11: associated
  16421. -wlan0-1: STA 78:d6:f0:00:11:22 WPA: pairwise key handshake completed (RSN)
  16422. -wlan0-1: STA 78:d6:f0:00:11:22 IEEE 802.11: disassociated
  16423. -
  16424. -This doesn't apply to hostapd dealing with SoftMAC drivers when handling
  16425. -AP SME & MLME is done it hostapd not the firmware.
  16426. -
  16427. -Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  16428. ----
  16429. - src/drivers/driver_nl80211_event.c | 7 ++++---
  16430. - 1 file changed, 4 insertions(+), 3 deletions(-)
  16431. -
  16432. ---- a/src/drivers/driver_nl80211_event.c
  16433. -+++ b/src/drivers/driver_nl80211_event.c
  16434. -@@ -1154,6 +1154,7 @@ static void nl80211_new_station_event(st
  16435. -
  16436. -
  16437. - static void nl80211_del_station_event(struct wpa_driver_nl80211_data *drv,
  16438. -+ struct i802_bss *bss,
  16439. - struct nlattr **tb)
  16440. - {
  16441. - u8 *addr;
  16442. -@@ -1166,7 +1167,7 @@ static void nl80211_del_station_event(st
  16443. - MAC2STR(addr));
  16444. -
  16445. - if (is_ap_interface(drv->nlmode) && drv->device_ap_sme) {
  16446. -- drv_event_disassoc(drv->ctx, addr);
  16447. -+ drv_event_disassoc(bss->ctx, addr);
  16448. - return;
  16449. - }
  16450. -
  16451. -@@ -1175,7 +1176,7 @@ static void nl80211_del_station_event(st
  16452. -
  16453. - os_memset(&data, 0, sizeof(data));
  16454. - os_memcpy(data.ibss_peer_lost.peer, addr, ETH_ALEN);
  16455. -- wpa_supplicant_event(drv->ctx, EVENT_IBSS_PEER_LOST, &data);
  16456. -+ wpa_supplicant_event(bss->ctx, EVENT_IBSS_PEER_LOST, &data);
  16457. - }
  16458. -
  16459. -
  16460. -@@ -1939,7 +1940,7 @@ static void do_process_drv_event(struct
  16461. - nl80211_new_station_event(drv, bss, tb);
  16462. - break;
  16463. - case NL80211_CMD_DEL_STATION:
  16464. -- nl80211_del_station_event(drv, tb);
  16465. -+ nl80211_del_station_event(drv, bss, tb);
  16466. - break;
  16467. - case NL80211_CMD_SET_REKEY_OFFLOAD:
  16468. - nl80211_rekey_offload_event(drv, tb);
  16469. diff --git a/package/network/services/hostapd/patches/200-multicall.patch b/package/network/services/hostapd/patches/200-multicall.patch
  16470. index de4a3a8..40bd733 100644
  16471. --- a/package/network/services/hostapd/patches/200-multicall.patch
  16472. +++ b/package/network/services/hostapd/patches/200-multicall.patch
  16473. @@ -1,15 +1,25 @@
  16474. --- a/hostapd/Makefile
  16475. +++ b/hostapd/Makefile
  16476. -@@ -17,6 +17,7 @@ export BINDIR ?= /usr/local/bin/
  16477. - # CFLAGS += -DUSE_KERNEL_HEADERS -I/usr/src/linux/include
  16478. +@@ -28,6 +28,7 @@ CFLAGS += -I$(abspath ../src/utils)
  16479. + export BINDIR ?= /usr/local/bin/
  16480. -include .config
  16481. +-include $(if $(MULTICALL), ../wpa_supplicant/.config)
  16482. - ifdef CONFIG_TESTING_OPTIONS
  16483. - CFLAGS += -DCONFIG_TESTING_OPTIONS
  16484. -@@ -242,10 +243,14 @@ ifdef CONFIG_IEEE80211AC
  16485. - CFLAGS += -DCONFIG_IEEE80211AC
  16486. + ifndef CONFIG_NO_GITVER
  16487. + # Add VERSION_STR postfix for builds from a git repository
  16488. +@@ -190,7 +191,8 @@ endif
  16489. +
  16490. + ifdef CONFIG_NO_VLAN
  16491. + CFLAGS += -DCONFIG_NO_VLAN
  16492. +-else
  16493. ++endif
  16494. ++ifneq ($(findstring CONFIG_NO_VLAN,$(CFLAGS)), CONFIG_NO_VLAN)
  16495. + OBJS += ../src/ap/vlan_init.o
  16496. + OBJS += ../src/ap/vlan_ifconfig.o
  16497. + OBJS += ../src/ap/vlan.o
  16498. +@@ -315,10 +317,14 @@ CFLAGS += -DCONFIG_MBO
  16499. + OBJS += ../src/ap/mbo_ap.o
  16500. endif
  16501. +ifndef MULTICALL
  16502. @@ -26,7 +36,7 @@
  16503. LIBS += $(DRV_AP_LIBS)
  16504. ifdef CONFIG_L2_PACKET
  16505. -@@ -941,6 +946,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR)
  16506. +@@ -1051,6 +1057,12 @@ install: $(addprefix $(DESTDIR)$(BINDIR)
  16507. BCHECK=../src/drivers/build.hostapd
  16508. @@ -39,30 +49,40 @@
  16509. hostapd: $(BCHECK) $(OBJS)
  16510. $(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS)
  16511. @$(E) " LD " $@
  16512. -@@ -980,6 +991,12 @@ HOBJS += ../src/crypto/aes-internal.o
  16513. +@@ -1092,6 +1104,12 @@ HOBJS += ../src/crypto/aes-internal.o
  16514. HOBJS += ../src/crypto/aes-internal-enc.o
  16515. endif
  16516. +dump_cflags:
  16517. -+ @echo -n $(CFLAGS) " "
  16518. ++ @printf "%s " "$(CFLAGS)"
  16519. +
  16520. +dump_ldflags:
  16521. -+ @echo -n $(LDFLAGS) $(LIBS) $(EXTRALIBS) " "
  16522. ++ @printf "%s " "$(LDFLAGS) $(LIBS) $(EXTRALIBS)"
  16523. +
  16524. nt_password_hash: $(NOBJS)
  16525. $(Q)$(CC) $(LDFLAGS) -o nt_password_hash $(NOBJS) $(LIBS_n)
  16526. @$(E) " LD " $@
  16527. --- a/wpa_supplicant/Makefile
  16528. +++ b/wpa_supplicant/Makefile
  16529. -@@ -15,6 +15,7 @@ CFLAGS += -I$(abspath ../src)
  16530. +@@ -27,6 +27,7 @@ CFLAGS += -I$(abspath ../src)
  16531. CFLAGS += -I$(abspath ../src/utils)
  16532. -include .config
  16533. +-include $(if $(MULTICALL),../hostapd/.config)
  16534. - ifdef CONFIG_TESTING_OPTIONS
  16535. - CFLAGS += -DCONFIG_TESTING_OPTIONS
  16536. -@@ -773,6 +774,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS
  16537. + ifndef CONFIG_NO_GITVER
  16538. + # Add VERSION_STR postfix for builds from a git repository
  16539. +@@ -312,7 +313,9 @@ endif
  16540. + ifdef CONFIG_IBSS_RSN
  16541. + NEED_RSN_AUTHENTICATOR=y
  16542. + CFLAGS += -DCONFIG_IBSS_RSN
  16543. ++ifndef MULTICALL
  16544. + CFLAGS += -DCONFIG_NO_VLAN
  16545. ++endif
  16546. + OBJS += ibss_rsn.o
  16547. + endif
  16548. +
  16549. +@@ -803,6 +806,10 @@ ifdef CONFIG_DYNAMIC_EAP_METHODS
  16550. CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS
  16551. LIBS += -ldl -rdynamic
  16552. endif
  16553. @@ -73,7 +93,7 @@
  16554. endif
  16555. ifdef CONFIG_MACSEC
  16556. -@@ -793,9 +798,11 @@ NEED_EAP_COMMON=y
  16557. +@@ -823,9 +830,11 @@ NEED_EAP_COMMON=y
  16558. NEED_RSN_AUTHENTICATOR=y
  16559. CFLAGS += -DCONFIG_AP
  16560. OBJS += ap.o
  16561. @@ -85,7 +105,7 @@
  16562. OBJS += ../src/ap/hostapd.o
  16563. OBJS += ../src/ap/wpa_auth_glue.o
  16564. OBJS += ../src/ap/utils.o
  16565. -@@ -858,10 +865,18 @@ endif
  16566. +@@ -898,10 +907,18 @@ endif
  16567. ifdef CONFIG_HS20
  16568. OBJS += ../src/ap/hs20.o
  16569. endif
  16570. @@ -104,7 +124,7 @@
  16571. NEED_AES_WRAP=y
  16572. OBJS += ../src/ap/wpa_auth.o
  16573. OBJS += ../src/ap/wpa_auth_ie.o
  16574. -@@ -1603,6 +1618,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv)
  16575. +@@ -1680,6 +1697,12 @@ wpa_priv: $(BCHECK) $(OBJS_priv)
  16576. $(OBJS_c) $(OBJS_t) $(OBJS_t2) $(OBJS) $(BCHECK) $(EXTRA_progs): .config
  16577. @@ -117,22 +137,22 @@
  16578. wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs)
  16579. $(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS)
  16580. @$(E) " LD " $@
  16581. -@@ -1694,6 +1715,12 @@ endif
  16582. - $(Q)sed -e 's|\@BINDIR\@|$(BINDIR)|g' $< >$@
  16583. +@@ -1782,6 +1805,12 @@ endif
  16584. + -e 's|\@DBUS_INTERFACE\@|$(DBUS_INTERFACE)|g' $< >$@
  16585. @$(E) " sed" $<
  16586. +dump_cflags:
  16587. -+ @echo -n $(CFLAGS) " "
  16588. ++ @printf "%s " "$(CFLAGS)"
  16589. +
  16590. +dump_ldflags:
  16591. -+ @echo -n $(LDFLAGS) $(LIBS) $(EXTRALIBS) " "
  16592. ++ @printf "%s " "$(LDFLAGS) $(LIBS) $(EXTRALIBS)"
  16593. +
  16594. wpa_supplicant.exe: wpa_supplicant
  16595. mv -f $< $@
  16596. wpa_cli.exe: wpa_cli
  16597. --- a/src/drivers/driver.h
  16598. +++ b/src/drivers/driver.h
  16599. -@@ -4581,8 +4581,8 @@ union wpa_event_data {
  16600. +@@ -4794,8 +4794,8 @@ union wpa_event_data {
  16601. * Driver wrapper code should call this function whenever an event is received
  16602. * from the driver.
  16603. */
  16604. @@ -141,11 +161,20 @@
  16605. +extern void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
  16606. + union wpa_event_data *data);
  16607. + /**
  16608. + * wpa_supplicant_event_global - Report a driver event for wpa_supplicant
  16609. +@@ -4807,7 +4807,7 @@ void wpa_supplicant_event(void *ctx, enu
  16610. + * Same as wpa_supplicant_event(), but we search for the interface in
  16611. + * wpa_global.
  16612. + */
  16613. +-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
  16614. ++extern void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
  16615. + union wpa_event_data *data);
  16616. /*
  16617. --- a/src/ap/drv_callbacks.c
  16618. +++ b/src/ap/drv_callbacks.c
  16619. -@@ -1075,8 +1075,8 @@ static void hostapd_event_dfs_cac_starte
  16620. +@@ -1157,8 +1157,8 @@ static void hostapd_event_dfs_cac_starte
  16621. #endif /* NEED_AP_MLME */
  16622. @@ -156,9 +185,18 @@
  16623. {
  16624. struct hostapd_data *hapd = ctx;
  16625. #ifndef CONFIG_NO_STDOUT_DEBUG
  16626. +@@ -1367,7 +1367,7 @@ void wpa_supplicant_event(void *ctx, enu
  16627. + }
  16628. +
  16629. +
  16630. +-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
  16631. ++void hostapd_wpa_event_global(void *ctx, enum wpa_event_type event,
  16632. + union wpa_event_data *data)
  16633. + {
  16634. + struct hapd_interfaces *interfaces = ctx;
  16635. --- a/wpa_supplicant/wpa_priv.c
  16636. +++ b/wpa_supplicant/wpa_priv.c
  16637. -@@ -819,8 +819,8 @@ static void wpa_priv_send_ft_response(st
  16638. +@@ -940,8 +940,8 @@ static void wpa_priv_send_ft_response(st
  16639. }
  16640. @@ -169,17 +207,27 @@
  16641. {
  16642. struct wpa_priv_interface *iface = ctx;
  16643. -@@ -961,6 +961,7 @@ int main(int argc, char *argv[])
  16644. +@@ -1010,7 +1010,7 @@ void wpa_supplicant_event(void *ctx, enu
  16645. + }
  16646. +
  16647. +
  16648. +-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
  16649. ++void supplicant_event_global(void *ctx, enum wpa_event_type event,
  16650. + union wpa_event_data *data)
  16651. + {
  16652. + struct wpa_priv_global *global = ctx;
  16653. +@@ -1122,6 +1122,8 @@ int main(int argc, char *argv[])
  16654. if (os_program_init())
  16655. return -1;
  16656. + wpa_supplicant_event = supplicant_event;
  16657. ++ wpa_supplicant_event_global = supplicant_event_global;
  16658. wpa_priv_fd_workaround();
  16659. - for (;;) {
  16660. + os_memset(&global, 0, sizeof(global));
  16661. --- a/wpa_supplicant/events.c
  16662. +++ b/wpa_supplicant/events.c
  16663. -@@ -3138,8 +3138,8 @@ static void wpa_supplicant_event_assoc_a
  16664. +@@ -3384,8 +3384,8 @@ static void wpa_supplicant_event_assoc_a
  16665. }
  16666. @@ -189,88 +237,125 @@
  16667. + union wpa_event_data *data)
  16668. {
  16669. struct wpa_supplicant *wpa_s = ctx;
  16670. + int resched;
  16671. +@@ -4051,7 +4051,7 @@ void wpa_supplicant_event(void *ctx, enu
  16672. + #endif /* CONFIG_AP */
  16673. + break;
  16674. + case EVENT_ACS_CHANNEL_SELECTED:
  16675. +-#ifdef CONFIG_ACS
  16676. ++#if defined(CONFIG_ACS) && defined(CONFIG_AP)
  16677. + if (!wpa_s->ap_iface)
  16678. + break;
  16679. + hostapd_acs_channel_selected(wpa_s->ap_iface->bss[0],
  16680. +@@ -4065,7 +4065,7 @@ void wpa_supplicant_event(void *ctx, enu
  16681. + }
  16682. +
  16683. +-void wpa_supplicant_event_global(void *ctx, enum wpa_event_type event,
  16684. ++void supplicant_event_global(void *ctx, enum wpa_event_type event,
  16685. + union wpa_event_data *data)
  16686. + {
  16687. + struct wpa_supplicant *wpa_s;
  16688. --- a/wpa_supplicant/wpa_supplicant.c
  16689. +++ b/wpa_supplicant/wpa_supplicant.c
  16690. -@@ -4300,6 +4300,9 @@ static void wpa_supplicant_deinit_iface(
  16691. - os_free(wpa_s);
  16692. +@@ -4990,7 +4990,6 @@ struct wpa_interface * wpa_supplicant_ma
  16693. + return NULL;
  16694. }
  16695. +-
  16696. + /**
  16697. + * wpa_supplicant_match_existing - Match existing interfaces
  16698. + * @global: Pointer to global data from wpa_supplicant_init()
  16699. +@@ -5027,6 +5026,11 @@ static int wpa_supplicant_match_existing
  16700. +
  16701. + #endif /* CONFIG_MATCH_IFACE */
  16702. +
  16703. +extern void supplicant_event(void *ctx, enum wpa_event_type event,
  16704. + union wpa_event_data *data);
  16705. +
  16706. ++extern void supplicant_event_global(void *ctx, enum wpa_event_type event,
  16707. ++ union wpa_event_data *data);
  16708. /**
  16709. * wpa_supplicant_add_iface - Add a new network interface
  16710. -@@ -4526,6 +4529,7 @@ struct wpa_global * wpa_supplicant_init(
  16711. +@@ -5282,6 +5286,8 @@ struct wpa_global * wpa_supplicant_init(
  16712. #ifndef CONFIG_NO_WPA_MSG
  16713. wpa_msg_register_ifname_cb(wpa_supplicant_msg_ifname_cb);
  16714. #endif /* CONFIG_NO_WPA_MSG */
  16715. + wpa_supplicant_event = supplicant_event;
  16716. ++ wpa_supplicant_event_global = supplicant_event_global;
  16717. if (params->wpa_debug_file_path)
  16718. wpa_debug_open_file(params->wpa_debug_file_path);
  16719. --- a/hostapd/main.c
  16720. +++ b/hostapd/main.c
  16721. -@@ -511,6 +511,9 @@ static int hostapd_get_ctrl_iface_group(
  16722. - return 0;
  16723. +@@ -583,6 +583,11 @@ fail:
  16724. + return -1;
  16725. }
  16726. +void hostapd_wpa_event(void *ctx, enum wpa_event_type event,
  16727. + union wpa_event_data *data);
  16728. +
  16729. ++void hostapd_wpa_event_global(void *ctx, enum wpa_event_type event,
  16730. ++ union wpa_event_data *data);
  16731. #ifdef CONFIG_WPS
  16732. static int gen_uuid(const char *txt_addr)
  16733. -@@ -562,6 +565,7 @@ int main(int argc, char *argv[])
  16734. - interfaces.global_iface_name = NULL;
  16735. +@@ -660,6 +665,8 @@ int main(int argc, char *argv[])
  16736. interfaces.global_ctrl_sock = -1;
  16737. + dl_list_init(&interfaces.global_ctrl_dst);
  16738. + wpa_supplicant_event = hostapd_wpa_event;
  16739. ++ wpa_supplicant_event_global = hostapd_wpa_event_global;
  16740. for (;;) {
  16741. - c = getopt(argc, argv, "b:Bde:f:hKP:Ttu:vg:G:");
  16742. + c = getopt(argc, argv, "b:Bde:f:hi:KP:STtu:vg:G:");
  16743. if (c < 0)
  16744. --- a/src/drivers/drivers.c
  16745. +++ b/src/drivers/drivers.c
  16746. -@@ -10,6 +10,9 @@
  16747. +@@ -10,6 +10,11 @@
  16748. #include "utils/common.h"
  16749. #include "driver.h"
  16750. +void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
  16751. + union wpa_event_data *data);
  16752. ++void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
  16753. ++ union wpa_event_data *data);
  16754. +
  16755. #ifdef CONFIG_DRIVER_WEXT
  16756. extern struct wpa_driver_ops wpa_driver_wext_ops; /* driver_wext.c */
  16757. #endif /* CONFIG_DRIVER_WEXT */
  16758. --- a/wpa_supplicant/eapol_test.c
  16759. +++ b/wpa_supplicant/eapol_test.c
  16760. -@@ -28,8 +28,12 @@
  16761. +@@ -29,7 +29,12 @@
  16762. #include "ctrl_iface.h"
  16763. #include "pcsc_funcs.h"
  16764. #include "wpas_glue.h"
  16765. +#include "drivers/driver.h"
  16766. -
  16767. +void (*wpa_supplicant_event)(void *ctx, enum wpa_event_type event,
  16768. + union wpa_event_data *data);
  16769. -+
  16770. - struct wpa_driver_ops *wpa_drivers[] = { NULL };
  16771. ++void (*wpa_supplicant_event_global)(void *ctx, enum wpa_event_type event,
  16772. ++ union wpa_event_data *data);
  16773. + const struct wpa_driver_ops *const wpa_drivers[] = { NULL };
  16774. -@@ -1203,6 +1207,8 @@ static void usage(void)
  16775. +@@ -1295,6 +1300,10 @@ static void usage(void)
  16776. "option several times.\n");
  16777. }
  16778. +extern void supplicant_event(void *ctx, enum wpa_event_type event,
  16779. + union wpa_event_data *data);
  16780. ++extern void supplicant_event_global(void *ctx, enum wpa_event_type event,
  16781. ++ union wpa_event_data *data);
  16782. int main(int argc, char *argv[])
  16783. {
  16784. -@@ -1221,6 +1227,7 @@ int main(int argc, char *argv[])
  16785. +@@ -1315,6 +1324,8 @@ int main(int argc, char *argv[])
  16786. if (os_program_init())
  16787. return -1;
  16788. + wpa_supplicant_event = supplicant_event;
  16789. ++ wpa_supplicant_event_global = supplicant_event_global;
  16790. hostapd_logger_register_cb(hostapd_logger_cb);
  16791. os_memset(&eapol_test, 0, sizeof(eapol_test));
  16792. diff --git a/package/network/services/hostapd/patches/300-noscan.patch b/package/network/services/hostapd/patches/300-noscan.patch
  16793. index 57d8fe2..21d6316 100644
  16794. --- a/package/network/services/hostapd/patches/300-noscan.patch
  16795. +++ b/package/network/services/hostapd/patches/300-noscan.patch
  16796. @@ -1,6 +1,6 @@
  16797. --- a/hostapd/config_file.c
  16798. +++ b/hostapd/config_file.c
  16799. -@@ -2771,6 +2771,10 @@ static int hostapd_config_fill(struct ho
  16800. +@@ -2862,6 +2862,10 @@ static int hostapd_config_fill(struct ho
  16801. }
  16802. #endif /* CONFIG_IEEE80211W */
  16803. #ifdef CONFIG_IEEE80211N
  16804. @@ -13,7 +13,7 @@
  16805. } else if (os_strcmp(buf, "ht_capab") == 0) {
  16806. --- a/src/ap/ap_config.h
  16807. +++ b/src/ap/ap_config.h
  16808. -@@ -619,6 +619,8 @@ struct hostapd_config {
  16809. +@@ -655,6 +655,8 @@ struct hostapd_config {
  16810. int ht_op_mode_fixed;
  16811. u16 ht_capab;
  16812. @@ -21,21 +21,22 @@
  16813. + int no_ht_coex;
  16814. int ieee80211n;
  16815. int secondary_channel;
  16816. - int require_ht;
  16817. + int no_pri_sec_switch;
  16818. --- a/src/ap/hw_features.c
  16819. +++ b/src/ap/hw_features.c
  16820. -@@ -461,7 +461,7 @@ static int ieee80211n_check_40mhz(struct
  16821. - struct wpa_driver_scan_params params;
  16822. +@@ -474,7 +474,8 @@ static int ieee80211n_check_40mhz(struct
  16823. int ret;
  16824. -- if (!iface->conf->secondary_channel)
  16825. -+ if (!iface->conf->secondary_channel || iface->conf->noscan)
  16826. - return 0; /* HT40 not used */
  16827. + /* Check that HT40 is used and PRI / SEC switch is allowed */
  16828. +- if (!iface->conf->secondary_channel || iface->conf->no_pri_sec_switch)
  16829. ++ if (!iface->conf->secondary_channel || iface->conf->no_pri_sec_switch ||
  16830. ++ iface->conf->noscan)
  16831. + return 0;
  16832. hostapd_set_state(iface, HAPD_IFACE_HT_SCAN);
  16833. --- a/src/ap/ieee802_11_ht.c
  16834. +++ b/src/ap/ieee802_11_ht.c
  16835. -@@ -221,6 +221,9 @@ void hostapd_2040_coex_action(struct hos
  16836. +@@ -244,6 +244,9 @@ void hostapd_2040_coex_action(struct hos
  16837. if (!(iface->conf->ht_capab & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET))
  16838. return;
  16839. @@ -45,7 +46,7 @@
  16840. if (len < IEEE80211_HDRLEN + 2 + sizeof(*bc_ie))
  16841. return;
  16842. -@@ -346,6 +349,9 @@ void ht40_intolerant_add(struct hostapd_
  16843. +@@ -368,6 +371,9 @@ void ht40_intolerant_add(struct hostapd_
  16844. if (iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G)
  16845. return;
  16846. diff --git a/package/network/services/hostapd/patches/310-rescan_immediately.patch b/package/network/services/hostapd/patches/310-rescan_immediately.patch
  16847. index 7be8c32..3f46cc4 100644
  16848. --- a/package/network/services/hostapd/patches/310-rescan_immediately.patch
  16849. +++ b/package/network/services/hostapd/patches/310-rescan_immediately.patch
  16850. @@ -1,6 +1,6 @@
  16851. --- a/wpa_supplicant/wpa_supplicant.c
  16852. +++ b/wpa_supplicant/wpa_supplicant.c
  16853. -@@ -3249,7 +3249,7 @@ wpa_supplicant_alloc(struct wpa_supplica
  16854. +@@ -3556,7 +3556,7 @@ wpa_supplicant_alloc(struct wpa_supplica
  16855. if (wpa_s == NULL)
  16856. return NULL;
  16857. wpa_s->scan_req = INITIAL_SCAN_REQ;
  16858. @@ -8,4 +8,4 @@
  16859. + wpa_s->scan_interval = 1;
  16860. wpa_s->new_connection = 1;
  16861. wpa_s->parent = parent ? parent : wpa_s;
  16862. - wpa_s->sched_scanning = 0;
  16863. + wpa_s->p2pdev = wpa_s->parent;
  16864. diff --git a/package/network/services/hostapd/patches/320-optional_rfkill.patch b/package/network/services/hostapd/patches/320-optional_rfkill.patch
  16865. index 75b4b07..cf2a2c1 100644
  16866. --- a/package/network/services/hostapd/patches/320-optional_rfkill.patch
  16867. +++ b/package/network/services/hostapd/patches/320-optional_rfkill.patch
  16868. @@ -1,14 +1,14 @@
  16869. --- a/src/drivers/drivers.mak
  16870. +++ b/src/drivers/drivers.mak
  16871. -@@ -34,7 +34,6 @@ NEED_SME=y
  16872. +@@ -36,7 +36,6 @@ NEED_SME=y
  16873. NEED_AP_MLME=y
  16874. NEED_NETLINK=y
  16875. NEED_LINUX_IOCTL=y
  16876. -NEED_RFKILL=y
  16877. + NEED_RADIOTAP=y
  16878. ifdef CONFIG_LIBNL32
  16879. - DRV_LIBS += -lnl-3
  16880. -@@ -116,7 +115,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT
  16881. +@@ -123,7 +122,6 @@ DRV_WPA_CFLAGS += -DCONFIG_DRIVER_WEXT
  16882. CONFIG_WIRELESS_EXTENSION=y
  16883. NEED_NETLINK=y
  16884. NEED_LINUX_IOCTL=y
  16885. @@ -16,7 +16,7 @@
  16886. endif
  16887. ifdef CONFIG_DRIVER_NDIS
  16888. -@@ -142,7 +140,6 @@ endif
  16889. +@@ -149,7 +147,6 @@ endif
  16890. ifdef CONFIG_WIRELESS_EXTENSION
  16891. DRV_WPA_CFLAGS += -DCONFIG_WIRELESS_EXTENSION
  16892. DRV_WPA_OBJS += ../src/drivers/driver_wext.o
  16893. @@ -24,14 +24,14 @@
  16894. endif
  16895. ifdef NEED_NETLINK
  16896. -@@ -155,6 +152,7 @@ endif
  16897. +@@ -162,6 +159,7 @@ endif
  16898. ifdef NEED_RFKILL
  16899. DRV_OBJS += ../src/drivers/rfkill.o
  16900. +DRV_WPA_CFLAGS += -DCONFIG_RFKILL
  16901. endif
  16902. - ifdef CONFIG_VLAN_NETLINK
  16903. + ifdef NEED_RADIOTAP
  16904. --- a/src/drivers/rfkill.h
  16905. +++ b/src/drivers/rfkill.h
  16906. @@ -18,8 +18,24 @@ struct rfkill_config {
  16907. diff --git a/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch b/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch
  16908. index dd90877..ca46012 100644
  16909. --- a/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch
  16910. +++ b/package/network/services/hostapd/patches/330-nl80211_fix_set_freq.patch
  16911. @@ -1,6 +1,6 @@
  16912. --- a/src/drivers/driver_nl80211.c
  16913. +++ b/src/drivers/driver_nl80211.c
  16914. -@@ -3616,7 +3616,7 @@ static int nl80211_set_channel(struct i8
  16915. +@@ -3795,7 +3795,7 @@ static int nl80211_set_channel(struct i8
  16916. freq->freq, freq->ht_enabled, freq->vht_enabled,
  16917. freq->bandwidth, freq->center_freq1, freq->center_freq2);
  16918. diff --git a/package/network/services/hostapd/patches/340-reload_freq_change.patch b/package/network/services/hostapd/patches/340-reload_freq_change.patch
  16919. index 91b6196..086ade9 100644
  16920. --- a/package/network/services/hostapd/patches/340-reload_freq_change.patch
  16921. +++ b/package/network/services/hostapd/patches/340-reload_freq_change.patch
  16922. @@ -1,6 +1,6 @@
  16923. --- a/src/ap/hostapd.c
  16924. +++ b/src/ap/hostapd.c
  16925. -@@ -76,6 +76,16 @@ static void hostapd_reload_bss(struct ho
  16926. +@@ -80,6 +80,16 @@ static void hostapd_reload_bss(struct ho
  16927. #endif /* CONFIG_NO_RADIUS */
  16928. ssid = &hapd->conf->ssid;
  16929. @@ -17,7 +17,7 @@
  16930. if (!ssid->wpa_psk_set && ssid->wpa_psk && !ssid->wpa_psk->next &&
  16931. ssid->wpa_passphrase_set && ssid->wpa_passphrase) {
  16932. /*
  16933. -@@ -175,21 +185,12 @@ int hostapd_reload_config(struct hostapd
  16934. +@@ -179,21 +189,12 @@ int hostapd_reload_config(struct hostapd
  16935. oldconf = hapd->iconf;
  16936. iface->conf = newconf;
  16937. diff --git a/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch b/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch
  16938. index a14fa03..247f154 100644
  16939. --- a/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch
  16940. +++ b/package/network/services/hostapd/patches/350-nl80211_del_beacon_bss.patch
  16941. @@ -1,6 +1,6 @@
  16942. --- a/src/drivers/driver_nl80211.c
  16943. +++ b/src/drivers/driver_nl80211.c
  16944. -@@ -2254,13 +2254,18 @@ wpa_driver_nl80211_finish_drv_init(struc
  16945. +@@ -2394,13 +2394,18 @@ wpa_driver_nl80211_finish_drv_init(struc
  16946. }
  16947. @@ -22,7 +22,7 @@
  16948. return send_and_recv_msgs(drv, msg, NULL, NULL);
  16949. }
  16950. -@@ -2311,7 +2316,7 @@ static void wpa_driver_nl80211_deinit(st
  16951. +@@ -2452,7 +2457,7 @@ static void wpa_driver_nl80211_deinit(st
  16952. nl80211_remove_monitor_interface(drv);
  16953. if (is_ap_interface(drv->nlmode))
  16954. @@ -31,7 +31,7 @@
  16955. if (drv->eapol_sock >= 0) {
  16956. eloop_unregister_read_sock(drv->eapol_sock);
  16957. -@@ -4140,8 +4145,7 @@ static void nl80211_teardown_ap(struct i
  16958. +@@ -4385,8 +4390,7 @@ static void nl80211_teardown_ap(struct i
  16959. nl80211_remove_monitor_interface(drv);
  16960. else
  16961. nl80211_mgmt_unsubscribe(bss, "AP teardown");
  16962. @@ -41,7 +41,7 @@
  16963. }
  16964. -@@ -6066,8 +6070,6 @@ static int wpa_driver_nl80211_if_remove(
  16965. +@@ -6387,8 +6391,6 @@ static int wpa_driver_nl80211_if_remove(
  16966. } else {
  16967. wpa_printf(MSG_DEBUG, "nl80211: First BSS - reassign context");
  16968. nl80211_teardown_ap(bss);
  16969. @@ -50,7 +50,7 @@
  16970. nl80211_destroy_bss(bss);
  16971. if (!bss->added_if)
  16972. i802_set_iface_flags(bss, 0);
  16973. -@@ -6389,8 +6391,7 @@ static int wpa_driver_nl80211_deinit_ap(
  16974. +@@ -6750,8 +6752,7 @@ static int wpa_driver_nl80211_deinit_ap(
  16975. struct wpa_driver_nl80211_data *drv = bss->drv;
  16976. if (!is_ap_interface(drv->nlmode))
  16977. return -1;
  16978. @@ -60,7 +60,7 @@
  16979. /*
  16980. * If the P2P GO interface was dynamically added, then it is
  16981. -@@ -6409,8 +6410,7 @@ static int wpa_driver_nl80211_stop_ap(vo
  16982. +@@ -6770,8 +6771,7 @@ static int wpa_driver_nl80211_stop_ap(vo
  16983. struct wpa_driver_nl80211_data *drv = bss->drv;
  16984. if (!is_ap_interface(drv->nlmode))
  16985. return -1;
  16986. diff --git a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch
  16987. index 06b005e..1e405cb 100644
  16988. --- a/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch
  16989. +++ b/package/network/services/hostapd/patches/360-ctrl_iface_reload.patch
  16990. @@ -1,22 +1,22 @@
  16991. --- a/hostapd/ctrl_iface.c
  16992. +++ b/hostapd/ctrl_iface.c
  16993. -@@ -45,6 +45,7 @@
  16994. - #include "wps/wps.h"
  16995. +@@ -54,6 +54,7 @@
  16996. + #include "fst/fst_ctrl_iface.h"
  16997. #include "config_file.h"
  16998. #include "ctrl_iface.h"
  16999. +#include "config_file.h"
  17000. - struct wpa_ctrl_dst {
  17001. -@@ -55,6 +56,7 @@ struct wpa_ctrl_dst {
  17002. - int errors;
  17003. - };
  17004. + #define HOSTAPD_CLI_DUP_VALUE_MAX_LEN 256
  17005. +@@ -72,6 +73,7 @@ static void hostapd_ctrl_iface_send(stru
  17006. + enum wpa_msg_type type,
  17007. + const char *buf, size_t len);
  17008. +static char *reload_opts = NULL;
  17009. - static void hostapd_ctrl_iface_send(struct hostapd_data *hapd, int level,
  17010. - const char *buf, size_t len);
  17011. -@@ -164,6 +166,61 @@ static int hostapd_ctrl_iface_new_sta(st
  17012. + static int hostapd_ctrl_iface_attach(struct hostapd_data *hapd,
  17013. + struct sockaddr_storage *from,
  17014. +@@ -123,6 +125,61 @@ static int hostapd_ctrl_iface_new_sta(st
  17015. return 0;
  17016. }
  17017. @@ -78,7 +78,7 @@
  17018. #ifdef CONFIG_IEEE80211W
  17019. #ifdef NEED_AP_MLME
  17020. -@@ -2086,6 +2143,8 @@ static void hostapd_ctrl_iface_receive(i
  17021. +@@ -2483,6 +2540,8 @@ static int hostapd_ctrl_iface_receive_pr
  17022. } else if (os_strncmp(buf, "VENDOR ", 7) == 0) {
  17023. reply_len = hostapd_ctrl_iface_vendor(hapd, buf + 7, reply,
  17024. reply_size);
  17025. @@ -89,7 +89,7 @@
  17026. #ifdef RADIUS_SERVER
  17027. --- a/src/ap/ctrl_iface_ap.c
  17028. +++ b/src/ap/ctrl_iface_ap.c
  17029. -@@ -541,5 +541,11 @@ int hostapd_parse_csa_settings(const cha
  17030. +@@ -593,7 +593,13 @@ int hostapd_parse_csa_settings(const cha
  17031. int hostapd_ctrl_iface_stop_ap(struct hostapd_data *hapd)
  17032. {
  17033. @@ -102,3 +102,5 @@
  17034. +
  17035. + return 0;
  17036. }
  17037. +
  17038. +
  17039. diff --git a/package/network/services/hostapd/patches/370-ap_sta_support.patch b/package/network/services/hostapd/patches/370-ap_sta_support.patch
  17040. index ea235e6..a77d4c9 100644
  17041. --- a/package/network/services/hostapd/patches/370-ap_sta_support.patch
  17042. +++ b/package/network/services/hostapd/patches/370-ap_sta_support.patch
  17043. @@ -1,6 +1,6 @@
  17044. --- a/wpa_supplicant/wpa_supplicant_i.h
  17045. +++ b/wpa_supplicant/wpa_supplicant_i.h
  17046. -@@ -110,6 +110,11 @@ struct wpa_interface {
  17047. +@@ -100,6 +100,11 @@ struct wpa_interface {
  17048. const char *ifname;
  17049. /**
  17050. @@ -12,8 +12,8 @@
  17051. * bridge_ifname - Optional bridge interface name
  17052. *
  17053. * If the driver interface (ifname) is included in a Linux bridge
  17054. -@@ -442,6 +447,8 @@ struct wpa_supplicant {
  17055. - #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
  17056. +@@ -484,6 +489,8 @@ struct wpa_supplicant {
  17057. + #endif /* CONFIG_CTRL_IFACE_BINDER */
  17058. char bridge_ifname[16];
  17059. + struct wpa_ctrl *hostapd;
  17060. @@ -23,7 +23,7 @@
  17061. --- a/wpa_supplicant/Makefile
  17062. +++ b/wpa_supplicant/Makefile
  17063. -@@ -14,6 +14,10 @@ CFLAGS += $(EXTRA_CFLAGS)
  17064. +@@ -26,6 +26,10 @@ CFLAGS += $(EXTRA_CFLAGS)
  17065. CFLAGS += -I$(abspath ../src)
  17066. CFLAGS += -I$(abspath ../src/utils)
  17067. @@ -34,7 +34,7 @@
  17068. -include .config
  17069. -include $(if $(MULTICALL),../hostapd/.config)
  17070. -@@ -84,6 +88,8 @@ OBJS_c += ../src/utils/wpa_debug.o
  17071. +@@ -113,6 +117,8 @@ OBJS_c += ../src/utils/wpa_debug.o
  17072. OBJS_c += ../src/utils/common.o
  17073. OBJS += wmm_ac.o
  17074. @@ -45,7 +45,7 @@
  17075. CONFIG_OS=win32
  17076. --- a/wpa_supplicant/wpa_supplicant.c
  17077. +++ b/wpa_supplicant/wpa_supplicant.c
  17078. -@@ -107,6 +107,55 @@ const char *wpa_supplicant_full_license5
  17079. +@@ -112,6 +112,55 @@ const char *const wpa_supplicant_full_li
  17080. "\n";
  17081. #endif /* CONFIG_NO_STDOUT_DEBUG */
  17082. @@ -73,7 +73,7 @@
  17083. + int ret;
  17084. +
  17085. + if (!bss)
  17086. -+ return;
  17087. ++ return -1;
  17088. +
  17089. + if (bss->ht_param & HT_INFO_HT_PARAM_STA_CHNL_WIDTH) {
  17090. + int sec = bss->ht_param & HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK;
  17091. @@ -101,7 +101,7 @@
  17092. /* Configure default/group WEP keys for static WEP */
  17093. int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
  17094. {
  17095. -@@ -743,8 +792,12 @@ void wpa_supplicant_set_state(struct wpa
  17096. +@@ -812,8 +861,12 @@ void wpa_supplicant_set_state(struct wpa
  17097. wpas_p2p_completed(wpa_s);
  17098. sme_sched_obss_scan(wpa_s, 1);
  17099. @@ -114,7 +114,7 @@
  17100. wpa_s->new_connection = 1;
  17101. wpa_drv_set_operstate(wpa_s, 0);
  17102. #ifndef IEEE8021X_EAPOL
  17103. -@@ -4038,6 +4091,20 @@ static int wpa_supplicant_init_iface(str
  17104. +@@ -4646,6 +4699,20 @@ static int wpa_supplicant_init_iface(str
  17105. sizeof(wpa_s->bridge_ifname));
  17106. }
  17107. @@ -135,7 +135,7 @@
  17108. /* RSNA Supplicant Key Management - INITIALIZE */
  17109. eapol_sm_notify_portEnabled(wpa_s->eapol, FALSE);
  17110. eapol_sm_notify_portValid(wpa_s->eapol, FALSE);
  17111. -@@ -4280,6 +4347,11 @@ static void wpa_supplicant_deinit_iface(
  17112. +@@ -4937,6 +5004,11 @@ static void wpa_supplicant_deinit_iface(
  17113. if (terminate)
  17114. wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING);
  17115. @@ -157,7 +157,7 @@
  17116. #include "drivers/driver.h"
  17117. #include "wpa_supplicant_i.h"
  17118. #include "config.h"
  17119. -@@ -277,6 +278,10 @@ static void calculate_update_time(const
  17120. +@@ -287,6 +288,10 @@ static void calculate_update_time(const
  17121. static void wpa_bss_copy_res(struct wpa_bss *dst, struct wpa_scan_res *src,
  17122. struct os_reltime *fetch_time)
  17123. {
  17124. @@ -168,7 +168,7 @@
  17125. dst->flags = src->flags;
  17126. os_memcpy(dst->bssid, src->bssid, ETH_ALEN);
  17127. dst->freq = src->freq;
  17128. -@@ -289,6 +294,15 @@ static void wpa_bss_copy_res(struct wpa_
  17129. +@@ -299,6 +304,15 @@ static void wpa_bss_copy_res(struct wpa_
  17130. dst->est_throughput = src->est_throughput;
  17131. dst->snr = src->snr;
  17132. @@ -186,7 +186,7 @@
  17133. --- a/wpa_supplicant/main.c
  17134. +++ b/wpa_supplicant/main.c
  17135. -@@ -33,7 +33,7 @@ static void usage(void)
  17136. +@@ -34,7 +34,7 @@ static void usage(void)
  17137. "vW] [-P<pid file>] "
  17138. "[-g<global ctrl>] \\\n"
  17139. " [-G<group>] \\\n"
  17140. @@ -195,24 +195,24 @@
  17141. "[-p<driver_param>] \\\n"
  17142. " [-b<br_ifname>] [-e<entropy file>]"
  17143. #ifdef CONFIG_DEBUG_FILE
  17144. -@@ -84,6 +84,7 @@ static void usage(void)
  17145. - #endif /* CONFIG_DEBUG_LINUX_TRACING */
  17146. - printf(" -t = include timestamp in debug messages\n"
  17147. +@@ -74,6 +74,7 @@ static void usage(void)
  17148. + " -g = global ctrl_interface\n"
  17149. + " -G = global ctrl_interface group\n"
  17150. " -h = show this help text\n"
  17151. -+ " -H = connect to a hostapd instance to manage state changes\n"
  17152. - " -L = show license (BSD)\n"
  17153. - " -o = override driver parameter for new interfaces\n"
  17154. - " -O = override ctrl_interface parameter for new interfaces\n"
  17155. -@@ -175,7 +176,7 @@ int main(int argc, char *argv[])
  17156. ++ " -H = connect to a hostapd instance to manage state changes\n"
  17157. + " -i = interface name\n"
  17158. + " -I = additional configuration file\n"
  17159. + " -K = include keys (passwords, etc.) in debug output\n"
  17160. +@@ -201,7 +202,7 @@ int main(int argc, char *argv[])
  17161. for (;;) {
  17162. c = getopt(argc, argv,
  17163. -- "b:Bc:C:D:de:f:g:G:hi:I:KLm:No:O:p:P:qsTtuvW");
  17164. -+ "b:Bc:C:D:de:f:g:G:hH:i:I:KLm:No:O:p:P:qsTtuvW");
  17165. +- "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuvW");
  17166. ++ "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuvW");
  17167. if (c < 0)
  17168. break;
  17169. switch (c) {
  17170. -@@ -222,6 +223,9 @@ int main(int argc, char *argv[])
  17171. +@@ -248,6 +249,9 @@ int main(int argc, char *argv[])
  17172. usage();
  17173. exitcode = 0;
  17174. goto out;
  17175. @@ -224,11 +224,11 @@
  17176. break;
  17177. --- a/wpa_supplicant/bss.h
  17178. +++ b/wpa_supplicant/bss.h
  17179. -@@ -72,6 +72,10 @@ struct wpa_bss {
  17180. - u8 ssid[32];
  17181. +@@ -79,6 +79,10 @@ struct wpa_bss {
  17182. + u8 ssid[SSID_MAX_LEN];
  17183. /** Length of SSID */
  17184. size_t ssid_len;
  17185. -+ /** HT caapbilities */
  17186. ++ /** HT capabilities */
  17187. + u16 ht_capab;
  17188. + /* Five octets of HT Operation Information */
  17189. + u8 ht_param;
  17190. diff --git a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch
  17191. index 3a41b82..9e815e9 100644
  17192. --- a/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch
  17193. +++ b/package/network/services/hostapd/patches/380-disable_ctrl_iface_mib.patch
  17194. @@ -1,18 +1,18 @@
  17195. --- a/hostapd/Makefile
  17196. +++ b/hostapd/Makefile
  17197. -@@ -168,6 +168,9 @@ endif
  17198. +@@ -212,6 +212,9 @@ endif
  17199. ifdef CONFIG_NO_CTRL_IFACE
  17200. CFLAGS += -DCONFIG_NO_CTRL_IFACE
  17201. else
  17202. +ifdef CONFIG_CTRL_IFACE_MIB
  17203. +CFLAGS += -DCONFIG_CTRL_IFACE_MIB
  17204. +endif
  17205. - OBJS += ctrl_iface.o
  17206. - OBJS += ../src/ap/ctrl_iface_ap.o
  17207. - endif
  17208. + ifeq ($(CONFIG_CTRL_IFACE), udp)
  17209. + CFLAGS += -DCONFIG_CTRL_IFACE_UDP
  17210. + else
  17211. --- a/hostapd/ctrl_iface.c
  17212. +++ b/hostapd/ctrl_iface.c
  17213. -@@ -1953,6 +1953,7 @@ static void hostapd_ctrl_iface_receive(i
  17214. +@@ -2342,6 +2342,7 @@ static int hostapd_ctrl_iface_receive_pr
  17215. reply_size);
  17216. } else if (os_strcmp(buf, "STATUS-DRIVER") == 0) {
  17217. reply_len = hostapd_drv_status(hapd, reply, reply_size);
  17218. @@ -20,18 +20,18 @@
  17219. } else if (os_strcmp(buf, "MIB") == 0) {
  17220. reply_len = ieee802_11_get_mib(hapd, reply, reply_size);
  17221. if (reply_len >= 0) {
  17222. -@@ -1994,6 +1995,7 @@ static void hostapd_ctrl_iface_receive(i
  17223. +@@ -2383,6 +2384,7 @@ static int hostapd_ctrl_iface_receive_pr
  17224. } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) {
  17225. reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply,
  17226. reply_size);
  17227. +#endif
  17228. } else if (os_strcmp(buf, "ATTACH") == 0) {
  17229. - if (hostapd_ctrl_iface_attach(hapd, &from, fromlen))
  17230. + if (hostapd_ctrl_iface_attach(hapd, from, fromlen))
  17231. reply_len = -1;
  17232. --- a/wpa_supplicant/Makefile
  17233. +++ b/wpa_supplicant/Makefile
  17234. -@@ -837,6 +837,9 @@ ifdef CONFIG_WNM
  17235. - OBJS += ../src/ap/wnm_ap.o
  17236. +@@ -874,6 +874,9 @@ ifdef CONFIG_MBO
  17237. + OBJS += ../src/ap/mbo_ap.o
  17238. endif
  17239. ifdef CONFIG_CTRL_IFACE
  17240. +ifdef CONFIG_CTRL_IFACE_MIB
  17241. @@ -42,7 +42,7 @@
  17242. --- a/wpa_supplicant/ctrl_iface.c
  17243. +++ b/wpa_supplicant/ctrl_iface.c
  17244. -@@ -1795,7 +1795,7 @@ static int wpa_supplicant_ctrl_iface_sta
  17245. +@@ -1895,7 +1895,7 @@ static int wpa_supplicant_ctrl_iface_sta
  17246. pos += ret;
  17247. }
  17248. @@ -51,7 +51,7 @@
  17249. if (wpa_s->ap_iface) {
  17250. pos += ap_ctrl_iface_wpa_get_status(wpa_s, pos,
  17251. end - pos,
  17252. -@@ -7896,6 +7896,7 @@ char * wpa_supplicant_ctrl_iface_process
  17253. +@@ -8687,6 +8687,7 @@ char * wpa_supplicant_ctrl_iface_process
  17254. reply_len = -1;
  17255. } else if (os_strncmp(buf, "NOTE ", 5) == 0) {
  17256. wpa_printf(MSG_INFO, "NOTE: %s", buf + 5);
  17257. @@ -59,7 +59,7 @@
  17258. } else if (os_strcmp(buf, "MIB") == 0) {
  17259. reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size);
  17260. if (reply_len >= 0) {
  17261. -@@ -7903,6 +7904,7 @@ char * wpa_supplicant_ctrl_iface_process
  17262. +@@ -8694,6 +8695,7 @@ char * wpa_supplicant_ctrl_iface_process
  17263. reply + reply_len,
  17264. reply_size - reply_len);
  17265. }
  17266. @@ -67,7 +67,7 @@
  17267. } else if (os_strncmp(buf, "STATUS", 6) == 0) {
  17268. reply_len = wpa_supplicant_ctrl_iface_status(
  17269. wpa_s, buf + 6, reply, reply_size);
  17270. -@@ -8353,6 +8355,7 @@ char * wpa_supplicant_ctrl_iface_process
  17271. +@@ -9164,6 +9166,7 @@ char * wpa_supplicant_ctrl_iface_process
  17272. reply_len = wpa_supplicant_ctrl_iface_bss(
  17273. wpa_s, buf + 4, reply, reply_size);
  17274. #ifdef CONFIG_AP
  17275. @@ -75,7 +75,7 @@
  17276. } else if (os_strcmp(buf, "STA-FIRST") == 0) {
  17277. reply_len = ap_ctrl_iface_sta_first(wpa_s, reply, reply_size);
  17278. } else if (os_strncmp(buf, "STA ", 4) == 0) {
  17279. -@@ -8361,12 +8364,15 @@ char * wpa_supplicant_ctrl_iface_process
  17280. +@@ -9172,12 +9175,15 @@ char * wpa_supplicant_ctrl_iface_process
  17281. } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) {
  17282. reply_len = ap_ctrl_iface_sta_next(wpa_s, buf + 9, reply,
  17283. reply_size);
  17284. @@ -93,15 +93,15 @@
  17285. reply_len = -1;
  17286. --- a/src/ap/ctrl_iface_ap.c
  17287. +++ b/src/ap/ctrl_iface_ap.c
  17288. -@@ -22,6 +22,7 @@
  17289. - #include "ctrl_iface_ap.h"
  17290. +@@ -24,6 +24,7 @@
  17291. #include "ap_drv_ops.h"
  17292. + #include "mbo_ap.h"
  17293. +#ifdef CONFIG_CTRL_IFACE_MIB
  17294. static int hostapd_get_sta_tx_rx(struct hostapd_data *hapd,
  17295. struct sta_info *sta,
  17296. -@@ -224,6 +225,7 @@ int hostapd_ctrl_iface_sta_next(struct h
  17297. +@@ -249,6 +250,7 @@ int hostapd_ctrl_iface_sta_next(struct h
  17298. return hostapd_ctrl_iface_sta_mib(hapd, sta->next, buf, buflen);
  17299. }
  17300. @@ -111,33 +111,33 @@
  17301. static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype,
  17302. --- a/src/ap/ieee802_1x.c
  17303. +++ b/src/ap/ieee802_1x.c
  17304. -@@ -2337,6 +2337,7 @@ static const char * bool_txt(Boolean boo
  17305. - return bool_val ? "TRUE" : "FALSE";
  17306. +@@ -2441,6 +2441,7 @@ static const char * bool_txt(Boolean val
  17307. + return val ? "TRUE" : "FALSE";
  17308. }
  17309. +#ifdef CONFIG_CTRL_IFACE_MIB
  17310. int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen)
  17311. {
  17312. -@@ -2512,6 +2513,7 @@ int ieee802_1x_get_mib_sta(struct hostap
  17313. +@@ -2616,6 +2617,7 @@ int ieee802_1x_get_mib_sta(struct hostap
  17314. return len;
  17315. }
  17316. +#endif
  17317. - static void ieee802_1x_finished(struct hostapd_data *hapd,
  17318. - struct sta_info *sta, int success,
  17319. + #ifdef CONFIG_HS20
  17320. + static void ieee802_1x_wnm_notif_send(void *eloop_ctx, void *timeout_ctx)
  17321. --- a/src/ap/wpa_auth.c
  17322. +++ b/src/ap/wpa_auth.c
  17323. -@@ -2999,6 +2999,7 @@ static const char * wpa_bool_txt(int boo
  17324. - return bool ? "TRUE" : "FALSE";
  17325. +@@ -3069,6 +3069,7 @@ static const char * wpa_bool_txt(int val
  17326. + return val ? "TRUE" : "FALSE";
  17327. }
  17328. +#ifdef CONFIG_CTRL_IFACE_MIB
  17329. #define RSN_SUITE "%02x-%02x-%02x-%d"
  17330. #define RSN_SUITE_ARG(s) \
  17331. -@@ -3143,7 +3144,7 @@ int wpa_get_mib_sta(struct wpa_state_mac
  17332. +@@ -3213,7 +3214,7 @@ int wpa_get_mib_sta(struct wpa_state_mac
  17333. return len;
  17334. }
  17335. @@ -148,7 +148,7 @@
  17336. {
  17337. --- a/src/rsn_supp/wpa.c
  17338. +++ b/src/rsn_supp/wpa.c
  17339. -@@ -2032,6 +2032,8 @@ static u32 wpa_key_mgmt_suite(struct wpa
  17340. +@@ -2108,6 +2108,8 @@ static u32 wpa_key_mgmt_suite(struct wpa
  17341. }
  17342. @@ -157,7 +157,7 @@
  17343. #define RSN_SUITE "%02x-%02x-%02x-%d"
  17344. #define RSN_SUITE_ARG(s) \
  17345. ((s) >> 24) & 0xff, ((s) >> 16) & 0xff, ((s) >> 8) & 0xff, (s) & 0xff
  17346. -@@ -2115,6 +2117,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch
  17347. +@@ -2191,6 +2193,7 @@ int wpa_sm_get_mib(struct wpa_sm *sm, ch
  17348. return (int) len;
  17349. }
  17350. @@ -167,7 +167,7 @@
  17351. --- a/wpa_supplicant/ap.c
  17352. +++ b/wpa_supplicant/ap.c
  17353. -@@ -1015,7 +1015,7 @@ int wpas_ap_wps_nfc_report_handover(stru
  17354. +@@ -1114,7 +1114,7 @@ int wpas_ap_wps_nfc_report_handover(stru
  17355. #endif /* CONFIG_WPS */
  17356. diff --git a/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch b/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch
  17357. index 1065a7f..c9e7bf4 100644
  17358. --- a/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch
  17359. +++ b/package/network/services/hostapd/patches/390-wpa_ie_cap_workaround.patch
  17360. @@ -1,6 +1,6 @@
  17361. --- a/src/common/wpa_common.c
  17362. +++ b/src/common/wpa_common.c
  17363. -@@ -1228,6 +1228,31 @@ u32 wpa_akm_to_suite(int akm)
  17364. +@@ -1244,6 +1244,31 @@ u32 wpa_akm_to_suite(int akm)
  17365. }
  17366. @@ -32,7 +32,7 @@
  17367. int wpa_compare_rsn_ie(int ft_initial_assoc,
  17368. const u8 *ie1, size_t ie1len,
  17369. const u8 *ie2, size_t ie2len)
  17370. -@@ -1235,8 +1260,19 @@ int wpa_compare_rsn_ie(int ft_initial_as
  17371. +@@ -1251,8 +1276,19 @@ int wpa_compare_rsn_ie(int ft_initial_as
  17372. if (ie1 == NULL || ie2 == NULL)
  17373. return -1;
  17374. diff --git a/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch b/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch
  17375. index 083af5b..f5872cd 100644
  17376. --- a/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch
  17377. +++ b/package/network/services/hostapd/patches/400-wps_single_auth_enc_type.patch
  17378. @@ -1,25 +1,22 @@
  17379. --- a/src/ap/wps_hostapd.c
  17380. +++ b/src/ap/wps_hostapd.c
  17381. -@@ -1052,11 +1052,9 @@ int hostapd_init_wps(struct hostapd_data
  17382. -
  17383. - if (conf->rsn_pairwise & (WPA_CIPHER_CCMP | WPA_CIPHER_GCMP))
  17384. +@@ -352,8 +352,7 @@ static int hapd_wps_reconfig_in_memory(s
  17385. + bss->wpa_pairwise |= WPA_CIPHER_GCMP;
  17386. + else
  17387. + bss->wpa_pairwise |= WPA_CIPHER_CCMP;
  17388. +- }
  17389. +- if (cred->encr_type & WPS_ENCR_TKIP)
  17390. ++ } else if (cred->encr_type & WPS_ENCR_TKIP)
  17391. + bss->wpa_pairwise |= WPA_CIPHER_TKIP;
  17392. + bss->rsn_pairwise = bss->wpa_pairwise;
  17393. + bss->wpa_group = wpa_select_ap_group_cipher(bss->wpa,
  17394. +@@ -1073,8 +1072,7 @@ int hostapd_init_wps(struct hostapd_data
  17395. + if (conf->rsn_pairwise & (WPA_CIPHER_CCMP | WPA_CIPHER_GCMP)) {
  17396. wps->encr_types |= WPS_ENCR_AES;
  17397. -- if (conf->rsn_pairwise & WPA_CIPHER_TKIP)
  17398. -+ else if (conf->rsn_pairwise & WPA_CIPHER_TKIP)
  17399. + wps->encr_types_rsn |= WPS_ENCR_AES;
  17400. +- }
  17401. +- if (conf->rsn_pairwise & WPA_CIPHER_TKIP) {
  17402. ++ } else if (conf->rsn_pairwise & WPA_CIPHER_TKIP) {
  17403. wps->encr_types |= WPS_ENCR_TKIP;
  17404. -- }
  17405. --
  17406. -- if (conf->wpa & WPA_PROTO_WPA) {
  17407. -+ } else if (conf->wpa & WPA_PROTO_WPA) {
  17408. - if (conf->wpa_key_mgmt & WPA_KEY_MGMT_PSK)
  17409. - wps->auth_types |= WPS_AUTH_WPAPSK;
  17410. - if (conf->wpa_key_mgmt & WPA_KEY_MGMT_IEEE8021X)
  17411. -@@ -1064,7 +1062,7 @@ int hostapd_init_wps(struct hostapd_data
  17412. -
  17413. - if (conf->wpa_pairwise & WPA_CIPHER_CCMP)
  17414. - wps->encr_types |= WPS_ENCR_AES;
  17415. -- if (conf->wpa_pairwise & WPA_CIPHER_TKIP)
  17416. -+ else if (conf->wpa_pairwise & WPA_CIPHER_TKIP)
  17417. - wps->encr_types |= WPS_ENCR_TKIP;
  17418. - }
  17419. -
  17420. + wps->encr_types_rsn |= WPS_ENCR_TKIP;
  17421. + }
  17422. diff --git a/package/network/services/hostapd/patches/410-limit_debug_messages.patch b/package/network/services/hostapd/patches/410-limit_debug_messages.patch
  17423. index da88732..a48b696 100644
  17424. --- a/package/network/services/hostapd/patches/410-limit_debug_messages.patch
  17425. +++ b/package/network/services/hostapd/patches/410-limit_debug_messages.patch
  17426. @@ -64,7 +64,7 @@
  17427. #ifdef CONFIG_DEBUG_FILE
  17428. static char *last_path = NULL;
  17429. #endif /* CONFIG_DEBUG_FILE */
  17430. -@@ -602,7 +576,7 @@ void wpa_msg_register_ifname_cb(wpa_msg_
  17431. +@@ -604,7 +578,7 @@ void wpa_msg_register_ifname_cb(wpa_msg_
  17432. }
  17433. @@ -73,7 +73,7 @@
  17434. {
  17435. va_list ap;
  17436. char *buf;
  17437. -@@ -640,7 +614,7 @@ void wpa_msg(void *ctx, int level, const
  17438. +@@ -642,7 +616,7 @@ void wpa_msg(void *ctx, int level, const
  17439. }
  17440. @@ -183,7 +183,7 @@
  17441. /*
  17442. * wpa_dbg() behaves like wpa_msg(), but it can be removed from build to reduce
  17443. -@@ -181,7 +222,12 @@ void wpa_hexdump_ascii_key(int level, co
  17444. +@@ -182,7 +223,12 @@ void wpa_hexdump_ascii_key(int level, co
  17445. *
  17446. * Note: New line '\n' is added to the end of the text when printing to stdout.
  17447. */
  17448. @@ -197,7 +197,7 @@
  17449. /**
  17450. * wpa_msg_ctrl - Conditional printf for ctrl_iface monitors
  17451. -@@ -195,8 +241,13 @@ void wpa_msg(void *ctx, int level, const
  17452. +@@ -196,8 +242,13 @@ void wpa_msg(void *ctx, int level, const
  17453. * attached ctrl_iface monitors. In other words, it can be used for frequent
  17454. * events that do not need to be sent to syslog.
  17455. */
  17456. diff --git a/package/network/services/hostapd/patches/420-indicate-features.patch b/package/network/services/hostapd/patches/420-indicate-features.patch
  17457. index 64c92df..335e71e 100644
  17458. --- a/package/network/services/hostapd/patches/420-indicate-features.patch
  17459. +++ b/package/network/services/hostapd/patches/420-indicate-features.patch
  17460. @@ -8,16 +8,16 @@
  17461. #include "crypto/random.h"
  17462. #include "crypto/tls.h"
  17463. #include "common/version.h"
  17464. -@@ -567,7 +568,7 @@ int main(int argc, char *argv[])
  17465. -
  17466. +@@ -668,7 +669,7 @@ int main(int argc, char *argv[])
  17467. wpa_supplicant_event = hostapd_wpa_event;
  17468. + wpa_supplicant_event_global = hostapd_wpa_event_global;
  17469. for (;;) {
  17470. -- c = getopt(argc, argv, "b:Bde:f:hKP:Ttu:vg:G:");
  17471. -+ c = getopt(argc, argv, "b:Bde:f:hKP:Ttu:g:G:v::");
  17472. +- c = getopt(argc, argv, "b:Bde:f:hi:KP:STtu:vg:G:");
  17473. ++ c = getopt(argc, argv, "b:Bde:f:hi:KP:STtu:g:G:v::");
  17474. if (c < 0)
  17475. break;
  17476. switch (c) {
  17477. -@@ -604,6 +605,8 @@ int main(int argc, char *argv[])
  17478. +@@ -705,6 +706,8 @@ int main(int argc, char *argv[])
  17479. break;
  17480. #endif /* CONFIG_DEBUG_LINUX_TRACING */
  17481. case 'v':
  17482. @@ -33,19 +33,19 @@
  17483. #include "common.h"
  17484. +#include "build_features.h"
  17485. + #include "fst/fst.h"
  17486. #include "wpa_supplicant_i.h"
  17487. #include "driver_i.h"
  17488. - #include "p2p_supplicant.h"
  17489. -@@ -176,7 +177,7 @@ int main(int argc, char *argv[])
  17490. +@@ -202,7 +203,7 @@ int main(int argc, char *argv[])
  17491. for (;;) {
  17492. c = getopt(argc, argv,
  17493. -- "b:Bc:C:D:de:f:g:G:hH:i:I:KLm:No:O:p:P:qsTtuvW");
  17494. -+ "b:Bc:C:D:de:f:g:G:hH:i:I:KLm:No:O:p:P:qsTtuv::W");
  17495. +- "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuvW");
  17496. ++ "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuv::W");
  17497. if (c < 0)
  17498. break;
  17499. switch (c) {
  17500. -@@ -279,8 +280,12 @@ int main(int argc, char *argv[])
  17501. +@@ -305,8 +306,12 @@ int main(int argc, char *argv[])
  17502. break;
  17503. #endif /* CONFIG_DBUS */
  17504. case 'v':
  17505. diff --git a/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch b/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch
  17506. index 85d2e16..d07b747 100644
  17507. --- a/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch
  17508. +++ b/package/network/services/hostapd/patches/430-hostapd_cli_ifdef.patch
  17509. @@ -1,6 +1,6 @@
  17510. --- a/hostapd/hostapd_cli.c
  17511. +++ b/hostapd/hostapd_cli.c
  17512. -@@ -67,7 +67,6 @@ static const char *commands_help =
  17513. +@@ -69,7 +69,6 @@ static const char *const commands_help =
  17514. #ifdef CONFIG_IEEE80211W
  17515. " sa_query <addr> send SA Query to a station\n"
  17516. #endif /* CONFIG_IEEE80211W */
  17517. @@ -8,7 +8,7 @@
  17518. " wps_pin <uuid> <pin> [timeout] [addr] add WPS Enrollee PIN\n"
  17519. " wps_check_pin <PIN> verify PIN checksum\n"
  17520. " wps_pbc indicate button pushed to initiate PBC\n"
  17521. -@@ -80,7 +79,6 @@ static const char *commands_help =
  17522. +@@ -82,7 +81,6 @@ static const char *const commands_help =
  17523. " wps_ap_pin <cmd> [params..] enable/disable AP PIN\n"
  17524. " wps_config <SSID> <auth> <encr> <key> configure AP\n"
  17525. " wps_get_status show current WPS status\n"
  17526. @@ -16,7 +16,7 @@
  17527. " get_config show current configuration\n"
  17528. " help show this usage help\n"
  17529. " interface [ifname] show interfaces/select interface\n"
  17530. -@@ -353,7 +351,6 @@ static int hostapd_cli_cmd_sa_query(stru
  17531. +@@ -418,7 +416,6 @@ static int hostapd_cli_cmd_sa_query(stru
  17532. #endif /* CONFIG_IEEE80211W */
  17533. @@ -24,7 +24,7 @@
  17534. static int hostapd_cli_cmd_wps_pin(struct wpa_ctrl *ctrl, int argc,
  17535. char *argv[])
  17536. {
  17537. -@@ -579,7 +576,6 @@ static int hostapd_cli_cmd_wps_config(st
  17538. +@@ -644,7 +641,6 @@ static int hostapd_cli_cmd_wps_config(st
  17539. ssid_hex, argv[1]);
  17540. return wpa_ctrl_command(ctrl, buf);
  17541. }
  17542. @@ -32,7 +32,7 @@
  17543. static int hostapd_cli_cmd_disassoc_imminent(struct wpa_ctrl *ctrl, int argc,
  17544. -@@ -1027,7 +1023,6 @@ static struct hostapd_cli_cmd hostapd_cl
  17545. +@@ -1236,7 +1232,6 @@ static const struct hostapd_cli_cmd host
  17546. #ifdef CONFIG_IEEE80211W
  17547. { "sa_query", hostapd_cli_cmd_sa_query },
  17548. #endif /* CONFIG_IEEE80211W */
  17549. @@ -40,7 +40,7 @@
  17550. { "wps_pin", hostapd_cli_cmd_wps_pin },
  17551. { "wps_check_pin", hostapd_cli_cmd_wps_check_pin },
  17552. { "wps_pbc", hostapd_cli_cmd_wps_pbc },
  17553. -@@ -1041,7 +1036,6 @@ static struct hostapd_cli_cmd hostapd_cl
  17554. +@@ -1250,7 +1245,6 @@ static const struct hostapd_cli_cmd host
  17555. { "wps_ap_pin", hostapd_cli_cmd_wps_ap_pin },
  17556. { "wps_config", hostapd_cli_cmd_wps_config },
  17557. { "wps_get_status", hostapd_cli_cmd_wps_get_status },
  17558. diff --git a/package/network/services/hostapd/patches/431-wpa_cli_ifdef.patch b/package/network/services/hostapd/patches/431-wpa_cli_ifdef.patch
  17559. index 874ff4b..256f6b5 100644
  17560. --- a/package/network/services/hostapd/patches/431-wpa_cli_ifdef.patch
  17561. +++ b/package/network/services/hostapd/patches/431-wpa_cli_ifdef.patch
  17562. @@ -1,13 +1,12 @@
  17563. --- a/wpa_supplicant/wpa_cli.c
  17564. +++ b/wpa_supplicant/wpa_cli.c
  17565. -@@ -26,6 +26,10 @@
  17566. +@@ -25,6 +25,9 @@
  17567. + #include <cutils/properties.h>
  17568. #endif /* ANDROID */
  17569. -
  17570. +#ifndef CONFIG_P2P
  17571. +#define CONFIG_P2P
  17572. +#endif
  17573. -+
  17574. - static const char *wpa_cli_version =
  17575. +
  17576. + static const char *const wpa_cli_version =
  17577. "wpa_cli v" VERSION_STR "\n"
  17578. - "Copyright (c) 2004-2015, Jouni Malinen <j@w1.fi> and contributors";
  17579. diff --git a/package/network/services/hostapd/patches/432-missing-typedef.patch b/package/network/services/hostapd/patches/432-missing-typedef.patch
  17580. new file mode 100644
  17581. index 0000000..7a100f1
  17582. --- /dev/null
  17583. +++ b/package/network/services/hostapd/patches/432-missing-typedef.patch
  17584. @@ -0,0 +1,10 @@
  17585. +--- a/src/drivers/linux_wext.h
  17586. ++++ b/src/drivers/linux_wext.h
  17587. +@@ -26,6 +26,7 @@ typedef int32_t __s32;
  17588. + typedef uint16_t __u16;
  17589. + typedef int16_t __s16;
  17590. + typedef uint8_t __u8;
  17591. ++typedef int8_t __s8;
  17592. + #ifndef __user
  17593. + #define __user
  17594. + #endif /* __user */
  17595. diff --git a/package/network/services/hostapd/patches/440-max_num_sta_probe.patch b/package/network/services/hostapd/patches/440-max_num_sta_probe.patch
  17596. deleted file mode 100644
  17597. index 74aef26..0000000
  17598. --- a/package/network/services/hostapd/patches/440-max_num_sta_probe.patch
  17599. +++ /dev/null
  17600. @@ -1,13 +0,0 @@
  17601. ---- a/src/ap/beacon.c
  17602. -+++ b/src/ap/beacon.c
  17603. -@@ -664,6 +664,10 @@ void handle_probe_req(struct hostapd_dat
  17604. - return;
  17605. - }
  17606. -
  17607. -+ if (!sta && hapd->num_sta >= hapd->conf->max_num_sta)
  17608. -+ wpa_printf(MSG_MSGDUMP, "Probe Request from " MACSTR " ignored,"
  17609. -+ " too many connected stations.", MAC2STR(mgmt->sa));
  17610. -+
  17611. - #ifdef CONFIG_INTERWORKING
  17612. - if (hapd->conf->interworking &&
  17613. - elems.interworking && elems.interworking_len >= 1) {
  17614. diff --git a/package/network/services/hostapd/patches/450-scan_wait.patch b/package/network/services/hostapd/patches/450-scan_wait.patch
  17615. index 87ebd45..78cf306 100644
  17616. --- a/package/network/services/hostapd/patches/450-scan_wait.patch
  17617. +++ b/package/network/services/hostapd/patches/450-scan_wait.patch
  17618. @@ -1,6 +1,6 @@
  17619. --- a/hostapd/main.c
  17620. +++ b/hostapd/main.c
  17621. -@@ -36,6 +36,8 @@ struct hapd_global {
  17622. +@@ -37,6 +37,8 @@ struct hapd_global {
  17623. };
  17624. static struct hapd_global global;
  17625. @@ -9,7 +9,7 @@
  17626. #ifndef CONFIG_NO_HOSTAPD_LOGGER
  17627. -@@ -142,6 +144,14 @@ static void hostapd_logger_cb(void *ctx,
  17628. +@@ -143,6 +145,14 @@ static void hostapd_logger_cb(void *ctx,
  17629. }
  17630. #endif /* CONFIG_NO_HOSTAPD_LOGGER */
  17631. @@ -24,7 +24,7 @@
  17632. /**
  17633. * hostapd_driver_init - Preparate driver interface
  17634. -@@ -160,6 +170,8 @@ static int hostapd_driver_init(struct ho
  17635. +@@ -161,6 +171,8 @@ static int hostapd_driver_init(struct ho
  17636. return -1;
  17637. }
  17638. @@ -33,7 +33,7 @@
  17639. /* Initialize the driver interface */
  17640. if (!(b[0] | b[1] | b[2] | b[3] | b[4] | b[5]))
  17641. b = NULL;
  17642. -@@ -381,8 +393,6 @@ static void hostapd_global_deinit(const
  17643. +@@ -401,8 +413,6 @@ static void hostapd_global_deinit(const
  17644. #endif /* CONFIG_NATIVE_WINDOWS */
  17645. eap_server_unregister_methods();
  17646. @@ -42,19 +42,26 @@
  17647. }
  17648. -@@ -408,11 +418,6 @@ static int hostapd_global_run(struct hap
  17649. +@@ -428,18 +438,6 @@ static int hostapd_global_run(struct hap
  17650. }
  17651. #endif /* EAP_SERVER_TNC */
  17652. -- if (daemonize && os_daemonize(pid_file)) {
  17653. -- wpa_printf(MSG_ERROR, "daemon: %s", strerror(errno));
  17654. -- return -1;
  17655. +- if (daemonize) {
  17656. +- if (os_daemonize(pid_file)) {
  17657. +- wpa_printf(MSG_ERROR, "daemon: %s", strerror(errno));
  17658. +- return -1;
  17659. +- }
  17660. +- if (eloop_sock_requeue()) {
  17661. +- wpa_printf(MSG_ERROR, "eloop_sock_requeue: %s",
  17662. +- strerror(errno));
  17663. +- return -1;
  17664. +- }
  17665. - }
  17666. -
  17667. eloop_run();
  17668. return 0;
  17669. -@@ -542,8 +547,7 @@ int main(int argc, char *argv[])
  17670. +@@ -638,8 +636,7 @@ int main(int argc, char *argv[])
  17671. struct hapd_interfaces interfaces;
  17672. int ret = 1;
  17673. size_t i, j;
  17674. diff --git a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch
  17675. index 217e701..6a5866e 100644
  17676. --- a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch
  17677. +++ b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch
  17678. @@ -18,15 +18,15 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  17679. #define WPA_SUPPLICANT_DRIVER_VERSION 4
  17680. -+#include "drivers/nl80211_copy.h"
  17681. ++#include "ap/sta_info.h"
  17682. #include "common/defs.h"
  17683. + #include "common/ieee802_11_defs.h"
  17684. #include "utils/list.h"
  17685. -
  17686. -@@ -538,6 +539,9 @@ struct wpa_driver_associate_params {
  17687. +@@ -587,6 +588,9 @@ struct wpa_driver_associate_params {
  17688. * responsible for selecting with which BSS to associate. */
  17689. const u8 *bssid;
  17690. -+ unsigned char rates[NL80211_MAX_SUPP_RATES];
  17691. ++ unsigned char rates[WLAN_SUPP_RATES_MAX];
  17692. + int mcast_rate;
  17693. +
  17694. /**
  17695. @@ -34,15 +34,15 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  17696. *
  17697. --- a/wpa_supplicant/config.c
  17698. +++ b/wpa_supplicant/config.c
  17699. -@@ -15,6 +15,7 @@
  17700. - #include "rsn_supp/wpa.h"
  17701. +@@ -16,6 +16,7 @@
  17702. #include "eap_peer/eap.h"
  17703. #include "p2p/p2p.h"
  17704. -+#include "drivers/nl80211_copy.h"
  17705. + #include "fst/fst.h"
  17706. ++#include "ap/sta_info.h"
  17707. #include "config.h"
  17708. -@@ -1722,6 +1723,97 @@ static char * wpa_config_write_mesh_basi
  17709. +@@ -1816,6 +1817,97 @@ static char * wpa_config_write_mesh_basi
  17710. #endif /* CONFIG_MESH */
  17711. @@ -88,7 +88,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  17712. + pos = (char *)value;
  17713. + r = strtok_r(pos, ",", &sptr);
  17714. + i = 0;
  17715. -+ while (pos && i < NL80211_MAX_SUPP_RATES) {
  17716. ++ while (pos && i < WLAN_SUPP_RATES_MAX) {
  17717. + rate = 0.0;
  17718. + if (r)
  17719. + rate = strtod(r, &end);
  17720. @@ -113,11 +113,11 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  17721. + if (ssid->rates[0] <= 0)
  17722. + return NULL;
  17723. +
  17724. -+ value = os_malloc(6 * NL80211_MAX_SUPP_RATES + 1);
  17725. ++ value = os_malloc(6 * WLAN_SUPP_RATES_MAX + 1);
  17726. + if (value == NULL)
  17727. + return NULL;
  17728. + pos = value;
  17729. -+ for (i = 0; i < NL80211_MAX_SUPP_RATES - 1; i++) {
  17730. ++ for (i = 0; i < WLAN_SUPP_RATES_MAX - 1; i++) {
  17731. + res = os_snprintf(pos, 6, "%.1f,", (double)ssid->rates[i] / 2);
  17732. + if (res < 0) {
  17733. + os_free(value);
  17734. @@ -126,13 +126,13 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  17735. + pos += res;
  17736. + }
  17737. + res = os_snprintf(pos, 6, "%.1f",
  17738. -+ (double)ssid->rates[NL80211_MAX_SUPP_RATES - 1] / 2);
  17739. ++ (double)ssid->rates[WLAN_SUPP_RATES_MAX - 1] / 2);
  17740. + if (res < 0) {
  17741. + os_free(value);
  17742. + return NULL;
  17743. + }
  17744. +
  17745. -+ value[6 * NL80211_MAX_SUPP_RATES] = '\0';
  17746. ++ value[6 * WLAN_SUPP_RATES_MAX] = '\0';
  17747. + return value;
  17748. +}
  17749. +#endif /* NO_CONFIG_WRITE */
  17750. @@ -140,7 +140,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  17751. /* Helper macros for network block parser */
  17752. #ifdef OFFSET
  17753. -@@ -1947,6 +2039,9 @@ static const struct parse_data ssid_fiel
  17754. +@@ -2047,6 +2139,9 @@ static const struct parse_data ssid_fiel
  17755. { INT(ap_max_inactivity) },
  17756. { INT(dtim_period) },
  17757. { INT(beacon_int) },
  17758. @@ -152,19 +152,22 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  17759. #endif /* CONFIG_MACSEC */
  17760. --- a/wpa_supplicant/config_ssid.h
  17761. +++ b/wpa_supplicant/config_ssid.h
  17762. -@@ -12,6 +12,7 @@
  17763. +@@ -10,8 +10,10 @@
  17764. + #define CONFIG_SSID_H
  17765. +
  17766. #include "common/defs.h"
  17767. ++#include "ap/sta_info.h"
  17768. #include "utils/list.h"
  17769. #include "eap_peer/eap_config.h"
  17770. +#include "drivers/nl80211_copy.h"
  17771. - #define MAX_SSID_LEN 32
  17772. -@@ -675,6 +676,9 @@ struct wpa_ssid {
  17773. + #define DEFAULT_EAP_WORKAROUND ((unsigned int) -1)
  17774. +@@ -711,6 +713,9 @@ struct wpa_ssid {
  17775. */
  17776. void *parent_cred;
  17777. -+ unsigned char rates[NL80211_MAX_SUPP_RATES];
  17778. ++ unsigned char rates[WLAN_SUPP_RATES_MAX];
  17779. + double mcast_rate;
  17780. +
  17781. #ifdef CONFIG_MACSEC
  17782. @@ -172,13 +175,13 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  17783. * macsec_policy - Determines the policy for MACsec secure session
  17784. --- a/wpa_supplicant/wpa_supplicant.c
  17785. +++ b/wpa_supplicant/wpa_supplicant.c
  17786. -@@ -2266,6 +2266,13 @@ static void wpas_start_assoc_cb(struct w
  17787. +@@ -2518,6 +2518,13 @@ static void wpas_start_assoc_cb(struct w
  17788. params.beacon_int = ssid->beacon_int;
  17789. else
  17790. params.beacon_int = wpa_s->conf->beacon_int;
  17791. + params.fixed_freq = ssid->fixed_freq;
  17792. + i = 0;
  17793. -+ while (i < NL80211_MAX_SUPP_RATES) {
  17794. ++ while (i < WLAN_SUPP_RATES_MAX) {
  17795. + params.rates[i] = ssid->rates[i];
  17796. + i++;
  17797. + }
  17798. diff --git a/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch b/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch
  17799. index 730cc31..459bdb9 100644
  17800. --- a/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch
  17801. +++ b/package/network/services/hostapd/patches/461-driver_nl80211-use-new-parameters-during-ibss-join.patch
  17802. @@ -10,7 +10,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  17803. --- a/src/drivers/driver_nl80211.c
  17804. +++ b/src/drivers/driver_nl80211.c
  17805. -@@ -4398,7 +4398,7 @@ static int wpa_driver_nl80211_ibss(struc
  17806. +@@ -4644,7 +4644,7 @@ static int wpa_driver_nl80211_ibss(struc
  17807. struct wpa_driver_associate_params *params)
  17808. {
  17809. struct nl_msg *msg;
  17810. @@ -19,7 +19,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
  17811. int count = 0;
  17812. wpa_printf(MSG_DEBUG, "nl80211: Join IBSS (ifindex=%d)", drv->ifindex);
  17813. -@@ -4425,6 +4425,37 @@ retry:
  17814. +@@ -4671,6 +4671,37 @@ retry:
  17815. nl80211_put_beacon_int(msg, params->beacon_int))
  17816. goto fail;
  17817. diff --git a/package/network/services/hostapd/patches/462-wpa_s-support-htmode-param.patch b/package/network/services/hostapd/patches/462-wpa_s-support-htmode-param.patch
  17818. index 30bb2dc..80fe49c 100644
  17819. --- a/package/network/services/hostapd/patches/462-wpa_s-support-htmode-param.patch
  17820. +++ b/package/network/services/hostapd/patches/462-wpa_s-support-htmode-param.patch
  17821. @@ -16,9 +16,9 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  17822. --- a/src/drivers/driver.h
  17823. +++ b/src/drivers/driver.h
  17824. -@@ -541,6 +541,8 @@ struct wpa_driver_associate_params {
  17825. +@@ -590,6 +590,8 @@ struct wpa_driver_associate_params {
  17826. - unsigned char rates[NL80211_MAX_SUPP_RATES];
  17827. + unsigned char rates[WLAN_SUPP_RATES_MAX];
  17828. int mcast_rate;
  17829. + int ht_set;
  17830. + unsigned int htmode;
  17831. @@ -27,7 +27,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  17832. * bssid_hint - BSSID of a proposed AP
  17833. --- a/src/drivers/driver_nl80211.c
  17834. +++ b/src/drivers/driver_nl80211.c
  17835. -@@ -4456,6 +4456,22 @@ retry:
  17836. +@@ -4702,6 +4702,22 @@ retry:
  17837. nla_put_u32(msg, NL80211_ATTR_MCAST_RATE, params->mcast_rate);
  17838. }
  17839. @@ -52,7 +52,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  17840. goto fail;
  17841. --- a/wpa_supplicant/config.c
  17842. +++ b/wpa_supplicant/config.c
  17843. -@@ -1754,6 +1754,71 @@ static char * wpa_config_write_mcast_rat
  17844. +@@ -1848,6 +1848,71 @@ static char * wpa_config_write_mcast_rat
  17845. }
  17846. #endif /* NO_CONFIG_WRITE */
  17847. @@ -124,7 +124,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  17848. static int wpa_config_parse_rates(const struct parse_data *data,
  17849. struct wpa_ssid *ssid, int line,
  17850. const char *value)
  17851. -@@ -2042,6 +2107,7 @@ static const struct parse_data ssid_fiel
  17852. +@@ -2142,6 +2207,7 @@ static const struct parse_data ssid_fiel
  17853. { INT_RANGE(fixed_freq, 0, 1) },
  17854. { FUNC(rates) },
  17855. { FUNC(mcast_rate) },
  17856. @@ -134,9 +134,9 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  17857. #endif /* CONFIG_MACSEC */
  17858. --- a/wpa_supplicant/config_ssid.h
  17859. +++ b/wpa_supplicant/config_ssid.h
  17860. -@@ -678,6 +678,8 @@ struct wpa_ssid {
  17861. +@@ -715,6 +715,8 @@ struct wpa_ssid {
  17862. - unsigned char rates[NL80211_MAX_SUPP_RATES];
  17863. + unsigned char rates[WLAN_SUPP_RATES_MAX];
  17864. double mcast_rate;
  17865. + int ht_set;
  17866. + unsigned int htmode;
  17867. @@ -145,7 +145,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
  17868. /**
  17869. --- a/wpa_supplicant/wpa_supplicant.c
  17870. +++ b/wpa_supplicant/wpa_supplicant.c
  17871. -@@ -2273,6 +2273,8 @@ static void wpas_start_assoc_cb(struct w
  17872. +@@ -2525,6 +2525,8 @@ static void wpas_start_assoc_cb(struct w
  17873. i++;
  17874. }
  17875. params.mcast_rate = ssid->mcast_rate;
  17876. diff --git a/package/network/services/hostapd/patches/470-survey_data_fallback.patch b/package/network/services/hostapd/patches/470-survey_data_fallback.patch
  17877. new file mode 100644
  17878. index 0000000..4e40a87
  17879. --- /dev/null
  17880. +++ b/package/network/services/hostapd/patches/470-survey_data_fallback.patch
  17881. @@ -0,0 +1,45 @@
  17882. +--- a/src/ap/acs.c
  17883. ++++ b/src/ap/acs.c
  17884. +@@ -292,18 +292,12 @@ static void acs_fail(struct hostapd_ifac
  17885. + static long double
  17886. + acs_survey_interference_factor(struct freq_survey *survey, s8 min_nf)
  17887. + {
  17888. +- long double factor, busy, total;
  17889. ++ long double factor, busy = 0, total;
  17890. +
  17891. + if (survey->filled & SURVEY_HAS_CHAN_TIME_BUSY)
  17892. + busy = survey->channel_time_busy;
  17893. + else if (survey->filled & SURVEY_HAS_CHAN_TIME_RX)
  17894. + busy = survey->channel_time_rx;
  17895. +- else {
  17896. +- /* This shouldn't really happen as survey data is checked in
  17897. +- * acs_sanity_check() */
  17898. +- wpa_printf(MSG_ERROR, "ACS: Survey data missing");
  17899. +- return 0;
  17900. +- }
  17901. +
  17902. + total = survey->channel_time;
  17903. +
  17904. +@@ -395,20 +389,19 @@ static int acs_usable_vht80_chan(struct
  17905. + static int acs_survey_is_sufficient(struct freq_survey *survey)
  17906. + {
  17907. + if (!(survey->filled & SURVEY_HAS_NF)) {
  17908. ++ survey->nf = -95;
  17909. + wpa_printf(MSG_INFO, "ACS: Survey is missing noise floor");
  17910. +- return 0;
  17911. + }
  17912. +
  17913. + if (!(survey->filled & SURVEY_HAS_CHAN_TIME)) {
  17914. ++ survey->channel_time = 0;
  17915. + wpa_printf(MSG_INFO, "ACS: Survey is missing channel time");
  17916. +- return 0;
  17917. + }
  17918. +
  17919. + if (!(survey->filled & SURVEY_HAS_CHAN_TIME_BUSY) &&
  17920. + !(survey->filled & SURVEY_HAS_CHAN_TIME_RX)) {
  17921. + wpa_printf(MSG_INFO,
  17922. + "ACS: Survey is missing RX and busy time (at least one is required)");
  17923. +- return 0;
  17924. + }
  17925. +
  17926. + return 1;
  17927. diff --git a/package/network/services/hostapd/patches/470-wait-for-nullfunc-longer.patch b/package/network/services/hostapd/patches/470-wait-for-nullfunc-longer.patch
  17928. deleted file mode 100644
  17929. index e6bbddd..0000000
  17930. --- a/package/network/services/hostapd/patches/470-wait-for-nullfunc-longer.patch
  17931. +++ /dev/null
  17932. @@ -1,11 +0,0 @@
  17933. ---- a/src/ap/sta_info.h
  17934. -+++ b/src/ap/sta_info.h
  17935. -@@ -179,7 +179,7 @@ struct sta_info {
  17936. - * AP_DISASSOC_DELAY seconds. Similarly, the station will be deauthenticated
  17937. - * after AP_DEAUTH_DELAY seconds has passed after disassociation. */
  17938. - #define AP_MAX_INACTIVITY (5 * 60)
  17939. --#define AP_DISASSOC_DELAY (1)
  17940. -+#define AP_DISASSOC_DELAY (3)
  17941. - #define AP_DEAUTH_DELAY (1)
  17942. - /* Number of seconds to keep STA entry with Authenticated flag after it has
  17943. - * been disassociated. */
  17944. diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch b/package/network/services/hostapd/patches/600-ubus_support.patch
  17945. index df2eac8..feacdf2 100644
  17946. --- a/package/network/services/hostapd/patches/600-ubus_support.patch
  17947. +++ b/package/network/services/hostapd/patches/600-ubus_support.patch
  17948. @@ -1,6 +1,6 @@
  17949. --- a/hostapd/Makefile
  17950. +++ b/hostapd/Makefile
  17951. -@@ -121,6 +121,11 @@ OBJS += ../src/common/hw_features_common
  17952. +@@ -157,6 +157,11 @@ OBJS += ../src/common/hw_features_common
  17953. OBJS += ../src/eapol_auth/eapol_auth_sm.o
  17954. @@ -22,7 +22,7 @@
  17955. struct wpa_ctrl_dst;
  17956. struct radius_server_data;
  17957. -@@ -103,6 +104,7 @@ struct hostapd_data {
  17958. +@@ -118,6 +119,7 @@ struct hostapd_data {
  17959. struct hostapd_iface *iface;
  17960. struct hostapd_config *iconf;
  17961. struct hostapd_bss_config *conf;
  17962. @@ -30,7 +30,7 @@
  17963. int interface_added; /* virtual interface added for this BSS */
  17964. unsigned int started:1;
  17965. unsigned int disabled:1;
  17966. -@@ -286,6 +288,8 @@ struct hostapd_iface {
  17967. +@@ -323,6 +325,8 @@ struct hostapd_iface {
  17968. struct hostapd_config *conf;
  17969. char phy[16]; /* Name of the PHY (radio) */
  17970. @@ -41,10 +41,10 @@
  17971. HAPD_IFACE_DISABLED,
  17972. --- /dev/null
  17973. +++ b/src/ap/ubus.c
  17974. -@@ -0,0 +1,511 @@
  17975. +@@ -0,0 +1,536 @@
  17976. +/*
  17977. + * hostapd / ubus support
  17978. -+ * Copyright (c) 2013, Felix Fietkau <nbd@openwrt.org>
  17979. ++ * Copyright (c) 2013, Felix Fietkau <nbd@nbd.name>
  17980. + *
  17981. + * This software may be distributed under the terms of the BSD license.
  17982. + * See README for more details.
  17983. @@ -58,6 +58,8 @@
  17984. +#include "wps_hostapd.h"
  17985. +#include "sta_info.h"
  17986. +#include "ubus.h"
  17987. ++#include "ap_drv_ops.h"
  17988. ++#include "beacon.h"
  17989. +
  17990. +static struct ubus_context *ctx;
  17991. +static struct blob_buf b;
  17992. @@ -417,6 +419,10 @@
  17993. +{
  17994. + struct blob_attr *tb[__VENDOR_ELEMENTS_MAX];
  17995. + struct hostapd_data *hapd = get_hapd_from_object(obj);
  17996. ++ struct hostapd_bss_config *bss = hapd->conf;
  17997. ++ struct wpabuf *elems;
  17998. ++ const char *pos;
  17999. ++ size_t len;
  18000. +
  18001. + blobmsg_parse(ve_policy, __VENDOR_ELEMENTS_MAX, tb,
  18002. + blob_data(msg), blob_len(msg));
  18003. @@ -424,10 +430,29 @@
  18004. + if (!tb[VENDOR_ELEMENTS])
  18005. + return UBUS_STATUS_INVALID_ARGUMENT;
  18006. +
  18007. -+ const char *vendor_elements = blobmsg_data(tb[VENDOR_ELEMENTS]);
  18008. -+ if (hostapd_set_iface(hapd->iconf, hapd->conf, "vendor_elements",
  18009. -+ vendor_elements) != 0)
  18010. -+ return UBUS_STATUS_NOT_SUPPORTED;
  18011. ++ pos = blobmsg_data(tb[VENDOR_ELEMENTS]);
  18012. ++ len = os_strlen(pos);
  18013. ++ if (len & 0x01)
  18014. ++ return UBUS_STATUS_INVALID_ARGUMENT;
  18015. ++
  18016. ++ len /= 2;
  18017. ++ if (len == 0) {
  18018. ++ wpabuf_free(bss->vendor_elements);
  18019. ++ bss->vendor_elements = NULL;
  18020. ++ return 0;
  18021. ++ }
  18022. ++
  18023. ++ elems = wpabuf_alloc(len);
  18024. ++ if (elems == NULL)
  18025. ++ return 1;
  18026. ++
  18027. ++ if (hexstr2bin(pos, wpabuf_put(elems, len), len)) {
  18028. ++ wpabuf_free(elems);
  18029. ++ return UBUS_STATUS_INVALID_ARGUMENT;
  18030. ++ }
  18031. ++
  18032. ++ wpabuf_free(bss->vendor_elements);
  18033. ++ bss->vendor_elements = elems;
  18034. +
  18035. + /* update beacons if vendor elements were set successfully */
  18036. + if (ieee802_11_update_beacons(hapd->iface) != 0)
  18037. @@ -558,7 +583,7 @@
  18038. @@ -0,0 +1,78 @@
  18039. +/*
  18040. + * hostapd / ubus support
  18041. -+ * Copyright (c) 2013, Felix Fietkau <nbd@openwrt.org>
  18042. ++ * Copyright (c) 2013, Felix Fietkau <nbd@nbd.name>
  18043. + *
  18044. + * This software may be distributed under the terms of the BSD license.
  18045. + * See README for more details.
  18046. @@ -636,7 +661,7 @@
  18047. +#endif
  18048. --- a/src/ap/hostapd.c
  18049. +++ b/src/ap/hostapd.c
  18050. -@@ -277,6 +277,7 @@ static void hostapd_free_hapd_data(struc
  18051. +@@ -284,6 +284,7 @@ static void hostapd_free_hapd_data(struc
  18052. hapd->started = 0;
  18053. wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface);
  18054. @@ -644,7 +669,7 @@
  18055. iapp_deinit(hapd->iapp);
  18056. hapd->iapp = NULL;
  18057. accounting_deinit(hapd);
  18058. -@@ -1098,6 +1099,8 @@ static int hostapd_setup_bss(struct host
  18059. +@@ -1139,6 +1140,8 @@ static int hostapd_setup_bss(struct host
  18060. if (hapd->driver && hapd->driver->set_operstate)
  18061. hapd->driver->set_operstate(hapd->drv_priv, 1);
  18062. @@ -653,7 +678,7 @@
  18063. return 0;
  18064. }
  18065. -@@ -1384,6 +1387,7 @@ int hostapd_setup_interface_complete(str
  18066. +@@ -1664,6 +1667,7 @@ static int hostapd_setup_interface_compl
  18067. if (err)
  18068. goto fail;
  18069. @@ -661,15 +686,15 @@
  18070. wpa_printf(MSG_DEBUG, "Completing interface initialization");
  18071. if (iface->conf->channel) {
  18072. #ifdef NEED_AP_MLME
  18073. -@@ -1544,6 +1548,7 @@ dfs_offload:
  18074. +@@ -1844,6 +1848,7 @@ dfs_offload:
  18075. fail:
  18076. wpa_printf(MSG_ERROR, "Interface initialization failed");
  18077. + hostapd_ubus_free_iface(iface);
  18078. hostapd_set_state(iface, HAPD_IFACE_DISABLED);
  18079. wpa_msg(hapd->msg_ctx, MSG_INFO, AP_EVENT_DISABLED);
  18080. - if (iface->interfaces && iface->interfaces->terminate_on_error)
  18081. -@@ -1873,6 +1878,7 @@ void hostapd_interface_deinit_free(struc
  18082. + #ifdef CONFIG_FST
  18083. +@@ -2277,6 +2282,7 @@ void hostapd_interface_deinit_free(struc
  18084. (unsigned int) iface->conf->num_bss);
  18085. driver = iface->bss[0]->driver;
  18086. drv_priv = iface->bss[0]->drv_priv;
  18087. @@ -679,7 +704,7 @@
  18088. __func__, driver, drv_priv);
  18089. --- a/src/ap/ieee802_11.c
  18090. +++ b/src/ap/ieee802_11.c
  18091. -@@ -881,7 +881,8 @@ int auth_sae_init_committed(struct hosta
  18092. +@@ -980,7 +980,8 @@ int auth_sae_init_committed(struct hosta
  18093. static void handle_auth(struct hostapd_data *hapd,
  18094. @@ -689,7 +714,7 @@
  18095. {
  18096. u16 auth_alg, auth_transaction, status_code;
  18097. u16 resp = WLAN_STATUS_SUCCESS;
  18098. -@@ -897,6 +898,11 @@ static void handle_auth(struct hostapd_d
  18099. +@@ -996,6 +997,11 @@ static void handle_auth(struct hostapd_d
  18100. char *identity = NULL;
  18101. char *radius_cui = NULL;
  18102. u16 seq_ctrl;
  18103. @@ -699,9 +724,9 @@
  18104. + .frame_info = fi,
  18105. + };
  18106. - if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.auth)) {
  18107. - wpa_printf(MSG_INFO, "handle_auth - too short payload (len=%lu)",
  18108. -@@ -983,6 +989,14 @@ static void handle_auth(struct hostapd_d
  18109. + os_memset(&vlan_id, 0, sizeof(vlan_id));
  18110. +
  18111. +@@ -1149,6 +1155,14 @@ static void handle_auth(struct hostapd_d
  18112. resp = WLAN_STATUS_UNSPECIFIED_FAILURE;
  18113. goto fail;
  18114. }
  18115. @@ -716,7 +741,7 @@
  18116. if (res == HOSTAPD_ACL_PENDING) {
  18117. wpa_printf(MSG_DEBUG, "Authentication frame from " MACSTR
  18118. " waiting for an external authentication",
  18119. -@@ -1694,13 +1708,18 @@ static void send_assoc_resp(struct hosta
  18120. +@@ -2033,13 +2047,18 @@ static u16 send_assoc_resp(struct hostap
  18121. static void handle_assoc(struct hostapd_data *hapd,
  18122. const struct ieee80211_mgmt *mgmt, size_t len,
  18123. @@ -724,7 +749,7 @@
  18124. + int reassoc, struct hostapd_frame_info *fi)
  18125. {
  18126. u16 capab_info, listen_interval, seq_ctrl, fc;
  18127. - u16 resp = WLAN_STATUS_SUCCESS;
  18128. + u16 resp = WLAN_STATUS_SUCCESS, reply_res;
  18129. const u8 *pos;
  18130. int left, i;
  18131. struct sta_info *sta;
  18132. @@ -736,9 +761,9 @@
  18133. if (len < IEEE80211_HDRLEN + (reassoc ? sizeof(mgmt->u.reassoc_req) :
  18134. sizeof(mgmt->u.assoc_req))) {
  18135. -@@ -1820,6 +1839,13 @@ static void handle_assoc(struct hostapd_
  18136. - goto fail;
  18137. +@@ -2159,6 +2178,13 @@ static void handle_assoc(struct hostapd_
  18138. }
  18139. + #endif /* CONFIG_MBO */
  18140. + if (hostapd_ubus_handle_event(hapd, &req)) {
  18141. + wpa_printf(MSG_DEBUG, "Station " MACSTR " assoc rejected by ubus handler.\n",
  18142. @@ -747,10 +772,10 @@
  18143. + goto fail;
  18144. + }
  18145. +
  18146. - sta->capability = capab_info;
  18147. - sta->listen_interval = listen_interval;
  18148. -
  18149. -@@ -2236,7 +2262,7 @@ int ieee802_11_mgmt(struct hostapd_data
  18150. + /*
  18151. + * sta->capability is used in check_assoc_ies() for RRM enabled
  18152. + * capability element.
  18153. +@@ -2639,7 +2665,7 @@ int ieee802_11_mgmt(struct hostapd_data
  18154. if (stype == WLAN_FC_STYPE_PROBE_REQ) {
  18155. @@ -759,7 +784,7 @@
  18156. return 1;
  18157. }
  18158. -@@ -2251,17 +2277,17 @@ int ieee802_11_mgmt(struct hostapd_data
  18159. +@@ -2657,17 +2683,17 @@ int ieee802_11_mgmt(struct hostapd_data
  18160. switch (stype) {
  18161. case WLAN_FC_STYPE_AUTH:
  18162. wpa_printf(MSG_DEBUG, "mgmt::auth");
  18163. @@ -782,7 +807,7 @@
  18164. case WLAN_FC_STYPE_DISASSOC:
  18165. --- a/src/ap/beacon.c
  18166. +++ b/src/ap/beacon.c
  18167. -@@ -542,7 +542,7 @@ static enum ssid_match_result ssid_match
  18168. +@@ -675,7 +675,7 @@ sta_track_seen_on(struct hostapd_iface *
  18169. void handle_probe_req(struct hostapd_data *hapd,
  18170. const struct ieee80211_mgmt *mgmt, size_t len,
  18171. @@ -791,22 +816,23 @@
  18172. {
  18173. u8 *resp;
  18174. struct ieee802_11_elems elems;
  18175. -@@ -550,8 +550,14 @@ void handle_probe_req(struct hostapd_dat
  18176. - size_t ie_len;
  18177. - struct sta_info *sta = NULL;
  18178. +@@ -684,9 +684,15 @@ void handle_probe_req(struct hostapd_dat
  18179. size_t i, resp_len;
  18180. -+ int ssi_signal = fi->ssi_signal;
  18181. int noack;
  18182. enum ssid_match_result res;
  18183. ++ int ssi_signal = fi->ssi_signal;
  18184. + int ret;
  18185. + u16 csa_offs[2];
  18186. + size_t csa_offs_len;
  18187. + struct hostapd_ubus_request req = {
  18188. + .type = HOSTAPD_UBUS_PROBE_REQ,
  18189. + .mgmt_frame = mgmt,
  18190. + .frame_info = fi,
  18191. + };
  18192. - ie = mgmt->u.probe_req.variable;
  18193. - if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.probe_req))
  18194. -@@ -710,6 +716,12 @@ void handle_probe_req(struct hostapd_dat
  18195. + if (len < IEEE80211_HDRLEN)
  18196. + return;
  18197. +@@ -838,6 +844,12 @@ void handle_probe_req(struct hostapd_dat
  18198. }
  18199. #endif /* CONFIG_P2P */
  18200. @@ -832,7 +858,7 @@
  18201. int ieee802_11_update_beacons(struct hostapd_iface *iface);
  18202. --- a/src/ap/drv_callbacks.c
  18203. +++ b/src/ap/drv_callbacks.c
  18204. -@@ -49,6 +49,10 @@ int hostapd_notif_assoc(struct hostapd_d
  18205. +@@ -52,6 +52,10 @@ int hostapd_notif_assoc(struct hostapd_d
  18206. u16 reason = WLAN_REASON_UNSPECIFIED;
  18207. u16 status = WLAN_STATUS_SUCCESS;
  18208. const u8 *p2p_dev_addr = NULL;
  18209. @@ -843,9 +869,9 @@
  18210. if (addr == NULL) {
  18211. /*
  18212. -@@ -113,6 +117,12 @@ int hostapd_notif_assoc(struct hostapd_d
  18213. +@@ -124,6 +128,12 @@ int hostapd_notif_assoc(struct hostapd_d
  18214. + goto fail;
  18215. }
  18216. - sta->flags &= ~(WLAN_STA_WPS | WLAN_STA_MAYBE_WPS | WLAN_STA_WPS2);
  18217. + if (hostapd_ubus_handle_event(hapd, &req)) {
  18218. + wpa_printf(MSG_DEBUG, "Station " MACSTR " assoc rejected by ubus handler.\n",
  18219. diff --git a/package/network/utils/iw/Makefile b/package/network/utils/iw/Makefile
  18220. index ad82081..d17cbca 100644
  18221. --- a/package/network/utils/iw/Makefile
  18222. +++ b/package/network/utils/iw/Makefile
  18223. @@ -12,10 +12,10 @@ PKG_VERSION:=4.3
  18224. PKG_RELEASE:=1
  18225. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  18226. -PKG_SOURCE_URL:=https://www.kernel.org/pub/software/network/iw
  18227. +PKG_SOURCE_URL:=@KERNEL/software/network/iw
  18228. PKG_MD5SUM:=7adec72e91ebdd9c55429fa34a23a6f5
  18229. -PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
  18230. +PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  18231. PKG_LICENSE:=GPL-2.0
  18232. include $(INCLUDE_DIR)/package.mk
  18233. diff --git a/package/network/utils/iw/patches/001-nl80211_h_sync.patch b/package/network/utils/iw/patches/001-nl80211_h_sync.patch
  18234. index 7de2258..e5ea8f7 100644
  18235. --- a/package/network/utils/iw/patches/001-nl80211_h_sync.patch
  18236. +++ b/package/network/utils/iw/patches/001-nl80211_h_sync.patch
  18237. @@ -8,7 +8,17 @@
  18238. *
  18239. * Permission to use, copy, modify, and/or distribute this software for any
  18240. * purpose with or without fee is hereby granted, provided that the above
  18241. -@@ -328,7 +329,15 @@
  18242. +@@ -321,14 +322,24 @@
  18243. + * @NL80211_CMD_GET_SCAN: get scan results
  18244. + * @NL80211_CMD_TRIGGER_SCAN: trigger a new scan with the given parameters
  18245. + * %NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the
  18246. +- * probe requests at CCK rate or not.
  18247. ++ * probe requests at CCK rate or not. %NL80211_ATTR_MAC can be used to
  18248. ++ * specify a BSSID to scan for; if not included, the wildcard BSSID will
  18249. ++ * be used.
  18250. + * @NL80211_CMD_NEW_SCAN_RESULTS: scan notification (as a reply to
  18251. + * NL80211_CMD_GET_SCAN and on the "scan" multicast group)
  18252. + * @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons,
  18253. * partial scan results may be available
  18254. *
  18255. * @NL80211_CMD_START_SCHED_SCAN: start a scheduled scan at certain
  18256. @@ -25,7 +35,82 @@
  18257. * Like with normal scans, if SSIDs (%NL80211_ATTR_SCAN_SSIDS)
  18258. * are passed, they are used in the probe requests. For
  18259. * broadcast, a broadcast SSID must be passed (ie. an empty
  18260. -@@ -1761,6 +1770,22 @@ enum nl80211_commands {
  18261. +@@ -418,7 +429,11 @@
  18262. + * @NL80211_CMD_ASSOCIATE: association request and notification; like
  18263. + * NL80211_CMD_AUTHENTICATE but for Association and Reassociation
  18264. + * (similar to MLME-ASSOCIATE.request, MLME-REASSOCIATE.request,
  18265. +- * MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitives).
  18266. ++ * MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitives). The
  18267. ++ * %NL80211_ATTR_PREV_BSSID attribute is used to specify whether the
  18268. ++ * request is for the initial association to an ESS (that attribute not
  18269. ++ * included) or for reassociation within the ESS (that attribute is
  18270. ++ * included).
  18271. + * @NL80211_CMD_DEAUTHENTICATE: deauthentication request and notification; like
  18272. + * NL80211_CMD_AUTHENTICATE but for Deauthentication frames (similar to
  18273. + * MLME-DEAUTHENTICATION.request and MLME-DEAUTHENTICATE.indication
  18274. +@@ -468,6 +483,9 @@
  18275. + * set of BSSID,frequency parameters is used (i.e., either the enforcing
  18276. + * %NL80211_ATTR_MAC,%NL80211_ATTR_WIPHY_FREQ or the less strict
  18277. + * %NL80211_ATTR_MAC_HINT and %NL80211_ATTR_WIPHY_FREQ_HINT).
  18278. ++ * %NL80211_ATTR_PREV_BSSID can be used to request a reassociation within
  18279. ++ * the ESS in case the device is already associated and an association with
  18280. ++ * a different BSS is desired.
  18281. + * Background scan period can optionally be
  18282. + * specified in %NL80211_ATTR_BG_SCAN_PERIOD,
  18283. + * if not specified default background scan configuration
  18284. +@@ -811,6 +829,10 @@
  18285. + * as an event to indicate changes for devices with wiphy-specific regdom
  18286. + * management.
  18287. + *
  18288. ++ * @NL80211_CMD_ABORT_SCAN: Stop an ongoing scan. Returns -ENOENT if a scan is
  18289. ++ * not running. The driver indicates the status of the scan through
  18290. ++ * cfg80211_scan_done().
  18291. ++ *
  18292. + * @NL80211_CMD_MAX: highest used command number
  18293. + * @__NL80211_CMD_AFTER_LAST: internal use
  18294. + */
  18295. +@@ -997,6 +1019,8 @@ enum nl80211_commands {
  18296. +
  18297. + NL80211_CMD_WIPHY_REG_CHANGE,
  18298. +
  18299. ++ NL80211_CMD_ABORT_SCAN,
  18300. ++
  18301. + /* add new commands above here */
  18302. +
  18303. + /* used to define NL80211_CMD_MAX below */
  18304. +@@ -1270,8 +1294,11 @@ enum nl80211_commands {
  18305. + * @NL80211_ATTR_RESP_IE: (Re)association response information elements as
  18306. + * sent by peer, for ROAM and successful CONNECT events.
  18307. + *
  18308. +- * @NL80211_ATTR_PREV_BSSID: previous BSSID, to be used by in ASSOCIATE
  18309. +- * commands to specify using a reassociate frame
  18310. ++ * @NL80211_ATTR_PREV_BSSID: previous BSSID, to be used in ASSOCIATE and CONNECT
  18311. ++ * commands to specify a request to reassociate within an ESS, i.e., to use
  18312. ++ * Reassociate Request frame (with the value of this attribute in the
  18313. ++ * Current AP address field) instead of Association Request frame which is
  18314. ++ * used for the initial association to an ESS.
  18315. + *
  18316. + * @NL80211_ATTR_KEY: key information in a nested attribute with
  18317. + * %NL80211_KEY_* sub-attributes
  18318. +@@ -1712,6 +1739,8 @@ enum nl80211_commands {
  18319. + * underlying device supports these minimal RRM features:
  18320. + * %NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES,
  18321. + * %NL80211_FEATURE_QUIET,
  18322. ++ * Or, if global RRM is supported, see:
  18323. ++ * %NL80211_EXT_FEATURE_RRM
  18324. + * If this flag is used, driver must add the Power Capabilities IE to the
  18325. + * association request. In addition, it must also set the RRM capability
  18326. + * flag in the association request's Capability Info field.
  18327. +@@ -1755,12 +1784,44 @@ enum nl80211_commands {
  18328. + * over all channels.
  18329. + *
  18330. + * @NL80211_ATTR_SCHED_SCAN_DELAY: delay before the first cycle of a
  18331. +- * scheduled scan (or a WoWLAN net-detect scan) is started, u32
  18332. +- * in seconds.
  18333. ++ * scheduled scan is started. Or the delay before a WoWLAN
  18334. ++ * net-detect scan is started, counting from the moment the
  18335. ++ * system is suspended. This value is a u32, in seconds.
  18336. +
  18337. * @NL80211_ATTR_REG_INDOOR: flag attribute, if set indicates that the device
  18338. * is operating in an indoor environment.
  18339. *
  18340. @@ -41,6 +126,21 @@
  18341. + * thus it must not specify the number of iterations, only the interval
  18342. + * between scans. The scan plans are executed sequentially.
  18343. + * Each scan plan is a nested attribute of &enum nl80211_sched_scan_plan.
  18344. ++ * @NL80211_ATTR_PBSS: flag attribute. If set it means operate
  18345. ++ * in a PBSS. Specified in %NL80211_CMD_CONNECT to request
  18346. ++ * connecting to a PCP, and in %NL80211_CMD_START_AP to start
  18347. ++ * a PCP instead of AP. Relevant for DMG networks only.
  18348. ++ * @NL80211_ATTR_BSS_SELECT: nested attribute for driver supporting the
  18349. ++ * BSS selection feature. When used with %NL80211_CMD_GET_WIPHY it contains
  18350. ++ * attributes according &enum nl80211_bss_select_attr to indicate what
  18351. ++ * BSS selection behaviours are supported. When used with %NL80211_CMD_CONNECT
  18352. ++ * it contains the behaviour-specific attribute containing the parameters for
  18353. ++ * BSS selection to be done by driver and/or firmware.
  18354. ++ *
  18355. ++ * @NL80211_ATTR_STA_SUPPORT_P2P_PS: whether P2P PS mechanism supported
  18356. ++ * or not. u8, one of the values of &enum nl80211_sta_p2p_ps_status
  18357. ++ *
  18358. ++ * @NL80211_ATTR_PAD: attribute used for padding for 64-bit alignment
  18359. + *
  18360. + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
  18361. + * transmit power to stay within regulatory limits. u32, dBi.
  18362. @@ -48,7 +148,7 @@
  18363. * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  18364. * @NL80211_ATTR_MAX: highest attribute number currently defined
  18365. * @__NL80211_ATTR_AFTER_LAST: internal use
  18366. -@@ -2130,6 +2155,13 @@ enum nl80211_attrs {
  18367. +@@ -2130,6 +2191,21 @@ enum nl80211_attrs {
  18368. NL80211_ATTR_REG_INDOOR,
  18369. @@ -57,30 +157,147 @@
  18370. + NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS,
  18371. + NL80211_ATTR_SCHED_SCAN_PLANS,
  18372. +
  18373. ++ NL80211_ATTR_PBSS,
  18374. ++
  18375. ++ NL80211_ATTR_BSS_SELECT,
  18376. ++
  18377. ++ NL80211_ATTR_STA_SUPPORT_P2P_PS,
  18378. ++
  18379. ++ NL80211_ATTR_PAD,
  18380. ++
  18381. + NL80211_ATTR_WIPHY_ANTENNA_GAIN,
  18382. +
  18383. /* add attributes here, update the policy in nl80211.c */
  18384. __NL80211_ATTR_AFTER_LAST,
  18385. -@@ -3364,6 +3396,9 @@ enum nl80211_bss_scan_width {
  18386. +@@ -2273,6 +2349,20 @@ enum nl80211_sta_flags {
  18387. + NL80211_STA_FLAG_MAX = __NL80211_STA_FLAG_AFTER_LAST - 1
  18388. + };
  18389. +
  18390. ++/**
  18391. ++ * enum nl80211_sta_p2p_ps_status - station support of P2P PS
  18392. ++ *
  18393. ++ * @NL80211_P2P_PS_UNSUPPORTED: station doesn't support P2P PS mechanism
  18394. ++ * @@NL80211_P2P_PS_SUPPORTED: station supports P2P PS mechanism
  18395. ++ * @NUM_NL80211_P2P_PS_STATUS: number of values
  18396. ++ */
  18397. ++enum nl80211_sta_p2p_ps_status {
  18398. ++ NL80211_P2P_PS_UNSUPPORTED = 0,
  18399. ++ NL80211_P2P_PS_SUPPORTED,
  18400. ++
  18401. ++ NUM_NL80211_P2P_PS_STATUS,
  18402. ++};
  18403. ++
  18404. + #define NL80211_STA_FLAG_MAX_OLD_API NL80211_STA_FLAG_TDLS_PEER
  18405. +
  18406. + /**
  18407. +@@ -2430,6 +2520,9 @@ enum nl80211_sta_bss_param {
  18408. + * TID+1 and the special TID 16 (i.e. value 17) is used for non-QoS frames;
  18409. + * each one of those is again nested with &enum nl80211_tid_stats
  18410. + * attributes carrying the actual values.
  18411. ++ * @NL80211_STA_INFO_RX_DURATION: aggregate PPDU duration for all frames
  18412. ++ * received from the station (u64, usec)
  18413. ++ * @NL80211_STA_INFO_PAD: attribute used for padding for 64-bit alignment
  18414. + * @__NL80211_STA_INFO_AFTER_LAST: internal
  18415. + * @NL80211_STA_INFO_MAX: highest possible station info attribute
  18416. + */
  18417. +@@ -2466,6 +2559,8 @@ enum nl80211_sta_info {
  18418. + NL80211_STA_INFO_BEACON_RX,
  18419. + NL80211_STA_INFO_BEACON_SIGNAL_AVG,
  18420. + NL80211_STA_INFO_TID_STATS,
  18421. ++ NL80211_STA_INFO_RX_DURATION,
  18422. ++ NL80211_STA_INFO_PAD,
  18423. +
  18424. + /* keep last */
  18425. + __NL80211_STA_INFO_AFTER_LAST,
  18426. +@@ -2482,6 +2577,7 @@ enum nl80211_sta_info {
  18427. + * transmitted MSDUs (not counting the first attempt; u64)
  18428. + * @NL80211_TID_STATS_TX_MSDU_FAILED: number of failed transmitted
  18429. + * MSDUs (u64)
  18430. ++ * @NL80211_TID_STATS_PAD: attribute used for padding for 64-bit alignment
  18431. + * @NUM_NL80211_TID_STATS: number of attributes here
  18432. + * @NL80211_TID_STATS_MAX: highest numbered attribute here
  18433. + */
  18434. +@@ -2491,6 +2587,7 @@ enum nl80211_tid_stats {
  18435. + NL80211_TID_STATS_TX_MSDU,
  18436. + NL80211_TID_STATS_TX_MSDU_RETRIES,
  18437. + NL80211_TID_STATS_TX_MSDU_FAILED,
  18438. ++ NL80211_TID_STATS_PAD,
  18439. +
  18440. + /* keep last */
  18441. + NUM_NL80211_TID_STATS,
  18442. +@@ -2927,6 +3024,7 @@ enum nl80211_user_reg_hint_type {
  18443. + * transmitting data (on channel or globally)
  18444. + * @NL80211_SURVEY_INFO_TIME_SCAN: time the radio spent for scan
  18445. + * (on this channel or globally)
  18446. ++ * @NL80211_SURVEY_INFO_PAD: attribute used for padding for 64-bit alignment
  18447. + * @NL80211_SURVEY_INFO_MAX: highest survey info attribute number
  18448. + * currently defined
  18449. + * @__NL80211_SURVEY_INFO_AFTER_LAST: internal use
  18450. +@@ -2942,6 +3040,7 @@ enum nl80211_survey_info {
  18451. + NL80211_SURVEY_INFO_TIME_RX,
  18452. + NL80211_SURVEY_INFO_TIME_TX,
  18453. + NL80211_SURVEY_INFO_TIME_SCAN,
  18454. ++ NL80211_SURVEY_INFO_PAD,
  18455. +
  18456. + /* keep last */
  18457. + __NL80211_SURVEY_INFO_AFTER_LAST,
  18458. +@@ -3364,6 +3463,10 @@ enum nl80211_bss_scan_width {
  18459. * (not present if no beacon frame has been received yet)
  18460. * @NL80211_BSS_PRESP_DATA: the data in @NL80211_BSS_INFORMATION_ELEMENTS and
  18461. * @NL80211_BSS_TSF is known to be from a probe response (flag attribute)
  18462. + * @NL80211_BSS_LAST_SEEN_BOOTTIME: CLOCK_BOOTTIME timestamp when this entry
  18463. + * was last updated by a received frame. The value is expected to be
  18464. + * accurate to about 10ms. (u64, nanoseconds)
  18465. ++ * @NL80211_BSS_PAD: attribute used for padding for 64-bit alignment
  18466. * @__NL80211_BSS_AFTER_LAST: internal
  18467. * @NL80211_BSS_MAX: highest BSS attribute
  18468. */
  18469. -@@ -3383,6 +3418,7 @@ enum nl80211_bss {
  18470. +@@ -3383,6 +3486,8 @@ enum nl80211_bss {
  18471. NL80211_BSS_CHAN_WIDTH,
  18472. NL80211_BSS_BEACON_TSF,
  18473. NL80211_BSS_PRESP_DATA,
  18474. + NL80211_BSS_LAST_SEEN_BOOTTIME,
  18475. ++ NL80211_BSS_PAD,
  18476. /* keep last */
  18477. __NL80211_BSS_AFTER_LAST,
  18478. -@@ -4589,4 +4625,28 @@ enum nl80211_tdls_peer_capability {
  18479. +@@ -3568,11 +3673,15 @@ enum nl80211_txrate_gi {
  18480. + * @NL80211_BAND_2GHZ: 2.4 GHz ISM band
  18481. + * @NL80211_BAND_5GHZ: around 5 GHz band (4.9 - 5.7 GHz)
  18482. + * @NL80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz)
  18483. ++ * @NUM_NL80211_BANDS: number of bands, avoid using this in userspace
  18484. ++ * since newer kernel versions may support more bands
  18485. + */
  18486. + enum nl80211_band {
  18487. + NL80211_BAND_2GHZ,
  18488. + NL80211_BAND_5GHZ,
  18489. + NL80211_BAND_60GHZ,
  18490. ++
  18491. ++ NUM_NL80211_BANDS,
  18492. + };
  18493. +
  18494. + /**
  18495. +@@ -4358,12 +4467,18 @@ enum nl80211_feature_flags {
  18496. + /**
  18497. + * enum nl80211_ext_feature_index - bit index of extended features.
  18498. + * @NL80211_EXT_FEATURE_VHT_IBSS: This driver supports IBSS with VHT datarates.
  18499. ++ * @NL80211_EXT_FEATURE_RRM: This driver supports RRM. When featured, user can
  18500. ++ * can request to use RRM (see %NL80211_ATTR_USE_RRM) with
  18501. ++ * %NL80211_CMD_ASSOCIATE and %NL80211_CMD_CONNECT requests, which will set
  18502. ++ * the ASSOC_REQ_USE_RRM flag in the association request even if
  18503. ++ * NL80211_FEATURE_QUIET is not advertized.
  18504. + *
  18505. + * @NUM_NL80211_EXT_FEATURES: number of extended features.
  18506. + * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
  18507. + */
  18508. + enum nl80211_ext_feature_index {
  18509. + NL80211_EXT_FEATURE_VHT_IBSS,
  18510. ++ NL80211_EXT_FEATURE_RRM,
  18511. +
  18512. + /* add new features before the definition below */
  18513. + NUM_NL80211_EXT_FEATURES,
  18514. +@@ -4589,4 +4704,72 @@ enum nl80211_tdls_peer_capability {
  18515. NL80211_TDLS_PEER_WMM = 1<<2,
  18516. };
  18517. @@ -108,4 +325,48 @@
  18518. + __NL80211_SCHED_SCAN_PLAN_AFTER_LAST - 1
  18519. +};
  18520. +
  18521. ++/**
  18522. ++ * struct nl80211_bss_select_rssi_adjust - RSSI adjustment parameters.
  18523. ++ *
  18524. ++ * @band: band of BSS that must match for RSSI value adjustment.
  18525. ++ * @delta: value used to adjust the RSSI value of matching BSS.
  18526. ++ */
  18527. ++struct nl80211_bss_select_rssi_adjust {
  18528. ++ __u8 band;
  18529. ++ __s8 delta;
  18530. ++} __attribute__((packed));
  18531. ++
  18532. ++/**
  18533. ++ * enum nl80211_bss_select_attr - attributes for bss selection.
  18534. ++ *
  18535. ++ * @__NL80211_BSS_SELECT_ATTR_INVALID: reserved.
  18536. ++ * @NL80211_BSS_SELECT_ATTR_RSSI: Flag indicating only RSSI-based BSS selection
  18537. ++ * is requested.
  18538. ++ * @NL80211_BSS_SELECT_ATTR_BAND_PREF: attribute indicating BSS
  18539. ++ * selection should be done such that the specified band is preferred.
  18540. ++ * When there are multiple BSS-es in the preferred band, the driver
  18541. ++ * shall use RSSI-based BSS selection as a second step. The value of
  18542. ++ * this attribute is according to &enum nl80211_band (u32).
  18543. ++ * @NL80211_BSS_SELECT_ATTR_RSSI_ADJUST: When present the RSSI level for
  18544. ++ * BSS-es in the specified band is to be adjusted before doing
  18545. ++ * RSSI-based BSS selection. The attribute value is a packed structure
  18546. ++ * value as specified by &struct nl80211_bss_select_rssi_adjust.
  18547. ++ * @NL80211_BSS_SELECT_ATTR_MAX: highest bss select attribute number.
  18548. ++ * @__NL80211_BSS_SELECT_ATTR_AFTER_LAST: internal use.
  18549. ++ *
  18550. ++ * One and only one of these attributes are found within %NL80211_ATTR_BSS_SELECT
  18551. ++ * for %NL80211_CMD_CONNECT. It specifies the required BSS selection behaviour
  18552. ++ * which the driver shall use.
  18553. ++ */
  18554. ++enum nl80211_bss_select_attr {
  18555. ++ __NL80211_BSS_SELECT_ATTR_INVALID,
  18556. ++ NL80211_BSS_SELECT_ATTR_RSSI,
  18557. ++ NL80211_BSS_SELECT_ATTR_BAND_PREF,
  18558. ++ NL80211_BSS_SELECT_ATTR_RSSI_ADJUST,
  18559. ++
  18560. ++ /* keep last */
  18561. ++ __NL80211_BSS_SELECT_ATTR_AFTER_LAST,
  18562. ++ NL80211_BSS_SELECT_ATTR_MAX = __NL80211_BSS_SELECT_ATTR_AFTER_LAST - 1
  18563. ++};
  18564. ++
  18565. #endif /* __LINUX_NL80211_H */
  18566. 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
  18567. index 574c490..2cdf360 100644
  18568. --- a/package/network/utils/iw/patches/300-display_interface_TX_power.patch
  18569. +++ b/package/network/utils/iw/patches/300-display_interface_TX_power.patch
  18570. @@ -12,11 +12,9 @@ Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  18571. interface.c | 7 +++++++
  18572. 1 file changed, 7 insertions(+)
  18573. -diff --git a/interface.c b/interface.c
  18574. -index 73ccecd..4f0821d 100644
  18575. --- a/interface.c
  18576. +++ b/interface.c
  18577. -@@ -368,6 +368,13 @@ static int print_iface_handler(struct nl_msg *msg, void *arg)
  18578. +@@ -368,6 +368,13 @@ static int print_iface_handler(struct nl
  18579. printf("\n");
  18580. }
  18581. diff --git a/package/network/utils/iw/patches/301-ibss_add_VHT80.patch b/package/network/utils/iw/patches/301-ibss_add_VHT80.patch
  18582. index 709fbb2..0627bcc 100644
  18583. --- a/package/network/utils/iw/patches/301-ibss_add_VHT80.patch
  18584. +++ b/package/network/utils/iw/patches/301-ibss_add_VHT80.patch
  18585. @@ -14,8 +14,6 @@ Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  18586. ibss.c | 49 +++++++++++++++++++++++++++++++++++++++++--------
  18587. 1 file changed, 41 insertions(+), 8 deletions(-)
  18588. -diff --git a/ibss.c b/ibss.c
  18589. -index 7a0b707..a99a262 100644
  18590. --- a/ibss.c
  18591. +++ b/ibss.c
  18592. @@ -16,6 +16,39 @@
  18593. @@ -58,7 +56,7 @@ index 7a0b707..a99a262 100644
  18594. static int join_ibss(struct nl80211_state *state,
  18595. struct nl_msg *msg,
  18596. int argc, char **argv,
  18597. -@@ -30,12 +63,8 @@ static int join_ibss(struct nl80211_state *state,
  18598. +@@ -30,12 +63,8 @@ static int join_ibss(struct nl80211_stat
  18599. int bintval;
  18600. int i;
  18601. unsigned long freq;
  18602. @@ -73,7 +71,7 @@ index 7a0b707..a99a262 100644
  18603. { .name = "HT20",
  18604. .width = NL80211_CHAN_WIDTH_20,
  18605. .freq1_diff = 0,
  18606. -@@ -60,6 +89,10 @@ static int join_ibss(struct nl80211_state *state,
  18607. +@@ -60,6 +89,10 @@ static int join_ibss(struct nl80211_stat
  18608. .width = NL80211_CHAN_WIDTH_10,
  18609. .freq1_diff = 0,
  18610. .chantype = -1 },
  18611. @@ -84,7 +82,7 @@ index 7a0b707..a99a262 100644
  18612. };
  18613. if (argc < 2)
  18614. -@@ -90,7 +123,7 @@ static int join_ibss(struct nl80211_state *state,
  18615. +@@ -90,7 +123,7 @@ static int join_ibss(struct nl80211_stat
  18616. NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
  18617. chanmode_selected->width);
  18618. NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ1,
  18619. 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
  18620. index fc44427..f96d5ea 100644
  18621. --- a/package/network/utils/iw/patches/302-ibss_use_MHz_instead_MHZ.patch
  18622. +++ b/package/network/utils/iw/patches/302-ibss_use_MHz_instead_MHZ.patch
  18623. @@ -7,11 +7,9 @@ Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  18624. ibss.c | 8 ++++----
  18625. 1 file changed, 4 insertions(+), 4 deletions(-)
  18626. -diff --git a/ibss.c b/ibss.c
  18627. -index a99a262..23bda70 100644
  18628. --- a/ibss.c
  18629. +++ b/ibss.c
  18630. -@@ -81,15 +81,15 @@ static int join_ibss(struct nl80211_state *state,
  18631. +@@ -81,15 +81,15 @@ static int join_ibss(struct nl80211_stat
  18632. .width = NL80211_CHAN_WIDTH_20_NOHT,
  18633. .freq1_diff = 0,
  18634. .chantype = NL80211_CHAN_NO_HT },
  18635. diff --git a/package/network/utils/iw/patches/303-mesh_add_VHT80.patch b/package/network/utils/iw/patches/303-mesh_add_VHT80.patch
  18636. index fe8dc21..956b050 100644
  18637. --- a/package/network/utils/iw/patches/303-mesh_add_VHT80.patch
  18638. +++ b/package/network/utils/iw/patches/303-mesh_add_VHT80.patch
  18639. @@ -15,8 +15,6 @@ Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
  18640. util.c | 26 ++++++++++++++++++++++++++
  18641. 4 files changed, 43 insertions(+), 41 deletions(-)
  18642. -diff --git a/ibss.c b/ibss.c
  18643. -index 23bda70..ac06fc5 100644
  18644. --- a/ibss.c
  18645. +++ b/ibss.c
  18646. @@ -16,39 +16,6 @@
  18647. @@ -59,8 +57,6 @@ index 23bda70..ac06fc5 100644
  18648. static int join_ibss(struct nl80211_state *state,
  18649. struct nl_msg *msg,
  18650. int argc, char **argv,
  18651. -diff --git a/iw.h b/iw.h
  18652. -index cef9da8..8e1a37a 100644
  18653. --- a/iw.h
  18654. +++ b/iw.h
  18655. @@ -59,6 +59,13 @@ struct cmd {
  18656. @@ -77,7 +73,7 @@ index cef9da8..8e1a37a 100644
  18657. #define ARRAY_SIZE(ar) (sizeof(ar)/sizeof(ar[0]))
  18658. #define DIV_ROUND_UP(x, y) (((x) + (y - 1)) / (y))
  18659. -@@ -174,6 +181,8 @@ void print_ies(unsigned char *ie, int ielen, bool unknown,
  18660. +@@ -174,6 +181,8 @@ void print_ies(unsigned char *ie, int ie
  18661. void parse_bitrate(struct nlattr *bitrate_attr, char *buf, int buflen);
  18662. void iw_hexdump(const char *prefix, const __u8 *data, size_t len);
  18663. @@ -86,11 +82,9 @@ index cef9da8..8e1a37a 100644
  18664. #define SCHED_SCAN_OPTIONS "interval <in_msecs> [delay <in_secs>] " \
  18665. "[freqs <freq>+] [matches [ssid <ssid>]+]] [active [ssid <ssid>]+|passive] [randomise[=<addr>/<mask>]]"
  18666. int parse_sched_scan(struct nl_msg *msg, int *argc, char ***argv);
  18667. -diff --git a/mesh.c b/mesh.c
  18668. -index 0090530..930d58f 100644
  18669. --- a/mesh.c
  18670. +++ b/mesh.c
  18671. -@@ -439,12 +439,8 @@ static int join_mesh(struct nl80211_state *state,
  18672. +@@ -439,12 +439,8 @@ static int join_mesh(struct nl80211_stat
  18673. int bintval, dtim_period, i, n_rates = 0;
  18674. char *end, *value = NULL, *sptr = NULL;
  18675. unsigned long freq = 0;
  18676. @@ -105,7 +99,7 @@ index 0090530..930d58f 100644
  18677. { .name = "HT20",
  18678. .width = NL80211_CHAN_WIDTH_20,
  18679. .freq1_diff = 0,
  18680. -@@ -461,6 +457,10 @@ static int join_mesh(struct nl80211_state *state,
  18681. +@@ -461,6 +457,10 @@ static int join_mesh(struct nl80211_stat
  18682. .width = NL80211_CHAN_WIDTH_20_NOHT,
  18683. .freq1_diff = 0,
  18684. .chantype = NL80211_CHAN_NO_HT },
  18685. @@ -116,7 +110,7 @@ index 0090530..930d58f 100644
  18686. };
  18687. if (argc < 1)
  18688. -@@ -497,7 +497,7 @@ static int join_mesh(struct nl80211_state *state,
  18689. +@@ -497,7 +497,7 @@ static int join_mesh(struct nl80211_stat
  18690. NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
  18691. chanmode_selected->width);
  18692. NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ1,
  18693. @@ -125,7 +119,7 @@ index 0090530..930d58f 100644
  18694. if (chanmode_selected->chantype != -1)
  18695. NLA_PUT_U32(msg,
  18696. NL80211_ATTR_WIPHY_CHANNEL_TYPE,
  18697. -@@ -599,7 +599,7 @@ static int join_mesh(struct nl80211_state *state,
  18698. +@@ -599,7 +599,7 @@ static int join_mesh(struct nl80211_stat
  18699. nla_put_failure:
  18700. return -ENOBUFS;
  18701. }
  18702. @@ -134,11 +128,9 @@ index 0090530..930d58f 100644
  18703. " [basic-rates <rate in Mbps,rate2,...>]], [mcast-rate <rate in Mbps>]"
  18704. " [beacon-interval <time in TUs>] [dtim-period <value>]"
  18705. " [vendor_sync on|off] [<param>=<value>]*",
  18706. -diff --git a/util.c b/util.c
  18707. -index 4efc4c8..d75ffe0 100644
  18708. --- a/util.c
  18709. +++ b/util.c
  18710. -@@ -728,3 +728,29 @@ void iw_hexdump(const char *prefix, const __u8 *buf, size_t size)
  18711. +@@ -728,3 +728,29 @@ void iw_hexdump(const char *prefix, cons
  18712. }
  18713. printf("\n\n");
  18714. }
  18715. 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
  18716. index d382453..20bb06e 100644
  18717. --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c
  18718. +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.c
  18719. @@ -39,6 +39,18 @@ __init void ap9x_pci_setup_wmac_led_pin(unsigned wmac, int pin)
  18720. }
  18721. }
  18722. +__init void ap9x_pci_setup_wmac_led_name(unsigned wmac, const char *led_name)
  18723. +{
  18724. + switch (wmac) {
  18725. + case 0:
  18726. + ap9x_wmac0_data.led_name = led_name;
  18727. + break;
  18728. + case 1:
  18729. + ap9x_wmac1_data.led_name = led_name;
  18730. + break;
  18731. + }
  18732. +}
  18733. +
  18734. __init struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac)
  18735. {
  18736. switch (wmac) {
  18737. @@ -81,6 +93,20 @@ __init void ap9x_pci_setup_wmac_leds(unsigned wmac, struct gpio_led *leds,
  18738. }
  18739. }
  18740. +__init void ap9x_pci_setup_wmac_btns(unsigned wmac,
  18741. + struct gpio_keys_button *btns,
  18742. + unsigned num_btns, unsigned poll_interval)
  18743. +{
  18744. + struct ath9k_platform_data *ap9x_wmac_data;
  18745. +
  18746. + if (!(ap9x_wmac_data = ap9x_pci_get_wmac_data(wmac)))
  18747. + return;
  18748. +
  18749. + ap9x_wmac_data->btns = btns;
  18750. + ap9x_wmac_data->num_btns = num_btns;
  18751. + ap9x_wmac_data->btn_poll_interval = poll_interval;
  18752. +}
  18753. +
  18754. static int ap91_pci_plat_dev_init(struct pci_dev *dev)
  18755. {
  18756. switch (PCI_SLOT(dev->devfn)) {
  18757. 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
  18758. index ad288cb..d7c0185 100644
  18759. --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h
  18760. +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-ap9x-pci.h
  18761. @@ -12,6 +12,7 @@
  18762. #define _ATH79_DEV_AP9X_PCI_H
  18763. struct gpio_led;
  18764. +struct gpio_keys_button;
  18765. struct ath9k_platform_data;
  18766. #if defined(CONFIG_ATH79_DEV_AP9X_PCI)
  18767. @@ -19,6 +20,9 @@ void ap9x_pci_setup_wmac_led_pin(unsigned wmac, int pin);
  18768. void ap9x_pci_setup_wmac_gpio(unsigned wmac, u32 mask, u32 val);
  18769. void ap9x_pci_setup_wmac_leds(unsigned wmac, struct gpio_led *leds,
  18770. int num_leds);
  18771. +void ap9x_pci_setup_wmac_led_name(unsigned wmac, const char *led_name);
  18772. +void ap9x_pci_setup_wmac_btns(unsigned wmac, struct gpio_keys_button *btns,
  18773. + unsigned num_btns, unsigned poll_interval);
  18774. struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac);
  18775. void ap91_pci_init(u8 *cal_data, u8 *mac_addr);
  18776. @@ -33,6 +37,12 @@ static inline void ap9x_pci_setup_wmac_gpio(unsigned wmac,
  18777. static inline void ap9x_pci_setup_wmac_leds(unsigned wmac,
  18778. struct gpio_led *leds,
  18779. int num_leds) {}
  18780. +static inline void ap9x_pci_setup_wmac_led_name(unsigned wmac,
  18781. + const char *led_name) {}
  18782. +static inline void ap9x_pci_setup_wmac_btns(unsigned wmac,
  18783. + struct gpio_keys_button *btns,
  18784. + unsigned num_btns,
  18785. + unsigned poll_interval) {}
  18786. static inline struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac)
  18787. {
  18788. return NULL;
  18789. diff --git a/target/linux/generic/files/include/linux/ath9k_platform.h b/target/linux/generic/files/include/linux/ath9k_platform.h
  18790. index 30ce216..2c19f3b 100644
  18791. --- a/target/linux/generic/files/include/linux/ath9k_platform.h
  18792. +++ b/target/linux/generic/files/include/linux/ath9k_platform.h
  18793. @@ -31,6 +31,10 @@ struct ath9k_platform_data {
  18794. u32 gpio_mask;
  18795. u32 gpio_val;
  18796. + u32 bt_active_pin;
  18797. + u32 bt_priority_pin;
  18798. + u32 wlan_active_pin;
  18799. +
  18800. bool endian_check;
  18801. bool is_clk_25mhz;
  18802. bool tx_gain_buffalo;
  18803. @@ -45,6 +49,11 @@ struct ath9k_platform_data {
  18804. int num_leds;
  18805. const struct gpio_led *leds;
  18806. + const char *led_name;
  18807. +
  18808. + unsigned num_btns;
  18809. + const struct gpio_keys_button *btns;
  18810. + unsigned btn_poll_interval;
  18811. };
  18812. #endif /* _LINUX_ATH9K_PLATFORM_H */